works, basically

This commit is contained in:
Jens Kraemer committed 2020-04-24 17:20:18 +08:00
1 parent 70257cdee0
commit 20ccbba2c1
24 files changed
+355 -27

No files matched your search

+12 -1
View File
@@ -21,7 +21,7 @@ module Stopwatch
def stop
if hours = runtime_hours and
time_entry = TimeEntry.find_by_id(data[:time_entry_id])
time_entry = TimeEntry.find_by_id(time_entry_id)
time_entry.update_column :hours, time_entry.hours + hours
end
@@ -29,11 +29,22 @@ module Stopwatch
save
end
def to_json
{
time_entry_id: time_entry_id,
running: running?
}.to_json
end
def save
user.pref[:current_timer] = data.to_json
user.pref.save
end
def time_entry_id
data[:time_entry_id]
end
private
def data