diff --git a/server/AyaNova/biz/WorkOrderBiz.cs b/server/AyaNova/biz/WorkOrderBiz.cs index 659a1668..d18894c5 100644 --- a/server/AyaNova/biz/WorkOrderBiz.cs +++ b/server/AyaNova/biz/WorkOrderBiz.cs @@ -1466,7 +1466,7 @@ namespace AyaNova.Biz AyaType = AyaType.WorkOrder, ObjectId = oProposed.WorkOrderId, NotifySubscriptionId = sub.Id, - Name = $"{WorkorderInfo.Serial.ToString()} - {wos.Name}", + Name = $"{WorkorderInfo.Serial.ToString()}", DecValue = GrandTotal }; await ct.NotifyEvent.AddAsync(n); diff --git a/server/AyaNova/generator/CoreJobNotify.cs b/server/AyaNova/generator/CoreJobNotify.cs index b501c446..c879aaaf 100644 --- a/server/AyaNova/generator/CoreJobNotify.cs +++ b/server/AyaNova/generator/CoreJobNotify.cs @@ -120,7 +120,19 @@ namespace AyaNova.Biz private static async Task DeliverInApp(NotifyEvent ne, TimeSpan ageValue, AyContext ct) { log.LogTrace($"DeliverInApp notify event: {ne}"); - await ct.Notification.AddAsync(new Notification() { UserId = ne.UserId, AyaType = ne.AyaType, ObjectId = ne.ObjectId, EventType = ne.EventType, NotifySubscriptionId = ne.NotifySubscriptionId, Message = ne.Message, Name = ne.Name, AgeValue = ageValue }); + await ct.Notification.AddAsync( + new Notification() + { + UserId = ne.UserId, + AyaType = ne.AyaType, + ObjectId = ne.ObjectId, + EventType = ne.EventType, + NotifySubscriptionId = ne.NotifySubscriptionId, + Message = ne.Message, + Name = ne.Name, + AgeValue = ageValue, + DecValue = ne.DecValue + }); await ct.SaveChangesAsync(); ct.NotifyEvent.Remove(ne); await ct.SaveChangesAsync(); @@ -182,6 +194,12 @@ namespace AyaNova.Biz if (ageValue != TimeSpan.Zero) AgeDisplay = $"({AyaNova.Util.DateUtil.FormatTimeSpan(ageValue, LT["TimeSpanDays"], LT["TimeSpanHours"], LT["TimeSpanMinutes"], LT["TimeSpanSeconds"])})\n"; + + //DecValue (only for TheAndy for now workorder exceedsthreshold so not putting a lot of localization effort in; in app will localize properly) + string DecDisplay= ""; + if(ne.DecValue!=0) + DecDisplay=ne.DecValue.ToString("N2", System.Globalization.CultureInfo.InvariantCulture); + string subject = ""; @@ -200,7 +218,7 @@ namespace AyaNova.Biz subject = $"AY:{AyaTypeTranslated}:{name}:{SubscriptionTypeName}"; if (ne.ObjectId != 0 || ne.EventType == NotifyEventType.BackupStatus) { - body = $"{AgeDisplay}{AyaTypeTranslated}\n{OpenObjectUrlBuilder(ne.AyaType, ne.ObjectId, ne.EventType)}\n"; + body = $"{AgeDisplay}{DecDisplay}{AyaTypeTranslated}\n{OpenObjectUrlBuilder(ne.AyaType, ne.ObjectId, ne.EventType)}\n"; } body += ne.Message; break; diff --git a/server/AyaNova/models/Notification.cs b/server/AyaNova/models/Notification.cs index ad24eff4..e083242f 100644 --- a/server/AyaNova/models/Notification.cs +++ b/server/AyaNova/models/Notification.cs @@ -28,6 +28,7 @@ namespace AyaNova.Models public long NotifySubscriptionId { get; set; } public string Message { get; set; } public TimeSpan AgeValue { get; set; } + public decimal DecValue { get; set; } [Required] public bool Fetched { get; set; } @@ -37,6 +38,7 @@ namespace AyaNova.Models Fetched = false; Name = string.Empty; AgeValue = TimeSpan.Zero; + DecValue = 0m; } //linked entity diff --git a/server/AyaNova/util/AySchema.cs b/server/AyaNova/util/AySchema.cs index fc4ad66c..b9a6edac 100644 --- a/server/AyaNova/util/AySchema.cs +++ b/server/AyaNova/util/AySchema.cs @@ -22,7 +22,7 @@ namespace AyaNova.Util //!!!!WARNING: BE SURE TO UPDATE THE DbUtil::EmptyBizDataFromDatabaseForSeedingOrImporting WHEN NEW TABLES ADDED!!!! private const int DESIRED_SCHEMA_LEVEL = 1; - internal const long EXPECTED_COLUMN_COUNT = 927; + internal const long EXPECTED_COLUMN_COUNT = 928; internal const long EXPECTED_INDEX_COUNT = 137; internal const long EXPECTED_CHECK_CONSTRAINTS = 415; internal const long EXPECTED_FOREIGN_KEY_CONSTRAINTS = 116; @@ -943,7 +943,7 @@ $BODY$ LANGUAGE PLPGSQL STABLE"); await ExecQueryAsync("CREATE TABLE anotification (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, userid BIGINT NOT NULL REFERENCES auser (id), " + "created TIMESTAMP NOT NULL, ayatype INTEGER NOT NULL, objectid BIGINT NOT NULL, name TEXT NOT NULL, agevalue INTERVAL, eventtype INTEGER NOT NULL, " - + "notifysubscriptionid BIGINT NOT NULL REFERENCES anotifysubscription(id) ON DELETE CASCADE, message TEXT, fetched BOOL NOT NULL)"); + + "decvalue DECIMAL(38,18) NULL, notifysubscriptionid BIGINT NOT NULL REFERENCES anotifysubscription(id) ON DELETE CASCADE, message TEXT, fetched BOOL NOT NULL)"); await ExecQueryAsync("CREATE TABLE anotifydeliverylog (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, processed TIMESTAMP NOT NULL, " + "ayatype INTEGER NOT NULL, objectid BIGINT NOT NULL, eventtype INTEGER NOT NULL, notifysubscriptionid BIGINT NOT NULL, idvalue BIGINT NOT NULL, "