Please enable JavaScript to use RhodeCode Enterprise
Commit Description:
add model solution
Commit Description:
add model solution
class Task < ActiveRecord :: Base
belongs_to :submission
STATUS_GRADING = 0
STATUS_INQUEUE = 1
STATUS_COMPLETE = 2
def status_inqueue
self . status = Task :: STATUS_INQUEUE
end
def status_inqueue!
status_inqueue
self . save
end
def status_grading
self . status = Task :: STATUS_GRADING
end
def status_grading!
status_grading
self . save
end
def status_complete
self . status = Task :: STATUS_COMPLETE
end
def status_complete!
status_complete
self . save
end
def status_str
case self . status
when Task :: STATUS_INQUEUE
"inqueue"
when Task :: STATUS_GRADING
"grading"
when Task :: STATUS_COMPLETE
"complete"
end
end
def self . get_inqueue_and_change_status ( status )
task = nil
begin
Task . transaction do
task = Task . where ( status : Task :: STATUS_INQUEUE ) . lock ( true ) . first
if task! = nil
task . status = status
task . save!
end
end
rescue
task = nil
end
task
end
end
Site-wide shortcuts
/
Use quick search box
g h
Goto home page
g g
Goto my private gists page
g G
Goto my public gists page
n r
New repository page
n g
New gist page
Repositories
g s
Goto summary page
g c
Goto changelog page
g f
Goto files page
g F
Goto files page with file search activated
g p
Goto pull requests page
g o
Goto repository settings
g O
Goto repository permissions settings