added template editor

This commit is contained in:
2023-07-26 15:51:44 -06:00
parent 9c547b3435
commit 87fc062dfb
14 changed files with 435 additions and 97 deletions

View File

@@ -0,0 +1,18 @@
using System.Text.RegularExpressions;
namespace LocalModels;
public record AssignmentTemplate
{
public string Id { get; set; } = String.Empty;
public string Name { get; set; } = String.Empty;
public string Markdown { get; set; } = String.Empty;
public static IEnumerable<string> GetVariables(string markdown)
{
string pattern = "{{(.*?)}}";
MatchCollection matches = Regex.Matches(markdown, pattern);
return matches.Select(match => match.Groups[1].Value);
}
}

View File

@@ -0,0 +1,35 @@
public record RubricItem
{
public static readonly string extraCredit = "(Extra Credit) ";
public string Id { get; set; } = "";
public string Label { get; set; } = "";
public int Points { get; set; } = 0;
}
public enum SubmissionType
{
online_text_entry,
online_upload,
online_quiz,
on_paper,
discussion_topic,
external_tool,
online_url,
media_recording,
student_annotation,
none,
}
public record LocalAssignment
{
public string id { get; init; } = "";
public ulong? canvasId = null;
public string name { get; init; } = "";
public string description { get; init; } = "";
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<SubmissionType> submission_types { get; init; } = new SubmissionType[] { };
}

View File

@@ -9,6 +9,8 @@ public record LocalCourse
public DateTime StartDate { get; init; }
public DateTime EndDate { get; init; }
public SimpleTimeOnly DefaultDueTime { get; init; } = new SimpleTimeOnly();
public IEnumerable<AssignmentTemplate> AssignmentTemplates { get; init; } =
Enumerable.Empty<AssignmentTemplate>();
}
public record SimpleTimeOnly