vmiklos / plees-tracker

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

Customize Dashboard duration #88

Closed ghost closed 3 years ago

ghost commented 3 years ago

I recently tried importing my years of sleeps from Sleep As Android into Plees[1], and noticed that the Dashboard summary is always set to stats of all previous sleeps. While this made sense initially, I'd personally rather see only stats from just my recent sleeps, eg the past week. Would it be possible to make the Dashboard summary duration customizable, for example to the options provided in the Statistics page (Last 7 days, This year, All time)?

1: If anybody else needs it, here's the quick Python script I wrote to convert Sleep as Android CSV to Plees CSV: https://gist.github.com/usashiki/d6f918b1d3c8035f3da8a9f51962c417 Edit: see contrib/sleep-as-android.py

vmiklos commented 3 years ago

That's a good idea. Also, what about sending a PR to add your script in a new contrib/ directory?

ghost commented 3 years ago

Thinking about this a bit more, if someone for example had Last 7 days selected as their Dashboard duration, it would probably make more sense at that point to list only the last 7 days of sleeps below instead of all the previous sleeps. The full list could be shown in the Statistics page or a new Sleeps page.

For full transparency, this is basically how Sleep as Android's tab view works: there's a Stats tab, which shows summary stats and a list of the previous sleeps, and a Graphs tab with all the previous sleeps.

Sleep as Android screenshots Stats tab: ![stats](https://user-images.githubusercontent.com/2847492/104853118-9a891f00-58b3-11eb-85ed-a282c1b2abcf.png) Graphs tab: ![graphs](https://user-images.githubusercontent.com/2847492/104853119-9f4dd300-58b3-11eb-8d45-19c2731a8bbb.png)
vmiklos commented 3 years ago

This sounds doable, there is already code in the stats activity to do the usual counting (and 2 averages) for different periods, you would do the same type of limiting in the main activity + a new setting for it.

Are you interested in looking in this yourself?

ghost commented 3 years ago

I don't have experience with Android dev in Kotlin/Java (only a bit of Flutter), but I can take a stab at it after I finish with the project I'm currently working on.

vmiklos commented 3 years ago

This is fixed on master, thanks for your work!

ghost commented 3 years ago

Thanks so much for all the help!