Use date to compare progress items

This commit is contained in:
William Oldham
2023-12-06 19:55:09 +00:00
parent 4129b80828
commit cf0125755c

View File

@@ -100,10 +100,9 @@ export const userProgressRouter = makeRouter((app) => {
if (newItemIndex > -1) { if (newItemIndex > -1) {
const newItem = newItems[newItemIndex]; const newItem = newItems[newItemIndex];
if (existingItem.watched < newItem.watched) { const newItemDate = defaultAndCoerceDateTime(newItem.updatedAt);
existingItem.updatedAt = defaultAndCoerceDateTime( if (existingItem.updatedAt.getTime() < newItemDate.getTime()) {
newItem.updatedAt, existingItem.updatedAt = newItemDate;
);
existingItem.watched = newItem.watched; existingItem.watched = newItem.watched;
} }
itemsUpserted.push(existingItem); itemsUpserted.push(existingItem);