Change ElectionCycle class to Election. Change ElectionCycle column in database to ElectionName. Update some variables for clarification.

This commit is contained in:
2024-09-03 11:24:28 -04:00
parent 306e0d687a
commit eb5102578d
10 changed files with 71 additions and 79 deletions
+8 -8
View File
@@ -58,10 +58,10 @@ class NominateDMModal(nextcord.ui.Modal):
with Session(engine) as session:
# user already in table
cycle = get_election_name(self.config)
election_name = get_election_name(self.config)
stmt = (
select(CouncilMembers)
.where(CouncilMembers.ElectionCycle == cycle)
.where(CouncilMembers.ElectionName == election_name)
.where(CouncilMembers.MemberId == self.usr_id)
)
council_elect = session.scalar(stmt)
@@ -120,10 +120,10 @@ class NominateCLModal(nextcord.ui.Modal):
with Session(engine) as session:
# user already in table
cycle = get_election_name(self.config)
election_name = get_election_name(self.config)
stmt = (
select(CouncilMembers)
.where(CouncilMembers.ElectionCycle == cycle)
.where(CouncilMembers.ElectionName == election_name)
.where(CouncilMembers.MemberId == self.usr_id)
)
council_elect = session.scalar(stmt)
@@ -170,13 +170,13 @@ class NominateHighCouncilView(nextcord.ui.View):
)
return
cycle = get_election_name(self.config)
election_name = get_election_name(self.config)
usr_nominated = False
speech_content = ""
with Session(engine) as session:
stmt = (
select(CouncilMembers)
.where(CouncilMembers.ElectionCycle == cycle)
.where(CouncilMembers.ElectionName == election_name)
.where(CouncilMembers.MemberId == interaction.user.id)
)
obj = session.scalar(stmt)
@@ -215,13 +215,13 @@ class NominateHighCouncilView(nextcord.ui.View):
)
return
cycle = get_election_name(self.config)
election_name = get_election_name(self.config)
usr_nominated = False
speech_content = ""
with Session(engine) as session:
stmt = (
select(CouncilMembers)
.where(CouncilMembers.ElectionCycle == cycle)
.where(CouncilMembers.ElectionName == election_name)
.where(CouncilMembers.MemberId == interaction.user.id)
)
obj = session.scalar(stmt)