-
Notifications
You must be signed in to change notification settings - Fork 6
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
WC2-523: [WEB] NFC card field shows 0 for all beneficiaries even when card is assigned #1735
WC2-523: [WEB] NFC card field shows 0 for all beneficiaries even when card is assigned #1735
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.
Nice! The counts work 👍 I have a few doubts about performance issues as the logs table grows, but I think it might be difficult to fix, see comments.
Main thing is I think there's something missing on this screen:
http://localhost:8081/dashboard/storages/
I did the setup as per instructions in the PR, but I see no beneficiary on the "General" or "Logs" entries. The status on the log is also missing (I set it to "OK" in my db).
concerned_entity = Entity.objects.get(uuid=log_data["entity_id"]) | ||
entity_id = log_data.get("entity_id") or log_data.get("entity_uuid") | ||
if entity_id: | ||
concerned_entity = Entity.objects.get(uuid=entity_id) |
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.
👍
nfc_log_entries_count = StorageLogEntry.objects.filter(device__in=nfc_devices).count() | ||
|
||
return nfc_log_entries_count | ||
|
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.
I think we should be careful to add this extra query on the EntitySerializer. I also expect the amount of records in StorageLogEntry
to grow.
Did you try to do it with a relation and prefetch_related
? If it's complicated then it's okay for me to go with it like this.
Did you link the storageDevice with the entity? The logs status, status_reason and status_comment must also be save in storageLogEntry |
@hakifran Yes I think it's a misalignment between the returned JSON and the frontend Btw, I see the |
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.
Tested again and this looks very good to me 👍
def get_nfc_cards(self, entity: Entity): | ||
nfc_log_entries_count = StorageDevice.objects.filter(entity=entity, type=StorageDevice.NFC).aggregate( | ||
total_logs=Count("log_entries") | ||
)["total_logs"] |
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.
Nice! Looking good to me 👍
Explain what problem this PR is resolving
Related JIRA tickets : WC2-523
Self proofreading checklist
Changes
How to test
Print Screen/video
Screencast.from.2024-10-23.11-18-46.webm