Skip to content

Commit

Permalink
Merge pull request #78 from rocketman768/bug/equipment-todouble
Browse files Browse the repository at this point in the history
Fixes #77: bad input behavior for equipment specific heat
  • Loading branch information
rocketman768 committed Oct 3, 2015
2 parents 3f6b1ca + 9a3cedb commit 5cc8230
Show file tree
Hide file tree
Showing 7 changed files with 80 additions and 80 deletions.
52 changes: 26 additions & 26 deletions src/brewnote.cpp
Expand Up @@ -359,32 +359,32 @@ QString BrewNote::brewDate_short() const
return brewDate().toString(format);
}

double BrewNote::sg() const { return Brewtarget::toDouble(get("sg").toString(), "BrewNote::sg()"); }
double BrewNote::abv() const { return Brewtarget::toDouble(get("abv").toString(), "BrewNote::abv()"); }
double BrewNote::volumeIntoBK_l() const { return Brewtarget::toDouble(get("volume_into_bk").toString(), "BrewNote::volume_into_bk()"); }
double BrewNote::effIntoBK_pct() const { return Brewtarget::toDouble(get("eff_into_bk").toString(), "BrewNote::effIntoBK_pct()"); }
double BrewNote::brewhouseEff_pct() const { return Brewtarget::toDouble(get("brewhouse_eff").toString(), "BrewNote::brewhouseEff_pct()"); }
double BrewNote::strikeTemp_c() const { return Brewtarget::toDouble(get("strike_temp").toString(), "BrewNote::strikeTemp_c()"); }
double BrewNote::mashFinTemp_c() const { return Brewtarget::toDouble(get("mash_final_temp").toString(), "BrewNote::mashFinTemp_c()"); }
double BrewNote::og() const { return Brewtarget::toDouble(get("og").toString(), "BrewNote::og()"); }
double BrewNote::volumeIntoFerm_l() const { return Brewtarget::toDouble(get("volume_into_fermenter").toString(), "BrewNote::volumeIntoFerm_l()"); }
double BrewNote::postBoilVolume_l() const { return Brewtarget::toDouble(get("post_boil_volume").toString(), "BrewNote::postBoilVolume_l()"); }
double BrewNote::pitchTemp_c() const { return Brewtarget::toDouble(get("pitch_temp").toString(), "BrewNote::pitchTemp_c()"); }
double BrewNote::fg() const { return Brewtarget::toDouble(get("fg").toString(), "BrewNote::fg()"); }
double BrewNote::finalVolume_l() const { return Brewtarget::toDouble(get("final_volume").toString(), "BrewNote::finalVolume_l()"); }
double BrewNote::projBoilGrav() const { return Brewtarget::toDouble(get("projected_boil_grav").toString(), "BrewNote::projBoilGrav()"); }
double BrewNote::projVolIntoBK_l() const { return Brewtarget::toDouble(get("projected_vol_into_bk").toString(), "BrewNote::projVolIntoBK_l()"); }
double BrewNote::projStrikeTemp_c() const { return Brewtarget::toDouble(get("projected_strike_temp").toString(), "BrewNote::projStrikeTemp_c()"); }
double BrewNote::projMashFinTemp_c() const { return Brewtarget::toDouble(get("projected_mash_fin_temp").toString(), "BrewNote::projMashFinTemp_c()"); }
double BrewNote::projOg() const { return Brewtarget::toDouble(get("projected_og").toString(), "BrewNote::projOg()"); }
double BrewNote::projVolIntoFerm_l() const { return Brewtarget::toDouble(get("projected_vol_into_ferm").toString(), "BrewNote::projVolIntoFerm_l()"); }
double BrewNote::projFg() const { return Brewtarget::toDouble(get("projected_fg").toString(), "BrewNote::projFg()"); }
double BrewNote::projEff_pct() const { return Brewtarget::toDouble(get("projected_eff").toString(), "BrewNote::projEff_pct()"); }
double BrewNote::projABV_pct() const { return Brewtarget::toDouble(get("projected_abv").toString(), "BrewNote::projABV_pct()"); }
double BrewNote::projPoints() const { return Brewtarget::toDouble(get("projected_points").toString(), "BrewNote::projPoints()"); }
double BrewNote::projFermPoints() const { return Brewtarget::toDouble(get("projected_ferm_points").toString(), "BrewNote::projFermPoints()"); }
double BrewNote::projAtten() const { return Brewtarget::toDouble(get("projected_atten").toString(), "BrewNote::projAtten()"); }
double BrewNote::boilOff_l() const { return Brewtarget::toDouble(get("boil_off").toString(), "BrewNote::boilOff_l()"); }
double BrewNote::sg() const { return get("sg").toDouble(); }
double BrewNote::abv() const { return get("abv").toDouble(); }
double BrewNote::volumeIntoBK_l() const { return get("volume_into_bk").toDouble(); }
double BrewNote::effIntoBK_pct() const { return get("eff_into_bk").toDouble(); }
double BrewNote::brewhouseEff_pct() const { return get("brewhouse_eff").toDouble(); }
double BrewNote::strikeTemp_c() const { return get("strike_temp").toDouble(); }
double BrewNote::mashFinTemp_c() const { return get("mash_final_temp").toDouble(); }
double BrewNote::og() const { return get("og").toDouble(); }
double BrewNote::volumeIntoFerm_l() const { return get("volume_into_fermenter").toDouble(); }
double BrewNote::postBoilVolume_l() const { return get("post_boil_volume").toDouble(); }
double BrewNote::pitchTemp_c() const { return get("pitch_temp").toDouble(); }
double BrewNote::fg() const { return get("fg").toDouble(); }
double BrewNote::finalVolume_l() const { return get("final_volume").toDouble(); }
double BrewNote::projBoilGrav() const { return get("projected_boil_grav").toDouble(); }
double BrewNote::projVolIntoBK_l() const { return get("projected_vol_into_bk").toDouble(); }
double BrewNote::projStrikeTemp_c() const { return get("projected_strike_temp").toDouble(); }
double BrewNote::projMashFinTemp_c() const { return get("projected_mash_fin_temp").toDouble(); }
double BrewNote::projOg() const { return get("projected_og").toDouble(); }
double BrewNote::projVolIntoFerm_l() const { return get("projected_vol_into_ferm").toDouble(); }
double BrewNote::projFg() const { return get("projected_fg").toDouble(); }
double BrewNote::projEff_pct() const { return get("projected_eff").toDouble(); }
double BrewNote::projABV_pct() const { return get("projected_abv").toDouble(); }
double BrewNote::projPoints() const { return get("projected_points").toDouble(); }
double BrewNote::projFermPoints() const { return get("projected_ferm_points").toDouble(); }
double BrewNote::projAtten() const { return get("projected_atten").toDouble(); }
double BrewNote::boilOff_l() const { return get("boil_off").toDouble(); }

int BrewNote::key() const { return _key; }

Expand Down
30 changes: 15 additions & 15 deletions src/equipment.cpp
Expand Up @@ -445,21 +445,21 @@ QString Equipment::name() const { return get("name").toString(); }
QString Equipment::notes() const { return get("notes").toString(); }
bool Equipment::calcBoilVolume() const { return get("calc_boil_volume").toBool(); }

double Equipment::boilSize_l() const { return Brewtarget::toDouble(get("boil_size").toString(), "Equipment::boilSize_l()"); }
double Equipment::batchSize_l() const { return Brewtarget::toDouble(get("batch_size").toString(), "Equipment::batchSize_l()"); }
double Equipment::tunVolume_l() const { return Brewtarget::toDouble(get("tun_volume").toString(), "Equipment::tunVolume_l()"); }
double Equipment::tunWeight_kg() const { return Brewtarget::toDouble(get("tun_weight").toString(), "Equipment::tunWeight_kg()"); }
double Equipment::tunSpecificHeat_calGC() const { return Brewtarget::toDouble(get("tun_specific_heat").toString(), "Equipment::tunSpecificHeat_calGC()"); }
double Equipment::topUpWater_l() const { return Brewtarget::toDouble(get("top_up_water").toString(), "Equipment::topUpWater_l()"); }
double Equipment::trubChillerLoss_l() const { return Brewtarget::toDouble(get("trub_chiller_loss").toString(), "Equipment::trubChillerLoss_l()"); }
double Equipment::evapRate_pctHr() const { return Brewtarget::toDouble(get("evap_rate").toString(), "Equipment::evapRate_pctHr()"); }
double Equipment::evapRate_lHr() const { return Brewtarget::toDouble(get("real_evap_rate").toString(), "Equipment::evapRate_lHr()"); }
double Equipment::boilTime_min() const { return Brewtarget::toDouble(get("boil_time").toString(), "Equipment::boilTime_min()"); }
double Equipment::lauterDeadspace_l() const { return Brewtarget::toDouble(get("lauter_deadspace").toString(), "Equipment::lauterDeadspace_l()"); }
double Equipment::topUpKettle_l() const { return Brewtarget::toDouble(get("top_up_kettle").toString(), "Equipment::topUpKettle_l()"); }
double Equipment::hopUtilization_pct() const { return Brewtarget::toDouble(get("hop_utilization").toString(), "Equipment::hopUtilization_pct()"); }
double Equipment::grainAbsorption_LKg() { return Brewtarget::toDouble(get("absorption").toString(), "Equipment::grainAbsorption_LKg()"); }
double Equipment::boilingPoint_c() const { return Brewtarget::toDouble(get("boiling_point").toString(), "Equipment::boilingPoint_c()"); }
double Equipment::boilSize_l() const { return get("boil_size").toDouble(); }
double Equipment::batchSize_l() const { return get("batch_size").toDouble(); }
double Equipment::tunVolume_l() const { return get("tun_volume").toDouble(); }
double Equipment::tunWeight_kg() const { return get("tun_weight").toDouble(); }
double Equipment::tunSpecificHeat_calGC() const { return get("tun_specific_heat").toDouble(); }
double Equipment::topUpWater_l() const { return get("top_up_water").toDouble(); }
double Equipment::trubChillerLoss_l() const { return get("trub_chiller_loss").toDouble(); }
double Equipment::evapRate_pctHr() const { return get("evap_rate").toDouble(); }
double Equipment::evapRate_lHr() const { return get("real_evap_rate").toDouble(); }
double Equipment::boilTime_min() const { return get("boil_time").toDouble(); }
double Equipment::lauterDeadspace_l() const { return get("lauter_deadspace").toDouble(); }
double Equipment::topUpKettle_l() const { return get("top_up_kettle").toDouble(); }
double Equipment::hopUtilization_pct() const { return get("hop_utilization").toDouble(); }
double Equipment::grainAbsorption_LKg() { return get("absorption").toDouble(); }
double Equipment::boilingPoint_c() const { return get("boiling_point").toDouble(); }

void Equipment::doCalculations()
{
Expand Down
2 changes: 1 addition & 1 deletion src/instruction.cpp
Expand Up @@ -122,7 +122,7 @@ QList<QString> Instruction::reagents()

double Instruction::interval()
{
return Brewtarget::toDouble(get("interval").toString(),"Instruction::interval()");
return get("interval").toDouble();
}

int Instruction::instructionNumber() const
Expand Down
12 changes: 6 additions & 6 deletions src/mash.cpp
Expand Up @@ -146,12 +146,12 @@ void Mash::removeAllMashSteps()
QString Mash::name() const { return get("name").toString(); }
QString Mash::notes() const { return get("notes").toString(); }

double Mash::grainTemp_c() const { return Brewtarget::toDouble(get("grain_temp").toString(), "Mash::grainTemp_c()"); }
double Mash::tunTemp_c() const { return Brewtarget::toDouble(get("tun_temp").toString(), "Mash::tunTemp_c()"); }
double Mash::spargeTemp_c() const { return Brewtarget::toDouble(get("sparge_temp").toString(), "Mash::spargeTemp_c()"); }
double Mash::ph() const { return Brewtarget::toDouble(get("ph").toString(), "Mash::ph()"); }
double Mash::tunWeight_kg() const { return Brewtarget::toDouble(get("tun_weight").toString(), "Mash::tunWeight_kg()"); }
double Mash::tunSpecificHeat_calGC() const { return Brewtarget::toDouble(get("tun_specific_heat").toString(), "Mash::tunSpecificHeat_calGC()"); }
double Mash::grainTemp_c() const { return get("grain_temp").toDouble(); }
double Mash::tunTemp_c() const { return get("tun_temp").toDouble(); }
double Mash::spargeTemp_c() const { return get("sparge_temp").toDouble(); }
double Mash::ph() const { return get("ph").toDouble(); }
double Mash::tunWeight_kg() const { return get("tun_weight").toDouble(); }
double Mash::tunSpecificHeat_calGC() const { return get("tun_specific_heat").toDouble(); }

bool Mash::equipAdjust() const { return get("equip_adjust").toBool(); }

Expand Down
14 changes: 7 additions & 7 deletions src/mashstep.cpp
Expand Up @@ -245,13 +245,13 @@ MashStep::Type MashStep::type() const { return static_cast<MashStep::Type
const QString MashStep::typeString() const { return get("mstype").toString(); }
const QString MashStep::typeStringTr() const { return typesTr.at(type()); }

double MashStep::infuseTemp_c() const { return Brewtarget::toDouble(get("infuse_temp").toString(), "MashStep::infuseTemp_c()"); }
double MashStep::infuseAmount_l() const { return Brewtarget::toDouble(get("infuse_amount").toString(), "MashStep::infuseAmount_l()"); }
double MashStep::stepTemp_c() const { return Brewtarget::toDouble(get("step_temp").toString(), "MashStep::stepTemp_c()"); }
double MashStep::stepTime_min() const { return Brewtarget::toDouble(get("step_time").toString(), "MashStep::stepTime_min()"); }
double MashStep::rampTime_min() const { return Brewtarget::toDouble(get("ramp_time").toString(), "MashStep::rampTime_min()"); }
double MashStep::endTemp_c() const { return Brewtarget::toDouble(get("end_temp").toString(), "MashStep::endTemp_c()"); }
double MashStep::decoctionAmount_l() const { return Brewtarget::toDouble(get("decoction_amount").toString(), "MashStep::decoctionAmount_l()"); }
double MashStep::infuseTemp_c() const { return get("infuse_temp").toDouble(); }
double MashStep::infuseAmount_l() const { return get("infuse_amount").toDouble(); }
double MashStep::stepTemp_c() const { return get("step_temp").toDouble(); }
double MashStep::stepTime_min() const { return get("step_time").toDouble(); }
double MashStep::rampTime_min() const { return get("ramp_time").toDouble(); }
double MashStep::endTemp_c() const { return get("end_temp").toDouble(); }
double MashStep::decoctionAmount_l() const { return get("decoction_amount").toDouble(); }

int MashStep::stepNumber() const { return get("step_number").toInt(); }

Expand Down
34 changes: 17 additions & 17 deletions src/recipe.cpp
Expand Up @@ -1315,23 +1315,23 @@ QString Recipe::primingSugarName() const { return get("priming_sugar_name").toSt

bool Recipe::forcedCarbonation() const { return get("forced_carb").toBool(); }

double Recipe::batchSize_l() const { return Brewtarget::toDouble(get("batch_size").toString(), "Recipe::batchSize_l()"); }
double Recipe::boilSize_l() const { return Brewtarget::toDouble(get("boil_size").toString(), "Recipe::boilSize_l()"); }
double Recipe::boilTime_min() const { return Brewtarget::toDouble(get("boil_time").toString(), "Recipe::boilTime_min()"); }
double Recipe::efficiency_pct() const { return Brewtarget::toDouble(get("efficiency").toString(), "Recipe::efficiency_pct()"); }
double Recipe::tasteRating() const { return Brewtarget::toDouble(get("taste_rating").toString(), "Recipe::tasteRating()"); }
double Recipe::primaryAge_days() const { return Brewtarget::toDouble(get("primary_age").toString(), "Recipe::primaryAge_days()"); }
double Recipe::primaryTemp_c() const { return Brewtarget::toDouble(get("primary_temp").toString(), "Recipe::primaryTemp_c()"); }
double Recipe::secondaryAge_days() const { return Brewtarget::toDouble(get("secondary_age").toString(), "Recipe::secondaryAge_days()"); }
double Recipe::secondaryTemp_c() const { return Brewtarget::toDouble(get("secondary_temp").toString(), "Recipe::secondaryTemp_c()"); }
double Recipe::tertiaryAge_days() const { return Brewtarget::toDouble(get("tertiary_age").toString(), "Recipe::tertiaryAge_days()"); }
double Recipe::tertiaryTemp_c() const { return Brewtarget::toDouble(get("tertiary_temp").toString(), "Recipe::tertiaryTemp_c()"); }
double Recipe::age_days() const { return Brewtarget::toDouble(get("age").toString(), "Recipe::age_days()"); }
double Recipe::ageTemp_c() const { return Brewtarget::toDouble(get("age_temp").toString(), "Recipe::ageTemp_c()"); }
double Recipe::carbonation_vols() const { return Brewtarget::toDouble(get("carb_volume").toString(), "Recipe::carbonation_vols()"); }
double Recipe::carbonationTemp_c() const { return Brewtarget::toDouble(get("carbonationTemp_c").toString(), "Recipe::carbonationTemp_c()"); }
double Recipe::primingSugarEquiv() const { return Brewtarget::toDouble(get("priming_sugar_equiv").toString(), "Recipe::primingSugarEquiv()"); }
double Recipe::kegPrimingFactor() const { return Brewtarget::toDouble(get("keg_priming_factor").toString(), "Recipe::kegPrimingFactor()"); }
double Recipe::batchSize_l() const { return get("batch_size").toDouble(); }
double Recipe::boilSize_l() const { return get("boil_size").toDouble(); }
double Recipe::boilTime_min() const { return get("boil_time").toDouble(); }
double Recipe::efficiency_pct() const { return get("efficiency").toDouble(); }
double Recipe::tasteRating() const { return get("taste_rating").toDouble(); }
double Recipe::primaryAge_days() const { return get("primary_age").toDouble(); }
double Recipe::primaryTemp_c() const { return get("primary_temp").toDouble(); }
double Recipe::secondaryAge_days() const { return get("secondary_age").toDouble(); }
double Recipe::secondaryTemp_c() const { return get("secondary_temp").toDouble(); }
double Recipe::tertiaryAge_days() const { return get("tertiary_age").toDouble(); }
double Recipe::tertiaryTemp_c() const { return get("tertiary_temp").toDouble(); }
double Recipe::age_days() const { return get("age").toDouble(); }
double Recipe::ageTemp_c() const { return get("age_temp").toDouble(); }
double Recipe::carbonation_vols() const { return get("carb_volume").toDouble(); }
double Recipe::carbonationTemp_c() const { return get("carbonationTemp_c").toDouble(); }
double Recipe::primingSugarEquiv() const { return get("priming_sugar_equiv").toDouble(); }
double Recipe::kegPrimingFactor() const { return get("keg_priming_factor").toDouble(); }

int Recipe::fermentationStages() const { return get("fermentation_stages").toInt(); }
QDate Recipe::date() const { return QDate::fromString( get("date").toString(), "d/M/yyyy"); }
Expand Down
16 changes: 8 additions & 8 deletions src/water.cpp
Expand Up @@ -130,11 +130,11 @@ void Water::setNotes( const QString &var )
QString Water::name() const { return get("name").toString(); }
QString Water::notes() const { return get("notes").toString(); }

double Water::sulfate_ppm() const { return Brewtarget::toDouble(get("sulfate").toString(), "Water::sulfate_ppm()"); }
double Water::amount_l() const { return Brewtarget::toDouble(get("amount").toString(), "Water::amount_l()"); }
double Water::calcium_ppm() const { return Brewtarget::toDouble(get("calcium").toString(), "Water::calcium_ppm()"); }
double Water::bicarbonate_ppm() const { return Brewtarget::toDouble(get("bicarbonate").toString(), "Water::bicarbonate_ppm()"); }
double Water::chloride_ppm() const { return Brewtarget::toDouble(get("chloride").toString(), "Water::chloride_ppm()"); }
double Water::sodium_ppm() const { return Brewtarget::toDouble(get("sodium").toString(), "Water::sodium_ppm()"); }
double Water::magnesium_ppm() const { return Brewtarget::toDouble(get("magnesium").toString(), "Water::magnesium_ppm()"); }
double Water::ph() const { return Brewtarget::toDouble(get("ph").toString(), "Water::ph()"); }
double Water::sulfate_ppm() const { return get("sulfate").toDouble(); }
double Water::amount_l() const { return get("amount").toDouble(); }
double Water::calcium_ppm() const { return get("calcium").toDouble(); }
double Water::bicarbonate_ppm() const { return get("bicarbonate").toDouble(); }
double Water::chloride_ppm() const { return get("chloride").toDouble(); }
double Water::sodium_ppm() const { return get("sodium").toDouble(); }
double Water::magnesium_ppm() const { return get("magnesium").toDouble(); }
double Water::ph() const { return get("ph").toDouble(); }

0 comments on commit 5cc8230

Please sign in to comment.