Skip to content

Record when a request was last approved or denied (last_action_at) - #635

Open
superconductor-for-github[bot] wants to merge 1 commit into
mainfrom
cycomachead/301-request-last-action-at
Open

superconductor-for-github[bot] wants to merge 1 commit into
mainfrom
cycomachead/301-request-last-action-at

Conversation

@superconductor-for-github

Copy link
Copy Markdown

Part 2 of 3 split out of #633. Independent of the other two parts: it branches from main and can merge in any order.

General Info

  • Breaking?

Changes

Adds requests.last_action_at: when the request was last approved or denied.

  • Stamped by a before_save whenever the status changes, so every path that approves or denies a request sets it.
  • The migration backfills it from updated_at for requests that are already decided.
  • updated_at was standing in for "approved/denied on", but it also moves on unrelated writes. These now use the new timestamp (via Request#decided_at):
    • the status column of the staff requests table and its export string,
    • the "Approved/Denied on … by …" line on the request page,
    • the pending-requests digest's count of recent auto-approvals.

A failed approval attempt does not move the timestamp; only an actual status change does.

Merge note: this PR and the action-log PR each add a migration, so whichever merges second will conflict in db/schema.rb (the version line and the new column). Re-running bin/rails db:migrate resolves it. No other files conflict.

Testing

  • RSpec: 877 examples, 0 failures. RuboCop clean.
  • New specs cover stamping on approve/deny, not moving on unrelated edits or failed approvals, moving when a decision is reversed, the export string, and the digest count.

Documentation

None needed.

Checklist

  • Name of branch corresponds to story

🤖 Generated with Claude Code

Adds requests.last_action_at, stamped whenever a request's status changes
and backfilled from updated_at for requests that are already decided.

updated_at was standing in for "when was this approved/denied", but it also
moves on unrelated writes. The staff requests table, the request page, the
status export string, and the digest's auto-approval count now use the new
timestamp instead.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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