class Periods

Public Instance Methods

by_id(id) click to toggle source
# File lib/minder/database/periods.rb, line 2
def by_id(id)
  where(id: id)
end
completed_pomodoros() click to toggle source
# File lib/minder/database/periods.rb, line 6
def completed_pomodoros
  where(type: 'work')
    .where('started_at IS NOT NULL')
    .where('ended_at IS NOT NULL')
end
pomodoros_today() click to toggle source
# File lib/minder/database/periods.rb, line 12
def pomodoros_today
  completed_pomodoros.
    where('ended_at BETWEEN ? AND ?',
          Time.now.strftime('%Y-%m-%d 00:00:00'),
          Time.now.strftime('%Y-%m-%d 23:59:59'))
end