Refactor UpdateCheapestIntervals logic to return a result object and improve code readability. Introduce CheapestIntervalsUpdateResult model for encapsulating update details and simplify inline tuples.
This commit is contained in:
@@ -40,6 +40,7 @@ public class NordPoolEntityService(IEntityManager entityManager, ILogger<NordPoo
|
||||
try
|
||||
{
|
||||
logger.LogInformation("Creating/re-registering MQTT entity: {EntityId}", nordPoolEntity.EntityId);
|
||||
|
||||
await entityManager.CreateEntityAsync(nordPoolEntity);
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -310,11 +311,11 @@ public class NordPoolEntityService(IEntityManager entityManager, ILogger<NordPoo
|
||||
return entries;
|
||||
}
|
||||
|
||||
private static IReadOnlyList<NordPoolDayPrice> MergeTodayTomorrowPrices(
|
||||
NordPoolPrice? today, NordPoolPrice? tomorrow)
|
||||
private static List<NordPoolDayPrice> MergeTodayTomorrowPrices(NordPoolPrice? today, NordPoolPrice? tomorrow)
|
||||
{
|
||||
var todayList = today?.Prices ?? [];
|
||||
var tomorrowList = tomorrow?.Prices ?? [];
|
||||
|
||||
return todayList
|
||||
.Concat(tomorrowList)
|
||||
.Where(p => p?.Start != null)
|
||||
|
||||
Reference in New Issue
Block a user