Class: Result
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Result
- Defined in:
- app/models/result.rb
Instance Method Summary collapse
- #enqueue_duration ⇒ Object
- #mark_complete_with_count(row_count) ⇒ Object
- #mark_failed!(message) ⇒ Object
- #mark_processing_from_sample(result_sample) ⇒ Object
- #mark_running! ⇒ Object
- #redis_result_row_count ⇒ Object
- #result_csv ⇒ Object
- #row_count ⇒ Object
- #run_duration ⇒ Object
Instance Method Details
#enqueue_duration ⇒ Object
49 50 51 |
# File 'app/models/result.rb', line 49 def enqueue_duration duration(:created_at, :started_at) end |
#mark_complete_with_count(row_count) ⇒ Object
25 26 27 |
# File 'app/models/result.rb', line 25 def mark_complete_with_count(row_count) update_attributes!(status: 'complete', row_count: row_count, completed_at: Time.now) end |
#mark_failed!(message) ⇒ Object
29 30 31 |
# File 'app/models/result.rb', line 29 def mark_failed!() update_attributes!(status: 'failed', error_message: , completed_at: Time.now) end |
#mark_processing_from_sample(result_sample) ⇒ Object
21 22 23 |
# File 'app/models/result.rb', line 21 def mark_processing_from_sample(result_sample) update_attributes!(status: 'processing', sample_data: result_sample) end |
#mark_running! ⇒ Object
17 18 19 |
# File 'app/models/result.rb', line 17 def mark_running! update_attributes!(status: 'running', started_at: Time.now) end |
#redis_result_row_count ⇒ Object
41 42 43 |
# File 'app/models/result.rb', line 41 def redis_result_row_count @redis_result_row_count ||= RedisResultRowCount.new(self) end |
#result_csv ⇒ Object
37 38 39 |
# File 'app/models/result.rb', line 37 def result_csv @result_csv ||= ResultCsv.new(id) end |
#row_count ⇒ Object
33 34 35 |
# File 'app/models/result.rb', line 33 def row_count super || ongoing_row_count end |
#run_duration ⇒ Object
45 46 47 |
# File 'app/models/result.rb', line 45 def run_duration duration(:started_at, :completed_at) end |