mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-07 13:22:54 +00:00
Fix video deduper timestamp comparison
This commit is contained in:
1 parent
46691b1578
commit
d235839e22
2 files changed
+32
-1
No files matched your search
@@ -8,6 +8,11 @@
|
||||
export function dedupeToNewestByRoot(videos) {
|
||||
const map = new Map();
|
||||
|
||||
const normalizeTimestamp = (value) => {
|
||||
const numeric = Number(value);
|
||||
return Number.isFinite(numeric) ? numeric : -Infinity;
|
||||
};
|
||||
|
||||
for (const vid of videos || []) {
|
||||
if (!vid) {
|
||||
continue;
|
||||
@@ -18,7 +23,10 @@ export function dedupeToNewestByRoot(videos) {
|
||||
}
|
||||
|
||||
const existing = map.get(rootId);
|
||||
if (!existing || vid.created_at > existing.created_at) {
|
||||
if (
|
||||
!existing ||
|
||||
normalizeTimestamp(vid.created_at) > normalizeTimestamp(existing.created_at)
|
||||
) {
|
||||
map.set(rootId, vid);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user