mirror of
https://github.com/p-stream/backend.git
synced 2026-03-11 17:55:35 +00:00
Use date to compare progress items
This commit is contained in:
parent
4129b80828
commit
cf0125755c
1 changed files with 3 additions and 4 deletions
|
|
@ -100,10 +100,9 @@ export const userProgressRouter = makeRouter((app) => {
|
|||
|
||||
if (newItemIndex > -1) {
|
||||
const newItem = newItems[newItemIndex];
|
||||
if (existingItem.watched < newItem.watched) {
|
||||
existingItem.updatedAt = defaultAndCoerceDateTime(
|
||||
newItem.updatedAt,
|
||||
);
|
||||
const newItemDate = defaultAndCoerceDateTime(newItem.updatedAt);
|
||||
if (existingItem.updatedAt.getTime() < newItemDate.getTime()) {
|
||||
existingItem.updatedAt = newItemDate;
|
||||
existingItem.watched = newItem.watched;
|
||||
}
|
||||
itemsUpserted.push(existingItem);
|
||||
|
|
|
|||
Loading…
Reference in a new issue