Events are the only invitation type without InvitationLogger logging. Workshops and virtual workshops record batch progress to InvitationLog per member (success/failure/skipped, total count, batch status). Events don't. When a batch fails, tracking who received what requires manual correlation across DJ logs and email delivery logs.
Add the same logging pattern to InvitationManager#send_event_emails that already exists for workshops:
app/services/invitation_manager.rb
- Add
initiator_id param to send_event_emails
- Look up
Member from initiator_id; create InvitationLogger.new(event, initiator, audience, :invite)
- Call
logger.start_batch, finish_batch(total), fail_batch(e) — catch ActiveRecord::RecordNotUnique on start_batch to prevent duplicate batches
- Thread
logger through invite_students_to_event and invite_coaches_to_event so each member outcome is logged
Open question: events send to both Students and Coaches in one call. InvitationLogger expects a single audience. Use a combined audience value (e.g. everyone) or log two separate batches.
app/controllers/admin/events_controller.rb
- Pass
current_user.id to send_event_emails
Tests
- Add to
spec/services/invitation_manager_spec.rb or spec/services/invitation_manager_logging_spec.rb
Migration
None. InvitationLog#loggable is polymorphic and already accepts Event. InvitationLog#action enum supports invite. audience is a string column.
Context
- Workshop reference:
InvitationManager#send_workshop_emails (line ~46), invite_members, send_email_with_logging
InvitationLog fields: loggable (polymorphic), initiator (Member), chapter_id, audience, action, status, total_invitees, timestamps
Out of scope
send_meeting_emails — separate concern
Events are the only invitation type without
InvitationLoggerlogging. Workshops and virtual workshops record batch progress toInvitationLogper member (success/failure/skipped, total count, batch status). Events don't. When a batch fails, tracking who received what requires manual correlation across DJ logs and email delivery logs.Add the same logging pattern to
InvitationManager#send_event_emailsthat already exists for workshops:app/services/invitation_manager.rbinitiator_idparam tosend_event_emailsMemberfrominitiator_id; createInvitationLogger.new(event, initiator, audience, :invite)logger.start_batch,finish_batch(total),fail_batch(e)— catchActiveRecord::RecordNotUniqueonstart_batchto prevent duplicate batchesloggerthroughinvite_students_to_eventandinvite_coaches_to_eventso each member outcome is loggedOpen question: events send to both
StudentsandCoachesin one call.InvitationLoggerexpects a singleaudience. Use a combined audience value (e.g.everyone) or log two separate batches.app/controllers/admin/events_controller.rbcurrent_user.idtosend_event_emailsTests
spec/services/invitation_manager_spec.rborspec/services/invitation_manager_logging_spec.rbMigration
None.
InvitationLog#loggableis polymorphic and already acceptsEvent.InvitationLog#actionenum supportsinvite.audienceis a string column.Context
InvitationManager#send_workshop_emails(line ~46),invite_members,send_email_with_loggingInvitationLogfields:loggable(polymorphic),initiator(Member),chapter_id,audience,action,status,total_invitees, timestampsOut of scope
send_meeting_emails— separate concern