From fd7b3c0450270fbe2917798800712269eeed418f Mon Sep 17 00:00:00 2001 From: Alan Cruikshanks Date: Tue, 8 Aug 2023 15:33:53 +0100 Subject: [PATCH] Include charge category in 2PT matching results (#343) https://eaflood.atlassian.net/browse/WATER-4046 One thing we are struggling with when checking the results from the endpoint is we cannot see the charge category, for example, **4.6.24**. This change updates the 2PT matching service to fetch the linked record so we can include it in the results. --- app/services/check/two-part.service.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/services/check/two-part.service.js b/app/services/check/two-part.service.js index cc171bc075..0d04c14f88 100644 --- a/app/services/check/two-part.service.js +++ b/app/services/check/two-part.service.js @@ -53,6 +53,13 @@ async function _fetchChargeVersions (billingPeriod, naldRegionId) { .modifyGraph('chargeVersions.chargeElements', (builder) => { builder.whereJsonPath('chargeElements.adjustments', '$.s127', '=', true) }) + .withGraphFetched('chargeElements.billingChargeCategory') + .modifyGraph('chargeElements.billingChargeCategory', (builder) => { + builder.select([ + 'reference', + 'shortDescription' + ]) + }) .withGraphFetched('chargeElements.chargePurposes.purposesUse') return chargeVersions