mirror of
https://github.com/alexmickelson/canvasManagement.git
synced 2026-03-25 23:28:33 -06:00
added border around today
This commit is contained in:
@@ -59,6 +59,9 @@
|
||||
if(dragging)
|
||||
return baseClasses + " bg-secondary text-light ";
|
||||
|
||||
if(date?.Date == DateTime.Today)
|
||||
baseClasses += " border-1 border-primary-subtle ";
|
||||
|
||||
if (isWeekDay)
|
||||
{
|
||||
DayOfWeek? weekDay = date?.DayOfWeek;
|
||||
|
||||
@@ -9,7 +9,7 @@ public record CanvasQuizAnswer
|
||||
public required string Text { get; init; }
|
||||
|
||||
[JsonPropertyName("html")]
|
||||
public required string Html { get; init; }
|
||||
public string? Html { get; init; }
|
||||
|
||||
[JsonPropertyName("weight")]
|
||||
public double Weight { get; init; }
|
||||
|
||||
@@ -4,7 +4,8 @@ public record LocalQuizQuestion
|
||||
{
|
||||
public ulong? CanvasId { 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 int Points { get; init; }
|
||||
public IEnumerable<LocalQuizQuestionAnswer> Answers { get; init; } =
|
||||
|
||||
@@ -8,4 +8,6 @@ public record LocalQuizQuestionAnswer
|
||||
//correct gets a weight of 100 in canvas
|
||||
public bool Correct { get; init; }
|
||||
public string Text { get; init; } = string.Empty;
|
||||
|
||||
public string HtmlText => Markdig.Markdown.ToHtml(Text);
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ public class CanvasQuizService
|
||||
shuffle_answers = localQuiz.ShuffleAnswers,
|
||||
// hide_results = localQuiz.HideResults,
|
||||
allowed_attempts = localQuiz.AllowedAttempts,
|
||||
one_question_at_a_time = true,
|
||||
one_question_at_a_time = false,
|
||||
cant_go_back = false,
|
||||
due_at = localQuiz.DueAt,
|
||||
lock_at = localQuiz.LockAtDueDate ? localQuiz.DueAt : localQuiz.LockAt,
|
||||
@@ -117,11 +117,12 @@ public class CanvasQuizService
|
||||
var newQuestion = await createQuestionOnly(canvasCourseId, localQuiz, question);
|
||||
|
||||
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)
|
||||
{
|
||||
Console.WriteLine(i);
|
||||
Console.WriteLine(JsonSerializer.Serialize(newQuestion));
|
||||
Console.WriteLine(JsonSerializer.Serialize(question));
|
||||
throw new NullReferenceException(
|
||||
@@ -148,13 +149,13 @@ public class CanvasQuizService
|
||||
{
|
||||
var url = $"courses/{canvasCourseId}/quizzes/{localQuiz.CanvasId}/questions";
|
||||
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();
|
||||
var body = new
|
||||
{
|
||||
question = new
|
||||
{
|
||||
question_text = q.Text,
|
||||
question_text = q.HtmlText,
|
||||
question_type = q.QuestionType + "_question",
|
||||
points_possible = q.Points,
|
||||
// position
|
||||
|
||||
Reference in New Issue
Block a user