Class: Workflow

Inherits:
ApplicationRecord
  • Object
show all
Defined in:
app/models/workflow.rb

Constant Summary collapse

STAT =
%i[
  internal_labour
  external_labour
  internal_paint
  external_paint
  upholstery
  storage
  construction_yard
]
STAT_TRANSLATED =
STAT.each_with_index.map {|a,i| [I18n.t("statuses.#{a.to_sym}"), (i+1).to_s]}

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.statsObject



71
72
73
# File 'app/models/workflow.rb', line 71

def self.stats
  STAT
end

.stats_translatedObject



75
76
77
# File 'app/models/workflow.rb', line 75

def self.stats_translated
  STAT_TRANSLATED
end

Instance Method Details

#barcodeObject



55
56
57
# File 'app/models/workflow.rb', line 55

def barcode
  chosen_item.barcode
end

#commissionObject

useful for filters



35
36
37
# File 'app/models/workflow.rb', line 35

def commission
  chosen_item.chosen_furniture.chosen_room.chosen_deck.commission.code rescue "-"
end

#deckObject



39
40
41
# File 'app/models/workflow.rb', line 39

def deck
  chosen_item.chosen_furniture.chosen_room.chosen_deck.deck.name rescue "-"
end

#display_nameObject



90
91
92
93
# File 'app/models/workflow.rb', line 90

def display_name
  # [commission, deck, room, furniture, item].compact.join(" - ")
  chosen_item.barcode
end

#furnitureObject



47
48
49
# File 'app/models/workflow.rb', line 47

def furniture
  chosen_item.chosen_furniture.furniture.name rescue "-"
end

#itemObject



51
52
53
# File 'app/models/workflow.rb', line 51

def item
  chosen_item.furniture_item.item.name rescue "-"
end

#roomObject



43
44
45
# File 'app/models/workflow.rb', line 43

def room
  chosen_item.chosen_furniture.chosen_room.room.name rescue "-"
end

#statObject



86
87
88
# File 'app/models/workflow.rb', line 86

def stat
  I18n.t "statuses.#{STAT[(statuses.to_i-1)].to_sym}"
end

#statuses_enumObject



79
80
81
82
83
84
# File 'app/models/workflow.rb', line 79

def statuses_enum
  # Array holding all the roles
  # Do not EDIT below this line
  # statuses.map {|s| I18n.t("statuses.#{s.to_sym}")}
  STAT_TRANSLATED
end