From 4dc81baa8141908e4080145afc1ccc97c19a19b3 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Thu, 16 Sep 2021 19:01:01 +0000 Subject: [PATCH] --- .vscode/launch.json | 2 +- docs/8.0/ayanova/docs/home-schedule.md | 4 +++ .../AyaNova/Controllers/ScheduleController.cs | 30 +++++++++++-------- 3 files changed, 22 insertions(+), 14 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 976f60e9..f92c39ec 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -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\\" diff --git a/docs/8.0/ayanova/docs/home-schedule.md b/docs/8.0/ayanova/docs/home-schedule.md index 2d040a41..14f7d286 100644 --- a/docs/8.0/ayanova/docs/home-schedule.md +++ b/docs/8.0/ayanova/docs/home-schedule.md @@ -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. \ No newline at end of file diff --git a/server/AyaNova/Controllers/ScheduleController.cs b/server/AyaNova/Controllers/ScheduleController.cs index ad1fb0da..41bbc3a5 100644 --- a/server/AyaNova/Controllers/ScheduleController.cs +++ b/server/AyaNova/Controllers/ScheduleController.cs @@ -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; }