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

dev: make groupByDateSpan return data when first DateSpan's begin is Nothing #2076

Merged
merged 1 commit into from
Aug 25, 2023

Conversation

jneubrand
Copy link
Contributor

There doesn't seem to be any report code that would hit this bug—just noticed it while working on a script :)

@jneubrand jneubrand changed the title dev: make groupByDateSpan return data when first period has unbounded begin dev: make groupByDateSpan return data when DateSpan's begin is Nothing Aug 25, 2023
@jneubrand jneubrand changed the title dev: make groupByDateSpan return data when DateSpan's begin is Nothing dev: make groupByDateSpan return data when first DateSpan's begin is Nothing Aug 25, 2023
@simonmichael
Copy link
Owner

Thanks!

Is it a bug ? I can't quite tell. If colspans is empty, there's nothing to dropWhile anyway, so the true or false fallback has no effect. It seems like this code could be simpler.

@jneubrand
Copy link
Contributor Author

jneubrand commented Aug 25, 2023

Well, it's a bug in that the code does something unintuitive but only in a path that isn't hit by any code that can be called via the CLI (because you can't provide custom spans to any function that uses groupByDateSpan.)

The fallback doesn't apply [edit: just] when colspans is an empty list, but [edit: also] when the first span has no begin date. So when passing colspans [DateSpan ..2022-12-31,DateSpan 2023] to groupByDateSpan, all postings are discarded instead of none and [(DateSpan ..2022-12-31,[]),(DateSpan 2023,[]))] is returned.

[edit: …and in the case that colspans is an empty list, groupByCols [] _ = [] applies anyway, so behavior is unchanged by this PR]

@simonmichael
Copy link
Owner

I believe you. Thank you!

@simonmichael simonmichael merged commit 97943b2 into simonmichael:master Aug 25, 2023
1 check passed
@jneubrand jneubrand deleted the fix-group-by-date-span branch August 26, 2023 08:11
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