This repository has been archived by the owner on Dec 3, 2024. It is now read-only.
generated from communitiesuk/funding-service-design-TEMPLATE
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
srh-sloan
committed
Nov 8, 2024
1 parent
33cd935
commit 1eb62cd
Showing
56 changed files
with
3,711 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
# noqa | ||
from .application import order_applications # noqa | ||
from .form import get_blank_forms # noqa |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from operator import itemgetter | ||
|
||
|
||
def order_applications(applications, order_by, order_rev): | ||
"""Returns a list of ordered applications.""" | ||
if order_by and order_by in [ | ||
"id", | ||
"status", | ||
"account_id", | ||
"assessment_deadline", | ||
"started_at", | ||
"last_edited", | ||
]: | ||
applications = sorted( | ||
applications, | ||
key=itemgetter(order_by), | ||
reverse=int(order_rev), | ||
) | ||
return applications |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
from services.apply import get_application_sections | ||
|
||
|
||
def get_form_name(section): | ||
forms = set() | ||
if section["children"]: | ||
for child in section["children"]: | ||
forms.update(get_form_name(child)) | ||
if section["form_name"]: | ||
forms.add(section["form_name"]) | ||
return forms | ||
|
||
|
||
def get_forms_from_sections(sections): | ||
mint_form_list = set() | ||
for section in sections: | ||
mint_form_list.update(get_form_name(section)) | ||
return mint_form_list | ||
|
||
|
||
def get_blank_forms(fund_id: str, round_id: str, language: str): | ||
"""Get the list of forms required to populate a blank application for a fund | ||
round. | ||
Args: | ||
fund_id: (str) The id of the fund | ||
round_id: (str) The id of the fund round | ||
Returns: | ||
A list of json forms to populate the form | ||
""" | ||
application_sections = get_application_sections(fund_id, round_id, language) | ||
if application_sections: | ||
forms = get_forms_from_sections(application_sections) | ||
if not forms: | ||
raise Exception(f"Could not find forms for {fund_id} - {round_id}") | ||
return forms | ||
raise Exception(f"Could not find fund round for {fund_id} - {round_id} in fund store.") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
from apply.api.routes.application.routes import ApplicationsView # noqa | ||
from apply.api.routes.queues.routes import QueueView # noqa |
Empty file.
Empty file.
Oops, something went wrong.