Skip to content

Commit

Permalink
Make the WHERE clauses more explicit
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Cruikshanks committed Apr 20, 2023
1 parent 4cb1ea5 commit 1be03b0
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ async function _fetch (regionId, billingPeriod) {
'status'
])
.innerJoinRelated('licence')
.where('scheme', 'sroc')
.whereNotNull('invoiceAccountId')
.where('includeInSrocSupplementaryBilling', true)
.where('regionId', regionId)
.where('chargeVersions.scheme', 'sroc')
.whereNotNull('chargeVersions.invoiceAccountId')
.where('chargeVersions.startDate', '>=', billingPeriod.startDate)
.where('chargeVersions.startDate', '<=', billingPeriod.endDate)
.whereNot('chargeVersions.status', 'draft')
Expand Down

0 comments on commit 1be03b0

Please sign in to comment.