From fba5dfcaffd95a72c2fb2bd9545ea4295e06ed20 Mon Sep 17 00:00:00 2001 From: vikasrohit Date: Tue, 3 Nov 2015 10:31:22 -0800 Subject: [PATCH 1/3] SUP-2387, Dealing with stats for design and non-rated sub-tracks -- Showed the statistics tab for non rated tracks (design specifically) --- app/profile/about/about.jade | 4 +-- .../subtrack/design/design-statistics.jade | 33 +++++++++++++++++++ app/profile/subtrack/subtrack.controller.js | 4 +-- app/profile/subtrack/subtrack.jade | 8 ++--- assets/css/profile/subtrack.scss | 7 ++++ 5 files changed, 47 insertions(+), 9 deletions(-) create mode 100644 app/profile/subtrack/design/design-statistics.jade diff --git a/app/profile/about/about.jade b/app/profile/about/about.jade index d86802bf8..65bb2e3cd 100644 --- a/app/profile/about/about.jade +++ b/app/profile/about/about.jade @@ -67,13 +67,13 @@ ) .name {{subtrack.subTrack | track}} - .ranking(ng-if="subtrack.rating") + .ranking(ng-if="subtrack.statType == 'Rating'") .number.rating(style="color: {{subtrack.rating | ratingColor}}") | {{subtrack.rating}} .tag Rating - .ranking(ng-if="subtrack.rank && !subtrack.rating") + .ranking(ng-if="subtrack.statType == 'Ranking'") .number {{subtrack.rank | ordinal}} .tag Ranking diff --git a/app/profile/subtrack/design/design-statistics.jade b/app/profile/subtrack/design/design-statistics.jade new file mode 100644 index 000000000..70dfa0aec --- /dev/null +++ b/app/profile/subtrack/design/design-statistics.jade @@ -0,0 +1,33 @@ +.design(ng-if="vm.track == 'DESIGN'") + + .bottom + h2.detailed Details + + ul.vertical-stats + li.first + .left Win Percentage + .right {{vm.typeStats.winPercent | percentage | empty}} + + li(ng-if="profileVm.isUser") + .left Inquiries + .right {{vm.typeStats.numInquiries | empty}} + + li(ng-if="profileVm.isUser") + .left Submissions + .right {{vm.typeStats.submissions | empty}} + + li + .left Submission Rate + .right {{vm.typeStats.submissionRate | percentage | empty}} + + li.first(ng-if="profileVm.isUser") + .left Passed Screening + .right {{vm.typeStats.passedScreening | empty}} + + li + .left Screening Success Rate + .right {{vm.typeStats.screeningSuccessRate | percentage | empty}} + + li + .left Average Placement + .right {{vm.typeStats.avgPlacement | number: 2 | empty}} diff --git a/app/profile/subtrack/subtrack.controller.js b/app/profile/subtrack/subtrack.controller.js index ee1bd453e..f7690b748 100644 --- a/app/profile/subtrack/subtrack.controller.js +++ b/app/profile/subtrack/subtrack.controller.js @@ -28,9 +28,7 @@ vm.pageName = vm.subTrack.toLowerCase().replace(/_/g, ' '); vm.tabs = []; - if (vm.track !== 'DESIGN') { - vm.tabs.push('statistics'); - } + vm.tabs.push('statistics'); if (vm.track !== 'COPILOT') { vm.tabs.push( vm.subTrack === 'SRM' ? 'Past srm': 'challenges'); diff --git a/app/profile/subtrack/subtrack.jade b/app/profile/subtrack/subtrack.jade index 4a6ed7b77..fdf717795 100644 --- a/app/profile/subtrack/subtrack.jade +++ b/app/profile/subtrack/subtrack.jade @@ -20,11 +20,10 @@ p.label {{item.label}} include ./develop/develop-statistics.jade - //- yes, challenges :( this is confusing and needs refactoring - include ./design/design-challenges.jade + include ./design/design-statistics.jade include ./data/data-statistics.jade - tc-tab(heading="{{vm.tabs[1]}}", ng-if="vm.track === 'DATA_SCIENCE' || vm.track === 'DEVELOP'") + tc-tab(heading="{{vm.tabs[1]}}") .subtrack-stats responsive-carousel(data="vm.subTrackStats", handle="{{vm.handle}}") .carousel-elem @@ -37,5 +36,6 @@ p.value(ng-hide="item.label === 'rating'") {{item.val | empty}} p.label {{item.label}} - include ./develop/develop-challenges.jade + include ./develop/develop-challenges.jade + include ./design/design-challenges.jade include ./data/data-challenges.jade diff --git a/assets/css/profile/subtrack.scss b/assets/css/profile/subtrack.scss index 206c0366e..d5c4b1161 100644 --- a/assets/css/profile/subtrack.scss +++ b/assets/css/profile/subtrack.scss @@ -527,6 +527,13 @@ } } + + .design { + // override height of the statistics section for design track as we don't have limited stats for design + ul.vertical-stats { + height: 200px; + } + } } } .categoryNav { From 57900940eb205617e664ca945740b8eecdffe3d1 Mon Sep 17 00:00:00 2001 From: vikasrohit Date: Tue, 3 Nov 2015 15:01:01 -0800 Subject: [PATCH 2/3] SUP-2410, Fix ordering of sub-tracks on profile and dashboard -- Ordered the subtract stats by descending order of mostRecentSubmission date for the track/subtrack -- Copilot stats would always be the first one, if available. --- .../subtrack-stats/subtrack-stats.controller.js | 2 +- app/services/profile.service.js | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/app/my-dashboard/subtrack-stats/subtrack-stats.controller.js b/app/my-dashboard/subtrack-stats/subtrack-stats.controller.js index 40c2efd09..ca1ed5089 100644 --- a/app/my-dashboard/subtrack-stats/subtrack-stats.controller.js +++ b/app/my-dashboard/subtrack-stats/subtrack-stats.controller.js @@ -24,7 +24,7 @@ // filtering is a separate step to allow multiple pre-processings and filter out in single call subtrackRanks = UserStatsService.filterStats(subtrackRanks); // sort subtrack ranks - subtrackRanks = $filter('orderBy')(subtrackRanks, 'mostRecentEventDate', true); + subtrackRanks = $filter('orderBy')(subtrackRanks, 'mostRecentSubmissionDate', true); vm.subtrackRanks = subtrackRanks; vm.hasRanks = !!vm.subtrackRanks.length; diff --git a/app/services/profile.service.js b/app/services/profile.service.js index 6b29b4c8f..ea3d28e78 100644 --- a/app/services/profile.service.js +++ b/app/services/profile.service.js @@ -108,7 +108,8 @@ 'rating': subTrack.rank.rating || 0, 'wins': subTrack.wins, 'submissions': (subTrack.submissions && subTrack.submissions.submissions) || 0, - 'mostRecentEventDate': new Date(subTrack.mostRecentEventDate) + 'mostRecentEventDate': new Date(subTrack.mostRecentEventDate), + 'mostRecentSubmissionDate': new Date(subTrack.mostRecentSubmission) }; }).filter(function(subTrack) { return !(subTrack.subTrack == 'COPILOT_POSTING' && subTrack.track == 'DEVELOP'); @@ -124,7 +125,8 @@ 'challenges': subTrack.challenges, 'wins': subTrack.wins, 'submissions': (subTrack.submissions) || 0, - 'mostRecentEventDate': new Date(subTrack.mostRecentEventDate) + 'mostRecentEventDate': new Date(subTrack.mostRecentEventDate), + 'mostRecentSubmissionDate': new Date(subTrack.mostRecentSubmission) }; }); } @@ -135,7 +137,8 @@ 'subTrack': 'SRM', 'rank': srmStats.rank.rank, 'rating': srmStats.rank.rating, - 'mostRecentEventDate': new Date(srmStats.rank.mostRecentEventDate) + 'mostRecentEventDate': new Date(srmStats.rank.mostRecentEventDate), + 'mostRecentSubmissionDate': new Date(srmStats.mostRecentSubmission) }); } if (stats.DATA_SCIENCE && stats.DATA_SCIENCE.MARATHON_MATCH && stats.DATA_SCIENCE.MARATHON_MATCH.rank) { @@ -145,7 +148,8 @@ 'subTrack': 'MARATHON_MATCH', 'rank': marathonStats.rank.rank, 'rating': marathonStats.rank.rating, - 'mostRecentEventDate': new Date(marathonStats.rank.mostRecentEventDate) + 'mostRecentEventDate': new Date(marathonStats.rank.mostRecentEventDate), + 'mostRecentSubmissionDate': new Date(marathonStats.mostRecentSubmission) }); } if (stats.COPILOT) { From c0346df451068dba551b05261402ffc40b7c15f4 Mon Sep 17 00:00:00 2001 From: vikasrohit Date: Tue, 3 Nov 2015 22:31:18 -0800 Subject: [PATCH 3/3] SUP-2410, Fix ordering of sub-tracks on profile and dashboard -- Incorporated changes from PR. --- app/profile/subtrack/subtrack.controller.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/profile/subtrack/subtrack.controller.js b/app/profile/subtrack/subtrack.controller.js index f7690b748..8a47fa2ab 100644 --- a/app/profile/subtrack/subtrack.controller.js +++ b/app/profile/subtrack/subtrack.controller.js @@ -27,8 +27,7 @@ vm.pageName = vm.subTrack.toLowerCase().replace(/_/g, ' '); - vm.tabs = []; - vm.tabs.push('statistics'); + vm.tabs = ['statistics']; if (vm.track !== 'COPILOT') { vm.tabs.push( vm.subTrack === 'SRM' ? 'Past srm': 'challenges');