Rename EventPoints.Cycle to EventPoints.QuarterName.
build_develop / build (push) Successful in 1m23s
build_develop / build (push) Successful in 1m23s
This commit is contained in:
Vendored
+1
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"cSpell.words": [
|
"cSpell.words": [
|
||||||
"aiofiles",
|
"aiofiles",
|
||||||
|
"autofilled",
|
||||||
"blurple",
|
"blurple",
|
||||||
"CLANLEADER",
|
"CLANLEADER",
|
||||||
"Dakiny",
|
"Dakiny",
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ class ViewCog(commands.Cog, name="View Commands"):
|
|||||||
with Session(engine) as session:
|
with Session(engine) as session:
|
||||||
if quarter_name:
|
if quarter_name:
|
||||||
ppdf = pd.read_sql_query(
|
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,
|
con=engine,
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
@@ -201,7 +201,7 @@ class ViewCog(commands.Cog, name="View Commands"):
|
|||||||
quarter_name (str): String to run autocomplete on.
|
quarter_name (str): String to run autocomplete on.
|
||||||
"""
|
"""
|
||||||
with Session(engine) as session:
|
with Session(engine) as session:
|
||||||
stmt = select(EventPoints.Cycle).distinct()
|
stmt = select(EventPoints.QuarterName).distinct()
|
||||||
quarters = session.scalars(stmt)
|
quarters = session.scalars(stmt)
|
||||||
|
|
||||||
# if empty compare string
|
# if empty compare string
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ CREATE TABLE Presences (
|
|||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE EventPoints (
|
CREATE TABLE EventPoints (
|
||||||
Cycle varchar(30) not null,
|
QuarterName varchar(30) not null,
|
||||||
UserId varchar(32) not null,
|
UserId varchar(32) not null,
|
||||||
DiscordMember boolean not null,
|
DiscordMember boolean not null,
|
||||||
Points int unsigned DEFAULT 0,
|
Points int unsigned DEFAULT 0,
|
||||||
|
|||||||
@@ -318,13 +318,13 @@ def record_event_points(config: DakinyConfig, users: Sequence[str], add_points:
|
|||||||
quarter_name = get_quarter_name(config)
|
quarter_name = get_quarter_name(config)
|
||||||
with Session(engine) as session:
|
with Session(engine) as session:
|
||||||
for user in users:
|
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)
|
points = session.scalar(stmt)
|
||||||
if points is None:
|
if points is None:
|
||||||
add_points = get_allowed_points(session, config.params.event_points_weekly_limit, user, add_points)
|
add_points = get_allowed_points(session, config.params.event_points_weekly_limit, user, add_points)
|
||||||
new_points = EventPoints(
|
new_points = EventPoints(
|
||||||
Cycle=quarter_name,
|
QuarterName=quarter_name,
|
||||||
UserId=user,
|
UserId=user,
|
||||||
DiscordMember=is_member,
|
DiscordMember=is_member,
|
||||||
Points=add_points,
|
Points=add_points,
|
||||||
|
|||||||
Reference in New Issue
Block a user