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

Commit 0b9a3c9

Browse files
author
vikasrohit
committed
Merge pull request #512 from appirio-tech/feature/quick-fixes-after-ga-release
SUP-2392, Extra spacing on profile if section is missing
2 parents 08f4747 + 3ac6e07 commit 0b9a3c9

File tree

3 files changed

+18
-6
lines changed

3 files changed

+18
-6
lines changed

app/profile/about/about.controller.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
vm.categories = profileVm.categories;
6262
vm.marathonRating = profileVm.categories['MARATHON_MATCH'] && profileVm.categories['MARATHON_MATCH'].rating;
6363
vm.SRMRating = profileVm.categories['SRM'] && profileVm.categories['SRM'].rating;
64-
vm.displaySection.stats = profileVm.showEditProfileLink || _.get(vm, 'categories.DESIGN', []).length || _.get(vm, 'categories.DEVELOP', []).length || _.get(vm, 'categories.DATA_SCIENCE', []).length || _.get(vm, 'categories.COPILOT', []).length;
64+
vm.displaySection.stats = profileVm.showEditProfileLink;
6565
});
6666

6767
profileVm.skillsPromise.then(function() {

app/profile/about/about.jade

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
.empty-profile
1414
.empty-state
15-
empty-state-placeholder(state-name="profile-empty", show="profileVm.status.skills === 'ready' && profileVm.status.stats === 'ready' && profileVm.status.externalLinks === 'ready' && !profileVm.showEditProfileLink && !profileVm.numProjects && (!profileVm.skills || (profileVm.skills && profileVm.skills.length == 0)) && !vm.hasLinks")
15+
empty-state-placeholder(state-name="profile-empty", show="profileVm.status.skills === 'ready' && profileVm.status.stats === 'ready' && profileVm.status.externalLinks === 'ready' && !profileVm.showEditProfileLink && !profileVm.showTCActivity && (!profileVm.skills || (profileVm.skills && profileVm.skills.length == 0)) && !vm.hasLinks")
1616
.sample-image
1717
img(ng-src="/images/robot.svg")
1818

@@ -39,12 +39,12 @@
3939

4040

4141
#tcActivity
42-
tc-section(ng-show="vm.displaySection.stats", state="profileVm.status.stats")
42+
tc-section(ng-show="vm.displaySection.stats || profileVm.showTCActivity", state="profileVm.status.stats")
4343

4444
.categories
4545

4646
.empty-state
47-
empty-state-placeholder(state-name="profile-topcoder-activity", show="!profileVm.numProjects", theme="offwhite")
47+
empty-state-placeholder(state-name="profile-topcoder-activity", show="!profileVm.showTCActivity", theme="offwhite")
4848

4949
.track(
5050
ng-repeat="track in profileVm.profile.tracks",

app/profile/profile.controller.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,26 +42,38 @@
4242
if (stats.COPILOT && stats.COPILOT.contests && vm.profile.tracks.indexOf('COPILOT') == -1) {
4343
vm.profile.tracks.push('COPILOT');
4444
}
45-
vm.numProjects = vm.stats.challenges;
45+
// flag to indicate if the member has acitivity on topcoder to be shown
46+
// it is set to true, if we get at least one track with showTrack == true
47+
vm.showTCActivity = false;
4648
vm.numWins = vm.stats.wins;
4749
vm.categories = ProfileService.getRanks(vm.stats);
4850
for(var trackName in vm.categories) {
4951
// trackStats is an array of subtrack rankings along with track stats properties (e.g showTrack)
5052
var trackStats = vm.categories[trackName];
53+
// flag to indicate if the member has activity for this track
54+
// it is set to true, if we get at least one subtrack which can be shown for topcoder activity
5155
trackStats.showTrack = false;
56+
// if track has subtracks with stats
5257
if (trackStats && trackStats.length > 0) {
58+
// iterate over each subtrack stat and determine if we need to show as stat
5359
trackStats.forEach(function(subTrackRank) {
60+
// process subtack stat
5461
UserStatsService.processStatRank(subTrackRank);
62+
// if any of the subtrack has stat to show, enable the showTrack flag for the track
5563
if (subTrackRank.showStats) {
5664
trackStats.showTrack = true;
5765
}
5866
});
5967
}
68+
// if any of the track has stat to show, enable the showTCActivity flag to true
69+
if (trackStats.showTrack) {
70+
vm.showTCActivity = true;
71+
}
6072
}
6173
} else {
6274
vm.stats = false;
6375
// vm.profile.tracks = [];
64-
vm.numProjects = 0;
76+
vm.showTCActivity = 0;
6577
vm.numWins = 0;
6678
vm.categories = {};
6779
}

0 commit comments

Comments
 (0)