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;