Skip to content

Commit

Permalink
Fix review licence page (#902)
Browse files Browse the repository at this point in the history
https://eaflood.atlassian.net/browse/WATER-4219

Following from the testing of the above ticket, two issues with the page was discovered. The first being where we are meant to display the charge reference billable volume this is actually displaying the charge elements and the second issue being a piece of text missing at the top of the page. This PR is to fix those issues.
  • Loading branch information
Beckyrose200 authored Apr 16, 2024
1 parent 5e0873f commit 2fcf993
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ function go (billRun, licence, markProgress) {
licenceHolder: licence[0].licenceHolder,
progress: licence[0].progress
},
elementsInReview: licence[0].hasReviewStatus,
licenceUpdated: _licenceUpdated(markProgress),
matchedReturns: _matchedReturns(licence[0].reviewReturns),
unmatchedReturns: _unmatchedReturns(licence[0].reviewReturns),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,24 @@ async function _fetchBillRun (billRunId) {

async function _fetchReviewLicence (licenceId, billRunId) {
return ReviewLicenceModel.query()
.select(
'id',
'billRunId',
'licenceId',
'licenceRef',
'licenceHolder',
'issues',
'status',
'progress',
ReviewLicenceModel.raw(`
EXISTS (SELECT 1
FROM review_charge_elements rce
INNER JOIN review_charge_references rcr ON rce.review_charge_reference_id = rcr.id
INNER JOIN review_charge_versions rcv ON rcr.review_charge_version_id = rcv.id
WHERE rce.status = 'review'
AND rcv.review_licence_id = review_licences.id) AS has_review_status
`)
)
.where('licenceId', licenceId)
.where('billRunId', billRunId)
.withGraphFetched('reviewReturns.reviewChargeElements')
Expand Down
10 changes: 5 additions & 5 deletions app/views/bill-runs/match-details.njk
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
{{ statusTag(chargeElement.status) }}
</p>

{# ------------- Licence nav bars --------------- #}
{# Licence nav bars #}
<ul class="govuk-summary-list__actions-list govuk-!-margin-bottom-3">
<li class="govuk-summary-list__actions-list-item"><a class="govuk-link govuk-!-font-weight-bold govuk-link--no-visited-state govuk-link--no-underline" href="/licences/{{ licenceId }}#summary">
Summary
Expand All @@ -45,7 +45,7 @@
<div class="govuk-caption-m"> Financial year {{ financialYear }}</div>
<h2 class="govuk-heading-m">Charge period {{ chargePeriod }}</h2>

{# ---------- Billable returns and volume ----------- #}
{# Billable returns and volume #}
<div class="govuk-grid-row">
<div class="govuk-grid-column-full">
<div class="govuk-!-margin-right-6 float-left">
Expand Down Expand Up @@ -92,7 +92,7 @@
</div>
</div>

{# ---------- Billable returns button ----------- #}
{# Billable returns button #}
<div class="govuk-grid-row govuk-!-margin-bottom-6">
<div class="govuk-grid-column-full">
{{ govukButton({
Expand All @@ -103,7 +103,7 @@
</div>


{# ------------- Matched Returns --------------- #}
{# Matched Returns #}
{% if matchedReturns.length > 0 %}
{% set tableRows = [] %}
{% for return in matchedReturns %}
Expand Down Expand Up @@ -182,7 +182,7 @@
}) }}
{% endif %}

{# ------------- No Returns --------------- #}
{# No Returns #}
{% if matchedReturns == 0 %}
<h2 class="govuk-heading-m">No two-part tariff returns</h2>
{% endif %}
Expand Down
9 changes: 9 additions & 0 deletions app/views/bill-runs/review-licence.njk
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
{% from "macros/review-status-tag.njk" import statusTag %}
{% from "govuk/components/summary-list/macro.njk" import govukSummaryList %}
{% from "govuk/components/table/macro.njk" import govukTable %}
{% from "govuk/components/inset-text/macro.njk" import govukInsetText %}


{% block breadcrumbs %}
{# Back link #}
Expand Down Expand Up @@ -51,6 +53,13 @@
</a></li>
</ul>

{# Licence in review text #}
{% if elementsInReview === true %}
{{ govukInsetText({
text: "There are elements in review"
}) }}
{% endif %}

{# Mark progress #}
{% if licence.progress %}
{% set progressButtonText = 'Remove progress mark' %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ describe('Review Licence presenter', () => {
licenceHolder: 'Licence Holder Ltd'
},
licenceUpdated: null,
elementsInReview: false,
matchedReturns: [
{
returnId: 'v1:1:01/60/28/3437:17061181:2022-04-01:2023-03-31',
Expand Down Expand Up @@ -235,6 +236,7 @@ function _licenceData () {
issues: '',
status: 'ready',
progress: false,
hasReviewStatus: false,
reviewReturns: [{
id: '2264f443-5c16-4ca9-8522-f63e2d4e38be',
reviewLicenceId: '78a99c1c-26d3-4163-ab58-084cd78594ab',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,8 @@ describe('Fetch Review Licence Results Service', () => {
licenceHolder: reviewLicence.licenceHolder,
issues: reviewLicence.issues,
status: reviewLicence.status,
createdAt: reviewLicence.createdAt,
updatedAt: reviewLicence.updatedAt,
progress: false,
hasReviewStatus: false,
reviewReturns: [{
id: reviewReturn.id,
reviewLicenceId: reviewReturn.reviewLicenceId,
Expand Down

0 comments on commit 2fcf993

Please sign in to comment.