Scale unique answer tracking
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
using MongoDB.Bson.Serialization.Attributes;
|
||||
|
||||
namespace QuestionsApi.Models;
|
||||
|
||||
public sealed class QuestionAttemptCounter
|
||||
{
|
||||
public string QuestionExternalId { get; set; } = "";
|
||||
public int Bucket { get; set; }
|
||||
public string ChoiceId { get; set; } = "";
|
||||
public long Count { get; set; }
|
||||
public DateTime UpdatedUtc { get; set; } = DateTime.UtcNow;
|
||||
}
|
||||
|
||||
public sealed class QuestionAttemptCounterTotal
|
||||
{
|
||||
[BsonId]
|
||||
public QuestionChoiceCounterKey Key { get; set; } = new();
|
||||
public long Count { get; set; }
|
||||
}
|
||||
|
||||
public sealed class QuestionAttemptCounterAggregate
|
||||
{
|
||||
[BsonId]
|
||||
public QuestionChoiceBucketKey Key { get; set; } = new();
|
||||
public long Count { get; set; }
|
||||
}
|
||||
|
||||
public sealed class QuestionChoiceBucketKey
|
||||
{
|
||||
public string QuestionExternalId { get; set; } = "";
|
||||
public int Bucket { get; set; }
|
||||
public string ChoiceId { get; set; } = "";
|
||||
}
|
||||
|
||||
public sealed class QuestionChoiceCounterKey
|
||||
{
|
||||
public string QuestionExternalId { get; set; } = "";
|
||||
public string ChoiceId { get; set; } = "";
|
||||
}
|
||||
|
||||
public sealed class AnswerStatisticsState
|
||||
{
|
||||
[BsonId]
|
||||
public string Id { get; set; } = "answer-statistics-v1";
|
||||
public bool Completed { get; set; }
|
||||
public string LeaseOwner { get; set; } = "";
|
||||
public DateTime LeaseUntilUtc { get; set; }
|
||||
public DateTime UpdatedUtc { get; set; } = DateTime.UtcNow;
|
||||
}
|
||||
@@ -14,5 +14,15 @@ public class QuestionAttempt
|
||||
public string ChoiceId { get; set; } = "";
|
||||
public bool IsCorrect { get; set; }
|
||||
public bool IsSkip { get; set; }
|
||||
public int CounterBucket { get; set; }
|
||||
public bool? RatingApplied { get; set; }
|
||||
public string RatingLeaseOwner { get; set; } = "";
|
||||
public DateTime RatingLeaseUntilUtc { get; set; }
|
||||
public DateTime CreatedUtc { get; set; } = DateTime.UtcNow;
|
||||
}
|
||||
|
||||
public sealed class QuestionAttemptRecordResult
|
||||
{
|
||||
public bool Inserted { get; set; }
|
||||
public QuestionAttempt Attempt { get; set; } = new();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user