fix bug in random function

This commit is contained in:
Max Böck 2019-04-14 22:06:32 +02:00
parent 95240a1abe
commit 45987600a0

View file

@ -34,9 +34,9 @@ export const getPrevious = url => {
}
export const getRandom = url => {
const randomIndex = Math.floor(Math.random() * members.length)
const sites = url
const selection = url
? members.filter(site => !url.includes(site.url))
: members
return sites[randomIndex]
const randomIndex = Math.floor(Math.random() * selection.length)
return selection[randomIndex]
}