Claude Terminal
Loading...
🏷️ Fix duplicate short names for foods
Ensures each food gets a unique short name so they're easier to tell apart.
> Technical Details
Update the short name calculation logic to account for foods throughout the entire day, not just within individual meals. This ensures that short names remain unique across all meals in a day, preventing duplicate short names that could cause confusion.
The short name calculation currently only ensures uniqueness within a single meal. If the same food appears in multiple meals throughout the day, it may receive the same short name in different meals, which can lead to ambiguity.
Short names should be calculated by considering all foods across all meals in the day. When a food appears multiple times throughout the day (across different meals), the short name algorithm should generate unique identifiers that distinguish between these instances.
- ●This affects the short name generation algorithm used for food items in meal displays
- ●Need to modify the scope of uniqueness checking from meal-level to day-level
- ●Consider performance implications when checking uniqueness across larger datasets (all foods in a day vs. foods in a single meal)
- ●Ensure the changes maintain backward compatibility with existing short name display logic
- ● Short name calculation considers all foods across all meals in the day
- ● No duplicate short names exist for different food items within the same day
- ● Short names remain concise and readable while maintaining uniqueness
- ● Performance remains acceptable even for days with many meals/foods
- ● Existing tests are updated to reflect day-level uniqueness requirements
- ● New tests added to verify cross-meal uniqueness
Extracted from PXL-705
Build instruction: Use -destination 'platform=iOS Simulator,name=iPhone 17 Pro' when building this project
Additional Bug Discovered During Testing
While testing the short name fix, discovered a separate issue:
Moving meal item during sync reverts the change when sync completes
When a user moves a meal item to another meal while a sync operation is ongoing, the move operation completes visually but then gets immediately reverted when the sync operation finishes. The sync operation overwrites the local change with the server state.
This is a data consistency/conflict resolution issue - local changes made during sync should take precedence or be merged correctly.
This should be split into a separate task if not directly related to short names.