Create Entity only if submission is approved when form submission review is enabled
Closed this issue · 0 comments
kelvin-muchiri commented
Enhancement
When submission review is enabled, creating Entities from forms should only be successful if a submission is approved.
Benefits of implementing the feature/enhancement
Only approved submissions will create Entities when submission reviewed is enabled. This ensures no Entities are created from rejected submissions.
Suggested implementation plan(Steps to be taken to implement feature)
- Modify the
post_save
signal handler onInstance
model that creates anEntity
, to only create anEntity
if submission review is not enabled for form. To determine that submission review is enabled for form, we check if a record exists inMetaData
model whosedata_type
field has a value ofsubmission_review
and whosedata_value
field has a value oftrue
. - Add a
post_save
signal handler onSubmissionReview
model, to create anEntity
only ifEntity
for submission does not exist and theSubmissionReview
's status field has a value ofApproved
. - Alter
MetaData
model, add index for fieldsobject_id
,data_type
.
Limitations
- Rejecting a previously approved submission will not delete the
Entity
that was created when the submission was approved.