Merge pull request 'fix(query): modernize CalculationFilterGroup and adjust IsValid behavior' (#4) from fix/Sonarqube-Tech-Debt-v2 into main
SonarQube Analysis / sonarqube (push) Successful in 3m31s
SonarQube Analysis / sonarqube (push) Successful in 3m31s
Reviewed-on: #4
This commit was merged in pull request #4.
This commit is contained in:
@@ -23,7 +23,9 @@
|
||||
"Bash(Get-ChildItem src/Strata.SqlTools.SqlServer/ExpressionFactory/Query/*.cs)",
|
||||
"Bash(Measure-Object)",
|
||||
"Bash(Select-Object -ExpandProperty Count)",
|
||||
"PowerShell(dotnet build *)"
|
||||
"PowerShell(dotnet build *)",
|
||||
"Bash(Get-ChildItem src/Strata.SqlTools.Query/*.cs)",
|
||||
"Bash(Select-String -Pattern '^namespace ')"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,24 +2,16 @@ using System.Text.Json.Serialization;
|
||||
|
||||
namespace Strata.SqlTools.Query;
|
||||
|
||||
public class CalculationFilterGroup
|
||||
[method: JsonConstructor]
|
||||
public class CalculationFilterGroup(IEnumerable<CalculationFilter> filters, LogicalOperator logicalOperator)
|
||||
{
|
||||
// Hereditary logical operation applied to all Filters
|
||||
public LogicalOperator LogicalOperator { get; set; }
|
||||
public LogicalOperator LogicalOperator { get; set; } = logicalOperator;
|
||||
|
||||
public IEnumerable<CalculationFilter> Filters { get; set; }
|
||||
public IEnumerable<CalculationFilter> Filters { get; set; } = filters;
|
||||
|
||||
public CalculationFilterGroup()
|
||||
public CalculationFilterGroup() : this([], LogicalOperator.And)
|
||||
{
|
||||
LogicalOperator = LogicalOperator.And;
|
||||
Filters = new List<CalculationFilter>();
|
||||
}
|
||||
|
||||
[JsonConstructor]
|
||||
public CalculationFilterGroup(IEnumerable<CalculationFilter> filters, LogicalOperator logicalOperator)
|
||||
{
|
||||
Filters = filters;
|
||||
LogicalOperator = logicalOperator;
|
||||
}
|
||||
|
||||
public IEnumerable<CalculationFilter> GetValidFilters()
|
||||
@@ -29,6 +21,6 @@ public class CalculationFilterGroup
|
||||
|
||||
public bool IsValid()
|
||||
{
|
||||
return Filters != null && Filters.Any(x => x.IsValid());
|
||||
return Filters.All(x => x.IsValid());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user