-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
To investigate and dig into this issue with the below code.
var query = Context.Inspectors
.Where(i => !i.IsDeleted && i.FieldEvaluationRelevantJobs.Any() && i.FieldEvaluationPendingDate != null);
if (search != null)
{
query = query.Where(i => i.User.Person.FirstName.Contains(search) || i.User.Person.LastName.Contains(search));
}
results.Total = query.Count();
query = query.OrderBy(i => i.FieldEvaluationPendingDate.Value); // order before taking the top
query = query.Take(50);
var fieldEvals = query.Select(i => new InspectorFieldEvaluationsDto
{
Name = i.User.Person.DisplayName,
InspectorId = i.Id,
Reason = i.FieldEvaluationReason,
DueDate = i.FieldEvaluationPendingDate.Value,
Status = "Pending since " + i.FieldEvaluationPendingDate.Value.ToString("dd-MMM-yyyy"),
RelevantJobs = i.FieldEvaluationRelevantJobs.Count(),
Jobs = i.FieldEvaluationRelevantJobs.Select(j => new FieldEvaluationJobsDto
{
Client = j.Project.Client.Name,
ClientId = j.Project.ClientId,
Job = j.Code,
JobId = j.Id,
Project = j.Project.Name,
ProjectId = j.ProjectId,
PlaceOfInspection = j.Site.Name,
PlaceOfInspectionId = j.SiteId,
Coordinator = j.CoordinatingOfficeCoordinator.DisplayName,
CoordinatorId = j.CoordinatingOfficeCoordinatorId
}).ToList()
}).ThenDoDeferred(new LinqDeferConfiguration(() => new LinqDefer.ExpressionAnalysers.DataAccessOnly.DataAccessOnlyAnalyser()));
Metadata
Metadata
Assignees
Labels
No labels