Description:
[web] fix time.new, time.now to use gmtime
git-svn-id: http://theory.cpe.ku.ac.th/grader/web/trunk@249 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
r121:00c0c912cae9 - - 3 files changed: 3 inserted, 3 deleted
@@ -32,25 +32,25 | |||
|
32 | 32 | end |
|
33 | 33 | |
|
34 | 34 | def submit |
|
35 | 35 | user = User.find(session[:user_id]) |
|
36 | 36 | |
|
37 | 37 | @submission = Submission.new(params[:submission]) |
|
38 | 38 | @submission.user = user |
|
39 | 39 | @submission.language_id = 0 |
|
40 | 40 | if params['file']!='' |
|
41 | 41 | @submission.source = params['file'].read |
|
42 | 42 | @submission.source_filename = params['file'].original_filename |
|
43 | 43 | end |
|
44 | - @submission.submitted_at = Time.new | |
|
44 | + @submission.submitted_at = Time.new.gmtime | |
|
45 | 45 | |
|
46 | 46 | if user.site!=nil and user.site.finished? |
|
47 | 47 | @submission.errors.add_to_base "The contest is over." |
|
48 | 48 | prepare_list_information |
|
49 | 49 | render :action => 'list' and return |
|
50 | 50 | end |
|
51 | 51 | |
|
52 | 52 | if @submission.valid? |
|
53 | 53 | if @submission.save == false |
|
54 | 54 | flash[:notice] = 'Error saving your submission' |
|
55 | 55 | elsif Task.create(:submission_id => @submission.id, |
|
56 | 56 | :status => Task::STATUS_INQUEUE) == false |
@@ -9,19 +9,19 | |||
|
9 | 9 | end |
|
10 | 10 | end |
|
11 | 11 | |
|
12 | 12 | def finished? |
|
13 | 13 | if !self.started |
|
14 | 14 | return false |
|
15 | 15 | end |
|
16 | 16 | |
|
17 | 17 | contest_time = Configuration['contest.time_limit'] |
|
18 | 18 | if tmatch = /(\d+):(\d+)/.match(contest_time) |
|
19 | 19 | h = tmatch[1].to_i |
|
20 | 20 | m = tmatch[2].to_i |
|
21 | - return Time.now > (self.start_time + h.hour + m.minute) | |
|
21 | + return Time.now.gmtime > (self.start_time + h.hour + m.minute) | |
|
22 | 22 | else |
|
23 | 23 | false |
|
24 | 24 | end |
|
25 | 25 | end |
|
26 | 26 | |
|
27 | 27 | end |
@@ -73,25 +73,25 | |||
|
73 | 73 | test_request.errors.add_to_base("No input submitted.") |
|
74 | 74 | test_request.input_file_name = nil |
|
75 | 75 | else |
|
76 | 76 | test_request.input_file_name = save_input_file(params[:input_file], user, problem) |
|
77 | 77 | if test_request.input_file_name == nil |
|
78 | 78 | test_request.errors.add_to_base("No input submitted.") |
|
79 | 79 | end |
|
80 | 80 | if params[:additional_file]!=nil and params[:additional_file]!="" |
|
81 | 81 | save_additional_file(params[:additional_file], |
|
82 | 82 | "#{test_request.input_file_name}.files") |
|
83 | 83 | end |
|
84 | 84 | end |
|
85 | - test_request.submitted_at = Time.new | |
|
85 | + test_request.submitted_at = Time.new.gmtime | |
|
86 | 86 | test_request.status_inqueue |
|
87 | 87 | test_request |
|
88 | 88 | end |
|
89 | 89 | |
|
90 | 90 | protected |
|
91 | 91 | |
|
92 | 92 | def self.name_of(problem) |
|
93 | 93 | if problem!=nil |
|
94 | 94 | problem.name |
|
95 | 95 | else |
|
96 | 96 | "default" |
|
97 | 97 | end |
You need to be logged in to leave comments.
Login now