-
-
Notifications
You must be signed in to change notification settings - Fork 0
Fix inventory retrieval for joined households #204
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
Fix inventory retrieval for joined households #204
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 fixes inventory retrieval for joined households by dynamically resolving the household ID during inventory operations rather than caching it at initialization time. This ensures that inventory activities are properly recorded against the current household when users switch between households.
- Removes cached household ID initialization and resolves it dynamically during operations
- Updates inventory activity logging to use the current household ID
- Refactors async operations to use suspend functions with await() instead of callback-based patterns
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| else -> null | ||
| } | ||
|
|
||
| val householdId = householdService.getHouseholdId() |
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 household ID is retrieved synchronously on the main thread during addProduct. Consider moving this call inside the coroutine scope or making it suspend to avoid potential UI blocking.
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.
@copilot open a new pull request to apply changes based on this feedback
app/src/main/java/com/freshkeeper/service/product/ProductServiceImpl.kt
Outdated
Show resolved
Hide resolved
| else -> activityType | ||
| } | ||
|
|
||
| val currentHouseholdId = householdService.getHouseholdId() |
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 household ID is retrieved synchronously in logActivity method. If this method is called from a coroutine context, consider making getHouseholdId() a suspend function to avoid blocking calls.
|
@maxschwinghammer I've opened a new pull request, #219, to work on those changes. Once the pull request is ready, I'll request review from you. |
…ceImpl.kt Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Summary
Testing
bash ./gradlew test(fails: /workspace/AndroidApp/app/keys.properties (No such file or directory))https://chatgpt.com/codex/tasks/task_b_68a70fbbad3883279ee430be12544b8e