Skip to content
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 for None value #443

Merged
merged 1 commit into from
Dec 4, 2024
Merged

Check for None value #443

merged 1 commit into from
Dec 4, 2024

Conversation

sravfeyn
Copy link
Member

@@ -262,7 +262,8 @@ def process_deliver_unit(user, xform: XForm, app: CommCareApp, opportunity: Oppo
)
completed_work_needs_save = False
today = datetime.date.today()
if opportunity.start_date > today or (payment_unit.start_date and payment_unit.start_date > today):
paymentunit_startdate = payment_unit.start_date if payment_unit else None
if opportunity.start_date > today or (paymentunit_startdate and paymentunit_startdate > today):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue arises when payment_unit is null. In cases where payment_unit is null and opportunity.start_date > today evaluates to false, the code proceeds to the else block. However, since payment_unit is required for completed_work, this results in an error.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, this seems to be a seperate issue for a while https://dimagi.sentry.io/issues/6098769063/?environment=production&project=4505635339829248&query=is%3Aunresolved%20issue.priority%3A%5Bhigh%2C%20medium%5D&referrer=issue-stream&sort=date&statsPeriod=14d&stream_index=0

But let’s merge at least this fix, because that affects even where paymentunit is not NULL

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sravfeyn sravfeyn merged commit 41b7557 into main Dec 4, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants