mirror of
https://github.com/rickbarrette/stopwatch.git
synced 2026-11-17 19:50:36 -05:00
works, basically
This commit is contained in:
1 parent
70257cdee0
commit
20ccbba2c1
24 files changed
+355
-27
No files matched your search
+12
-1
@@ -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
|
||||
|
||||
Reference in new issue
Block a user