Y26 031 labware location report by retention instructions#5637
Y26 031 labware location report by retention instructions#5637
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #5637 +/- ##
===========================================
- Coverage 87.35% 87.31% -0.04%
===========================================
Files 1476 1476
Lines 33517 33523 +6
Branches 3549 3551 +2
===========================================
- Hits 29279 29272 -7
- Misses 4217 4230 +13
Partials 21 21
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Adds retention-instruction support to Location Reports so users can filter returned labware by retention instruction, while persisting the selected instructions on the report record.
Changes:
- Add
retention_instructions(serialized array) toLocationReportand persist it via a new DB column. - Extend the selection form + controller strong params to allow multi-select retention instructions.
- Filter selected labware by retention instruction and add an RSpec scenario for it.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| spec/models/location_report_spec.rb | Adds coverage for filtering by retention instruction. |
| db/schema.rb | Updates schema with the new location_reports.retention_instructions column. |
| db/migrate/20260325134057_add_retention_instructions_to_lcation_reports.rb | Introduces the migration adding the new column. |
| app/views/location_reports/_location_labware_selection_form.html.erb | Adds a multi-select retention instruction filter UI. |
| app/models/location_report/location_report_form.rb | Passes retention_instructions from the form into the model. |
| app/models/location_report.rb | Serializes retention_instructions and filters labware results accordingly. |
| app/controllers/location_reports_controller.rb | Permits retention_instructions as an array param. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
BenTopping
left a comment
There was a problem hiding this comment.
Couple questions about whether we need to support multiple retention_instructions.
N.B. Haven't tested locally.
…ntion-instructions
…ntion-instructions
…ntion-instructions
…ntion-instructions
…ntion-instructions
…ntion-instructions
StephenHulme
left a comment
There was a problem hiding this comment.
Looks good in general, but a couple comments and questions.
In the specs, why has plate_1_custom_metadatum changed to plate_1_retention_instruction?
| context 'with retention instructions' do | ||
| let(:start_date) { '2016-01-01 00:00:00' } | ||
| let(:end_date) { '2016-11-01 00:00:00' } | ||
| let(:retention_instructions) { %w[long_term_storage return_to_customer_after_2_years] } | ||
| # Only plate_1, plate_3, and tube_1 have retention instructions set | ||
| let(:expected_lines) do | ||
| [ | ||
| headers_line, | ||
| plt_1_line, | ||
| plt_3_line, | ||
| tube_1_line | ||
| ] | ||
| end | ||
|
|
||
| it_behaves_like 'a successful report' | ||
| end | ||
|
|
||
| context 'with multiple retention instruction filters' do | ||
| let(:start_date) { '2016-01-01 00:00:00' } | ||
| let(:end_date) { '2016-11-01 00:00:00' } | ||
| let(:retention_instructions) { %w[long_term_storage return_to_customer_after_2_years] } | ||
| let(:plate_3_retention_instruction) do | ||
| plate_3.update!(retention_instruction: :return_to_customer_after_2_years) | ||
| end | ||
| let(:plt_3_line) do | ||
| # rubocop:todo Layout/LineLength | ||
| "#{plate_3.machine_barcode},#{plate_3.human_barcode},#{plt_3_purpose},#{plt_3_created},#{plt_3_received_date},#{locn_prefix} - Shelf 3,LabWhere,#{retention_value_2},#{study_2.name},#{study_2.id},#{study_2_sponsor.name}" | ||
| # rubocop:enable Layout/LineLength | ||
| end | ||
| let(:expected_lines) do | ||
| [ | ||
| headers_line, | ||
| plt_1_line, | ||
| plt_3_line, | ||
| tube_1_line | ||
| ] | ||
| end | ||
|
|
||
| it_behaves_like 'a successful report' | ||
| end |
There was a problem hiding this comment.
It's difficult to look at these tests and clearly see: "ah, yes there are only the lines returned that are in 2-year storage", etc.
Would it be possible to rename/create labwares like plate_2_years, plate_longterm, tube_no_storage (in a before block or with let! - not let, since it is lazily evaluated)? Then refactor the tests to clearly show that when all the retention-instructed-labwares are created but only return-after-2-years is added in the filter, that only the return-after-2-years labwares are shown in the report?
Closes #
Changes proposed in this pull request
add retention instruction column in location report table
add filter by retention instruction on the return record
Instructions for Reviewers
[All PRs] - Confirm PR template filled
[Feature Branches] - Review code
[Production Merges to
main]- Check story numbers included
- Check for debug code
- Check version