Skip to content
This repository has been archived by the owner on Dec 10, 2024. It is now read-only.

Commit

Permalink
Merge pull request #448 from communitiesuk/fix-export-feedback-link-cyp
Browse files Browse the repository at this point in the history
Fix-export-feedback-link-cyp
  • Loading branch information
RamuniN authored Oct 18, 2023
2 parents a337970 + 4b27e8d commit 513ca5c
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 5 deletions.
15 changes: 11 additions & 4 deletions app/blueprints/assessments/models/fund_summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,17 @@ def create_round_summaries(
round_short_name=round.short_name.lower(),
report_type="OUTPUT_TRACKER",
)
feedback_export_href = url_for(
"assessment_bp.feedback_export",
fund_short_name=fund.short_name,
round_short_name=round.short_name.lower(),
feedback_export_href = (
url_for(
"assessment_bp.feedback_export",
fund_short_name=fund.short_name,
round_short_name=round.short_name.lower(),
)
if (
round.feedback_survey_config.has_feedback_survey
or round.feedback_survey_config.has_section_feedback
)
else ""
)

if has_devolved_authority_validation(fund_id=fund.id):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ <h3 class="govuk-body govuk_summary-card__title govuk-!-font-size-24">{{summary.
View all submitted applications
</a>
{{ round_links(summary.access_controller, summary.round_application_fields_download_available, summary.export_href, summary.feedback_export_href, summary.assessment_tracker_href) }}
{% elif summary.access_controller.is_lead_assessor %}
{% elif summary.access_controller.is_lead_assessor and summary.feedback_export_href %}
<a class="govuk-link" href="{{ summary.feedback_export_href }}">
Export applicants feedback information
</a>
Expand Down
30 changes: 30 additions & 0 deletions app/blueprints/services/models/round.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,25 @@
from .application import Application


@dataclass
class FeedbackSurveyConfig:
has_feedback_survey: bool = False
is_feedback_survey_optional: bool = True
has_section_feedback: bool = False
is_section_feedback_optional: bool = True

@staticmethod
def from_json(d: dict):
# Filter unknown fields from JSON dictionary
return FeedbackSurveyConfig(
**{
k: v
for k, v in d.items()
if k in inspect.signature(FeedbackSurveyConfig).parameters
}
)


@dataclass
class Round:
id: str
Expand All @@ -19,6 +38,15 @@ class Round:
application_fields_download_available: bool = False
display_logo_on_pdf_exports: bool = False
applications: List[Application] = None
feedback_survey_config: FeedbackSurveyConfig = None

def __post_init__(self):
if isinstance(self.feedback_survey_config, dict):
self.feedback_survey_config = FeedbackSurveyConfig.from_json(
self.feedback_survey_config
)
elif self.feedback_survey_config is None:
self.feedback_survey_config = FeedbackSurveyConfig()

@classmethod
def from_dict(cls, d: dict):
Expand Down Expand Up @@ -50,6 +78,8 @@ def from_json(data: dict):
or False,
display_logo_on_pdf_exports=data.get("display_logo_on_pdf_exports")
or False,
feedback_survey_config=data.get("feedback_survey_config")
or FeedbackSurveyConfig(),
)

def add_application(self, application: Application):
Expand Down

0 comments on commit 513ca5c

Please sign in to comment.