fix: add Configuration filter support for moon2024 logbook queries#73
fix: add Configuration filter support for moon2024 logbook queries#73rbatsenko wants to merge 2 commits intolemeryfertitta:mainfrom
Conversation
The Moonboard 2024 API requires both setupId and Configuration filters to return logbook data. Without the Configuration filter, the API returns 0 sessions even though data exists. Changes: - Modified logbook_pages() to accept optional angle parameter and build Configuration filter for moon2024 - Modified raw_logbook_entries_for_page() similarly to support angle-based filtering - Updated raw_logbook_entries() to iterate over all angles for moon2024, querying each angle (25° and 40°) separately - Updated README to document moon2024 partial support and API limitations Technical details: - moon2024 uses setupId=21 with Configuration IDs: 25°→2, 40°→3 - Filter format: setupId~eq~'21'~and~Configuration~eq~'3' - The API has known data inconsistencies; Dashboard may show more climbs than the Logbook API returns This fix enables BoardLib to retrieve available moon2024 data instead of returning 0 entries. Tested with user data showing 18 entries retrieved for 40° angle where Dashboard showed 26 climbs (API limitation documented).
There was a problem hiding this comment.
Pull Request Overview
This PR fixes the broken moon2024 logbook support by implementing Configuration filter support that the Moonboard 2024 API requires. The key insight is that moon2024 requires both setupId and Configuration filters, unlike older board versions that only need setupId.
- Added angle-based Configuration filtering for moon2024 logbook queries
- Modified logbook functions to handle moon2024's requirement for separate angle-specific queries
- Updated documentation to reflect partial moon2024 support and API limitations
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/boardlib/api/moon.py | Added Configuration filter support and angle-based querying for moon2024 |
| README.md | Updated documentation about moon2024 partial support and API limitations |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
@lemeryfertitta here's the small fix to allow fetching 2024 logbook entries 🙂 (API is terrible as you know so possibly not a complete data, but at least smth!) |
Address GitHub Copilot feedback: - Add ValueError with helpful message when invalid angle is provided - Add 0.5s delay between angle queries to prevent API throttling - Import time module for rate limiting This prevents KeyError crashes and reduces risk of API throttling when querying multiple angles for moon2024.
|
@rbatsenko sorry for the late review! I went to go test this one and it looks like there may a new issue with logging in to the Moon API now, so I was unable to test it. If you're still interested and want to push a fix that includes the login so this is testable, I'll be sure to review it more promptly this time. |
Summary
This PR fixes moon2024 logbook support by implementing the required Configuration filter that the Moonboard 2024 API needs to return data.
Problem
The README currently states that moon2024 API is broken and returns no data. However, through investigation, I discovered that moon2024 requires both
setupIdandConfigurationfilters to work, unlike older board versions which only needsetupId.Without the Configuration filter:
With the Configuration filter:
Changes
logbook_pages()- Added optionalangleparameter to build Configuration filter for moon2024raw_logbook_entries_for_page()- Added same angle-based filtering supportraw_logbook_entries()- Special handling for moon2024 to query each angle (25° and 40°) separately since they require different Configuration IDsTechnical Details
Moon2024 board configuration:
setupId~eq~'21'~and~Configuration~eq~'3'The existing
ANGLES_TO_IDSmapping already had this data but it was only used for Dashboard endpoints, not Logbook queries.Testing
Tested with real user data (username: rbatsenko):
Known Limitations
The Moonboard API itself has data inconsistencies:
This PR enables BoardLib to retrieve the maximum available data from the broken API, which is better than the current behavior of returning nothing.
Backwards Compatibility
✅ All changes are backwards compatible:
angleparameters are optional with defaultNoneReferences
POST /Logbook/GetLogbook