stretchly icon indicating copy to clipboard operation
stretchly copied to clipboard

History and Timeline of Breaks

Open aleuca opened this issue 6 years ago • 15 comments

Feature addition

Add a new window with history and timeline for breaks. Acceptance criteria:

  • [ ] stretchly has events: break has started, break has finished, user has entered idle time, idle time ended, system went to sleep, wake up of the system, etc...
  • [ ] every of this event is saved into local DB file (eg. Event) - SQLite or Postgres?
  • [ ] when we are saving event, and we know it's the end of the event (eg end of break), we save new line in DB, let's say Activity (regural break, idle time, skipped break, extra break...)
  • [ ] from Activities, we can then have some stats, graphs for skipped break, idle time etc..

Reference #200 and #86

@Sveijk

aleuca avatar Jul 07 '18 11:07 aleuca

List

List of all events we could find and actions or state. Here's also an image attached of sketches for a data graph. Items that could be subject of the graph are:

  • [ ] Counters (number of breaks, etc during some timeframe)
  • [ ] Time (duration total of breaks, etc during some timeframe)

Image of our awesome drawn graph

Events

  • [ ] Go on break
  • [ ] Go on microbreak
  • [ ] Pause breaks
  • [ ] Pause microbreaks
  • [ ] Reset timer on breaks
  • [ ] Go to idle mode
  • [ ] Come out of idle mode
  • [ ] Skip a break
  • [ ] Finish break
  • [ ] Finish microbreak
  • [ ] Skip timer to the next break
  • [ ] Skip timer to next microbreak
  • [ ] Change settings { microbreaks enabled; microbreaks disabled; breaks enabled; breaks disabled }
  • [ ] Reset to defaults
  • [ ] Timing changed
  • [ ] Skip enabled or disabled breaks / microbreaks
  • [ ] Break induced
  • [ ] Microbreak induced
  • [ ] Manual pause (for an hour; for 2 hours; for 5 hours; indefinately) finished
  • [ ] Normal pause finished
  • [ ] Postponed

Activity / State

  • [ ] Work
  • [ ] Idle (computer idle or turned off)
  • [ ] Break
  • [ ] Suspended / paused
  • [ ] Microbreak
  • [ ] DND / presentation mode

Sveijk avatar Jul 11 '18 12:07 Sveijk

I wrote a whole explanation of why i would do it a different way, and then I realized that yours is better. Great work!!!

drigberg avatar Jul 11 '18 12:07 drigberg

Could you provide a proposal for the Event schema? Example:

{
    id: string,
    type: string,
    timestamp: date
}

drigberg avatar Jul 11 '18 12:07 drigberg

Hey folks, so some things I've been thinking about. I've polished your list of States

Activity / State

  • work (when user is doing whatever she wants)
  • idle/natural break (when we are in idle time - meaning user has been idle longer as 5 minutes - as it it in app right now)
  • break (when break is on)
  • microbreak (when microbreak is on)
  • paused (user has manually paused)
  • DND / presentation mode
  • suspend (computer is in sleep)
  • turned off (pc is turned off)

and questions I am not sure about:

  • do we need to differ between suspend and PC turned off?
  • what will happen when break is on and PC is suspended/turned off?
  • do we need to differ between break and microbreak and natural break? (I guess we want to differ)
  • do we want to have manually started breaks separately?

More specific stats that we would like to have in the end should help us answer this.

Events

We do not need events like user changed some settings and so on. I think the Event should be an event inside application that causes one user State to change to another.

hovancik avatar Jul 13 '18 12:07 hovancik

We researched which database could be used with an Electron App. A database that wouldn't make the user install anything extra other than Stretchly. It seems that there're two options here that we know of: Sqlite and NeDB.

Sveijk avatar Jul 14 '18 08:07 Sveijk

I'm for SQLite

hovancik avatar Jul 16 '18 06:07 hovancik

I don’t think you need to use a full fledged database, couldn’t you just store things in the default app.getPath('userData') data folder?

Hum4n01d avatar Sep 07 '18 05:09 Hum4n01d

Are there any updates on this? I would love to add this to the current statistics I am tracking to analyze my productivity.

For my use case, the same stats that workrave tracks for breaks (micro and long) would be perfect:

  • Daily Number of prompted breaks taken
  • Daily Number of breaks skipped
  • Daily Number breaks postponed

nicolae-stroncea avatar Sep 11 '20 02:09 nicolae-stroncea

Hi @nicolae-stroncea , no progress. There was some work done by RGSoC students few years ago, but that would be much outdated now.

hovancik avatar Sep 12 '20 07:09 hovancik

I ran stretchly form the CLI and noticed that the logs are very detailed and would provide me exactly the information that I need:

17:24:27.186 › Stretchly: starting Mini Break
17:24:57.192 › Stretchly: finishing Mini Break
17:30:03.993 › Stretchly: pausing breaks because of idle time
17:31:00.055 › Stretchly: resuming breaks after idle time
17:40:50.055 › Stretchly: showing Mini Break notification
17:41:00.519 › Stretchly: showing window 1 of 1
17:41:00.521 › Stretchly: starting Mini Break
17:41:31.580 › Stretchly: finishing Mini Break

Are the logs permanently written to some file by any chance? For me, a persistent log file containing the above would be enough to parse and extract the useful information I need.

As a side note, feels like the same place where this is logged, events could also just be sent to a SQLite database with very little changes (one col for start time, end time, and one for event type)

nicolae-stroncea avatar Sep 12 '20 23:09 nicolae-stroncea

Yes, it is saved to log file. More info in README, log is rotated, though. In debug info of About page, you can see file location.

hovancik avatar Sep 14 '20 12:09 hovancik

I'm so tempted to have a go at this but will probably end up reading from the existing log file as previous adventurers have concluded. Looking at there 2018 PR, you'd really need to split this up into more finely grained PRs IMO:

  • Add SQLite with flexible events format
  • Start adding different event types (basically follow where existing electron log messages are)
  • Add option to export stats as CSV (low lift, would unblock most people interested in this right now anyway I suspect)
  • Add new section under preferences to show stats / graphs etc

With possible follow up:

  • Make stat collection opt-in
  • Clear stats option
  • Compaction to avoid this growing too quickly
  • More ways to show / visualise stats

cdlewis avatar Jan 05 '21 03:01 cdlewis

Yes, I think I agree this is a huge thing to implement. SQLite would definitely need testing, if it were working on packaged app etc. Remember when we were looking into it few years ago, it was not unproblematic.

Starting with UI/wireframes is good in a way that it gives sense what data we need from "backend"

hovancik avatar Jan 17 '21 17:01 hovancik

Solving this would obviously require major efforts, so it's unlikely to happen shortly. Meanwhile, Workrave offers good usage statistics. These cover breaks: image ...as well as activity: image

I realize as I write this that these statistics are unreliable (the proportion of natural breaks I take is surely not 15 on 15), and usage time has always been largely underestimated for me, but still, I'm afraid it will take a while before Stretchly gets to that level. I find weekly and monthly usage to be the most useful metrics.

Chealer avatar Aug 12 '21 23:08 Chealer

Appreciated.

Faith-Mian avatar Jun 20 '22 04:06 Faith-Mian