From 2b39df4d626d4483a73af9b3a1a746ccf9a4699b Mon Sep 17 00:00:00 2001 From: vikasrohit Date: Tue, 19 Apr 2016 12:49:34 +0530 Subject: [PATCH 1/4] AS#112412760157010, Marathon Match link broken on Dashboard (for both challenge page and submissions) -- rough draft for the fix. --- app/filters/challengeLinks.filter.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/filters/challengeLinks.filter.js b/app/filters/challengeLinks.filter.js index 92aaee5e9..9cbcbe58b 100644 --- a/app/filters/challengeLinks.filter.js +++ b/app/filters/challengeLinks.filter.js @@ -21,7 +21,11 @@ import angular from 'angular' case 'registrants': return String.supplant('https://community.{domain}/longcontest/?module=ViewRegistrants&rd={roundId}', data) case 'detail': - return String.supplant('https://community.{domain}/longcontest/stats/?module=ViewOverview&rd={roundId}', data) + if (challenge.status === 'PAST') { + return String.supplant('https://community.{domain}/longcontest/stats/?module=ViewOverview&rd={roundId}', data) + } else { // for all other statues (ACTIVE, UPCOMING), show the problem statement + return String.supplant('https://community.{domain}/longcontest/?module=ViewProblemStatement&rd={roundId}', data) + } } } else { data = { From dfd4bc4d5bb3f70d39a4ef5c9a36c7e338480e08 Mon Sep 17 00:00:00 2001 From: vikasrohit Date: Mon, 9 May 2016 13:01:09 +0530 Subject: [PATCH 2/4] AS#112412760157010, Marathon Match link broken on Dashboard (for both challenge page and submissions) (Front end) --- .../challenge-tile/challenge-tile.jade | 4 +-- app/filters/challengeLinks.filter.js | 12 +++++++-- app/filters/filters.spec.js | 26 +++++++++++++++++-- 3 files changed, 36 insertions(+), 6 deletions(-) diff --git a/app/directives/challenge-tile/challenge-tile.jade b/app/directives/challenge-tile/challenge-tile.jade index 20b415a2b..4660e4dfb 100644 --- a/app/directives/challenge-tile/challenge-tile.jade +++ b/app/directives/challenge-tile/challenge-tile.jade @@ -20,7 +20,7 @@ .stalled-challenge(ng-hide="challenge.userCurrentPhaseEndTime") This challenge is currently paused. .phase-action(ng-show="challenge.userAction", ng-switch="challenge.userAction") - a.tc-btn.tc-btn-s.tc-btn-wide.tc-btn-ghost.submit(ng-switch-when="Submit", ng-href="{{challenge|challengeLinks:'detail'}}") Submit + a.tc-btn.tc-btn-s.tc-btn-wide.tc-btn-ghost.submit(ng-switch-when="Submit", ng-href="{{challenge|challengeLinks:'submit'}}") Submit .submitted(ng-switch-when="Submitted") Submitted @@ -96,7 +96,7 @@ p.ends-in(ng-hide="challenge.userCurrentPhaseEndTime") This challenge is currently paused. .phase-action(ng-switch="challenge.userAction") - a.tc-btn.tc-btn-s.tc-btn-wide.tc-btn-ghost.submit(ng-switch-when="Submit", ng-href="{{challenge|challengeLinks:'detail'}}") Submit + a.tc-btn.tc-btn-s.tc-btn-wide.tc-btn-ghost.submit(ng-switch-when="Submit", ng-href="{{challenge|challengeLinks:'submit'}}") Submit .submitted(ng-switch-when="Submitted") Submitted diff --git a/app/filters/challengeLinks.filter.js b/app/filters/challengeLinks.filter.js index c32ae5d2d..02ee3467c 100644 --- a/app/filters/challengeLinks.filter.js +++ b/app/filters/challengeLinks.filter.js @@ -1,4 +1,5 @@ import angular from 'angular' +import _ from 'lodash' (function() { 'use strict' @@ -13,18 +14,23 @@ import angular from 'angular' data = { domain: CONSTANTS.domain, roundId: challenge.rounds[0].id, - forumId: challenge.rounds[0].forumId + forumId: challenge.rounds[0].forumId, + componentId: _.get(challenge, 'componentId[0]', ''), + challengeId: challenge.id, + problemId: _.get(challenge, 'problemId[0]', '') } switch (type) { case 'forums': return String.supplant('https://apps.{domain}/forums/?module=ThreadList&forumID={forumId}', data) case 'registrants': return String.supplant('https://community.{domain}/longcontest/?module=ViewRegistrants&rd={roundId}', data) + case 'submit': + return String.supplant('https://community.{domain}/longcontest/?module=Submit&compid={componentId}&rd={roundId}&cd={challengeId}', data) case 'detail': if (challenge.status === 'PAST') { return String.supplant('https://community.{domain}/longcontest/stats/?module=ViewOverview&rd={roundId}', data) } else { // for all other statues (ACTIVE, UPCOMING), show the problem statement - return String.supplant('https://community.{domain}/longcontest/?module=ViewProblemStatement&rd={roundId}', data) + return String.supplant('https://community.{domain}/longcontest/?module=ViewProblemStatement&pm={problemId}&rd={roundId}', data) } } } else { @@ -49,6 +55,8 @@ import angular from 'angular' return String.supplant('https://www.{domain}/challenge-details/{id}/?type={track}#submissions', data) case 'registrants': return String.supplant('https://www.{domain}/challenge-details/{id}/?type={track}#viewRegistrant', data) + case 'submit':// TODO use details link for submit, we can replace it with new submission page url + return String.supplant('https://www.{domain}/challenge-details/{id}/?type={track}', data) case 'detail': return String.supplant('https://www.{domain}/challenge-details/{id}/?type={track}', data) } diff --git a/app/filters/filters.spec.js b/app/filters/filters.spec.js index 94a2a775f..75c7454ef 100644 --- a/app/filters/filters.spec.js +++ b/app/filters/filters.spec.js @@ -68,6 +68,7 @@ describe('filters', function() { track: 'develop', subTrack : 'CODE' } + expect(challengeLinksFilter(_ch, 'submit')).to.be.equal('https://www.'+domain+'/challenge-details/1/?type=develop') expect(challengeLinksFilter(_ch, 'detail')).to.be.equal('https://www.'+domain+'/challenge-details/1/?type=develop') expect(challengeLinksFilter(_ch, 'forums')).to.be.equal('https://apps.'+domain+'/forums/?module=Category&categoryID=2') expect(challengeLinksFilter(_ch, 'registrants')).to.be.equal('https://www.'+domain+'/challenge-details/1/?type=develop#viewRegistrant') @@ -81,23 +82,44 @@ describe('filters', function() { track: 'design', subTrack : 'WEB_DESIGN' } + expect(challengeLinksFilter(_ch, 'submit')).to.be.equal('https://www.'+domain+'/challenge-details/1/?type=design') expect(challengeLinksFilter(_ch, 'detail')).to.be.equal('https://www.'+domain+'/challenge-details/1/?type=design') expect(challengeLinksFilter(_ch, 'forums')).to.be.equal('https://apps.'+domain+'/forums/?module=ThreadList&forumID=2') expect(challengeLinksFilter(_ch, 'registrants')).to.be.equal('https://www.'+domain+'/challenge-details/1/?type=design#viewRegistrant') expect(challengeLinksFilter(_ch, 'submissions')).to.be.equal('https://www.'+domain+'/challenge-details/1/?type=design#submissions') }) - it ('should have the correct links for DATA_SCIENCE challenge', function() { + it ('should have the correct links for PAST DATA_SCIENCE challenge', function() { var _ch = { id: 1, rounds: [{id: 3,forumId: 2}], track: 'DATA_SCIENCE', - subTrack : 'MARATHON_MATCH' + subTrack : 'MARATHON_MATCH', + componentId: [4], + problemId: [5], + status: 'PAST' } + expect(challengeLinksFilter(_ch, 'submit')).to.be.equal('https://community.'+domain+'/longcontest/?module=Submit&compid=4&rd=3&cd=1') expect(challengeLinksFilter(_ch, 'detail')).to.be.equal('https://community.'+domain+'/longcontest/stats/?module=ViewOverview&rd=3') expect(challengeLinksFilter(_ch, 'forums')).to.be.equal('https://apps.'+domain+'/forums/?module=ThreadList&forumID=2') expect(challengeLinksFilter(_ch, 'registrants')).to.be.equal('https://community.'+domain+'/longcontest/?module=ViewRegistrants&rd=3') }) + + it ('should have the correct links for ACTIVE/UPCOMING DATA_SCIENCE challenge', function() { + var _ch = { + id: 1, + rounds: [{id: 3,forumId: 2}], + track: 'DATA_SCIENCE', + subTrack : 'MARATHON_MATCH', + componentId: [4], + problemId: [5], + status: 'ACTIVE' + } + expect(challengeLinksFilter(_ch, 'submit')).to.be.equal('https://community.'+domain+'/longcontest/?module=Submit&compid=4&rd=3&cd=1') + expect(challengeLinksFilter(_ch, 'detail')).to.be.equal('https://community.'+domain+'/longcontest/?module=ViewProblemStatement&pm=5&rd=3') + expect(challengeLinksFilter(_ch, 'forums')).to.be.equal('https://apps.'+domain+'/forums/?module=ThreadList&forumID=2') + expect(challengeLinksFilter(_ch, 'registrants')).to.be.equal('https://community.'+domain+'/longcontest/?module=ViewRegistrants&rd=3') + }) }) describe('externalLinkColorFilter', function() { From aa9381179fcfdd201137b5c33a6b59ee3ad5d546 Mon Sep 17 00:00:00 2001 From: vikasrohit Date: Mon, 27 Jun 2016 13:00:31 +0530 Subject: [PATCH 3/4] AS#112412760157010, Marathon Match link broken on Dashboard (for both challenge page and submissions) (Front end) -- Adapted code for handling the singular values instead of array of values for componentId and problemId fields as per discussion in asana task. --- app/filters/challengeLinks.filter.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/filters/challengeLinks.filter.js b/app/filters/challengeLinks.filter.js index ab5804ad2..5204ba37b 100644 --- a/app/filters/challengeLinks.filter.js +++ b/app/filters/challengeLinks.filter.js @@ -15,9 +15,9 @@ import _ from 'lodash' domain: CONSTANTS.domain, roundId: challenge.rounds[0].id, forumId: challenge.rounds[0].forumId, - componentId: _.get(challenge, 'componentId[0]', ''), + componentId: _.get(challenge, 'componentId', ''), challengeId: challenge.id, - problemId: _.get(challenge, 'problemId[0]', '') + problemId: _.get(challenge, 'problemId', '') } switch (type) { case 'forums': From 890cc37f0593c791cfda7a4a0f1e95226de96526 Mon Sep 17 00:00:00 2001 From: vikasrohit Date: Mon, 27 Jun 2016 13:07:52 +0530 Subject: [PATCH 4/4] AS#112412760157010, Marathon Match link broken on Dashboard (for both challenge page and submissions) (Front end) -- Fixed unit tests --- app/filters/filters.spec.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/filters/filters.spec.js b/app/filters/filters.spec.js index 75c7454ef..aeaaed63a 100644 --- a/app/filters/filters.spec.js +++ b/app/filters/filters.spec.js @@ -95,8 +95,8 @@ describe('filters', function() { rounds: [{id: 3,forumId: 2}], track: 'DATA_SCIENCE', subTrack : 'MARATHON_MATCH', - componentId: [4], - problemId: [5], + componentId: 4, + problemId: 5, status: 'PAST' } expect(challengeLinksFilter(_ch, 'submit')).to.be.equal('https://community.'+domain+'/longcontest/?module=Submit&compid=4&rd=3&cd=1') @@ -111,8 +111,8 @@ describe('filters', function() { rounds: [{id: 3,forumId: 2}], track: 'DATA_SCIENCE', subTrack : 'MARATHON_MATCH', - componentId: [4], - problemId: [5], + componentId: 4, + problemId: 5, status: 'ACTIVE' } expect(challengeLinksFilter(_ch, 'submit')).to.be.equal('https://community.'+domain+'/longcontest/?module=Submit&compid=4&rd=3&cd=1')