merged from master
Some checks reported errors
FarmMaps.Develop/CarbonLib/pipeline/head Something is wrong with the build of this commit

This commit is contained in:
2024-02-19 13:00:49 +01:00
2 changed files with 8 additions and 6 deletions

View File

@@ -156,7 +156,7 @@ namespace FarmMapsAPI.Carbon
Crop = cropYear.MiterraCropName, Crop = cropYear.MiterraCropName,
CropRes = cropYear.CropRes, CropRes = cropYear.CropRes,
OrganicManures = OrganicManures =
cropYear.OrganicManures.Where(y=>y.Quantity > 0 && !string.IsNullOrEmpty(y.Type)).Select(x => new OrganicManureType { Type = x.Type, Quantity = x.Quantity }).ToList(), cropYear.OrganicManures.Where(y=>y.Quantity > 0 && !string.IsNullOrEmpty(y.Type)).Select(x => new OrganicManureType { Type = x.Type, Quantity = x.Quantity.HasValue? x.Quantity.Value : 0 }).ToList(),
CropYield = cropYear.CropYield, CropYield = cropYear.CropYield,
Irrigation = crops.Irrigations} } Irrigation = crops.Irrigations} }
}); });
@@ -171,9 +171,9 @@ namespace FarmMapsAPI.Carbon
{ {
foreach (var manure in cropYear.OrganicManures) foreach (var manure in cropYear.OrganicManures)
{ {
if (!string.IsNullOrEmpty(manure.Type) && manure.Quantity > 0) if (!string.IsNullOrEmpty(manure.Type) && manure.Quantity.HasValue && manure.Quantity > 0)
{ {
orgManure.Add(new OrganicManureType { Type = manure.Type, Quantity = manure.Quantity }); orgManure.Add(new OrganicManureType { Type = manure.Type, Quantity = manure.Quantity.HasValue ? manure.Quantity.Value : 0 });
} }
} }
} }
@@ -276,7 +276,9 @@ namespace FarmMapsAPI.Carbon
{ {
soilPropertyDepth10 = true; soilPropertyDepth10 = true;
} }
//FSA todo: different corrections for depth10 (10, 25, 30 cm) // Different corrections for depth (10, 25, 30 cm)
// depth of 10cm has same result as previous checkbox (sample taken at 10cm)
parameterSet.LayerDepth = item.Value.Depth.HasValue? item.Value.Depth.Value : parameterSet.LayerDepth;
if (initialSoil == "Temp_gras" && soilPropertyDepth10) if (initialSoil == "Temp_gras" && soilPropertyDepth10)
{ {
oM_corr_SoilType.Add((item.Key, soilOfItem), item.Value.OM_Cont * 0.97); oM_corr_SoilType.Add((item.Key, soilOfItem), item.Value.OM_Cont * 0.97);

View File

@@ -70,7 +70,7 @@ namespace FarmMapsAPI.Carbon.Models
[Required] [Required]
public string Type { get; set; } public string Type { get; set; }
[Required] [Required]
public double Quantity { get; set; } public double? Quantity { get; set; }
} }
public class SoilPropertyFarmMaps public class SoilPropertyFarmMaps