diff --git a/app/controllers/transactions/transaction-list.controller.js b/app/controllers/transactions/transaction-list.controller.js index acee1b47bd..396e3cfa03 100644 --- a/app/controllers/transactions/transaction-list.controller.js +++ b/app/controllers/transactions/transaction-list.controller.js @@ -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) } diff --git a/app/utils/filters.js b/app/utils/filters.js index e996c36ab5..0e912eb236 100644 --- a/app/utils/filters.js +++ b/app/utils/filters.js @@ -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 diff --git a/app/views/transactions/index.njk b/app/views/transactions/index.njk index d3a87dadd9..2345c43a72 100644 --- a/app/views/transactions/index.njk +++ b/app/views/transactions/index.njk @@ -65,19 +65,19 @@ {% include "transactions/display-size.njk" %} +
End date must be after start date
-The from date entered is {{fromDateParam}} and the to date entered is {{toDateParam}}
+End date must be after start date
+The from date entered is {{fromDateParam}} and the to date entered is {{toDateParam}}
{% else %} -