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

Commit c868f7f

Browse files
committed
Merge pull request #399 from tconsky/dev
get_srm_schedule
2 parents e629991 + 3ead546 commit c868f7f

19 files changed

+1825
-67
lines changed

actions/srmChallenges.js

Lines changed: 421 additions & 34 deletions
Large diffs are not rendered by default.

apiary.apib

Lines changed: 483 additions & 0 deletions
Large diffs are not rendered by default.

config/tc-config.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/*
22
* Copyright (C) 2013 - 2014 TopCoder Inc., All Rights Reserved.
33
*
4-
* @author vangavroche, Ghost_141, kurtrips, Sky_, isv, bugbuka, flytoj2ee, TCSASSEMBLER
5-
* @version 1.28
4+
* @author vangavroche, Ghost_141, kurtrips, Sky_, isv, bugbuka, flytoj2ee, onsky
5+
* @version 1.29
66
* changes in 1.1:
77
* - add defaultCacheLifetime parameter
88
* changes in 1.2:
@@ -66,6 +66,8 @@
6666
* Add userActivationResendLimit and userActivationCacheLifeTime for user activation email api.
6767
* Changes in 1.28:
6868
* Add source code image generation configuration.
69+
* Changes in 1.29:
70+
* Add database timezone identifier configuration.
6971
*/
7072

