Class: Timelog

Inherits:
ApplicationRecord show all
Includes:
IgnorableColumns, Importable, Sortable
Defined in:
app/models/timelog.rb

Constant Summary

Constants inherited from ApplicationRecord

ApplicationRecord::MAX_PLUCK

Constants included from ResetOnUnionError

ResetOnUnionError::MAX_RESET_PERIOD

Instance Attribute Summary

Attributes included from Importable

#imported, #importing

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApplicationRecord

cached_column_list, #create_or_load_association, declarative_enum, default_select_columns, id_in, id_not_in, iid_in, pluck_primary_key, primary_key_in, #readable_by?, safe_ensure_unique, safe_find_or_create_by, safe_find_or_create_by!, #to_ability_name, underscore, where_exists, where_not_exists, with_fast_read_statement_timeout, without_order

Methods included from SensitiveSerializableHash

#serializable_hash

Class Method Details

.sort_by_field(field) ⇒ Object



49
50
51
52
53
54
55
56
57
# File 'app/models/timelog.rb', line 49

def self.sort_by_field(field)
  case field.to_s
  when 'spent_at_asc' then order_scope_asc(:spent_at)
  when 'spent_at_desc' then order_scope_desc(:spent_at)
  when 'time_spent_asc' then order_scope_asc(:time_spent)
  when 'time_spent_desc' then order_scope_desc(:time_spent)
  else order_by(field)
  end
end

Instance Method Details

#issuableObject



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

def issuable
  issue || merge_request
end