mirror of
https://github.com/ppy/osu.git
synced 2024-12-17 02:12:56 +08:00
Fix code quality and formatting issues
This commit is contained in:
parent
b58576f31b
commit
6b532824b1
@ -632,32 +632,32 @@ namespace osu.Game.Tests.NonVisual.Filtering
|
|||||||
|
|
||||||
private static readonly object[] ranked_date_valid_test_cases =
|
private static readonly object[] ranked_date_valid_test_cases =
|
||||||
{
|
{
|
||||||
new object[] { "ranked<2012", dateTimeOffsetFromDateOnly(2012, 1, 1), (FilterCriteria x) => x.DateRanked.Max },
|
new object[] { "ranked<2012", dateTimeOffsetFromDateOnly(2012, 1, 1), (FilterCriteria x) => x.DateRanked.Max },
|
||||||
new object[] { "ranked<2012.03", dateTimeOffsetFromDateOnly(2012, 3, 1), (FilterCriteria x) => x.DateRanked.Max },
|
new object[] { "ranked<2012.03", dateTimeOffsetFromDateOnly(2012, 3, 1), (FilterCriteria x) => x.DateRanked.Max },
|
||||||
new object[] { "ranked<2012/03/05", dateTimeOffsetFromDateOnly(2012, 3, 5), (FilterCriteria x) => x.DateRanked.Max },
|
new object[] { "ranked<2012/03/05", dateTimeOffsetFromDateOnly(2012, 3, 5), (FilterCriteria x) => x.DateRanked.Max },
|
||||||
new object[] { "ranked<2012-3-5", dateTimeOffsetFromDateOnly(2012, 3, 5), (FilterCriteria x) => x.DateRanked.Max },
|
new object[] { "ranked<2012-3-5", dateTimeOffsetFromDateOnly(2012, 3, 5), (FilterCriteria x) => x.DateRanked.Max },
|
||||||
|
|
||||||
new object[] { "ranked<=2012", dateTimeOffsetFromDateOnly(2013, 1, 1), (FilterCriteria x) => x.DateRanked.Max },
|
new object[] { "ranked<=2012", dateTimeOffsetFromDateOnly(2013, 1, 1), (FilterCriteria x) => x.DateRanked.Max },
|
||||||
new object[] { "ranked<=2012.03", dateTimeOffsetFromDateOnly(2012, 4, 1), (FilterCriteria x) => x.DateRanked.Max },
|
new object[] { "ranked<=2012.03", dateTimeOffsetFromDateOnly(2012, 4, 1), (FilterCriteria x) => x.DateRanked.Max },
|
||||||
new object[] { "ranked<=2012/03/05", dateTimeOffsetFromDateOnly(2012, 3, 6), (FilterCriteria x) => x.DateRanked.Max },
|
new object[] { "ranked<=2012/03/05", dateTimeOffsetFromDateOnly(2012, 3, 6), (FilterCriteria x) => x.DateRanked.Max },
|
||||||
new object[] { "ranked<=2012-3-5", dateTimeOffsetFromDateOnly(2012, 3, 6), (FilterCriteria x) => x.DateRanked.Max },
|
new object[] { "ranked<=2012-3-5", dateTimeOffsetFromDateOnly(2012, 3, 6), (FilterCriteria x) => x.DateRanked.Max },
|
||||||
|
|
||||||
new object[] { "ranked>2012", dateTimeOffsetFromDateOnly(2013, 1, 1), (FilterCriteria x) => x.DateRanked.Min },
|
new object[] { "ranked>2012", dateTimeOffsetFromDateOnly(2013, 1, 1), (FilterCriteria x) => x.DateRanked.Min },
|
||||||
new object[] { "ranked>2012.03", dateTimeOffsetFromDateOnly(2012, 4, 1), (FilterCriteria x) => x.DateRanked.Min },
|
new object[] { "ranked>2012.03", dateTimeOffsetFromDateOnly(2012, 4, 1), (FilterCriteria x) => x.DateRanked.Min },
|
||||||
new object[] { "ranked>2012/03/05", dateTimeOffsetFromDateOnly(2012, 3, 6), (FilterCriteria x) => x.DateRanked.Min },
|
new object[] { "ranked>2012/03/05", dateTimeOffsetFromDateOnly(2012, 3, 6), (FilterCriteria x) => x.DateRanked.Min },
|
||||||
new object[] { "ranked>2012-3-5", dateTimeOffsetFromDateOnly(2012, 3, 6), (FilterCriteria x) => x.DateRanked.Min },
|
new object[] { "ranked>2012-3-5", dateTimeOffsetFromDateOnly(2012, 3, 6), (FilterCriteria x) => x.DateRanked.Min },
|
||||||
|
|
||||||
new object[] { "ranked>=2012", dateTimeOffsetFromDateOnly(2012, 1, 1), (FilterCriteria x) => x.DateRanked.Min },
|
new object[] { "ranked>=2012", dateTimeOffsetFromDateOnly(2012, 1, 1), (FilterCriteria x) => x.DateRanked.Min },
|
||||||
new object[] { "ranked>=2012.03", dateTimeOffsetFromDateOnly(2012, 3, 1), (FilterCriteria x) => x.DateRanked.Min },
|
new object[] { "ranked>=2012.03", dateTimeOffsetFromDateOnly(2012, 3, 1), (FilterCriteria x) => x.DateRanked.Min },
|
||||||
new object[] { "ranked>=2012/03/05", dateTimeOffsetFromDateOnly(2012, 3, 5), (FilterCriteria x) => x.DateRanked.Min },
|
new object[] { "ranked>=2012/03/05", dateTimeOffsetFromDateOnly(2012, 3, 5), (FilterCriteria x) => x.DateRanked.Min },
|
||||||
new object[] { "ranked>=2012-3-5", dateTimeOffsetFromDateOnly(2012, 3, 5), (FilterCriteria x) => x.DateRanked.Min },
|
new object[] { "ranked>=2012-3-5", dateTimeOffsetFromDateOnly(2012, 3, 5), (FilterCriteria x) => x.DateRanked.Min },
|
||||||
|
|
||||||
new object[] { "ranked=2012", dateTimeOffsetFromDateOnly(2012, 1, 1), (FilterCriteria x) => x.DateRanked.Min },
|
new object[] { "ranked=2012", dateTimeOffsetFromDateOnly(2012, 1, 1), (FilterCriteria x) => x.DateRanked.Min },
|
||||||
new object[] { "ranked=2012", dateTimeOffsetFromDateOnly(2012, 1, 1), (FilterCriteria x) => x.DateRanked.Min },
|
new object[] { "ranked=2012", dateTimeOffsetFromDateOnly(2012, 1, 1), (FilterCriteria x) => x.DateRanked.Min },
|
||||||
new object[] { "ranked=2012-03", dateTimeOffsetFromDateOnly(2012, 3, 1), (FilterCriteria x) => x.DateRanked.Min },
|
new object[] { "ranked=2012-03", dateTimeOffsetFromDateOnly(2012, 3, 1), (FilterCriteria x) => x.DateRanked.Min },
|
||||||
new object[] { "ranked=2012-03", dateTimeOffsetFromDateOnly(2012, 4, 1), (FilterCriteria x) => x.DateRanked.Max },
|
new object[] { "ranked=2012-03", dateTimeOffsetFromDateOnly(2012, 4, 1), (FilterCriteria x) => x.DateRanked.Max },
|
||||||
new object[] { "ranked=2012-03-05", dateTimeOffsetFromDateOnly(2012, 3, 5), (FilterCriteria x) => x.DateRanked.Min },
|
new object[] { "ranked=2012-03-05", dateTimeOffsetFromDateOnly(2012, 3, 5), (FilterCriteria x) => x.DateRanked.Min },
|
||||||
new object[] { "ranked=2012-03-05", dateTimeOffsetFromDateOnly(2012, 3, 6), (FilterCriteria x) => x.DateRanked.Max },
|
new object[] { "ranked=2012-03-05", dateTimeOffsetFromDateOnly(2012, 3, 6), (FilterCriteria x) => x.DateRanked.Max },
|
||||||
};
|
};
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -688,13 +688,13 @@ namespace osu.Game.Tests.NonVisual.Filtering
|
|||||||
|
|
||||||
private static readonly object[] submitted_date_test_cases =
|
private static readonly object[] submitted_date_test_cases =
|
||||||
{
|
{
|
||||||
new object[] { "submitted<2012", true },
|
new object[] { "submitted<2012", true },
|
||||||
new object[] { "submitted<2012.03", true },
|
new object[] { "submitted<2012.03", true },
|
||||||
new object[] { "submitted<2012/03/05", true },
|
new object[] { "submitted<2012/03/05", true },
|
||||||
new object[] { "submitted<2012-3-5", true },
|
new object[] { "submitted<2012-3-5", true },
|
||||||
|
|
||||||
new object[] { "submitted<0", false },
|
new object[] { "submitted<0", false },
|
||||||
new object[] { "submitted=99999", false },
|
new object[] { "submitted=99999", false },
|
||||||
new object[] { "submitted>=2012-03-05-04", false },
|
new object[] { "submitted>=2012-03-05-04", false },
|
||||||
new object[] { "submitted>=2012/03.05-04", false },
|
new object[] { "submitted>=2012/03.05-04", false },
|
||||||
};
|
};
|
||||||
|
@ -642,7 +642,6 @@ namespace osu.Game.Screens.Select
|
|||||||
|
|
||||||
switch (key)
|
switch (key)
|
||||||
{
|
{
|
||||||
|
|
||||||
case @"year":
|
case @"year":
|
||||||
year = (int)value;
|
year = (int)value;
|
||||||
break;
|
break;
|
||||||
@ -670,14 +669,8 @@ namespace osu.Game.Screens.Select
|
|||||||
switch (op)
|
switch (op)
|
||||||
{
|
{
|
||||||
case Operator.Less:
|
case Operator.Less:
|
||||||
if (month == null)
|
month ??= 1;
|
||||||
{
|
day ??= 1;
|
||||||
month = 1;
|
|
||||||
day = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (day == null)
|
|
||||||
day = 1;
|
|
||||||
|
|
||||||
dateTimeOffset = dateTimeOffsetFromDateOnly(year.Value, month.Value, day.Value);
|
dateTimeOffset = dateTimeOffsetFromDateOnly(year.Value, month.Value, day.Value);
|
||||||
return tryUpdateCriteriaRange(ref dateRange, op, dateTimeOffset);
|
return tryUpdateCriteriaRange(ref dateRange, op, dateTimeOffset);
|
||||||
@ -690,6 +683,7 @@ namespace osu.Game.Screens.Select
|
|||||||
dateTimeOffset = dateTimeOffsetFromDateOnly(year.Value, month.Value, day.Value).AddYears(1);
|
dateTimeOffset = dateTimeOffsetFromDateOnly(year.Value, month.Value, day.Value).AddYears(1);
|
||||||
return tryUpdateCriteriaRange(ref dateRange, Operator.Less, dateTimeOffset);
|
return tryUpdateCriteriaRange(ref dateRange, Operator.Less, dateTimeOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (day == null)
|
if (day == null)
|
||||||
{
|
{
|
||||||
day = 1;
|
day = 1;
|
||||||
@ -701,14 +695,8 @@ namespace osu.Game.Screens.Select
|
|||||||
return tryUpdateCriteriaRange(ref dateRange, Operator.Less, dateTimeOffset);
|
return tryUpdateCriteriaRange(ref dateRange, Operator.Less, dateTimeOffset);
|
||||||
|
|
||||||
case Operator.GreaterOrEqual:
|
case Operator.GreaterOrEqual:
|
||||||
if (month == null)
|
month ??= 1;
|
||||||
{
|
day ??= 1;
|
||||||
month = 1;
|
|
||||||
day = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (day == null)
|
|
||||||
day = 1;
|
|
||||||
|
|
||||||
dateTimeOffset = dateTimeOffsetFromDateOnly(year.Value, month.Value, day.Value);
|
dateTimeOffset = dateTimeOffsetFromDateOnly(year.Value, month.Value, day.Value);
|
||||||
return tryUpdateCriteriaRange(ref dateRange, op, dateTimeOffset);
|
return tryUpdateCriteriaRange(ref dateRange, op, dateTimeOffset);
|
||||||
@ -721,6 +709,7 @@ namespace osu.Game.Screens.Select
|
|||||||
dateTimeOffset = dateTimeOffsetFromDateOnly(year.Value, month.Value, day.Value).AddYears(1);
|
dateTimeOffset = dateTimeOffsetFromDateOnly(year.Value, month.Value, day.Value).AddYears(1);
|
||||||
return tryUpdateCriteriaRange(ref dateRange, Operator.GreaterOrEqual, dateTimeOffset);
|
return tryUpdateCriteriaRange(ref dateRange, Operator.GreaterOrEqual, dateTimeOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (day == null)
|
if (day == null)
|
||||||
{
|
{
|
||||||
day = 1;
|
day = 1;
|
||||||
@ -742,11 +731,8 @@ namespace osu.Game.Screens.Select
|
|||||||
day = 1;
|
day = 1;
|
||||||
minDateTimeOffset = dateTimeOffsetFromDateOnly(year.Value, month.Value, day.Value);
|
minDateTimeOffset = dateTimeOffsetFromDateOnly(year.Value, month.Value, day.Value);
|
||||||
maxDateTimeOffset = dateTimeOffsetFromDateOnly(year.Value, month.Value, day.Value).AddYears(1);
|
maxDateTimeOffset = dateTimeOffsetFromDateOnly(year.Value, month.Value, day.Value).AddYears(1);
|
||||||
return (
|
return tryUpdateCriteriaRange(ref dateRange, Operator.GreaterOrEqual, minDateTimeOffset)
|
||||||
tryUpdateCriteriaRange(ref dateRange, Operator.GreaterOrEqual, minDateTimeOffset)
|
&& tryUpdateCriteriaRange(ref dateRange, Operator.Less, maxDateTimeOffset);
|
||||||
&&
|
|
||||||
tryUpdateCriteriaRange(ref dateRange, Operator.Less, maxDateTimeOffset)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (day == null)
|
if (day == null)
|
||||||
@ -754,21 +740,15 @@ namespace osu.Game.Screens.Select
|
|||||||
day = 1;
|
day = 1;
|
||||||
minDateTimeOffset = dateTimeOffsetFromDateOnly(year.Value, month.Value, day.Value);
|
minDateTimeOffset = dateTimeOffsetFromDateOnly(year.Value, month.Value, day.Value);
|
||||||
maxDateTimeOffset = dateTimeOffsetFromDateOnly(year.Value, month.Value, day.Value).AddMonths(1);
|
maxDateTimeOffset = dateTimeOffsetFromDateOnly(year.Value, month.Value, day.Value).AddMonths(1);
|
||||||
return (
|
return tryUpdateCriteriaRange(ref dateRange, Operator.GreaterOrEqual, minDateTimeOffset)
|
||||||
tryUpdateCriteriaRange(ref dateRange, Operator.GreaterOrEqual, minDateTimeOffset)
|
&& tryUpdateCriteriaRange(ref dateRange, Operator.Less, maxDateTimeOffset);
|
||||||
&&
|
|
||||||
tryUpdateCriteriaRange(ref dateRange, Operator.Less, maxDateTimeOffset)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
minDateTimeOffset = dateTimeOffsetFromDateOnly(year.Value, month.Value, day.Value);
|
minDateTimeOffset = dateTimeOffsetFromDateOnly(year.Value, month.Value, day.Value);
|
||||||
maxDateTimeOffset = dateTimeOffsetFromDateOnly(year.Value, month.Value, day.Value).AddDays(1);
|
maxDateTimeOffset = dateTimeOffsetFromDateOnly(year.Value, month.Value, day.Value).AddDays(1);
|
||||||
|
return tryUpdateCriteriaRange(ref dateRange, Operator.GreaterOrEqual, minDateTimeOffset)
|
||||||
|
&& tryUpdateCriteriaRange(ref dateRange, Operator.Less, maxDateTimeOffset);
|
||||||
|
|
||||||
return (
|
|
||||||
tryUpdateCriteriaRange(ref dateRange, Operator.GreaterOrEqual, minDateTimeOffset)
|
|
||||||
&&
|
|
||||||
tryUpdateCriteriaRange(ref dateRange, Operator.Less, maxDateTimeOffset)
|
|
||||||
);
|
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user