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

Commit 3d9ecd6

Browse files
author
Parth Shah
committed
Merge branch 'dev' into release/v1.0.2
2 parents c9e5521 + 38a5333 commit 3d9ecd6

File tree

22 files changed

+123
-175
lines changed

22 files changed

+123
-175
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
# Topcoder-App
2+
3+
Supply rocks!
24
This repository houses any new topcoder pages or refactored Angular apps/pages from the tc-site repository.
35

46
The technologies used are Jade, SCSS, Angular, and Gulp.

app/directives/distribution-graph/distribution-graph.directive.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@
9090

9191
function resize() {
9292
if (window.innerWidth < 900 && desktop) {
93-
console.log('yo!')
9493
d3.select('.distribution-graph svg').remove();
9594
draw(mobileMeasurements, $scope.distribution);
9695
desktop = false;
@@ -151,7 +150,7 @@
151150

152151

153152
function logr(x) {
154-
console.log(x); return x;
153+
return x;
155154
}
156155
svg.append('line')
157156
.attr('x1', xScale2($scope.rating))
@@ -281,7 +280,7 @@
281280

282281
function removeLeadingZeroes(ranges) {
283282
while(ranges[0].number == 0) {
284-
ranges.shift();
283+
ranges.shift();
285284
}
286285
}
287286

@@ -304,7 +303,7 @@
304303
});
305304
return colors[0] && colors[0].darkerColor || 'black';
306305
}
307-
306+
308307
// TODO: delete because this is probably unnecessary
309308
function ratingToRange(ranges, rating) {
310309
var ans = ranges.filter(function(range) {

app/directives/external-account/external-account.directive.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,6 @@
9696
});
9797

9898
$scope.$watchCollection('externalLinks', function(newValue, oldValue) {
99-
console.log("WATCH COLLECTION EXTERNAL LINKS: ");
100-
console.log("New Value: ", newValue);
101-
console.log("Old Value: ", oldValue);
102-
10399
angular.forEach(newValue, function(link) {
104100
var provider = link.providerType;
105101

app/directives/history-graph/history-graph.directive.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -228,11 +228,9 @@
228228
.attr('stroke-width', 3)
229229

230230
function processRatingStripePoint(y) {
231-
console.log('y:' + y)
232231
if (y < padding.top || isNaN(y)) {
233232
return padding.top;
234233
} else if (y > totalH - padding.bottom) {
235-
console.log('y & ' + padding.bottom);
236234
return totalH - padding.bottom;
237235
} else {
238236
return y;
@@ -286,7 +284,7 @@
286284
});
287285
return colors[0] && colors[0].darkerColor || 'black';
288286
}
289-
287+
290288
}
291289

292290
})();

app/directives/ios-card/ios-card.directive.jade

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,19 @@
77
p {{challenge.subTrack | underscoreStrip}}
88

99
.challenge-details
10+
11+
p.currentPhase {{challenge.userCurrentPhase}}
12+
.challenge-calendar(ng-show="challenge.userCurrentPhaseEndTime")
13+
p.ends-in Ends In
14+
p.time-remaining {{challenge.userCurrentPhaseEndTime[0]}}
15+
p.unit-of-time {{challenge.userCurrentPhaseEndTime[1]}}
16+
1017
p.prize-money(ng-show="challenge.reviewType === 'PEER'") Peer Review Challenge
1118

1219
p.prize-money(ng-hide="challenge.reviewType === 'PEER'") {{challenge.totalCheckpointPrize || 0 | currency:undefined:0}}
1320

1421
p.technologies {{challenge.technologies}}
1522

16-
.challenge-calendar
17-
p.starts-in Starts In
18-
p.time-remaining 3
19-
p.unit-of-time days
20-
2123
//button.phase-action(ng-class="{'action-completed': challenge.currentPhaseActionCompleted}") Submit
2224
2325
.challenge-links

app/directives/srm-tile/srm-tile.directive.jade

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
p.points #[span {{srm.result.finalPoints }}] #[span Points]
3232
.ranks
3333
.division
34-
p.rank #[{{srm.result.divisionPlacement}}]
34+
p.rank {{srm.result.divisionPlacement}}
3535
p.label #[span Division {{srm.result.division}}]
3636
.room
3737
p.rank #[span {{srm.result.roomPlacement}}]
@@ -62,14 +62,14 @@
6262
a(ng-href="https://community.{{DOMAIN}}/tc?module=MatchDetails&rd={{srm.id}}") {{srm.name}}
6363

6464
.srm-details
65-
p.ended-on Ended #[{{srm.endDate | timeDiff:"quantity"}} {{srm.endDate | timeDiff:'unit'}}] ago
65+
p.ended-on Ended {{srm.endDate | timeDiff:"quantity"}} {{srm.endDate | timeDiff:'unit'}} ago
6666

6767
.member-stats
6868
p.points #[span {{srm.result.finalPoints }}] Points
6969

7070
.ranks
7171
.division
72-
p.rank #[{{srm.result.divisionPlacement}}]
72+
p.rank {{srm.result.divisionPlacement}}
7373
p.label #[span Div {{srm.result.division}}] #[span Placement]
7474
.room
7575
p.rank #[span {{srm.result.roomPlacement}}]

app/my-challenges/my-challenges.controller.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
activate();
3535

3636
function activate() {
37+
vm.isError = false;
3738
vm.isCopilot = _.includes(userIdentity.roles, 'copilot');
3839

3940
// watches page change counter to reload the data
@@ -77,9 +78,9 @@
7778
filter: "status=" + vm.statusFilter
7879
};
7980
vm.loading = true;
81+
8082
return ChallengeService.getUserChallenges(handle, params)
8183
.then(function(challenges){
82-
console.log(challenges.plain());
8384
if (challenges.length > 0) {
8485
vm.myChallenges = challenges;
8586
vm.userHasChallenges = true;
@@ -90,10 +91,10 @@
9091
}
9192
})
9293
.catch(function(err) {
93-
$log.error(err);
94-
vm.userHasChallenges = true;
94+
vm.userHasChallenges = false;
95+
vm.isError = true;
9596
vm.loading = false;
96-
// TODO - handle error
97+
$log.error(err);
9798
});
9899
}
99100
}

