This commit is contained in:
2
.vscode/launch.json
vendored
2
.vscode/launch.json
vendored
@@ -52,7 +52,7 @@
|
||||
"AYANOVA_FOLDER_USER_FILES": "c:\\temp\\RavenTestData\\userfiles",
|
||||
"AYANOVA_FOLDER_BACKUP_FILES": "c:\\temp\\RavenTestData\\backupfiles",
|
||||
"AYANOVA_FOLDER_TEMPORARY_SERVER_FILES": "c:\\temp\\RavenTestData\\tempfiles",
|
||||
"AYANOVA_SERVER_TEST_MODE": "true",
|
||||
"AYANOVA_SERVER_TEST_MODE": "false",
|
||||
"AYANOVA_SERVER_TEST_MODE_SEEDLEVEL": "small",
|
||||
"AYANOVA_SERVER_TEST_MODE_TZ_OFFSET": "-7",
|
||||
"AYANOVA_BACKUP_PG_DUMP_PATH": "C:\\data\\code\\postgres_13\\bin\\"
|
||||
|
||||
@@ -91,10 +91,31 @@ namespace AyaNova.Api.Controllers
|
||||
ViewEnd = p.End.AddDays(6);
|
||||
}
|
||||
|
||||
|
||||
//Tags to Users
|
||||
List<long> Users = null;
|
||||
|
||||
if (p.Tags.Count == 0)
|
||||
Users = await ct.User.AsNoTracking().Where(x => x.Active == true && x.UserType == UserType.ServiceContractor || x.UserType == UserType.Service).OrderBy(x => x.Name).Select(x => x.Id).ToListAsync();
|
||||
else
|
||||
{
|
||||
Users = new List<long>();
|
||||
//add users that match any of the tags, to match they must have at least one of the tags
|
||||
//iterate available users
|
||||
var availableUsers = await ct.User.AsNoTracking().Where(x => x.Active == true && x.UserType == UserType.ServiceContractor || x.UserType == UserType.Service).OrderBy(x => x.Name).Select(x => new { x.Id, x.Tags }).ToListAsync();
|
||||
//if user has any of the tags in the list then include them
|
||||
foreach (var u in availableUsers)
|
||||
{
|
||||
//any of the inclusive tags in contact tags?
|
||||
if (p.Tags.Intersect(u.Tags).Any())
|
||||
Users.Add(u.Id);
|
||||
}
|
||||
|
||||
}
|
||||
//WORKORDERS
|
||||
{
|
||||
//Note: query for *overlapping* ranges, not *contained* entirely in view range
|
||||
r.AddRange(await ct.ViewScheduleWorkOrder.Where(x => p.Users.Contains(x.SchedUserId) && ViewStart <= x.StopDate && x.StartDate <= ViewEnd)
|
||||
r.AddRange(await ct.ViewScheduleWorkOrder.Where(x => Users.Contains(x.SchedUserId) && ViewStart <= x.StopDate && x.StartDate <= ViewEnd)
|
||||
.Select(x => MakeServiceWOSchedItem(x, p))
|
||||
.ToListAsync());
|
||||
}
|
||||
@@ -111,8 +132,10 @@ namespace AyaNova.Api.Controllers
|
||||
public DateTime End { get; set; }
|
||||
[Required]
|
||||
public ScheduleWorkOrderColorSource WisuColorSource { get; set; }
|
||||
// [Required]
|
||||
// public List<long> Users { get; set; }//user id's to display and in order to display
|
||||
[Required]
|
||||
public List<long> Users { get; set; }//user id's to display and in order to display
|
||||
public List<string> Tags { get; set; }
|
||||
[Required]
|
||||
public bool Dark { get; set; }//indicate if Client is set to dark mode or not, used for colorless types to display as black or white
|
||||
}
|
||||
@@ -259,7 +282,7 @@ namespace AyaNova.Api.Controllers
|
||||
s.Type = AyaType.WorkOrderItemScheduledUser;
|
||||
s.Name = NameFromWOItem(v);
|
||||
s.Editable = v.WorkOrderStatusCompleted != true && v.WorkOrderStatusLocked != true;//could be null as well which we'll consider open as it's no status set
|
||||
s.UserId=v.SchedUserId;
|
||||
s.UserId = v.SchedUserId;
|
||||
return s;
|
||||
}
|
||||
|
||||
@@ -407,7 +430,7 @@ namespace AyaNova.Api.Controllers
|
||||
//user can simply filter a data table by null dates to see them
|
||||
//we shouldn't have allowed null dates in the first place in v7 but here we are :)
|
||||
public DateTime Start { get; set; }
|
||||
public DateTime End { get; set; }
|
||||
public DateTime End { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Color { get; set; }
|
||||
public string TextColor { get; set; }
|
||||
|
||||
Reference in New Issue
Block a user