Record points in the command.
This commit is contained in:
@@ -357,22 +357,21 @@ def record_event_participation(config: DakinyConfig, users: list[str], is_member
|
||||
session.commit()
|
||||
|
||||
|
||||
def record_event_host(config: DakinyConfig, user: str, is_member: bool):
|
||||
def record_event_host(config: DakinyConfig, user: int):
|
||||
"""
|
||||
Adds host points to the given user. Checks if they don't exist in order to make a new entry, otherwise adds points
|
||||
to the existing value.
|
||||
|
||||
Args:
|
||||
config (DakinyConfig): Dakiny config for getting points
|
||||
user (str): User that hosted.
|
||||
is_member (bool): whether the user is a discord member or not
|
||||
user (int): Id of user that hosted.
|
||||
"""
|
||||
cycle = get_current_cycle(config)
|
||||
host_point_value = config.params.event_host_points
|
||||
with Session(engine) as session:
|
||||
stmt = (
|
||||
select(ParticipationPoints)
|
||||
.where(ParticipationPoints.UserId == user)
|
||||
.where(ParticipationPoints.UserId == str(user))
|
||||
.where(ParticipationPoints.Cycle == cycle)
|
||||
)
|
||||
|
||||
@@ -380,8 +379,8 @@ def record_event_host(config: DakinyConfig, user: str, is_member: bool):
|
||||
if points is None:
|
||||
new_points = ParticipationPoints(
|
||||
Cycle=cycle,
|
||||
UserId=user,
|
||||
DiscordMember=is_member,
|
||||
UserId=str(user),
|
||||
DiscordMember=True,
|
||||
Points=host_point_value,
|
||||
)
|
||||
session.add(new_points)
|
||||
|
||||
Reference in New Issue
Block a user