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

Update search challenges api and fix some jslint error. #379

Merged
merged 1 commit into from
Oct 20, 2014
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion actions/challengeRegistration.js
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ var projectTrack = function (api, userId, challengeId, componentInfo, dbConnecti
function (cb) {
//Rating
var rating = componentInfo.rating;

if (rating > 0) {
persistResourceInfo(api, resourceId, 4, componentInfo.rating, userId, dbConnectionMap, cb);
} else {
Expand Down
5 changes: 2 additions & 3 deletions actions/docusign.js
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ exports.generateDocusignViewURL = {
});
}

textTabs.push({tabLabel :'TopCoder Handle', value: user.handle});
textTabs.push({tabLabel : 'TopCoder Handle', value: user.handle});

//Prepare the POST parameters
reqParams = {
Expand Down Expand Up @@ -477,8 +477,7 @@ exports.generateDocusignViewURL = {
var url, returnURL, reqParams;

//Create the return url
returnURL = _.template(connection.params.returnUrl ?
connection.params.returnUrl : api.config.tcConfig.docusign.returnURL)({envelopeId: envelopeId});
returnURL = _.template(connection.params.returnUrl || api.config.tcConfig.docusign.returnURL)({envelopeId: envelopeId});

//Request recipient view
url = baseURL + "/envelopes/" + envelopeId + "/views/recipient";
Expand Down
6 changes: 3 additions & 3 deletions actions/reports.js
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ var clientChallengeCosts = function (api, connection, next) {
cb(new NotFoundError('Client not found'));
return;
}
if(type === helper.ListType.ACTIVE) {
if (type === helper.ListType.ACTIVE) {
api.dataAccess.executeQuery("active_client_challenges_costs", sqlParameters, dbConnectionMap, cb);
} else {
api.dataAccess.executeQuery("past_client_challenges_costs", sqlParameters, dbConnectionMap, cb);
Expand Down Expand Up @@ -649,8 +649,8 @@ exports.getClientActiveChallengeCosts = {
api.dataAccess.executeQuery("get_client_active_challenge_costs", sqlParameters, dbConnectionMap, cb);
}, function (results, cb) {
costs = _.map(results, function (item) {
var duration = item.challenge_duration ? parseFloat(item.challenge_duration.toFixed(1)) : 0;
var currentPhaseText = item.current_phase;
var duration = item.challenge_duration ? parseFloat(item.challenge_duration.toFixed(1)) : 0,
currentPhaseText = item.current_phase;
/* currentPhaseArray = [];

if (currentPhaseText) {
Expand Down
4 changes: 2 additions & 2 deletions actions/srmProblems.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ var ForbiddenError = require('../errors/ForbiddenError');
*/
function parseProblem(item) {
var type = {id: item.problem_type_id, description: item.problem_type_desc},
status = {id: item.status_id, description: item.status_desc};
status = {id: item.status_id, description: item.status_desc};
return {id: item.problem_id, name: item.name, proposedDivisionId: item.division_id, type: type, status: status};
}

Expand Down Expand Up @@ -65,7 +65,7 @@ var listRoundProblems = function (api, connection, dbConnectionMap, next) {
_.each(results, function (item) {
var division = {id: item.division_id, desc: item.division_desc},
problem = parseProblem(item);
problem.roundId = roundId;
problem.roundId = roundId;
result.push({division: division, problemData: problem});
});

Expand Down
4 changes: 2 additions & 2 deletions actions/srmRoundComponentsAndTerms.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ function checkComponents(api, dbConnectionMap, components, callback) {
}, function (results, cb) {
if (!error) {
if (results.length === 0) {
error = new IllegalArgumentError("The componentId "+ component.componentId + " does not exist in database.");
error = new IllegalArgumentError("The componentId " + component.componentId + " does not exist in database.");
}
}

Expand Down Expand Up @@ -348,4 +348,4 @@ exports.setRoundTerms = {
api.helper.handleNoConnection(api, connection, next);
}
}
};
};
26 changes: 13 additions & 13 deletions actions/srmRoundManagement.js
Original file line number Diff line number Diff line change
Expand Up @@ -430,18 +430,18 @@ exports.createSRMContestRound = {
function (roundId, cbx) {
params.id = roundId;
api.dataAccess.executeQuery('insert_srm_contest_round',
{
contest_id: params.contest_id,
round_id: params.id,
round_type_id: params.type.id,
registration_limit: params.registrationLimit,
invitational: params.invitationalType,
region_id: params.region.region_id,
name: params.name,
status: params.status,
short_name: params.short_name
},
dbConnectionMap, cbx);
{
contest_id: params.contest_id,
round_id: params.id,
round_type_id: params.type.id,
registration_limit: params.registrationLimit,
invitational: params.invitationalType,
region_id: params.region.region_id,
name: params.name,
status: params.status,
short_name: params.short_name
},
dbConnectionMap, cbx);
}
], cb);
},
Expand Down Expand Up @@ -781,4 +781,4 @@ exports.deleteSRMContestRound = {
next(connection, true);
});
}
};
};
40 changes: 20 additions & 20 deletions initializers/configurator.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,25 @@
*/
"use strict";

