From 1976795cb992d34ef8f50d65a32176e69542f7fe Mon Sep 17 00:00:00 2001 From: sawinglogz <3787776-sawinglogz@users.noreply.gitlab.com> Date: Wed, 20 May 2020 13:40:20 -0400 Subject: [PATCH] Export only CPAP sessions in the sessions CSV export. This fixes the mystery sessions that were appearing in CSV exports. --- oscar/exportcsv.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/oscar/exportcsv.cpp b/oscar/exportcsv.cpp index 4c5e6a32..25f3fbbb 100644 --- a/oscar/exportcsv.cpp +++ b/oscar/exportcsv.cpp @@ -233,7 +233,7 @@ void ExportCSV::on_exportButton_clicked() ui->progressBar->setValue(ui->progressBar->value() + 1); QApplication::processEvents(); - Day *day = p_profile->GetDay(date, MT_CPAP); + Day *day = p_profile->GetDay(date, MT_CPAP); // Only export days with CPAP data. if (day) { QString data; @@ -280,6 +280,9 @@ void ExportCSV::on_exportButton_clicked() } else if (ui->rb1_Sessions->isChecked()) { for (int i = 0; i < day->size(); i++) { Session *sess = (*day)[i]; + if (sess->type() != MT_CPAP) { + continue; // Not every session in a day with CPAP data will be a CPAP session. + } QDateTime start = QDateTime::fromTime_t(sess->first() / 1000L); QDateTime end = QDateTime::fromTime_t(sess->last() / 1000L);