Anonymous poll

This commit is contained in:
2025-09-07 23:22:34 +08:00
parent eaa3a9c297
commit fa01b7027a
6 changed files with 2204 additions and 4 deletions

View File

@@ -75,7 +75,7 @@ public class PollService(AppDatabase db, ICacheService cache)
var questionId = question.Id.ToString();
if (question.IsRequired && !answer.ContainsKey(questionId))
throw new Exception($"Missing required field: {question.Title}");
else if (!answer.ContainsKey(questionId))
if (!answer.ContainsKey(questionId))
continue;
switch (question.Type)
{
@@ -269,7 +269,7 @@ public class PollService(AppDatabase db, ICacheService cache)
await cache.SetWithGroupsAsync(
cacheKey,
stats,
new[] { PollCacheGroupPrefix + question.PollId },
[PollCacheGroupPrefix + question.PollId],
TimeSpan.FromHours(1));
return stats;