Skip to content

FSR-1564 | Stop duplicate rainfall totals being inserted#145

Open
LeeGordon83 wants to merge 4 commits intodevelopmentfrom
feature/FSR-1564-rainfall-tooltip-totals-double
Open

FSR-1564 | Stop duplicate rainfall totals being inserted#145
LeeGordon83 wants to merge 4 commits intodevelopmentfrom
feature/FSR-1564-rainfall-tooltip-totals-double

Conversation

@LeeGordon83
Copy link
Copy Markdown
Contributor

@LeeGordon83 LeeGordon83 commented Mar 20, 2026

To summarise:

  • Added an ON CONFLICT ... DO NOTHING clause to the INSERT INTO sls_telemetry_value_parent SQL query.

  • The conflict target is (station, region, COALESCE(qualifier, ''), start_timestamp, end_timestamp) scoped specifically to rainfall records

  • Added a guard after the parent insert in rloi.js : if res.rows[0] is falsy (i.e. the DO NOTHING path was taken and nothing was returned), the processing of child values for that parent is skipped entirely (increments processed counter and returns early).

  • Added further assertions to existing unit test to cover above

  • Updated readme.txt to instruct how to run floi test locally. I have included everything needed to test this locally including duplicate test data, test script, and local debug setup. This will be useful for testing but can maybe be removed at a later date.

  • Forced to refactor rloi.js as Sonar complained about complexity.

@sonarqubecloud
Copy link
Copy Markdown

@LeeGordon83 LeeGordon83 marked this pull request as ready for review March 23, 2026 16:59
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.

1 participant