Class: Result

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/result.rb

Instance Method Summary collapse

Instance Method Details

#enqueue_durationObject



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!(message)
  update_attributes!(status: 'failed', error_message: 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_countObject



41
42
43
# File 'app/models/result.rb', line 41

def redis_result_row_count
  @redis_result_row_count ||= RedisResultRowCount.new(self)
end

#result_csvObject



37
38
39
# File 'app/models/result.rb', line 37

def result_csv
  @result_csv ||= ResultCsv.new(id)
end

#row_countObject



33
34
35
# File 'app/models/result.rb', line 33

def row_count
  super || ongoing_row_count
end

#run_durationObject



45
46
47
# File 'app/models/result.rb', line 45

def run_duration
  duration(:started_at, :completed_at)
end