Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Eliminate zero listens in trending results #153

Merged
merged 1 commit into from
Oct 30, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 0 additions & 18 deletions identity-service/src/routes/trackListens.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,24 +191,6 @@ const getTrendingTracks = async (
seenTrackIds.push(elem.trackId)
})

const seenIdSet = new Set(seenTrackIds)
if (idList && seenIdSet.size < idList.length) {
// For any tracks in the required id list that were not listened to in the last <timeFrame>
// Populate empty listen counts
for (var i = 0; i < idList.length; i++) {
const id = parseInt(idList[i])
// Add tracks only if not already present in parsedListenCounts
if (!seenIdSet.has(id)) {
parsedListenCounts.push({ trackId: id, listens: 0 })
}

// Exit if desired response limit has been met
if (limit && parsedListenCounts.length >= limit) {
break
}
}
}

return parsedListenCounts
}

Expand Down