mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-17 19:20:46 +00:00
BMI was not being recorded properly
This commit is contained in:
parent
b816bec488
commit
e4bd02bd6c
@ -45,7 +45,6 @@ void SummaryChart::SetDay(Day * nullday)
|
|||||||
m_days.clear();
|
m_days.clear();
|
||||||
m_hours.clear();
|
m_hours.clear();
|
||||||
m_goodcodes.clear();
|
m_goodcodes.clear();
|
||||||
m_goodcodes[""]=1;
|
|
||||||
m_miny=999999999;
|
m_miny=999999999;
|
||||||
m_maxy=-999999999;
|
m_maxy=-999999999;
|
||||||
m_minx=0;
|
m_minx=0;
|
||||||
@ -70,6 +69,8 @@ void SummaryChart::SetDay(Day * nullday)
|
|||||||
total=0;
|
total=0;
|
||||||
bool fnd=false;
|
bool fnd=false;
|
||||||
if (m_graphtype==GT_SESSIONS) {
|
if (m_graphtype==GT_SESSIONS) {
|
||||||
|
for (int i=0;i<m_codes.size();i++)
|
||||||
|
m_goodcodes[m_codes[i]]=true;
|
||||||
for (int i=0;i<d.value().size();i++) { // for each day
|
for (int i=0;i<d.value().size();i++) { // for each day
|
||||||
day=d.value()[i];
|
day=d.value()[i];
|
||||||
if (!day) continue;
|
if (!day) continue;
|
||||||
@ -167,7 +168,10 @@ void SummaryChart::SetDay(Day * nullday)
|
|||||||
m_goodcodes[code]=false;
|
m_goodcodes[code]=false;
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if (type==ST_HOURS || type==ST_SESSIONS) continue; // too many lookups happening here.. stop the crap..
|
if (type==ST_HOURS || type==ST_SESSIONS ||
|
||||||
|
code=="Weight" ||
|
||||||
|
code=="BMI" ||
|
||||||
|
code=="ZombieMeter") continue; // too many lookups happening here.. stop the crap..
|
||||||
|
|
||||||
for (QMap<QDate,QVector<Day *> >::iterator d=PROFILE.daylist.begin();d!=PROFILE.daylist.end();d++) {
|
for (QMap<QDate,QVector<Day *> >::iterator d=PROFILE.daylist.begin();d!=PROFILE.daylist.end();d++) {
|
||||||
tt=QDateTime(d.key(),QTime(0,0,0),Qt::UTC).toTime_t();
|
tt=QDateTime(d.key(),QTime(0,0,0),Qt::UTC).toTime_t();
|
||||||
@ -467,8 +471,9 @@ void SummaryChart::paint(gGraph & w,int left, int top, int width, int height)
|
|||||||
|
|
||||||
for (int j=0;j<m_codes.size();j++) {
|
for (int j=0;j<m_codes.size();j++) {
|
||||||
if (totalcounts[j]==0) continue;
|
if (totalcounts[j]==0) continue;
|
||||||
if (!m_goodcodes.contains(m_codes[j])) continue;
|
ChannelID code=m_codes[j];
|
||||||
a=schema::channel[m_codes[j]].label();
|
if (!m_goodcodes.contains(code) || !m_goodcodes[code]) continue;
|
||||||
|
a=schema::channel[code].label();
|
||||||
a+=" ";
|
a+=" ";
|
||||||
switch(m_type[j]) {
|
switch(m_type[j]) {
|
||||||
case ST_WAVG: a+="Avg"; break;
|
case ST_WAVG: a+="Avg"; break;
|
||||||
|
45
daily.cpp
45
daily.cpp
@ -980,7 +980,14 @@ void Daily::Unload(QDate date)
|
|||||||
journal->settings[Journal_Notes]=jhtml;
|
journal->settings[Journal_Notes]=jhtml;
|
||||||
journal->SetChanged(true);
|
journal->SetChanged(true);
|
||||||
}
|
}
|
||||||
if ((!journal->settings.contains("Weight") && (ui->weightSpinBox->value()>0)) || (journal->settings["Weight"].toDouble(&ok)!=ui->weightSpinBox->value())) {
|
double w=ui->weightSpinBox->value();
|
||||||
|
if (journal->settings.contains("Weight") && ui->weightSpinBox->value()==0) {
|
||||||
|
journal->settings.erase(journal->settings.find("Weight"));
|
||||||
|
if (journal->settings.contains("BMI")) {
|
||||||
|
journal->settings.erase(journal->settings.find("BMI"));
|
||||||
|
}
|
||||||
|
journal->SetChanged(true);
|
||||||
|
} else if (ui->weightSpinBox->value()>0) {
|
||||||
double kg;
|
double kg;
|
||||||
if (PROFILE["Units"].toString()=="metric") {
|
if (PROFILE["Units"].toString()=="metric") {
|
||||||
kg=ui->weightSpinBox->value();
|
kg=ui->weightSpinBox->value();
|
||||||
@ -988,22 +995,13 @@ void Daily::Unload(QDate date)
|
|||||||
kg=(ui->weightSpinBox->value()*(ounce_convert*16.0))+(ui->ouncesSpinBox->value()*ounce_convert);
|
kg=(ui->weightSpinBox->value()*(ounce_convert*16.0))+(ui->ouncesSpinBox->value()*ounce_convert);
|
||||||
kg/=1000.0;
|
kg/=1000.0;
|
||||||
}
|
}
|
||||||
double height=PROFILE["Height"].toDouble(&ok);
|
double height=PROFILE["Height"].toDouble(&ok)/100.0;
|
||||||
double bmi=(height*height)/kg;
|
double bmi=0;
|
||||||
if (kg>0) {
|
if (height>0)
|
||||||
journal->settings["Weight"]=kg;
|
bmi=kg/(height*height);
|
||||||
journal->settings["BMI"]=bmi;
|
journal->settings["Weight"]=kg;
|
||||||
journal->SetChanged(true);
|
journal->settings["BMI"]=bmi;
|
||||||
} else {
|
journal->SetChanged(true);
|
||||||
if (journal->settings.contains("Weight")) {
|
|
||||||
journal->settings.erase(journal->settings.find("Weight"));
|
|
||||||
journal->SetChanged(true);
|
|
||||||
}
|
|
||||||
if (journal->settings.contains("BMI")) {
|
|
||||||
journal->settings.erase(journal->settings.find("BMI"));
|
|
||||||
journal->SetChanged(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if ((!journal->settings.contains("ZombieMeter") && (ui->ZombieMeter->value()!=50)) || (journal->settings["ZombieMeter"].toDouble(&ok)!=ui->ZombieMeter->value())) {
|
if ((!journal->settings.contains("ZombieMeter") && (ui->ZombieMeter->value()!=50)) || (journal->settings["ZombieMeter"].toDouble(&ok)!=ui->ZombieMeter->value())) {
|
||||||
journal->settings["ZombieMeter"]=ui->ZombieMeter->value();
|
journal->settings["ZombieMeter"]=ui->ZombieMeter->value();
|
||||||
@ -1043,13 +1041,16 @@ void Daily::Unload(QDate date)
|
|||||||
kg=(ui->weightSpinBox->value()*(ounce_convert*16))+(ui->ouncesSpinBox->value()*ounce_convert);
|
kg=(ui->weightSpinBox->value()*(ounce_convert*16))+(ui->ouncesSpinBox->value()*ounce_convert);
|
||||||
kg/=1000.0;
|
kg/=1000.0;
|
||||||
}
|
}
|
||||||
double height=PROFILE["Height"].toDouble(&ok);
|
double height=PROFILE["Height"].toDouble(&ok)/100.0;
|
||||||
double bmi=(height*height)/kg;
|
double bmi=0;
|
||||||
if (kg>0) {
|
if (height>0)
|
||||||
|
bmi=kg/(height*height);
|
||||||
|
//if (kg>0) {
|
||||||
journal->settings["Weight"]=kg;
|
journal->settings["Weight"]=kg;
|
||||||
journal->settings["BMI"]=bmi;
|
if (bmi>0)
|
||||||
|
journal->settings["BMI"]=bmi;
|
||||||
journal->SetChanged(true);
|
journal->SetChanged(true);
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
if (BookmarksChanged) {
|
if (BookmarksChanged) {
|
||||||
QVariantList start;
|
QVariantList start;
|
||||||
|
Loading…
Reference in New Issue
Block a user