vmiklos / plees-tracker

Plees Tracker is a simple sleep tracker for your Android phone.
https://vmiklos.hu/plees-tracker/
MIT License
167 stars 38 forks source link

Sleep Tracking Pause Button #389

Open LinuxinaBit opened 1 year ago

LinuxinaBit commented 1 year ago

I've discovered something rather important that is missing, a button to pause sleep tracking. It may seem unnecessary, but on nights when I wake up at 2AM for no reason, I would like to not have 10 hours of sleep throwing off my averages. If this is implemented, a "sleep interruption" feature could also be added somewhere to represent how much your sleep has been interrupted, and track it. Thank you.

vmiklos commented 1 year ago

Hmm, the idea is that you can just tracking and then you start tracking again. The default is to show the average of daily sums, so you don't hurt your nice average if you stop for an hour, read a book, get sleepy again and then you start tracking.

With that in mind, does it still make sense to clutter the UI with pause functionality? If so, how would the UI for this look like? Currently you have a single FloatingActionButton to stop tracking, it's not clear to me how we would do a pause.

LinuxinaBit commented 1 year ago

True. I was just thinking a "time awake" statistic would be good. Also such pausing could still mess with the averages depending on how the daily sleep rollover is calculated. Maybe there could be a seperate slide up ui panel that has the pause and stop buttons as well as some other stuff like a flashlight and clock. Similar to how a keyboard would pop up.

On May 31, 2023 2:10:51 PM CDT, Miklos Vajna @.***> wrote:

Hmm, the idea is that you can just tracking and then you start tracking again. The default is to show the average of daily sums, so you don't hurt your nice average if you stop for an hour, read a book, get sleepy again and then you start tracking.

With that in mind, does it still make sense to clutter the UI with pause functionality? If so, how would the UI for this look like? Currently you have a single FloatingActionButton to stop tracking, it's not clear to me how we would do a pause.

-- Reply to this email directly or view it on GitHub: https://github.com/vmiklos/plees-tracker/issues/389#issuecomment-1570783308 You are receiving this because you authored the thread.

Message ID: @.***>

clicky6 commented 11 months ago

+1

vmiklos commented 11 months ago

Thinking about this a bit more, the pause functionality could be added with a long tap on the stop button. But then the question is what to do with the data model, which really just has a start and a stop timestamp for the sleep. If you pause for 1h, then just resume and a final stop would lead to a sleep that has the original start timestamp and the new stop timestamp and the length of the sleep would be incorrect.

If the use-case is to please the "average" graph, then perhaps this could be a new column in the sleeps table, which would be the total length of pauses in the sleep. That would be backwards-compatible, but need to handle that at several places, I guess.

Are you interested in doing a PR for this yourself?