-
-
Notifications
You must be signed in to change notification settings - Fork 0
Store barcode only when used #202
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
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements conditional barcode storage to avoid persisting empty barcode values in the database. The change ensures that barcodes are only stored when they contain meaningful data.
- Introduces null-safe barcode cleaning to filter out blank values
- Replaces direct FoodItem object persistence with a Map-based approach for selective field inclusion
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| barcode = cleanedBarcode, | ||
| userId = user.id, | ||
| householdId = householdId, | ||
| name = productName, |
Copilot
AI
Aug 21, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The FoodItem object is created but never used after line 119 switches to using foodItemData. This creates unnecessary object instantiation and potential confusion about which data structure is actually persisted.
| category = category, | ||
| status = FoodStatus.ACTIVE, | ||
| picture = picture, | ||
| ) |
Copilot
AI
Aug 21, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The FoodItem object is created but never used after line 119 switches to using foodItemData. This creates unnecessary object instantiation and potential confusion about which data structure is actually persisted.
| cleanedBarcode?.let { this["barcode"] = it } | ||
| householdId?.let { this["householdId"] = it } | ||
| picture?.let { this["picture"] = it } | ||
| } |
Copilot
AI
Aug 21, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The hardcoded string keys in the map create a maintenance risk and potential for typos. Consider using property names from the FoodItem class or defining constants for these field names to ensure consistency.
Summary
Testing
./gradlew test(fails: keys.properties missing)https://chatgpt.com/codex/tasks/task_b_68a70f5e974883279bff6a680fd95519