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

output from challenge 30115866 #1318

Merged
merged 1 commit into from
Feb 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/profile/profile.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe('Profile Controller', function() {

var profileService = {
getUserStats: function() {
return $q.when({result: {content: mockStats}})
return $q.when({result: {content: [mockStats]}})
},
getUserSkills: function() {
return $q.when({result: {content: mockSkills}})
Expand Down
14 changes: 9 additions & 5 deletions app/services/profile.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,15 @@ import _ from 'lodash'
}

function getUserStats(username) {
return restangular.one('members', username).one('stats').get().then(function(data) {
if (data && !data.DEVELOP) data.DEVELOP = {challenges: 0, wins: 0, subTracks: []}
if (data && !data.DESIGN) data.DESIGN = {challenges: 0, wins: 0, subTracks: []}
if (data && !data.DATA_SCIENCE) data.DATA_SCIENCE = {challenges: 0, wins: 0, SRM: {}, MARATHON_MATCH: {}}
return data
return restangular.one('members', username).one('stats').get({ groupIds: CONSTANTS.DEFAULT_GROUP_ID }).then(function(data) {
var stats = {}
if (Array.isArray(data) && data.length) {
stats = data[0]
if (!stats.DEVELOP) stats.DEVELOP = {challenges: 0, wins: 0, subTracks: []}
if (!stats.DESIGN) stats.DESIGN = {challenges: 0, wins: 0, subTracks: []}
if (!stats.DATA_SCIENCE) stats.DATA_SCIENCE = {challenges: 0, wins: 0, SRM: {}, MARATHON_MATCH: {}}
}
return stats
})
}

Expand Down
4 changes: 2 additions & 2 deletions app/services/profile.service.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ describe('Profile Service', function() {
.respond(200, {result: {content: mockProfile}})
// mock stats
$httpBackend
.when('GET', apiUrl + '/members/rakesh/stats/')
.respond(200, {result: {content: mockStats}})
.when('GET', apiUrl + '/members/rakesh/stats/?groupIds=' + CONSTANTS.DEFAULT_GROUP_ID)
.respond(200, {result: {content: [mockStats]}})

})

Expand Down
3 changes: 2 additions & 1 deletion app/topcoder.constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,6 @@ angular.module('CONSTANTS', []).constant('CONSTANTS', {
'STATUS_COMPLETED_WITHOUT_WIN' : 'Completed Without Win',
'CHALLENGES_LOADING_CHUNK' : 36,
'INFINITE_SCROLL_OFFSET' : '400', // footer is 300px and challenge tile is 400px
'VIDEO_DEFAULT_HEIGHT': 360
'VIDEO_DEFAULT_HEIGHT': 360,
'DEFAULT_GROUP_ID': 10
})