Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.

Commit 381600a

Browse files
author
Nick Litwin
committed
Update copilot challenges on header dash
1 parent da2a05b commit 381600a

File tree

2 files changed

+13
-23
lines changed

2 files changed

+13
-23
lines changed

app/my-dashboard/header-dashboard/header-dashboard.controller.js

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
HeaderDashboardController.$inject = [
77
'$stateParams',
88
'NotificationService',
9-
'UserService',
109
'ProfileService',
1110
'CONSTANTS',
12-
'userIdentity'
11+
'userIdentity',
12+
'$q'
1313
];
1414

15-
function HeaderDashboardController($stateParams, NotificationService, UserService, ProfileService, CONSTANTS, userIdentity) {
15+
function HeaderDashboardController($stateParams, NotificationService, ProfileService, CONSTANTS, userIdentity, $q) {
1616
var vm = this;
1717
vm.domain = CONSTANTS.domain;
1818
vm.defaultPhotoUrl = CONSTANTS.ASSET_PREFIX + "images/avatarPlaceholder.png";
@@ -30,36 +30,26 @@
3030
function activate() {
3131
var handle = userIdentity.handle;
3232

33-
ProfileService.getUserProfile(handle)
34-
.then(function(profile) {
35-
vm.profile = profile;
36-
});
33+
$q.all([
34+
ProfileService.getUserStats(handle),
35+
ProfileService.getUserFinancials(handle)
36+
]).then(function(data) {
37+
var stats = data[0];
38+
var financials = data[1];
39+
40+
vm.moneyEarned = _.sum(_.pluck(financials, 'amount'));
3741

38-
ProfileService.getUserStats(handle)
39-
.then(function(stats) {
4042
if (stats.COPILOT != null) {
4143
vm.numCopilotActiveContests = stats.COPILOT.activeContests;
4244
} else {
4345
vm.numCopilotActiveContests = 0;
4446
}
4547

46-
vm.rankStats = ProfileService.getRanks(stats);
47-
48-
if (vm.rankStats.length === 0) {
49-
vm.hasRatings = false;
50-
}
51-
5248
vm.loading = false;
5349
})
5450
.catch(function(err) {
5551
vm.hasRatings = false;
5652
vm.loading = false;
57-
// todo handle error
58-
})
59-
60-
ProfileService.getUserFinancials(handle)
61-
.then(function(financials) {
62-
vm.moneyEarned = _.sum(_.pluck(financials, 'amount'));
6353
});
6454
}
6555
}

app/my-dashboard/header-dashboard/header-dashboard.jade

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
header
22
h1 My Dashboard
33

4-
.user-stats(id="metrics")
4+
.user-stats(id="metrics", ng-hide="vm.loading")
55
.copilot-challenges(ng-show="dashboard.isCopilot")
66
p.number(ng-bind='vm.numCopilotActiveContests')
77

8-
p Active Challenges
8+
p Copilot Challenges
99

1010
.slash(ng-show="dashboard.isCopilot")
1111

0 commit comments

Comments
 (0)