mirror of
https://github.com/rickbarrette/stopwatch.git
synced 2026-04-02 09:51:57 -04:00
25 lines
561 B
Ruby
25 lines
561 B
Ruby
module Stopwatch
|
|
module UserPatch
|
|
extend ActiveSupport::Concern
|
|
|
|
def timer_running?
|
|
Stopwatch::Timer.new(self).running?
|
|
end
|
|
|
|
def is_running_timer?(time_entry)
|
|
id = running_time_entry_id
|
|
id.present? and time_entry.id == id
|
|
end
|
|
|
|
def running_time_entry_id
|
|
timer = Stopwatch::Timer.new(self)
|
|
timer.time_entry_id if timer.running?
|
|
end
|
|
|
|
def todays_time_entry_for(issue)
|
|
TimeEntry.order(created_on: :desc).
|
|
find_or_initialize_by(user: self, issue: issue, spent_on: today)
|
|
end
|
|
end
|
|
end
|