diff --git a/sleepyhead/SleepLib/calcs.cpp b/sleepyhead/SleepLib/calcs.cpp
index f634ae6c..58143049 100644
--- a/sleepyhead/SleepLib/calcs.cpp
+++ b/sleepyhead/SleepLib/calcs.cpp
@@ -1000,8 +1000,6 @@ EventDataType calcAHI(Session *session, qint64 start, qint64 end)
int calcAHIGraph(Session *session)
{
bool calcrdi = session->machine()->loaderName() == "PRS1";
- //p_profile->general->calculateRDI()
-
const qint64 window_step = 30000; // 30 second windows
double window_size = p_profile->cpap->AHIWindow();
@@ -1117,8 +1115,6 @@ int calcAHIGraph(Session *session)
}
}
- //if (lastti > last) lastti = last;
-
AHI->AddEvent(last, 0);
if (calcrdi) {
diff --git a/sleepyhead/SleepLib/loader_plugins/intellipap_loader.cpp b/sleepyhead/SleepLib/loader_plugins/intellipap_loader.cpp
index 78083490..6ab9c386 100644
--- a/sleepyhead/SleepLib/loader_plugins/intellipap_loader.cpp
+++ b/sleepyhead/SleepLib/loader_plugins/intellipap_loader.cpp
@@ -376,6 +376,7 @@ int IntellipapLoader::Open(QString path)
Session *sess = Sessions[sid];
qint64 time = quint64(ts1) * 1000L;
+ sess->really_set_last(time);
sess->settings[CPAP_Mode] = mode;
int minp = m_buffer[pos + 0x13];
@@ -521,51 +522,32 @@ int IntellipapLoader::Open(QString path)
if (sid) {
sess = Sessions[sid];
+ if (!sess) continue;
quint64 first = qint64(sid) * 1000L;
quint64 last = qint64(SessionEnd[i]) * 1000L;
- sess->settings[CPAP_PresReliefType] = (PRTypes)PR_SMARTFLEX;
+ if (sess->last() > 0) {
+ sess->settings[CPAP_PresReliefType] = (PRTypes)PR_SMARTFLEX;
- sess->settings[CPAP_PresReliefSet] = smartflex;
+ sess->settings[CPAP_PresReliefSet] = smartflex;
- if (smartflexmode == 0) {
- sess->settings[CPAP_PresReliefMode] = PM_FullTime;
+ if (smartflexmode == 0) {
+ sess->settings[CPAP_PresReliefMode] = PM_FullTime;
+ } else {
+ sess->settings[CPAP_PresReliefMode] = PM_RampOnly;
+ }
+
+ sess->settings[CPAP_RampPressure] = ramp_pressure;
+ sess->settings[CPAP_RampTime] = ramp_time;
+
+
+ sess->UpdateSummaries();
+ mach->AddSession(sess);
} else {
- sess->settings[CPAP_PresReliefMode] = PM_RampOnly;
+ delete sess;
}
- sess->settings[CPAP_RampPressure] = ramp_pressure;
- sess->settings[CPAP_RampTime] = ramp_time;
-
-
-// EventDataType max = sess->Max(CPAP_IPAP);
-// EventDataType min = sess->Min(CPAP_EPAP);
-// EventDataType pres = sess->Min(CPAP_Pressure);
-
-// if (max == min) {
-// sess->settings[CPAP_Mode] = (int)MODE_CPAP;
-// sess->settings[CPAP_Pressure] = min;
-// } else {
-// sess->settings[CPAP_Mode] = (int)MODE_APAP;
-// sess->settings[CPAP_PressureMin] = min;
-// sess->settings[CPAP_PressureMax] = max;
-// }
-
-// sess->eventlist.erase(sess->eventlist.find(CPAP_IPAP));
-// sess->eventlist.erase(sess->eventlist.find(CPAP_EPAP));
-// sess->m_min.erase(sess->m_min.find(CPAP_EPAP));
-// sess->m_max.erase(sess->m_max.find(CPAP_EPAP));
-
-// if (pres < min) {
-// sess->settings[CPAP_RampPressure] = pres;
-// }
-
- sess->set_first(first);
- sess->set_last(last);
-
- sess->UpdateSummaries();
- mach->AddSession(sess);
}
}
diff --git a/sleepyhead/welcome.cpp b/sleepyhead/welcome.cpp
index dfd6d3c2..ca161355 100644
--- a/sleepyhead/welcome.cpp
+++ b/sleepyhead/welcome.cpp
@@ -161,7 +161,7 @@ QString GenerateWelcomeHTML()
else if (ahi < 10) ahitext = QString("")+QObject::tr("not very good")+"";
else ahitext = QString("")+QObject::tr("horrible, please consult your doctor")+"";
- html += QObject::tr("Your had an AHI of %1, which is considered %2.").arg(ahi,0,'f',2).arg(ahitext)+"
";
+ html += QObject::tr("Your had an AHI of %1, which is considered %2").arg(ahi,0,'f',2).arg(ahitext)+"
";
int seconds = int(hours * 3600.0) % 60;
int minutes = int(hours * 60) % 60;