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
cb19a679
"wiki/Roadmap" did not exist on "62d72f9e98ef3c1fcc1a8e307375aecf504f148b"
Commit
cb19a679
authored
4 years ago
by
vimal1083
Committed by
Fredrik Jonsson
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Update filter Api
parent
41db2f7d
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
hypha/apply/api/v1/filters.py
+10
-11
10 additions, 11 deletions
hypha/apply/api/v1/filters.py
hypha/apply/api/v1/views.py
+11
-11
11 additions, 11 deletions
hypha/apply/api/v1/views.py
with
21 additions
and
22 deletions
hypha/apply/api/v1/filters.py
+
10
−
11
View file @
cb19a679
...
...
@@ -44,19 +44,18 @@ class SubmissionsFilter(filters.FilterSet):
queryset
=
get_user_model
().
objects
.
all
(),
)
class
Meta
:
model
=
ApplicationSubmission
fields
=
(
'
status
'
,
'
round
'
,
'
active
'
,
'
submit_date
'
,
'
fund
'
,
'
screening_statuses
'
,
'
reviewers
'
,
'
lead
'
)
class
Meta
:
model
=
ApplicationSubmission
fields
=
(
'
status
'
,
'
round
'
,
'
active
'
,
'
submit_date
'
,
'
fund
'
,
'
screening_statuses
'
,
'
reviewers
'
,
'
lead
'
)
def
filter_active
(
self
,
qs
,
name
,
value
):
if
value
is
None
:
return
qs
def
filter_active
(
self
,
qs
,
name
,
value
):
if
value
is
None
:
return
qs
if
value
:
return
qs
.
active
()
else
:
return
qs
.
inactive
()
if
value
:
return
qs
.
active
()
else
:
return
qs
.
inactive
()
class
NewerThanFilter
(
filters
.
ModelChoiceFilter
):
...
...
This diff is collapsed.
Click to expand it.
hypha/apply/api/v1/views.py
+
11
−
11
View file @
cb19a679
...
...
@@ -14,7 +14,7 @@ from hypha.apply.activity.messaging import MESSAGES, messenger
from
hypha.apply.activity.models
import
COMMENT
,
Activity
from
hypha.apply.determinations.views
import
DeterminationCreateOrUpdateView
from
hypha.apply.funds.models
import
ApplicationSubmission
,
RoundsAndLabs
from
hypha.apply.funds.tables
import
get_reviewers
from
hypha.apply.funds.tables
import
get_reviewers
,
get_round_leads
,
get_screening_statuses
,
get_used_rounds
,
get_used_funds
from
hypha.apply.funds.workflow
import
STATUSES
from
hypha.apply.review.models
import
Review
...
...
@@ -57,7 +57,9 @@ class SubmissionViewSet(viewsets.ReadOnlyModelViewSet):
class
SubmissionFilters
(
APIView
):
permission_classes
=
[
permissions
.
IsAuthenticated
]
permission_classes
=
(
permissions
.
IsAuthenticated
,
IsApplyStaffUser
,
)
def
filter_unique_options
(
self
,
options
):
unique_items
=
[
dict
(
item
)
for
item
in
{
tuple
(
option
.
items
())
for
option
in
options
}]
...
...
@@ -71,15 +73,14 @@ class SubmissionFilters(APIView):
}
def
get
(
self
,
request
,
format
=
None
):
submissions
=
ApplicationSubmission
.
objects
.
for_table
(
user
=
self
.
request
.
user
)
filter_options
=
[
self
.
format
(
"
fund
"
,
"
Funds
"
,
[
{
"
key
"
:
submission
.
page
.
id
,
"
label
"
:
submission
.
page
.
title
}
for
submission
in
submissions
.
distinct
(
'
page
'
)
{
"
key
"
:
fund
.
get
(
"
id
"
),
"
label
"
:
fund
.
get
(
"
title
"
)
}
for
fund
in
get_used_funds
(
request
).
values
(
)
]),
self
.
format
(
"
round
"
,
"
Rounds
"
,
[
{
"
key
"
:
submission
.
round
.
id
,
"
label
"
:
submission
.
round
.
title
}
for
submission
in
submissions
.
distinct
(
'
round
'
).
exclude
(
round__isnull
=
True
)
{
"
key
"
:
round
.
get
(
"
id
"
),
"
label
"
:
round
.
get
(
"
title
"
)
}
for
round
in
get_used_rounds
(
request
).
values
(
)
]),
self
.
format
(
"
status
"
,
"
Statuses
"
,
[
{
'
key
'
:
list
(
STATUSES
.
get
(
label
)),
'
label
'
:
label
}
...
...
@@ -87,12 +88,11 @@ class SubmissionFilters(APIView):
]),
self
.
format
(
"
screening_statuses
"
,
"
Screenings
"
,
self
.
filter_unique_options
([
{
"
key
"
:
screening
.
get
(
"
id
"
),
"
label
"
:
screening
.
get
(
"
title
"
)}
for
submission
in
submissions
.
distinct
(
'
screening_statuses
'
)
for
screening
in
submission
.
screening_statuses
.
values
()
for
screening
in
get_screening_statuses
(
request
).
values
()
])),
self
.
format
(
"
lead
"
,
"
Leads
"
,
[
{
"
key
"
:
submission
.
lead
.
id
,
"
label
"
:
submission
.
lead
.
full_name
}
for
submission
in
submissions
.
distinct
(
'
lead
'
)
{
"
key
"
:
lead
.
get
(
'
id
'
),
"
label
"
:
lead
.
get
(
'
full_name
'
)
or
lead
.
get
(
'
email
'
)
}
for
lead
in
get_round_leads
(
request
).
values
(
)
]),
self
.
format
(
"
reviewers
"
,
"
Reviewers
"
,
self
.
filter_unique_options
([
{
"
key
"
:
reviewer
.
get
(
'
id
'
),
"
label
"
:
reviewer
.
get
(
'
full_name
'
)
or
reviewer
.
get
(
'
email
'
)}
...
...
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