7173
"use strict";
@@ -97,6 +99,7 @@ var config = {
9799
downloadsRootDirectory: process.env.DOWNLOADS_ROOT_DIRECTORY || __dirname + "/downloads",
98100
challengeCommunityLink: 'http://community.topcoder.com/tc?module=ProjectDetail&pj=',
99101
reviewAuctionDetailLink: 'http://community.topcoder.com/tc?module=ReviewAuctionDetails&aid=',
102+
databaseTimezoneIdentifier: '-0400',
100103

101104
/**
102105
* The directory where uploaded files are stored.

initializers/helper.js

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
/**
77
* This module contains helper functions.
8-
* @author Sky_, Ghost_141, muzehyun, kurtrips, isv, LazyChild, hesibo, panoptimum, flytoj2ee
8+
* @author Sky_, Ghost_141, muzehyun, kurtrips, isv, LazyChild, hesibo, panoptimum, flytoj2ee, TCSASSEMBLER
99
* @version 1.41
1010
* changes in 1.1:
1111
* - add mapProperties
@@ -108,8 +108,8 @@
108108
* - Update apiName2dbNameMap to add entries for coding_duration, num_contestants and num_submitters.
109109
* - Update getSortColumnDBName method to return column name in lower case.
110110
* - Update getLowerCaseList method to use map method.
111-
* Changes in 1.41
112-
* - Updated method checkDefined().
111+
* Changes in 1.41:
112+
* - Update apiName2dbNameMap to add entries for srm schedule API.
113113
*/
114114
"use strict";
115115

@@ -268,7 +268,17 @@ var apiName2dbNameMap = {
268268
mypoints: 'my_points',
269269
codingduration: 'coding_duration',
270270
numcontestants: 'num_contestants',
271-
numsubmitters: 'num_submitters'
271+
numsubmitters: 'num_submitters',
272+
registrationstarttime: "registration_start_time",
273+
registrationendtime: "registration_end_time",
274+
codingstarttime: "coding_start_time",
275+
codingendtime: "coding_end_time",
276+
intermissionstarttime: "intermission_start_time",
277+
intermissionendtime: "intermission_end_time",
278+
challengestarttime: "challenge_start_time",
279+
challengeendtime: "challenge_end_time",
280+
systeststarttime: "systest_start_time",
281+
systestendtime: "systest_end_time"
272282
};
273283

274284
/**

queries/get_srm_schedule

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
select SKIP @firstRowIndex@ FIRST @pageSize@
22
r.round_id AS round_id
3-
, c.contest_id AS contest_id
4-
, c.name AS name
3+
, r.name AS name
4+
, r.short_name As short_name
5+
, c.name AS contest_name
56
, rt.round_type_desc AS round_type
6-
, c.start_date AS start_date
7-
, c.end_date AS end_date
7+
, r.status AS status
88
, reg.start_time AS registration_start_time
99
, reg.end_time AS registration_end_time
1010
, coding.start_time AS coding_start_time
@@ -17,13 +17,13 @@ select SKIP @firstRowIndex@ FIRST @pageSize@
1717
, systest.end_time AS systest_end_time
1818
FROM
1919
contest c
20-
INNER JOIN round AS r ON r.contest_id = c.contest_id AND r.status='A'
20+
INNER JOIN round AS r ON r.contest_id = c.contest_id
2121
INNER JOIN round_type_lu AS rt ON rt.round_type_id = r.round_type_id
2222
LEFT JOIN round_segment AS reg ON reg.round_id = r.round_id AND reg.segment_id = 1
2323
LEFT JOIN round_segment AS coding ON coding.round_id = r.round_id AND coding.segment_id = 2
2424
LEFT JOIN round_segment AS intermission ON intermission.round_id = r.round_id AND intermission.segment_id = 3
2525
LEFT JOIN round_segment AS challenge ON challenge.round_id = r.round_id AND challenge.segment_id = 4
26-
LEFT JOIN round_segment AS systest ON systest.round_id = r.round_id AND systest.segment_id = 7
26+
LEFT JOIN round_segment AS systest ON systest.round_id = r.round_id AND systest.segment_id = 5
2727
WHERE
2828
r.round_type_id in (1, 2, 10)
2929
ORDER BY

queries/get_srm_schedule_count

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ select
22
COUNT(*) AS total_count
33
FROM
44
contest c
5-
INNER JOIN round AS r ON r.contest_id = c.contest_id AND r.status='A'
5+
INNER JOIN round AS r ON r.contest_id = c.contest_id
66
INNER JOIN round_type_lu AS rt ON rt.round_type_id = r.round_type_id
77
LEFT JOIN round_segment AS reg ON reg.round_id = r.round_id AND reg.segment_id = 1
88
LEFT JOIN round_segment AS coding ON coding.round_id = r.round_id AND coding.segment_id = 2
99
LEFT JOIN round_segment AS interm ON interm.round_id = r.round_id AND interm.segment_id = 3
1010
LEFT JOIN round_segment AS challenge ON challenge.round_id = r.round_id AND challenge.segment_id = 4
11-
LEFT JOIN round_segment AS systest ON systest.round_id = r.round_id AND systest.segment_id = 7
11+
LEFT JOIN round_segment AS systest ON systest.round_id = r.round_id AND systest.segment_id = 5
1212
WHERE
1313
r.round_type_id in (1, 2, 10)
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
DELETE FROM round_segment WHERE round_id >= 3000 AND round_id <= 3010;
2+
DELETE FROM round WHERE round_id >= 3000 AND round_id <= 3010;
3+
DELETE FROM contest WHERE contest_id >= 2000 AND contest_id <= 2005;
4+
5+
UPDATE round set status="A" where round_id=1000;
6+
UPDATE round set status="F" where round_id=13672;
7+
UPDATE round set status="F" where round_id=13673;
8+
UPDATE round set status="A" where round_id=13674;
9+
UPDATE round set status="F" where round_id=13675;
10+
UPDATE round set status="F" where round_id=13676;
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
UPDATE round set status="N" where status != "";
2+
UPDATE round set status="N" where round_id=1000;
3+
UPDATE round set status="N" where round_id=13672;
4+
UPDATE round set status="N" where round_id=13673;
5+
UPDATE round set status="N" where round_id=13674;
6+
UPDATE round set status="N" where round_id=13675;
7+
UPDATE round set status="N" where round_id=13676;
8+
9+
INSERT INTO contest (contest_id, name, status, group_id) VALUES (2001, "SRM 2001", "A", -1);
10+
INSERT INTO round (round_id, contest_id, name, status, round_type_id, rated_ind) VALUES (3001, 2001, "round 3001", "F", 1, 0);
11+
INSERT INTO round_segment(round_id, segment_id, start_time, end_time, status) VALUES(3001, 1, '2014-09-20 00:00:00', '2014-09-21 00:00:00', 'F');
12+
INSERT INTO round_segment(round_id, segment_id, start_time, end_time, status) VALUES(3001, 2, '2014-09-21 00:00:00', '2014-09-22 00:00:00', 'A');
13+
INSERT INTO round_segment(round_id, segment_id, start_time, end_time, status) VALUES(3001, 3, '2014-09-22 00:00:00', '2014-09-23 00:00:00', 'P');
14+
INSERT INTO round_segment(round_id, segment_id, start_time, end_time, status) VALUES(3001, 4, '2014-09-23 00:00:00', '2014-09-24 00:00:00', 'P');
15+
INSERT INTO round_segment(round_id, segment_id, start_time, end_time, status) VALUES(3001, 5, '2014-09-24 00:00:00', '2014-09-25 00:00:00', 'P');
16+
17+
INSERT INTO contest (contest_id, name, status, group_id) VALUES (2002, "SRM 2002", "A", -1);
18+
INSERT INTO round (round_id, contest_id, name, status, round_type_id, rated_ind) VALUES (3002, 2002, "round 3002", "A", 2, 0);
19+
INSERT INTO round_segment(round_id, segment_id, start_time, end_time, status) VALUES(3002, 1, '2014-10-20 00:00:00', '2014-10-21 00:00:00', 'F');
20+
INSERT INTO round_segment(round_id, segment_id, start_time, end_time, status) VALUES(3002, 2, '2014-10-21 00:00:00', '2014-10-22 00:00:00', 'F');
21+
INSERT INTO round_segment(round_id, segment_id, start_time, end_time, status) VALUES(3002, 3, '2014-10-22 00:00:00', '2014-10-23 00:00:00', 'A');
22+
INSERT INTO round_segment(round_id, segment_id, start_time, end_time, status) VALUES(3002, 4, '2014-10-23 00:00:00', '2014-10-24 00:00:00', 'P');
23+
INSERT INTO round_segment(round_id, segment_id, start_time, end_time, status) VALUES(3002, 5, '2014-10-24 00:00:00', '2014-10-25 00:00:00', 'P');
24+
25+
INSERT INTO contest (contest_id, name, status, group_id) VALUES (2003, "SRM 2003", "A", -1);
26+
INSERT INTO round (round_id, contest_id, name, status, round_type_id, rated_ind) VALUES (3003, 2003, "round 3003", "F", 2, 0);
27+
INSERT INTO round_segment(round_id, segment_id, start_time, end_time, status) VALUES(3003, 1, '2014-09-10 00:00:00', '2014-09-11 00:00:00', 'F');
28+
INSERT INTO round_segment(round_id, segment_id, start_time, end_time, status) VALUES(3003, 2, '2014-09-11 00:00:00', '2014-09-12 00:00:00', 'A');
29+
INSERT INTO round_segment(round_id, segment_id, start_time, end_time, status) VALUES(3003, 3, '2014-09-12 00:00:00', '2014-09-13 00:00:00', 'P');
30+
INSERT INTO round_segment(round_id, segment_id, start_time, end_time, status) VALUES(3003, 4, '2014-09-13 00:00:00', '2014-09-14 00:00:00', 'P');
31+
INSERT INTO round_segment(round_id, segment_id, start_time, end_time, status) VALUES(3003, 5, '2014-09-14 00:00:00', '2014-09-15 00:00:00', 'P');
32+
33+
INSERT INTO contest (contest_id, name, status, group_id) VALUES (2004, "SRM 2004", "A", -1);
34+
INSERT INTO round (round_id, contest_id, name, status, round_type_id, rated_ind) VALUES (3004, 2004, "round 3004", "F", 1, 0);
35+
INSERT INTO round_segment(round_id, segment_id, start_time, end_time, status) VALUES(3004, 1, '2014-09-01 04:00:00', '2014-09-01 05:00:00', 'F');
36+
INSERT INTO round_segment(round_id, segment_id, start_time, end_time, status) VALUES(3004, 2, '2014-09-01 06:00:00', '2014-09-02 00:00:00', 'A');
37+
INSERT INTO round_segment(round_id, segment_id, start_time, end_time, status) VALUES(3004, 3, '2014-09-02 00:00:00', '2014-09-03 00:00:00', 'P');
38+
INSERT INTO round_segment(round_id, segment_id, start_time, end_time, status) VALUES(3004, 4, '2014-09-03 00:00:00', '2014-09-04 00:00:00', 'P');
39+
INSERT INTO round_segment(round_id, segment_id, start_time, end_time, status) VALUES(3004, 5, '2014-09-04 00:00:00', '2014-09-05 00:00:00', 'P');
40+
41+
INSERT INTO contest (contest_id, name, status, group_id) VALUES (2005, "SRM 2005", "A", -1);
42+
INSERT INTO round (round_id, contest_id, name, status, round_type_id, rated_ind) VALUES (3005, 2001, "round 3005", "P", 10, 0);
43+
INSERT INTO round_segment(round_id, segment_id, start_time, end_time, status) VALUES(3005, 1, '2014-09-20 00:00:00', '2014-09-21 00:00:00', 'F');
44+
INSERT INTO round_segment(round_id, segment_id, start_time, end_time, status) VALUES(3005, 2, '2014-09-21 00:00:00', '2014-09-22 00:00:00', 'A');
45+
INSERT INTO round_segment(round_id, segment_id, start_time, end_time, status) VALUES(3005, 3, '2014-09-22 00:00:00', '2014-09-23 00:00:00', 'P');
46+
INSERT INTO round_segment(round_id, segment_id, start_time, end_time, status) VALUES(3005, 4, '2014-09-23 00:00:00', '2014-09-24 00:00:00', 'P');
47+
INSERT INTO round_segment(round_id, segment_id, start_time, end_time, status) VALUES(3005, 5, '2014-09-24 00:00:00', '2014-09-25 00:00:00', 'P');

0 commit comments

Comments
 (0)