From c3f1324540d22a934f4614b587feaa982c62ed2d Mon Sep 17 00:00:00 2001
From: Frank Duncan <frankduncan@opentechstrategies.com>
Date: Thu, 11 Jul 2024 11:18:26 -0500
Subject: [PATCH] Remove None reviewers from validation (#4021)

Fixes #4020

This was caused by an issue where the "---" (None) reviewers were
causing the validation to fail, meaning that you had to fill out n-1
reviewers in the submission page in order for the save to go through.

The solution was to only check for duplicates with reviewers that were
selected.
---
 hypha/apply/funds/forms.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hypha/apply/funds/forms.py b/hypha/apply/funds/forms.py
index 4860661fe..31aece61d 100644
--- a/hypha/apply/funds/forms.py
+++ b/hypha/apply/funds/forms.py
@@ -270,7 +270,7 @@ class UpdateReviewersForm(ApplicationSubmissionModelForm):
         role_reviewers = [
             user
             for field, user in self.cleaned_data.items()
-            if field in self.role_fields
+            if field in self.role_fields and user
         ]
 
         for field, role in self.role_fields.items():
@@ -396,7 +396,7 @@ class BatchUpdateReviewersForm(forms.Form):
         role_reviewers = [
             user
             for field, user in self.cleaned_data.items()
-            if field in self.role_fields
+            if field in self.role_fields and user
         ]
 
         # If any of the users match and are set to multiple roles, throw an error
-- 
GitLab