mirror of
https://github.com/alexmickelson/canvasManagement.git
synced 2026-03-25 23:28:33 -06:00
changed casing of local assets
This commit is contained in:
@@ -10,53 +10,53 @@ public record RubricItem
|
||||
|
||||
public static class SubmissionType
|
||||
{
|
||||
public static readonly string online_text_entry = "online_text_entry";
|
||||
public static readonly string online_upload = "online_upload";
|
||||
public static readonly string online_quiz = "online_quiz";
|
||||
public static readonly string on_paper = "on_paper";
|
||||
public static readonly string discussion_topic = "discussion_topic";
|
||||
public static readonly string external_tool = "external_tool";
|
||||
public static readonly string online_url = "online_url";
|
||||
public static readonly string media_recording = "media_recording";
|
||||
public static readonly string student_annotation = "student_annotation";
|
||||
public static readonly string none = "none";
|
||||
public static readonly string ONLINE_TEXT_ENTRY = "online_text_entry";
|
||||
public static readonly string ONLINE_UPLOAD = "online_upload";
|
||||
public static readonly string ONLINE_QUIZ = "online_quiz";
|
||||
public static readonly string ON_PAPER = "on_paper";
|
||||
public static readonly string DISCUSSION_TOPIC = "discussion_topic";
|
||||
public static readonly string EXTERNAL_TOOL = "external_tool";
|
||||
public static readonly string ONLINE_URL = "online_url";
|
||||
public static readonly string MEDIA_RECORDING = "media_recording";
|
||||
public static readonly string STUDENT_ANNOTATION = "student_annotation";
|
||||
public static readonly string NONE = "none";
|
||||
public static readonly IEnumerable<string> AllTypes = new string[]
|
||||
{
|
||||
SubmissionType.online_text_entry,
|
||||
SubmissionType.online_upload,
|
||||
SubmissionType.online_quiz,
|
||||
SubmissionType.on_paper,
|
||||
SubmissionType.discussion_topic,
|
||||
SubmissionType.external_tool,
|
||||
SubmissionType.online_url,
|
||||
SubmissionType.media_recording,
|
||||
SubmissionType.student_annotation,
|
||||
SubmissionType.none,
|
||||
SubmissionType.ONLINE_TEXT_ENTRY,
|
||||
SubmissionType.ONLINE_UPLOAD,
|
||||
SubmissionType.ONLINE_QUIZ,
|
||||
SubmissionType.ON_PAPER,
|
||||
SubmissionType.DISCUSSION_TOPIC,
|
||||
SubmissionType.EXTERNAL_TOOL,
|
||||
SubmissionType.ONLINE_URL,
|
||||
SubmissionType.MEDIA_RECORDING,
|
||||
SubmissionType.STUDENT_ANNOTATION,
|
||||
SubmissionType.NONE,
|
||||
};
|
||||
}
|
||||
|
||||
public record LocalAssignment
|
||||
{
|
||||
public string id { get; init; } = "";
|
||||
public ulong? canvasId { get; init; } = null;
|
||||
public string name { get; init; } = "";
|
||||
public string description { get; init; } = "";
|
||||
public bool use_template { get; init; } = false;
|
||||
public string? template_id { get; init; } = string.Empty;
|
||||
public Dictionary<string, string> template_variables { get; init; } =
|
||||
public string Id { get; init; } = "";
|
||||
public ulong? CanvasId { get; init; } = null;
|
||||
public string Name { get; init; } = "";
|
||||
public string Description { get; init; } = "";
|
||||
public bool UseTemplate { get; init; } = false;
|
||||
public string? TemplateId { get; init; } = string.Empty;
|
||||
public Dictionary<string, string> TemplateVariables { get; init; } =
|
||||
new Dictionary<string, string>();
|
||||
public bool lock_at_due_date { get; init; }
|
||||
public IEnumerable<RubricItem> rubric { get; init; } = new RubricItem[] { };
|
||||
public DateTime? lock_at { get; init; }
|
||||
public DateTime due_at { get; init; }
|
||||
public int points_possible { get; init; }
|
||||
public IEnumerable<string> submission_types { get; init; } = new string[] { };
|
||||
public bool LockAtDueDate { get; init; }
|
||||
public IEnumerable<RubricItem> Rubric { get; init; } = new RubricItem[] { };
|
||||
public DateTime? LockAt { get; init; }
|
||||
public DateTime DueAt { get; init; }
|
||||
public int PointsPossible { get; init; }
|
||||
public IEnumerable<string> SubmissionTypes { get; init; } = new string[] { };
|
||||
|
||||
public string GetRubricHtml()
|
||||
{
|
||||
var output = "<h1>Rubric</h1><pre><code class=\"language-json\">[\n";
|
||||
|
||||
var lineStrings = rubric.Select(
|
||||
var lineStrings = Rubric.Select(
|
||||
item => $" {{\"label\": \"{item.Label}\", \"points\": {item.Points}}}"
|
||||
);
|
||||
output += string.Join(",\n", lineStrings);
|
||||
@@ -66,26 +66,26 @@ public record LocalAssignment
|
||||
|
||||
public string GetDescriptionHtml(IEnumerable<AssignmentTemplate>? templates)
|
||||
{
|
||||
if (use_template && templates == null)
|
||||
if (UseTemplate && templates == null)
|
||||
throw new Exception("cannot get description for assignment if templates not provided");
|
||||
|
||||
var rubricHtml = GetRubricHtml();
|
||||
|
||||
if (use_template)
|
||||
if (UseTemplate)
|
||||
{
|
||||
var template = templates?.FirstOrDefault(t => t.Id == template_id);
|
||||
var template = templates?.FirstOrDefault(t => t.Id == TemplateId);
|
||||
if (template == null)
|
||||
throw new Exception($"Could not find template with id {template_id}");
|
||||
throw new Exception($"Could not find template with id {TemplateId}");
|
||||
|
||||
var html = Markdig.Markdown.ToHtml(template.Markdown);
|
||||
|
||||
foreach (KeyValuePair<string, string> entry in template_variables)
|
||||
foreach (KeyValuePair<string, string> entry in TemplateVariables)
|
||||
{
|
||||
html = html.Replace($"%7B%7B{entry.Key}%7D%7D", entry.Value);
|
||||
}
|
||||
return html + "<hr>" + rubricHtml;
|
||||
}
|
||||
|
||||
return Markdig.Markdown.ToHtml(description) + "<hr>" + rubricHtml;
|
||||
return Markdig.Markdown.ToHtml(Description) + "<hr>" + rubricHtml;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,5 +6,7 @@ public record LocalModule
|
||||
public IEnumerable<LocalAssignment> Assignments { get; init; } =
|
||||
Enumerable.Empty<LocalAssignment>();
|
||||
|
||||
public IEnumerable<LocalQuiz> Quizzes { get; init; } = Enumerable.Empty<LocalQuiz>();
|
||||
|
||||
public ulong? CanvasId { get; set; } = null;
|
||||
}
|
||||
|
||||
13
Management/Models/Local/LocalQuiz.cs
Normal file
13
Management/Models/Local/LocalQuiz.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
public record LocalQuiz
|
||||
{
|
||||
public string Id { get; init; } = ""; public ulong? CanvasId { get; init; } = null;
|
||||
public string Name { get; init; } = "";
|
||||
public string Description { get; init; } = "";
|
||||
public bool LockAtDueDate { get; init; }
|
||||
public DateTime? LockAt { get; init; }
|
||||
public DateTime DueAt { get; init; }
|
||||
public bool ShuffleAnswers { get; init; }
|
||||
public bool OneQuestionAtATime { get; init; }
|
||||
public int AllowedAttempts { get; init; }
|
||||
//quiz type
|
||||
}
|
||||
Reference in New Issue
Block a user