SciPost Code Repository
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SciPost
Manage
Activity
Members
Labels
Plan
Issues
118
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
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
Code review analytics
Issue analytics
Insights
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
SciPost
SciPost
Commits
4b0d35c1
Commit
4b0d35c1
authored
1 year ago
by
George Katsikas
Browse files
Options
Downloads
Patches
Plain Diff
fix dup nominations when sorting by round props
parent
7d4c70b2
No related branches found
No related tags found
1 merge request
!58
[Fellowship Nominations] Rework the fellowship nomination system and UI
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
scipost_django/colleges/forms.py
+24
-5
24 additions, 5 deletions
scipost_django/colleges/forms.py
with
24 additions
and
5 deletions
scipost_django/colleges/forms.py
+
24
−
5
View file @
4b0d35c1
...
@@ -547,9 +547,9 @@ class FellowshipNominationSearchForm(forms.Form):
...
@@ -547,9 +547,9 @@ class FellowshipNominationSearchForm(forms.Form):
orderby
=
forms
.
ChoiceField
(
orderby
=
forms
.
ChoiceField
(
label
=
"
Order by
"
,
label
=
"
Order by
"
,
choices
=
(
choices
=
(
(
"
voting_rounds__voting
_deadline
"
,
"
Deadline
"
),
(
"
latest_round
_deadline
"
,
"
Deadline
"
),
(
"
voting_rounds__voting
_open
s
"
,
"
Voting start
"
),
(
"
latest_round
_open
"
,
"
Voting start
"
),
(
"
voting
_round
s_
_decision_
_
outcome
"
,
"
Decision
"
),
(
"
latest
_round_decision_outcome
"
,
"
Decision
"
),
(
"
profile__last_name
"
,
"
Nominee
"
),
(
"
profile__last_name
"
,
"
Nominee
"
),
),
),
required
=
False
,
required
=
False
,
...
@@ -632,13 +632,32 @@ class FellowshipNominationSearchForm(forms.Form):
...
@@ -632,13 +632,32 @@ class FellowshipNominationSearchForm(forms.Form):
session
.
save
()
session
.
save
()
nominations
=
FellowshipNomination
.
objects
.
all
()
def
latest_round_subquery
(
key
):
return
Subquery
(
FellowshipNominationVotingRound
.
objects
.
filter
(
nomination
=
OuterRef
(
"
pk
"
)
)
.
order_by
(
"
-voting_deadline
"
)
.
values
(
key
)[:
1
]
)
nominations
=
(
FellowshipNomination
.
objects
.
all
()
.
annotate
(
latest_round_deadline
=
latest_round_subquery
(
"
voting_deadline
"
),
latest_round_open
=
latest_round_subquery
(
"
voting_opens
"
),
latest_round_decision_outcome
=
latest_round_subquery
(
"
decision__outcome
"
),
)
.
distinct
()
)
if
self
.
cleaned_data
.
get
(
"
can_vote
"
)
or
not
self
.
user
.
has_perm
(
if
self
.
cleaned_data
.
get
(
"
can_vote
"
)
or
not
self
.
user
.
has_perm
(
"
scipost.can_view_all_nomination_voting_rounds
"
"
scipost.can_view_all_nomination_voting_rounds
"
):
):
# Restrict rounds to those the user can vote on
# Restrict rounds to those the user can vote on
nominations
=
nominations
.
with_user_votable_rounds
(
self
.
user
)
nominations
=
nominations
.
with_user_votable_rounds
(
self
.
user
)
.
distinct
()
if
nominee
:
=
self
.
cleaned_data
.
get
(
"
nominee
"
):
if
nominee
:
=
self
.
cleaned_data
.
get
(
"
nominee
"
):
nominations
=
nominations
.
filter
(
nominations
=
nominations
.
filter
(
...
...
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