-
Notifications
You must be signed in to change notification settings - Fork 29
Coc as a timestamp #429
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Coc as a timestamp #429
Changes from all commits
55a121c
613d116
eae16a1
588ecd5
9cf28d7
2da0a8e
3666f73
10ef399
bde502e
79d3fab
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| class AddCocAgreedAtToParticipants < ActiveRecord::Migration[7.2] | ||
| def change | ||
| add_column :participants, :coc_agreed_at, :datetime | ||
| end | ||
| end |
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggestion: This should be a db migration, not a rake task. We should avoid writing raw SQL wherever possible, and use active record instead (as long as it's reasonably performant). See this migration as an example (not the same, but similar idea): https://github.com/minnestar/sessionizer/blob/main/db/migrate/20260319035803_backfill_event_categories.rb
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. agree that it should be a migration. I'm still getting the rust off of my "this is the RoR" way of doing things and this is the correct approach. I'll see about doing it all in active record. The main issue here is that there isn't any easy/idiomatic way to do it efficiently. I'll do the following:
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| class BackfillCocAgreedAt < ActiveRecord::Migration[7.2] | ||
| def up | ||
| Participant.where(coc_agreed_at: nil).find_each do |participant| | ||
| aggreement = CodeOfConductAgreement.where(participant_id: participant.id) | ||
| .order(created_at: :desc).first | ||
| participant.update_column(:coc_agreed_at, aggreement.created_at) if aggreement | ||
| end | ||
| end | ||
|
|
||
| def down | ||
| Participant.update_all(coc_agreed_at: nil) | ||
| end | ||
| end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Testing this locally made me realize that there are four places on the front-end where we currently show the CoC checkbox:
newandedit)newandedit, via theformpartial)With this change, we should be sure to update the front-end views accordingly to make sure we're capturing CoC agreements correctly and in the right places.
After running through all four scenarios locally, I think they're still working as expected. I don't think showing a checked checkbox that's also disabled, along with a link to the CoC, whenever a user is creating or editing a session, or editing their own profile hurts anything. It's a nice reminder that we have a CoC and expect attendees & presenters to follow it.
And it's also still worth including the checkbox in all 4 places because we already have existing users in the system who haven't necessarily accepted the CoC yet.
Sorry this is a bit of a word salad, but the TLDR is that the way we're currently presenting CoC checkboxes in the front-end seems like it'll still work with these changes. But I had to walk through each scenario locally and say it all out loud before it made sense to me 🙃