Fix: January bin dates being treated as past during December
Some councils return January collection dates using the current year during December. For example, Bromley just lists the day and month, which is then interpreted as the current year rather than next year. This causes valid upcoming collections to be dropped. This change corrects the year in Dec → Jan rollover cases.
Summary by CodeRabbit
-
Bug Fixes
- Fixed bin collection date handling for collections that cross year boundaries. When viewing upcoming collections in December scheduled for January, dates now correctly reflect the following year.
✏️ Tip: You can customize this high-level summary in your review settings.
📝 Walkthrough
Walkthrough
A rollover-year correction has been added to the process_bin_data function. When a bin collection date is in the past but crosses a year boundary (December transitioning to January), the code now adjusts the year forward and logs the correction before determining the next collection date.
Changes
| Cohort / File(s) | Summary |
|---|---|
Year-rollover correction logic custom_components/uk_bin_collection/__init__.py |
Added conditional logic in process_bin_data to detect and correct bin collection dates that span year boundaries (December month → January month), bumping the year forward with logging to capture the adjustment. |
Estimated code review effort
🎯 2 (Simple) | ⏱️ ~10 minutes
Possibly related issues
- robbrad/UKBinCollectionData#1454 — Addresses year-adjustment logic for bin collection dates crossing year boundaries, similar to a reported bug in AdurAndWorthingCouncils module.
Suggested reviewers
- dp247
Poem
🐰 A hop, a skip, through December's last call,
When bins meet the new year, we don't miss at all!
The dates now roll forward with hop and a bound,
Year-end transitions? No confusion is found! ✨
Pre-merge checks and finishing touches
✅ Passed checks (3 passed)
| Check name | Status | Explanation |
|---|---|---|
| Description Check | ✅ Passed | Check skipped - CodeRabbit’s high-level summary is enabled. |
| Title check | ✅ Passed | The title accurately describes the main fix: correcting January bin collection dates that were incorrectly treated as past dates during December, matching the core objective of the pullrequest. |
| Docstring Coverage | ✅ Passed | Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. |
✨ Finishing touches
- [ ] 📝 Generate docstrings
🧪 Generate unit tests (beta)
- [ ] Create PR with unit tests
- [ ] Post copyable unit tests in a comment
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands and usage tips.
Codecov Report
:x: Patch coverage is 33.33333% with 2 lines in your changes missing coverage. Please review.
:white_check_mark: Project coverage is 86.67%. Comparing base (83cce53) to head (0301ad5).
:warning: Report is 4 commits behind head on master.
| Files with missing lines | Patch % | Lines |
|---|---|---|
| custom_components/uk_bin_collection/__init__.py | 33.33% | 2 Missing :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## master #1787 +/- ##
==========================================
- Coverage 86.81% 86.67% -0.15%
==========================================
Files 9 9
Lines 1138 1141 +3
==========================================
+ Hits 988 989 +1
- Misses 150 152 +2
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.