Fix channel history for Vodafone Station and UltraHub7#211
Merged
Conversation
The Vodafone Station and UltraHub7 drivers return channelID as a string (e.g. "1") instead of an integer. The analyzer stored this as-is, causing a type mismatch in get_channel_history where int(query_param) != "1". - Cast channel_id to int in analyzer when building channel dicts - Handle string channel_ids in storage queries for existing data - Show date-only labels (MM-DD) in 30d channel timeline/compare views
Address code review findings:
- CGA driver used str(parse_number()) producing "1.0" - int("1.0")
raises ValueError, so channel history remained empty
- TG driver used str(ch.get("ChannelID", "")) which could be empty,
crashing analyze() with ValueError
Fixes:
- Driver: return int channel IDs directly instead of str(float)
- Analyzer: add _parse_channel_id() with int(float()) and fallback to 0
- Storage: use int(float()) to handle existing "1.0" data in DB
- Tests: cover float-string IDs, empty channelID, multi-channel queries
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Root cause
The Vodafone Station and UltraHub7 drivers return
channelIDas a string (e.g."1") instead of an integer. The analyzer stored this as-is in the JSON, causing a type mismatch whenget_channel_history()comparedint(query_param)with the stored string -"1" == 1isFalsein Python, so no data was ever returned.Changes
analyzer.py: Castchannel_idtointwhen building channel dicts (prevents new string IDs)storage/analysis.py: Cast storedchannel_idto int during comparison (handles existing data in DB)channels.js: Show date-only labels (MM-DD) for 30-day views in both timeline and compare modesTest plan
test_string_channel_id_matchesverifies the fixCloses #210