SPR-287 Reschedule Requests

https://spordle.atlassian.net/browse/SPR-287

This is to allow teams to request change to games and allow for an approval workflow.

Requirements

  • Teams can propose new dates/times/surfaces for any of their games

    • If allowed, leagues could disable this

  • Depending on configuration, the required parties (other team, league, association) will be notified and required to accept the change

    • This is configured on a per-office basis

  • Once all required parties have accepted the proposed change, the game is automatically rescheduled and everyone is notified (as normal)

Out of scope

  • Change fees

    • OMAHA won’t use this because they require games to fill out a form and pay a fee, so we’ll need transactions to convince them to use this (or a report?)

UX

  • Add a Propose Change button on the game page, if the game is allowed to be rescheduled.

    • This will pop up a modal to select the new time and surface. This can be toggled between a form or calendar

    • A comment may be provided. This would be included on the DraftGameApproval

  • If the game has any DraftGames, an card is shown on the game page to show game changes are proposed

    • The draft game row can be expanded to show the status of each required party (DraftGameApproval)

    • Clicking on Accept/Decline will open a modal to confirm and attach an optional note

      • This replaces the current Publish button when approvals are present

    • If the user is both a league admin and team official they would see multiple approval requests and would have to accept both individually

Models

Reschedule requests are stored as DraftGames, similar to producing a schedule. The API will automatically create DraftGameApprovals based on settings to determine who’s required to accept the change.

OfficeSettings

To configure who is required to approve game changes. Property names TBD.

Property

Type

Description

Property

Type

Description

rescheduleRequestsEnabled

boolean

Allow teams to request changes to games

requiredRescheduleApprovals

enum[]

List of approvals required for approval a draft game

  • Team Staff

  • Team Office

  • Schedule Office

If rescheduleRequestsEnabled is true, validation requires at least one value

DraftGameApproval

To track required approvals

Property

Type

Description

Property

Type

Description

draftGameId

uuid

Link to the DraftGame

targetType

string

Office/Team

targetId

id

 

status

string

Pending | Accepted | Declined

comment

string

Optional notes to append with the response

Implementation

  • Settings control which required parties require approval. Typical office defaults to schedule settings

  • Requesting a change produces a DraftGame. After save hook on DraftGame automatically produces DraftGameApprovals based on the office settings and if updatedGameId is present. Settings are based on the published game (a move to another schedule/teams requires the original schedule/teams to approve).

  • The DraftGame modal mentioned in UX would also apply to games produced by leagues through the draft flow. This modal should only be visible for required parties for approval with permission

  • A new permission scope (scheduling:approve) to be added, which allows responding to a DraftGameApproval

    • For the migration, grant it to any role that has scheduling:manage, scheduling:games, scheduling:drafts or teams:roster

  • A notification task that runs every 5 minutes should check for newly created DraftGameApprovals and send a notification

    • A new notification type for Draft Game Approvals to be created. By default (in the view) anyone with a scheduling:approve role has it enabled

    • DraftGame Target → Permission Target to determine who receives the notification

  • When a DraftGameApproval is changed to Accepted, check if all others are accepted. If so, publish the draft game to update the game

    • The standard game rescheduled notification covers this case already

  • If an approval is declined, the league is responsible for deleting the draft game

  • Scheduling changes to the draft game must reset any approvals