Add user progress dashboard
This commit is contained in:
@@ -27,6 +27,8 @@ public class QuestionAttemptStore
|
||||
|
||||
var createdIndex = Builders<QuestionAttempt>.IndexKeys.Ascending(a => a.CreatedUtc);
|
||||
_col.Indexes.CreateOne(new CreateIndexModel<QuestionAttempt>(createdIndex));
|
||||
_col.Indexes.CreateOne(new CreateIndexModel<QuestionAttempt>(
|
||||
Builders<QuestionAttempt>.IndexKeys.Ascending(a => a.UserId).Descending(a => a.CreatedUtc)));
|
||||
}
|
||||
|
||||
public async Task<QuestionAttemptRecordResult> RecordFirstAttemptAsync(
|
||||
@@ -35,7 +37,8 @@ public class QuestionAttemptStore
|
||||
string choiceId,
|
||||
bool isCorrect,
|
||||
bool isSkip = false,
|
||||
IReadOnlyCollection<string>? presentedChoiceIds = null)
|
||||
IReadOnlyCollection<string>? presentedChoiceIds = null,
|
||||
int durationSeconds = 0)
|
||||
{
|
||||
var attempt = new QuestionAttempt
|
||||
{
|
||||
@@ -46,6 +49,7 @@ public class QuestionAttemptStore
|
||||
TracksPresentation = presentedChoiceIds is { Count: > 0 },
|
||||
IsCorrect = isCorrect,
|
||||
IsSkip = isSkip,
|
||||
DurationSeconds = Math.Clamp(durationSeconds, 0, 86_400),
|
||||
CounterBucket = GetCounterBucket(userId),
|
||||
RatingApplied = false,
|
||||
CreatedUtc = DateTime.UtcNow
|
||||
|
||||
Reference in New Issue
Block a user