Fix selezione interventi nel periodo

This commit is contained in:
Samuele Locatelli
2022-06-11 12:42:42 +02:00
parent d798e91055
commit 05c26f4e53
6 changed files with 79 additions and 47 deletions
+16 -13
View File
@@ -85,17 +85,6 @@ namespace MP.MONO.UI.Data
return await Task.FromResult(dbResult);
}
public async Task<bool> createMissingSchedTask(int machineId)
{
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
bool answ = await dbController.SchedMaintTaskCreateMissing(machineId);
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Trace($"Effettuata chiamata a createMissingSchedTask: {ts.TotalMilliseconds} ms");
return await Task.FromResult(answ);
}
public async Task<List<DataLogModel>> DataLogGetFilt(int machineId, string fluxType, DateTime inizio, DateTime fine)
{
Stopwatch stopWatch = new Stopwatch();
@@ -334,11 +323,25 @@ namespace MP.MONO.UI.Data
return await Task.FromResult(dbResult);
}
public async Task<List<ScheduledMaintModel>> SchedMaintTaskGetFilt(int machineId, int skipRec, int numRec, bool showCompleted)
public async Task<bool> SchedMaintTaskCreateMissing(int machineId)
{
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
List<ScheduledMaintModel>? dbResult = dbController.SchedMaintTaskGetFilt(machineId, skipRec, numRec, showCompleted);
bool answ = await dbController.SchedMaintTaskCreateMissing(machineId);
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Trace($"Effettuata chiamata a createMissingSchedTask: {ts.TotalMilliseconds} ms");
return await Task.FromResult(answ);
}
public async Task<List<ScheduledMaintModel>> SchedMaintTaskGetFilt(int machineId, int maxRemain, int skipRec, int numRec, bool showCompleted)
{
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
// ricerca sul DB "raw"
List<ScheduledMaintModel>? rawResult = dbController.SchedMaintTaskGetFilt(machineId, skipRec, numRec, showCompleted);
// filtro ulteriormente ora...
var dbResult = rawResult.Where(x => x.CountRemainVal <= maxRemain || maxRemain == 0).ToList();
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Trace($"Effettuata lettura da DB SchedMaintTaskGetFilt: {ts.TotalMilliseconds} ms");