module MiGA::Dataset::Status

Helper module including specific functions for dataset status

Public Instance Methods

recalculate_status(save = true) click to toggle source

Identify the current status and save it if save and the status changed. Return symbols are the same as status.

# File lib/miga/dataset/status.rb, line 19
def recalculate_status(save = true)
  old_status = metadata[:status]
  metadata[:status] =
    !active? ? 'inactive' : done_preprocessing? ? 'complete' : 'incomplete'
  if save && (old_status.nil? || old_status != metadata[:status])
    self.save
    MiGA::MiGA.DEBUG "Status changed: #{old_status} -> #{metadata[:status]}"
  end
  metadata[:status].to_sym
end
status(save = false) click to toggle source

Returns the status of the dataset. If the status is not yet defined, it recalculates it and, if save is true, saves it in metadata. Return symbols are:

  • :inactive The dataset is currently inactive

  • :incomplete The dataset is not yet fully processed

  • :complete The dataset is fully processed

# File lib/miga/dataset/status.rb, line 11
def status(save = false)
  recalculate_status(save) if metadata[:status].nil?
  metadata[:status].to_sym
end