rename filter function
This commit is contained in:
parent
66507cb08f
commit
296a490e93
@ -63,10 +63,12 @@ export default class VoteController {
|
|||||||
}
|
}
|
||||||
return await message.delete()
|
return await message.delete()
|
||||||
}
|
}
|
||||||
public isAboveThreshold(vote: Vote): boolean {
|
|
||||||
const aboveThreshold = (vote.count - 1) >= 1
|
public hasAtLeastOneVote(vote: Vote): boolean {
|
||||||
logger.debug(`${vote.movie} : ${vote.count} -> above: ${aboveThreshold}`)
|
// subtracting the bots initial vote
|
||||||
return aboveThreshold
|
const overOneVote = (vote.count - 1) >= 1
|
||||||
|
logger.debug(`${vote.movie} : ${vote.count} -> above: ${overOneVote}`)
|
||||||
|
return overOneVote
|
||||||
}
|
}
|
||||||
public async handleReroll(voteMessage: VoteMessage, guildId: string, requestId: string) {
|
public async handleReroll(voteMessage: VoteMessage, guildId: string, requestId: string) {
|
||||||
//get movies that already had votes to give them a second chance
|
//get movies that already had votes to give them a second chance
|
||||||
@ -74,7 +76,7 @@ export default class VoteController {
|
|||||||
|
|
||||||
let movies: string[] = Array()
|
let movies: string[] = Array()
|
||||||
if (config.bot.reroll_retains_top_picks) {
|
if (config.bot.reroll_retains_top_picks) {
|
||||||
const votedOnMovies = voteInfo.votes.filter(this.isAboveThreshold).filter(x => x.emote !== NONE_OF_THAT)
|
const votedOnMovies = voteInfo.votes.filter(this.hasAtLeastOneVote).filter(x => x.emote !== NONE_OF_THAT)
|
||||||
logger.info(`Found ${votedOnMovies.length} with votes`, { requestId, guildId })
|
logger.info(`Found ${votedOnMovies.length} with votes`, { requestId, guildId })
|
||||||
const newMovieCount: number = config.bot.random_movie_count - votedOnMovies.length
|
const newMovieCount: number = config.bot.random_movie_count - votedOnMovies.length
|
||||||
logger.info(`Fetching ${newMovieCount} from jellyfin`)
|
logger.info(`Fetching ${newMovieCount} from jellyfin`)
|
||||||
|
Loading…
Reference in New Issue
Block a user