-
Notifications
You must be signed in to change notification settings - Fork 1
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
Check whether paymentunits have deliverunits set before processing #458
base: main
Are you sure you want to change the base?
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.
Thanks 🙌🏽
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.
Left a few questions
@@ -100,6 +100,9 @@ def is_setup_complete(self): | |||
for pu in self.paymentunit_set.all(): | |||
if not (pu.max_total and pu.max_daily): | |||
return False | |||
if not pu.deliver_units.exists(): |
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.
Is it possible to add this as validation on the form that sets these up? It probably shouldn't be possible to submit that form (or section of the form) if there are none selected. That way users will also know before forms start to come in.
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.
Interesting, the form already has this as required, so this shouldn't really happen, I am not sure how it ended up happening. Do you have any idea how this could have occurred?
@@ -232,6 +232,8 @@ def clean_form_submission(access: OpportunityAccess, user_visit: UserVisit, xfor | |||
|
|||
|
|||
def process_deliver_unit(user, xform: XForm, app: CommCareApp, opportunity: Opportunity, deliver_unit_block: dict): | |||
if not opportunity.is_setup_complete: |
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.
Do we want this to be more targeted? Occasionally projects add new payment units part way through, and I would be concerned that if they improperly add new ones, this check would prevent the old ones from being processed as well. If we instead just did an error message when we hit this error, that might be safer.
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.
Yeah, I am happy to just make a sentry error here instead of hard-fail. Though, per above comment this shouldn't be possible.
Product Description
Detect when paymentunits don't have deliverunit set.
Technical Summary
We have been having cases where projects are trying to submit forms and they are failing due to their payment-units being configured partially. This will do two things when paymentunits don't have deliverunit set.
Safety Assurance
Safety story
Automated test coverage
Existing processor tests
QA Plan
NA
Labels & Review