From beea88171810eb5baac8ef80ad94e31dc552bd86 Mon Sep 17 00:00:00 2001 From: sanchezvem Date: Mon, 23 Mar 2026 15:44:50 +0100 Subject: [PATCH] Change logic of vote --- BeReadyBackend/Endpoints/Groups/PatchVoteEndpoint.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/BeReadyBackend/Endpoints/Groups/PatchVoteEndpoint.cs b/BeReadyBackend/Endpoints/Groups/PatchVoteEndpoint.cs index 8eb8501..104f490 100644 --- a/BeReadyBackend/Endpoints/Groups/PatchVoteEndpoint.cs +++ b/BeReadyBackend/Endpoints/Groups/PatchVoteEndpoint.cs @@ -36,9 +36,15 @@ public class PatchVoteEndpoint(UserGroupsRepository userGroupsRepository, UserSe return; } - if (member.Group!.IsFinished) + if (member.Group!.StartedVote is not null && member.Group.StartedVote.Value.AddHours(member.Group.VoteDuration) > DateTime.Now) { - await Send.StringAsync("Ce défi est terminé", 400, cancellation: ct); + await Send.StringAsync("Le vote est terminé", 400, cancellation: ct); + return; + } + + if (member.Group!.StartedVote is null) + { + await Send.StringAsync("Le vote n'a pas commencé", 400, cancellation: ct); return; }