feat(levels): add levels leaderboard#406
Merged
ReenigneArcher merged 7 commits intomasterfrom Feb 15, 2026
Merged
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #406 +/- ##
==========================================
- Coverage 60.30% 59.51% -0.80%
==========================================
Files 21 24 +3
Lines 1164 1761 +597
==========================================
+ Hits 702 1048 +346
- Misses 462 713 +251
|
8780c06 to
984396a
Compare
984396a to
8942723
Compare
1 task
8942723 to
3bc5088
Compare
This comment was marked as resolved.
This comment was marked as resolved.
3bc5088 to
cafdc7e
Compare
cafdc7e to
9642ccc
Compare
9642ccc to
d8827de
Compare
Use `with self.db as db` and get table handles via `db.table(...)`; introduce `q = self.db.query()` for queries. Move `comment_data` construction to the correct scope, update comments via `comments_table.update(...)`, and preserve existing `bot_discord` when updating submissions. For submissions, perform update-and-return inside the DB context, and build/insert new `submission_data` (with default `bot_discord`) afterward. Overall tidies DB access and fixes update/insert logic for comments and submissions.
d8827de to
34df460
Compare
Add support for sending level-up messages to a designated Discord channel and introduce comprehensive unit tests. README and sample.env: document and expose DISCORD_LEVEL_UP_CHANNEL_ID. src/discord_bot/cogs/rank.py: import os and implement sending a Level Up embed to the channel defined by DISCORD_LEVEL_UP_CHANNEL_ID (if present), with error handling. tests/unit/common: add test_rank.py and test_rank_database.py to cover RankSystem and RankDatabase behaviors (XP awarding, cooldowns, level calculations, leaderboards, migrations, multi-community handling) using temporary DBs and mocks.
Enhance Rank tests to reliably clean up DB file handles and correct test expectations. Added gc and time imports and explicit tinydb.close()/gc.collect()/sleep to release file locks (esp. on Windows). Adjusted RankDatabase patching to return a real instance for temp DB usage and reformatted env_patch creation. Updated Reddit-related tests to patch globals.REDDIT_BOT and assert community_id from the mock subreddit. Corrected calculate_level/calculate_xp_for_level expectations to match the level = floor(sqrt(xp/100)) and xp = level^2 * 100 formulas. Also improved table existence checks by accessing tables and verifying they are empty.
3289ad9 to
ffb7abe
Compare
Add comprehensive unit tests for Database.sync covering git-related scenarios. Tests include: git enabled with no changes, git enabled with changes (commit & push), handling multiple JSON files, push failures, general git exceptions, behavior when GIT_ENABLED flag is false, no JSON files to add, changes cleared after git add, correct push URL construction with credentials, and ensuring _configure_repo is invoked. Tests use mocking for the repo, os.listdir, and the GIT_ENABLED flag to avoid performing real git operations.
ffb7abe to
36d296e
Compare
Update the migration-status print to explicitly mention Mee6 when skipping already-completed migrations. This provides clearer context in logs for why a guild's migration was skipped.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.




Description
This PR changes the following:
TODO:
tinydb.Queryis usedScreenshot
Issues Fixed or Closed
Type of Change
.github/...)Checklist