This commit is contained in:
2021-09-16 19:01:01 +00:00
parent f780eaff4b
commit 4dc81baa81
3 changed files with 22 additions and 14 deletions

2
.vscode/launch.json vendored
View File

@@ -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\\"

View File

@@ -1,3 +1,7 @@
# HOME-SCHEDULE Placeholder
[Incomplete - under construction]
Notes to cover:
Null dates - schedule has no way to display null dates (e.g. woitemscheduser with no start or end date selected). Null dates must be viewed in data table lists instead.

View File

@@ -60,7 +60,9 @@ namespace AyaNova.Api.Controllers
var UType = UserTypeFromContext.Type(HttpContext.Items);
//Adjust query dates to encompass actual view range
//Note: query will return records that fall within viewed range even if they start or end outside of it
//However in month view (only, rest are as is) we can see up to 6 days before or after the month so in the interest of filling those voids:
//Adjust query dates to encompass actual potential 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
@@ -70,7 +72,6 @@ namespace AyaNova.Api.Controllers
ViewEnd = p.End.AddDays(6);
}
//WORKORDERS
if (p.WorkOrders && (UType == UserType.Service || UType == UserType.ServiceContractor))
{
@@ -88,19 +89,19 @@ namespace AyaNova.Api.Controllers
s.Id = v.WoItemSchedUserId;
s.Color = ColorFromWOItem(v, p);
s.TextColor = TextColor(s.Color);
s.Start = EpochSeconds(v.StartDate, p.TZOffset);
s.End = EpochSeconds(v.StopDate, p.TZOffset);
s.Start = (DateTime)v.StartDate;
s.End = (DateTime)v.StopDate;
s.Type = AyaType.WorkOrderItemScheduledUser;
s.Name = NameFromWOItem(v, p);
return s;
}
private static long? EpochSeconds(DateTime? dt, int tzOffset = 0)
{
if (dt == null) return null;
DateTimeOffset dto = new DateTimeOffset((DateTime)dt);
return dto.ToUnixTimeMilliseconds() + (tzOffset * 60000);
}
// private static long? EpochSeconds(DateTime? dt, int tzOffset = 0)
// {
// if (dt == null) return null;
// DateTimeOffset dto = new DateTimeOffset((DateTime)dt);
// return dto.ToUnixTimeMilliseconds() + (tzOffset * 60000);
// }
private static string ColorFromWOItem(ViewSchedulePersonalWorkOrder v, PersonalScheduleParams p)
{
@@ -153,7 +154,6 @@ namespace AyaNova.Api.Controllers
public class PersonalScheduleParams
{
public ScheduleView View { get; set; }
public int TZOffset { get; set; }
public DateTime Start { get; set; }
public DateTime End { get; set; }
public PersonalScheduleWorkOrderColorSource ColorSource { get; set; }
@@ -164,8 +164,12 @@ namespace AyaNova.Api.Controllers
public class PersonalScheduleListItem
{
public long? Start { get; set; }
public long? End { get; set; }
//Never be null dates in here even though source records might be have null dates because they are not queried for and
//can't be displayed on a calendar anyway
//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 bool Timed { get { return true; } }
public string Name { get; set; }
public string Color { get; set; }