Class: Twenty::Task

Inherits:
Sequel::Model
  • Object
show all
Includes:
Model
Defined in:
lib/twenty/server/model/task.rb

Constant Summary collapse

STATUS_MAP =
{backlog: 0, ready: 1, in_progress: 2, complete: 3}
STATUS_KEYS =
STATUS_MAP.keys

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Model

included

Class Method Details

.by_status(status) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/twenty/server/model/task.rb', line 11

def self.by_status(status)
  if STATUS_KEYS.any? { _1.to_s == status.to_s }
    public_send(status)
  else
    where(id: nil)
  end
end

Instance Method Details

#statusObject



29
30
31
# File 'lib/twenty/server/model/task.rb', line 29

def status
  super.to_s
end

#status=(v) ⇒ Object



25
26
27
# File 'lib/twenty/server/model/task.rb', line 25

def status=(v)
  super(v.to_sym)
end