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

Commit 0372224

Browse files
committed
Merge pull request #422 from appirio-tech/SUP-452-sorting-active-upcoming
Sup 452 sorting active upcoming
2 parents a51323d + 504d4b0 commit 0372224

File tree

4 files changed

+9
-5
lines changed

4 files changed

+9
-5
lines changed

actions/challenges.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3670,7 +3670,8 @@ var getChallenges = function (api, connection, listType, isMyChallenges, next) {
36703670
}
36713671
}
36723672

3673-
sortOrder = query.sortorder || "desc";
3673+
sortOrder = query.sortorder ||
3674+
(!query.sortcolumn && (listType == api.helper.ListType.ACTIVE || listType == api.helper.ListType.UPCOMING) ? "asc" : "desc");
36743675
sortColumn = query.sortcolumn || DEFAULT_SORT_COLUMN;
36753676
pageIndex = Number(query.pageindex || 1);
36763677
pageSize = Number(query.pagesize || 150);

initializers/helper.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ var apiName2dbNameMap = {
261261
currentphaseremainingtime: 'current_phase_remaining_time',
262262
currentphasename: 'current_phase_name',
263263
registrationopen: 'registration_open',
264-
totalPrize: 'total_prize',
264+
totalprize: 'total_prize',
265265
registrationstartdate: 'registration_start_date',
266266
challengecommunity: 'challenge_community',
267267
problemid: 'problem_id',
@@ -280,7 +280,8 @@ var apiName2dbNameMap = {
280280
challengestarttime: "challenge_start_time",
281281
challengeendtime: "challenge_end_time",
282282
systeststarttime: "systest_start_time",
283-
systestendtime: "systest_end_time"
283+
systestendtime: "systest_end_time",
284+
firstplaceprize: "first_place_prize"
284285
};
285286

286287
/**

queries/get_active_challenges

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
SELECT
2+
SKIP @first_row_index@
3+
FIRST @page_size@
24
CASE WHEN (p.project_studio_spec_id IS NOT NULL) THEN 1 ELSE 0 END AS is_studio
35
, pcl.description AS challenge_type
46
, pn.value AS challenge_name
@@ -71,4 +73,4 @@ AND pp1.phase_status_id IN (2, 3)
7173
AND pi1.project_info_type_id = 1 -- external reference id
7274
AND pi1.project_id = p.project_id
7375

74-
ORDER BY NVL(pp2.actual_end_time, pp2.scheduled_end_time) ASC
76+
ORDER BY @sort_column@ @sort_order@

queries/get_upcoming_challenges

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,4 @@ AND pp1.scheduled_start_time < CURRENT + 90 UNITS DAY
6868
AND pi1.project_info_type_id = 1 -- external reference id
6969
AND pi1.project_id = p.project_id
7070

71-
ORDER BY pp2.scheduled_end_time ASC
71+
ORDER BY @sort_column@ @sort_order@

0 commit comments

Comments
 (0)