diff --git a/CarbonCalculation.cs b/CarbonCalculation.cs index 71d54de..e86da0c 100644 --- a/CarbonCalculation.cs +++ b/CarbonCalculation.cs @@ -156,7 +156,7 @@ namespace FarmMapsAPI.Carbon Crop = cropYear.MiterraCropName, CropRes = cropYear.CropRes, OrganicManures = - cropYear.OrganicManures.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 }).ToList(), CropYield = cropYear.CropYield } } }); } @@ -170,7 +170,10 @@ namespace FarmMapsAPI.Carbon { foreach (var manure in cropYear.OrganicManures) { - orgManure.Add(new OrganicManureType { Type = manure.Type, Quantity = manure.Quantity }); + if (!string.IsNullOrEmpty(manure.Type) && manure.Quantity > 0) + { + orgManure.Add(new OrganicManureType { Type = manure.Type, Quantity = manure.Quantity }); + } } } var crop = mappedCropData.SingleOrDefault(x => x.Year == crops.Year);