fix: don't show times of players not in the team

This commit is contained in:
julius 2025-05-25 21:13:28 +02:00
parent 62ba89c599
commit a4ea0dfc41
Signed by: julius
GPG Key ID: C80A63E6A5FD7092

View File

@ -320,10 +320,17 @@ def last_submissions(
):
times = {}
with Session(engine) as session:
player_ids = session.exec(
select(P.id)
.join(PlayerTeamLink)
.join(Team)
.where(Team.id == request.team_id, P.disabled == False)
).all()
for survey in [C, PT, R]:
subquery = (
select(survey.user, func.max(survey.time).label("latest"))
.where(survey.team == request.team_id)
.where(survey.user.in_(player_ids))
.group_by(survey.user)
.subquery()
)