Skip to content

Commit 1be03b0

Browse files
committed
Make the WHERE clauses more explicit
We have shied away from adding the table name to the licence fields in the WHERE clauses on the basis if it works don't fix it. But by adding `chargeVersions.` to all the charge version based ones we hope to make it clearer where the source of each comes from.
1 parent 4cb1ea5 commit 1be03b0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Diff for: app/services/supplementary-billing/fetch-charge-versions.service.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ async function _fetch (regionId, billingPeriod) {
3636
'status'
3737
])
3838
.innerJoinRelated('licence')
39-
.where('scheme', 'sroc')
40-
.whereNotNull('invoiceAccountId')
4139
.where('includeInSrocSupplementaryBilling', true)
4240
.where('regionId', regionId)
41+
.where('chargeVersions.scheme', 'sroc')
42+
.whereNotNull('chargeVersions.invoiceAccountId')
4343
.where('chargeVersions.startDate', '>=', billingPeriod.startDate)
4444
.where('chargeVersions.startDate', '<=', billingPeriod.endDate)
4545
.whereNot('chargeVersions.status', 'draft')

0 commit comments

Comments
 (0)