Description:
fixed contest to be ready message bug (when not in contest mode)
git-svn-id: http://theory.cpe.ku.ac.th/grader/web/trunk@368 6386c4cd-e34a-4fa8-8920-d93eb39b512e
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r170:5374337e0f83 - - 2 files changed: 5 inserted, 1 deleted
@@ -68,48 +68,52 | |||||
|
68 |
|
68 | ||
|
69 | def self.show_grading_result |
|
69 | def self.show_grading_result |
|
70 | return (get(SYSTEM_MODE_CONF_KEY)=='analysis') |
|
70 | return (get(SYSTEM_MODE_CONF_KEY)=='analysis') |
|
71 | end |
|
71 | end |
|
72 |
|
72 | ||
|
73 | def self.allow_test_request(user) |
|
73 | def self.allow_test_request(user) |
|
74 | mode = get(SYSTEM_MODE_CONF_KEY) |
|
74 | mode = get(SYSTEM_MODE_CONF_KEY) |
|
75 | early_timeout = get(TEST_REQUEST_EARLY_TIMEOUT_KEY) |
|
75 | early_timeout = get(TEST_REQUEST_EARLY_TIMEOUT_KEY) |
|
76 | if (mode=='contest') |
|
76 | if (mode=='contest') |
|
77 | return false if ((user.site!=nil) and |
|
77 | return false if ((user.site!=nil) and |
|
78 | ((user.site.started!=true) or |
|
78 | ((user.site.started!=true) or |
|
79 | (early_timeout and (user.site.time_left < 30.minutes)))) |
|
79 | (early_timeout and (user.site.time_left < 30.minutes)))) |
|
80 | end |
|
80 | end |
|
81 | return false if mode=='analysis' |
|
81 | return false if mode=='analysis' |
|
82 | return true |
|
82 | return true |
|
83 | end |
|
83 | end |
|
84 |
|
84 | ||
|
85 | def self.task_grading_info |
|
85 | def self.task_grading_info |
|
86 | if @@task_grading_info==nil |
|
86 | if @@task_grading_info==nil |
|
87 | read_grading_info |
|
87 | read_grading_info |
|
88 | end |
|
88 | end |
|
89 | return @@task_grading_info |
|
89 | return @@task_grading_info |
|
90 | end |
|
90 | end |
|
91 |
|
91 | ||
|
|
92 | + def self.contest_mode | ||
|
|
93 | + return get(SYSTEM_MODE_CONF_KEY) == 'contest' | ||
|
|
94 | + end | ||
|
|
95 | + | ||
|
92 | protected |
|
96 | protected |
|
93 |
|
97 | ||
|
94 | def self.convert_type(val,type) |
|
98 | def self.convert_type(val,type) |
|
95 | case type |
|
99 | case type |
|
96 | when 'string' |
|
100 | when 'string' |
|
97 | return val |
|
101 | return val |
|
98 |
|
102 | ||
|
99 | when 'integer' |
|
103 | when 'integer' |
|
100 | return val.to_i |
|
104 | return val.to_i |
|
101 |
|
105 | ||
|
102 | when 'boolean' |
|
106 | when 'boolean' |
|
103 | return (val=='true') |
|
107 | return (val=='true') |
|
104 | end |
|
108 | end |
|
105 | end |
|
109 | end |
|
106 |
|
110 | ||
|
107 | def self.read_config |
|
111 | def self.read_config |
|
108 | @@configurations = {} |
|
112 | @@configurations = {} |
|
109 | Configuration.find(:all).each do |conf| |
|
113 | Configuration.find(:all).each do |conf| |
|
110 | key = conf.key |
|
114 | key = conf.key |
|
111 | val = conf.value |
|
115 | val = conf.value |
|
112 | @@configurations[key] = Configuration.convert_type(val,conf.value_type) |
|
116 | @@configurations[key] = Configuration.convert_type(val,conf.value_type) |
|
113 | end |
|
117 | end |
|
114 | end |
|
118 | end |
|
115 |
|
119 |
@@ -1,30 +1,30 | |||||
|
1 | = user_title_bar(@user) |
|
1 | = user_title_bar(@user) |
|
2 |
|
2 | ||
|
3 | - if @announcements.length!=0 |
|
3 | - if @announcements.length!=0 |
|
4 | .announcementbox |
|
4 | .announcementbox |
|
5 | %span{:class => 'title'} |
|
5 | %span{:class => 'title'} |
|
6 | Announcements |
|
6 | Announcements |
|
7 | = render :partial => 'announcement', :collection => @announcements |
|
7 | = render :partial => 'announcement', :collection => @announcements |
|
8 |
|
8 | ||
|
9 | - if Configuration.show_submitbox_to?(@user) |
|
9 | - if Configuration.show_submitbox_to?(@user) |
|
10 | .submitbox |
|
10 | .submitbox |
|
11 | = error_messages_for 'submission' |
|
11 | = error_messages_for 'submission' |
|
12 | = render :partial => 'submission_box' |
|
12 | = render :partial => 'submission_box' |
|
13 |
|
13 | ||
|
14 |
|
14 | ||
|
15 | %hr/ |
|
15 | %hr/ |
|
16 |
|
16 | ||
|
17 | - - if (@user.site!=nil) and (@user.site.started!=true) |
|
17 | + - if (Configuration.contest_mode) and (@user.site!=nil) and (@user.site.started!=true) |
|
18 | %p=t 'main.start_soon' |
|
18 | %p=t 'main.start_soon' |
|
19 |
|
19 | ||
|
20 | - if Configuration.show_tasks_to?(@user) |
|
20 | - if Configuration.show_tasks_to?(@user) |
|
21 | %table.info |
|
21 | %table.info |
|
22 | %tr.info-head |
|
22 | %tr.info-head |
|
23 | %th |
|
23 | %th |
|
24 | %th Tasks |
|
24 | %th Tasks |
|
25 | %th # of sub(s) |
|
25 | %th # of sub(s) |
|
26 | %th Results |
|
26 | %th Results |
|
27 | = render :partial => 'problem', :collection => @problems |
|
27 | = render :partial => 'problem', :collection => @problems |
|
28 |
|
28 | ||
|
29 | %hr/ |
|
29 | %hr/ |
|
30 |
|
30 |
You need to be logged in to leave comments.
Login now