rename filter function
This commit is contained in:
		@@ -63,10 +63,12 @@ export default class VoteController {
 | 
			
		||||
		}
 | 
			
		||||
		return await message.delete()
 | 
			
		||||
	}
 | 
			
		||||
	public isAboveThreshold(vote: Vote): boolean {
 | 
			
		||||
		const aboveThreshold = (vote.count - 1) >= 1
 | 
			
		||||
		logger.debug(`${vote.movie} : ${vote.count} -> above: ${aboveThreshold}`)
 | 
			
		||||
		return aboveThreshold
 | 
			
		||||
 | 
			
		||||
	public hasAtLeastOneVote(vote: Vote): boolean {
 | 
			
		||||
		// subtracting the bots initial vote
 | 
			
		||||
		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) {
 | 
			
		||||
		//get movies that already had votes to give them a second chance
 | 
			
		||||
@@ -74,7 +76,7 @@ export default class VoteController {
 | 
			
		||||
 | 
			
		||||
		let movies: string[] = Array()
 | 
			
		||||
		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 })
 | 
			
		||||
			const newMovieCount: number = config.bot.random_movie_count - votedOnMovies.length
 | 
			
		||||
			logger.info(`Fetching ${newMovieCount} from jellyfin`)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user