mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-07 11:40:42 +00:00
Ignore old sessions should not impact existing data
This commit is contained in:
parent
497cf8e5c4
commit
a836871914
@ -49,6 +49,7 @@
|
|||||||
<li>[fix] Stop skipping the first 40 seconds of ResMed low-rate pressure data.</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>
|
<li>[fix] Correct Total Time and AHI in CSV Export when non-CPAP devices are used.</li>
|
||||||
<li>[fix] Fix value display and bookmark behavior with clock drift.</li>
|
<li>[fix] Fix value display and bookmark behavior with clock drift.</li>
|
||||||
|
<li>[fix] Ignore old sessions should not impact existing data.</li>
|
||||||
</ul>
|
</ul>
|
||||||
<p>
|
<p>
|
||||||
<b>Changes and fixes in OSCAR v1.2.0</b>
|
<b>Changes and fixes in OSCAR v1.2.0</b>
|
||||||
|
@ -279,7 +279,11 @@ QDate Machine::pickDate(qint64 first)
|
|||||||
return date;
|
return date;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Machine::AddSession(Session *s)
|
// allowOldSessions defaults to false and is only set to true when loading
|
||||||
|
// summary data on profile load. This true setting prevents old sessions from
|
||||||
|
// becoming lost if user preference indicates to not import sessions prior to a
|
||||||
|
// given date.
|
||||||
|
bool Machine::AddSession(Session *s, bool allowOldSessions)
|
||||||
{
|
{
|
||||||
if (s == nullptr) {
|
if (s == nullptr) {
|
||||||
qCritical() << "AddSession() called with a null object";
|
qCritical() << "AddSession() called with a null object";
|
||||||
@ -303,7 +307,10 @@ bool Machine::AddSession(Session *s)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (profile->session->ignoreOlderSessions()) {
|
// allowOldSessions is true when loading summaries (already imported sessions)
|
||||||
|
// We don't want to throw away data already in the database in circumstances
|
||||||
|
// where user wants to ignore old sessions on import.
|
||||||
|
if (profile->session->ignoreOlderSessions() && !allowOldSessions) {
|
||||||
qint64 ignorebefore = profile->session->ignoreOlderSessionsDate().toMSecsSinceEpoch();
|
qint64 ignorebefore = profile->session->ignoreOlderSessionsDate().toMSecsSinceEpoch();
|
||||||
if (s->last() < ignorebefore) {
|
if (s->last() < ignorebefore) {
|
||||||
qDebug() << s->session() << "Ignoring old session";
|
qDebug() << s->session() << "Ignoring old session";
|
||||||
@ -783,7 +790,7 @@ bool Machine::Load(ProgressDialog *progress)
|
|||||||
|
|
||||||
// Forced to load it, because know nothing about this session..
|
// Forced to load it, because know nothing about this session..
|
||||||
if (sess->LoadSummary()) {
|
if (sess->LoadSummary()) {
|
||||||
AddSession(sess);
|
AddSession(sess, true);
|
||||||
} else {
|
} else {
|
||||||
qWarning() << "Error loading summary file" << filename;
|
qWarning() << "Error loading summary file" << filename;
|
||||||
delete sess;
|
delete sess;
|
||||||
@ -1019,7 +1026,7 @@ bool Machine::LoadSummary(ProgressDialog * progress)
|
|||||||
// }
|
// }
|
||||||
*****************************************************************/
|
*****************************************************************/
|
||||||
Session * sess = it.value();
|
Session * sess = it.value();
|
||||||
if ( ! AddSession(sess)) {
|
if ( ! AddSession(sess, true)) {
|
||||||
delete sess;
|
delete sess;
|
||||||
} else {
|
} else {
|
||||||
if (loadSummaries) {
|
if (loadSummaries) {
|
||||||
|
@ -143,7 +143,7 @@ class Machine
|
|||||||
Session *SessionExists(SessionID session);
|
Session *SessionExists(SessionID session);
|
||||||
|
|
||||||
//! \brief Adds the session to this machine object, and the Master Profile list. (used during load)
|
//! \brief Adds the session to this machine object, and the Master Profile list. (used during load)
|
||||||
bool AddSession(Session *s);
|
bool AddSession(Session *s, bool allowOldSessions=false);
|
||||||
|
|
||||||
//! \brief Find the date this session belongs in, according to profile settings
|
//! \brief Find the date this session belongs in, according to profile settings
|
||||||
QDate pickDate(qint64 start);
|
QDate pickDate(qint64 start);
|
||||||
|
Loading…
Reference in New Issue
Block a user