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

Commit e75b6f0

Browse files
author
vikasrohit
committed
Merge branch 'dev' into fixes/vikas-beta-release
* dev: new default profile photo Added past challenges to design profile more fixes Fixed add skills bug Conflicts: app/directives/challenge-tile/challenge-tile.directive.jade
2 parents c60a19d + d7e518c commit e75b6f0

File tree

9 files changed

+56
-34
lines changed

9 files changed

+56
-34
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959

6060
div(ng-switch-when="MARATHON_MATCH")
6161
.marathon-score
62-
p.score {{challenge.pointTotal}}
62+
p.score {{challenge.pointTotal || 0 }
6363

6464
p Total Points
6565

app/directives/profile-widget/profile-widget.jade

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
.profile-widget-directive
22
a(ui-sref="profile.about({userHandle: profile.handle})")
3-
img.profile-circle(fallback-src="/images/avatarPlaceholder.png", ng-src="{{profile.photoURL}}")
3+
img.profile-circle(ng-if="profile.photoURL", ng-src="{{profile.photoURL}}")
4+
img.profile-circle(ng-if="!profile.photoURL", src="/images/ico-user-default.svg")
45

56
.info
67
h1.handle {{profile.handle}}

app/profile/subtrack/data/data.jade

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,14 @@
4343
.challenges(ng-hide="vm.subTrack === 'SRM'")
4444
.challenge.tile(ng-repeat="challenge in vm.challenges")
4545
challenge-tile(challenge="challenge", domain="vm.domain", view="'tile'")
46-
.div(ng-show="!vm.challenges || vm.challenges.length == 0")
47-
| No past challenges available for this user
46+
.no-challenges(ng-show="!vm.challenges || vm.challenges.length == 0")
47+
| Sorry, no successful challenges found.
4848

4949
.challenges(ng-show="vm.subTrack == 'SRM'")
5050
.challenge.tile(ng-repeat="challenge in vm.challenges")
5151
srm-tile(srm="challenge", domain="vm.domain", view="'tile'")
52-
.div(ng-show="!vm.challenges || vm.challenges.length == 0")
53-
| No past SRMs available for this user
52+
.no-challenges(ng-show="!vm.challenges || vm.challenges.length == 0")
53+
| Sorry, no rated SRMs found.
5454

5555
.stats(ng-show="vm.viewing == 'stats' && profileVm.status.stats === 'ready'")
5656
.graphs()

app/profile/subtrack/design/design.jade

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,17 @@
99
.value {{vm.typeStats.wins}}
1010
.name CHALLENGES
1111

12+
.tabs
13+
a.left(id="stats", ng-click="vm.viewing = 'stats'",
14+
ng-class="vm.viewing == 'stats' ? 'selected' : ''"
15+
) Statistics
16+
17+
a.right(id="challenges", ng-click="vm.viewing = 'challenges'",
18+
ng-class="vm.viewing == 'challenges' ? 'selected' : ''"
19+
) Challenges
20+
21+
hr
22+
1223
tc-section(
1324
ng-show="vm.viewing == 'challenges'",
1425
state="vm.status.challenges"
@@ -18,8 +29,8 @@
1829
.challenge.tile(ng-repeat="challenge in vm.challenges")
1930
challenge-tile(challenge="challenge", domain="vm.domain", view="'tile'")
2031

21-
.div(ng-show="!vm.challenges || vm.challenges.length == 0")
22-
| No past challenges available for this user
32+
.no-challenges(ng-show="!vm.challenges || vm.challenges.length == 0")
33+
| Sorry, no successful challenges found.
2334

2435
.bottom(ng-show="vm.viewing == 'stats'")
2536
h2.detailed Detailed Stats

app/profile/subtrack/develop/develop.jade

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@
4545
.challenges
4646
.challenge.tile(ng-repeat="challenge in vm.challenges")
4747
challenge-tile(challenge="challenge", domain="vm.domain", view="'tile'")
48-
.div(ng-show="!vm.challenges || vm.challenges.length == 0")
49-
| no past challenges available for this user
48+
.no-challenges(ng-show="!vm.challenges || vm.challenges.length == 0")
49+
| Sorry, no successful challenges found.
5050

5151
.stats(ng-show="vm.viewing == 'stats' && profileVm.status.stats === 'ready'")
5252
.graphs

app/services/challenge.service.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,17 @@
3131
return api.one('members', handle.toLowerCase()).all('challenges').getList(params);
3232
}
3333

34-
function getUserMarathonMatches(handle, params) {
35-
return api.one('members', handle.toLowerCase()).all('mms').getList(params);
34+
function getUserMarathonMatches(handle, params, filterUnRated) {
35+
filterUnRated = filterUnRated || true;
36+
return api.one('members', handle.toLowerCase()).all('mms').getList(params)
37+
.then(function(mms) {
38+
if (filterUnRated) {
39+
mms = _.filter(mms, function(m) {
40+
return _.isArray(m.rounds) && m.rounds.length && !_.isUndefined(m.rounds[0].userMMDetails) && m.rounds[0].userMMDetails.rated;
41+
});
42+
}
43+
return mms;
44+
});
3645
}
3746

3847
function getReviewEndDate(challengeId) {

app/services/srm.service.js

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -20,26 +20,20 @@
2020
return api.all('srms').getList(params);
2121
}
2222

23-
function getPastSRMs(userHandle, params) {
24-
return api.one('members', userHandle).all('srms').getList(params)
25-
.then(function(srms) {
26-
// var resultParams = {
27-
// filter: 'userId=' + userId
28-
// };
29-
// return getSRMResults(resultParams).then(function(results) {
30-
// var resultsMap = [];
31-
// angular.forEach(results, function(result) {
32-
// resultsMap[result['contestId']] = result;
33-
// });
34-
// angular.forEach(srms, function(srm) {
35-
// if (resultsMap[srm.id]) {
36-
// srm.result = resultsMap[srm.id];
37-
// }
38-
// });
39-
return srms;
40-
});
23+
function getPastSRMs(userHandle, params, filterUnRated) {
24+
filterUnRated = filterUnRated || true;
25+
return api.one('members', userHandle).all('srms').getList(params).then(function(srms) {
26+
// filter un rated SRMs
27+
if (filterUnRated) {
28+
srms = _.filter(srms, function(s) {
29+
return _.isArray(s.rounds) && s.rounds.length && !_.isUndefined(s.rounds[0].userSRMDetails) && s.rounds[0].userSRMDetails.rated;
30+
});
31+
}
32+
return srms;
33+
});
4134
}
4235

36+
// NOT Used deprecate
4337
function getSRMResults(params) {
4438
return api.all('srmResults').getList(params);
4539
}

app/settings/edit-profile/edit-profile.controller.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,9 @@
6565
if (skill) {
6666
var skillTagId = _.get(skill, 'originalObject.id').toString();
6767
// verify if skill has already been added
68-
var idx = _.find(vm.skills, function(s) { return s.tagId === skillTagId});
69-
if (idx < 0) {
68+
var idx = _.find(vm.skills, function(s) { return s.tagId == skillTagId});
69+
// _.find returns undefined when skill isn't found
70+
if (!idx) {
7071
// add the skill
7172
ProfileService.addUserSkill(vm.userData.handle, skillTagId).then(function(resp) {
7273
// find the new skill in response object and inject it into our existing list.

assets/css/profile/subtrack.scss

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
.profile-subtrack-container {
44
display: flex;
55
flex-direction: column;
6-
6+
77
.nav {
88
@include module-full-width;
99
background: white;
@@ -291,13 +291,19 @@
291291
width: 325px;
292292
padding: 15px;
293293
}
294+
.no-challenges {
295+
margin: 30px;
296+
@include sofia-pro-regular;
297+
font-size: 16px;
298+
color: #a3a3ae;
299+
}
294300
}
295301

296302
}
297303
}
298304
@media (min-width: 768px) {
299305
.profile-subtrack-container {
300-
306+
301307
.nav {
302308
display: flex;
303309
flex-direction: row;

0 commit comments

Comments
 (0)