Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hypha
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ots
hypha
Commits
4be83efc
Commit
4be83efc
authored
6 years ago
by
Todd Dembrey
Browse files
Options
Downloads
Patches
Plain Diff
Gh-1016: Make sure we dont duplicate assignment when adding in a role
parent
17b3c48b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
opentech/apply/funds/forms.py
+2
-5
2 additions, 5 deletions
opentech/apply/funds/forms.py
opentech/apply/funds/tests/test_views.py
+8
-0
8 additions, 0 deletions
opentech/apply/funds/tests/test_views.py
with
10 additions
and
5 deletions
opentech/apply/funds/forms.py
+
2
−
5
View file @
4be83efc
...
@@ -181,11 +181,8 @@ class UpdateReviewersForm(forms.ModelForm):
...
@@ -181,11 +181,8 @@ class UpdateReviewersForm(forms.ModelForm):
}
}
for
role
,
reviewer
in
assigned_roles
.
items
():
for
role
,
reviewer
in
assigned_roles
.
items
():
if
reviewer
:
if
reviewer
:
AssignedReviewers
.
objects
.
update_or_create
(
AssignedReviewers
.
objects
.
filter
(
submission
=
instance
,
role
=
role
).
delete
()
submission
=
instance
,
AssignedReviewers
.
objects
.
update_or_create
(
submission
=
instance
,
reviewer
=
reviewer
,
defaults
=
{
'
role
'
:
role
})
role
=
role
,
defaults
=
{
'
reviewer
'
:
reviewer
},
)
# 2. Update non-role reviewers
# 2. Update non-role reviewers
# 2a. Remove those not on form
# 2a. Remove those not on form
...
...
This diff is collapsed.
Click to expand it.
opentech/apply/funds/tests/test_views.py
+
8
−
0
View file @
4be83efc
...
@@ -297,6 +297,14 @@ class TestReviewersUpdateView(BaseSubmissionViewTestCase):
...
@@ -297,6 +297,14 @@ class TestReviewersUpdateView(BaseSubmissionViewTestCase):
# Make sure that the ex-role-reviewer is still assigned record
# Make sure that the ex-role-reviewer is still assigned record
self
.
assertCountEqual
(
submission
.
reviewers
.
all
(),
self
.
staff
[
0
:
2
])
self
.
assertCountEqual
(
submission
.
reviewers
.
all
(),
self
.
staff
[
0
:
2
])
def
test_can_be_made_role_and_not_duplciated
(
self
):
submission
=
ApplicationSubmissionFactory
()
ReviewFactory
(
submission
=
submission
,
author
=
self
.
staff
[
0
])
self
.
post_form
(
submission
,
reviewer_roles
=
[
self
.
staff
[
0
]])
self
.
assertCountEqual
(
submission
.
reviewers
.
all
(),
[
self
.
staff
[
0
]])
def
test_can_remove_external_reviewer_and_review_remains
(
self
):
def
test_can_remove_external_reviewer_and_review_remains
(
self
):
submission
=
ApplicationSubmissionFactory
(
lead
=
self
.
user
)
submission
=
ApplicationSubmissionFactory
(
lead
=
self
.
user
)
reviewer
=
self
.
reviewers
[
0
]
reviewer
=
self
.
reviewers
[
0
]
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment