mirror of
https://github.com/rickbarrette/stopwatch.git
synced 2026-04-02 09:51:57 -04:00
always show the running timer in the timers list #5
This commit is contained in:
@@ -86,7 +86,9 @@ class StopwatchTimersController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def load_todays_entries
|
def load_todays_entries
|
||||||
@entries = time_entries.where(spent_on: User.current.today).order(created_on: :asc)
|
@entries = time_entries.where(spent_on: User.current.today).or(
|
||||||
|
time_entries.where(id: User.current.running_time_entry_id)
|
||||||
|
).order(created_on: :asc)
|
||||||
end
|
end
|
||||||
|
|
||||||
def time_entries
|
def time_entries
|
||||||
|
|||||||
@@ -9,8 +9,13 @@ module Stopwatch
|
|||||||
end
|
end
|
||||||
|
|
||||||
def is_running_timer?(time_entry)
|
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 = Stopwatch::Timer.new(self)
|
||||||
timer.running? and timer.time_entry_id == time_entry.id
|
timer.time_entry_id if timer.running?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user