pydoro icon indicating copy to clipboard operation
pydoro copied to clipboard

Save daily statistics of each work/break period into a CSV file

Open JaDogg opened this issue 6 years ago • 6 comments

  • Simple local CSV file for those who want's to analyse their data.
  • No servers/internet needed. Everything is saved locally at a location provided by user.
  • Append only writing for each completed task.

CSV Contents

date unix-date start-time unix-start-time end-time unix-end-time pauses type configured-time actual-time
2020/01/20 6:55AM 7:15AM 0 WORK 1200 1200
  • Both human readable dates and unix dates are provided. Human readable date is in current timezone. Unix time will be UTC time.
  • Why UNIX time? Situations where you are working in multiple time-zones (& system is properly updated with new time). Unix time still works.
  • types: WORK, SBREAK, LBREAK
  • pauses: Total pauses you did
  • configured-time: What is the time configured for this type of work
  • actual-time: Actually taken time including pauses within same work/break period. This can also be calculated by unix-end-time - unix-start-time. Provided for convenience.

JaDogg avatar Jan 26 '20 07:01 JaDogg

Neat! This interests me :P

I'm not sure if these statistics are useful though. But we could make a simple framework for saving statistics and then, after the framework is done, it should be easy enough to add, remove or modify which stats are being saved.

gmelodie avatar Jan 26 '20 18:01 gmelodie

It's good that we already have config file now. We can add configurable features.

JaDogg avatar Jan 26 '20 19:01 JaDogg

So here's what I was thinking:

  • Change .pydoro.ini to pydoro.ini inside a ~/.pydoro folder (configurable through env var)
  • Put stats.csv inside .pydoro folder
  • Only work with unix timestamps (for start_time and end_time) and unix dates. Treat to local timezone only when writing to CSV

  • Pydoro started
    • start_time = time.time()
    • date = today > dunno how I'll do this yet
    • start_pause = start_time > time before first work session is handled as a pause (but don't count in pauses
  • Work paused
    • start_pause = time.time()
    • pauses += 1
  • Work resumed (or began)
    • total_pause_time += time.time() - start_pause
  • Quit Pydoro
    • overall_time = time.time() - start_time
    • total_work_time = overall_time - total_pause_time
    • Treat timezones
    • Append data to CSV file
  • If user doesn't quit nicely (e.g. CTRL+C), don't save stats (maybe improve that in the future)

gmelodie avatar Apr 21 '20 17:04 gmelodie

@gmelodie I think that's sufficient let's not worry about time-zone at the moment.

We shouldn't make it automatically collect stats. It should only be enabled from command line or .ini file. 🤔

JaDogg avatar Apr 22 '20 15:04 JaDogg

Oh I forgot to say that. I added a --no-stats argument to the CLI and the equivalent to the ini file. Should I change that to --collect-stats instead?

gmelodie avatar Apr 22 '20 20:04 gmelodie

Yes please.

JaDogg avatar Apr 23 '20 11:04 JaDogg

This feature is still need to implement or already existing? I didn't find the function usage in documentation. It looks useful feature to have.

GmGniap avatar Apr 03 '23 02:04 GmGniap

It still need to be implemented.

On Mon, Apr 3, 2023, 3:51 AM GmGniap @.***> wrote:

This feature is still need to implement or already existing? I didn't find the function usage in documentation. It looks useful feature to have.

— Reply to this email directly, view it on GitHub https://github.com/JaDogg/pydoro/issues/88#issuecomment-1493563394, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADZXUUGTSZSMPL4HCB4OU3W7I3J7ANCNFSM4KLVIGOQ . You are receiving this because you authored the thread.Message ID: @.***>

JaDogg avatar Apr 03 '23 05:04 JaDogg