From 8f3971cb093a9bc2e9272867a575a1fabda0731a Mon Sep 17 00:00:00 2001 From: Guy Scharf Date: Wed, 12 Aug 2020 17:26:14 -0700 Subject: [PATCH] Fix maskon/off vs session count comparison for deciding when to re-import a day --- oscar/SleepLib/loader_plugins/resmed_loader.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/oscar/SleepLib/loader_plugins/resmed_loader.cpp b/oscar/SleepLib/loader_plugins/resmed_loader.cpp index a6e8fa83..06643fbe 100644 --- a/oscar/SleepLib/loader_plugins/resmed_loader.cpp +++ b/oscar/SleepLib/loader_plugins/resmed_loader.cpp @@ -719,13 +719,20 @@ void ResmedLoader::checkSummaryDay( ResMedDay & resday, QDate date, Machine * ma } } else { qDebug() << "Have summary and details for this date!"; - if (day->size() == (resday.str.maskevents/2) ) { - qDebug() << "No new sessions -- skipping"; + QList sessions = day->getSessions(MT_CPAP, true); + if (sessions.length() == (resday.str.maskevents/2) ) { + qDebug() << "No new sessions -- skipping. Sessions now in day:"; + qDebug() << " i sessionID s_first from - to"; + for (int i=0; i < sessions.length(); i++) { + qDebug().noquote() << i << sessions[i]->session() + << sessions[i]->first() + << QDateTime::fromMSecsSinceEpoch(sessions[i]->first()).toString(" hh:mm:ss") + << "-" << QDateTime::fromMSecsSinceEpoch(sessions[i]->last()).toString("hh:mm:ss"); + } return; } qDebug() << "Maskevent count" << resday.str.maskevents << "is not twice the existing session count" << day->size(); qDebug() << "Clean the day and re-import it"; - QList sessions = day->getSessions(MT_CPAP); for (auto & sess : sessions) { day->removeSession(sess); delete sess;