Show More
Commit Description:
[web] added site and time out basic functionality...
Commit Description:
[web] added site and time out basic functionality
git-svn-id: http://theory.cpe.ku.ac.th/grader/web/trunk@169 6386c4cd-e34a-4fa8-8920-d93eb39b512e
References:
File last commit:
Show/Diff file:
Action:
app/models/site.rb
| 24 lines
| 457 B
| text/x-ruby
| RubyLexer
|
|
r85 | class Site < ActiveRecord::Base | ||
def clear_start_time_if_not_started | ||||
if !self.started | ||||
self.start_time = nil | ||||
end | ||||
end | ||||
def finished? | ||||
if !self.started | ||||
return false | ||||
end | ||||
contest_time = Configuration['contest.time_limit'] | ||||
if tmatch = /(\d+):(\d+)/.match(contest_time) | ||||
h = tmatch[1].to_i | ||||
m = tmatch[2].to_i | ||||
return Time.now > (self.start_time + h.hour + m.minute) | ||||
else | ||||
false | ||||
end | ||||
end | ||||
end | ||||