Skip to content

Commit

Permalink
PP-11877 review update
Browse files Browse the repository at this point in the history
  • Loading branch information
olatomgds committed Dec 15, 2023
1 parent bf66983 commit 755976c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 12 deletions.
9 changes: 3 additions & 6 deletions app/controllers/transactions/transaction-list.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,10 @@ module.exports = async function showTransactionList (req, res, next) {
filters: {},
}
let result

let transactionSearchResults = (filters.dateRangeState.isInvalidDateRange) ?
noTransactionSearchResults : transactionService.search([accountId], filters.result)
try {
result = await Promise.all([
(filters.dateRangeState.isInvalidDateRange) ?
noTransactionSearchResults : transactionService.search([accountId], filters.result) ,
client.getAllCardTypes()
])
result = await Promise.all([ transactionSearchResults, client.getAllCardTypes() ])
} catch (error) {
return next(error)
}
Expand Down
4 changes: 2 additions & 2 deletions app/utils/filters.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ function trimFilterValues (filters) {
}

function validateDateRange(filters){
let result = moment(filters.fromDate, 'DD/MM/YYYY').isAfter(moment(filters.toDate, 'DD/MM/YYYY'))? 1: -1;
var isInvalid = false
const result = moment(filters.fromDate, 'DD/MM/YYYY').isAfter(moment(filters.toDate, 'DD/MM/YYYY'))? 1: -1;
let isInvalid = false

if (result === 1) {
isInvalid = true
Expand Down
8 changes: 4 additions & 4 deletions app/views/transactions/index.njk
Original file line number Diff line number Diff line change
Expand Up @@ -65,19 +65,19 @@

{% include "transactions/display-size.njk" %}

<h3 class="govuk-heading-s govuk-!-font-weight-regular govuk-!-margin-top-3" id="total-results">
{% if (isInvalidDateRange) %}
<p class="govuk-body" id="invalid-date-range-1">End date must be after start date</p>
<p class="govuk-body" id="invalid-date-range-2">The from date entered is <span class="govuk-body govuk-!-font-weight-bold">{{fromDateParam}}</span> and the to date entered is <span class="govuk-body govuk-!-font-weight-bold">{{toDateParam}}</span> </p>
<p> End date must be after start date </p>
<p> The from date entered is <span class="govuk-body govuk-!-font-weight-bold">{{fromDateParam}}</span> and the to date entered is <span class="govuk-body govuk-!-font-weight-bold">{{toDateParam}}</span></p>
{% else %}
<h3 class="govuk-heading-s govuk-!-font-weight-regular govuk-!-margin-top-3" id="total-results">
{% if totalOverLimit %}
Over {{maxLimitFormatted}} transactions
{% else %}
{{totalFormatted}} transactions
{% endif %}
{{ filtersDescription | safe }}
</h3>
{% endif %}
</h3>

{% if allServiceTransactions or permissions.transactions_download_read %}

Expand Down

0 comments on commit 755976c

Please sign in to comment.