From e321a02d70660004a9ed8ccbe64913f9bf784efd Mon Sep 17 00:00:00 2001 From: Nick Lupton <19624419+mr-nick17@users.noreply.github.com> Date: Wed, 30 Nov 2022 14:02:45 +0000 Subject: [PATCH] 5951 add messaging about xlsx delay --- assets/locales/service.cy.toml | 4 ++++ assets/locales/service.en.toml | 4 ++++ .../templates/partials/census/get-data.tmpl | 19 +++++++++++++------ mapper/census.go | 1 + mapper/census_test.go | 8 ++++++++ model/datasetLandingPageCensus/model.go | 1 + 6 files changed, 31 insertions(+), 6 deletions(-) diff --git a/assets/locales/service.cy.toml b/assets/locales/service.cy.toml index e91db7e3..c64dd59e 100644 --- a/assets/locales/service.cy.toml +++ b/assets/locales/service.cy.toml @@ -274,6 +274,10 @@ one = "Select your download format" description = "Get the data component lead text" one = "Download the data in the following formats" +[GetDataXLSXInfo] +description = "xlsx delay information with {{.URI}}" +one = "If you are not seeing an xlsx download file, please refresh the page. If the number of rows within the data set exceeds 1 million, the xlsx download file will not be available." + [IncludesSupportingInfo] description = "Dataset and supporting information" one = "Dataset and supporting information" diff --git a/assets/locales/service.en.toml b/assets/locales/service.en.toml index 491749e5..a6326685 100644 --- a/assets/locales/service.en.toml +++ b/assets/locales/service.en.toml @@ -255,6 +255,10 @@ one = "Select your download format" description = "Get the data component lead text" one = "Download the data in the following formats" +[GetDataXLSXInfo] +description = "xlsx delay information with {{.URI}}" +one = "If you are not seeing an xlsx download file, please refresh the page. If the number of rows within the data set exceeds 1 million, the xlsx download file will not be available." + [IncludesSupportingInfo] description = "Dataset and supporting information" one = "Dataset and supporting information" diff --git a/assets/templates/partials/census/get-data.tmpl b/assets/templates/partials/census/get-data.tmpl index fe66d98a..9c34e235 100644 --- a/assets/templates/partials/census/get-data.tmpl +++ b/assets/templates/partials/census/get-data.tmpl @@ -3,13 +3,20 @@

{{ localise "GetData" .Language 1 }}

{{ if .DatasetLandingPage.HasDownloads }}
+ {{ if .DatasetLandingPage.ShowXLSXInfo }} +
+

+ {{- localise "GetDataXLSXInfo" .Language 1 .URI | safeHTML -}} +

+
+ {{ end }} {{ if .Error.Title }} -
- Error: -
-

- {{ localise "GetDataValidationError" .Language 1 }} -

+
+ Error: +
+

+ {{ localise "GetDataValidationError" .Language 1 }} +

{{ end }}
diff --git a/mapper/census.go b/mapper/census.go index ec11b654..4811a3e1 100644 --- a/mapper/census.go +++ b/mapper/census.go @@ -186,6 +186,7 @@ func CreateCensusDatasetLandingPage(isEnableMultivariate bool, ctx context.Conte if isFilterOutput && len(filterOutput) >= 3 { p.DatasetLandingPage.HasDownloads = true + p.DatasetLandingPage.ShowXLSXInfo = true } if p.HasContactDetails { diff --git a/mapper/census_test.go b/mapper/census_test.go index 993962e9..e22191c8 100644 --- a/mapper/census_test.go +++ b/mapper/census_test.go @@ -566,6 +566,10 @@ func TestCreateCensusDatasetLandingPage(t *testing.T) { So(page.DatasetLandingPage.HasDownloads, ShouldBeTrue) }) + Convey("GetDataXLSXInfo set to false", func() { + So(page.DatasetLandingPage.ShowXLSXInfo, ShouldBeFalse) + }) + Convey("Downloads are sorted by fixed extension order", func() { So(page.Version.Downloads[0].Extension, ShouldEqual, "xls") So(page.Version.Downloads[1].Extension, ShouldEqual, "csv") @@ -687,6 +691,10 @@ func TestCreateCensusDatasetLandingPage(t *testing.T) { So(page.DatasetLandingPage.HasDownloads, ShouldBeTrue) }) + Convey("GetDataXLSXInfo set to true for custom datasets", func() { + So(page.DatasetLandingPage.ShowXLSXInfo, ShouldBeTrue) + }) + Convey("Downloads are sorted by fixed extension order", func() { So(page.Version.Downloads[0].Extension, ShouldEqual, "csv") So(page.Version.Downloads[1].Extension, ShouldEqual, "txt") diff --git a/model/datasetLandingPageCensus/model.go b/model/datasetLandingPageCensus/model.go index c5f7b708..0f2a4b95 100644 --- a/model/datasetLandingPageCensus/model.go +++ b/model/datasetLandingPageCensus/model.go @@ -34,6 +34,7 @@ type DatasetLandingPage struct { QualityStatements []Panel `json:"quality_statements"` RelatedContentItems []RelatedContentItem `json:"related_content_items"` IsMultivariate bool `json:"is_multivariate"` + ShowXLSXInfo bool `json:"show_xlsx_info"` } // Panel contains the data required to populate a panel UI component