feat/40-reroll-on-disinterest #54
@ -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
|
||||
|
||||
magnetotail marked this conversation as resolved
Outdated
|
||||
public hasAtLeastOneVote(vote: Vote): boolean {
|
||||
magnetotail marked this conversation as resolved
Outdated
magnetotail
commented
threshold seems to be a magic number threshold seems to be a magic number
magnetotail
commented
Or rename method to "hasAtLeastOneVote" Or rename method to "hasAtLeastOneVote"
kenobi
commented
296a490e935cbdb79b70d73d2df9bc12a5774c53
kenobi
commented
done done
|
||||
// subtracting the bots initial vote
|
||||
const overOneVote = (vote.count - 1) >= 1
|
||||
logger.debug(`${vote.movie} : ${vote.count} -> above: ${overOneVote}`)
|
||||
return overOneVote
|
||||
}
|
||||
magnetotail marked this conversation as resolved
Outdated
magnetotail
commented
comment is misleading, voteinfo is also used to get the eventid and eventdate in line 93 comment is misleading, voteinfo is also used to get the eventid and eventdate in line 93
kenobi
commented
119343c916b023a926e534575ae803cdec5b9594
|
||||
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 {
|
||||
|
||||
magnetotail marked this conversation as resolved
Outdated
magnetotail
commented
maybe extract this if-else to a method to keep code more compact maybe extract this if-else to a method to keep code more compact
kenobi
commented
7d794a8001a66d068f949c893d689a068c3caeed
done
|
||||
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`)
|
||||
|
Loading…
Reference in New Issue
Block a user
above WHAT threshold? What does it do??
20da25f2bf
Mit einem Kommentar versehen und entsprechend deines vorschlags umbenannt