Skip to content

MAN-2761: GPS tagging by code#1538

Merged
rav-moj merged 4 commits into
mainfrom
MAN-2761-gps-tagging-code
Jun 8, 2026
Merged

MAN-2761: GPS tagging by code#1538
rav-moj merged 4 commits into
mainfrom
MAN-2761-gps-tagging-code

Conversation

@rav-moj

@rav-moj rav-moj commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@rav-moj rav-moj changed the title MAN-2761: GPS tagging code MAN-2761: GPS tagging by code Jun 5, 2026
@Luca2471 Luca2471 requested a review from Copilot June 5, 2026 08:36

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates GPS tagging (“Location Monitoring”) detection to rely on structured requirement/licence condition codes (e.g. EM01, RM59) rather than string matching, and updates WireMock fixtures and Nunjucks templates accordingly so GPS data links can be shown based on those codes.

Changes:

  • Add code fields to relevant WireMock sentence/requirements/licence-condition fixtures.
  • Replace description string-matching with code-based checks (checkLocationMonitoringCode) in the sentence page template and Nunjucks setup.
  • Update middleware logic and tests to use code-based location monitoring detection; extend sentence model types to include code.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
wiremock/mappings/X778160-sentences.json Adds requirement/licence-condition code values for GPS tagging scenarios.
wiremock/mappings/X777916-sentence.json Adds code: EM01 to licence condition fixture.
wiremock/mappings/X000002-sentence.json Adds code: EM01 to licence condition fixture.
wiremock/mappings/X000001-sentences.json Adds code values for requirement and licence condition GPS tagging fixtures.
wiremock/mappings/X000001-sentence.json Adds code values for requirement/licence-condition GPS tagging fixtures.
server/views/pages/sentence.njk Switches GPS tagging UI logic from description matching to code matching via a filter.
server/utils/nunjucksSetup.ts Renames/rewires the Nunjucks filter from string-based to code-based.
server/middleware/postAppointments.test.ts Updates sentence mocks to include code fields to satisfy updated types.
server/middleware/checkLocationMonitoring.ts Implements code-based location monitoring detection and exposes a code-check helper.
server/middleware/checkLocationMonitoring.test.ts Updates/adjusts tests for code-based behaviour.
server/data/model/sentenceDetails.ts Extends Requirement and LicenceCondition types to include code.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +3 to +4
const GPS_TAGGING_CODES: string[] = ['RM59', 'EM01']

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addressed

Comment on lines +37 to +38
export const checkLocationMonitoringCode = (code: string | null | undefined): boolean | undefined =>
GPS_TAGGING_CODES.includes(code)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addressed

Comment on lines +77 to 84
describe('checkLocationMonitoringCode', () => {
it('should return true when code contains "EM01"', () => {
expect(checkLocationMonitoringCode('EM01')).toBe(true)
})

it('should be case-insensitive', () => {
expect(checkLocationMonitoringString('LOCATION MONITORING')).toBe(true)
expect(checkLocationMonitoringString('location monitoring')).toBe(true)
it('should return false when code does not contain "EM01"', () => {
expect(checkLocationMonitoringCode('RMXX')).toBe(false)
})

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addressed

@rav-moj rav-moj marked this pull request as ready for review June 8, 2026 11:13
@rav-moj rav-moj requested a review from a team as a code owner June 8, 2026 11:13

@AidanFilby Aidan Filby (AidanFilby) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@rav-moj rav-moj merged commit 07ea3aa into main Jun 8, 2026
13 checks passed
@rav-moj rav-moj deleted the MAN-2761-gps-tagging-code branch June 8, 2026 11:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants