Sorting and save

This commit is contained in:
Mike Phares 2023-02-05 08:59:50 -07:00
parent 9def988f9d
commit e9d2c6374e
3 changed files with 10 additions and 1 deletions

View File

@ -245,7 +245,12 @@ public class MapLogicSupport : Shared.Models.Methods.IMapLogicSupport
if (!collection.Any())
results = Array.Empty<SortingContainer>();
else
results = Shared.Models.Stateless.Methods.ISortingContainer.Sort(collection);
{
if (_RangeDaysDeltaTolerance[1] > _RangeDaysDeltaTolerance[2])
results = Shared.Models.Stateless.Methods.ISortingContainer.Sort(collection);
else
results = Shared.Models.Stateless.Methods.ISortingContainer.SortUsingDaysDelta(collection);
}
return results;
}

View File

@ -1093,6 +1093,8 @@ public partial class DlibDotNet
LookForAbandoned(idToLocationContainers, distinctFilteredIds);
Mapping[] mappingCollection = MapLogicSupport.GetSelectedMappingCollection(distinctFilteredFaces);
int totalNotMapped = mapLogic.UpdateMappingFromPerson(mappingCollection);
string json = System.Text.Json.JsonSerializer.Serialize(mappingCollection);
File.WriteAllText(Path.Combine(eDistanceContentDirectory, $"{ticks}.json"), json);
if (a2PeopleContentDirectory is not null && false)
mapLogic.CreateTree(ticks, a2PeopleContentDirectory);
foreach (string outputResolution in _Configuration.OutputResolutions)

View File

@ -6,6 +6,8 @@ public interface ISortingContainer
Models.SortingContainer[] TestStatic_Sort(List<Models.SortingContainer> collection) =>
Sort(collection);
static Models.SortingContainer[] Sort(List<Models.SortingContainer> collection) =>
(from l in collection orderby l.Sorting.DistancePermyriad select l).ToArray();
static Models.SortingContainer[] SortUsingDaysDelta(List<Models.SortingContainer> collection) =>
(from l in collection orderby l.Sorting.DistancePermyriad, l.Sorting.DaysDelta select l).ToArray();
}