From e50ce2f51533de6a493f9d805d148f3fe5cf239c Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Wed, 6 Aug 2025 02:15:40 +0800 Subject: [PATCH] :bug: Trying to fix poll update --- DysonNetwork.Sphere/Poll/PollController.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/DysonNetwork.Sphere/Poll/PollController.cs b/DysonNetwork.Sphere/Poll/PollController.cs index d644fdc..bd5b042 100644 --- a/DysonNetwork.Sphere/Poll/PollController.cs +++ b/DysonNetwork.Sphere/Poll/PollController.cs @@ -199,14 +199,13 @@ public class PollController(AppDatabase db, PollService polls, PublisherService if (request.Questions != null) { // Remove existing questions - db.PollQuestions.RemoveRange(poll.Questions); + poll.Questions.Clear(); // Add new questions - poll.Questions = request.Questions.Select(q => q.ToQuestion()).ToList(); + poll.Questions.AddRange(request.Questions.Select(q => q.ToQuestion())); } polls.ValidatePoll(poll); - poll.UpdatedAt = SystemClock.Instance.GetCurrentInstant(); await db.SaveChangesAsync(); // Commit the transaction if all operations succeed @@ -271,4 +270,4 @@ public class PollController(AppDatabase db, PollService polls, PublisherService return StatusCode(500, "An error occurred while deleting the poll... " + ex.Message); } } -} \ No newline at end of file +}