Add new filters and refactor InteractionDialog handling
Introduced new filters for prospects: "WithoutIdCheck" and "NoActivity" with associated UI controls. Refactored `InteractionDialog.ShowAsync` to use a new parameter record for cleaner code and better extensibility. These changes enhance usability and maintainability by providing additional filtering options and streamlining dialog interactions.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using FoodsharingSiegen.Contracts.Entity;
|
||||
using System.Linq.Expressions;
|
||||
using FoodsharingSiegen.Contracts.Entity;
|
||||
using FoodsharingSiegen.Contracts.Model;
|
||||
|
||||
namespace FoodsharingSiegen.Shared.Helper
|
||||
@@ -33,6 +34,18 @@ namespace FoodsharingSiegen.Shared.Helper
|
||||
|
||||
if (filter.WithoutStepInBriefing)
|
||||
filterListQ = filterListQ.Where(x => x.Interactions.All(i => i.Type != InteractionType.StepInBriefing));
|
||||
|
||||
if (filter.WithoutIdCheck)
|
||||
filterListQ = filterListQ.Where(x => x.Interactions.All(i => i.Type != InteractionType.IdCheck));
|
||||
|
||||
if (filter.NoActivity)
|
||||
{
|
||||
var days = 180; // Half year
|
||||
Func<Prospect, bool> q1 = x => x.Interactions.Any() && x.Interactions.All(i => DateTime.Now - i.Date > TimeSpan.FromDays(days));
|
||||
Func<Prospect, bool> q2 = x => DateTime.Now - x.Created > TimeSpan.FromDays(days);
|
||||
|
||||
filterListQ = filterListQ.Where(x => q1(x) && q2(x));
|
||||
}
|
||||
|
||||
return filterListQ.ToList();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user