mirror of
https://github.com/rickbarrette/stopwatch.git
synced 2026-04-02 09:51:57 -04:00
22 lines
436 B
Ruby
22 lines
436 B
Ruby
module Stopwatch
|
|
module UserPatch
|
|
def self.apply
|
|
User.prepend self unless User < self
|
|
end
|
|
|
|
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
|
|
end
|
|
end
|