Skip to content

Commit

Permalink
Fs 4264 Add instructions_json column and migrate existing data (#276)
Browse files Browse the repository at this point in the history
* change instructions, app_guidance to json columns

* eoi welsh trans added

* add comments to migration script

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* added data update script for eoi

* update script

---------

Co-authored-by: RamuniN <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Mar 20, 2024
1 parent 5298dc9 commit 50dbc39
Show file tree
Hide file tree
Showing 16 changed files with 386 additions and 102 deletions.
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"args": [
"db",
"downgrade",
"0feae1606cfa" // modify the downgrade revision accordingly
"ed3a28891090" // modify the downgrade revision accordingly
]
},
{
Expand Down
10 changes: 10 additions & 0 deletions api/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,16 @@ def filter_fund(data):
def filter_round_by_lang(round_data, lang_key: str = "en"):
def filter_round(data):
data["title"] = data["title_json"].get(lang_key) or data["title_json"]["en"]
data["instructions"] = (
data["instructions_json"].get(lang_key) or data["instructions_json"].get("en")
if data["instructions_json"]
else ""
)
data["application_guidance"] = (
data["application_guidance_json"].get(lang_key) or data["application_guidance_json"].get("en")
if data["application_guidance_json"]
else ""
)
return data

if isinstance(round_data, dict):
Expand Down
44 changes: 30 additions & 14 deletions config/fund_loader_config/cof/cof_r2.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,26 @@
"contact_textphone": None,
"support_times": "9am to 5pm",
"support_days": "Monday to Friday",
"instructions": (
"You must have received an invitation to apply. If we did not invite you,"
" first <a"
' href="https://www.gov.uk/government/publications/community-ownership-fund-prospectus">'
" express your interest in the fund</a>."
),
"instructions_json": {
"en": (
"You must have received an invitation to apply. If we did not invite you,"
" first <a"
' href="https://www.gov.uk/government/publications/community-ownership-fund-prospectus">'
" express your interest in the fund</a>."
),
"cy": (
"You must have received an invitation to apply. If we did not invite you,"
" first <a"
' href="https://www.gov.uk/government/publications/community-ownership-fund-prospectus">'
" express your interest in the fund</a>."
),
},
"feedback_link": (
"https://forms.office.com/Pages/ResponsePage.aspx?id="
"EGg0v32c3kOociSi7zmVqN48ORk8WN5LlJITE3Swt-lURUNCR0dHMjgxWFZOMTMxQzlOTVIxVkQ0Sy4u"
),
"project_name_field_id": "KAgrBz",
"application_guidance": COF_APPLICATION_GUIDANCE,
"application_guidance_json": COF_APPLICATION_GUIDANCE,
"guidance_url": (
"https://mhclg.sharepoint.com.mcas.ms/:w:/s/CommunityOwnershipFund"
"/Ecv3iM7U0AtKtyHnzRrQ9dsB0HdMPvHWqAoGn1WrWM7EMA?e=6QpdUT"
Expand Down Expand Up @@ -96,18 +104,26 @@
"contact_textphone": None,
"support_times": "9am to 5pm",
"support_days": "Monday to Friday",
"instructions": (
"You must have received an invitation to apply. If we did not invite you,"
" first <a"
' href="https://www.gov.uk/government/publications/community-ownership-fund-prospectus">'
" express your interest in the fund</a>."
),
"instructions_json": {
"en": (
"You must have received an invitation to apply. If we did not invite you,"
" first <a"
' href="https://www.gov.uk/government/publications/community-ownership-fund-prospectus">'
" express your interest in the fund</a>."
),
"cy": (
"You must have received an invitation to apply. If we did not invite you,"
" first <a"
' href="https://www.gov.uk/government/publications/community-ownership-fund-prospectus">'
" express your interest in the fund</a>."
),
},
"feedback_link": (
"https://forms.office.com/Pages/ResponsePage.aspx?id="
"EGg0v32c3kOociSi7zmVqFJBHpeOL2tNnpiwpdL2iElUREIySU9OWTU4R0RTNjhBUDE1Q1VYVFBEMi4u"
),
"project_name_field_id": "KAgrBz",
"application_guidance": COF_APPLICATION_GUIDANCE,
"application_guidance_json": COF_APPLICATION_GUIDANCE,
"guidance_url": (
"https://mhclg.sharepoint.com.mcas.ms/:w:/s/CommunityOwnershipFund"
"/Ecv3iM7U0AtKtyHnzRrQ9dsB0HdMPvHWqAoGn1WrWM7EMA?e=6QpdUT"
Expand Down
69 changes: 47 additions & 22 deletions config/fund_loader_config/cof/cof_r3.py
Original file line number Diff line number Diff line change
Expand Up @@ -733,18 +733,26 @@
"contact_textphone": None,
"support_times": "9am to 5pm",
"support_days": "Monday to Friday",
"instructions": (
"You must have received an invitation to apply. If we did not invite you,"
" first <a"
' href="https://www.gov.uk/government/publications/community-ownership-fund-prospectus">'
" express your interest in the fund</a>."
),
"instructions_json": {
"en": (
"You must have received an invitation to apply. If we did not invite you,"
" first <a"
' href="https://www.gov.uk/government/publications/community-ownership-fund-prospectus">'
" express your interest in the fund</a>."
),
"cy": (
"You must have received an invitation to apply. If we did not invite you,"
" first <a"
' href="https://www.gov.uk/government/publications/community-ownership-fund-prospectus">'
" express your interest in the fund</a>."
),
},
"feedback_link": (
"https://forms.office.com/Pages/ResponsePage.aspx?id="
"EGg0v32c3kOociSi7zmVqFJBHpeOL2tNnpiwpdL2iElURUY1WkhaS0NFMlZVQUhYQ1NaN0E4RjlQMC4u"
),
"project_name_field_id": "apGjFS",
"application_guidance": COF_APPLICATION_GUIDANCE,
"application_guidance_json": COF_APPLICATION_GUIDANCE,
"guidance_url": (
"https://www.gov.uk/government/publications/community-ownership-fund-round-3-application-form"
"-assessment-criteria-guidance"
Expand Down Expand Up @@ -786,18 +794,26 @@
"contact_textphone": None,
"support_times": "9am to 5pm",
"support_days": "Monday to Friday",
"instructions": (
"You must have received an invitation to apply. If we did not invite you,"
" first <a"
' href="https://www.gov.uk/government/publications/community-ownership-fund-prospectus">'
" express your interest in the fund</a>."
),
"instructions_json": {
"en": (
"You must have received an invitation to apply. If we did not invite you,"
" first <a"
' href="https://www.gov.uk/government/publications/community-ownership-fund-prospectus">'
" express your interest in the fund</a>."
),
"cy": (
"You must have received an invitation to apply. If we did not invite you,"
" first <a"
' href="https://www.gov.uk/government/publications/community-ownership-fund-prospectus">'
" express your interest in the fund</a>."
),
},
"feedback_link": (
"https://forms.office.com/Pages/ResponsePage.aspx?id="
"EGg0v32c3kOociSi7zmVqFJBHpeOL2tNnpiwpdL2iElURUY1WkhaS0NFMlZVQUhYQ1NaN0E4RjlQMC4u"
),
"project_name_field_id": "apGjFS",
"application_guidance": COF_APPLICATION_GUIDANCE,
"application_guidance_json": COF_APPLICATION_GUIDANCE,
"guidance_url": (
"https://www.gov.uk/government/publications/community-ownership-fund-round-3-application-form"
"-assessment-criteria-guidance"
Expand Down Expand Up @@ -839,19 +855,28 @@
"contact_textphone": None,
"support_times": "9am to 5pm",
"support_days": "Monday to Friday",
"instructions": (
"You must have received an invitation to apply. If we did not invite you,"
" first <a"
' href="https://www.gov.uk/guidance/community-ownership-fund-round-3-how-'
'to-express-your-interest-in-applying">'
" express your interest in the fund</a>."
),
"instructions_json": {
"en": (
"You must have received an invitation to apply. If we did not invite you,"
" first <a"
' href="https://www.gov.uk/guidance/community-ownership-fund-round-3-how-'
'to-express-your-interest-in-applying">'
" express your interest in the fund</a>."
),
"cy": (
"You must have received an invitation to apply. If we did not invite you,"
" first <a"
' href="https://www.gov.uk/guidance/community-ownership-fund-round-3-how-'
'to-express-your-interest-in-applying">'
" express your interest in the fund</a>."
),
},
"feedback_link": (
"https://forms.office.com/Pages/ResponsePage.aspx?id="
"EGg0v32c3kOociSi7zmVqFJBHpeOL2tNnpiwpdL2iElURUY1WkhaS0NFMlZVQUhYQ1NaN0E4RjlQMC4u"
),
"project_name_field_id": "apGjFS",
"application_guidance": COF_APPLICATION_GUIDANCE,
"application_guidance_json": COF_APPLICATION_GUIDANCE,
"guidance_url": (
"https://www.gov.uk/government/publications/community-ownership-fund-round-3-application-form"
"-assessment-criteria-guidance"
Expand Down
24 changes: 16 additions & 8 deletions config/fund_loader_config/cof/cof_r4.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,19 +253,27 @@
"contact_textphone": None,
"support_times": "9am to 5pm",
"support_days": "Monday to Friday",
"instructions": (
"You must have received an invitation to apply. If we did not invite you,"
" first <a"
' href="https://www.gov.uk/guidance/community-ownership-fund-round-3-how-'
'to-express-your-interest-in-applying">'
" express your interest in the fund</a>."
),
"instructions_json": {
"en": (
"You must have received an invitation to apply. If we did not invite you,"
" first <a"
' href="https://www.gov.uk/guidance/community-ownership-fund-round-3-how-'
'to-express-your-interest-in-applying">'
" express your interest in the fund</a>."
),
"cy": (
"Mae'n rhaid i chi fod wedi derbyn gwahoddiad i ymgeisio. Os na wnaethom eich gwahodd, <a"
' href="https://www.gov.uk/guidance/community-ownership-fund-round-3-how-'
'to-express-your-interest-in-applying">'
" mynegwch eich diddordeb yn y gronfa yn gyntaf</a>."
),
},
"feedback_link": (
"https://forms.office.com/Pages/ResponsePage.aspx?id="
"EGg0v32c3kOociSi7zmVqFJBHpeOL2tNnpiwpdL2iElURUY1WkhaS0NFMlZVQUhYQ1NaN0E4RjlQMC4u"
),
"project_name_field_id": "apGjFS",
"application_guidance": COF_APPLICATION_GUIDANCE,
"application_guidance_json": COF_APPLICATION_GUIDANCE,
"guidance_url": (
"https://www.gov.uk/government/publications/community-ownership-fund-round-3-application-form"
"-assessment-criteria-guidance"
Expand Down
16 changes: 11 additions & 5 deletions config/fund_loader_config/cof/eoi.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,16 +127,22 @@
"contact_textphone": None,
"support_times": "9am to 5pm",
"support_days": "Monday to Friday",
"instructions": (
"You must complete this Expression of Interest (EOI) form if you"
" are interested in applying for the Community Ownership Fund (COF)."
),
"instructions_json": {
"en": (
"You must complete this Expression of Interest (EOI) form if you"
" are interested in applying for the Community Ownership Fund (COF)."
),
"cy": (
"Mae'n rhaid i chi gwblhau'r ffurflen Datganiad o Ddiddordeb hon os"
" oes diddordeb gennych mewn gwneud cais i'r Gronfa Perchnogaeth Gymunedol."
),
},
"feedback_link": (
"https://forms.office.com/Pages/ResponsePage.aspx?id="
"EGg0v32c3kOociSi7zmVqFJBHpeOL2tNnpiwpdL2iElURUY1WkhaS0NFMlZVQUhYQ1NaN0E4RjlQMC4u"
),
"project_name_field_id": "SMRWjl",
"application_guidance": EOI_APPLICATION_GUIDANCE,
"application_guidance_json": EOI_APPLICATION_GUIDANCE,
"guidance_url": (
"https://www.gov.uk/government/publications/community-ownership-fund-round-3-application-form"
"-assessment-criteria-guidance"
Expand Down
40 changes: 28 additions & 12 deletions config/fund_loader_config/cof/shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,32 @@
"owner_organisation_logo_uri": DLUHC_LOGO_PNG,
}

COF_APPLICATION_GUIDANCE = ( # TODO: Provide welsh translation
"<h2 class='govuk-heading govuk-heading-s'>What we'll ask you for</h2><p"
" class='govuk-body'>You can preview the <a href='{all_questions_url}'>full list of"
" application questions</a>.</p><p class='govuk-body'>We'll also ask you to upload"
" a business plan to support the answers you've given us in the management case"
" section.</p>"
)
COF_APPLICATION_GUIDANCE = {
"en": (
"<h2 class='govuk-heading govuk-heading-s'>What we'll ask you for</h2><p"
" class='govuk-body'>You can preview the <a href='{all_questions_url}'>full list of"
" application questions</a>.</p><p class='govuk-body'>We'll also ask you to upload"
" a business plan to support the answers you've given us in the management case"
" section.</p>"
),
"cy": (
"<h2 class='govuk-heading govuk-heading-s'>Beth fyddwn ni'n gofyn i chi amdano</h2><p"
" class='govuk-body'>Gallwch gael cip ymlaen llaw <a href='{all_questions_url}'>o restr lawn"
" cwestiynau'r cais</a>.</p><p class='govuk-body'>Byddwn hefyd yn gofyn i chi "
"lanlwytho cynllun busnes i ategu'r atebion rydych wedi'u rhoi i ni yn"
" yr adran achos rheoli.</p>"
),
}

EOI_APPLICATION_GUIDANCE = ( # TODO: Provide welsh translation
"<h2 class='govuk-heading govuk-heading-s'>What we'll ask you for</h2><p"
" class='govuk-body'>You can preview the <a class='govuk-link' href='{all_questions_url}'>full list of"
" application questions</a>.</p>"
)
EOI_APPLICATION_GUIDANCE = {
"en": (
"<h2 class='govuk-heading govuk-heading-s'>What we'll ask you for</h2><p"
" class='govuk-body'>You can preview the <a class='govuk-link' href='{all_questions_url}'>full list of"
" application questions</a>.</p>"
),
"cy": (
"<h2 class='govuk-heading govuk-heading-s'>Beth y byddwn yn gofyn i chi amdano</h2><p"
" class='govuk-body'>Gallwch gael rhagolwg o'r <a class='govuk-link' href='{all_questions_url}'>rhestr lawn o"
" gwestiynau yn y cais</a>.</p>"
),
}
20 changes: 11 additions & 9 deletions config/fund_loader_config/cyp/cyp_r1.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@
CYP_R1_ASSESSMENT_DEADLINE_DATE = datetime(2023, 12, 24, 12, 0, 0, tzinfo=timezone.utc) # 2023-12-24 12:00:00

CYP_PROSPECTS_LINK = "https://www.gov.uk/government/publications/the-children-and-young-peoples-resettlement-fund-prospectus/the-children-and-young-peoples-resettlement-fund-prospectus" # noqa
CYP_APPLICATION_GUIDANCE = (
"<h2 class='govuk-heading govuk-heading-s'>Before you start</h2><p"
f" class='govuk-body'><a href='{CYP_PROSPECTS_LINK}'>Read the fund's prospectus</a>"
" before you apply.</p><p class='govuk-body'>You can <a"
" href='{all_questions_url}'>preview the full list of application"
" questions</a>.</p>"
)
CYP_APPLICATION_GUIDANCE = {
"en": (
"<h2 class='govuk-heading govuk-heading-s'>Before you start</h2><p"
f" class='govuk-body'><a href='{CYP_PROSPECTS_LINK}'>Read the fund's prospectus</a>"
" before you apply.</p><p class='govuk-body'>You can <a"
" href='{all_questions_url}'>preview the full list of application"
" questions</a>.</p>"
)
}

r1_application_sections = [
{
Expand Down Expand Up @@ -163,10 +165,10 @@
"contact_textphone": None,
"support_times": "9am to 5pm",
"support_days": "Monday to Friday",
"instructions": "",
"instructions_json": None,
"feedback_link": "",
"project_name_field_id": "bsUoNG",
"application_guidance": CYP_APPLICATION_GUIDANCE,
"application_guidance_json": CYP_APPLICATION_GUIDANCE,
"guidance_url": (
"https://www.gov.uk/government/publications/"
"the-children-and-young-peoples-resettlement-"
Expand Down
20 changes: 11 additions & 9 deletions config/fund_loader_config/digital_planning/dpi_r2.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@
"https://www.localdigital.gov.uk/digital-planning/funding/digital-planning-programme-funding-2023" # noqa
)
DPI_PRIVACY_NOTICE = "https://www.gov.uk/guidance/digital-planning-improvement-fund-privacy-notice"
DPI_APPLICATION_GUIDANCE = (
"<h2 class='govuk-heading govuk-heading-s'>Before you start</h2><p"
f" class='govuk-body'><a href='{DPI_PROSPECTS_LINK}'>Read the fund's prospectus</a>"
" before you apply.</p><p class='govuk-body'>You can <a"
" href='{all_questions_url}'>preview the full list of application"
" questions</a>.</p>"
)
DPI_APPLICATION_GUIDANCE = {
"en": (
"<h2 class='govuk-heading govuk-heading-s'>Before you start</h2><p"
f" class='govuk-body'><a href='{DPI_PROSPECTS_LINK}'>Read the fund's prospectus</a>"
" before you apply.</p><p class='govuk-body'>You can <a"
" href='{all_questions_url}'>preview the full list of application"
" questions</a>.</p>"
)
}

r2_application_sections = [
{
Expand Down Expand Up @@ -141,10 +143,10 @@
"contact_textphone": None,
"support_times": "9am to 5pm",
"support_days": "Monday to Friday",
"instructions": "",
"instructions_json": None,
"feedback_link": "",
"project_name_field_id": "JAAhRP",
"application_guidance": DPI_APPLICATION_GUIDANCE,
"application_guidance_json": DPI_APPLICATION_GUIDANCE,
"guidance_url": (
"https://docs.google.com/document/d/1cF5eKphoBWEUe0Zv5HBwv0R3n1svCk16kUFRJhKnIQY"
"/edit#heading=h.b0vrhm5gih2k"
Expand Down
Loading

0 comments on commit 50dbc39

Please sign in to comment.