mirror of
https://github.com/alexmickelson/canvasManagement.git
synced 2026-03-25 23:28:33 -06:00
pass in a config object rather than a term to create a semester
This commit is contained in:
@@ -3,10 +3,12 @@ using CanvasModel.EnrollmentTerms;
|
||||
public class SemesterPlanner
|
||||
{
|
||||
public IEnumerable<CalendarMonth> Months { get; }
|
||||
public SemesterPlanner(EnrollmentTermModel canvasTerm)
|
||||
public SemesterPlanner(SemesterConfiguration configuration)
|
||||
{
|
||||
var start = canvasTerm.StartAt ?? throw new Exception($"Canvas Term must have a start date. Term: {canvasTerm.Id}");
|
||||
var end = canvasTerm.EndAt ?? throw new Exception($"Canvas Term must have a end date. Term: {canvasTerm.Id}");
|
||||
// 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;
|
||||
|
||||
var monthsInTerm =
|
||||
1 + ((end.Year - start.Year) * 12)
|
||||
|
||||
5
Management/Models/SemesterConfiguration.cs
Normal file
5
Management/Models/SemesterConfiguration.cs
Normal file
@@ -0,0 +1,5 @@
|
||||
public record SemesterConfiguration(
|
||||
DateTime StartDate,
|
||||
DateTime EndDate,
|
||||
IEnumerable<DayOfWeek> Days
|
||||
);
|
||||
Reference in New Issue
Block a user