-
-
Notifications
You must be signed in to change notification settings - Fork 218
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
Users unable to edit the report they created #8589
Comments
@yrimal |
Hi @dianabarsan , {
"title": [
{
"locale": "en",
"content": "Non-communicable diseases survey form"
},
{
"locale": "ne",
"content": "नसर्ने रोग सम्बन्धी सर्बेक्षण फारम"
}
],
"context": {
"place": false,
"person": true,
"expression": "contact.contact_type === 'c82_person' && user._id != contact._id"
},
"icon": "icon-healthcare-assessment"
}
Contact type for which this report was added is |
I am able to replicate this with default config and submitting a |
I believe this started manifesting when we merged #6505 and started evaluating form context on edit. The issue is that the context that we sent on edit does not have the same format as on create. |
Thinking more about it, I'm unsure if we should even apply form expressions when editing forms. I'm thinking of common examples where blocking editing based on form expression can be wrong:
List can continue. Seeking feedback from @garethbowen and @michaelkohn . |
I'm not 100% convinced by your examples, because in both cases someone is editing a report that is no longer relevant anyway. Why edit a report for a muted contact? Or for a condition that no longer applies to the patient? A particularly fastidious health worker may want to fix the data regardless but I think it's unlikely. One more concerning example would be if they submitted a report that was incorrect which caused the report itself to be uneditable. For example, if a pregnant woman had a checkup, and one of the questions was "has the baby been delivered?". Answering "yes" might remove the "pregnant" condition which could make the "checkup" form irrelevant, and therefore you couldn't edit the report and turn the "yes" to a "no". So I think your approach makes sense - for editing check permissions but don't check the expression. |
Backported fix to |
Backported to |
Describe the bug
We've seen CHT user(s) are able to create report but they are not able to edit the same report.
To Reproduce
Expected behavior
Users should be able to edit the report that they created if permission allows that.
Screenshots
See the video:
Screen.Recording.2023-09-26.at.2.45.52.PM.mov
Environment
Additional context
app settings and forms used for this: medic/config-nssd#406 (internal)
The text was updated successfully, but these errors were encountered: