1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 05:32:54 +08:00

Made Operator.Equal not parse for date filter and added corresponding test

This commit is contained in:
Elvendir 2023-04-05 21:25:58 +02:00
parent df170517a8
commit c2f225f025
2 changed files with 12 additions and 0 deletions

View File

@ -381,6 +381,15 @@ namespace osu.Game.Tests.NonVisual.Filtering
Assert.AreEqual(false, filterCriteria.LastPlayed.Min == null);
}
[Test]
public void TestEqualDateQuery()
{
const string query = "played=50";
var filterCriteria = new FilterCriteria();
FilterQueryParser.ApplyQueries(filterCriteria, query);
Assert.AreEqual(false, filterCriteria.LastPlayed.HasFilter);
}
[Test]
public void TestOutofrangeDateQuery()
{

View File

@ -376,6 +376,9 @@ namespace osu.Game.Screens.Select
private static bool tryUpdateDateRange(ref FilterCriteria.OptionalRange<DateTimeOffset> dateRange, Operator op, string val)
{
if (op == Operator.Equal)
return false;
GroupCollection? match = null;
match ??= tryMatchRegex(val, @"^((?<years>\d+(\.\d+)?)y)?((?<months>\d+(\.\d+)?)M)?((?<days>\d+(\.\d+)?)d)?((?<hours>\d+(\.\d+)?)h)?((?<minutes>\d+(\.\d+)?)m)?((?<seconds>\d+(\.\d+)?)s)?$");