Skip to content

Record who checked an aliquot out; Checked out by me filter; no-owner report - #202

Merged
olsonjp merged 4 commits into
mainfrom
checked-out-by-and-no-owner-report
Nov 11, 2026
Merged

olsonjp merged 4 commits into
mainfrom
checked-out-by-and-no-owner-report

Conversation

@olsonjp

@olsonjp olsonjp commented Nov 11, 2026 •

Copy link
Copy Markdown
Owner

Closes #192

What it does

  • Records who and when. Check Out saves the signed-in user and the time on the aliquot (checked_out_by, checked_out_at; migration 0008, both nullable, no backfill).
  • Kept after use. The lab uses a checked-out aliquot and discards it, and never re-stores it. So nothing clears the owner and time when the aliquot becomes Exhausted. They stay as a record of who used it. Both aliquot pages show a "Checked out by" row when one is recorded.
  • Per-person list. The Aliquots list has a Checked out by me toggle pill (/samples/list/?type=aliquot&checked_out_by=me). It shows the signed-in user's In Use aliquots, shows their count on the pill, and adds a Checked Out time column. The list already has sample, type and passage.
  • Toggle pills. Hide exhausted (from Aliquots list: passage, sample date, search all fields, hide exhausted #200) and Checked out by me are now pills under the search bar, replacing the boxed checkbox and their chips: outlined when off, filled with a check when on. Each is a link that flips its own parameter, keeps the other filters, and returns to page 1; no JS. Each carries its state in its aria-label, and the Search button now has one. The count text is singular for one result ("1 aliquot found"). The parameter name stays hide_finished.
  • No-owner report. Reports > Checked Out, No Owner lists In Use aliquots with no recorded owner: older checkouts, or ones set to In Use by hand. In the dump I looked at, that is about 587 aliquots. The page says they are mostly aliquots used long ago and never marked Exhausted, so it is a cleanup list. Documented in reports/README.md.
  • Clearing the no-owner list. Lab managers and admins can tick rows (select-all covers the current page, 50 rows), pick a status and press Apply, with a confirmation. The statuses are every status except Stored and In Use (the Exhausted and Disposed types), since a checked-out aliquot is never re-stored. Only aliquots still In Use with no owner are changed, so a stale page cannot overwrite a later edit; skipped rows are counted in the message. Each change is written to the audit log as aliquot_updated. Other roles get no tick boxes and a 403 if they post directly. It works on the page's 50 rows at a time; select-all across pages is not included.

How I read the ambiguous parts

  • "Who checked it out" is the person who clicked Check Out. If someone can check out for a colleague, that needs a follow-up.
  • "Currently checked out" is disposition In Use and an owner set.
  • Existing In Use aliquots show in the no-owner report (the issue suggested "Unknown").

Not in this PR (agreed split)

The Dashboard card for your checked-out aliquots, Create child prefill, a Done action, a Check out button on Find Aliquot results, and a manager tile come in later PRs. This PR only makes the data and the filtered list available.

Verification

  • New tests: sample/tests/test_checked_out.py and reports/test_checked_out_no_owner.py. They cover recording on checkout, keeping owner and time after Exhausted, deleting the user, the detail-page rows, the filter (only my In Use aliquots, with search and sort, other values ignored), the pills (state, toggle links, count) and the report (only ownerless In Use, pagination, the Reports page link). Full suite: 596 tests, OK. makemigrations --check is clean.
  • Not checked: how it looks in a browser. I cannot see it; the author has looked at the filtered list, the pills and the report (including the status change) locally; the aliquot pages still need a look.
  • I applied the migration to my local SQLite database only.

🤖 Generated with Claude Code

olsonjp and others added 3 commits November 10, 2026 21:33
… report

Closes #192.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Replace the boxed checkbox and the filter chips for the two yes/no filters
with pills that are links toggling their query parameter. The checked-out
pill shows the user's In Use count. Singular count text; aria-label on Search.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…sposed

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@olsonjp
olsonjp merged commit 9d66065 into main Nov 11, 2026
1 check passed
@olsonjp
olsonjp deleted the checked-out-by-and-no-owner-report branch November 11, 2026 04:55
olsonjp added a commit that referenced this pull request Nov 11, 2026
#202 was squash-merged, so take main's version of its files.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
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.

Show each person the aliquots they currently have checked out

1 participant