mirror of
https://github.com/alexmickelson/canvasManagement.git
synced 2026-03-26 07:38:33 -06:00
can create config from semester
This commit is contained in:
@@ -5,8 +5,6 @@ public class SemesterPlanner
|
||||
public IEnumerable<CalendarMonth> Months { get; }
|
||||
public SemesterPlanner(SemesterConfiguration configuration)
|
||||
{
|
||||
// var start = configuration.StartAt ?? throw new Exception($"Canvas Term must have a start date. Term: {configuration.Id}");
|
||||
// var end = configuration.EndAt ?? throw new Exception($"Canvas Term must have a end date. Term: {configuration.Id}");
|
||||
var start = configuration.StartDate;
|
||||
var end = configuration.EndDate;
|
||||
|
||||
|
||||
19
Management/Features/Configuration/ConfigrationManagement.cs
Normal file
19
Management/Features/Configuration/ConfigrationManagement.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using CanvasModel.EnrollmentTerms;
|
||||
|
||||
public class ConfigurationManagement
|
||||
{
|
||||
public static SemesterConfiguration CreateFromTerm(
|
||||
EnrollmentTermModel canvasTerm,
|
||||
DayOfWeek[] daysOfWeek
|
||||
)
|
||||
{
|
||||
var start = canvasTerm.StartAt ?? throw new Exception($"Canvas Term must have a start date. Term: {canvasTerm.Name}");
|
||||
var end = canvasTerm.EndAt ?? throw new Exception($"Canvas Term must have a end date. Term: {canvasTerm.Name}");
|
||||
|
||||
return new SemesterConfiguration(
|
||||
StartDate: start,
|
||||
EndDate: end,
|
||||
Days: daysOfWeek
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user