From caad89a4ddd6b773df83e46d2da9c3ac4a81f0f8 Mon Sep 17 00:00:00 2001 From: Detze <92268414+Detze@users.noreply.github.com> Date: Thu, 29 Feb 2024 07:36:35 +0100 Subject: [PATCH] Fix test failure on leap years --- .../NonVisual/Filtering/FilterQueryParserTest.cs | 2 +- osu.Game/Screens/Select/FilterQueryParser.cs | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/osu.Game.Tests/NonVisual/Filtering/FilterQueryParserTest.cs b/osu.Game.Tests/NonVisual/Filtering/FilterQueryParserTest.cs index 12d6060351..bf888348ee 100644 --- a/osu.Game.Tests/NonVisual/Filtering/FilterQueryParserTest.cs +++ b/osu.Game.Tests/NonVisual/Filtering/FilterQueryParserTest.cs @@ -538,7 +538,7 @@ namespace osu.Game.Tests.NonVisual.Filtering Assert.That(filterCriteria.LastPlayed.Max, Is.Not.Null); // the parser internally references `DateTimeOffset.Now`, so to not make things too annoying for tests, just assume some tolerance // (irrelevant in proportion to the actual filter proscribed). - Assert.That(filterCriteria.LastPlayed.Min, Is.EqualTo(DateTimeOffset.Now.AddYears(-1).AddMonths(-6)).Within(TimeSpan.FromSeconds(5))); + Assert.That(filterCriteria.LastPlayed.Min, Is.EqualTo(DateTimeOffset.Now.AddMonths(-6).AddYears(-1)).Within(TimeSpan.FromSeconds(5))); Assert.That(filterCriteria.LastPlayed.Max, Is.EqualTo(DateTimeOffset.Now.AddMonths(-3)).Within(TimeSpan.FromSeconds(5))); } diff --git a/osu.Game/Screens/Select/FilterQueryParser.cs b/osu.Game/Screens/Select/FilterQueryParser.cs index 2c4077dacf..1ee8b9bc05 100644 --- a/osu.Game/Screens/Select/FilterQueryParser.cs +++ b/osu.Game/Screens/Select/FilterQueryParser.cs @@ -402,19 +402,19 @@ namespace osu.Game.Screens.Select // we'll want to flip the operator, such that `>5d` means "more than five days ago", as in "*before* five days ago", // as intended by the user. case Operator.Less: - op = Operator.Greater; - break; - - case Operator.LessOrEqual: op = Operator.GreaterOrEqual; break; + case Operator.LessOrEqual: + op = Operator.Greater; + break; + case Operator.Greater: - op = Operator.Less; + op = Operator.LessOrEqual; break; case Operator.GreaterOrEqual: - op = Operator.LessOrEqual; + op = Operator.Less; break; }