mirror of
https://github.com/alexmickelson/canvasManagement.git
synced 2026-03-25 23:28:33 -06:00
can select course from existing file
This commit is contained in:
@@ -2,28 +2,20 @@ using CanvasModel.EnrollmentTerms;
|
||||
|
||||
public class SemesterPlanner
|
||||
{
|
||||
public DateTime FirstDay { get; }
|
||||
public DateTime LastDay { get; }
|
||||
|
||||
public IEnumerable<CalendarMonth> Months { get; }
|
||||
public IEnumerable<DayOfWeek> Days { get; }
|
||||
public SemesterPlanner(SemesterCalendarConfig configuration)
|
||||
public static IEnumerable<CalendarMonth> GetMonthsBetweenDates(
|
||||
DateTime startDate,
|
||||
DateTime endDate
|
||||
)
|
||||
{
|
||||
FirstDay = configuration.StartDate;
|
||||
LastDay = configuration.EndDate;
|
||||
var monthsInTerm = 1 + ((endDate.Year - startDate.Year) * 12) + endDate.Month - startDate.Month;
|
||||
|
||||
var monthsInTerm =
|
||||
1 + ((LastDay.Year - FirstDay.Year) * 12)
|
||||
+ LastDay.Month - FirstDay.Month;
|
||||
|
||||
Months = Enumerable
|
||||
return Enumerable
|
||||
.Range(0, monthsInTerm)
|
||||
.Select(monthDiff =>
|
||||
{
|
||||
var month = ((FirstDay.Month + monthDiff - 1) % 12) + 1;
|
||||
var year = FirstDay.Year + ((FirstDay.Month + monthDiff - 1) / 12);
|
||||
var month = ((startDate.Month + monthDiff - 1) % 12) + 1;
|
||||
var year = startDate.Year + ((startDate.Month + monthDiff - 1) / 12);
|
||||
return new CalendarMonth(year, month);
|
||||
});
|
||||
Days = configuration.Days;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user