Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a report-bikes-cummulative-distance command #14

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

kassick
Copy link

@kassick kassick commented Jan 6, 2024

This PR provides a command to display the cummulative sum of distance and elevation.

I've added the command to help me study how many KMs I had in my bikes between visits do the mechanic

Copy link
Owner

@liskin liskin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Took a quick look. I'd probably want to add some tests for the reports as I struggled to remember how all this works. Something like this that I did recently: https://github.com/liskin/strava-gear/blob/0b6195ca6e08a8790998d2f0e756aba682a6d93c/tests/csv.md, although in here we'd need to first make a way to fill the database with sample data.

I mean, this is more of a note for myself, I don't expect you to do all this, just sort of braindumping. We can probably merge this even without those tests, just need to make the CI pass and tweak the CLI a bit perhaps.

table = (dict(row) for row in db.execute(sql, params))
return tabulate(table, headers='keys')
if format == 'csv':
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we turn this into a separate commit that adds configurable output formats to all reports, pls? You can steal some code from here: https://github.com/liskin/strava-gear/blob/0b6195ca6e08a8790998d2f0e756aba682a6d93c/src/strava_gear/cli.py#L42-L47
Also the strava-gear code passes the output stream to the report function instead of using StringIO, and that's probably better as well. I'll be happy to do this refactoring myself later but if you want to help I wouldn't mind :-)

bike: Optional[str],
start_year: int, end_year: int,
) -> None:
"Show monthly report by bike"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's actually daily, isn't it? Also probably wanna mention "cummulative" here as well :-)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes! I probably changed the default and completely forgot about the docstr

@kassick
Copy link
Author

kassick commented Jan 8, 2024

I coded this about a year ago and used it every couple of months to update the usage of my bikes vs component age and wear. Finally got to merging upstream and PR the changes to see if you though they'd be useful.

I'll take a look at the suggestions when I have some time this week. Probably will disagree with several rushed decisions made by past-self.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants