Fix alarm analisys page

This commit is contained in:
Samuele Locatelli
2022-09-26 16:17:53 +02:00
parent 5f5a1dd5d7
commit 3babbcd5f2
2 changed files with 32 additions and 29 deletions
+3 -3
View File
@@ -33,7 +33,7 @@
{
<DetailOee currRecord="@currRecord"></DetailOee>
}*@
@if (ListRecordsFreq == null && setFreqDur || ListRecordsDur == null && !setFreqDur)
@if ((ListRecordsFreq == null && setFreqDur) || (ListRecordsDur == null && !setFreqDur))
{
<LoadingData></LoadingData>
}
@@ -71,7 +71,7 @@
</td>
<td>
<div>
@if (totalEvents != 0)
@if (totalVar != 0)
{
<span class="text-success">@calcPerc((double)record.EventCount)</span>
}
@@ -79,7 +79,7 @@
</td>
<td>
<div class="progress">
<div class="progress-bar @styleColourPBar((double)record.EventCount/totalEvents)" role="progressbar" style="@val((double)record.EventCount)" aria-valuemin="0" aria-valuemax="100">@record.EventCount</div>
<div class="progress-bar @styleColourPBar((double)record.EventCount/totalVar)" role="progressbar" style="@val((double)record.EventCount)" aria-valuemin="0" aria-valuemax="100">@record.EventCount</div>
</div>
</td>
</tr>
+29 -26
View File
@@ -28,13 +28,13 @@ namespace MP.MONO.UI.Pages
{
#region Private Fields
private AlarmFreqDTO currRecord = null;
private AlarmFreqDTO? currRecord = null;
private List<AlarmFreqDTO> ListRecordsFreq = null!;
private List<AlarmDurationDTO> ListRecordsDur = null!;
private List<AlarmFreqDTO>? ListRecordsFreq = null;
private List<AlarmDurationDTO>? ListRecordsDur = null;
private List<AlarmFreqDTO> SearchRecordsFreq = null!;
private List<AlarmDurationDTO> SearchRecordsDur = null!;
private List<AlarmFreqDTO>? SearchRecordsFreq = null;
private List<AlarmDurationDTO>? SearchRecordsDur = null;
#endregion Private Fields
@@ -43,7 +43,7 @@ namespace MP.MONO.UI.Pages
private int _currPage { get; set; } = 1;
private int _numRecord { get; set; } = 10;
protected int totalEvents = 0;
protected double totalVar = 0;
protected string percEvents = "";
private int currPage
@@ -135,22 +135,22 @@ namespace MP.MONO.UI.Pages
#region Protected Properties
protected int totalCount
{
get
{
int answ = 0;
if (SearchRecordsFreq != null && setFreqDur)
{
answ = SearchRecordsFreq.Count;
}
else
{
//answ = SearchRecordsDur.Count;
}
return answ;
}
}
protected int totalCount { get; set; } = 0;
//{
// get
// {
// int answ = 0;
// if (SearchRecordsFreq != null && setFreqDur)
// {
// answ = SearchRecordsFreq.Count;
// }
// else
// {
// //answ = SearchRecordsDur.Count;
// }
// return answ;
// }
//}
#endregion Protected Properties
@@ -166,7 +166,8 @@ namespace MP.MONO.UI.Pages
{
SearchRecordsFreq = CurrentDataService.dbController.AlarmRecGetParetoFreq(1, dtStart, dtEnd);
ListRecordsFreq = SearchRecordsFreq.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
totalEvents = SearchRecordsFreq.Sum(x => x.EventCount);
totalCount = SearchRecordsFreq.Count;
totalVar = SearchRecordsFreq.Sum(x => x.EventCount);
calcolaSoglie();
await Task.Delay(1);
}
@@ -174,6 +175,8 @@ namespace MP.MONO.UI.Pages
{
SearchRecordsDur = CurrentDataService.dbController.AlarmRecGetParetoDur(1, dtStart, dtEnd);
ListRecordsDur = SearchRecordsDur.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
totalCount = SearchRecordsDur.Count;
totalVar = SearchRecordsDur.Sum(x => x.Duration);
await Task.Delay(1);
}
await Task.Delay(1);
@@ -219,11 +222,11 @@ namespace MP.MONO.UI.Pages
var lastRecord = SearchRecordsFreq.Skip((int)(numRecord * 0.8)).FirstOrDefault();
if (firstRecord != null)
{
sogliaGreen = (double)firstRecord.EventCount / totalEvents;
sogliaGreen = (double)firstRecord.EventCount / totalVar;
}
if (lastRecord != null)
{
sogliaRed = (double)lastRecord.EventCount / totalEvents;
sogliaRed = (double)lastRecord.EventCount / totalVar;
}
}
@@ -233,7 +236,7 @@ namespace MP.MONO.UI.Pages
}
protected string calcPerc(double numEvent)
{
string ans = $"{numEvent / totalEvents:P2}";
string ans = $"{numEvent / totalVar:P2}";
return ans;
}