I Completely disagree with this decision.

Remove the table for the original output
This commit is contained in:
2022-12-10 12:36:36 -06:00
parent fc2fe0a396
commit fd5f5a7e7a
6 changed files with 32 additions and 68 deletions

View File

@@ -6,8 +6,6 @@
import datetime
from beautifultable import BeautifulTable
from database.models import GameModel as Game, GuessModel as Guess
from game.base import BaseGameManager
from game.process_guess import ProcessGuess
@@ -84,33 +82,26 @@ class EndGameManager(BaseGameManager):
("Play closed!\n" + "However, there were not enough participants.")
)
message = "Closed this play! Here are the results:"
message += "\n```\n"
table = BeautifulTable()
table.column_headers = [
"PLAYER",
"GUESS",
"DIFFERENCE",
"POINTS GAINED",
"TOTAL POINTS",
]
message = (
"Closed this play! Here are the results\n"
+ "PLAYER | GUESS | DIFFERENCE | POINTS GAINED | TOTAL POINTS\n"
)
pitch_value = await self.update_pitch_value()
guess_processor = ProcessGuess(
game=self, pitch_value=pitch_value, message=table
game=self, pitch_value=pitch_value, message=message
)
(
table,
message,
closest_player_id,
furthest_player_id,
) = guess_processor.process_guesses()
message += str(table)
message += "\n```\n"
message += f"Congrats <@{closest_player_id}>! You were the closest!\n"
message += f"Sorry <@{furthest_player_id}>, you were way off\n"
message += (
f"\nCongrats <@{closest_player_id}>! You were the closest!\n"
+ f"Sorry <@{furthest_player_id}>, you were way off"
)
await self.message.channel.send(message)

View File

@@ -4,8 +4,6 @@
# pylint: disable=not-an-iterable,missing-module-docstring,too-few-public-methods
from beautifultable import BeautifulTable
from database.models import PlayerModel as Player
from game.base import BaseGameManager
@@ -25,23 +23,22 @@ class PointsManager(BaseGameManager):
message = (
"\nPlayers, who played recently, with their points highest to lowest\n\n"
)
message += "```\n"
table = BeautifulTable()
table.column_headers = ["Player", "Total Points", "Last Played"]
message += "Player | Total Points | Last Played\n"
players = Player.select(
Player.player_name, Player.total_points, Player.last_update
).order_by(Player.last_update.desc(), Player.total_points.desc())
for player in players:
table.rows.append([
player.player_name,
str(player.total_points),
str(player.last_update)[:-10],
])
message += str(table)
message += "\n```\n"
message += (
" | ".join(
[
player.player_name,
str(player.total_points),
str(player.last_update)[:-10],
]
)
+ "\n"
)
return await self.message.channel.send(message)

View File

@@ -134,15 +134,7 @@ class ProcessGuess:
self.update_difference_value()
self.update_player_total_points()
self.message.rows.append(
[
guess.player.player_name,
guess.guess,
difference,
difference_score,
guess.player.total_points + difference_score,
]
)
self.message += f"{guess.player.player_name} | {guess.guess} | {difference} | {difference_score} | {(guess.player.total_points + difference_score)}\n"
if guess.guess == winner:
closest_player_id = guess.player.player_id