Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 2PT query #331

Merged
merged 1 commit into from
Aug 2, 2023
Merged

Fix 2PT query #331

merged 1 commit into from
Aug 2, 2023

Conversation

Jozzey
Copy link
Contributor

@Jozzey Jozzey commented Aug 2, 2023

The query was checking the chargeElements.isSection127AgreementEnabled column to see if the charge version was a 2 Part Tarrif. This was the incorrect column, we should have been using the chargeVersions:chargeElements.adjustments column. This PR fixes that issue.

The query was checking the `chargeElements.isSection127AgreementEnabled` column to see if the charge version was a 2 Part Tarrif. This was the incorrect column, we should have been using the `chargeVersions:chargeElements.adjustments` column. This PR fixes that issue.
@Jozzey Jozzey added the bug Something isn't working label Aug 2, 2023
@Jozzey Jozzey requested review from Cruikshanks and StuAA78 August 2, 2023 15:52
@Jozzey Jozzey marked this pull request as ready for review August 2, 2023 15:52
@Jozzey Jozzey merged commit 861a00f into main Aug 2, 2023
@Jozzey Jozzey deleted the fix-tpt-query branch August 2, 2023 15:54
Cruikshanks added a commit that referenced this pull request Aug 3, 2023
When working on [Fix 2PT query](#331) we needed to update a where clause in an Objection query to use a JSONB field.

We'd done this a number of times in our tear down service and thought we had to use [Knex's raw()](https://knexjs.org/guide/raw.html). But we happened to see there was also a [whereRaw()](https://knexjs.org/guide/query-builder.html#whereraw) method and whilst on the page [whereJsonPath()](https://knexjs.org/guide/query-builder.html#wherejsonpath).

This avoids us having to drop down to `raw()` and is much more in keeping with our preference; first try Objection, then Knex, and only `raw()` if you really have to.

To keep things consistent, this updates our existing uses to use `whereJsonPath()`.
Cruikshanks added a commit that referenced this pull request Aug 3, 2023
When working on [Fix 2PT query](#331) we needed to update a where clause in an Objection query to use a JSONB field.

We'd done this a number of times in our tear down service and thought we had to use [Knex's raw()](https://knexjs.org/guide/raw.html). But we happened to see there was also a [whereRaw()](https://knexjs.org/guide/query-builder.html#whereraw) method and whilst on the page [whereJsonPath()](https://knexjs.org/guide/query-builder.html#wherejsonpath).

This avoids us having to drop down to `raw()` and is much more in keeping with our preference; first try Objection, then Knex, and only `raw()` if you really have to.

To keep things consistent, this updates our existing uses to use `whereJsonPath()`.
Cruikshanks added a commit that referenced this pull request Aug 3, 2023
When working on [Fix 2PT query](#331) we needed to update a where clause in an Objection query to use a JSONB field.

We'd done this a number of times in our tear-down service and thought we had to use [Knex's raw()](https://knexjs.org/guide/raw.html). But we happened to see there was also a [whereRaw()](https://knexjs.org/guide/query-builder.html#whereraw) method and whilst on the page [whereJsonPath()](https://knexjs.org/guide/query-builder.html#wherejsonpath).

This avoids us having to drop down to `raw()` and is much more in keeping with our preference; first try Objection, then Knex, and only `raw()` if you really have to.

To keep things consistent, this updates our existing uses to use `whereJsonPath()`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants