mirror of
https://github.com/rickbarrette/stopwatch.git
synced 2026-10-04 10:00:43 -04:00
remove running timer info when the time entry is removed
This commit is contained in:
1 parent
53d5fbafd2
commit
a2096e3208
3 files changed
+43
No files matched your search
@@ -0,0 +1,18 @@
|
||||
module Stopwatch
|
||||
module TimeEntryPatch
|
||||
def self.apply
|
||||
TimeEntry.prepend self unless TimeEntry < self
|
||||
end
|
||||
|
||||
def self.prepended(base)
|
||||
base.class_eval do
|
||||
before_destroy :stop_timer
|
||||
end
|
||||
end
|
||||
|
||||
def stop_timer
|
||||
t = Stopwatch::Timer.new(user)
|
||||
t.update(stop: true) if t.running?
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in new issue
Block a user