Correct Total Time and AHI in CSV Export when non-CPAP devices are used

This commit is contained in:
kappa44 2021-04-26 10:02:30 +10:00
parent e20518e84c
commit 89edb3f077
2 changed files with 4 additions and 4 deletions

View File

@ -45,6 +45,7 @@
<li>[fix] Mark exported Journal backup file as UTF-8.</li>
<li>[fix] Improve error message when unable to access OSCAR database.</li>
<li>[fix] Stop skipping the first 40 seconds of ResMed low-rate pressure data.</li>
<li>[fix] Correct Total Time and AHI in CSV Export when non-CPAP devices are used.</li>
</ul>
<p>
<b>Changes and fixes in OSCAR v1.2.0</b>

View File

@ -248,14 +248,13 @@ void ExportCSV::on_exportButton_clicked()
data += sep + QString::number(day->size(), 10);
data += sep + start.toString(Qt::ISODate);
data += sep + end.toString(Qt::ISODate);
int time = day->total_time() / 1000L;
// Given this is a CPAP specific report, just report CPAP hours
int time = int(day->hours(MT_CPAP) * 3600L);
int h = time / 3600;
int m = int(time / 60) % 60;
int s = int(time) % 60;
data += sep + QString().sprintf("%02i:%02i:%02i", h, m, s);
float ahi = day->count(CPAP_Obstructive) + day->count(CPAP_Hypopnea) + day->count(
CPAP_Apnea) + day->count(CPAP_ClearAirway);
ahi /= day->hours();
float ahi = day->calcAHI();
data += sep + QString::number(ahi, 'f', 3);
for (int i = 0; i < countlist.size(); i++) {