Skip to content

Commit

Permalink
Update documentation about acmcsuf.com/lc-dailies (#52)
Browse files Browse the repository at this point in the history
* change handbook to represent latest changes

* run `deno task all`

Resolves <https://github.com/acmcsufoss/lc-dailies/pull/41/files/e9f43b15db1da390fa1d54747b07da653be53c35#r1360054079>.

* Update HANDBOOK.md

* add docs for subcommand `/lc unregister`

* add scoring section
  • Loading branch information
EthanThatOneKid authored Sep 21, 2024
1 parent 408af81 commit a41fab2
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 28 deletions.
78 changes: 50 additions & 28 deletions docs/HANDBOOK.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,49 @@
# Handbook

This brief handbook contains comprehensive knowledge needed to operate the `/lc`
slash command on the ACM CSUF Discord server.

## Table of contents

- [Seasons](#seasons)
- [`/lc` slash command](#lc-slash-command)
slash command on the ACM CSUF Discord server. Join the server at
<https://acmcsuf.com/discord>!

## Seasons

Seasons are week-long competitions that reset every Sunday at midnight UTC. The
goal of each season is for each player to submit an accepted solution to as many
of Leetcode's daily challenges as fast as possible.
Seasons are week-long competitions on LC-Dailies which reset every Sunday at
midnight UTC. The goal of each season is for each player to submit an accepted
solution to as many of Leetcode's daily challenges as fast as possible.

- The JSON API for our live season results is available at
- The live season results JSON API is available at
<https://lc-dailies.deno.dev/seasons/latest>.
- All seasons are available at <https://lc-dailies.deno.dev/seasons>.

## `/lc` slash command
## Submissions

Submissions are the accepted solutions to Leetcode's daily challenges that are
submitted by players during a season.

Submissions are automatically synced with Leetcode's API every 15 minutes.

## Scoring

The scoring system for our weekly competitions is based on the time it takes for
the player to submit an accepted solution to Leetcode's daily challenges. A
player's total season score is the sum of their daily scores for each day of the
season.

The following is a representation of the submission scoring algorithm
implemented by function `calculateSubmissionScore`, located in file
`lib/leaderboard/scores.ts`.

```ts
const score =
(1 - Math.min(Math.max(msElapsed / msAllotted, 0), 1)) * (hi - lo) + lo;
```

## Slash command

Slash commands are a way to integrate custom logic into Discord servers. In our
case, the `/lc` slash command is used to register your Leetcode username and
submit your solutions to Leetcode's daily challenges.

### `/lc` slash command

The `/lc` slash command is a Discord application command that allows members of
the ACM CSUF Discord server to participate in weekly Leetcode competitions that
Expand All @@ -34,17 +59,6 @@ This tool takes advantage of Discord's permissions system to elevate the
security of `/lc`, allowing only verified members of the ACM CSUF Discord server
to play in our automated weekly competitions.

### Operate with confidence

The software is a
[Discord slash command](https://discord.com/developers/docs/interactions/application-commands).
All that is required to use the tool is a Discord account with the `Verified`
role on the [ACM CSUF Discord server](https://acmcsuf.com/discord).

- This slash command is only available to members with the `Verified` role.
- This slash command is available in the `📚algo-chat` text channel of the
[ACM CSUF Discord server](https://acmcsuf.com/discord).

### Register your Leetcode username

Associate your Leetcode username with your Discord account to participate in our
Expand All @@ -53,10 +67,21 @@ weekly competitions.
- Type `/lc register` in the `📚algo-chat` text channel to use the slash
command.
- Populate the required field `lc_username` with your Leetcode username.
- Press <kbd>Enter</kbd> to submit the registration.
- Press <kbd>Enter</kbd> to submit the registration command.
- Wait for the response from the slash command to confirm the registration. This
may take a second.

### Unregister your Leetcode username

Disassociate your Leetcode username with your Discord account to stop
participating in our weekly competitions.

- Type `/lc unregister` in the `📚algo-chat` text channel to use the slash
command.
- Press <kbd>Enter</kbd> to submit the unregistration command.
- Wait for the response from the slash command to confirm the unregistration.
This may take a second.

### Submit your Leetcode solution

Once you have registered your Leetcode username, you are ready to participate in
Expand All @@ -66,11 +91,8 @@ No further action is needed on your part to submit your Leetcode solutions. A
daily background process automatically syncs our stored leaderboard data with
the latest submissions data on Leetcode.

> **NOTE**
>
> Soon, our leaderboard will be visible on the ACM CSUF website at
> <https://acmcsuf.com/lc-dailies>. Follow issue
> [#36](https://github.com/acmcsufoss/lc-dailies/issues/36) for updates.
Our leaderboards are visible on the ACM at CSUF website at
<https://acmcsuf.com/lc-dailies>.

---

Expand Down
1 change: 1 addition & 0 deletions lib/api/dailies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ export function makeDailyWebhookEmbeds(
"```",
leaderboard.formatScores(options.season),
"```",
`View the leaderboard on [acmcsuf.com/lc-dailies/${options.season.id}](https://acmcsuf.com/lc-dailies/${options.season.id})!`,
].join("\n"),
});
}
Expand Down

0 comments on commit a41fab2

Please sign in to comment.