diff --git a/ExtraIsland/Components/ProfileInformation/ProfileInformation.axaml.cs b/ExtraIsland/Components/ProfileInformation/ProfileInformation.axaml.cs index 5144e7d..056536d 100644 --- a/ExtraIsland/Components/ProfileInformation/ProfileInformation.axaml.cs +++ b/ExtraIsland/Components/ProfileInformation/ProfileInformation.axaml.cs @@ -55,14 +55,11 @@ void LessonsServiceOnPostMainTimerTicked(object? sender,EventArgs e) { int GetWeekInSemester(DateTime? current = null) { current ??= _exactTimeService.GetCurrentLocalDateTime(); DateTime orientation = (DateTime)((dynamic)AppBase.Current).Settings.SingleWeekStartTime; - int oriWeek = orientation.DayOfWeek == DayOfWeek.Sunday ? 6 : Convert.ToInt32(orientation.DayOfWeek) - 1; - - //regulate - DateTime startMonday = orientation.AddDays(-oriWeek); - int lastDelta = current.Value.DayOfWeek != DayOfWeek.Sunday ? 7 - Convert.ToInt32(current.Value.DayOfWeek) : 0; - DateTime lastEnd = current.Value.AddDays(lastDelta); - - TimeSpan totalWeekDelta = lastEnd - startMonday; + int daysToStartOfWeek = ((int)orientation.DayOfWeek - (int)Settings.FirstDayOfWeek + 7) % 7; + DateTime startDay = orientation.AddDays(-daysToStartOfWeek); + int daysToEndOfWeek = ((int)Settings.FirstDayOfWeek - (int)current.Value.DayOfWeek + 6) % 7; + DateTime lastEnd = current.Value.AddDays(daysToEndOfWeek); + TimeSpan totalWeekDelta = lastEnd - startDay; return Convert.ToInt32(totalWeekDelta.Days + 1) / 7; } } \ No newline at end of file diff --git a/ExtraIsland/Components/ProfileInformation/ProfileInformationConfig.cs b/ExtraIsland/Components/ProfileInformation/ProfileInformationConfig.cs index c44af52..a315021 100644 --- a/ExtraIsland/Components/ProfileInformation/ProfileInformationConfig.cs +++ b/ExtraIsland/Components/ProfileInformation/ProfileInformationConfig.cs @@ -10,6 +10,9 @@ public partial class ProfileInformationConfig : ObservableObject { [ObservableProperty] bool _isShortModeEnabled; + + [ObservableProperty] + DayOfWeek _firstDayOfWeek = DayOfWeek.Monday; } public enum ProfileInformationType { diff --git a/ExtraIsland/Components/ProfileInformation/ProfileInformationSettings.axaml b/ExtraIsland/Components/ProfileInformation/ProfileInformationSettings.axaml index 14f7799..0426330 100644 --- a/ExtraIsland/Components/ProfileInformation/ProfileInformationSettings.axaml +++ b/ExtraIsland/Components/ProfileInformation/ProfileInformationSettings.axaml @@ -8,6 +8,7 @@ x:TypeArguments="components:ProfileInformationConfig"> + @@ -35,6 +36,22 @@ + + + + + + + + + + +