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

Commit a579807

Browse files
committedSep 20, 2017
Merge branch 'dev' into f2f-dashboard-ronakkaria-3
2 parents bf7d199 + 2553cad commit a579807

File tree

4 files changed

+34
-26
lines changed

4 files changed

+34
-26
lines changed
 

‎app/profile/profile.controller.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,11 @@ import moment from 'moment'
3838
activate()
3939

4040
// adding stats promise on scope so child states can use this.
41-
vm.statsPromise = ProfileService.getUserStats(vm.userHandle)
41+
vm.statsPromise = UserService.getV2UserProfile(vm.userHandle)
42+
.then(function(resp) {
43+
vm.profile.badges = resp
44+
return ProfileService.getUserStats(vm.userHandle)
45+
})
4246
.then(function(stats) {
4347
if (stats) {
4448
vm.stats = stats
@@ -112,10 +116,6 @@ import moment from 'moment'
112116
} else {
113117
profile.startMonth = null
114118
}
115-
UserService.getV2UserProfile(vm.userHandle).then(function(resp) {
116-
vm.profile.badges = resp
117-
})
118-
119119
}
120120

121121
function showBadges() {

‎app/services/user.service.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,17 @@ import { decodeToken } from 'tc-accounts'
119119
* Temporary end point for getting member's badges/achievements. This endpoint
120120
* should be removed once we have it in v3.
121121
*/
122-
function getV2UserProfile(handle) {
122+
function getV2UserProfile(handle, retryIter) {
123+
retryIter = retryIter || 0
123124
return ApiService.restangularV2.one('users', handle).get()
125+
.catch(function(err) {
126+
// Retry api call once if it fails with 400 or no response
127+
// This is suspected to be a backend bug as error message for 400 usually says 'User not activated'
128+
if ((err.status === 400 || err.status === -1) && retryIter < 2) {
129+
return getV2UserProfile(handle, retryIter + 1)
130+
}
131+
throw err
132+
})
124133
}
125134

126135
function getPreference(prefName) {

‎package-lock.json

Lines changed: 18 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"description": "Topcoder pages including login, registration, settings, dashboard, profile.",
44
"scripts": {
55
"build": "webpack --bail --progress --build --tc",
6-
"start": "webpack-dev-server --history-api-fallback --host 0.0.0.0 --dev --tc --inline --progress --port 3000",
6+
"start": "webpack-dev-server --history-api-fallback --host local.topcoder-dev.com --dev --tc --inline --progress --port 3000",
77
"start-prod": "webpack-dev-server --history-api-fallback --host local.topcoder.com --prod --tc --inline --progress --port 80",
88
"lint": "eslint .",
99
"test": "karma start --tc --test"

0 commit comments

Comments
 (0)
This repository has been archived.