Rename EventPoints.Cycle to EventPoints.QuarterName.
build_develop / build (push) Successful in 1m23s

This commit is contained in:
2024-09-03 11:42:20 -04:00
parent eb5102578d
commit 7e0ff1da18
4 changed files with 6 additions and 5 deletions
+1
View File
@@ -1,6 +1,7 @@
{
"cSpell.words": [
"aiofiles",
"autofilled",
"blurple",
"CLANLEADER",
"Dakiny",
+2 -2
View File
@@ -49,7 +49,7 @@ class ViewCog(commands.Cog, name="View Commands"):
with Session(engine) as session:
if quarter_name:
ppdf = pd.read_sql_query(
sql=session.query(EventPoints).where(EventPoints.Cycle.startswith(quarter_name)).statement,
sql=session.query(EventPoints).where(EventPoints.QuarterName.startswith(quarter_name)).statement,
con=engine,
)
else:
@@ -201,7 +201,7 @@ class ViewCog(commands.Cog, name="View Commands"):
quarter_name (str): String to run autocomplete on.
"""
with Session(engine) as session:
stmt = select(EventPoints.Cycle).distinct()
stmt = select(EventPoints.QuarterName).distinct()
quarters = session.scalars(stmt)
# if empty compare string
+1 -1
View File
@@ -42,7 +42,7 @@ CREATE TABLE Presences (
);
CREATE TABLE EventPoints (
Cycle varchar(30) not null,
QuarterName varchar(30) not null,
UserId varchar(32) not null,
DiscordMember boolean not null,
Points int unsigned DEFAULT 0,
+2 -2
View File
@@ -318,13 +318,13 @@ def record_event_points(config: DakinyConfig, users: Sequence[str], add_points:
quarter_name = get_quarter_name(config)
with Session(engine) as session:
for user in users:
stmt = select(EventPoints).where(EventPoints.UserId == user).where(EventPoints.Cycle == quarter_name)
stmt = select(EventPoints).where(EventPoints.UserId == user).where(EventPoints.QuarterName == quarter_name)
points = session.scalar(stmt)
if points is None:
add_points = get_allowed_points(session, config.params.event_points_weekly_limit, user, add_points)
new_points = EventPoints(
Cycle=quarter_name,
QuarterName=quarter_name,
UserId=user,
DiscordMember=is_member,
Points=add_points,