Add conditional sorting logic for Month span in memories sorting

This commit is contained in:
Cameron
2025-08-15 17:22:01 -04:00
parent 4315744abb
commit 7dcf89c47e

View File

@@ -285,7 +285,10 @@ pub async fn list_memories(
} }
} }
// Sort by day of the month and time (using the created timestamp) match span_mode {
// Sort by absolute time for a more 'overview'
MemoriesSpan::Month => memories_with_dates.sort_by(|a, b| a.1.cmp(&b.1)),
_ => {
memories_with_dates.sort_by(|a, b| { memories_with_dates.sort_by(|a, b| {
let day_comparison = a.1.day().cmp(&b.1.day()); let day_comparison = a.1.day().cmp(&b.1.day());
@@ -300,6 +303,9 @@ pub async fn list_memories(
day_comparison day_comparison
} }
}); });
}
}
// Sort by day of the month and time (using the created timestamp)
let items: Vec<MemoryItem> = memories_with_dates.into_iter().map(|(m, _)| m).collect(); let items: Vec<MemoryItem> = memories_with_dates.into_iter().map(|(m, _)| m).collect();