Class: Workflow
- Inherits:
-
ApplicationRecord
- Object
- ApplicationRecord
- Workflow
- 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
- #barcode ⇒ Object
-
#commission ⇒ Object
useful for filters.
- #deck ⇒ Object
- #display_name ⇒ Object
- #furniture ⇒ Object
- #item ⇒ Object
- #room ⇒ Object
- #stat ⇒ Object
- #statuses_enum ⇒ Object
Class Method Details
.stats ⇒ Object
71 72 73 |
# File 'app/models/workflow.rb', line 71 def self.stats STAT end |
.stats_translated ⇒ Object
75 76 77 |
# File 'app/models/workflow.rb', line 75 def self.stats_translated STAT_TRANSLATED end |
Instance Method Details
#barcode ⇒ Object
55 56 57 |
# File 'app/models/workflow.rb', line 55 def chosen_item. end |
#commission ⇒ Object
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 |
#deck ⇒ Object
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_name ⇒ Object
90 91 92 93 |
# File 'app/models/workflow.rb', line 90 def display_name # [commission, deck, room, furniture, item].compact.join(" - ") chosen_item. end |
#furniture ⇒ Object
47 48 49 |
# File 'app/models/workflow.rb', line 47 def furniture chosen_item.chosen_furniture.furniture.name rescue "-" end |
#item ⇒ Object
51 52 53 |
# File 'app/models/workflow.rb', line 51 def item chosen_item.furniture_item.item.name rescue "-" end |
#room ⇒ Object
43 44 45 |
# File 'app/models/workflow.rb', line 43 def room chosen_item.chosen_furniture.chosen_room.room.name rescue "-" end |
#stat ⇒ Object
86 87 88 |
# File 'app/models/workflow.rb', line 86 def stat I18n.t "statuses.#{STAT[(statuses.to_i-1)].to_sym}" end |
#statuses_enum ⇒ Object
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 |