refactor: extract lib.rs, remove club module, add bounded concurrency

- Extract shared types (Car, BestCarRecord, AnalysisContext) into src/lib.rs
- Replace global static BEST_CARS with injected AnalysisContext for testability
- Add semaphore-bounded concurrency (limit 20) in parse_all_times()
- Replace hardcoded track name match with track_names.json loaded via include_str!
- Replace magic number 115 with const MAX_RQ: u8 = 113
- Improve floating-point tie comparison with TIME_TOLERANCE (5ms) constant
- Remove src/club.rs binary (topdrives.club no longer maintained)
- Remove scraper dependency from Cargo.toml
- Remove tracks.txt (replaced by track_names.json)
- Remove empty/placeholder test bodies
- Improve error handling in get_file() for response body read
- Add load_my_cars_data() combining owned + wishlist extraction in one I/O
- Update CHANGELOG, README, and all docs to reflect changes
This commit is contained in:
Jan-Peter von Hunnius 2026-05-06 20:20:15 +02:00
parent 6a68469239
commit 89fa69e3c8
14 changed files with 874 additions and 2037 deletions

View file

@ -160,8 +160,8 @@ Best car for Track: laguna, Condition: Dry, RQ: 85 -> McLaren F1 (1993) with tim
```
**Track name format:**
- Use internal names: `laguna`, `monaco`, `testBowl`
- Full mappings in `translate_track_name()` function
- Use display names: `Laguna Seca`, `Monaco`, `Test Bowl`
- Full mappings loaded from `track_names.json`
**Condition options:**
- `Dry` - Standard asphalt
@ -169,6 +169,43 @@ Best car for Track: laguna, Condition: Dry, RQ: 85 -> McLaren F1 (1993) with tim
- `Dirt` - Off-road tracks
- `Snow` - Winter conditions
## Daily Workflow
The recommended daily workflow uses the `full_script` command, which runs `fetch` followed by all analysis commands in a single pipeline:
```bash
cargo run --bin records -- full_script
```
### What `full_script` Does
1. **Fetches** fresh data from the community repository
2. **Runs** all analysis commands sequentially
3. **Generates** all output CSV files
### Output Files
| File | Purpose | Format |
|------|---------|--------|
| `best.csv` | Ranked list of best cars — evaluate if a car is worth keeping | `RQ,Brand,Model,Year,Count` |
| `details.csv` | Detailed timing data for all tracks/conditions — find best config for a car | `RQ,TrackID,Condition,CarRQ,Brand,Model,Year,Config,Time` |
| `add.csv` | Cars to add to wishlist — missing cars not yet wishlisted, prefixed with `+` | `+RQ,Brand,Model,Year` |
| `remove.csv` | Cars to remove from wishlist — stale wishlist entries, prefixed with `-` | `-RQ,Brand,Model,Year` |
| `trash.csv` | Owned cars that can be safely removed | `RQ,Brand,Model,Year` |
| `sorted.csv` | Best cars sorted by count (descending) | `RQ,Brand,Model,Year,Count` |
| `very_best.csv` | Best cars with count ≥ 10 | `RQ,Brand,Model,Year,Count` |
| `wishlist.csv` | Missing cars already on wishlist | `RQ,Brand,Model,Year,Count` |
### Typical Daily Routine
1. **Run `full_script`** to get fresh data and full analysis
2. **Review `best.csv`** to see how your cars rank overall
3. **Check `add.csv`** for cars worth adding to your wishlist (prefixed with `+`)
4. **Check `remove.csv`** for wishlist entries to remove (prefixed with `-`)
5. **Review `trash.csv`** for owned cars you can safely sell
6. **Use `details.csv`** to find the optimal tune config for a specific car
7. **Check `very_best.csv`** for the absolute top performers (count ≥ 10)
## Advanced Usage
### RQ Range Analysis
@ -241,16 +278,24 @@ The tool generates CSV files for external analysis:
- Import into spreadsheet for sorting/filtering
- Track performance across time
#### missing.csv
- Cars to acquire
- Prioritize by count and RQ relevance
- Plan acquisition strategy
#### details.csv
- Comprehensive timing database
- Advanced analysis and research
- Historical performance tracking
#### add.csv / remove.csv
- Wishlist management
- `+` prefix indicates cars to add
- `-` prefix indicates cars to remove
#### trash.csv
- Cars safe to sell from your collection
- Cross-reference with your garage before selling
#### sorted.csv / very_best.csv
- Sorted rankings by versatility
- `very_best.csv` filters to count ≥ 10 for top-tier recommendations
### Spreadsheet Analysis Tips
**Excel/Google Sheets setup:**
@ -265,7 +310,7 @@ The tool generates CSV files for external analysis:
#### "Please provide a command"
**Problem:** No arguments provided
**Solution:** Use `best`, `missing`, `trash`, `details`, or `track`
**Solution:** Use `best`, `missing`, `trash`, `details`, `track`, or `full_script`
#### "Could not read my cars file"
**Problem:** `my_cars.json` not found or not readable
@ -303,9 +348,9 @@ The tool generates CSV files for external analysis:
## Tips and Best Practices
### Regular Maintenance
1. **Weekly**: Run `fetch` to get latest data
2. **Monthly**: Review `missing` cars for new acquisitions
3. **Quarterly**: Use `trash` to optimize collection
1. **Daily**: Run `full_script` to get latest data and full analysis
2. **Weekly**: Review `missing` cars for new acquisitions
3. **Monthly**: Use `trash` to optimize collection
### Data-Driven Decisions
1. **Trust the numbers**: Count-based recommendations are data-driven
@ -331,4 +376,4 @@ The tool generates CSV files for external analysis:
---
**Remember**: This tool provides data-driven insights, but ultimately you're the best judge of which cars you enjoy driving. Use the analysis as a guide, not a strict rulebook.
**Remember**: This tool provides data-driven insights, but ultimately you're the best judge of which cars you enjoy driving. Use the analysis as a guide, not a strict rulebook.