added border around today

This commit is contained in:
2023-09-08 13:44:10 -06:00
parent 2b154d186d
commit c2ce788627
5 changed files with 14 additions and 7 deletions

View File

@@ -59,6 +59,9 @@
if(dragging) if(dragging)
return baseClasses + " bg-secondary text-light "; return baseClasses + " bg-secondary text-light ";
if(date?.Date == DateTime.Today)
baseClasses += " border-1 border-primary-subtle ";
if (isWeekDay) if (isWeekDay)
{ {
DayOfWeek? weekDay = date?.DayOfWeek; DayOfWeek? weekDay = date?.DayOfWeek;

View File

@@ -9,7 +9,7 @@ public record CanvasQuizAnswer
public required string Text { get; init; } public required string Text { get; init; }
[JsonPropertyName("html")] [JsonPropertyName("html")]
public required string Html { get; init; } public string? Html { get; init; }
[JsonPropertyName("weight")] [JsonPropertyName("weight")]
public double Weight { get; init; } public double Weight { get; init; }

View File

@@ -5,6 +5,7 @@ public record LocalQuizQuestion
public ulong? CanvasId { get; set; } public ulong? CanvasId { get; set; }
public string Id { get; set; } = ""; public string Id { get; set; } = "";
public string Text { get; init; } = string.Empty; public string Text { get; init; } = string.Empty;
public string HtmlText => Markdig.Markdown.ToHtml(Text);
public string QuestionType { get; init; } = string.Empty; public string QuestionType { get; init; } = string.Empty;
public int Points { get; init; } public int Points { get; init; }
public IEnumerable<LocalQuizQuestionAnswer> Answers { get; init; } = public IEnumerable<LocalQuizQuestionAnswer> Answers { get; init; } =

View File

@@ -8,4 +8,6 @@ public record LocalQuizQuestionAnswer
//correct gets a weight of 100 in canvas //correct gets a weight of 100 in canvas
public bool Correct { get; init; } public bool Correct { get; init; }
public string Text { get; init; } = string.Empty; public string Text { get; init; } = string.Empty;
public string HtmlText => Markdig.Markdown.ToHtml(Text);
} }

View File

@@ -56,7 +56,7 @@ public class CanvasQuizService
shuffle_answers = localQuiz.ShuffleAnswers, shuffle_answers = localQuiz.ShuffleAnswers,
// hide_results = localQuiz.HideResults, // hide_results = localQuiz.HideResults,
allowed_attempts = localQuiz.AllowedAttempts, allowed_attempts = localQuiz.AllowedAttempts,
one_question_at_a_time = true, one_question_at_a_time = false,
cant_go_back = false, cant_go_back = false,
due_at = localQuiz.DueAt, due_at = localQuiz.DueAt,
lock_at = localQuiz.LockAtDueDate ? localQuiz.DueAt : localQuiz.LockAt, lock_at = localQuiz.LockAtDueDate ? localQuiz.DueAt : localQuiz.LockAt,
@@ -117,11 +117,12 @@ public class CanvasQuizService
var newQuestion = await createQuestionOnly(canvasCourseId, localQuiz, question); var newQuestion = await createQuestionOnly(canvasCourseId, localQuiz, question);
var answersWithIds = question.Answers var answersWithIds = question.Answers
.Select(answer => .Select((answer, i) =>
{ {
var canvasAnswer = newQuestion.Answers?.FirstOrDefault(ca => ca.Html == answer.Text); var canvasAnswer = newQuestion.Answers?.ElementAt(i);
if (canvasAnswer == null) if (canvasAnswer == null)
{ {
Console.WriteLine(i);
Console.WriteLine(JsonSerializer.Serialize(newQuestion)); Console.WriteLine(JsonSerializer.Serialize(newQuestion));
Console.WriteLine(JsonSerializer.Serialize(question)); Console.WriteLine(JsonSerializer.Serialize(question));
throw new NullReferenceException( throw new NullReferenceException(
@@ -148,13 +149,13 @@ public class CanvasQuizService
{ {
var url = $"courses/{canvasCourseId}/quizzes/{localQuiz.CanvasId}/questions"; var url = $"courses/{canvasCourseId}/quizzes/{localQuiz.CanvasId}/questions";
var answers = q.Answers var answers = q.Answers
.Select(a => new { answer_html = a.Text, answer_weight = a.Correct ? 100 : 0 }) .Select(a => new { answer_html = a.HtmlText, answer_weight = a.Correct ? 100 : 0 })
.ToArray(); .ToArray();
var body = new var body = new
{ {
question = new question = new
{ {
question_text = q.Text, question_text = q.HtmlText,
question_type = q.QuestionType + "_question", question_type = q.QuestionType + "_question",
points_possible = q.Points, points_possible = q.Points,
// position // position