www/import/from_brouwhulp.php

changeset 114
4935e86b2775
parent 111
8c4ba91adf58
child 118
07daa505d309
--- a/www/import/from_brouwhulp.php	Fri Nov 23 15:25:54 2018 +0100
+++ b/www/import/from_brouwhulp.php	Wed Nov 28 21:57:06 2018 +0100
@@ -1123,6 +1123,13 @@
 		$count = mysqli_affected_rows($db);
 		if ($count > 0) {
 			$psql .= "', log_fermentation='1";
+		} else {
+			// See if there really are no records
+			$sql  = "SELECT product_code FROM log_fermentation WHERE product_code='".$recipe->NR_RECIPE."';";
+			$count = mysqli_affected_rows($db);
+			if ($count > 0) {
+				$psql .= "', log_fermentation='1";
+			}
 		}
 
 		/*
@@ -1163,7 +1170,13 @@
 			if ($recipe->EQUIPMENT->TOP_UP_WATER)
 				$psql .= "', eq_top_up_water='" . floatval($recipe->EQUIPMENT->TOP_UP_WATER);
 			$psql .= "', eq_trub_chiller_loss='" . floatval($recipe->EQUIPMENT->TRUB_CHILLER_LOSS);
-			$psql .= "', eq_evap_rate='" . floatval($recipe->EQUIPMENT->EVAP_RATE);
+			/*
+			 * Brouwhulp uses a percentage for the evaporation rate. This is wrong
+			 * but was made so because the beerxml standard requires this. What we
+			 * do is calculate the actual evaporation and store that.
+			 * This is what we use. Brouwhulp calculates this on the fly.
+			 */
+			$psql .= "', eq_evap_rate='" . (floatval($recipe->EQUIPMENT->EVAP_RATE) * floatval($recipe->EQUIPMENT->BOIL_SIZE)) / 100;
 			$psql .= "', eq_boil_time='" . floatval($recipe->EQUIPMENT->BOIL_TIME);
 			($recipe->EQUIPMENT->CALC_BOIL_VOLUME == 'TRUE') ? $psql .= "', eq_calc_boil_volume='1" : $psql .= "', eq_calc_boil_volume='0";
 			if ($recipe->EQUIPMENT->TOP_UP_KETTLE)

mercurial