Trial - boosting prospect grid loading performance

This commit is contained in:
troogs
2026-09-20 11:09:44 +02:00
parent 8b298b37c7
commit b33f9f6c52
15 changed files with 688 additions and 73 deletions
@@ -115,18 +115,24 @@ namespace FoodsharingSiegen.Server.Data.Service
.Include(x => x.Images)
.Include(x => x.Interactions.OrderBy(i => i.Date)).ThenInclude(x => x.User)
.OrderBy(x => x.Name).AsQueryable();
if(parameter.MustHaveInteractions != null && parameter.MustHaveInteractions.Any())
if (parameter.MustHaveInteractions != null && parameter.MustHaveInteractions.Any())
prospectsQuery = prospectsQuery.Where(x => x.Interactions.Any(i => parameter.MustHaveInteractions.Contains(i.Type)));
if(parameter.CannotHaveInteractions != null && parameter.CannotHaveInteractions.Any())
if (parameter.CannotHaveInteractions != null && parameter.CannotHaveInteractions.Any())
prospectsQuery = prospectsQuery.Where(x => x.Interactions.All(i => !parameter.CannotHaveInteractions.Contains(i.Type)));
if (!parameter.IncludeDeleted)
if (!parameter.IncludeDeleted)
prospectsQuery = prospectsQuery.Where(x => x.RecordState != RecordState.Archived);
if (parameter.Skip > 0)
prospectsQuery = prospectsQuery.Skip(parameter.Skip);
if (parameter.Take > 0)
prospectsQuery = prospectsQuery.Take(parameter.Take);
var prospects = await prospectsQuery.ToListAsync();
return new(prospects);
}
catch (Exception e)