Skip to content

Commit

Permalink
if not soluble doesnt show nutrient concentration calculated
Browse files Browse the repository at this point in the history
  • Loading branch information
lunamoonmoon committed Jan 28, 2025
1 parent 4cd427a commit c3f463a
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions app/Server/src/SERVERAPI/Controllers/NutrientsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -823,7 +823,7 @@ public IActionResult FertigationDetails(FertigationDetailsViewModel fgvm)

//Total Product Volume per fertigation
fgvm.totProductVolPerFert = Math.Round(field.Area * selectedProductRate, 1); // convert to int/string? Error messages?

// Total product volume per growing season calc
// Product Rate x Fertigation area x fert per season
fgvm.totProductVolPerSeason = Math.Round(field.Area * selectedProductRate, 1) * fgvm.eventsPerSeason; // convert to int/string? Error messages?
Expand Down Expand Up @@ -1052,23 +1052,25 @@ private void SolidFertigationCalculation(FertigationDetailsViewModel fgvm){

fertArea = Convert.ToDecimal(fgvm.fieldArea);

//Need in lb/us gallon
fgvm.nutrientConcentrationN = Convert.ToString(Math.Round(amountToDissolve * Convert.ToDecimal(fgvm.valN) / 100 / (tankVolume * 1.20095m), 2));
fgvm.nutrientConcentrationK2O = Convert.ToString(Math.Round(amountToDissolve * Convert.ToDecimal(fgvm.valK2o) / 100 / (tankVolume * 1.20095m), 2));
fgvm.nutrientConcentrationP205 = Convert.ToString(Math.Round(amountToDissolve * Convert.ToDecimal(fgvm.valP2o5) / 100 / (tankVolume * 1.20095m), 2));


fgvm.fertigationTime = Math.Round(tankVolume / convertedInjectionRate, 0);

//convert tankVolume from imp gal to litres
//convert amountToDissolve from lbs to kgs
if ((amountToDissolve * 0.45359237m) <= ((tankVolume * 4.54609m) * solInWater / 1000 * 0.65m))
{
fgvm.dryAction = "Soluble";
}
//Need in lb/us gallon
fgvm.nutrientConcentrationN = Convert.ToString(Math.Round(amountToDissolve * Convert.ToDecimal(fgvm.valN) / 100 / (tankVolume * 1.20095m), 2));
fgvm.nutrientConcentrationK2O = Convert.ToString(Math.Round(amountToDissolve * Convert.ToDecimal(fgvm.valK2o) / 100 / (tankVolume * 1.20095m), 2));
fgvm.nutrientConcentrationP205 = Convert.ToString(Math.Round(amountToDissolve * Convert.ToDecimal(fgvm.valP2o5) / 100 / (tankVolume * 1.20095m), 2));
}
else
{
fgvm.dryAction = "Reduce the amount to dissolve";
// dont show nutrient concentration calculations if need to reduce amount to dissolve
fgvm.nutrientConcentrationN = "0";
fgvm.nutrientConcentrationK2O = "0";
fgvm.nutrientConcentrationP205 = "0";
}

fgvm.calcN = Convert.ToString(Math.Round(Convert.ToDecimal(fgvm.nutrientConcentrationN) * amountToDissolve / fertArea, 2));
Expand Down

0 comments on commit c3f463a

Please sign in to comment.