mirror of
https://github.com/alexmickelson/canvasManagement.git
synced 2026-03-25 23:28:33 -06:00
have basic quiz editor implemented
This commit is contained in:
@@ -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[] { }
|
||||
};
|
||||
|
||||
@@ -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*\]|\[\*\]";
|
||||
|
||||
@@ -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,
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user