diff --git a/oscar/daily.cpp b/oscar/daily.cpp
index a69964e8..7a4f00bb 100644
--- a/oscar/daily.cpp
+++ b/oscar/daily.cpp
@@ -578,6 +578,11 @@ void Daily::showEvent(QShowEvent *)
bool Daily::rejectToggleSessionEnable( Session*sess) {
if (!sess) return true;
+ if (AppSetting->clinicalMode()) {
+ QMessageBox mbox(QMessageBox::Warning, tr("Disable Session"), tr(" Disabling Sessions requires the Permissive Mode"), QMessageBox::Ok , this);
+ mbox.exec();
+ return true;
+ }
sess->setEnabled(!sess->enabled());
return false;
}
diff --git a/oscar/dailySearchTab.cpp b/oscar/dailySearchTab.cpp
index bceb1562..448004a8 100644
--- a/oscar/dailySearchTab.cpp
+++ b/oscar/dailySearchTab.cpp
@@ -1210,69 +1210,33 @@ QString DailySearchTab::centerLine(QString line) {
QString DailySearchTab::helpStr()
{
- QStringList str;
- str.append(tr("Finds days that match specified criteria."));
- str.append("\n");
- str.append(tr(" Searches from last day to first day."));
- str.append("\n");
- str.append("\n");
- str.append(tr("First click on Match Button then select topic."));
- str.append("\n");
- str.append(tr(" Then click on the operation to modify it."));
- str.append("\n");
- str.append(tr(" or update the value"));
- str.append("\n");
- str.append(tr("Topics without operations will automatically start."));
- str.append("\n");
- str.append("\n");
- str.append(tr("Compare Operations: numberic or character. "));
- str.append("\n");
- str.append(tr(" Numberic Operations: "));
- str.append(" > , >= , < , <= , == , != ");
- str.append("\n");
- str.append(tr(" Character Operations: "));
- str.append(" == , *? ");
- str.append("\n");
- str.append("\n");
- str.append(tr("Summary Line"));
- str.append("\n");
- str.append(tr(" Left:Summary - Number of Day searched"));
- str.append("\n");
- str.append(tr(" Center:Number of Items Found"));
- str.append("\n");
- str.append(tr(" Right:Minimum/Maximum for item searched"));
- str.append("\n");
- str.append(tr("Result Table"));
- str.append("\n");
- str.append(tr(" Column One: Date of match. Click selects date."));
- str.append("\n");
- str.append(tr(" Column two: Information. Click selects date."));
- str.append("\n");
- str.append(tr(" Then Jumps the appropiate tab."));
- str.append("\n");
- str.append("\n");
- str.append(tr("Wildcard Pattern Matching:"));
- str.append(" *? ");
- str.append("\n");
- str.append(tr(" Wildcards use 3 characters:"));
- str.append("\n");
- str.append(tr(" Asterisk"));
- str.append(" * ");
- str.append(" ");
- str.append(tr(" Question Mark"));
- str.append(" ? ");
- str.append(" ");
- str.append(tr(" Backslash."));
- str.append(" \\ ");
- str.append("\n");
- str.append(tr(" Asterisk matches any number of characters."));
- str.append("\n");
- str.append(tr(" Question Mark matches a single character."));
- str.append("\n");
- str.append(tr(" Backslash matches next character."));
- str.append("\n");
- QString result =str.join("");
- return result;
+ QStringList str; str
+ <
, >= , < , <= , == , != " <<"\n"
+ <
clinicalMode() ) return;
SegType mn = min();
SegType mx = max();
@@ -173,7 +172,6 @@ void SessionBar::mousePressEvent(QMouseEvent *ev)
void SessionBar::mouseMoveEvent(QMouseEvent *ev)
{
- if ( AppSetting->clinicalMode() ) return;
SegType mn = min();
SegType mx = max();
diff --git a/oscar/statistics.cpp b/oscar/statistics.cpp
index 4b06a5ed..722e1219 100644
--- a/oscar/statistics.cpp
+++ b/oscar/statistics.cpp
@@ -174,40 +174,42 @@ void DisabledInfo::update(QDate latestDate, QDate earliestDate)
{
clear();
if (AppSetting->clinicalMode()) return;
- qint64 complianceLimit = 3600000.0 * p_profile->cpap->complianceHours(); // conbvert to ms
+ qint64 complianceHours = 3600000.0 * p_profile->cpap->complianceHours(); // conbvert to ms
totalDays = 1+earliestDate.daysTo(latestDate);
for (QDate date = latestDate ; date >= earliestDate ; date=date.addDays(-1) ) {
Day* day = p_profile->GetDay(date);
if (!day) { daysNoData++; continue;};
+ // find basic statistics for a day
int numDisabled=0;
qint64 sessLength = 0;
qint64 dayLength = 0;
- qint64 complianceLength = 0;
- //qint64 disableLength = 0;
+ qint64 enabledLength = 0;
QList sessions = day->getSessions(MT_CPAP,true);
for (auto & sess : sessions) {
sessLength = sess->length();
dayLength += sessLength;
- if (!sess->enabled(true)) {
+ if (sess->enabled(true)) {
+ enabledLength += sessLength;
+ } else {
numDisabled ++;
- numDisabledsessions ++;
- //disableLength += sessLength;
totalDurationOfDisabledSessions += sessLength;
if (maxDurationOfaDisabledsession < sessLength) maxDurationOfaDisabledsession = sessLength;
- } else {
- complianceLength += sess->length();
}
}
- if ( complianceLimit <= complianceLength ) {
+ // calculate stats for all days
+ // calculate if compliance for a day changed.
+ if ( complianceHours <= enabledLength ) {
daysInCompliance ++;
} else {
- if (complianceLimit < dayLength ) {
+ if (complianceHours < dayLength ) {
numDaysDisabledSessionChangedCompliance++;
} else {
daysOutOfCompliance ++;
}
}
+ // update disabled info for all days
if ( numDisabled > 0 ) {
+ numDisabledsessions += numDisabled;
numDaysWithDisabledsessions++;
};
}
@@ -236,20 +238,20 @@ void DisabledInfo::update(QDate latestDate, QDate earliestDate)
QString DisabledInfo::display(int type)
{
/*
-Warning: As Permissive mode is set (Preferences/Clinical), some sessions are excluded from this report, as follows:
-Total disabled sessions: xx, found in yy days, of which zz days would have caused compliance failures.
+Permissive mode: some sessions are excluded from this report, as follows:
+Total disabled sessions: xx, found in yy days.
Duration of longest disabled session: aa minutes, Total duration of all disabled sessions: bb minutes.
*/
switch (type) {
default :
case 0:
- return QString(QObject::tr("Warning: As Permissive mode is set (Preferences/Clinical), some sessions are excluded from this report"));
+ return QString(QObject::tr("Permissive mode is set (Preferences/Clinical), disabled sessions are excluded from this report"));
case 1:
- return QString(QObject::tr("Total disabled sessions: %1, found in %2 days") //, of which %3 days would have caused compliance failures")
- .arg(numDisabledsessions)
- .arg(numDaysWithDisabledsessions)
- //.arg(numDaysDisabledSessionChangedCompliance)
- );
+ if (numDisabledsessions>0) {
+ return QString(QObject::tr("Total disabled sessions: %1, found in %2 days") .arg(numDisabledsessions) .arg(numDaysWithDisabledsessions));
+ } else {
+ return QString(QObject::tr("Total disabled sessions: %1") .arg(numDisabledsessions) );
+ }
case 2:
return QString(QObject::tr( "Duration of longest disabled session: %1 minutes, Total duration of all disabled sessions: %2 minutes.")
.arg(maxDurationOfaDisabledsession)
@@ -633,7 +635,9 @@ Statistics::Statistics(QObject *parent) :
updateDisabledInfo();
rows.push_back(StatisticsRow(disabledInfo.display(0),SC_WARNING ,MT_CPAP));
rows.push_back(StatisticsRow(disabledInfo.display(1),SC_WARNING2,MT_CPAP));
- rows.push_back(StatisticsRow(disabledInfo.display(2),SC_WARNING2,MT_CPAP));
+ if (disabledInfo.size()>0) {
+ rows.push_back(StatisticsRow(disabledInfo.display(2),SC_WARNING2,MT_CPAP));
+ }
}
rows.push_back(StatisticsRow("", SC_DAYS, MT_CPAP));
rows.push_back(StatisticsRow("", SC_COLUMNHEADERS, MT_CPAP));
@@ -986,7 +990,7 @@ struct Period {
QString header;
};
-const QString warning_color="#ff8888";
+const QString warning_color="#ffffff";
const QString heading_color="#ffffff";
const QString subheading_color="#e0e0e0";
//const int rxthresh = 5;
@@ -1354,11 +1358,13 @@ QString Statistics::GenerateCPAPUsage()
} else if (row.calc == SC_UNDEFINED) {
continue;
} else if (row.calc == SC_WARNING) {
- html+=QString("%3 |
").
+ //html+=QString("%3 |
").
+ // arg(warning_color).arg(periods.size()+1).arg(row.src);
+ html+=QString("%3 |
").
arg(warning_color).arg(periods.size()+1).arg(row.src);
continue;
} else if (row.calc == SC_WARNING2) {
- html+=QString("%3 |
").
+ html+=QString("%3 |
").
arg(warning_color).arg(periods.size()+1).arg(row.src);
continue;
} else {
diff --git a/oscar/statistics.h b/oscar/statistics.h
index aa8d976d..9f7663d0 100644
--- a/oscar/statistics.h
+++ b/oscar/statistics.h
@@ -27,6 +27,7 @@ class DisabledInfo
public:
QString display(int);
void update(QDate latest, QDate earliest) ;
+ int size() {return numDisabledsessions;};
private:
int totalDays ;
int daysNoData ;