Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Prioritize last met over birthday

laurenspriemc45e4ad1d153
diff --git a/mobile/lib/services/smart_memories_service.dart b/mobile/lib/services/smart_memories_service.dart
index db915f6587..b69ad76b90 100644
--- a/mobile/lib/services/smart_memories_service.dart
+++ b/mobile/lib/services/smart_memories_service.dart
@@ -583,6 +583,22 @@ class SmartMemoriesService {
final personMemories = personToMemories[personID];
if (personID == meID || personMemories == null) continue;
final person = personIdToPerson[personID]!;
+
+ // Check if we should surface memory based on last met
+ final lastMetMemory =
+ personMemories[PeopleMemoryType.lastTimeYouSawThem]?.first;
+ if (lastMetMemory != null) {
+ final lastMetTime = DateTime.fromMicrosecondsSinceEpoch(
+ lastMetMemory.lastCreationTime!,
+ ).copyWith(year: currentTime.year);
+ final daysSinceLastMet = lastMetTime.difference(currentTime).inDays;
+ if (daysSinceLastMet < 7 && daysSinceLastMet >= 0) {
+ memoryResults.add(lastMetMemory);
+ }
+ // Don't surface birthday when person hasn't been seen in a while (could be passed away)
+ continue;
+ }
+
// Check if we should surface memory based on birthday
final birthdate = DateTime.tryParse(person.data.birthDate ?? "");
if (birthdate != null) {
@@ -631,24 +647,10 @@ class SmartMemoriesService {
continue;
}
}
-
- // Check if we should surface memory based on last met
- final lastMetMemory =
- personMemories[PeopleMemoryType.lastTimeYouSawThem]?.first;
- if (lastMetMemory != null) {
- final lastMetTime = DateTime.fromMicrosecondsSinceEpoch(
- lastMetMemory.lastCreationTime!,
- ).copyWith(year: currentTime.year);
- final daysSinceLastMet = lastMetTime.difference(currentTime).inDays;
- if (daysSinceLastMet < 7 && daysSinceLastMet >= 0) {
- memoryResults.add(lastMetMemory);
- }
- }
}
w?.log('relevancy setup');
// Loop through the people (and memory types) and add based on rotation
- if (memoryResults.length >= 3) return memoryResults;
peopleRotationLoop:
for (final personID in orderedImportantPersonsID) {
for (final memory in memoryResults) {