From e356b7816b29596074b8f47f6c601ff6272b451e Mon Sep 17 00:00:00 2001 From: sawinglogz <3787776-sawinglogz@users.noreply.gitlab.com> Date: Thu, 24 Oct 2019 12:19:13 -0400 Subject: [PATCH] Don't treat a 0-length compliance file as a failure in parsing. This fixes the start/end times of such compliance sessions, but their total_time is broken due to the presence of a 0-length slice. That will require a more extensive fix of the slice system throughout the program. --- oscar/SleepLib/loader_plugins/prs1_loader.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/oscar/SleepLib/loader_plugins/prs1_loader.cpp b/oscar/SleepLib/loader_plugins/prs1_loader.cpp index e88541ba..289b3e01 100644 --- a/oscar/SleepLib/loader_plugins/prs1_loader.cpp +++ b/oscar/SleepLib/loader_plugins/prs1_loader.cpp @@ -1454,7 +1454,7 @@ PRS1_DURATION_EVENT(PRS1UnknownDurationEvent, EV_PRS1_UNK_DURATION); PRS1_DURATION_EVENT(PRS1HypopneaEvent, EV_PRS1_HY); PRS1_VALUE_EVENT(PRS1TotalLeakEvent, EV_PRS1_TOTLEAK); -PRS1_VALUE_EVENT(PRS1LeakEvent, EV_PRS1_LEAK); // TODO: do machines really report unintentional leak? +PRS1_VALUE_EVENT(PRS1LeakEvent, EV_PRS1_LEAK); PRS1_PRESSURE_EVENT(PRS1AutoPressureSetEvent, EV_PRS1_AUTO_PRESSURE_SET); PRS1_PRESSURE_EVENT(PRS1PressureSetEvent, EV_PRS1_PRESSURE_SET); @@ -3889,12 +3889,12 @@ bool PRS1Import::ImportCompliance() } if (compliance->duration == 0) { // This does occasionally happen and merely indicates a brief session with no useful data. - qDebug() << compliance->sessionid << "duration == 0"; - return false; + // This requires the use of really_set_last below, which otherwise rejects 0 length. + qDebug() << compliance->sessionid << "compliance duration == 0"; } session->setSummaryOnly(true); session->set_first(start); - session->set_last(qint64(compliance->timestamp + compliance->duration) * 1000L); + session->really_set_last(qint64(compliance->timestamp + compliance->duration) * 1000L); return true; } @@ -7133,6 +7133,10 @@ bool PRS1Import::ParseSession(void) break; } + // TODO: filter out 0-length slices, since they cause problems for Day::total_time() + // and possibly filter out everything except mask on/off, since the gSessionTimesChart::paint + // assumes that assumes that. Or rework the slice system to be more robust. + if (event != nullptr) { ok = ParseEvents(); if (!ok) {