diff --git a/Shoko.Server/Filters/Functions/DateAddFunction.cs b/Shoko.Server/Filters/Functions/DateAddFunction.cs index cd3dd645b..a50a01584 100644 --- a/Shoko.Server/Filters/Functions/DateAddFunction.cs +++ b/Shoko.Server/Filters/Functions/DateAddFunction.cs @@ -9,34 +9,27 @@ public DateAddFunction() { } - public DateAddFunction(FilterExpression selector, TimeSpan parameter) + public DateAddFunction(FilterExpression left, TimeSpan parameter) { - Selector = selector; + Left = left; Parameter = parameter; } - public FilterExpression Selector { get; set; } + public FilterExpression Left { get; set; } public TimeSpan Parameter { get; set; } - public override bool TimeDependent => Selector.TimeDependent; - public override bool UserDependent => Selector.UserDependent; + public override bool TimeDependent => Left.TimeDependent; + public override bool UserDependent => Left.UserDependent; public override string HelpDescription => "This adds a timespan to a date selector"; public override FilterExpressionGroup Group => FilterExpressionGroup.Function; - - public FilterExpression Left - { - get => Selector; - set => Selector = value; - } - public override DateTime? Evaluate(IFilterable filterable, IFilterableUserInfo userInfo) { - return Selector.Evaluate(filterable, userInfo) + Parameter; + return Left.Evaluate(filterable, userInfo) + Parameter; } protected bool Equals(DateAddFunction other) { - return base.Equals(other) && Equals(Selector, other.Selector) && Parameter.Equals(other.Parameter); + return base.Equals(other) && Equals(Left, other.Left) && Parameter.Equals(other.Parameter); } public override bool Equals(object obj) @@ -61,7 +54,7 @@ public override bool Equals(object obj) public override int GetHashCode() { - return HashCode.Combine(base.GetHashCode(), Selector, Parameter); + return HashCode.Combine(base.GetHashCode(), Left, Parameter); } public static bool operator ==(DateAddFunction left, DateAddFunction right) @@ -76,6 +69,6 @@ public override int GetHashCode() public override bool IsType(FilterExpression expression) { - return expression is DateAddFunction exp && Left.IsType(exp.Left) && Selector.IsType(exp.Selector); + return expression is DateAddFunction exp && Left.IsType(exp.Left); } } diff --git a/Shoko.Server/Filters/Functions/DateDiffFunction.cs b/Shoko.Server/Filters/Functions/DateDiffFunction.cs index 14a84e450..ae46033ad 100644 --- a/Shoko.Server/Filters/Functions/DateDiffFunction.cs +++ b/Shoko.Server/Filters/Functions/DateDiffFunction.cs @@ -5,35 +5,29 @@ namespace Shoko.Server.Filters.Functions; public class DateDiffFunction : FilterExpression, IWithDateSelectorParameter, IWithTimeSpanParameter { - public DateDiffFunction(FilterExpression selector, TimeSpan parameter) + public DateDiffFunction(FilterExpression left, TimeSpan parameter) { - Selector = selector; + Left = left; Parameter = parameter; } public DateDiffFunction() { } - public FilterExpression Selector { get; set; } + public FilterExpression Left { get; set; } public TimeSpan Parameter { get; set; } - public override bool TimeDependent => Selector.TimeDependent; - public override bool UserDependent => Selector.UserDependent; + public override bool TimeDependent => Left.TimeDependent; + public override bool UserDependent => Left.UserDependent; public override string HelpDescription => "This subtracts a timespan from a date selector."; public override FilterExpressionGroup Group => FilterExpressionGroup.Function; - public FilterExpression Left - { - get => Selector; - set => Selector = value; - } - public override DateTime? Evaluate(IFilterable filterable, IFilterableUserInfo userInfo) { - return Selector.Evaluate(filterable, userInfo) - Parameter; + return Left.Evaluate(filterable, userInfo) - Parameter; } protected bool Equals(DateDiffFunction other) { - return base.Equals(other) && Equals(Selector, other.Selector) && Parameter.Equals(other.Parameter); + return base.Equals(other) && Equals(Left, other.Left) && Parameter.Equals(other.Parameter); } public override bool Equals(object obj) @@ -58,7 +52,7 @@ public override bool Equals(object obj) public override int GetHashCode() { - return HashCode.Combine(base.GetHashCode(), Selector, Parameter); + return HashCode.Combine(base.GetHashCode(), Left, Parameter); } public static bool operator ==(DateDiffFunction left, DateDiffFunction right) @@ -73,6 +67,6 @@ public override int GetHashCode() public override bool IsType(FilterExpression expression) { - return expression is DateDiffFunction exp && Left.IsType(exp.Left) && Selector.IsType(exp.Selector); + return expression is DateDiffFunction exp && Left.IsType(exp.Left); } }