This commit is contained in:
2021-08-24 00:06:05 +00:00
parent a500e5b6bd
commit fde9e29efc
2 changed files with 13 additions and 6 deletions

View File

@@ -198,8 +198,7 @@ namespace AyaNova.Biz
ILogger log = AyaNova.Util.ApplicationLogging.CreateLogger<UnitMeterReadingBiz>();
if (ServerBootConfig.SEEDING || ServerBootConfig.MIGRATING) return;
log.LogDebug($"HandlePotentialNotificationEvent processing: [AyaType:{this.BizType}, AyaEvent:{ayaEvent}]");
await Task.CompletedTask;
//SPECIFIC EVENTS FOR THIS OBJECT
//UnitMeterReadingMultipleExceeded event
@@ -222,7 +221,9 @@ namespace AyaNova.Biz
var lastMeterReading = await ct.UnitMeterReading.AsNoTracking()
.Where(x => x.UnitId == proposedObj.UnitId)
.OrderByDescending(z => z.MeterDate)
.Take(1).FirstOrDefaultAsync();
.Skip(1)//because it's already saved this current reading by the time it gets here
.Take(1)
.FirstOrDefaultAsync();
long lastReading = 0;
if (lastMeterReading != null)
lastReading = lastMeterReading.Meter;

View File

@@ -223,7 +223,7 @@ namespace AyaNova.Biz
if (ne.EventType == NotifyEventType.CustomerServiceImminent)
TranslationKeysToFetch.Add("NotifyEventCustomerServiceImminentMessage");
if (ne.DecValue != 0)
if (ne.DecValue != 0 && ne.EventType == NotifyEventType.WorkorderTotalExceedsThreshold)
{
TranslationKeysToFetch.Add("Total");
}
@@ -253,10 +253,16 @@ namespace AyaNova.Biz
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)
//DecValue
string DecDisplay = "";
//could be money or integer depending on typ
if (ne.DecValue != 0)
DecDisplay = $"{LT["Total"]}: {ne.DecValue.ToString("N2", System.Globalization.CultureInfo.InvariantCulture)}\n";
{
if (ne.EventType == NotifyEventType.WorkorderTotalExceedsThreshold)
DecDisplay = $"{LT["Total"]}: {ne.DecValue.ToString("N2", System.Globalization.CultureInfo.InvariantCulture)}\n";
else if (ne.EventType == NotifyEventType.UnitMeterReadingMultipleExceeded)
DecDisplay = $"{System.Convert.ToInt64(ne.DecValue).ToString()}\n";
}
string subject = "";