Skip to content
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

feat: track + notify user signups #929

Merged
merged 16 commits into from
Jan 31, 2024

Conversation

sgfost
Copy link
Contributor

@sgfost sgfost commented Jan 24, 2024

Enable participants to sign up for specific launch time(s) while viewing the launch schedule in their tournament / player dashboard.

  • provide a visual indicator of number of total signups in that time slot
  • create toggle button UI to "signup" or "un-signup" for a specific TournamentRoundDate
  • build backend endpoints to do the data things on the backend to signup / unsignup
  • build backend schedule logic to send an email reminder to eligible signed up participants when the lobby opens (and a few minutes before the lobby closes?)
  • automated tests for backend logic
  • prevent players that have already participated from signing up
  • de-activate signups when a player has participated
  • come up with a better indicator for the amt of players signed up (configurable threshold)

resolves virtualcommons/planning#63
resolves virtualcommons/planning#66

alee and others added 7 commits January 23, 2024 20:13
part of a feature to keep track of users signing up for a specific
launch time and:

1. getting notified via email when the lobby is open + how many signups
   are there / signed in users (still tbd)
2. visual indicator of number of total signups in that time slot

refs virtualcommons/planning#63

Co-authored-by: Scott Foster <[email protected]>
Co-authored-by: Sabrina Nelson <[email protected]>
primary key constraints ensure that the same user cannot sign up for the
same date multiple times, otherwise we would need to check for this each
time
adds a new service method tournament.getTournamentRoundSchedule which
includes round date object ids, signup count, and whether the calling
user is signed up in addition to just the timestamps

when adding/removing a signup, this should be used to respond with
the updated schedule to update the client state
* adds endpoints for adding and removing a 'sign up' for a certain round
  date which return an updated schedule object with the current amount of
  signups and state for the requesting user

* adds a recurring job (at 30 min every hour) that checks for the
  existence of an upcoming round date and sends a reminder email to any
  players signed up for it
toggling checkbox makes the corresponding call (add/remove) to the
server and then updates based on the new schedule state that the server
responds with
currently works by showing a progress bar of the signup count over and
adjusted average
@sgfost
Copy link
Contributor Author

sgfost commented Jan 24, 2024

Added an 'interest level' bar which should roughly show how many people are signed up for any given time-slot. Do you think its clear enough what's going on here @sabrinanel3?

outdated

Screenshot from 2024-01-24 15-22-47

formalizing an assumption used in the implementation of launch reminders
* when retrieving signups for notification or counting for display, users
  with the "hasParticipated" flag in their invite are filtered out

* trying to sign up for an invite when you have already participated
  throws an error

* added signups 'popularity' threshold value to settings to use for
  diplaying interest level of each time-slot
still using a progress bar for ease of implementation but uses a
configurable value for the max in order to (hopefully) more accurately
indicate the likelihood that enough players are interested for a game to
start

color changes from orange to green when half of the threshold is met (5
for a full game if kept at the default 10)

* reword signup label and explanation
handle null invite and give toggles a unique id so that clicking on a
label toggles the correct one
* use one method with action param instead of two methods for the signup
  request

* move all of the toggle css into a new component
  - should refactor this a bit if we ever use it again, might make more
    sense to use <b-form-checkbox switch> but fix the css
Copy link
Member

@alee alee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, good work @sgfost! Will do a bit of minor refactoring and then merge.

googleInviteURL,
icsInviteURL,
});
}
return grouped;
}

async handleSignupClicked(launchTime: LaunchTime) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

toggleSignup might help convey the toggliness of this method more though I like handleSignupClicked perfectly fine as well.

How about

await this.api.setSignup(..., launchTime.isSignedUp);

This pushes the add|remove based on the value of the isSignedUp boolean logic into the API method and better encapsulates API endpoint specific things

return false;
}
const beforeOffset = state.tournamentStatus.lobbyOpenBeforeOffset;
const afterOffset = state.tournamentStatus.lobbyOpenAfterOffset;
const nextLaunchTime = state.tournamentStatus.currentRound.schedule[0];
const nextLaunchTime = state.tournamentRoundSchedule[0].timestamp;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could use this.nextLaunchTime(state) too? duplicates the tournamentRoundSchedule length check though

</div>
<p>
<small>
* We will send you an email reminder 30 minutes prior to launch. Signing up is not
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about shortening it to:

`Sign up for automated email reminders 30 minutes prior to launch and to help other players find good times to participate."

- rename to toggleSignup and have it perform toggly logic
- change addOrRemoveSignup to setSignup(boolean, ...) with conditional
  logic dispatching to the appropriate endpoint
@alee alee merged commit 81557d7 into virtualcommons:main Jan 31, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants