Error - Don't keep
This commit is contained in:
@ -6,11 +6,11 @@ public interface ISorting
|
||||
Models.Sorting[] TestStatic_Sort(List<Models.Sorting> collection) =>
|
||||
Sort(collection);
|
||||
static Models.Sorting[] Sort(List<Models.Sorting> collection) =>
|
||||
(from l in collection orderby l.WithinRange, l.DistancePermyriad, l.DaysDelta select l).ToArray();
|
||||
(from l in collection orderby l.DistancePermyriad, l.DaysDelta select l).ToArray();
|
||||
|
||||
Models.Sorting TestStatic_Get(int faceDistancePermyriad, double rangeDistanceTolerance, Models.FaceDistance faceDistanceEncoding, Models.FaceDistance faceDistanceLength, List<(long lcl, long minimum, long maximum, long ucl)> personKeysRangesCollection) =>
|
||||
Get(faceDistancePermyriad, rangeDistanceTolerance, faceDistanceEncoding, faceDistanceLength, personKeysRangesCollection);
|
||||
static Models.Sorting Get(int faceDistancePermyriad, double rangeDistanceTolerance, Models.FaceDistance faceDistanceEncoding, Models.FaceDistance faceDistanceLength, List<(long lcl, long minimum, long maximum, long ucl)> personKeysRangesCollection) =>
|
||||
Sorting.Get(faceDistancePermyriad, rangeDistanceTolerance, faceDistanceEncoding, faceDistanceLength, personKeysRangesCollection);
|
||||
Models.Sorting TestStatic_Get(int faceDistancePermyriad, double rangeDistanceTolerance, Models.FaceDistance faceDistanceEncoding, Models.FaceDistance faceDistanceLength) =>
|
||||
Get(faceDistancePermyriad, rangeDistanceTolerance, faceDistanceEncoding, faceDistanceLength);
|
||||
static Models.Sorting Get(int faceDistancePermyriad, double rangeDistanceTolerance, Models.FaceDistance faceDistanceEncoding, Models.FaceDistance faceDistanceLength) =>
|
||||
Sorting.Get(faceDistancePermyriad, rangeDistanceTolerance, faceDistanceEncoding, faceDistanceLength);
|
||||
|
||||
}
|
@ -6,6 +6,6 @@ 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.WithinRange, l.Sorting.DistancePermyriad, l.Sorting.DaysDelta select l).ToArray();
|
||||
(from l in collection orderby l.Sorting.DistancePermyriad, l.Sorting.DaysDelta select l).ToArray();
|
||||
|
||||
}
|
@ -3,7 +3,7 @@ namespace View_by_Distance.Shared.Models.Stateless.Methods;
|
||||
internal abstract class Sorting
|
||||
{
|
||||
|
||||
internal static Models.Sorting Get(int faceDistancePermyriad, double rangeDistanceTolerance, Models.FaceDistance faceDistanceEncoding, Models.FaceDistance faceDistanceLength, List<(long lcl, long minimum, long maximum, long ucl)> personKeysRangesCollection)
|
||||
internal static Models.Sorting Get(int faceDistancePermyriad, double rangeDistanceTolerance, Models.FaceDistance faceDistanceEncoding, Models.FaceDistance faceDistanceLength)
|
||||
{
|
||||
Models.Sorting result;
|
||||
if (faceDistanceLength.Length is null)
|
||||
@ -12,28 +12,12 @@ internal abstract class Sorting
|
||||
throw new NotSupportedException();
|
||||
if (faceDistanceEncoding.MinimumDateTime is null || faceDistanceLength.MinimumDateTime is null)
|
||||
throw new NotSupportedException();
|
||||
List<int> withinRanges = new();
|
||||
long ticks = faceDistanceEncoding.MinimumDateTime.Value.Ticks;
|
||||
TimeSpan timeSpan = new(faceDistanceLength.MinimumDateTime.Value.Ticks - ticks);
|
||||
bool older = timeSpan.TotalMilliseconds < 0;
|
||||
int daysDelta = (int)Math.Round(Math.Abs(timeSpan.TotalDays), 0);
|
||||
int distancePermyriad = (int)(faceDistanceLength.Length.Value / rangeDistanceTolerance * faceDistancePermyriad);
|
||||
if (!personKeysRangesCollection.Any())
|
||||
withinRanges.Add(0);
|
||||
else
|
||||
{
|
||||
foreach ((long lcl, long minimum, long maximum, long ucl) in personKeysRangesCollection)
|
||||
{
|
||||
if (ticks > minimum && ticks < maximum)
|
||||
withinRanges.Add(0);
|
||||
else if (ticks > lcl && ticks < ucl)
|
||||
withinRanges.Add(1);
|
||||
else
|
||||
withinRanges.Add(2);
|
||||
}
|
||||
}
|
||||
int withinRange = withinRanges.Max();
|
||||
result = new(daysDelta, distancePermyriad, faceDistanceLength.Id, faceDistanceLength.NormalizedRectangle.Value, older, withinRange);
|
||||
result = new(daysDelta, distancePermyriad, faceDistanceLength.Id, faceDistanceLength.NormalizedRectangle.Value, older);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user