have basic quiz editor implemented

This commit is contained in:
2023-10-10 17:16:08 -06:00
parent 008b85b971
commit e5defbc0cf
8 changed files with 231 additions and 16 deletions

View File

@@ -49,7 +49,7 @@ LockAt: {LockAt}
DueAt: {DueAt}
ShuffleAnswers: {ShuffleAnswers.ToString().ToLower()}
OneQuestionAtATime: {OneQuestionAtATime.ToString().ToLower()}
LocalAssignmentGroupName: {LocalAssignmentGroupName}
AssignmentGroup: {LocalAssignmentGroupName}
AllowedAttempts: {AllowedAttempts}
Description: {Description}
---
@@ -84,8 +84,8 @@ Description: {Description}
var dueAt = DateTime.Parse(extractLabelValue(settings, "DueAt"));
var lockAt = DateTime.Parse(extractLabelValue(settings, "LockAt"));
var description = extractDescription(settings);
var assignmentGroup = extractLabelValue(settings, "AssignmentGroup");
// var assignmentGroup = ExtractLabelValue(settings, "AssignmentGroup");
return new LocalQuiz()
{
Id = "id-" + name,
@@ -96,7 +96,7 @@ Description: {Description}
DueAt = dueAt,
ShuffleAnswers = shuffleAnswers,
OneQuestionAtATime = oneQuestionAtATime,
// LocalAssignmentGroupId = "someId",
LocalAssignmentGroupName = assignmentGroup,
AllowedAttempts = allowedAttempts,
Questions = new LocalQuizQuestion[] { }
};

View File

@@ -64,10 +64,10 @@ public record LocalQuizQuestion
private static (LocalQuizQuestionAnswer[], string questionType) getAnswers(string[] linesWithoutPoints)
{
var indexOfAnswerStart = linesWithoutPoints
.ToList()
.FindIndex(
l => validFirstAnswerDelimiters.Any(prefix => l.TrimStart().StartsWith(prefix))
);
.ToList()
.FindIndex(
l => validFirstAnswerDelimiters.Any(prefix => l.TrimStart().StartsWith(prefix))
);
var answerLinesRaw = linesWithoutPoints[indexOfAnswerStart..];
var answerStartPattern = @"^(\*?[a-z]\))|\[\s*\]|\[\*\]";

View File

@@ -13,7 +13,7 @@ public record LocalQuizQuestionAnswer
public static LocalQuizQuestionAnswer ParseMarkdown(string input)
{
var isCorrect = input[0] == '*' || input[1] == '*';
string startingQuestionPattern = @"^(?:\*[a-z]\))|\[\s*\]|\[\*\] ";
string startingQuestionPattern = @"^(\*?[a-z]\))|\[\s*\]|\[\*\] ";
var text = Regex.Replace(input, startingQuestionPattern, string.Empty).Trim();
return new LocalQuizQuestionAnswer()
@@ -22,5 +22,4 @@ public record LocalQuizQuestionAnswer
Text=text,
};
}
}