Description:
[web] test request stops at 30 min before end, auto refresh grader process status
git-svn-id: http://theory.cpe.ku.ac.th/grader/web/trunk@258 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
r128:f40baf68cc55 - - 4 files changed: 24 inserted, 7 deleted
@@ -26,11 +26,18 | |||
|
26 | 26 | render :action => 'index' and return |
|
27 | 27 | end |
|
28 | 28 | |
|
29 |
- if Configuration[SYSTEM_MODE_CONF_KEY]=='contest' |
|
|
30 |
- |
|
|
31 | - @submitted_test_request.errors.add_to_base('Contest is over.') | |
|
32 | - prepare_index_information | |
|
33 | - render :action => 'index' and return | |
|
29 | + if Configuration[SYSTEM_MODE_CONF_KEY]=='contest' | |
|
30 | + if @user.site!=nil and @user.site.finished? | |
|
31 | + @submitted_test_request.errors.add_to_base('Contest is over.') | |
|
32 | + prepare_index_information | |
|
33 | + render :action => 'index' and return | |
|
34 | + end | |
|
35 | + | |
|
36 | + if !Configuration.allow_test_request(@user) | |
|
37 | + prepare_index_information | |
|
38 | + flash[:notice] = 'Test request is not allowed during the last 30 minutes' | |
|
39 | + redirect_to :action => 'index' and return | |
|
40 | + end | |
|
34 | 41 | end |
|
35 | 42 | |
|
36 | 43 | if @submitted_test_request.save |
@@ -46,7 +46,16 | |||
|
46 | 46 | end |
|
47 | 47 | return true |
|
48 | 48 | end |
|
49 | - | |
|
49 | + | |
|
50 | + def self.allow_test_request(user) | |
|
51 | + mode = get(SYSTEM_MODE_CONF_KEY) | |
|
52 | + if (mode=='contest') | |
|
53 | + return false if (user.site!=nil) and ((user.site.started==false) or | |
|
54 | + (user.site.time_left < 30.minutes)) | |
|
55 | + end | |
|
56 | + return false if mode=='analysis' | |
|
57 | + return true | |
|
58 | + end | |
|
50 | 59 | |
|
51 | 60 | protected |
|
52 | 61 | def self.read_config |
@@ -1,5 +1,6 | |||
|
1 | 1 | - content_for :head do |
|
2 | 2 | = stylesheet_link_tag 'graders' |
|
3 | + <meta http-equiv ="refresh" content="10"/> | |
|
3 | 4 | |
|
4 | 5 | %h2 (Under Experiments) |
|
5 | 6 |
@@ -35,7 +35,7 | |||
|
35 | 35 | } |
|
36 | 36 | </script> |
|
37 | 37 | |
|
38 | - <% if Configuration.show_submitbox_to?(@user) %> | |
|
38 | + <% if Configuration.show_submitbox_to?(@user) and Configuration.allow_test_request(@user) %> | |
|
39 | 39 | <div class="submitbox"> |
|
40 | 40 | <%= error_messages_for 'submitted_test_request' %> |
|
41 | 41 | <% form_for :test_request, nil, |
You need to be logged in to leave comments.
Login now