From 2a32f7a7dfa1efa7241371a2733936d49f16163b Mon Sep 17 00:00:00 2001 From: Lubos Hricak Date: Thu, 7 Sep 2023 12:16:46 +0200 Subject: [PATCH 1/5] Move threshold for company business start to 1000 years --- .../v2024/innovation/innovation_step4.rb | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/forms/award_years/v2024/innovation/innovation_step4.rb b/forms/award_years/v2024/innovation/innovation_step4.rb index 418aacb789..f639775f9b 100644 --- a/forms/award_years/v2024/innovation/innovation_step4.rb +++ b/forms/award_years/v2024/innovation/innovation_step4.rb @@ -62,7 +62,7 @@ def innovation_step4 by_year_condition :started_trading, ->(v) { Utils::Date.within_range?(v, AwardYear.start_trading_between(2, 3)) }, 2, data: {value: AwardYear.start_trading_between(2, 3, minmax: true, format: true), type: :range, identifier: "2 to 3"} by_year_condition :started_trading, ->(v) { Utils::Date.within_range?(v, AwardYear.start_trading_between(3, 4)) }, 3, data: {value: AwardYear.start_trading_between(3, 4, minmax: true, format: true), type: :range, identifier: "3 to 4"} by_year_condition :started_trading, ->(v) { Utils::Date.within_range?(v, AwardYear.start_trading_between(4, 5)) }, 4, data: {value: AwardYear.start_trading_between(4, 5, minmax: true, format: true), type: :range, identifier: "4 to 5"} - by_year_condition :started_trading, ->(v) { Utils::Date.within_range?(v, AwardYear.start_trading_between(5, 99)) }, 5, data: {value: AwardYear.start_trading_between(5, Settings.min_started_trading, minmax: true, format: true), type: :range, identifier: "5 plus", default: true}, default: true + by_year_condition :started_trading, ->(v) { Utils::Date.within_range?(v, AwardYear.start_trading_between(5, 1000)) }, 5, data: {value: AwardYear.start_trading_between(5, 1000, minmax: true, format: true), type: :range, identifier: "5 plus", default: true}, default: true conditional :financial_year_date_changed, :yes end @@ -115,7 +115,7 @@ def innovation_step4 by_year_condition :started_trading, ->(v) { Utils::Date.within_range?(v, AwardYear.start_trading_between(2, 3)) }, 2, data: {value: AwardYear.start_trading_between(2, 3, minmax: true, format: true), type: :range, identifier: "2 to 3"} by_year_condition :started_trading, ->(v) { Utils::Date.within_range?(v, AwardYear.start_trading_between(3, 4)) }, 3, data: {value: AwardYear.start_trading_between(3, 4, minmax: true, format: true), type: :range, identifier: "3 to 4"} by_year_condition :started_trading, ->(v) { Utils::Date.within_range?(v, AwardYear.start_trading_between(4, 5)) }, 4, data: {value: AwardYear.start_trading_between(4, 5, minmax: true, format: true), type: :range, identifier: "4 to 5"} - by_year_condition :started_trading, ->(v) { Utils::Date.within_range?(v, AwardYear.start_trading_between(5, 99)) }, 5, data: {value: AwardYear.start_trading_between(5, Settings.min_started_trading, minmax: true, format: true), type: :range, identifier: "5 plus", default: true}, default: true + by_year_condition :started_trading, ->(v) { Utils::Date.within_range?(v, AwardYear.start_trading_between(5, 1000)) }, 5, data: {value: AwardYear.start_trading_between(5, 1000, minmax: true, format: true), type: :range, identifier: "5 plus", default: true}, default: true conditional :financial_year_date_changed, :true employees_question @@ -138,7 +138,7 @@ def innovation_step4 by_year_condition :started_trading, ->(v) { Utils::Date.within_range?(v, AwardYear.start_trading_between(2, 3)) }, 2, data: {value: AwardYear.start_trading_between(2, 3, minmax: true, format: true), type: :range, identifier: "2 to 3"} by_year_condition :started_trading, ->(v) { Utils::Date.within_range?(v, AwardYear.start_trading_between(3, 4)) }, 3, data: {value: AwardYear.start_trading_between(3, 4, minmax: true, format: true), type: :range, identifier: "3 to 4"} by_year_condition :started_trading, ->(v) { Utils::Date.within_range?(v, AwardYear.start_trading_between(4, 5)) }, 4, data: {value: AwardYear.start_trading_between(4, 5, minmax: true, format: true), type: :range, identifier: "4 to 5"} - by_year_condition :started_trading, ->(v) { Utils::Date.within_range?(v, AwardYear.start_trading_between(5, 99)) }, 5, data: {value: AwardYear.start_trading_between(5, Settings.min_started_trading, minmax: true, format: true), type: :range, identifier: "5 plus", default: true}, default: true + by_year_condition :started_trading, ->(v) { Utils::Date.within_range?(v, AwardYear.start_trading_between(5, 1000)) }, 5, data: {value: AwardYear.start_trading_between(5, 1000, minmax: true, format: true), type: :range, identifier: "5 plus", default: true}, default: true conditional :financial_year_date_changed, :true end @@ -154,7 +154,7 @@ def innovation_step4 by_year_condition :started_trading, ->(v) { Utils::Date.within_range?(v, AwardYear.start_trading_between(2, 3)) }, 2, data: {value: AwardYear.start_trading_between(2, 3, minmax: true, format: true), type: :range, identifier: "2 to 3"} by_year_condition :started_trading, ->(v) { Utils::Date.within_range?(v, AwardYear.start_trading_between(3, 4)) }, 3, data: {value: AwardYear.start_trading_between(3, 4, minmax: true, format: true), type: :range, identifier: "3 to 4"} by_year_condition :started_trading, ->(v) { Utils::Date.within_range?(v, AwardYear.start_trading_between(4, 5)) }, 4, data: {value: AwardYear.start_trading_between(4, 5, minmax: true, format: true), type: :range, identifier: "4 to 5"} - by_year_condition :started_trading, ->(v) { Utils::Date.within_range?(v, AwardYear.start_trading_between(5, 99)) }, 5, data: {value: AwardYear.start_trading_between(5, Settings.min_started_trading, minmax: true, format: true), type: :range, identifier: "5 plus", default: true}, default: true + by_year_condition :started_trading, ->(v) { Utils::Date.within_range?(v, AwardYear.start_trading_between(5, 1000)) }, 5, data: {value: AwardYear.start_trading_between(5, 1000, minmax: true, format: true), type: :range, identifier: "5 plus", default: true}, default: true conditional :financial_year_date_changed, :true end @@ -168,7 +168,7 @@ def innovation_step4 by_year_condition :started_trading, ->(v) { Utils::Date.within_range?(v, AwardYear.start_trading_between(2, 3)) }, 2, data: {value: AwardYear.start_trading_between(2, 3, minmax: true, format: true), type: :range, identifier: "2 to 3"} by_year_condition :started_trading, ->(v) { Utils::Date.within_range?(v, AwardYear.start_trading_between(3, 4)) }, 3, data: {value: AwardYear.start_trading_between(3, 4, minmax: true, format: true), type: :range, identifier: "3 to 4"} by_year_condition :started_trading, ->(v) { Utils::Date.within_range?(v, AwardYear.start_trading_between(4, 5)) }, 4, data: {value: AwardYear.start_trading_between(4, 5, minmax: true, format: true), type: :range, identifier: "4 to 5"} - by_year_condition :started_trading, ->(v) { Utils::Date.within_range?(v, AwardYear.start_trading_between(5, 99)) }, 5, data: {value: AwardYear.start_trading_between(5, Settings.min_started_trading, minmax: true, format: true), type: :range, identifier: "5 plus", default: true}, default: true + by_year_condition :started_trading, ->(v) { Utils::Date.within_range?(v, AwardYear.start_trading_between(5, 1000)) }, 5, data: {value: AwardYear.start_trading_between(5, 1000, minmax: true, format: true), type: :range, identifier: "5 plus", default: true}, default: true conditional :financial_year_date_changed, :true turnover :total_turnover @@ -185,7 +185,7 @@ def innovation_step4 by_year_condition :started_trading, ->(v) { Utils::Date.within_range?(v, AwardYear.start_trading_between(2, 3)) }, 2, data: {value: AwardYear.start_trading_between(2, 3, minmax: true, format: true), type: :range, identifier: "2 to 3"} by_year_condition :started_trading, ->(v) { Utils::Date.within_range?(v, AwardYear.start_trading_between(3, 4)) }, 3, data: {value: AwardYear.start_trading_between(3, 4, minmax: true, format: true), type: :range, identifier: "3 to 4"} by_year_condition :started_trading, ->(v) { Utils::Date.within_range?(v, AwardYear.start_trading_between(4, 5)) }, 4, data: {value: AwardYear.start_trading_between(4, 5, minmax: true, format: true), type: :range, identifier: "4 to 5"} - by_year_condition :started_trading, ->(v) { Utils::Date.within_range?(v, AwardYear.start_trading_between(5, 99)) }, 5, data: {value: AwardYear.start_trading_between(5, Settings.min_started_trading, minmax: true, format: true), type: :range, identifier: "5 plus", default: true}, default: true + by_year_condition :started_trading, ->(v) { Utils::Date.within_range?(v, AwardYear.start_trading_between(5, 1000)) }, 5, data: {value: AwardYear.start_trading_between(5, 1000, minmax: true, format: true), type: :range, identifier: "5 plus", default: true}, default: true context %(

Use a minus symbol to record any losses. @@ -209,7 +209,7 @@ def innovation_step4 by_year_condition :started_trading, ->(v) { Utils::Date.within_range?(v, AwardYear.start_trading_between(2, 3)) }, 2, data: {value: AwardYear.start_trading_between(2, 3, minmax: true, format: true), type: :range, identifier: "2 to 3"} by_year_condition :started_trading, ->(v) { Utils::Date.within_range?(v, AwardYear.start_trading_between(3, 4)) }, 3, data: {value: AwardYear.start_trading_between(3, 4, minmax: true, format: true), type: :range, identifier: "3 to 4"} by_year_condition :started_trading, ->(v) { Utils::Date.within_range?(v, AwardYear.start_trading_between(4, 5)) }, 4, data: {value: AwardYear.start_trading_between(4, 5, minmax: true, format: true), type: :range, identifier: "4 to 5"} - by_year_condition :started_trading, ->(v) { Utils::Date.within_range?(v, AwardYear.start_trading_between(5, 99)) }, 5, data: {value: AwardYear.start_trading_between(5, Settings.min_started_trading, minmax: true, format: true), type: :range, identifier: "5 plus", default: true}, default: true + by_year_condition :started_trading, ->(v) { Utils::Date.within_range?(v, AwardYear.start_trading_between(5, 1000)) }, 5, data: {value: AwardYear.start_trading_between(5, 1000, minmax: true, format: true), type: :range, identifier: "5 plus", default: true}, default: true conditional :financial_year_date_changed, :true end @@ -330,7 +330,7 @@ def innovation_step4 by_year_condition :innovation_was_launched_in_the_market, ->(v) { Utils::Date.within_range?(v, AwardYear.start_trading_between(2, 3)) }, 2, data: {value: AwardYear.start_trading_between(2, 3, minmax: true, format: true), type: :range, identifier: "2 to 3"} by_year_condition :innovation_was_launched_in_the_market, ->(v) { Utils::Date.within_range?(v, AwardYear.start_trading_between(3, 4)) }, 3, data: {value: AwardYear.start_trading_between(3, 4, minmax: true, format: true), type: :range, identifier: "3 to 4"} by_year_condition :innovation_was_launched_in_the_market, ->(v) { Utils::Date.within_range?(v, AwardYear.start_trading_between(4, 5)) }, 4, data: {value: AwardYear.start_trading_between(4, 5, minmax: true, format: true), type: :range, identifier: "4 to 5"} - by_year_condition :innovation_was_launched_in_the_market, ->(v) { Utils::Date.within_range?(v, AwardYear.start_trading_between(5, 99)) }, 5, data: {value: AwardYear.start_trading_between(5, Settings.min_started_trading, minmax: true, format: true), type: :range, identifier: "5 plus", default: true}, default: true + by_year_condition :innovation_was_launched_in_the_market, ->(v) { Utils::Date.within_range?(v, AwardYear.start_trading_between(5, 1000)) }, 5, data: {value: AwardYear.start_trading_between(5, 1000, minmax: true, format: true), type: :range, identifier: "5 plus", default: true}, default: true end by_years :sales, "Sales of your innovative product/service (if applicable)." do @@ -345,7 +345,7 @@ def innovation_step4 by_year_condition :innovation_was_launched_in_the_market, ->(v) { Utils::Date.within_range?(v, AwardYear.start_trading_between(2, 3)) }, 2, data: {value: AwardYear.start_trading_between(2, 3, minmax: true, format: true), type: :range, identifier: "2 to 3"} by_year_condition :innovation_was_launched_in_the_market, ->(v) { Utils::Date.within_range?(v, AwardYear.start_trading_between(3, 4)) }, 3, data: {value: AwardYear.start_trading_between(3, 4, minmax: true, format: true), type: :range, identifier: "3 to 4"} by_year_condition :innovation_was_launched_in_the_market, ->(v) { Utils::Date.within_range?(v, AwardYear.start_trading_between(4, 5)) }, 4, data: {value: AwardYear.start_trading_between(4, 5, minmax: true, format: true), type: :range, identifier: "4 to 5"} - by_year_condition :innovation_was_launched_in_the_market, ->(v) { Utils::Date.within_range?(v, AwardYear.start_trading_between(5, 99)) }, 5, data: {value: AwardYear.start_trading_between(5, Settings.min_started_trading, minmax: true, format: true), type: :range, identifier: "5 plus", default: true}, default: true + by_year_condition :innovation_was_launched_in_the_market, ->(v) { Utils::Date.within_range?(v, AwardYear.start_trading_between(5, 1000)) }, 5, data: {value: AwardYear.start_trading_between(5, 1000, minmax: true, format: true), type: :range, identifier: "5 plus", default: true}, default: true end by_years :sales_exports, "Of which exports (if applicable)." do @@ -360,7 +360,7 @@ def innovation_step4 by_year_condition :innovation_was_launched_in_the_market, ->(v) { Utils::Date.within_range?(v, AwardYear.start_trading_between(2, 3)) }, 2, data: {value: AwardYear.start_trading_between(2, 3, minmax: true, format: true), type: :range, identifier: "2 to 3"} by_year_condition :innovation_was_launched_in_the_market, ->(v) { Utils::Date.within_range?(v, AwardYear.start_trading_between(3, 4)) }, 3, data: {value: AwardYear.start_trading_between(3, 4, minmax: true, format: true), type: :range, identifier: "3 to 4"} by_year_condition :innovation_was_launched_in_the_market, ->(v) { Utils::Date.within_range?(v, AwardYear.start_trading_between(4, 5)) }, 4, data: {value: AwardYear.start_trading_between(4, 5, minmax: true, format: true), type: :range, identifier: "4 to 5"} - by_year_condition :innovation_was_launched_in_the_market, ->(v) { Utils::Date.within_range?(v, AwardYear.start_trading_between(5, 99)) }, 5, data: {value: AwardYear.start_trading_between(5, Settings.min_started_trading, minmax: true, format: true), type: :range, identifier: "5 plus", default: true}, default: true + by_year_condition :innovation_was_launched_in_the_market, ->(v) { Utils::Date.within_range?(v, AwardYear.start_trading_between(5, 1000)) }, 5, data: {value: AwardYear.start_trading_between(5, 1000, minmax: true, format: true), type: :range, identifier: "5 plus", default: true}, default: true end by_years :sales_royalties, "Of which royalties or licences (if applicable)." do @@ -375,7 +375,7 @@ def innovation_step4 by_year_condition :innovation_was_launched_in_the_market, ->(v) { Utils::Date.within_range?(v, AwardYear.start_trading_between(2, 3)) }, 2, data: {value: AwardYear.start_trading_between(2, 3, minmax: true, format: true), type: :range, identifier: "2 to 3"} by_year_condition :innovation_was_launched_in_the_market, ->(v) { Utils::Date.within_range?(v, AwardYear.start_trading_between(3, 4)) }, 3, data: {value: AwardYear.start_trading_between(3, 4, minmax: true, format: true), type: :range, identifier: "3 to 4"} by_year_condition :innovation_was_launched_in_the_market, ->(v) { Utils::Date.within_range?(v, AwardYear.start_trading_between(4, 5)) }, 4, data: {value: AwardYear.start_trading_between(4, 5, minmax: true, format: true), type: :range, identifier: "4 to 5"} - by_year_condition :innovation_was_launched_in_the_market, ->(v) { Utils::Date.within_range?(v, AwardYear.start_trading_between(5, 99)) }, 5, data: {value: AwardYear.start_trading_between(5, Settings.min_started_trading, minmax: true, format: true), type: :range, identifier: "5 plus", default: true}, default: true + by_year_condition :innovation_was_launched_in_the_market, ->(v) { Utils::Date.within_range?(v, AwardYear.start_trading_between(5, 1000)) }, 5, data: {value: AwardYear.start_trading_between(5, 1000, minmax: true, format: true), type: :range, identifier: "5 plus", default: true}, default: true end textarea :drops_in_sales, "Explain any drop in sales or the number of units sold (if applicable)." do @@ -403,7 +403,7 @@ def innovation_step4 by_year_condition :innovation_was_launched_in_the_market, ->(v) { Utils::Date.within_range?(v, AwardYear.start_trading_between(2, 3)) }, 2, data: {value: AwardYear.start_trading_between(2, 3, minmax: true, format: true), type: :range, identifier: "2 to 3"} by_year_condition :innovation_was_launched_in_the_market, ->(v) { Utils::Date.within_range?(v, AwardYear.start_trading_between(3, 4)) }, 3, data: {value: AwardYear.start_trading_between(3, 4, minmax: true, format: true), type: :range, identifier: "3 to 4"} by_year_condition :innovation_was_launched_in_the_market, ->(v) { Utils::Date.within_range?(v, AwardYear.start_trading_between(4, 5)) }, 4, data: {value: AwardYear.start_trading_between(4, 5, minmax: true, format: true), type: :range, identifier: "4 to 5"} - by_year_condition :innovation_was_launched_in_the_market, ->(v) { Utils::Date.within_range?(v, AwardYear.start_trading_between(5, 99)) }, 5, data: {value: AwardYear.start_trading_between(5, Settings.min_started_trading, minmax: true, format: true), type: :range, identifier: "5 plus", default: true}, default: true + by_year_condition :innovation_was_launched_in_the_market, ->(v) { Utils::Date.within_range?(v, AwardYear.start_trading_between(5, 1000)) }, 5, data: {value: AwardYear.start_trading_between(5, 1000, minmax: true, format: true), type: :range, identifier: "5 plus", default: true}, default: true end textarea :avg_unit_price_desc, "Explain your unit selling prices or contract values, highlighting any changes over the above periods (if applicable)." do @@ -428,7 +428,7 @@ def innovation_step4 by_year_condition :innovation_was_launched_in_the_market, ->(v) { Utils::Date.within_range?(v, AwardYear.start_trading_between(2, 3)) }, 2, data: {value: AwardYear.start_trading_between(2, 3, minmax: true, format: true), type: :range, identifier: "2 to 3"} by_year_condition :innovation_was_launched_in_the_market, ->(v) { Utils::Date.within_range?(v, AwardYear.start_trading_between(3, 4)) }, 3, data: {value: AwardYear.start_trading_between(3, 4, minmax: true, format: true), type: :range, identifier: "3 to 4"} by_year_condition :innovation_was_launched_in_the_market, ->(v) { Utils::Date.within_range?(v, AwardYear.start_trading_between(4, 5)) }, 4, data: {value: AwardYear.start_trading_between(4, 5, minmax: true, format: true), type: :range, identifier: "4 to 5"} - by_year_condition :innovation_was_launched_in_the_market, ->(v) { Utils::Date.within_range?(v, AwardYear.start_trading_between(5, 99)) }, 5, data: {value: AwardYear.start_trading_between(5, Settings.min_started_trading, minmax: true, format: true), type: :range, identifier: "5 plus", default: true}, default: true + by_year_condition :innovation_was_launched_in_the_market, ->(v) { Utils::Date.within_range?(v, AwardYear.start_trading_between(5, 1000)) }, 5, data: {value: AwardYear.start_trading_between(5, 1000, minmax: true, format: true), type: :range, identifier: "5 plus", default: true}, default: true end textarea :costs_change_desc, "Explain your direct unit or contract costs, highlighting any changes over the above periods (if applicable)." do From 6a0945a72a0d4bf17c05aa06a70c7156aeb6ffb9 Mon Sep 17 00:00:00 2001 From: DaniBitZesty <84323332+DaniBitZesty@users.noreply.github.com> Date: Thu, 7 Sep 2023 12:16:41 +0100 Subject: [PATCH 2/5] Accomodate NaN values in proportion calculations --- app/assets/javascripts/application.js.coffee | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/assets/javascripts/application.js.coffee b/app/assets/javascripts/application.js.coffee index b9f627ac93..91f0b5fcb6 100644 --- a/app/assets/javascripts/application.js.coffee +++ b/app/assets/javascripts/application.js.coffee @@ -459,6 +459,9 @@ jQuery -> referenceValue = parseFloat(referenceCell?.value) or 0 if type == 'disadvantaged' proportionInput?.value = ((referenceValue / colSums[cell.cellIndex]) * 100).toFixed(2) + if isNaN(parseFloat(proportionInput?.value)) + proportionInput?.value = "0" + else if type == 'others' proportionInput?.value = ( colSums[cell.cellIndex] / (colSums[cell.cellIndex] + referenceValue) * 100).toFixed(2) From d54fec8a0464f3ecfd54e885c3dfea386ebac5f1 Mon Sep 17 00:00:00 2001 From: Lubos Hricak Date: Thu, 7 Sep 2023 18:04:28 +0200 Subject: [PATCH 3/5] Add GH action to deploy to staging --- .github/workflows/deploy_staging.yml | 42 ++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 .github/workflows/deploy_staging.yml diff --git a/.github/workflows/deploy_staging.yml b/.github/workflows/deploy_staging.yml new file mode 100644 index 0000000000..94fb403155 --- /dev/null +++ b/.github/workflows/deploy_staging.yml @@ -0,0 +1,42 @@ +name: 'Staging deployment' +on: [workflow_dispatch] +jobs: + deploy_staging: + if: github.ref == 'refs/heads/staging' + runs-on: ubuntu-latest + strategy: + max-parallel: 1 + steps: + - uses: actions/checkout@v2 + - uses: actions/cache@v2 + with: + path: vendor/bundle + key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} + restore-keys: | + ${{ runner.os }}-gems- + - name: Setup Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: 2.7.7 + - uses: actions/setup-node@v2-beta + with: + node-version: '16' + - name: 'Deploy staging' + env: + name: staging + url: 'https://staging.queens-awards-enterprise.service.gov.uk/' + CF_ENDPOINT: 'api.london.cloud.service.gov.uk' + CF_SPACE: staging + CF_APP: qae-staging + CF_USER: ${{ secrets.CF_USER }} + CF_PASSWORD: ${{ secrets.CF_PASSWORD }} + CF_ORG: ${{ secrets.CF_ORG }} + SLACK_CHANNEL: ${{ secrets.SLACK_CHANNEL }} + SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} + run: | + curl -v -L -o cf-cli_amd64.deb 'https://cli.run.pivotal.io/stable?release=debian64&source=github' + sudo dpkg -i cf-cli_amd64.deb + cf -v + cf add-plugin-repo CF-Community https://plugins.cloudfoundry.org + cf install-plugin blue-green-deploy -r CF-Community -f + ./bin/deploy From 7f48f191af428d7c778d2feb59e5bcfdf9229a84 Mon Sep 17 00:00:00 2001 From: Lubos Hricak Date: Thu, 7 Sep 2023 18:56:26 +0200 Subject: [PATCH 4/5] Use proportional fix everywhere --- app/assets/javascripts/application.js.coffee | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/application.js.coffee b/app/assets/javascripts/application.js.coffee index 91f0b5fcb6..85341422fa 100644 --- a/app/assets/javascripts/application.js.coffee +++ b/app/assets/javascripts/application.js.coffee @@ -459,11 +459,12 @@ jQuery -> referenceValue = parseFloat(referenceCell?.value) or 0 if type == 'disadvantaged' proportionInput?.value = ((referenceValue / colSums[cell.cellIndex]) * 100).toFixed(2) - if isNaN(parseFloat(proportionInput?.value)) - proportionInput?.value = "0" else if type == 'others' proportionInput?.value = ( colSums[cell.cellIndex] / (colSums[cell.cellIndex] + referenceValue) * 100).toFixed(2) + + if isNaN(parseFloat(proportionInput?.value)) + proportionInput?.value = "0" calculateRowsToExcludeFromBottom = (table, className) -> rows = table.querySelectorAll('tr'); From 89ec923d5c5eb051ddde7c4d988a19723d8712fe Mon Sep 17 00:00:00 2001 From: Lubos Hricak Date: Tue, 22 Aug 2023 23:23:28 +0200 Subject: [PATCH 5/5] Display help block only for trade applications --- .../_queen_award_applications_question.html.slim | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/views/qae_form/_queen_award_applications_question.html.slim b/app/views/qae_form/_queen_award_applications_question.html.slim index 2652bf49d6..8cc1ccf034 100644 --- a/app/views/qae_form/_queen_award_applications_question.html.slim +++ b/app/views/qae_form/_queen_award_applications_question.html.slim @@ -138,7 +138,9 @@ a.govuk-button.govuk-button--secondary.js-button-add.if-no-js-hide href="#" aria .question-block.help-block .govuk-form-group - p class="govuk-body govuk-!-font-weight-bold hide" id="current-holder" - | As you currently hold a King's Award for International Trade, you cannot apply for another Award. You may apply in future years but can only use one year's financial performance from your Award winning application. - p class="govuk-body govuk-!-font-weight-bold hide" id="recent-winner" - | As you currently hold a King's Award in International Trade, you can only apply for the Outstanding Achievement Award (3 years). + - if @form_answer.trade? + p[class="govuk-body govuk-!-font-weight-bold hide" id="current-holder"] + | As you currently hold a King's Award for International Trade, you cannot apply for another Award. You may apply in future years but can only use one year's financial performance from your Award winning application. + + p[class="govuk-body govuk-!-font-weight-bold hide" id="recent-winner"] + | As you currently hold a King's Award in International Trade, you can only apply for the Outstanding Achievement Award (3 years).