Description:
added test assignment time out
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r222:2b6293a64dbb - - 8 files changed: 42 inserted, 2 deleted
@@ -203,6 +203,11 | |||
|
203 | 203 | redirect_to :action => 'list' and return |
|
204 | 204 | end |
|
205 | 205 | |
|
206 | + if recent_assignment.expired? | |
|
207 | + flash[:notice] = 'The current input is expired. Please download a new input data.' | |
|
208 | + redirect_to :action => 'list' and return | |
|
209 | + end | |
|
210 | + | |
|
206 | 211 | if recent_assignment.submitted |
|
207 | 212 | flash[:notice] = 'You have already submitted an incorrect solution for this input. Please download a new input data.' |
|
208 | 213 | redirect_to :action => 'list' and return |
@@ -1,5 +1,11 | |||
|
1 | 1 | class TestPairAssignment < ActiveRecord::Base |
|
2 | + | |
|
2 | 3 | belongs_to :user |
|
3 | 4 | belongs_to :test_pair |
|
4 | 5 | belongs_to :problem |
|
6 | + | |
|
7 | + def expired? | |
|
8 | + return created_at + TEST_ASSIGNMENT_EXPIRATION_DURATION < Time.new.gmtime | |
|
9 | + end | |
|
10 | + | |
|
5 | 11 | end |
@@ -96,7 +96,7 | |||
|
96 | 96 | |
|
97 | 97 | def can_request_new_test_pair_for?(problem) |
|
98 | 98 | recent = get_recent_test_pair_assignment_for problem |
|
99 | - return (recent == nil or recent.submitted) | |
|
99 | + return (recent == nil or recent.submitted or recent.expired?) | |
|
100 | 100 | end |
|
101 | 101 | |
|
102 | 102 | def get_new_test_pair_assignment_for(problem) |
@@ -14,7 +14,7 | |||
|
14 | 14 | <%= user_header %> |
|
15 | 15 | </div> |
|
16 | 16 | |
|
17 | - <%= content_tag(:p,flash[:notice],:style => "color:green") if flash[:notice]!=nil %> | |
|
17 | + <% if flash[:notice]!=nil %><div class="notice-bar"><span class="notice"><%= flash[:notice] %></span></div><% end %> | |
|
18 | 18 | |
|
19 | 19 | <%= yield %> |
|
20 | 20 |
@@ -3,6 +3,7 | |||
|
3 | 3 | - form_tag({ :action => 'download_input', :id => problem.id }, :method => :post) do |
|
4 | 4 | %b Input: |
|
5 | 5 | %input{:type => "submit", :value => "Download input"} |
|
6 | + = "After downloading, you have #{TEST_ASSIGNMENT_EXPIRATION_DURATION/60} minutes to submit." | |
|
6 | 7 | - form_tag({ :action => 'submit_solution', :id => problem.id }, :method => :post, :multipart => true) do |
|
7 | 8 | %b Submit output: |
|
8 | 9 | %input{:type => "file", :name => "file"} |
@@ -107,3 +107,4 | |||
|
107 | 107 | # OPTIONS FOR CODE JOM |
|
108 | 108 | # -------------------- |
|
109 | 109 | CODEJOM_MAX_ALIVE_LEVEL = 10 |
|
110 | + TEST_ASSIGNMENT_EXPIRATION_DURATION = 5.minute |
@@ -264,3 +264,16 | |||
|
264 | 264 | .problem-panel .problem-form { |
|
265 | 265 | border: 1px dotted #99aaee; |
|
266 | 266 | background: #eeeeff; } |
|
267 | + | |
|
268 | + .notice-bar { | |
|
269 | + margin-top: 3px; | |
|
270 | + margin-bottom: 3px; | |
|
271 | + text-align: center; } | |
|
272 | + .notice-bar span.notice { | |
|
273 | + color: white; | |
|
274 | + font-weight: bold; | |
|
275 | + background: #000070; | |
|
276 | + padding: 3px 20px 3px 20px; | |
|
277 | + -moz-border-radius: 2px; | |
|
278 | + -webkit-border-radius: 5px; | |
|
279 | + border-radius: 5px; } |
@@ -310,3 +310,17 | |||
|
310 | 310 | .problem-form |
|
311 | 311 | border: 1px dotted #99aaee |
|
312 | 312 | background: #eeeeff |
|
313 | + | |
|
314 | + .notice-bar | |
|
315 | + margin-top: 3px | |
|
316 | + margin-bottom: 3px | |
|
317 | + text-align: center | |
|
318 | + | |
|
319 | + span.notice | |
|
320 | + color: white | |
|
321 | + font-weight: bold | |
|
322 | + background: #000070 | |
|
323 | + padding: 3px 20px 3px 20px | |
|
324 | + -moz-border-radius: 2px | |
|
325 | + -webkit-border-radius: 5px | |
|
326 | + border-radius: 5px |
You need to be logged in to leave comments.
Login now