forked from FarmMaps/FarmMapsApiClient
fixed upload shape zip.
This commit is contained in:
parent
a065a28e01
commit
d9fa663de9
@ -64,34 +64,9 @@ namespace FarmmapsApi.Services
|
|||||||
if (result.Progress.Status == UploadStatus.Failed)
|
if (result.Progress.Status == UploadStatus.Failed)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
var zipName = Path.GetFileName(filePath);
|
return await FindChildItemAsync(root.Code, SHAPE_PROCESSED_ITEMTYPE, itemName,
|
||||||
Item shapeItem = null;
|
i => i.Created >= startUpload &&
|
||||||
await PollTask(TimeSpan.FromSeconds(3), async source =>
|
i.Name.ToLower().Contains(itemName.ToLower()));;
|
||||||
{
|
|
||||||
_logger.LogInformation($"Searching for {itemName} item");
|
|
||||||
var uploadedFilesChildren = await _farmmapsApiService.GetItemChildrenAsync(root.Code);
|
|
||||||
var zipItems = uploadedFilesChildren.Where(i => i.Name.Contains(zipName));
|
|
||||||
|
|
||||||
foreach (var zipItem in zipItems)
|
|
||||||
{
|
|
||||||
List<Item> items = await _farmmapsApiService.GetItemChildrenAsync(zipItem.Code,
|
|
||||||
SHAPE_PROCESSED_ITEMTYPE);
|
|
||||||
|
|
||||||
items = items.Where(i => i.Created >= startUpload).OrderByDescending(i => i.Created).ToList();
|
|
||||||
|
|
||||||
if (items.Any())
|
|
||||||
{
|
|
||||||
shapeItem = items.First(i => i.Name.Contains(itemName));
|
|
||||||
if (shapeItem != null)
|
|
||||||
{
|
|
||||||
source.Cancel();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return shapeItem;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<Item> ShapeToGeotiff(Item shapeItem)
|
public async Task<Item> ShapeToGeotiff(Item shapeItem)
|
||||||
@ -172,13 +147,9 @@ namespace FarmmapsApi.Services
|
|||||||
{
|
{
|
||||||
_logger.LogInformation($"Trying to get {containsName} data");
|
_logger.LogInformation($"Trying to get {containsName} data");
|
||||||
var uploadedFilesChildren = await _farmmapsApiService.GetItemChildrenAsync(parentCode, itemType);
|
var uploadedFilesChildren = await _farmmapsApiService.GetItemChildrenAsync(parentCode, itemType);
|
||||||
if (uploadedFilesChildren.Count > 0)
|
Func<Item, bool> func = filter ?? (i => i.Name.ToLower().Contains(containsName.ToLower()));
|
||||||
{
|
dataItem = uploadedFilesChildren.FirstOrDefault(func);
|
||||||
Func<Item, bool> func = filter ?? (i => i.Name.ToLower().Contains(containsName.ToLower()));
|
if (dataItem != null || tries == maxTries)
|
||||||
dataItem = uploadedFilesChildren.FirstOrDefault(func);
|
|
||||||
source.Cancel();
|
|
||||||
}
|
|
||||||
else if (tries == maxTries)
|
|
||||||
{
|
{
|
||||||
source.Cancel();
|
source.Cancel();
|
||||||
}
|
}
|
||||||
|
@ -76,7 +76,6 @@ namespace FarmmapsNbs
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
var cropfieldItem = await _generalService.CreateCropfieldItemAsync(myDriveRoot.Code,
|
var cropfieldItem = await _generalService.CreateCropfieldItemAsync(myDriveRoot.Code,
|
||||||
$"VRA NBS cropfield {input.OutputFileName}", plantingDate.Year, input.GeometryJson.ToString(Formatting.None));
|
$"VRA NBS cropfield {input.OutputFileName}", plantingDate.Year, input.GeometryJson.ToString(Formatting.None));
|
||||||
|
|
||||||
|
@ -12,6 +12,9 @@
|
|||||||
<None Update="Data\**\*">
|
<None Update="Data\**\*">
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
|
<None Update="PotenInput.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
Loading…
Reference in New Issue
Block a user