filter out invalid organic manures
All checks were successful
FarmMaps.Develop/CarbonLib/pipeline/head This commit looks good
All checks were successful
FarmMaps.Develop/CarbonLib/pipeline/head This commit looks good
This commit is contained in:
@@ -156,7 +156,7 @@ namespace FarmMapsAPI.Carbon
|
|||||||
Crop = cropYear.MiterraCropName,
|
Crop = cropYear.MiterraCropName,
|
||||||
CropRes = cropYear.CropRes,
|
CropRes = cropYear.CropRes,
|
||||||
OrganicManures =
|
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 } }
|
CropYield = cropYear.CropYield } }
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -170,7 +170,10 @@ namespace FarmMapsAPI.Carbon
|
|||||||
{
|
{
|
||||||
foreach (var manure in cropYear.OrganicManures)
|
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);
|
var crop = mappedCropData.SingleOrDefault(x => x.Year == crops.Year);
|
||||||
|
|||||||
Reference in New Issue
Block a user