Return the most watched item in the database

This fixes a issue where a more recent watch event that was shorter than a existing watch confused users into thinking that the video wasn't completely watched already.
This commit is contained in:
root
2022-08-21 23:21:27 +05:30
parent b0eab5058b
commit 0ff898c927
+3 -2
View File
@@ -23,8 +23,9 @@ export function updateWatchedVideoProgress (videoID, prog, dur) {
})
}
export function findLastWatch (videoId) {
return PMDB.watchedVideos.where('videoId').equals(videoId).last()
export async function findLastWatch (videoId) {
const v = await PMDB.watchedVideos.where('videoId').equals(videoId).reverse().sortBy('progressPcnt')
return v[0]
}
export function getWatchedVideos () {