mirror of
https://github.com/alexmickelson/canvasManagement.git
synced 2026-03-25 23:28:33 -06:00
prevent colon from getting in the name and breaking windows machines
This commit is contained in:
@@ -8,8 +8,17 @@ namespace LocalModels;
|
||||
|
||||
public record LocalAssignment
|
||||
{
|
||||
// public ulong? CanvasId { get; init; } = null;
|
||||
public string Name { get; init; } = "";
|
||||
private string _name = "";
|
||||
public string Name
|
||||
{
|
||||
get => _name;
|
||||
init
|
||||
{
|
||||
if (value.Contains(':'))
|
||||
throw new AssignmentMarkdownParseException("Name cannot contain a ':' character, it breaks windows filesystems " + value);
|
||||
_name = value;
|
||||
}
|
||||
}
|
||||
public string Description { get; init; } = "";
|
||||
// public bool LockAtDueDate { get; init; }
|
||||
public DateTime? LockAt { get; init; }
|
||||
@@ -18,7 +27,6 @@ public record LocalAssignment
|
||||
public IEnumerable<string> SubmissionTypes { get; init; } = Array.Empty<string>();
|
||||
public IEnumerable<RubricItem> Rubric { get; init; } = Array.Empty<RubricItem>();
|
||||
public int PointsPossible => Rubric.Sum(r => r.IsExtraCredit ? 0 : r.Points);
|
||||
|
||||
public string GetRubricHtml()
|
||||
{
|
||||
var output = "<h1>Rubric</h1><pre><code class=\"language-json\">[\n";
|
||||
|
||||
@@ -37,8 +37,6 @@ public class CourseMarkdownLoader
|
||||
throw new LoadCourseFromFileException(errorMessage);
|
||||
}
|
||||
|
||||
|
||||
|
||||
LocalCourseSettings settings = await loadCourseSettings(courseDirectory);
|
||||
var modules = await loadCourseModules(courseDirectory);
|
||||
|
||||
@@ -73,7 +71,7 @@ public class CourseMarkdownLoader
|
||||
modulePaths
|
||||
.Select(loadModuleFromPath)
|
||||
);
|
||||
return modules;
|
||||
return modules.OrderBy(m => m.Name);
|
||||
}
|
||||
|
||||
private async Task<LocalModule> loadModuleFromPath(string modulePath)
|
||||
|
||||
Reference in New Issue
Block a user