Closed dqnne closed 2 months ago
The fix for this is easier than I thought it would be at first glance.
COUNT(
CASE
WHEN DATE(created, 'unixepoch', 'localtime') =
DATE('now', 'localtime') AND hidden = 0
AND gym_sets.plan_id = $planId
THEN 1
END
)
This code is checking the DATE (stripping time) is the same as the gym set. If I do this instead:
COUNT(
CASE
WHEN created >= strftime('%s', 'now', 'localtime', '-24 hours')
AND hidden = 0
AND gym_sets.plan_id = $planId
THEN 1
END
)
It checks that the gym set and today are within 24hours of each other.
When a workout starts before midnight and ends after, the app treats sets completed after midnight as part of a new session rather than continuing the previous one. This is intended, but annoying for people like me who often train around that time. I think this could be solved with some sort of grace period, e.g. if new sets are entered within 1h (gotta accommodate for powerlifter rest times) they count toward the same session despite being past midnight. Thoughts?