mirror of
https://github.com/ThatGuySam/doesitarm.git
synced 2026-05-18 06:44:46 -07:00
Fix duplicate related video entries
This commit is contained in:
parent
afec75f482
commit
d8f0c8b486
1 changed files with 6 additions and 6 deletions
|
|
@ -21,7 +21,7 @@ export function appsRelatedToVideo ( video ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function videosRelatedToVideo ( video ) {
|
export function videosRelatedToVideo ( video ) {
|
||||||
const relatedVideos = []
|
const relatedVideos = {}
|
||||||
|
|
||||||
const featuredApps = appsRelatedToVideo( video )
|
const featuredApps = appsRelatedToVideo( video )
|
||||||
|
|
||||||
|
|
@ -35,23 +35,23 @@ export function videosRelatedToVideo ( video ) {
|
||||||
if (otherVideo.slug === video.slug) continue
|
if (otherVideo.slug === video.slug) continue
|
||||||
|
|
||||||
// Add this video to our related videos list
|
// Add this video to our related videos list
|
||||||
relatedVideos.push(otherVideo)
|
relatedVideos[otherVideo.id] = otherVideo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return relatedVideos
|
return Object.values(relatedVideos)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export function videosRelatedToApp ( app ) {
|
export function videosRelatedToApp ( app ) {
|
||||||
const relatedVideos = []
|
const relatedVideos = {}
|
||||||
|
|
||||||
// Find other videos that also feature this video's app
|
// Find other videos that also feature this video's app
|
||||||
for (const video of videoList) {
|
for (const video of videoList) {
|
||||||
if (!video.apps.includes(app.slug)) continue
|
if (!video.apps.includes(app.slug)) continue
|
||||||
|
|
||||||
relatedVideos.push(video)
|
relatedVideos[video.id] = video
|
||||||
}
|
}
|
||||||
|
|
||||||
return relatedVideos
|
return Object.values(relatedVideos)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue