Skip to content

Commit

Permalink
surely this fixes tables
Browse files Browse the repository at this point in the history
  • Loading branch information
probablyjassin committed Feb 9, 2025
1 parent 6333bcf commit 761657e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cogs/mogi/calculations.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ async def collect(self, ctx: MogiApplicationContext):
)
# Store the date of the results
ctx.mogi.results_date = time.strftime("%d%m%y")
file = File(create_table(ctx.mogi), filename="table.png")
file = File(await create_table(ctx.mogi), filename="table.png")
message = await ctx.results_channel.send(
content=f"# Results - {time.strftime('%d.%m.%y')}", file=file
)
Expand Down
3 changes: 2 additions & 1 deletion cogs/profiles/leaderboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ async def leaderboard(

buffer = BytesIO()

dfi.export(
await dfi.export_async(
df.style.set_table_styles(
[
{
Expand Down Expand Up @@ -146,6 +146,7 @@ async def leaderboard(
).set_caption(f"Leaderboard sorted by {sort} | Page {page_index}"),
buffer,
dpi=200,
table_conversion="playwright_async",
)
buffer.seek(0)

Expand Down
5 changes: 3 additions & 2 deletions utils/maths/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from models.MogiModel import Mogi


def create_table(mogi: Mogi) -> BytesIO:
async def create_table(mogi: Mogi) -> BytesIO:

all_player_names = [player.name for player in mogi.players]
all_player_mmrs = [player.mmr for player in mogi.players]
Expand All @@ -34,7 +34,7 @@ def create_table(mogi: Mogi) -> BytesIO:
df = df.sort_values(by="Pos.", ascending=True)

buffer = BytesIO()
dfi.export(
await dfi.export_async(
df.style.set_table_styles(
[
{
Expand Down Expand Up @@ -82,6 +82,7 @@ def create_table(mogi: Mogi) -> BytesIO:
subset=["Change"],
),
buffer,
table_conversion="playwright_async",
)

buffer.seek(0)
Expand Down

0 comments on commit 761657e

Please sign in to comment.