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

BugFix: Fix Sampling Information Cache #1495

Merged
merged 5 commits into from
Feb 12, 2025
Merged

BugFix: Fix Sampling Information Cache #1495

merged 5 commits into from
Feb 12, 2025

Conversation

NickPhura
Copy link
Collaborator

@NickPhura NickPhura commented Feb 11, 2025

Links to Jira Tickets

n/a

Description of Changes

Fixes the sampling information cache.

The sampling site, technique, and period columns in the observations data grid should now load records as expected, based on the correct site -> technique -> period record relationships.

Typing in the sites drop-down should filter the results as expected (fixed in previous PR).

  • Note: The technique search always returns all results regardless of what you enter. The findTechnique backend service/repo receives the keyword, it just doesn't do anything with it currently.
  • Note: The period search always returns all results regardless of what you enter. The keyword isn't even sent to the backend currently.

Dev Notes

The cache works by tracking 3 objects (for site, technique, period). Where the key is the primary ID, and the value is the respective autocomplete option.

There are 2 new index objects, which tracks a key against an array of ids.

  • site id -> technique id
  • site id + technique id -> period id

This way, the technique edit component can filter its drop-down options based on the site value provided (from the site datagrid value).
And the period edit component can filter its drop-down options based on both the site and technique values provided (based on their respective values in the datagrid state).

Testing Notes

Site column should search and filter as expected from an autocomplete field.

Technique column should show all valid techniques for the chosen site, or nothing if no site value has been selected.
If the site value changes, the technique value will be cleared.

Period column should show all valid periods for the chosen site + technique, or nothing if no site or technique values have been selected.
If the site or technique value changes, the period value will be cleared.

Copy link

codecov bot commented Feb 11, 2025

Codecov Report

Attention: Patch coverage is 70.58824% with 30 lines in your changes missing coverage. Please review.

Project coverage is 47.49%. Comparing base (5232bf6) to head (04b29a0).
Report is 1 commits behind head on dev.

Files with missing lines Patch % Lines
...mpling-information/useSamplingInformationCache.tsx 86.74% 3 Missing and 8 partials ⚠️
...ion/techniques/MethodTechniqueDataGridEditCell.tsx 0.00% 7 Missing ⚠️
...formation/periods/SamplePeriodDataGridEditCell.tsx 0.00% 6 Missing ⚠️
...g-information/sites/SampleSiteDataGridEditCell.tsx 0.00% 2 Missing ⚠️
...nitions/count/ObservationCountDataGridEditCell.tsx 0.00% 1 Missing ⚠️
...formation/periods/SamplePeriodDataGridViewCell.tsx 0.00% 1 Missing ⚠️
...g-information/sites/SampleSiteDataGridViewCell.tsx 0.00% 1 Missing ⚠️
...ion/techniques/MethodTechniqueDataGridViewCell.tsx 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #1495      +/-   ##
==========================================
+ Coverage   45.92%   47.49%   +1.57%     
==========================================
  Files         907      926      +19     
  Lines       23537    24018     +481     
  Branches     3492     3570      +78     
==========================================
+ Hits        10809    11407     +598     
+ Misses      12136    11991     -145     
- Partials      592      620      +28     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@NickPhura NickPhura changed the title BugFix: Fix sampling information cache. BugFix: Fix Sampling Information Cache Feb 11, 2025
mauberti-bc
mauberti-bc previously approved these changes Feb 12, 2025
Copy link
Collaborator

@mauberti-bc mauberti-bc left a comment

Choose a reason for hiding this comment

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

👍

MacQSL
MacQSL previously approved these changes Feb 12, 2025
Copy link
Collaborator

@MacQSL MacQSL left a comment

Choose a reason for hiding this comment

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

Skimmed the code and tested the UI LGTM

Add unit tests.
Copy link
Collaborator

@MacQSL MacQSL left a comment

Choose a reason for hiding this comment

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

👍🏼

@NickPhura NickPhura added the Ready For Review PR is ready for review label Feb 12, 2025
Copy link

@NickPhura NickPhura merged commit eb5bec7 into dev Feb 12, 2025
23 checks passed
@NickPhura NickPhura deleted the npTechDebt15 branch February 12, 2025 16:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Ready For Review PR is ready for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants