5
11
Fork
You've already forked tomato
1

Add public/admin notes to shift form/details #53

Merged
edwardloveall merged 3 commits from el-new-shift-info into main 2025年12月03日 19:33:57 +01:00

There's so much information to keep track of when handling volunteer logistics, including information specific to admins and some that should be shared with volunteers. For example, admins may want to let their coworkers know if a recipient has reached out about the quality of food on a specific shift, requested a volunteer not be on a shift, or sharing todos. Admins also want volunteers to know to:

  • leave food for afternoon shifts
  • drop off food at specific times
  • compost or not compost certain items
  • add Rapid Response teams for each shift for volunteers or GPC to contact.

Currently, Rootable has admin/public notes for locations, but not for specific shifts. We actually used to have this information in the robot (our previous tool) and migrated it to rootable, but was neither shown nor editable.

Now, each shift occurrence now has editable public notes.

The shift occurrence form is weird in the way it accepts data. It passes two hashes to the Updater, one of which contains shift event params. This is opposed to the rails convention of having a single params hash that a form renders. Instead, the form is a mishmash of form fields, hidden fields modified in the controller, and a react form.

To get everything working, this just puts another field on the page under the shift_events scope for public_notes. It's passed along to Updater to become eventable_attributes; attributes directly on the "eventable" object which is the ShiftEvent.

A more difficult technical challenge was ensuring users are still assigned to a shift after updating the shift with notes.

Assigning users into the future is tricky, because we merge them with the existing users. I chose to set shift event attributes to save public notes. However, user_ids were also in that attribute hash.

What could happen was:

  • merge users into future events
  • assign attributes to future events
    • this assigns things like public_notes, but...
    • it also destroys merged users and just keeps new ones

The solution I came up with is to strip user_ids from the attributes hash after we're done assigning it to the events.

We also decided that having both site notes and shift notes was confusing when they're both called Public Notes or Instructions. We opted to name them: Shift Notes (one for the whole shift) and Site Notes (one for each task).

There's so much information to keep track of when handling volunteer logistics, including information specific to admins and some that should be shared with volunteers. For example, admins may want to let their coworkers know if a recipient has reached out about the quality of food on a specific shift, requested a volunteer not be on a shift, or sharing todos. Admins also want volunteers to know to: * leave food for afternoon shifts * drop off food at specific times * compost or not compost certain items * add Rapid Response teams for each shift for volunteers or GPC to contact. Currently, Rootable has admin/public notes for locations, but not for specific shifts. We actually used to have this information in the robot (our previous tool) and migrated it to rootable, but was neither shown nor editable. Now, each shift occurrence now has editable public notes. The shift occurrence form is weird in the way it accepts data. It passes two hashes to the Updater, one of which contains shift event params. This is opposed to the rails convention of having a single params hash that a form renders. Instead, the form is a mishmash of form fields, hidden fields modified in the controller, and a react form. To get everything working, this just puts another field on the page under the `shift_events` scope for `public_notes`. It's passed along to `Updater` to become `eventable_attributes`; attributes directly on the "eventable" object which is the `ShiftEvent`. A more difficult technical challenge was ensuring users are still assigned to a shift after updating the shift with notes. Assigning users into the future is tricky, because we merge them with the existing users. I chose to set shift event attributes to save public notes. However, user_ids were also in that attribute hash. What could happen was: * merge users into future events * assign attributes to future events * this assigns things like public_notes, but... * it also destroys merged users and just keeps new ones The solution I came up with is to strip `user_ids` from the attributes hash after we're done assigning it to the events. We also decided that having both site notes and shift notes was confusing when they're both called Public Notes or Instructions. We opted to name them: Shift Notes (one for the whole shift) and Site Notes (one for each task).
edwardloveall changed target branch from el-occurrence-params to main 2025年12月01日 15:32:34 +01:00
edwardloveall force-pushed el-new-shift-info from cd8efa81bd
Some checks failed
Setup Successful
Jest Successful
Static Analysis Failed
RSpec Failed
to 2d47a745bb
Some checks failed
Setup Successful
Jest Successful
Static Analysis Successful
RSpec Failed
2025年12月02日 18:26:45 +01:00
Compare
@ -245,0 +244,4 @@
<Grid container item direction="column" xs={6}>
<div className="field">
{/* eslint-disable-next-line jsx-a11y/label-has-associated-control */}
<label htmlFor="public_notes">Shift Instructions</label>
First-time contributor
Copy link

Should this use the localization value from the translate file?

Should this use the localization value from the translate file?
Author
Owner
Copy link

Yes, thank you. Turns out there were no translations for this ShiftForm because it's outside the volunteer dashboard. So I set it up in bf31bf4.

Yes, thank you. Turns out there were no translations for this ShiftForm because it's outside the volunteer dashboard. So I set it up in bf31bf4.
First-time contributor
Copy link

Looks good to me!

Looks good to me!
edwardloveall force-pushed el-new-shift-info from bf31bf4e20
Some checks failed
Setup Successful
Jest Failed
Static Analysis Successful
RSpec Failed
to 68b39fcb53
Some checks failed
Setup Successful
Jest Successful
Static Analysis Successful
RSpec Failed
2025年12月03日 17:15:44 +01:00
Compare
Author
Owner
Copy link

Specs are flaky and pass locally

Specs are flaky and pass locally
edwardloveall deleted branch el-new-shift-info 2025年12月03日 19:33:58 +01:00
Sign in to join this conversation.
No reviewers
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
rootable/tomato!53
Reference in a new issue
rootable/tomato
No description provided.
Delete branch "el-new-shift-info"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?