Skip to content

Commit 9f049d6

Browse files
committed
2 round detection fix
1 parent d0b8b94 commit 9f049d6

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

src/components/ChallengeEditor/index.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import {
3030
MULTI_ROUND_CHALLENGE_TEMPLATE_ID, DS_TRACK_ID,
3131
CHALLENGE_STATUS
3232
} from '../../config/constants'
33-
import { getDomainTypes, getResourceRoleByName } from '../../util/tc'
33+
import { getDomainTypes, getResourceRoleByName, is2RoundsChallenge } from '../../util/tc'
3434
import { PrimaryButton, OutlineButton } from '../Buttons'
3535
import TrackField from './Track-Field'
3636
import TypeField from './Type-Field'
@@ -838,8 +838,7 @@ class ChallengeEditor extends Component {
838838
const { phases } = this.state.challenge
839839
let newChallenge = _.cloneDeep(this.state.challenge)
840840
const isDesignChallenge = newChallenge.trackId === DES_TRACK_ID
841-
const is2RoundChallenge =
842-
newChallenge.timelineTemplateId === MULTI_ROUND_CHALLENGE_TEMPLATE_ID
841+
const is2RoundChallenge = is2RoundsChallenge(newChallenge)
843842
const is2RoundDesignChallenge = isDesignChallenge && is2RoundChallenge
844843

845844
for (let index = 0; index < phases.length; ++index) {

src/util/tc.js

+8
Original file line numberDiff line numberDiff line change
@@ -269,3 +269,11 @@ export function getChallengeTypeAbbr (track, challengeTypes) {
269269
}
270270
return null
271271
}
272+
273+
/**
274+
* Check if challenge is 2 rounds challenge or not
275+
* @param {Object} challenge challenge info
276+
*/
277+
export function is2RoundsChallenge (challenge) {
278+
return !!_.find(challenge.phases, { name: 'Checkpoint Submission' })
279+
}

0 commit comments

Comments
 (0)