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

Feature/sup 3127 marathonmatch details link #799

Merged
merged 7 commits into from
Jun 27, 2016
Merged
Changes from 6 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
4 changes: 2 additions & 2 deletions app/directives/challenge-tile/challenge-tile.jade
Original file line number Diff line number Diff line change
@@ -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

16 changes: 14 additions & 2 deletions app/filters/challengeLinks.filter.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import angular from 'angular'
import _ from 'lodash'

(function() {
'use strict'
@@ -13,15 +14,24 @@ 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', ''),
challengeId: challenge.id,
problemId: _.get(challenge, 'problemId', '')
}
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':
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&pm={problemId}&rd={roundId}', data)
}
}
} else if (challenge.subTrack === 'SRM') {
data = {
@@ -54,6 +64,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)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@parthshah @fnisen @ajefts fyi, when we have single link for both design and development challenges for the new submission page, we can replace the details link with the submission link.

case 'detail':
return String.supplant('https://www.{domain}/challenge-details/{id}/?type={track}', data)
}
26 changes: 24 additions & 2 deletions app/filters/filters.spec.js
Original file line number Diff line number Diff line change
@@ -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() {