Skip to content

Commit

Permalink
it's b30/n20, for some reason
Browse files Browse the repository at this point in the history
  • Loading branch information
beer-psi committed Dec 12, 2024
1 parent b8690bc commit f55e490
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
23 changes: 10 additions & 13 deletions cogs/chunithm/records.py
Original file line number Diff line number Diff line change
Expand Up @@ -1099,8 +1099,8 @@ async def recent10(
mention_author=False,
)

@commands.hybrid_command("new10", aliases=["n10"])
async def new10(
@commands.hybrid_command("new20", aliases=["n10", "n15", "n20", "new10", "new15"])
async def new20(
self, ctx: Context, *, user: Optional[discord.User | discord.Member] = None
):
"""Calculate your rating in the new CHUNITHM VERSE system (latest version is
Expand Down Expand Up @@ -1159,25 +1159,22 @@ async def new10(
else Decimal(0)
)

new10 = new_records[:10]
new10_total = sum((item.extras[KEY_PLAY_RATING] for item in new10), Decimal(0))
new10_avg = (
floor_to_ndp(new10_total / len(new10), 4) if len(new10) > 0 else Decimal(0)
new20 = new_records[:20]
new20_total = sum((item.extras[KEY_PLAY_RATING] for item in new20), Decimal(0))
new20_avg = (
floor_to_ndp(new20_total / len(new20), 4) if len(new20) > 0 else Decimal(0)
)

content = (
f"**Best 30 average**: {best30_avg}\n"
f"**New 10 average**: {new10_avg}\n"
f"**Rating**: {floor_to_ndp((best30_total + new10_total) / 40, 2)}\n"
"*This is a prediction of the new rating system and does not reflect "
"the actual distribution between old/new in CHUNITHM VERSE. The bot will be "
"updated once the distribution is known.*"
f"**New 20 average**: {new20_avg}\n"
f"**Rating**: {floor_to_ndp((best30_total + new20_total) / 50, 2)}\n"
)

if len(new10) == 0:
if len(new20) == 0:
await message.edit(content=content, allowed_mentions=AllowedMentions.none())
else:
view = B30View(ctx, new10, show_reachable=False)
view = B30View(ctx, new20, show_reachable=False)
view.message = await message.edit(
content=content,
embeds=view.format_page(view.items[: view.per_page]),
Expand Down
1 change: 1 addition & 0 deletions utils/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@
"v2024.12": "Shattered Memories",
"v2024.12.1": "Shattered Memories",
"v2024.12.2": "Shattered Memories",
"v2024.12.3": "Shattered Memories",
}

0 comments on commit f55e490

Please sign in to comment.