Skip to content

Integrate InvitationLogger for event invitation sending #2760

Description

@mroderick

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions