mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-09 04:30:43 +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_hours.clear();
|
||||
m_goodcodes.clear();
|
||||
m_goodcodes[""]=1;
|
||||
m_miny=999999999;
|
||||
m_maxy=-999999999;
|
||||
m_minx=0;
|
||||
@ -70,6 +69,8 @@ void SummaryChart::SetDay(Day * nullday)
|
||||
total=0;
|
||||
bool fnd=false;
|
||||
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
|
||||
day=d.value()[i];
|
||||
if (!day) continue;
|
||||
@ -167,7 +168,10 @@ void SummaryChart::SetDay(Day * nullday)
|
||||
m_goodcodes[code]=false;
|
||||
} 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++) {
|
||||
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++) {
|
||||
if (totalcounts[j]==0) continue;
|
||||
if (!m_goodcodes.contains(m_codes[j])) continue;
|
||||
a=schema::channel[m_codes[j]].label();
|
||||
ChannelID code=m_codes[j];
|
||||
if (!m_goodcodes.contains(code) || !m_goodcodes[code]) continue;
|
||||
a=schema::channel[code].label();
|
||||
a+=" ";
|
||||
switch(m_type[j]) {
|
||||
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->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;
|
||||
if (PROFILE["Units"].toString()=="metric") {
|
||||
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/=1000.0;
|
||||
}
|
||||
double height=PROFILE["Height"].toDouble(&ok);
|
||||
double bmi=(height*height)/kg;
|
||||
if (kg>0) {
|
||||
journal->settings["Weight"]=kg;
|
||||
journal->settings["BMI"]=bmi;
|
||||
journal->SetChanged(true);
|
||||
} else {
|
||||
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);
|
||||
}
|
||||
}
|
||||
double height=PROFILE["Height"].toDouble(&ok)/100.0;
|
||||
double bmi=0;
|
||||
if (height>0)
|
||||
bmi=kg/(height*height);
|
||||
journal->settings["Weight"]=kg;
|
||||
journal->settings["BMI"]=bmi;
|
||||
journal->SetChanged(true);
|
||||
}
|
||||
if ((!journal->settings.contains("ZombieMeter") && (ui->ZombieMeter->value()!=50)) || (journal->settings["ZombieMeter"].toDouble(&ok)!=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/=1000.0;
|
||||
}
|
||||
double height=PROFILE["Height"].toDouble(&ok);
|
||||
double bmi=(height*height)/kg;
|
||||
if (kg>0) {
|
||||
double height=PROFILE["Height"].toDouble(&ok)/100.0;
|
||||
double bmi=0;
|
||||
if (height>0)
|
||||
bmi=kg/(height*height);
|
||||
//if (kg>0) {
|
||||
journal->settings["Weight"]=kg;
|
||||
journal->settings["BMI"]=bmi;
|
||||
if (bmi>0)
|
||||
journal->settings["BMI"]=bmi;
|
||||
journal->SetChanged(true);
|
||||
}
|
||||
//}
|
||||
}
|
||||
if (BookmarksChanged) {
|
||||
QVariantList start;
|
||||
|
Loading…
Reference in New Issue
Block a user