app/my-challenges/my-challenges.jade

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
.my-challenges-container
22
.my-challenges
3-
43
.nav
54
.breadcrumbs
65
.dashboard
76
a(ui-sref="dashboard") Dashboard
7+
88
.my-challenges // My Challenges
99

1010
.section-loading(ng-show="vm.loading")
1111

1212
section.noChallenges(ng-if="!vm.userHasChallenges && !vm.loading")
13-
You have not participated in any challenges yet.
13+
p(ng-hide="vm.isError") You have not participated in any challenges yet.
14+
15+
p(ng-show="vm.isError") There was an error fetching challenges. Please try again later.
1416

1517
.content
1618
section.challenges(ng-show="vm.userHasChallenges && !vm.loading")
@@ -30,5 +32,3 @@
3032

3133
.bottom
3234
tc-paginator(data="vm.myChallenges", page-params="vm.pageParams")
33-
34-
hr

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

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,12 @@
77
'$stateParams',
88
'NotificationService',
99
'ProfileService',
10-
'CONSTANTS',
11-
'userIdentity',
12-
'$q'
10+
'userIdentity'
1311
];
1412

15-
function HeaderDashboardController($stateParams, NotificationService, ProfileService, CONSTANTS, userIdentity, $q) {
13+
function HeaderDashboardController($stateParams, NotificationService, ProfileService, userIdentity) {
1614
var vm = this;
17-
vm.domain = CONSTANTS.domain;
18-
vm.isCopilot = false;
1915
vm.loading = true;
20-
vm.hasRatings = true;
21-
vm.rankStats = [];
2216

2317
if ($stateParams.notifyReset) {
2418
NotificationService.inform('Thanks. Your new password has been set.');
@@ -29,25 +23,13 @@
2923
function activate() {
3024
var handle = userIdentity.handle;
3125

32-
$q.all([
33-
ProfileService.getUserStats(handle),
34-
ProfileService.getUserFinancials(handle)
35-
]).then(function(data) {
36-
var stats = data[0];
37-
var financials = data[1];
38-
26+
ProfileService.getUserFinancials(handle)
27+
.then(function(financials) {
3928
vm.moneyEarned = _.sum(_.pluck(financials, 'amount'));
40-
41-
if (stats.COPILOT != null) {
42-
vm.numCopilotActiveContests = stats.COPILOT.activeContests;
43-
} else {
44-
vm.numCopilotActiveContests = 0;
45-
}
46-
4729
vm.loading = false;
30+
4831
})
4932
.catch(function(err) {
50-
vm.hasRatings = false;
5133
vm.loading = false;
5234
});
5335
}

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

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

44
.user-stats(id="metrics", ng-hide="vm.loading")
5-
.copilot-challenges(ng-show="dashboard.isCopilot")
6-
p.number(ng-bind='vm.numCopilotActiveContests')
7-
8-
p Copilot Challenges
9-
10-
.slash(ng-show="dashboard.isCopilot")
11-
125
.money-earned
136
p.number(ng-bind="vm.moneyEarned | currency:'$':0")
147

15-
p Won
8+
p Earned
169

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,6 @@
4242
var marathonMatches = challenges[0];
4343
var devDesignChallenges = challenges[1];
4444

45-
// console.log('MMs: ', marathonMatches.plain());
46-
// console.log('dev design challenges: ', devDesignChallenges.plain());
47-
4845
if (!marathonMatches.length && !devDesignChallenges.length) {
4946
vm.userHasChallenges = false;
5047
vm.loading = false;
@@ -53,6 +50,7 @@
5350
ChallengeService.processActiveDevDesignChallenges(devDesignChallenges);
5451
ChallengeService.processActiveMarathonMatches(marathonMatches);
5552
var userChallenges = marathonMatches.concat(devDesignChallenges);
53+
// FIX when working on marathon matches:
5654
// sort by closest deadline? .sort(function)
5755
// limit to 8 .slice(0, 8);
5856

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@
8383
}
8484

8585
vm.challenges = challenges;
86+
ChallengeService.processActiveDevDesignChallenges(vm.challenges);
8687
vm.loading = false;
8788
})
8889
.catch(function(err) {

app/my-dashboard/srms/srms.jade

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,13 @@ section(ng-hide="vm.loading")
1212
.flex-wrapper
1313
h2 Practice on past problems
1414

15-
a(href="https://arena.{{DOMAIN}}") Launch Arena
15+
a(ng-href="https://community.{{DOMAIN}}/tc?module=ProblemArchive") Problem Archives
1616

17-
a(href="https://www.{{DOMAIN}}/community/getting-started/") Learn More
17+
a(ng-href="https://community.{{DOMAIN}}/wiki/display/tc/Algorithm+Problem+Set+Analysis") Match Editorials
18+
19+
a(ng-href="https://www.{{DOMAIN}}/community/getting-started/") Learn More
1820

1921
.srms-links(ng-hide="vm.loading")
2022
a(ui-sref="my-srms") View Past SRMs
23+
24+
a(ng-href="https://arena.{{DOMAIN}}") Launch Arena

app/my-dashboard/subtrack-stats/subtrack-stats.controller.js

Lines changed: 35 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -19,29 +19,9 @@
1919

2020
ProfileService.getUserStats(vm.handle)
2121
.then(function(stats) {
22-
var subtrackRanks = [];
23-
2422
var trackRanks = ProfileService.getRanks(stats);
25-
26-
angular.forEach(trackRanks, function(subtracks, track) {
27-
if (Array.isArray(subtracks) && subtracks.length) {
28-
subtrackRanks = subtrackRanks.concat(subtracks);
29-
}
30-
});
31-
32-
angular.forEach(subtrackRanks, function(subtrack) {
33-
if (subtrack.track === 'COPILOT') {
34-
subtrack.stat = subtrack.activeContests;
35-
subtrack.statType = 'Active Contests';
36-
} else if (subtrack.track === 'DESIGN') {
37-
subtrack.stat = subtrack.wins;
38-
subtrack.statType = 'Wins';
39-
} else {
40-
subtrack.stat = subtrack.rating;
41-
subtrack.statType = 'Rating';
42-
}
43-
});
44-
console.log('subtrackRanks: ', subtrackRanks);
23+
var subtrackRanks = compileSubtracks(trackRanks);
24+
processStats(subtrackRanks);
4525

4626
vm.subtrackRanks = subtrackRanks;
4727
vm.hasRanks = !!vm.subtrackRanks.length;
@@ -52,5 +32,38 @@
5232
vm.loading = false;
5333
});
5434
}
35+
36+
function compileSubtracks(trackRanks) {
37+
return _.reduce(trackRanks, function(result, subtracks, track) {
38+
if (Array.isArray(subtracks) && subtracks.length) {
39+
if (track === 'DEVELOP') {
40+
_.remove(subtracks, function(subtrackObj) {
41+
return subtrackObj.subTrack === 'COPILOT_POSTING';
42+
});
43+
}
44+
45+
return result.concat(subtracks);
46+
47+
} else {
48+
return result;
49+
50+
}
51+
}, []);
52+
}
53+
54+
function processStats(subtrackRanks) {
55+
angular.forEach(subtrackRanks, function(subtrack) {
56+
if (subtrack.track === 'DESIGN') {
57+
subtrack.stat = subtrack.wins;
58+
subtrack.statType = 'Wins';
59+
} else if (subtrack.track === 'COPILOT') {
60+
subtrack.stat = subtrack.activeContests;
61+
subtrack.statType = 'Challenges';
62+
} else {
63+
subtrack.stat = subtrack.rating;
64+
subtrack.statType = 'Rating';
65+
}
66+
});
67+
}
5568
}
5669
})();

app/profile/profile.controller.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@
2323
'COPILOT': 'copilot'
2424
};
2525

26-
// spinnerssss
27-
$log.debug()
26+
$log.debug();
2827
vm.status = {
2928
'badges': CONSTANTS.STATE_LOADING,
3029
'stats': CONSTANTS.STATE_LOADING,
@@ -51,15 +50,13 @@
5150
vm.status.stats = CONSTANTS.STATE_ERROR;
5251
});
5352

54-
// skills
5553
vm.skillsPromise = ProfileService.getUserSkills(vm.userHandle).then(function(skills) {
5654
vm.skills = skills.skills;
5755
vm.status.skills = CONSTANTS.STATE_READY;
5856
}).catch(function(err) {
5957
vm.status.skills = CONSTANTS.STATE_ERROR;
6058
});
6159

62-
// externalLinks
6360
vm.externalLinksPromise = ExternalAccountService.getLinkedExternalLinksData(vm.userHandle).then(function(data) {
6461
vm.linkedExternalAccountsData = data.plain();
6562
console.log('EXT')

0 commit comments

Comments
 (0)