MAN-2761: GPS tagging by code#1538
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
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
codefields 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'] | ||
|
|
Comment on lines
+37
to
+38
| export const checkLocationMonitoringCode = (code: string | null | undefined): boolean | undefined => | ||
| GPS_TAGGING_CODES.includes(code) |
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) | ||
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.