Skip to content

Conversation

@sandeepsajan0
Copy link
Member

Fixes #4290

Test Steps

  • Try to perform batch update status action on submissions
  • Try to update some batch determinations(dismissed, accept and more info), all should work fine.

@sentry
Copy link

sentry bot commented Dec 24, 2024

🔍 Existing Issues For Review

Your pull request is modifying functions with the following pre-existing issues:

📄 File: hypha/apply/determinations/views.py

Function Unhandled Issue
form_valid AttributeError: 'NoneType' object has no attribute 'id' /apply/submissions/{submission_pk}/determination/{pk...
Event Count: 1

Did you find this useful? React with a 👍 or 👎

)
if redirect:
return HttpResponseClientRedirect(redirect.url)
# should redirect
Copy link
Member Author

Choose a reason for hiding this comment

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

Moved should_redirect method directly in here to avoid raising an Error, instead showing the error to the user without performing the batch action.

It is hard to find all the cases at once so I guess it is a better way to avoid 500. We can include the cases to validation as soon as it is reported.

@sandeepsajan0 sandeepsajan0 marked this pull request as ready for review December 24, 2024 07:36
@frjo frjo added Type: Bug Bugs! Things that are broken :-/ Type: Minor Minor change, used in release drafter labels Dec 31, 2024
@frjo

This comment was marked as outdated.

@frjo frjo self-requested a review January 7, 2025 08:49
frjo

This comment was marked as outdated.

@frjo frjo force-pushed the fix/gh-4290-batch-determination-issue branch 2 times, most recently from d5ea79a to 5743656 Compare January 10, 2025 17:00

# hide determination actions if submissions have different forms
if not allow_determination:
determination_actions = ["Dismiss", "Request More Information", "Accept"]
Copy link
Member

Choose a reason for hiding this comment

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

@sandeepsajan0 Will this work with translations?

Copy link
Member Author

Choose a reason for hiding this comment

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

@frjo It is fixed now, used machine names(DETERMINATION_OUTCOMES) to compare.

@frjo frjo added Status: Needs testing Tickets that need testing/qa Status: Needs dev testing 🧑‍💻 Tasks that should be tested by the dev team labels Jan 14, 2025
@wes-otf
Copy link
Contributor

wes-otf commented Jan 16, 2025

In testing this definitely was a lot smoother! @sandeepsajan0 I noticed when I selected a couple of lab submissions they all gave me the option to bulk dismiss, and the same with when I selected fund submissions, but combining them removed that option - is this because of the difference in determination forms? if so I think this is ready

@sandeepsajan0 sandeepsajan0 force-pushed the fix/gh-4290-batch-determination-issue branch from 74bd050 to 44febe5 Compare January 26, 2025 10:28
@sandeepsajan0
Copy link
Member Author

combining them removed that option - is this because of the difference in determination forms?

@wes-otf Yes, determination actions are not available for different forms now. Because for determination we need to render determination form and it is impossible to render different form for a single bulk action.

@sandeepsajan0 sandeepsajan0 requested a review from frjo January 26, 2025 10:44
determination_form_ids = [
submission.get_from_parent("determination_forms").first().id
for submission in submissions
]
Copy link
Member

Choose a reason for hiding this comment

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

There is an edge case where no determination form id exist. I believe this only affects OTF that still have some funds/labs that use the old hardcoded determination forms, before we made them into stream field forms.

Unsure how to best solve this issue without messing up the code more than needed.

@wes I assume all current funds and labs by OTF uses streamfield determination forms, can you confirm that?

We have a property to check if a submission use the old forms, see:

@property
def is_determination_form_attached(self):
"""
We use old django determination forms but now as we are moving
to streamfield determination forms which can be created and attached
to funds in admin.
This method checks if there are new determination forms attached to the
submission or we would still use the old determination forms for backward
compatibility.
"""
return self.get_from_parent("determination_forms").count() > 0

Copy link
Contributor

@wes-otf wes-otf Jan 27, 2025

Choose a reason for hiding this comment

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

did a quick pass today and it doesn't seem like any of OTFs funds still use it actively. would still probably be worth it to handle it so it doesn't error out if there's an archive fund or something weird down the road. even if that's just ignoring it

Copy link
Member

@frjo frjo left a comment

Choose a reason for hiding this comment

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

Works well in my testing.

@frjo frjo removed Status: Needs testing Tickets that need testing/qa Status: Needs dev testing 🧑‍💻 Tasks that should be tested by the dev team labels Jan 31, 2025
@frjo frjo merged commit b59ec29 into main Jan 31, 2025
7 checks passed
@frjo frjo deleted the fix/gh-4290-batch-determination-issue branch March 11, 2025 19:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Type: Bug Bugs! Things that are broken :-/ Type: Minor Minor change, used in release drafter

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Batch determination breaks with different form submissions

3 participants