mirror of https://github.com/FreeTubeApp/FreeTube
Remove duplicates from history (#216)
This commit is contained in:
parent
916812b8f9
commit
390bc24c1c
|
@ -30,7 +30,20 @@ function addToHistory(videoId){
|
||||||
videoId: videoId,
|
videoId: videoId,
|
||||||
timeWatched: new Date().getTime(),
|
timeWatched: new Date().getTime(),
|
||||||
};
|
};
|
||||||
historyDb.insert(data, (err, newDoc) => {});
|
|
||||||
|
historyDb.findOne({ videoId: videoId }, function (err, doc) {
|
||||||
|
if(doc === null) {
|
||||||
|
historyDb.insert(data, (err, newDoc) => {});
|
||||||
|
} else {
|
||||||
|
historyDb.update(
|
||||||
|
{ videoId: videoId },
|
||||||
|
{
|
||||||
|
$set: {
|
||||||
|
timeWatched: data.timeWatched,
|
||||||
|
}
|
||||||
|
}, {}, (err, newDoc) => {});
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue