Skip to content

Fix getChallengeRegistrants filter to not logged user #223

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: integration-v5-challenge-api
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 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: 3 additions & 1 deletion src/reducers/challenge.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import { fireErrorMessage } from '../utils/errors';

import mySubmissionsManagement from './my-submissions-management';

import { COMPETITION_TRACKS } from '../utils/tc';

/**
* Handles CHALLENGE/GET_DETAILS_INIT action.
* @param {Object} state
Expand Down Expand Up @@ -469,7 +471,7 @@ export function factory(options = {}) {
const challengeDetails = _.get(res, 'payload', {});
const track = _.get(challengeDetails, 'legacy.track', '');
let checkpointsPromise = null;
if (track === 'DESIGN') {
if (track === COMPETITION_TRACKS.DESIGN) {
const p = _.get(challengeDetails, 'phases', [])
.filter(x => x.name === 'Checkpoint Review');
if (p.length && !p[0].isOpen) {
Expand Down
4 changes: 2 additions & 2 deletions src/services/challenges.js
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,7 @@ class ChallengesService {
let contentType;
let url;

if (track === 'DESIGN') {
if (track === COMPETITION_TRACKS.DESIGN) {
({ api } = this.private);
contentType = 'application/json';
url = '/submissions/'; // The submission info is contained entirely in the JSON body
Expand All @@ -654,7 +654,7 @@ class ChallengesService {
}, onProgress).then((res) => {
const jres = JSON.parse(res);
// Return result for Develop submission
if (track === 'DEVELOP') {
if (track === COMPETITION_TRACKS.DEVELOP) {
return jres;
}
// Design Submission requires an extra "Processing" POST
Expand Down
2 changes: 1 addition & 1 deletion src/utils/challenge/filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ function filterByRegistrationOpen(challenge, state) {
if (!registrationPhase || !registrationPhase.isOpen) {
return false;
}
if (challenge.track === 'DESIGN') {
if (challenge.track === COMPETITION_TRACKS.DESIGN) {
const checkpointPhase = challengePhases.find(item => item.name === 'Checkpoint Submission')[0];
return !checkpointPhase || !checkpointPhase.isOpen;
}
Expand Down