Skip to content

Commit

Permalink
update round export config
Browse files Browse the repository at this point in the history
  • Loading branch information
NarenderRajuB committed Sep 22, 2024
1 parent 941d6c2 commit 23ce2a5
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 24 deletions.
6 changes: 3 additions & 3 deletions app/blueprints/fund_builder/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,17 +232,17 @@ def round():
assessment_deadline=get_datetime(form.assessment_deadline),
prospectus_link=form.prospectus_link.data,
privacy_notice_link=form.privacy_notice_link.data,
contact_us_banner_json=form.contact_us_banner_json.data,
contact_us_banner_json={'en': form.contact_us_banner_json.data, "cy":None},
reference_contact_page_over_email=form.reference_contact_page_over_email.data,
contact_email=form.contact_email.data,
contact_phone=form.contact_phone.data,
contact_textphone=form.contact_textphone.data,
support_times=form.support_times.data,
support_days=form.support_days.data,
instructions_json={"en": form.instructions_json.data},
instructions_json={"en": form.instructions_json.data, "cy": None},
feedback_link=form.feedback_link.data,
project_name_field_id=form.project_name_field_id.data,
application_guidance_json={"en": form.application_guidance_json.data},
application_guidance_json={"en": form.application_guidance_json.data, "cy": None},
guidance_url=form.guidance_url.data,
all_uploaded_documents_section_available=form.all_uploaded_documents_section_available.data,
application_fields_download_available=form.application_fields_download_available.data,
Expand Down
17 changes: 17 additions & 0 deletions app/export_config/generate_fund_round_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,24 @@ def generate_round_config(round_id):
reminder_date=round.reminder_date.isoformat(),
prospectus=round.prospectus_link,
privacy_notice=round.privacy_notice_link,
contact_us_banner_json=round.contact_us_banner_json,
reference_contact_page_over_email=False,
contact_email=round.contact_email,
contact_phone=round.contact_phone,
contact_textphone=round.contact_textphone,
support_times=round.support_times,
support_days=round.support_days,
instructions_json=round.instructions_json,
feedback_link=round.feedback_link,
project_name_field_id=round.project_name_field_id,
application_guidance_json=round.application_guidance_json,
guidance_url=round.guidance_url,
all_uploaded_documents_section_available=round.all_uploaded_documents_section_available,
application_fields_download_available=round.application_fields_download_available,
display_logo_on_pdf_exports=round.display_logo_on_pdf_exports,
mark_as_complete_enabled=round.mark_as_complete_enabled,
is_expression_of_interest=round.is_expression_of_interest,
feedback_survey_config=round.feedback_survey_config,
)

write_config(round_export, "round_config", round.short_name, "python_file")
Expand Down
11 changes: 7 additions & 4 deletions app/shared/data_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,11 @@ class RoundExport:
display_logo_on_pdf_exports: Optional[bool] = None
mark_as_complete_enabled: Optional[bool] = None
is_expression_of_interest: Optional[bool] = None
eoi_decision_schema: Optional[str] = None # Adjust type as
feedback_survey_config: FeedbackSurveyConfig = field(default_factory=FeedbackSurveyConfig)
eligibility_config: EligibilityConfig = field(default_factory=EligibilityConfig)
eoi_decision_schema: Optional[Dict[str, str]] = None
# check to use FeedbackSurveyConfig
feedback_survey_config: Optional[Dict[str, str]] = None
# check to use EligibilityConfig
eligibility_config: Optional[Dict[str, str]] = None
title_json: TitleJson = field(default_factory=TitleJson)
contact_us_banner_json: ContactUsBannerJson = field(default_factory=ContactUsBannerJson)
#check to use EligibilityConfig
contact_us_banner_json: Optional[Dict[str, str]] = None
28 changes: 11 additions & 17 deletions tests/test_config_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,28 +68,23 @@ def test_generate_config_for_round_valid_input(seed_dynamic_data, monkeypatch):
"contact_email": None,
"contact_phone": None,
"contact_textphone": None,
"support_times": None,
"support_days": None,
"support_times": '',
"support_days": '',
"instructions_json": None,
"feedback_link": None,
"project_name_field_id": None,
"project_name_field_id": '',
"application_guidance_json": None,
"guidance_url": None,
"all_uploaded_documents_section_available": None,
"application_fields_download_available": None,
"display_logo_on_pdf_exports": None,
"mark_as_complete_enabled": None,
"is_expression_of_interest": None,
"all_uploaded_documents_section_available": False,
"application_fields_download_available": False,
"display_logo_on_pdf_exports": False,
"mark_as_complete_enabled": False,
"is_expression_of_interest": False,
"eoi_decision_schema": None,
"feedback_survey_config": {
"has_feedback_survey": None,
"has_section_feedback": None,
"is_feedback_survey_optional": None,
"is_section_feedback_optional": None,
},
"eligibility_config": {"has_eligibility": None},
"feedback_survey_config": None,
"eligibility_config": None,
"title_json": {"en": "round the first"},
"contact_us_banner_json": {"en": "", "cy": ""},
"contact_us_banner_json": None,
},
},
{
Expand Down Expand Up @@ -125,7 +120,6 @@ def test_generate_config_for_round_valid_input(seed_dynamic_data, monkeypatch):
if isinstance(data, dict):
keys_to_remove = ["reminder_date", "assessment_start", "assessment_deadline", "deadline", "opens"]
data = {k: v for k, v in data.items() if k not in keys_to_remove}

assert data == expected_file["expected_output"]
finally:
# Cleanup step to remove the directory
Expand Down

0 comments on commit 23ce2a5

Please sign in to comment.