From c3143210397a4a027a0af9f27ea1fa0ab845fbd2 Mon Sep 17 00:00:00 2001 From: Lorenz Stechauner Date: Fri, 5 Jul 2024 21:15:51 +0200 Subject: [PATCH] Utils: Change CurrentLastSeason to switch in july --- Elwig/Helpers/Utils.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Elwig/Helpers/Utils.cs b/Elwig/Helpers/Utils.cs index 8ee9184..707bfe3 100644 --- a/Elwig/Helpers/Utils.cs +++ b/Elwig/Helpers/Utils.cs @@ -36,7 +36,7 @@ namespace Elwig.Helpers { public static int CurrentYear => DateTime.Now.Year; public static int CurrentNextSeason => DateTime.Now.Year - (DateTime.Now.Month <= 3 ? 1 : 0); - public static int CurrentLastSeason => DateTime.Now.Year - (DateTime.Now.Month <= 7 ? 1 : 0); + public static int CurrentLastSeason => DateTime.Now.Year - (DateTime.Now.Month <= 6 ? 1 : 0); public static int FollowingSeason => DateTime.Now.Year + (DateTime.Now.Month >= 11 ? 1 : 0); public static DateTime Today => (DateTime.Now.Hour >= 3) ? DateTime.Today : DateTime.Today.AddDays(-1); @@ -557,15 +557,15 @@ namespace Elwig.Helpers { } public static Expression> ActiveAreaCommitments() => ActiveAreaCommitments(CurrentYear); - public static Expression> ActiveAreaCommitments(int yearTo) => - c => (c.YearFrom <= yearTo) && (c.YearTo == null || c.YearTo >= yearTo); + public static Expression> ActiveAreaCommitments(int year) => + c => (c.YearFrom <= year) && (c.YearTo == null || c.YearTo >= year); public static IQueryable ActiveAreaCommitments(IQueryable query) => ActiveAreaCommitments(query, CurrentYear); - public static IQueryable ActiveAreaCommitments(IQueryable query, int yearTo) => - query.Where(ActiveAreaCommitments(yearTo)); + public static IQueryable ActiveAreaCommitments(IQueryable query, int year) => + query.Where(ActiveAreaCommitments(year)); public static IEnumerable ActiveAreaCommitments(IEnumerable query) => ActiveAreaCommitments(query, CurrentYear); - public static IEnumerable ActiveAreaCommitments(IEnumerable query, int yearTo) => - query.Where(c => ActiveAreaCommitments(yearTo).Invoke(c)); + public static IEnumerable ActiveAreaCommitments(IEnumerable query, int year) => + query.Where(c => ActiveAreaCommitments(year).Invoke(c)); } }