Skip to content

Conversation

@maxschwinghammer
Copy link
Collaborator

Summary

  • Only persist barcodes when non-empty and omit field otherwise

Testing

  • ./gradlew test (fails: keys.properties missing)

https://chatgpt.com/codex/tasks/task_b_68a70f5e974883279bff6a680fd95519

Copy link
Contributor

Copilot AI left a 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,
Copy link

Copilot AI Aug 21, 2025

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.

Copilot uses AI. Check for mistakes.
category = category,
status = FoodStatus.ACTIVE,
picture = picture,
)
Copy link

Copilot AI Aug 21, 2025

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.

Copilot uses AI. Check for mistakes.
cleanedBarcode?.let { this["barcode"] = it }
householdId?.let { this["householdId"] = it }
picture?.let { this["picture"] = it }
}
Copy link

Copilot AI Aug 21, 2025

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.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants