Updated Blight and Zonering

This commit is contained in:
2021-03-01 14:04:18 +01:00
parent a29b973268
commit 6debe82085
8 changed files with 80 additions and 31 deletions

View File

@@ -38,7 +38,7 @@ namespace FarmmapsApi.Services
}
public async Task<Item> UploadDataAsync(UserRoot root, string itemType, string filePath, string itemName) {
var startUpload = DateTime.UtcNow;
var startUpload = DateTime.UtcNow.AddSeconds(-3);
var result = await _farmmapsApiService.UploadFile(filePath, root.Code,
progress => _logger.LogInformation($"Status: {progress.Status} - BytesSent: {progress.BytesSent}"));
@@ -90,9 +90,9 @@ namespace FarmmapsApi.Services
return null;
}
//the taskmap is a child of the input tiff
//the taskmap is a child of the input tiff *** Update feb 2021: it is a child of the cropfield.
var itemName = "Taskmap";
var taskMapItem = await FindChildItemAsync(tiffItem.Code,
var taskMapItem = await FindChildItemAsync(tiffItem.ParentCode,
SHAPE_PROCESSED_ITEMTYPE, itemName);
if (taskMapItem == null) {
_logger.LogError("Could not find the shape taskmap as a child item under the input");
@@ -131,8 +131,6 @@ namespace FarmmapsApi.Services
await PollTask(TimeSpan.FromSeconds(3), async source => {
_logger.LogInformation($"Trying to get {containsName} data");
var uploadedFilesChildren = await _farmmapsApiService.GetItemChildrenAsync(parentCode, itemType);
Func<Item, bool> func = filter ?? (i => i.Name.ToLower().Contains(containsName.ToLower()));
dataItem = uploadedFilesChildren.FirstOrDefault(func);
if (dataItem != null || tries == maxTries) {