Skip to content

Commit

Permalink
OR filtering tests - multiple properties (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
Biarity authored Apr 19, 2018
1 parent b041c0b commit 3e671f5
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion Sieve/Models/SieveModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,19 @@ public List<IFilterTerm> FiltersParsed
var value = new List<IFilterTerm>();
foreach (var filter in Filters.Split(','))
{
value.Add(new FilterTerm(filter));
if (filter.StartsWith("("))
{
var filterOpAndVal = filter.Substring(filter.LastIndexOf(")") + 1);
filter = filter.Replace(subfilterOpAndVal, "").Replace("(", "").Replace(")","");
foreach (var subfilter in filter.Split("|"))
{
value.Add(new FilterTerm(subfilter + filterOpAndVal))
}
}
else
{
value.Add(new FilterTerm(filter));
}
}
return value;
}
Expand Down

0 comments on commit 3e671f5

Please sign in to comment.