Commit 0fdf0caf authored by BAIRE Anthony's avatar BAIRE Anthony
Browse files

display "done" instead of "success" to the user

(will be less confusing, also "done" is more neutral than "success"
 it applies well to past jobs that have errors)
parent 0ad5229b
......@@ -43,7 +43,6 @@ class JobResult(enum.IntEnum):
ERROR = 2
ABORTED = 3
TIMEOUT = 4
DONE = 5
class Webapp(Base):
......
......@@ -58,10 +58,6 @@ class Job < ActiveRecord::Base
# job timed out
TIMEOUT: 4,
# job done (only for pre-migration jobs, because we do not now the outcome)
# (small case because it conflicts with state.DONE)
done: 5,
}
scope :not_archived, -> { where.not(state: "ARCHIVED") }
......@@ -109,7 +105,7 @@ class Job < ActiveRecord::Base
# status of the job
# return either .state or .result (which one is more useful)
def status
((DONE? or ARCHIVED?) ? result : state).downcase
(((DONE? or ARCHIVED?) and not SUCCESS?) ? result : state).downcase
end
def make_directory
......
class AddJobResult < ActiveRecord::Migration[5.0]
def up
add_column :jobs, :result, :integer, default: 0, null: false
execute 'UPDATE jobs SET result=5 WHERE state IN (3, 4);'
# set result=SUCCESS for all terminated jobs
execute 'UPDATE jobs SET result=1 WHERE state IN (3, 4);'
end
def down
remove_column :jobs, :result
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment