aw6373: read organic matter from eurofins if available
All checks were successful
FarmMaps.Develop/CarbonLib/pipeline/head This commit looks good

This commit is contained in:
2024-11-14 13:51:34 +01:00
parent 7f510c7c8e
commit 346b6eaf78
2 changed files with 24 additions and 2 deletions

View File

@@ -217,7 +217,15 @@ namespace FarmMapsAPI.Carbon
{
string provinceCode = GetProvinceCode(dataTransformationSet, postalCode);
var crpYield = cropYieldConfig.SingleOrDefault(x => x.CropName.ToLower() == cropCode.ToLower());
if (crpYield == null)
{
return 0;
}
var crpYieldProvince = crpYield.Yields.SingleOrDefault(x => x.ProvinceCode == provinceCode);
if (crpYieldProvince == null)
{
return 0;
}
var cropYield = crpYieldProvince.YearData.SingleOrDefault(x => x.Year == year)?.YieldValue;
return cropYield;
}

View File

@@ -21,6 +21,9 @@ namespace FarmMapsAPI.Carbon.Models
//added
public int CalculateUntil { get; set; }
//fsa
public int CalculateFrom { get; set; }
}
public class CropFieldFarmMaps
@@ -31,10 +34,11 @@ namespace FarmMapsAPI.Carbon.Models
public double Area { get; set; }
[Required]
public string SoilType { get; set; }
public string SoilTypeDefault { get; set; }
[Required]
public SoilPropertyFarmMaps SoilProperty { get; set; }
[Required]
public List<HistoricalCropDataFarmMaps> HistoricalCropData { get; set; }
public List<HistoricalCropDataFarmMaps> HistoricalCropData { get; set; }
}
public class HistoricalCropDataFarmMaps
@@ -78,10 +82,20 @@ namespace FarmMapsAPI.Carbon.Models
{
public double? OM_Const { get; set; }
public double? C_Const { get; set; }
public double? OM_ConstDefault { get; set; }
public string OM_Choice { get; set; }
public double? Clay_Content { get; set; }
public double? Clay_ContentDefault { get; set; }
public bool Depth10 { get; set; }
public int? Depth { get; set; }
public int? Depth { get; set; }
[JsonIgnore]
public List<OrganicMatterFarmMaps> OrganicMatters { get; set; }
}
public class OrganicMatterFarmMaps
{
public int Year { get; set; }
public double OrganicMatter { get; set; }
}
public class GreenManureTypeFarmMaps