-
Notifications
You must be signed in to change notification settings - Fork 3
feat: add Countries Visited feature to Stats for Nerds #89
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
Open
vide
wants to merge
9
commits into
main
Choose a base branch
from
feat/countries-visited
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
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
Add a new "Countries Visited" record in the Drives category that shows the count of unique countries visited. Tapping the record opens a dedicated screen listing all countries with: - Flag emoji (derived from ISO 3166-1 alpha-2 country code) - Country name - First and last visit dates - Drive count per country Data layer changes: - Add startCountryCode and startCountryName fields to DriveDetailAggregate - Bump SchemaVersion to 3 to trigger reprocessing of drive details - Add database migration V3→V4 for new country columns - Enhance GeocodingRepository with reverseGeocodeWithCountry() - Extract country during drive detail sync via Nominatim API - Add country queries to AggregateDao - Add CountryRecord model and countriesVisitedCount to DeepStats - Add country stats methods to StatsRepository UI changes: - Create CountriesVisitedScreen with sorting options (by first visit, alphabetically, by drive count) - Create CountriesVisitedViewModel for screen state - Add record card to StatsScreen with navigation callback - Add navigation route for CountriesVisited screen - Add localized strings for all 4 locales (EN, IT, ES, CA) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Show "Offline since X" tooltip and duration below status icons when car is in offline state, similar to asleep/suspended states. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Reduce throttle delay from 100ms to 10ms between batches - Process drives/charges in parallel batches of 10 concurrent requests - Country geocoding also runs concurrently within each batch - Batch database writes (upsertDriveAggregates, upsertChargeAggregates) - Single-pass aggregate computation instead of multiple iterations - Update progress once per batch instead of per item Expected improvement: 10-20x faster sync (30+ min → 2-3 min) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add updateDriveDetailProgressBatch and updateChargeDetailProgressBatch methods to SyncStateDao and SyncManager - Update SyncRepository to use batch progress updates with correct count - Fixes progress bar not updating correctly during parallel batch sync Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The progress bar was not updating because the UI was reading progress from slow DB aggregate count queries (deepSyncProgress) instead of the real-time SyncProgress.percentage from StateFlow. Now uses StateFlow percentage during active sync, falling back to DB counts when sync is complete. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Pass isSyncing to StatsContent so progress bar shows even when percentage is 0% (sync just started). Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Instead of relying on StateFlow -> collector -> DB query chain, use Room's reactive Flow queries that automatically emit when tables change. - Add observeCount() Flow queries to DriveSummaryDao, ChargeSummaryDao - Add observeDriveAggregateCount/observeChargeAggregateCount to AggregateDao - Add observeDeepSyncProgress() in StatsRepository using combine() - ViewModel observes this Flow directly for real-time progress updates This bypasses the complex StateFlow propagation and uses Room's native change detection for reliable UI updates. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Nominatim API has ~1 req/sec rate limit which makes sync very slow. Disabled for now until we implement a background/incremental approach. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
vide
added a commit
that referenced
this pull request
Jan 21, 2026
Adds a new 'Countries Visited' record to Stats for Nerds showing unique countries visited. Tapping opens a detail screen with: - Country flag, name, first/last visit dates - Drive count, total distance, energy charged, charge count - Sorting by first visit, alphabetically, or by drive count Also includes: - Background geocoding with Nominatim rate limiting (1 req/sec) - Grid-based cache (~1km resolution) for efficient deduplication - Progress tracking with sync recovery - Localization in English, Italian, Spanish, and Catalan
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
Changes
Data layer:
startCountryCodeandstartCountryNamefields toDriveDetailAggregateGeocodingRepositorywithreverseGeocodeWithCountry()AggregateDaoUI:
CountriesVisitedScreenwith sorting options (by first visit, alphabetically, by drive count)CountriesVisitedViewModelfor screen state managementStatsScreenwith navigationTest plan
🤖 Generated with Claude Code