exports.configurator = function(api, next){
exports.configurator = function (api, next) {

api.configurator = {
_start: function(api, next){
this.configWeb(api);
next();
},
configWeb: function(api){
if(!api.servers || !api.servers.servers['web'] || !api.servers.servers['web'].server) {
api.log('[configurator] web server has not been created.', 'warning');
return;
}

var timeout = api.config.servers.web.timeout || 10 * 60 * 1000;

api.servers.servers['web'].server.timeout = timeout;
api.log('[configurator] web.server#timeout => '+timeout, 'info');
}
};
api.configurator = {
_start: function (api, next) {
this.configWeb(api);
next();
},
configWeb: function (api) {
if (!api.servers || !api.servers.servers.web || !api.servers.servers.web.server) {
api.log('[configurator] web server has not been created.', 'warning');
return;
}

next();
}
var timeout = api.config.servers.web.timeout || 10 * 60 * 1000;

api.servers.servers.web.server.timeout = timeout;
api.log('[configurator] web.server#timeout => ' + timeout, 'info');
}
};

next();
};
2 changes: 1 addition & 1 deletion queries/challenge_details
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ SELECT
AND pi52.project_id = p.project_id
AND pi78.project_info_type_id = 78 -- forum type
AND pi78.project_id = p.project_id
AND p.project_Id = nd_phase.project_id
AND p.project_id = nd_phase.project_id
AND nd_phase.phase_type_id = (SELECT MIN(phase_type_id) FROM project_phase WHERE project_id = p.project_id AND phase_status_id = 2 AND phase_type_id not in (13,14))
AND p.project_category_id = pcl.project_category_id
AND pcl.project_type_id IN (@project_type_id@)
Expand Down
2 changes: 1 addition & 1 deletion queries/search_software_studio_challenges
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ FIRST @pageSize@
AND pi4.project_id = p.project_id
AND pi4.project_info_type_id = 4 --forum id
AND p.project_Id = nd_phase.project_id
AND nd_phase.project_phase_id = (SELECT MAX(project_phase_id) FROM project_phase WHERE project_id = p.project_id AND phase_status_id = 2 AND phase_type_id IN (1,2,3,4,5,6,7,8,9,10,11,12))
AND nd_phase.phase_type_id = (SELECT MIN(phase_type_id) FROM project_phase WHERE project_id = p.project_id AND phase_status_id = 2 AND phase_type_id not in (13,14))
AND p.project_category_id = pcl.project_category_id
-- Filter out the challenge that user is not belong to.
AND (not exists (select contest_id from contest_eligibility where contest_id = p.project_id)
Expand Down
4 changes: 2 additions & 2 deletions routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -330,8 +330,8 @@ exports.routes = {
{ path: "/:apiVersion/data/srm/problems", action: "listSRMProblems" },
{ path: "/:apiVersion/data/srm/rounds/:roundId/problems", action: "listRoundProblems" },
{ path: "/:apiVersion/data/srm/rounds/:roundId/:problemId/:divisionId/components", action: "listRoundProblemComponents" },
{ path: "/:apiVersion/data/srm/rounds/:roundId/components", action: "listRoundProblemComponents" },
{ path: "/:apiVersion/data/srm/rounds/:contestId", action: "listSRMContestRounds" },
{ path: "/:apiVersion/data/srm/rounds/:roundId/components", action: "listRoundProblemComponents" },
{ path: "/:apiVersion/data/srm/rounds/:contestId", action: "listSRMContestRounds" },
{ path: "/:apiVersion/auth0/callback", action: "auth0Callback" },

//Stubs APIs
Expand Down