From b8c157e2be137795d38a14aac535f21af8bc7be9 Mon Sep 17 00:00:00 2001 From: Renyu Liu Date: Sat, 5 Apr 2014 00:57:36 +0800 Subject: [PATCH 1/3] Add new sort columns for search challenge API. --- actions/challenges.js | 7 +++++-- initializers/helper.js | 6 +++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/actions/challenges.js b/actions/challenges.js index 731f827f4..98320aa2b 100755 --- a/actions/challenges.js +++ b/actions/challenges.js @@ -1,7 +1,7 @@ /* * Copyright (C) 2013 - 2014 TopCoder Inc., All Rights Reserved. * - * @version 1.18 + * @version 1.19 * @author Sky_, mekanizumu, TCSASSEMBLER, freegod, Ghost_141, kurtrips, xjtufreeman, ecnu_haozi, hesibo, LazyChild * @changes from 1.0 * merged with Member Registration API @@ -44,6 +44,8 @@ * add API for submitting to design challenge * changes in 1.18: * add clientSelection flag in studio results + * changes in 1.19: + * add new allowed sort columns : postingDate, numSubmissions, numRegistrants, currentPhaseRemainingTime */ "use strict"; /*jslint stupid: true, unparam: true, continue: true */ @@ -90,7 +92,8 @@ var ALLOWABLE_QUERY_PARAMETER = [ */ var ALLOWABLE_SORT_COLUMN = [ "challengeName", "challengeType", "challengeId", "cmcTaskId", "registrationEndDate", - "submissionEndDate", "finalFixEndDate", "prize1", "currentStatus", "digitalRunPoints" + "submissionEndDate", "finalFixEndDate", "prize1", "currentStatus", "digitalRunPoints", + "postingDate", "numSubmissions", "numRegistrants", "currentPhaseRemainingTime" ]; /** diff --git a/initializers/helper.js b/initializers/helper.js index 853e4e42e..b270b1b71 100644 --- a/initializers/helper.js +++ b/initializers/helper.js @@ -153,7 +153,11 @@ var apiName2dbNameMap = { numberofsubmissions: 'number_of_submissions', numberofreviewpositionsavailable: 'number_of_review_positions_available', round2scheduledstartdate: 'round_2_scheduled_start_date', - round1scheduledstartdate: 'round_1_scheduled_start_date' + round1scheduledstartdate: 'round_1_scheduled_start_date', + postingdate: 'posting_date', + numsubmissions: 'num_submissions', + numregistrants: 'num_registrants', + currentphaseremainingtime: 'current_phase_remaining_time' }; /** From 254ba78d174167d45044312d7135dda80e5f0cd3 Mon Sep 17 00:00:00 2001 From: Renyu Liu Date: Sat, 5 Apr 2014 01:12:47 +0800 Subject: [PATCH 2/3] Add sort columns. --- actions/challenges.js | 4 ++-- initializers/helper.js | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/actions/challenges.js b/actions/challenges.js index 98320aa2b..10f246171 100755 --- a/actions/challenges.js +++ b/actions/challenges.js @@ -45,7 +45,7 @@ * changes in 1.18: * add clientSelection flag in studio results * changes in 1.19: - * add new allowed sort columns : postingDate, numSubmissions, numRegistrants, currentPhaseRemainingTime + * add new allowed sort columns. */ "use strict"; /*jslint stupid: true, unparam: true, continue: true */ @@ -93,7 +93,7 @@ var ALLOWABLE_QUERY_PARAMETER = [ var ALLOWABLE_SORT_COLUMN = [ "challengeName", "challengeType", "challengeId", "cmcTaskId", "registrationEndDate", "submissionEndDate", "finalFixEndDate", "prize1", "currentStatus", "digitalRunPoints", - "postingDate", "numSubmissions", "numRegistrants", "currentPhaseRemainingTime" + "postingDate", "numSubmissions", "numRegistrants", "currentPhaseRemainingTime", "currentPhaseName" ]; /** diff --git a/initializers/helper.js b/initializers/helper.js index b270b1b71..36763f030 100644 --- a/initializers/helper.js +++ b/initializers/helper.js @@ -157,7 +157,8 @@ var apiName2dbNameMap = { postingdate: 'posting_date', numsubmissions: 'num_submissions', numregistrants: 'num_registrants', - currentphaseremainingtime: 'current_phase_remaining_time' + currentphaseremainingtime: 'current_phase_remaining_time', + currentphasename: 'current_phase_name' }; /** From 5a87501037a284de965ddaafcf44b3519a7e6668 Mon Sep 17 00:00:00 2001 From: Renyu Liu Date: Sat, 5 Apr 2014 01:26:17 +0800 Subject: [PATCH 3/3] Challenge API update. --- actions/challenges.js | 5 +++-- initializers/helper.js | 3 ++- queries/search_software_studio_challenges | 1 + 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/actions/challenges.js b/actions/challenges.js index 10f246171..f0ad906ab 100755 --- a/actions/challenges.js +++ b/actions/challenges.js @@ -93,7 +93,7 @@ var ALLOWABLE_QUERY_PARAMETER = [ var ALLOWABLE_SORT_COLUMN = [ "challengeName", "challengeType", "challengeId", "cmcTaskId", "registrationEndDate", "submissionEndDate", "finalFixEndDate", "prize1", "currentStatus", "digitalRunPoints", - "postingDate", "numSubmissions", "numRegistrants", "currentPhaseRemainingTime", "currentPhaseName" + "postingDate", "numSubmissions", "numRegistrants", "currentPhaseRemainingTime", "currentPhaseName", "registrationOpen" ]; /** @@ -360,7 +360,8 @@ function transferResult(src, helper) { digitalRunPoints: row.digital_run_points, prize: [], reliabilityBonus: helper.getReliabilityBonus(row.prize1), - challengeCommunity: row.is_studio ? 'design' : 'develop' + challengeCommunity: row.is_studio ? 'design' : 'develop', + registrationOpen: row.registration_open }); for (i = 1; i < 10; i = i + 1) { diff --git a/initializers/helper.js b/initializers/helper.js index 36763f030..aa1cc0c7b 100644 --- a/initializers/helper.js +++ b/initializers/helper.js @@ -158,7 +158,8 @@ var apiName2dbNameMap = { numsubmissions: 'num_submissions', numregistrants: 'num_registrants', currentphaseremainingtime: 'current_phase_remaining_time', - currentphasename: 'current_phase_name' + currentphasename: 'current_phase_name', + registrationopen: 'registration_open' }; /** diff --git a/queries/search_software_studio_challenges b/queries/search_software_studio_challenges index 53c98205d..67630c7bc 100644 --- a/queries/search_software_studio_challenges +++ b/queries/search_software_studio_challenges @@ -47,6 +47,7 @@ FIRST @pageSize@ , (SELECT event_short_desc from event e where e.event_id = nvl((SELECT max(event_id) from contest_project_xref x, contest c where project_id = p.project_id and c.contest_id = x.contest_id), 0)) as event_name , technology_list(pi1.value) AS technology , platform_list(p.project_id) as platforms + , CASE WHEN (pp1.phase_status_id = 2) THEN 'Yes' ELSE 'No' END AS registration_open FROM project p , project_status_lu pstatus , project_phase pp1 --registration phase