diff --git a/oscar/SleepLib/day.cpp b/oscar/SleepLib/day.cpp index 3e701bea..691a1716 100644 --- a/oscar/SleepLib/day.cpp +++ b/oscar/SleepLib/day.cpp @@ -98,6 +98,16 @@ Session *Day::find(SessionID sessid) return nullptr; } +Session *Day::find(SessionID sessid, MachineType mt) +{ + for (auto & sess : sessions) { + if ((sess->session() == sessid) && (sess->s_machtype == mt)) { + return sess; + } + } + return nullptr; +} + void Day::addSession(Session *s) { if (s == nullptr) { diff --git a/oscar/SleepLib/day.h b/oscar/SleepLib/day.h index 8651442c..2691f652 100644 --- a/oscar/SleepLib/day.h +++ b/oscar/SleepLib/day.h @@ -202,6 +202,8 @@ class Day Session *find(SessionID sessid); + Session *find(SessionID sessid, MachineType mt); + //! \brief Returns the number of Sessions in this day record int size() { return sessions.size(); } diff --git a/oscar/daily.cpp b/oscar/daily.cpp index 613a6de7..7bff1515 100644 --- a/oscar/daily.cpp +++ b/oscar/daily.cpp @@ -560,7 +560,7 @@ void Daily::Link_clicked(const QUrl &url) if (code=="togglecpapsession") { // Enable/Disable CPAP session day=p_profile->GetDay(previous_date,MT_CPAP); if (!day) return; - Session *sess=day->find(sid); + Session *sess=day->find(sid, MT_CPAP); if (!sess) return; // int i=webView->page()->mainFrame()->scrollBarMaximum(Qt::Vertical)-webView->page()->mainFrame()->scrollBarValue(Qt::Vertical); @@ -571,7 +571,7 @@ void Daily::Link_clicked(const QUrl &url) // webView->page()->mainFrame()->setScrollBarValue(Qt::Vertical, webView->page()->mainFrame()->scrollBarMaximum(Qt::Vertical)-i); } else if (code=="toggleoxisession") { // Enable/Disable Oximetry session day=p_profile->GetDay(previous_date,MT_OXIMETER); - Session *sess=day->find(sid); + Session *sess=day->find(sid, MT_OXIMETER); if (!sess) return; // int i=webView->page()->mainFrame()->scrollBarMaximum(Qt::Vertical)-webView->page()->mainFrame()->scrollBarValue(Qt::Vertical);