This commit is contained in:
@@ -56,15 +56,24 @@ namespace AyaNova.Api.Controllers
|
|||||||
|
|
||||||
var UserId = UserIdFromContext.Id(HttpContext.Items);
|
var UserId = UserIdFromContext.Id(HttpContext.Items);
|
||||||
var UType = UserTypeFromContext.Type(HttpContext.Items);
|
var UType = UserTypeFromContext.Type(HttpContext.Items);
|
||||||
|
|
||||||
|
|
||||||
|
//Adjust query dates to encompass actual view range
|
||||||
|
DateTime ViewStart = p.Start;
|
||||||
|
DateTime ViewEnd = p.End;
|
||||||
//this covers the largest possible window that could display due to nearly a week of the last or next month showing
|
//this covers the largest possible window that could display due to nearly a week of the last or next month showing
|
||||||
DateTime dtStart = p.Start.AddDays(-6);
|
if (p.View == ScheduleView.Month)
|
||||||
DateTime dtEnd = p.End.AddDays(6);
|
{
|
||||||
|
ViewStart = p.Start.AddDays(-6);
|
||||||
|
ViewEnd = p.End.AddDays(6);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//WORKORDERS
|
//WORKORDERS
|
||||||
if (p.WorkOrders && (UType == UserType.Service || UType == UserType.ServiceContractor))
|
if (p.WorkOrders && (UType == UserType.Service || UType == UserType.ServiceContractor))
|
||||||
{
|
{
|
||||||
r.AddRange(await ct.ViewSchedulePersonalWorkOrder.Where(x => x.SchedUserId == UserId && x.StartDate > dtStart && x.StopDate < dtEnd)
|
//Note: query for *overlapping* ranges, not *contained* entirely in view range
|
||||||
|
r.AddRange(await ct.ViewSchedulePersonalWorkOrder.Where(x => x.SchedUserId == UserId && ViewStart <= x.StopDate && x.StartDate <= ViewEnd)
|
||||||
.Select(x => MakeWOSchedItem(x, p))
|
.Select(x => MakeWOSchedItem(x, p))
|
||||||
.ToListAsync());
|
.ToListAsync());
|
||||||
}
|
}
|
||||||
@@ -141,7 +150,7 @@ namespace AyaNova.Api.Controllers
|
|||||||
|
|
||||||
public class PersonalScheduleParams
|
public class PersonalScheduleParams
|
||||||
{
|
{
|
||||||
public ScheduleView View {get;set;}
|
public ScheduleView View { get; set; }
|
||||||
public DateTime Start { get; set; }
|
public DateTime Start { get; set; }
|
||||||
public DateTime End { get; set; }
|
public DateTime End { get; set; }
|
||||||
public PersonalScheduleWorkOrderColorSource ColorSource { get; set; }
|
public PersonalScheduleWorkOrderColorSource ColorSource { get; set; }
|
||||||
|
|||||||
Reference in New Issue
Block a user