From a9adf85dcec6ec58344b3fee820ef893834d9766 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Mon, 7 Jun 2021 23:51:06 +0000 Subject: [PATCH] --- .vscode/launch.json | 2 +- server/AyaNova/generator/CoreJobNotify.cs | 42 ++++++++++++++--------- 2 files changed, 26 insertions(+), 18 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index fcc80a75..b77f3b95 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -53,7 +53,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/server/AyaNova/generator/CoreJobNotify.cs b/server/AyaNova/generator/CoreJobNotify.cs index 7f217c80..40edfaec 100644 --- a/server/AyaNova/generator/CoreJobNotify.cs +++ b/server/AyaNova/generator/CoreJobNotify.cs @@ -132,15 +132,23 @@ namespace AyaNova.Biz await ct.SaveChangesAsync(); continue; } + + + //TIME DELAYED AGED EVENT? //when to time delay deliver formula:If sub.agevalue!= timespan.zero then deliver on = //NotifyEvent "EventDate"+NotifySubscription.AgeValue timespan - NotifySubscription AdvanceNotice timespan > utcNow //Is it time delayed? //(NOTE: some direct notifications in app e.g. overdue review will have a future date set as a deadman switch to deliver after unless completed before then //their EventDate will be that future date, however regular in app notifications will go through here too but their evendate will be the moment they are created so should still - //deliver immediately-ish) - if (notifyevent.NotifySubscription.AgeValue != TimeSpan.Zero) - { + //deliver immediately-ish) + + //NOTE: There is no need to separate out future delivery and immediate delivery because + // All events have an event date, it's either immediate upon creation or it's future + //but not all events ahve an age value including ones with future event dates, + // and the default agevalue and advancenotice are both zero regardless so the block below works for either future or immediate deliveries + // if (notifyevent.NotifySubscription.AgeValue != TimeSpan.Zero) + // { var deliverAfter = notifyevent.EventDate + notifyevent.NotifySubscription.AgeValue - notifyevent.NotifySubscription.AdvanceNotice; if (deliverAfter < DateTime.UtcNow) { @@ -153,22 +161,22 @@ namespace AyaNova.Biz await DeliverSMTP(notifyevent, ct); } } - } - else - { + // } + // else + // { - //COULD BE TIME DELAYED BUT WITHOUT AGE, i.e. EventDate takes precedence? + // //COULD BE TIME DELAYED BUT WITHOUT AGE, i.e. EventDate takes precedence? - //NORMAL IMMEDIATE DELIVERY EVENT - if (notifyevent.NotifySubscription.DeliveryMethod == NotifyDeliveryMethod.App) - { - await DeliverInApp(notifyevent, ct); - } - if (notifyevent.NotifySubscription.DeliveryMethod == NotifyDeliveryMethod.SMTP) - { - await DeliverSMTP(notifyevent, ct); - } - } + // //NORMAL IMMEDIATE DELIVERY EVENT + // if (notifyevent.NotifySubscription.DeliveryMethod == NotifyDeliveryMethod.App) + // { + // await DeliverInApp(notifyevent, ct); + // } + // if (notifyevent.NotifySubscription.DeliveryMethod == NotifyDeliveryMethod.SMTP) + // { + // await DeliverSMTP(notifyevent, ct); + // } + // } } }