Merge branch 'main' into hotfix/ComsMessageQueue-throws-exception

This commit is contained in:
Andrew Welker
2021-01-26 12:45:14 -07:00
committed by GitHub

View File

@@ -64,30 +64,34 @@ namespace PepperDash.Essentials.Core
initialStatus = MonitorStatus.InWarning; initialStatus = MonitorStatus.InWarning;
prefix = "2:"; prefix = "2:";
} }
else if (InWarning.Count() > 0) else if (IsOk.Count() > 0)
initialStatus = MonitorStatus.IsOk; initialStatus = MonitorStatus.IsOk;
else else
initialStatus = MonitorStatus.StatusUnknown; initialStatus = MonitorStatus.StatusUnknown;
// Build the error message string // Build the error message string
if (InError.Count() > 0 || InWarning.Count() > 0) if (InError.Count() > 0 || InWarning.Count() > 0)
{ {
StringBuilder sb = new StringBuilder(prefix); StringBuilder sb = new StringBuilder(prefix);
if (InError.Count() > 0) if (InError.Count() > 0)
{ {
// Do string splits and joins // Do string splits and joins
sb.Append(string.Format("{0} Errors:", InError.Count())); sb.Append(string.Format("{0} Errors:", InError.Count()));
foreach (var mon in InError) foreach (var mon in InError)
sb.Append(string.Format("{0}, ", mon.Parent.Key)); sb.Append(string.Format("{0}, ", mon.Parent.Key));
} }
if (InWarning.Count() > 0) if (InWarning.Count() > 0)
{ {
sb.Append(string.Format("{0} Warnings:", InWarning.Count())); sb.Append(string.Format("{0} Warnings:", InWarning.Count()));
foreach (var mon in InWarning) foreach (var mon in InWarning)
sb.Append(string.Format("{0}, ", mon.Parent.Key)); sb.Append(string.Format("{0}, ", mon.Parent.Key));
} }
Message = sb.ToString(); Message = sb.ToString();
} }
else
{
Message = "Room Ok.";
}
// Want to fire even if status doesn't change because the message may. // Want to fire even if status doesn't change because the message may.
Status = initialStatus; Status = initialStatus;