mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-06 19:20:45 +00:00
Fix Day summary calculations
This commit is contained in:
parent
aea4053d49
commit
8968b03a6d
@ -115,6 +115,7 @@ EventDataType Day::settings_wavg(ChannelID code)
|
|||||||
double s0=0,s1=0,s2=0;
|
double s0=0,s1=0,s2=0;
|
||||||
for (QVector<Session *>::iterator s=sessions.begin();s!=sessions.end();s++) {
|
for (QVector<Session *>::iterator s=sessions.begin();s!=sessions.end();s++) {
|
||||||
Session & sess=*(*s);
|
Session & sess=*(*s);
|
||||||
|
|
||||||
QHash<ChannelID,QVariant>::iterator i=sess.settings.find(code);
|
QHash<ChannelID,QVariant>::iterator i=sess.settings.find(code);
|
||||||
if (i!=sess.settings.end()) {
|
if (i!=sess.settings.end()) {
|
||||||
s0=sess.hours();
|
s0=sess.hours();
|
||||||
@ -136,8 +137,7 @@ EventDataType Day::p90(ChannelID code) // The "average" p90.. this needs fixing.
|
|||||||
// Don't assume sessions are in order.
|
// Don't assume sessions are in order.
|
||||||
for (s=sessions.begin();s!=sessions.end();s++) {
|
for (s=sessions.begin();s!=sessions.end();s++) {
|
||||||
Session & sess=*(*s);
|
Session & sess=*(*s);
|
||||||
QHash<ChannelID,QVector<EventList *> >::iterator i=sess.eventlist.find(code);
|
if (sess.m_90p.contains(code)) {
|
||||||
if (i!=sess.eventlist.end()) {
|
|
||||||
val+=sess.p90(code);
|
val+=sess.p90(code);
|
||||||
cnt++;
|
cnt++;
|
||||||
}
|
}
|
||||||
@ -156,7 +156,7 @@ EventDataType Day::avg(ChannelID code)
|
|||||||
// Don't assume sessions are in order.
|
// Don't assume sessions are in order.
|
||||||
for (s=sessions.begin();s!=sessions.end();s++) {
|
for (s=sessions.begin();s!=sessions.end();s++) {
|
||||||
Session & sess=*(*s);
|
Session & sess=*(*s);
|
||||||
if (sess.eventlist.find(code)!=sess.eventlist.end()) {
|
if (sess.m_avg.contains(code)) {
|
||||||
val+=sess.avg(code);
|
val+=sess.avg(code);
|
||||||
cnt++;
|
cnt++;
|
||||||
}
|
}
|
||||||
@ -173,7 +173,7 @@ EventDataType Day::sum(ChannelID code)
|
|||||||
|
|
||||||
for (s=sessions.begin();s!=sessions.end();s++) {
|
for (s=sessions.begin();s!=sessions.end();s++) {
|
||||||
Session & sess=*(*s);
|
Session & sess=*(*s);
|
||||||
if (sess.eventlist.find(code)!=sess.eventlist.end()) {
|
if (sess.m_sum.contains(code)) {
|
||||||
val+=sess.sum(code);
|
val+=sess.sum(code);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -266,7 +266,8 @@ EventDataType Day::min(ChannelID code)
|
|||||||
EventDataType tmp;
|
EventDataType tmp;
|
||||||
bool first=true;
|
bool first=true;
|
||||||
for (QVector<Session *>::iterator s=sessions.begin();s!=sessions.end();s++) {
|
for (QVector<Session *>::iterator s=sessions.begin();s!=sessions.end();s++) {
|
||||||
if ((*s)->eventlist.find(code)==(*s)->eventlist.end()) continue;
|
if (!(*s)->m_min.contains(code)) continue;
|
||||||
|
//if ((*s)->eventlist.find(code)==(*s)->eventlist.end()) continue;
|
||||||
tmp=(*s)->min(code);
|
tmp=(*s)->min(code);
|
||||||
if (first) {
|
if (first) {
|
||||||
min=tmp;
|
min=tmp;
|
||||||
@ -284,7 +285,8 @@ EventDataType Day::max(ChannelID code)
|
|||||||
EventDataType tmp;
|
EventDataType tmp;
|
||||||
bool first=true;
|
bool first=true;
|
||||||
for (QVector<Session *>::iterator s=sessions.begin();s!=sessions.end();s++) {
|
for (QVector<Session *>::iterator s=sessions.begin();s!=sessions.end();s++) {
|
||||||
if ((*s)->eventlist.find(code)==(*s)->eventlist.end()) continue;
|
if (!(*s)->m_max.contains(code)) continue;
|
||||||
|
// if ((*s)->eventlist.find(code)==(*s)->eventlist.end()) continue;
|
||||||
tmp=(*s)->max(code);
|
tmp=(*s)->max(code);
|
||||||
if (first) {
|
if (first) {
|
||||||
max=tmp;
|
max=tmp;
|
||||||
|
@ -84,8 +84,8 @@ Overview::Overview(QWidget *parent,gGraphView * shared) :
|
|||||||
pr=new SummaryChart(profile,"cmH2O",GT_LINE);
|
pr=new SummaryChart(profile,"cmH2O",GT_LINE);
|
||||||
|
|
||||||
pr->addSlice(CPAP_Pressure,QColor("dark green"),ST_WAVG);
|
pr->addSlice(CPAP_Pressure,QColor("dark green"),ST_WAVG);
|
||||||
pr->addSlice(CPAP_Pressure,QColor("orange"),ST_AVG);
|
pr->addSlice(CPAP_Pressure,QColor("orange"),ST_MIN);
|
||||||
//pr->addSlice(CPAP_Pressure,QColor("red"),ST_MAX);
|
pr->addSlice(CPAP_Pressure,QColor("red"),ST_MAX);
|
||||||
|
|
||||||
PR->AddLayer(new gYAxis(),LayerLeft,gYAxis::Margin);
|
PR->AddLayer(new gYAxis(),LayerLeft,gYAxis::Margin);
|
||||||
gx=new gXAxis();
|
gx=new gXAxis();
|
||||||
|
Loading…
Reference in New Issue
Block a user