Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 19 additions & 12 deletions content/operations/events.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -327,18 +327,15 @@ their own time zone.
name", with the meeting and the server (never its password), **Signed up 8** ·
Not coming 1, and no teams, map or forum.
- **Sign-up replies** (visible only to the player who clicks; in a DM they
arrive as a normal message, in the clan's language too): **Sign up** opens "Where do you want to play?"
with each group, its count and, for a full group, "you'll go to the
reserves". Choosing a group saves the sign-up and the same card turns into
"Sign-up saved: Infantry" with **Change group** and **Can't make it**; **Edit
sign-up** returns that card. A full group keeps the sign-up as a reserve
without a group, a group that needs a Discord role names the group, the role
and where to ask for it, and closed sign-ups say when they closed. Every
refusal is a short reason and the next step.
A match with **Allow backup group choices** enabled instead opens an ordered
choice card. One group is enough; add alternatives if wanted, use **Change
order** for up/down/remove buttons, then **Save sign-up**. Full-group reserves
retain their preferences. See [match sign-ups](./matches#sign-ups).
arrive as a normal message, in the clan's language too): **Sign up** saves
your eligible primary group, falling back to the first eligible secondary group.
If none matches, **Not signed up - choose a group** requires a selection, which
saves immediately. The saved card says **No further action required** and offers
optional **Change group** and **Can't make it** actions. Full groups save as
reserves. With **Allow backup group choices**, Change group opens the optional
preference editor: add alternatives, use **Change order**, then **Save sign-up**
to apply edits. Abandoning or expiring the editor preserves the saved signup.
See [match sign-ups](./matches#sign-ups).
During registration, you can select the same group again or return to a
previously selected group, including on matches created before preferential
sign-ups were introduced. Normal and preferential saves acknowledge the click
Expand Down Expand Up @@ -555,3 +552,13 @@ delivery receipts still require that manual check.


The match **Sign-ups and attendance** tab includes players who have signed up but are not yet placed on the roster. It groups players by their membership for the match's game. **No response** includes unpaused members, recruits, reserves and mercenaries whose membership status is allowed for the match; shared matches use the local player audience. Players who already responded or have a roster placement are excluded. Required Discord-role restrictions may further limit who can sign up.


## Event-specific sign-up history

Match and training details include a **Sign-up history** tab. It stays inside
that event's detail and shows only activity recorded for that event. The tab has
a direct URL (`?tab=history`), and event names in the general sign-up activity feed
link to their corresponding event history. Switching back to **Overview** keeps
the same event and game context. History shows up to the latest 100 entries and
indicates when that limit is reached.
48 changes: 35 additions & 13 deletions content/operations/matches.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,19 @@ Switch on **Repeat every week** for a weekly series.

### Sign-ups

Clicking **Sign up** saves immediately using your offered, eligible primary group,
or the first eligible secondary group. If no assigned group matches, the bot says
**Not signed up - choose a group**. Choose one to save; no extra confirmation is
needed. A saved signup says **No further action required**. Clicking Sign up again
shows the saved signup without replacing your choices.

**Allow backup group choices** is off by default. Enable it to let players add
optional alternatives in preference order. In Discord, select a first group,
optionally **Add another group**, then **Save sign-up**. One group is enough.
**Change order** opens an editor with up/down and remove buttons; **Done** returns
to the choices before saving. Longer lists have pages. Edits are private and
expire after 15 minutes of inactivity; reopen the signup to start again.
optional alternatives in preference order. After signup, **Change group** opens
the optional preference editor. Use **Add another group** and **Change order**
for up/down/remove buttons; **Done** returns to the choices. Click **Save sign-up**
to apply edits. Longer lists have pages. Edits are private and expire after 15
minutes of inactivity. Closing the editor, expiration, or a bot restart preserves
the saved signup; only unsaved edits are lost. Late signups still require a reason.
A full first-choice group still starts the player in reserves, and their ordered
choices are retained for roster planning. Backup choices do not automatically
move players between groups when someone else signs up or withdraws.
Expand Down Expand Up @@ -307,14 +314,29 @@ attendance**.

## Sign-ups and attendance (manager)

The **Sign-ups and attendance** tab counts roster players who attended, were
excused or did not attend, reserves who attended, people who declined and
members who never answered. The table lists the roster players in squad order,
then the reserves, with their place, what they said before the match, their
attendance and the points it gives under the workspace's
[membership score rules](/wiki/configuration/members). Filters switch to the
people who declined or did not answer; **Sign-up history** opens the event's
sign-up activity.
The **Sign-ups and attendance** tab shows one table for everyone: signed-up
players (including those awaiting placement), explicit declines, and eligible
members without a recorded response. The three summary counts stay visible;
click a count or a filter to narrow the table, or choose **All responses**.
Membership groups have prominent headings and can be collapsed independently.
Collapsing or filtering does not change the summary counts.

The **Response** column is independent of roster placement and actual attendance.
Only a recorded **Not attending** response counts as a decline. The roster's
inferred not-attending bucket does not prove that a player declined. Someone
placed on a roster can still have no recorded sign-up response. An **Event reserve**
place is different from **Reserve member** membership.

Points are shown per player using the current Membership rules and scoring
eligibility. Before closing, they are **Projected points**; after closing, they
are **Points under current rules**, not a historical ledger. Players outside the
scored membership set and events closed without points show **Not scored**.
Expand **Scoring rules** to see the configured values; hover a point value for its
category. This screen does not change the existing scoring policy.

**Sign-up history** is a tab inside this match detail, with a direct link and
activity queried for this event only. The general sign-up activity feed also
links each event name to that event's history tab.

- **Attended** records manager-confirmed attendance on the roster, the same
status as **Confirmed** on the roster board.
Expand Down
11 changes: 11 additions & 0 deletions discord-bot/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -393,3 +393,14 @@ The application/ticket effect journal is an internal Discord lifecycle. There is
no new `/api/v1` write: an API key is not a substitute for the current Discord
thread/category authority used by recruitment and ticket commands. Dashboard/v1
membership writes continue to use the existing shared assignment commands.

## Immediate match signup

Discord Sign up saves the first eligible offered assignment (primary, then
secondary order), or requires a group selection that saves immediately.
Saved replies distinguish completed signup from a required selection and a full
group reserve. Optional ranked preference edits require Save sign-up; abandoning
them preserves the existing signup. Late signups still require a reason.
This is a Discord interaction convenience over the existing shared signup command.
Dashboard and v1 writers retain their explicit group/preference inputs and existing
authorization, capacity and late-signup rules; no new API operation is needed.
4 changes: 3 additions & 1 deletion discord-bot/src/events/interactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ export const matchAnnouncementInteractions: InteractionFeature = {
.stringSelect("ranked-signup:", (interaction) =>
handleRankedSignupInteraction(interaction, context)
)
.button("signup-picker:", handleEventSignupPickerInteraction)
.button("signup-picker:", (interaction) =>
handleEventSignupPickerInteraction(interaction, context)
)
.button("check-signup:", handleCheckSignupInteraction)
.button("signup:", (interaction) =>
handleEventButtonInteraction(interaction, context)
Expand Down
52 changes: 51 additions & 1 deletion discord-bot/src/interactions/event-buttons.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,57 @@ test("ranked Discord draft adds, reorders, removes and saves only on request", a
return activeClick
}
const options = { enqueueEventSync: () => {}, triggerPollSoon: () => {} }
// First signup is durable immediately, including primary/secondary fallback.
context.assignments = [
{ userId, primaryGroupId: "inf", secondaryGroupIds: ["tank"] },
]
await handleEventSignupPickerInteraction(
click(`signup-picker:event-1:${guildId}`) as ButtonInteraction
click(`signup-picker:event-1:${guildId}`) as ButtonInteraction,
options
)
assert.equal(mutations.at(-1)?.group, boardGroups[0].name)
assert.deepEqual(mutations.at(-1)?.signupPreferences, [boardGroups[0].name])
context.assignments[0].primaryGroupId = "unoffered"
await handleEventSignupPickerInteraction(
click(`signup-picker:event-1:${guildId}`) as ButtonInteraction,
options
)
assert.equal(mutations.at(-1)?.group, boardGroups[1].name)
context.assignments = []
const beforePicker = mutations.length
await handleEventSignupPickerInteraction(
click(`signup-picker:event-1:${guildId}`) as ButtonInteraction,
options
)
assert.equal(mutations.length, beforePicker)
assert.match(payloadText(replies.at(-1)), /Not signed up/)
await handleEventButtonInteraction(
click(`signup:event-1:select:${guildId}`, "inf"),
options
)
assert.equal(mutations.length, beforePicker + 1)
assert.match(payloadText(replies.at(-1)), /No further action required/)
context.event.participants = [
{
userId,
status: "attending",
group: boardGroups[0].name,
updatedAt: "2030-01-01T00:00:00.000Z",
},
]
const beforeRepeat = mutations.length
await handleEventSignupPickerInteraction(
click(`signup-picker:event-1:${guildId}`) as ButtonInteraction,
options
)
assert.equal(
mutations.length,
beforeRepeat,
"repeat signup preserves saved choices"
)
mutations.length = 0
await handleEventSignupPickerInteraction(
click(`signup-picker:event-1:${guildId}:edit`) as ButtonInteraction
)
function actionId(action: string) {
const match = payloadText(replies.at(-1)).match(
Expand All @@ -151,6 +200,7 @@ test("ranked Discord draft adds, reorders, removes and saves only on request", a
1,
"an expired or replayed editor never saves twice"
)
context.event.participants = []
// Legacy matches without the ranked setting may repeatedly choose any group.
delete context.event.allowRankedSignup
for (const groupId of ["tank", "tank", "inf", "inf", "tank"]) {
Expand Down
131 changes: 85 additions & 46 deletions discord-bot/src/interactions/event-buttons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -283,12 +283,14 @@ function pickerOptions(context: EventInteractionContext): SignupPickerOption[] {
* L1-88, L1-89). Who may not sign up at all reads why right away.
*/
export async function handleEventSignupPickerInteraction(
interaction: ButtonInteraction
interaction: ButtonInteraction,
handlers?: InteractionHandlerOptions
) {
const [, eventId, thirdPart, fourthPart] = interaction.customId.split(":")
// A legacy announcement's single signup button has an extra action
// segment (`signup:<event>:PRIMARY_GROUP:<guild>`).
const customIdGuildId = fourthPart ?? thirdPart
const editing = thirdPart !== SIGNUP_PRIMARY_GROUP && fourthPart === "edit"
const customIdGuildId = editing ? thirdPart : (fourthPart ?? thirdPart)
const context = await loadSignupContext(
interaction,
eventId ?? "",
Expand Down Expand Up @@ -321,14 +323,76 @@ export async function handleEventSignupPickerInteraction(
return
}
const choices = pickerOptions(context)
if (context.event.kind === "match" && context.event.allowRankedSignup) {
if (!editing && handlers) {
if (
context.event.participants.some(
(person) =>
person.userId === interaction.user.id &&
person.status === "attending"
)
) {
await handleCheckSignupInteraction(interaction)
return
}
const preferred = [
membership.assignment?.primaryGroupId,
...(membership.assignment?.secondaryGroupIds ?? []),
].find(
(id) =>
id &&
choices.some((choice) => choice.value === id) &&
resolveEventSignupSelection({
event: context.event,
groups: context.groups,
memberRoleIds: member
? [...member.roles.cache.keys()]
: null,
assignedGroupIds: membership.assignedGroupIds,
membershipStatus: membership.membershipStatus,
actionId: id,
labels: selectionLabels(context),
}).ok
)
if (preferred) {
const group = context.groups.find((item) => item.id === preferred)
if (group) {
await handleEventButtonInteraction(interaction, handlers, {
eventId: context.event.id,
guildId: context.event.guildId,
firstGroupId: preferred,
choices: context.event.allowRankedSignup
? [group.name]
: [],
})
return
}
}
}
if (
editing &&
context.event.participants.some(
(person) =>
person.userId === interaction.user.id &&
person.status === "attending"
) &&
context.event.kind === "match" &&
context.event.allowRankedSignup
) {
await openRankedSignup(interaction, context)
return
}
await replyToClicker(
interaction,
choices.length
? signupPickerView({ ...replyContext(context), options: choices })
? signupPickerView({
...replyContext(context),
options: choices,
signedUp: context.event.participants.some(
(person) =>
person.userId === interaction.user.id &&
person.status === "attending"
),
})
: signupNoGroupsView(replyContext(context).copy),
{ ...options, replaceCard: true }
)
Expand All @@ -347,20 +411,6 @@ function groupNameOf(
)
}

/** The first configured assignment that this match offers: primary, then secondary order. */
function preferredSignupGroupId(
context: EventInteractionContext,
assignment: ReturnType<typeof membershipOf>["assignment"]
) {
if (!assignment) return undefined
const offered = new Set(
context.event.signupGroupIds ?? context.groups.map((group) => group.id)
)
return [assignment.primaryGroupId, ...(assignment.secondaryGroupIds ?? [])]
.filter((groupId): groupId is string => Boolean(groupId))
.find((groupId) => offered.has(groupId))
}

/**
* "Upravit přihlášku": the saved sign-up with "Změnit skupinu" and "Nepřijdu",
* or, without one, "Přihlásit se" (L1-20, L1-92).
Expand Down Expand Up @@ -496,7 +546,7 @@ export async function handleEventButtonInteraction(
interaction.customId.split(":")
const eventId = ranked?.eventId ?? parsedEventId
const customIdGuildId = ranked?.guildId ?? parsedGuildId
let requestedGroupId =
const requestedGroupId =
ranked?.firstGroupId ??
(interaction.isStringSelectMenu()
? (interaction.values[0] ?? "")
Expand Down Expand Up @@ -533,6 +583,15 @@ export async function handleEventButtonInteraction(
return
}

if (
!ranked &&
interaction.isButton() &&
requestedGroupId === SIGNUP_PRIMARY_GROUP
) {
await handleEventSignupPickerInteraction(interaction, options)
return
}

const context = await loadSignupContext(
interaction,
eventId ?? "",
Expand Down Expand Up @@ -569,20 +628,6 @@ export async function handleEventButtonInteraction(
const member = await resolveInteractionMember(interaction, guild)
const membership = membershipOf(context, interaction.user.id)
const kit = { ...kitOptions(context), replaceCard: true }
if (
interaction.isButton() &&
requestedGroupId === SIGNUP_PRIMARY_GROUP
) {
const preferredGroupId = preferredSignupGroupId(
context,
membership.assignment
)
if (!preferredGroupId) {
await handleEventSignupPickerInteraction(interaction)
return
}
requestedGroupId = preferredGroupId
}
const resolved = resolveEventSignupSelection({
event: context.event,
groups: context.groups,
Expand All @@ -602,18 +647,6 @@ export async function handleEventButtonInteraction(
return
}

if (
!ranked &&
context.event.kind === "match" &&
context.event.allowRankedSignup &&
resolved.group &&
![SIGNUP_NOT_ATTENDING, SIGNUP_GENERAL, TRAINING_ATTEND].includes(
resolved.group
)
) {
await openRankedSignup(interaction, context, [resolved.group])
return
}
if (ranked) {
for (const name of ranked.choices) {
const group = context.groups.find((item) => item.name === name)
Expand Down Expand Up @@ -703,7 +736,13 @@ export async function handleEventButtonInteraction(
group: resolved.group,
signupPreferences: ranked?.choices.length
? ranked.choices
: undefined,
: context.event.allowRankedSignup &&
resolved.group &&
context.groups.some(
(group) => group.name === resolved.group
)
? [resolved.group]
: undefined,
lateSignupReason,
profile: {
name:
Expand Down
Loading
Loading