From 6bc5bcfd1a3004249cb54bbd4d9fcceebce0e15a Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Wed, 6 Aug 2025 02:41:00 +0800 Subject: [PATCH] :bug: Fix poll update --- DysonNetwork.Sphere/Poll/PollController.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/DysonNetwork.Sphere/Poll/PollController.cs b/DysonNetwork.Sphere/Poll/PollController.cs index bace2a7..84777cf 100644 --- a/DysonNetwork.Sphere/Poll/PollController.cs +++ b/DysonNetwork.Sphere/Poll/PollController.cs @@ -195,10 +195,12 @@ public class PollController(AppDatabase db, PollService polls, PublisherService // Update questions if provided if (request.Questions != null) { + var newQuestions = request.Questions.Select(q => q.ToQuestion()).ToList(); + db.AttachRange(newQuestions); // Remove existing questions poll.Questions.Clear(); // Add new questions - poll.Questions.AddRange(request.Questions.Select(q => q.ToQuestion())); + poll.Questions.AddRange(newQuestions); } polls.ValidatePoll(poll);