From 77b64c87e8c5202cfa421532ff20410e54767b76 Mon Sep 17 00:00:00 2001 From: Guy Scharf Date: Sat, 21 Nov 2020 11:45:43 -0700 Subject: [PATCH] Fix loss of notes and bookmarks when importing or purging data OSCAR now calls Unload() for the current day when importing new data or purging oximetry data. This will cause any recently changes Notes to be saved instead of silently discarded. When purging the current day, OSCAR will now purge only session data and not any other machine data it finds, which caused Bookmarks (and probably Oximetry data) to be deleted as well. Release Notes updated. --- Htmldocs/release_notes.html | 2 ++ oscar/mainwindow.cpp | 15 +++++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/Htmldocs/release_notes.html b/Htmldocs/release_notes.html index 7786bb66..affaa8de 100644 --- a/Htmldocs/release_notes.html +++ b/Htmldocs/release_notes.html @@ -22,6 +22,8 @@
  • [fix] Fix crash and other problems when disabling an oximeter session on Daily page when a bookmark was present.
  • [fix] Fix rare problem of OSCAR crashing with unusual Journal file.
  • [fix] ResMed loader no longer rejects data from an earlier timezone or DST.
  • +
  • [fix] Newly entered notes no longer lost when importing new day or purging oximetry data.
  • +
  • [fix] Purge currently selected day no longer deletes bookmarks for that day.
  • Changes and fixes in OSCAR v1.2.0 diff --git a/oscar/mainwindow.cpp b/oscar/mainwindow.cpp index 95cfdf0e..fef3d0c2 100644 --- a/oscar/mainwindow.cpp +++ b/oscar/mainwindow.cpp @@ -748,6 +748,9 @@ int MainWindow::importCPAP(ImportPath import, const QString &message) void MainWindow::finishCPAPImport() { + if (daily) + daily->Unload(daily->getDate()); + p_profile->StoreMachines(); QList machines = p_profile->GetMachines(MT_CPAP); for (Machine * mach : machines) { @@ -1810,10 +1813,13 @@ void MainWindow::on_actionPurge_Current_Day_triggered() QList list; for (s = day->begin(); s != day->end(); ++s) { - list.append(*s); - qDebug() << "Purging session ID:" << (*s)->session() << "["+QDateTime::fromTime_t((*s)->session()).toString()+"]"; - qDebug() << "First Time:" << QDateTime::fromMSecsSinceEpoch((*s)->realFirst()).toString(); - qDebug() << "Last Time:" << QDateTime::fromMSecsSinceEpoch((*s)->realLast()).toString(); + Session *sess = *s; + if (sess->type() == MT_CPAP) { + list.append(*s); + qDebug() << "Purging session ID:" << (*s)->session() << "["+QDateTime::fromTime_t((*s)->session()).toString()+"]"; + qDebug() << "First Time:" << QDateTime::fromMSecsSinceEpoch((*s)->realFirst()).toString(); + qDebug() << "Last Time:" << QDateTime::fromMSecsSinceEpoch((*s)->realLast()).toString(); + } } QFile rxcache(p_profile->Get("{" + STR_GEN_DataFolder + "}/RXChanges.cache" )); @@ -2554,6 +2560,7 @@ void MainWindow::on_actionPurgeCurrentDaysOximetry_triggered() if (daily) { + daily->Unload(date); daily->clearLastDay(); // otherwise Daily will crash daily->ReloadGraphs(); }