This commit is contained in:
2021-06-07 23:51:06 +00:00
parent a7fb80f609
commit a9adf85dce
2 changed files with 26 additions and 18 deletions

2
.vscode/launch.json vendored
View File

@@ -53,7 +53,7 @@
"AYANOVA_FOLDER_USER_FILES": "c:\\temp\\RavenTestData\\userfiles", "AYANOVA_FOLDER_USER_FILES": "c:\\temp\\RavenTestData\\userfiles",
"AYANOVA_FOLDER_BACKUP_FILES": "c:\\temp\\RavenTestData\\backupfiles", "AYANOVA_FOLDER_BACKUP_FILES": "c:\\temp\\RavenTestData\\backupfiles",
"AYANOVA_FOLDER_TEMPORARY_SERVER_FILES": "c:\\temp\\RavenTestData\\tempfiles", "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_SEEDLEVEL": "small",
"AYANOVA_SERVER_TEST_MODE_TZ_OFFSET": "-7", "AYANOVA_SERVER_TEST_MODE_TZ_OFFSET": "-7",
"AYANOVA_BACKUP_PG_DUMP_PATH": "C:\\data\\code\\postgres_13\\bin\\" "AYANOVA_BACKUP_PG_DUMP_PATH": "C:\\data\\code\\postgres_13\\bin\\"

View File

@@ -132,6 +132,9 @@ namespace AyaNova.Biz
await ct.SaveChangesAsync(); await ct.SaveChangesAsync();
continue; continue;
} }
//TIME DELAYED AGED EVENT? //TIME DELAYED AGED EVENT?
//when to time delay deliver formula:If sub.agevalue!= timespan.zero then deliver on = //when to time delay deliver formula:If sub.agevalue!= timespan.zero then deliver on =
//NotifyEvent "EventDate"+NotifySubscription.AgeValue timespan - NotifySubscription AdvanceNotice timespan > utcNow //NotifyEvent "EventDate"+NotifySubscription.AgeValue timespan - NotifySubscription AdvanceNotice timespan > utcNow
@@ -139,8 +142,13 @@ namespace AyaNova.Biz
//(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 //(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 //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) //deliver immediately-ish)
if (notifyevent.NotifySubscription.AgeValue != TimeSpan.Zero)
{ //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; var deliverAfter = notifyevent.EventDate + notifyevent.NotifySubscription.AgeValue - notifyevent.NotifySubscription.AdvanceNotice;
if (deliverAfter < DateTime.UtcNow) if (deliverAfter < DateTime.UtcNow)
{ {
@@ -153,22 +161,22 @@ namespace AyaNova.Biz
await DeliverSMTP(notifyevent, ct); 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 // //NORMAL IMMEDIATE DELIVERY EVENT
if (notifyevent.NotifySubscription.DeliveryMethod == NotifyDeliveryMethod.App) // if (notifyevent.NotifySubscription.DeliveryMethod == NotifyDeliveryMethod.App)
{ // {
await DeliverInApp(notifyevent, ct); // await DeliverInApp(notifyevent, ct);
} // }
if (notifyevent.NotifySubscription.DeliveryMethod == NotifyDeliveryMethod.SMTP) // if (notifyevent.NotifySubscription.DeliveryMethod == NotifyDeliveryMethod.SMTP)
{ // {
await DeliverSMTP(notifyevent, ct); // await DeliverSMTP(notifyevent, ct);
} // }
} // }
} }
} }