Skip to content

Y26 031 labware location report by retention instructions#5637

Open
wendyyang wants to merge 27 commits intodevelopfrom
Y26-031---labware-location-report-by-retention-instructions
Open

Y26 031 labware location report by retention instructions#5637
wendyyang wants to merge 27 commits intodevelopfrom
Y26-031---labware-location-report-by-retention-instructions

Conversation

@wendyyang
Copy link
Copy Markdown
Contributor

@wendyyang wendyyang commented Mar 23, 2026

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

@wendyyang wendyyang linked an issue Mar 23, 2026 that may be closed by this pull request
3 tasks
@wendyyang wendyyang marked this pull request as ready for review March 27, 2026 09:08
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 27, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.31%. Comparing base (81d3a77) to head (9cc102e).

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              
Flag Coverage Δ
javascript 50.00% <ø> (ø)
ruby 87.33% <100.00%> (-0.05%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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) to LocationReport and 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.

Comment thread app/models/location_report.rb Outdated
Comment thread db/migrate/20260325134057_add_retention_instructions_to_lcation_reports.rb Outdated
Comment thread app/controllers/location_reports_controller.rb Outdated
Comment thread app/models/location_report.rb Outdated
@wendyyang wendyyang requested a review from KatyTaylor March 27, 2026 14:00
Copy link
Copy Markdown
Contributor

@BenTopping BenTopping left a comment

Choose a reason for hiding this comment

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

Couple questions about whether we need to support multiple retention_instructions.

N.B. Haven't tested locally.

Comment thread app/models/location_report.rb Outdated
Comment thread db/migrate/20260325134057_add_retention_instructions_to_location_reports.rb Outdated
Comment thread spec/models/location_report_spec.rb
Copy link
Copy Markdown
Contributor

@StephenHulme StephenHulme left a comment

Choose a reason for hiding this comment

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

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?

Comment thread app/controllers/location_reports_controller.rb
Comment on lines +454 to +493
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
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.

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?

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.

Y26-031 - Labware Location Report by Retention Instructions

4 participants