# HG changeset patch # User jittat # Date 2008-05-09 13:33:00 # Node ID adeb816b0bb6f5c04f298432c6a9cc0f44c61e49 # Parent f40baf68cc551052dc2271efbd4faf615d6e48c9 [web] fix nil problem in various place, some styling git-svn-id: http://theory.cpe.ku.ac.th/grader/web/trunk@259 6386c4cd-e34a-4fa8-8920-d93eb39b512e diff --git a/app/models/configuration.rb b/app/models/configuration.rb --- a/app/models/configuration.rb +++ b/app/models/configuration.rb @@ -34,7 +34,7 @@ return false if mode=='analysis' if (mode=='contest') return false if (user.site!=nil) and - ((user.site.started==false) or (user.site.finished?)) + ((user.site.started!=true) or (user.site.finished?)) end return true end @@ -42,7 +42,7 @@ def self.show_tasks_to?(user) mode = get(SYSTEM_MODE_CONF_KEY) if (mode=='contest') - return false if (user.site!=nil) and (user.site.started==false) + return false if (user.site!=nil) and (user.site.started!=true) end return true end @@ -50,8 +50,7 @@ def self.allow_test_request(user) mode = get(SYSTEM_MODE_CONF_KEY) if (mode=='contest') - return false if (user.site!=nil) and ((user.site.started==false) or - (user.site.time_left < 30.minutes)) + return false if (user.site!=nil) and ((user.site.started!=true) or (user.site.time_left < 30.minutes)) end return false if mode=='analysis' return true diff --git a/app/models/site.rb b/app/models/site.rb --- a/app/models/site.rb +++ b/app/models/site.rb @@ -14,8 +14,13 @@ if tmatch = /(\d+):(\d+)/.match(contest_time) h = tmatch[1].to_i m = tmatch[2].to_i - finish_time = self.start_time + h.hour + m.minute + current_time = Time.now.gmtime + if self.start_time!=nil + finish_time = self.start_time + h.hour + m.minute + else + finish_time = current_time + h.hour + m.minute + end if current_time > finish_time return current_time - current_time diff --git a/app/views/main/list.html.haml b/app/views/main/list.html.haml --- a/app/views/main/list.html.haml +++ b/app/views/main/list.html.haml @@ -25,8 +25,3 @@ %hr/ -%p - %b Note: - We currently have problems synchronizing - the time stamps between grading machines. - You will see weird time stamps during the practice session. diff --git a/app/views/test/index.html.erb b/app/views/test/index.html.erb --- a/app/views/test/index.html.erb +++ b/app/views/test/index.html.erb @@ -77,7 +77,7 @@ - * This option works only for task max. + * This option works only for task beads. You can use this to submit questions.txt.
The file shall be copied to the execution directory before your program runs.