feat: Enhance CSV parser to dynamically map quantity, name, finish, and ID columns from headers for robust custom imports.
All checks were successful
Build and Deploy / build (push) Successful in 1m20s
All checks were successful
Build and Deploy / build (push) Successful in 1m20s
This commit is contained in:
@@ -8,3 +8,4 @@
|
||||
## Recent Completions
|
||||
- [Game Battlefield & Manual Mode](./devlog/2025-12-14-234500_game_battlefield_plan.md): Completed.
|
||||
- [Helm Chart Config](./devlog/2025-12-14-214500_helm_config.md): Completed.
|
||||
- [CSV Import Robustness](./devlog/2025-12-16-152253_csv_import_robustness.md): Completed. Enhanced CSV parser to dynamically map columns from headers, supporting custom user imports.
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
|
||||
# CSV Import Robustness Update
|
||||
|
||||
## Background
|
||||
The user provided a specific CSV format associated with typical automated imports. The requirement was to extract relevant information (Quantity, Name, Finish, Scryfall ID) while ignoring other fields (such as Condition, Date Added, etc.).
|
||||
|
||||
## Changes
|
||||
- Refactored `src/client/src/services/CardParserService.ts` to implement dynamic header parsing.
|
||||
- The `parse` method now:
|
||||
- Detects if the first line is a CSV header containing "Quantity" and "Name".
|
||||
- Maps columns to indices based on the header.
|
||||
- Specifically looks for `Quantity`, `Name`, `Finish`, and `Scryfall ID` (checking common variations like 'scryfall_id', 'id', 'uuid').
|
||||
- Uses strictly mapped columns if a header is detected, ensuring other fields are ignored as requested.
|
||||
- Falls back gracefully to previous generic parsing logic if no matching header is found, preserving backward compatibility with Arena/MTGO exports and simple lists.
|
||||
|
||||
## Verification
|
||||
- Verified manually via a test script that the provided CSV content parses correctly into the `CardIdentifier` memory structure.
|
||||
- The extraction correctly identifies Quantity, Name, Finish (Normal/Foil), and Scryfall UUID.
|
||||
|
||||
## Next Steps
|
||||
- Ensure the frontend `CubeManager` works seamlessly with this update (no changes needed there as it uses the service).
|
||||
Reference in New Issue
Block a user