Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async function getChallengesBlockDone(blockProps) {
const {
id, preview, spaceName, environment,
} = blockProps;
// get the Contentful data
const service = getService({ preview, spaceName, environment });
const block = await service.getEntry(id);
// prepare for getting the challenges
const challengesService = services.challenge.getService();
const filter = {};
if (!block.fields.completedChallenges) {
filter.status = 'ACTIVE';
}
if (block.fields.challengeTitleContains) {
filter.name = block.fields.challengeTitleContains;
}
if (block.fields.challengeType) {
filter.subTrack = block.fields.challengeType.join(',');
}
if (block.fields.technologies) {
filter.technologies = block.fields.technologies.join(',');
}
const challenges = await challengesService.getChallenges(filter);
return {
/**
* actions.page.challenge-details.submission
*
* Description:
* Contains the Redux Actions for updating the Submission page UI
* and for for uploading submissions to back end
*/
import _ from 'lodash';
import { createActions } from 'redux-actions';
import { services } from 'topcoder-react-lib';
import design from './design';
const getChallengesService = services.challenge.getService;
/**
* Payload creator for the action that actually performs submission operation.
* @param {String} tokenV3
* @param {String} tokenV2
* @param {String} submissionId
* @param {Object} body Data to submit.
* @param {String} track Competition track of the challenge where we submit.
* @param {Function} progress The callback to trigger with updates on the
* submission progress.
* @return Promise
*/
function submitDone(tokenV3, tokenV2, submissionId, body, track, progress) {
return getChallengesService(tokenV3, tokenV2)
.submit(body, submissionId, track, progress);
}
/**
* Challenge listing actions.
*/
import _ from 'lodash';
import { createActions } from 'redux-actions';
import { decodeToken } from 'tc-accounts';
import 'isomorphic-fetch';
import { processSRM } from 'utils/tc';
import { errors, services } from 'topcoder-react-lib';
const { fireErrorMessage } = errors;
const { getService } = services.challenge;
const { getReviewOpportunitiesService } = services.reviewOpportunities;
/**
* The maximum number of challenges to fetch in a single API call. Currently,
* the backend never returns more than 50 challenges, even when a higher limit
* was specified in the request. Thus, this constant should not be larger than
* 50 (otherwise the frontend code will miss to load some challenges).
*/
const PAGE_SIZE = 50;
/**
* The maximum number of review opportunities to fetch in a single API call.
*/
const REVIEW_OPPORTUNITY_PAGE_SIZE = 1000;
/**
/**
* Challenge listing actions.
*/
import _ from 'lodash';
import { createActions } from 'redux-actions';
import { decodeToken } from 'tc-accounts';
import 'isomorphic-fetch';
import { processSRM } from 'utils/tc';
import { errors, services } from 'topcoder-react-lib';
const { fireErrorMessage } = errors;
const { getService } = services.challenge;
const { getReviewOpportunitiesService } = services.reviewOpportunities;
/**
* The maximum number of challenges to fetch in a single API call. Currently,
* the backend never returns more than 50 challenges, even when a higher limit
* was specified in the request. Thus, this constant should not be larger than
* 50 (otherwise the frontend code will miss to load some challenges).
*/
const PAGE_SIZE = 50;
/**
* The maximum number of review opportunities to fetch in a single API call.
*/
const REVIEW_OPPORTUNITY_PAGE_SIZE = 10;
/**