diff --git a/server/AyaNova/biz/NotifyEventProcessor.cs b/server/AyaNova/biz/NotifyEventProcessor.cs index e01f5a0c..f7e5e1b4 100644 --- a/server/AyaNova/biz/NotifyEventProcessor.cs +++ b/server/AyaNova/biz/NotifyEventProcessor.cs @@ -41,7 +41,7 @@ namespace AyaNova.Biz //Add event if there are subscribers //several optional conditional parameters - public static async Task UpsertEvent(NotifyEvent ev, List inTags = null, long? IdValue=null,TimeSpan? AgeValue=null,decimal? DecValue=null) + public static async Task UpsertEvent(NotifyEvent ev, List inTags = null, long? IdValue = null, TimeSpan? AgeValue = null, decimal? DecValue = null) { log.LogTrace($"UpsertEvent processing: [{ev.ToString()}]"); @@ -60,10 +60,10 @@ namespace AyaNova.Biz //find all the subs that are relevant //this first query ensures that the equality matching conditions of AyaType and EventType and idValue are matched leaving only more complex matches to rectify below - var subs = await ct.NotifySubscription.AsNoTracking().Where(z => z.EventType == ev.EventType && z.AyaType == ev.AyaType && z.IdValue==ev.IdValue).ToListAsync(); + var subs = await ct.NotifySubscription.AsNoTracking().Where(z => z.EventType == ev.EventType && z.AyaType == ev.AyaType && z.IdValue == ev.IdValue).ToListAsync(); foreach (var sub in subs) { - //Final condition if tags are specified + //Tags condition if (sub.Tags.Count > 0) { if (!HasTags) @@ -71,12 +71,20 @@ namespace AyaNova.Biz //bool existsCheck = list1.All(x => list2.Any(y => x.SupplierId == y.SupplierId)); //would tell you if all of list1's items are in list2. - if(!sub.Tags.All(z=> inTags.Any(x=>x==z))) - continue; + if (!sub.Tags.All(z => inTags.Any(x => x == z))) + continue; } + //Decimal value, so far only for "The Andy" so the only condition is that the event value be greater than or equal to subscription setting + if (ev.EventType == NotifyEventType.WorkorderTotalExceedsThreshold && ev.DecValue < sub.DecValue) + continue; + + //AgeValue + + + //Here we know the sub matches so create the NotifyEvent here - NotifyEvent ne=new NotifyEvent(){}; + NotifyEvent ne = new NotifyEvent() { };