Rename ParticipationPoints table to EventPoints
build_develop / build (push) Successful in 1m21s

This commit is contained in:
2024-05-19 11:52:25 -04:00
parent 29a6b000ac
commit bec6494697
4 changed files with 18 additions and 22 deletions
+5 -10
View File
@@ -8,12 +8,7 @@ from nextcord.ext import commands
from sqlalchemy import select
from sqlalchemy.orm import Session
from database_setup.sql_data_classes import (
ParticipationPoints,
Presences,
Votes,
engine,
)
from database_setup.sql_data_classes import EventPoints, Presences, Votes, engine
from utils import VoteType
@@ -48,14 +43,14 @@ class ViewCog(commands.Cog, name="View Commands"):
with Session(engine) as session:
if quarter_name:
df = pd.read_sql_query(
sql=session.query(ParticipationPoints)
.where(ParticipationPoints.Cycle.startswith(quarter_name))
sql=session.query(EventPoints)
.where(EventPoints.Cycle.startswith(quarter_name))
.statement,
con=engine,
)
else:
df = pd.read_sql_query(
sql=session.query(ParticipationPoints).statement,
sql=session.query(EventPoints).statement,
con=engine,
)
@@ -231,7 +226,7 @@ class ViewCog(commands.Cog, name="View Commands"):
"""
with Session(engine) as session:
stmt = select(ParticipationPoints.Cycle).distinct()
stmt = select(EventPoints.Cycle).distinct()
quarters = session.scalars(stmt)
# if empty compare string
+2 -1
View File
@@ -41,7 +41,7 @@ CREATE TABLE Presences (
Presence varchar(100) not null
);
CREATE TABLE ParticipationPoints (
CREATE TABLE EventPoints (
Cycle varchar(30) not null,
UserId varchar(32) not null,
DiscordMember boolean not null,
@@ -53,3 +53,4 @@ CREATE TABLE Messages (
Path varchar(100) PRIMARY KEY,
Id bigint unsigned not null
);
+1 -1
View File
@@ -15,7 +15,7 @@ Base.prepare(autoload_with=engine)
CouncilMembers = Base.classes.CouncilMembers
ElectionInformation = Base.classes.ElectionInformation
Messages = Base.classes.Messages
ParticipationPoints = Base.classes.ParticipationPoints
EventPoints = Base.classes.EventPoints
Presences = Base.classes.Presences
UserBirthday = Base.classes.UserBirthday
Votes = Base.classes.Votes
+9 -9
View File
@@ -14,8 +14,8 @@ from sqlalchemy.orm import Session
from config import DakinyConfig
from database_setup.sql_data_classes import (
CouncilMembers,
EventPoints,
Messages,
ParticipationPoints,
Votes,
engine,
)
@@ -333,14 +333,14 @@ def record_event_participation(config: DakinyConfig, users: list[str], is_member
with Session(engine) as session:
for user in users:
stmt = (
select(ParticipationPoints)
.where(ParticipationPoints.UserId == user)
.where(ParticipationPoints.Cycle == cycle)
select(EventPoints)
.where(EventPoints.UserId == user)
.where(EventPoints.Cycle == cycle)
)
points = session.scalar(stmt)
if points is None:
new_points = ParticipationPoints(
new_points = EventPoints(
Cycle=cycle,
UserId=user,
DiscordMember=is_member,
@@ -366,14 +366,14 @@ def record_event_host(config: DakinyConfig, user: int):
host_point_value = config.params.event_host_points
with Session(engine) as session:
stmt = (
select(ParticipationPoints)
.where(ParticipationPoints.UserId == str(user))
.where(ParticipationPoints.Cycle == cycle)
select(EventPoints)
.where(EventPoints.UserId == str(user))
.where(EventPoints.Cycle == cycle)
)
points = session.scalar(stmt)
if points is None:
new_points = ParticipationPoints(
new_points = EventPoints(
Cycle=cycle,
UserId=str(user),
DiscordMember=True,