From 66a9a656c48f267cf1bc62d2488c22e1a4b18e3c Mon Sep 17 00:00:00 2001 From: Renyu Liu Date: Sat, 5 Apr 2014 02:34:22 +0800 Subject: [PATCH 1/2] change the parameter name. --- actions/challenges.js | 12 ++++++------ routes.js | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/actions/challenges.js b/actions/challenges.js index 6693ae3cd..7ade9f32a 100755 --- a/actions/challenges.js +++ b/actions/challenges.js @@ -788,7 +788,7 @@ var getChallenge = function (api, connection, dbConnectionMap, isStudio, next) { submissionEndDate : formatDate(data.submission_end_date) }; - if (connection.action == "getChallenge") { + if (connection.action === "getChallenge") { challenge.type = isStudio ? 'design' : 'develop'; } @@ -1023,7 +1023,7 @@ var submitForDevelopChallenge = function (api, connection, dbConnectionMap, next console.log('-------------------------------------------'); console.log(stats.size + '\t' + api.config.submissionMaxSizeBytes); console.log('-------------------------------------------'); - + if (stats.size > api.config.submissionMaxSizeBytes) { cb(new RequestTooLargeError( "The submission file size is greater than the max allowed size: " + (api.config.submissionMaxSizeBytes / 1024) + " KB." @@ -1049,7 +1049,7 @@ var submitForDevelopChallenge = function (api, connection, dbConnectionMap, next fileName: uploadId + "_" + fileName }); api.dataAccess.executeQuery("insert_upload", sqlParams, dbConnectionMap, cb); - }, function(notUsed, cb) { + }, function (notUsed, cb) { //Now check if the contest is a CloudSpokes one and if it needs to submit the thurgood job if (!_.isUndefined(thurgoodPlatform) && !_.isUndefined(thurgoodLanguage) && type === 'final') { //Make request to the thurgood job api url @@ -1530,7 +1530,7 @@ exports.getChallenge = { name: "getChallenge", description: "getStudioChallenge", inputs: { - required: ["contestId"], + required: ["challengeId"], optional: ["refresh"] }, blockedConnectionTypes: [], @@ -1541,11 +1541,11 @@ exports.getChallenge = { run: function (api, connection, next) { if (connection.dbConnectionMap) { api.log("Execute getChallenge#run", 'debug'); - api.dataAccess.executeQuery('check_challenge_exists', {challengeId: connection.params.contestId}, connection.dbConnectionMap, function(err, result) { + api.dataAccess.executeQuery('check_challenge_exists', {challengeId: connection.params.contestId}, connection.dbConnectionMap, function (err, result) { if (err) { api.helper.handleError(api, connection, err); next(connection, true); - } else if (result.length == 0) { + } else if (result.length === 0) { api.helper.handleError(api, connection, new NotFoundError("Challenge not found.")); next(connection, true); } else { diff --git a/routes.js b/routes.js index 67f2f9f74..581c4d78a 100755 --- a/routes.js +++ b/routes.js @@ -138,7 +138,7 @@ var testMethods = { exports.routes = { get: [ { path: "/:apiVersion/logs", action: "getLogTail" }, - { path: "/:apiVersion/challenges/:contestId", action: "getChallenge" }, + { path: "/:apiVersion/challenges/:challengeId", action: "getChallenge" }, { path: "/:apiVersion/challenges", action: "searchSoftwareAndStudioChallenges" }, { path: "/:apiVersion/develop/challenges/checkpoint/:challengeId", action: "getSoftwareCheckpoint" }, From 5fb6fef62767d2777efae91399bd16cc4237aa8f Mon Sep 17 00:00:00 2001 From: Renyu Liu Date: Sat, 5 Apr 2014 02:34:22 +0800 Subject: [PATCH 2/2] change the parameter name. --- actions/challenges.js | 2 +- routes.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/actions/challenges.js b/actions/challenges.js index 09e1390c1..9ff4440c5 100755 --- a/actions/challenges.js +++ b/actions/challenges.js @@ -1502,7 +1502,7 @@ exports.getChallenge = { name: "getChallenge", description: "getStudioChallenge", inputs: { - required: ["contestId"], + required: ["challengeId"], optional: ["refresh"] }, blockedConnectionTypes: [], diff --git a/routes.js b/routes.js index 43d01eabe..030695a0f 100755 --- a/routes.js +++ b/routes.js @@ -141,7 +141,7 @@ exports.routes = { get: [ { path: "/:apiVersion/logs", action: "getLogTail" }, { path: "/:apiVersion/challenges/rss", action: "getChallengesRSS" }, - { path: "/:apiVersion/challenges/:contestId", action: "getChallenge" }, + { path: "/:apiVersion/challenges/:challengeId", action: "getChallenge" }, { path: "/:apiVersion/challenges", action: "searchSoftwareAndStudioChallenges" }, { path: "/:apiVersion/develop/challenges/checkpoint/:challengeId", action: "getSoftwareCheckpoint" },