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
d6aef973
Commit
d6aef973
authored
5 years ago
by
George Hickman
Committed by
Fredrik Jonsson
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add filters to the Leaderboard table
parent
30d50fb0
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
hypha/apply/funds/tables.py
+45
-1
45 additions, 1 deletion
hypha/apply/funds/tables.py
hypha/apply/funds/views.py
+2
-0
2 additions, 0 deletions
hypha/apply/funds/views.py
hypha/apply/users/tests/factories.py
+1
-1
1 addition, 1 deletion
hypha/apply/users/tests/factories.py
with
48 additions
and
2 deletions
hypha/apply/funds/tables.py
+
45
−
1
View file @
d6aef973
...
@@ -23,7 +23,6 @@ from hypha.images.models import CustomImage
...
@@ -23,7 +23,6 @@ from hypha.images.models import CustomImage
from
.widgets
import
Select2MultiCheckboxesWidget
from
.widgets
import
Select2MultiCheckboxesWidget
User
=
get_user_model
()
User
=
get_user_model
()
...
@@ -363,6 +362,51 @@ class RoundsFilter(filters.FilterSet):
...
@@ -363,6 +362,51 @@ class RoundsFilter(filters.FilterSet):
round_state
=
OpenRoundFilter
(
label
=
'
Open
'
)
round_state
=
OpenRoundFilter
(
label
=
'
Open
'
)
class
LeaderboardFilterForm
(
forms
.
ModelForm
):
"""
Form to
"
clean
"
a list of User objects to their PKs.
The Leaderboard table is a list of User objects, however we also want the
ability to filter down to N Users (reviewers). Django filter is converting
the selected PKs to User objects, however we can
'
t filter a User QuerySet
with User objects. So this form converts back to a list of User PKs using
the clean_reviewer method.
"""
class
Meta
:
fields
=
[
"
id
"
]
model
=
User
def
clean_reviewer
(
self
):
return
[
u
.
id
for
u
in
self
.
cleaned_data
[
'
reviewer
'
]]
class
LeaderboardFilter
(
filters
.
FilterSet
):
reviewer
=
Select2ModelMultipleChoiceFilter
(
field_name
=
'
pk
'
,
label
=
'
Reviewers
'
,
queryset
=
get_reviewers
,
)
funds
=
Select2ModelMultipleChoiceFilter
(
field_name
=
'
submission__page
'
,
label
=
'
Funds
'
,
queryset
=
get_used_funds
,
)
rounds
=
Select2ModelMultipleChoiceFilter
(
field_name
=
'
submission__round
'
,
label
=
'
Rounds
'
,
queryset
=
get_used_rounds
,
)
class
Meta
:
fields
=
[
'
reviewer
'
,
'
funds
'
,
'
rounds
'
,
]
form
=
LeaderboardFilterForm
model
=
User
class
LeaderboardTable
(
tables
.
Table
):
class
LeaderboardTable
(
tables
.
Table
):
full_name
=
tables
.
Column
(
verbose_name
=
"
Reviewer
"
)
full_name
=
tables
.
Column
(
verbose_name
=
"
Reviewer
"
)
most_recent
=
tables
.
Column
(
orderable
=
False
)
most_recent
=
tables
.
Column
(
orderable
=
False
)
...
...
This diff is collapsed.
Click to expand it.
hypha/apply/funds/views.py
+
2
−
0
View file @
d6aef973
...
@@ -79,6 +79,7 @@ from .models import (
...
@@ -79,6 +79,7 @@ from .models import (
from
.permissions
import
is_user_has_access_to_view_submission
from
.permissions
import
is_user_has_access_to_view_submission
from
.tables
import
(
from
.tables
import
(
AdminSubmissionsTable
,
AdminSubmissionsTable
,
LeaderboardFilter
,
LeaderboardTable
,
LeaderboardTable
,
ReviewerSubmissionsTable
,
ReviewerSubmissionsTable
,
RoundsFilter
,
RoundsFilter
,
...
@@ -1187,6 +1188,7 @@ class SubmissionResultView(FilterView):
...
@@ -1187,6 +1188,7 @@ class SubmissionResultView(FilterView):
@method_decorator
(
login_required
,
name
=
'
dispatch
'
)
@method_decorator
(
login_required
,
name
=
'
dispatch
'
)
class
ReviewLeaderboard
(
SingleTableMixin
,
FilterView
):
class
ReviewLeaderboard
(
SingleTableMixin
,
FilterView
):
filterset_class
=
LeaderboardFilter
table_class
=
LeaderboardTable
table_class
=
LeaderboardTable
table_pagination
=
False
table_pagination
=
False
template_name
=
'
funds/review_leaderboard.html
'
template_name
=
'
funds/review_leaderboard.html
'
...
...
This diff is collapsed.
Click to expand it.
hypha/apply/users/tests/factories.py
+
1
−
1
View file @
d6aef973
...
@@ -11,7 +11,7 @@ from ..groups import (
...
@@ -11,7 +11,7 @@ from ..groups import (
COMMUNITY_REVIEWER_GROUP_NAME
,
COMMUNITY_REVIEWER_GROUP_NAME
,
PARTNER_GROUP_NAME
,
PARTNER_GROUP_NAME
,
REVIEWER_GROUP_NAME
,
REVIEWER_GROUP_NAME
,
STAFF_GROUP_NAME
STAFF_GROUP_NAME
,
)
)
...
...
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