NonSpecificPeopleCollection now checks every hour

No longer using default if not any _NotMappedPersonContainers
This commit is contained in:
2023-07-30 23:42:22 -07:00
parent 1594783c7d
commit 5b9e32bce6
2 changed files with 52 additions and 10 deletions

View File

@ -501,7 +501,48 @@ internal abstract class MapLogic
return result;
}
private static List<PersonContainer> GetNotMappedPersonContainers(Configuration configuration, ReadOnlyCollection<PersonContainer> personContainers, long[] personKeyCollection)
private static List<PersonContainer> GetNonSpecificPeopleCollection(Configuration configuration, long ticks, List<long> personKeys)
{
List<PersonContainer> results = new();
bool check;
Person person;
long personKey;
int? approximateYears = null;
PersonBirthday personBirthday;
PersonContainer personContainer;
string[] personDisplayDirectoryAllFiles = Array.Empty<string>();
DateTime incrementDate = new(configuration.PersonBirthdayFirstYear, 1, 1);
long oneHour = new DateTime(1, 1, 1, 1, 0, 0).Ticks - new DateTime(1, 1, 1).Ticks;
for (int i = 0; i < int.MaxValue; i++)
{
check = false;
personKey = incrementDate.Ticks;
incrementDate = incrementDate.AddDays(1);
if (incrementDate.Ticks > ticks)
break;
if (personKeys.Contains(personKey))
continue;
for (int j = 1; j < 24; j++)
{
if (personKeys.Contains(personKey + (oneHour * j)))
{
check = true;
break;
}
}
if (check)
continue;
personBirthday = IPersonBirthday.GetPersonBirthday(personKey + (oneHour * 2));
person = IPerson.GetPerson(configuration.MappingDefaultName, configuration.PersonCharacters.ToArray(), configuration.MappingDefaultName, personKey, personBirthday);
personContainer = new(approximateYears, new PersonBirthday[] { personBirthday }, personDisplayDirectoryAllFiles, configuration.MappingDefaultName, personKey, person);
results.Add(personContainer);
if (results.Count > 999)
break;
}
return results;
}
private static List<PersonContainer> GetNotMappedPersonContainers(Configuration configuration, long ticks, ReadOnlyCollection<PersonContainer> personContainers, long[] personKeyCollection)
{
List<PersonContainer> results = new();
List<PersonContainer> notMappedAndNotNamedPersonKeys = new();
@ -521,6 +562,8 @@ internal abstract class MapLogic
notMappedAndWithNamedPersonKeys.Add(personContainer);
}
results.AddRange(notMappedAndNotNamedPersonKeys);
if (results.Count == 0)
results.AddRange(GetNonSpecificPeopleCollection(configuration, ticks, personKeys));
return results;
}
@ -866,7 +909,7 @@ internal abstract class MapLogic
long[] personKeyCollection = (from l in nullablePersonKeyCollection where l is not null select l.Value).Distinct().ToArray();
PossiblyRebuildPersonContainers(configuration, a2PeopleSingletonDirectory, personKeyFormattedToNewestPersonKeyFormatted, possiblyNewPersonDisplayDirectoryNamesAndPersonContainer);
SetPersonKeyToPersonContainer(configuration, personContainers, personKeyCollection, personKeyToPersonContainer, personKeyToPersonContainerCollection);
notMappedPersonContainers.AddRange(GetNotMappedPersonContainers(configuration, personContainers, personKeyCollection));
notMappedPersonContainers.AddRange(GetNotMappedPersonContainers(configuration, ticks, personContainers, personKeyCollection));
}
private static string GetMappingSegmentB(long ticks, PersonBirthday personBirthday, int? approximateYears, long dateTimeOriginalThenMinimumDateTimeTicks, bool? isWrongYear)