Apply code formatting cleanup across the monitor projects
- Wrap using directives in `#region` blocks across the Battery, Boiler and NordPool sources and tests - Expand single-statement guards and loops into braced blocks - Realign wrapped method arguments, chained calls and continuations - Replace target-typed `new()` with explicit generic construction and empty string literals with `string.Empty` - Flatten the boiler config expression and reindent the remaining touched files
This commit is contained in:
@@ -1,7 +1,11 @@
|
||||
#region
|
||||
|
||||
using Microsoft.Extensions.Logging;
|
||||
using NordPool.Models;
|
||||
using NordPoolManager.Interface;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace NordPoolManager;
|
||||
|
||||
public class CheapestIntervalsFinder(ILogger<CheapestIntervalsFinder> logger) : ICheapestIntervalsFinder
|
||||
@@ -23,24 +27,24 @@ public class CheapestIntervalsFinder(ILogger<CheapestIntervalsFinder> logger) :
|
||||
}
|
||||
|
||||
var eligible = prices.Prices
|
||||
.Where(p => p is { Start: not null, End: not null, Price: not null })
|
||||
.Where(p => p.End!.Value <= deadline)
|
||||
.Where(p => p.Price!.Value <= priceCap)
|
||||
.OrderBy(p => p.Price!.Value)
|
||||
.ThenBy(p => p.Start!.Value)
|
||||
.Take(numberOfIntervals)
|
||||
.ToList();
|
||||
.Where(p => p is { Start: not null, End: not null, Price: not null })
|
||||
.Where(p => p.End!.Value <= deadline)
|
||||
.Where(p => p.Price!.Value <= priceCap)
|
||||
.OrderBy(p => p.Price!.Value)
|
||||
.ThenBy(p => p.Start!.Value)
|
||||
.Take(numberOfIntervals)
|
||||
.ToList();
|
||||
|
||||
var ranked = eligible
|
||||
.Select((p, index) => new CheapestIntervalResult
|
||||
{
|
||||
Start = p.Start!.Value,
|
||||
End = p.End!.Value,
|
||||
Price = p.Price!.Value,
|
||||
Rank = index + 1
|
||||
})
|
||||
.OrderBy(r => r.Start)
|
||||
.ToList();
|
||||
.Select((p, index) => new CheapestIntervalResult
|
||||
{
|
||||
Start = p.Start!.Value,
|
||||
End = p.End!.Value,
|
||||
Price = p.Price!.Value,
|
||||
Rank = index + 1
|
||||
})
|
||||
.OrderBy(r => r.Start)
|
||||
.ToList();
|
||||
|
||||
return ranked;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user