Create records in database when tracking spent time

parent fde61543
...@@ -46,13 +46,13 @@ module TimeTrackable ...@@ -46,13 +46,13 @@ module TimeTrackable
private private
def reset_spent_time def reset_spent_time
timelogs.new(time_spent: total_time_spent * -1, user: @time_spent_user) timelogs.create(time_spent: total_time_spent * -1, user: @time_spent_user)
end end
def add_or_subtract_spent_time def add_or_subtract_spent_time
# Exit if time to subtract exceeds the total time spent. # Exit if time to subtract exceeds the total time spent.
return if time_spent < 0 && (time_spent.abs > total_time_spent) return if time_spent < 0 && (time_spent.abs > total_time_spent)
timelogs.new(time_spent: time_spent, user: @time_spent_user) timelogs.create(time_spent: time_spent, user: @time_spent_user)
end end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment