diff --git a/cutt/analysis.py b/cutt/analysis.py index 7266e34..cfb1601 100644 --- a/cutt/analysis.py +++ b/cutt/analysis.py @@ -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() )