Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.then((channel) => {
return Logger.info(`Started finding dates in ${_.capitalize(channel.name)} channel`)
.then(() => findByChannel.bind(this)(channel))
.finally(() => Logger.info(`Finished finding dates in ${_.capitalize(channel.name)} channel`))
})
}
find (channelNames = []) {
const startDate = _.now()
Logger.info('Started finding dates')
const updateStats = () => {
return Logger.info('Started updating stats')
.then(() => Stats.update())
.finally(() => Logger.info('Finished updating stats'))
}
return Database.channels.findAll()
.mapSeries(({ name, isEnabled }) => {
if ((_.isEmpty(channelNames) && !isEnabled) ||
(!_.isEmpty(channelNames) && !_.includes(channelNames, name))) {
return
}
return this.findByChannelName(name)
})
.finally(() => Logger.info('Finished updating stats'))
}
const updateStats = () => {
return Logger.info('Started updating stats')
.then(() => Stats.update())
.finally(() => Logger.info('Finished updating stats'))
}
.then((match) => {
return Logger.info(`${recommendation.name} got a like :+1:(photos = ${recommendation.photosSimilarityMean}%)`)
.then(() => {
recommendation.isLike = true
if (!match) {
return recommendation
}
return this.setUpMatch(recommendation, match)
})
})
})