tip-kudos-recipients: Allow configurable payment periodicity

This commit is contained in:
Pedro Pombeiro 2018-04-12 10:32:08 +02:00
parent 4690f4c6e0
commit fe3e42e1d3
No known key found for this signature in database
GPG Key ID: A65DEB11E4BBC647
1 changed files with 3 additions and 2 deletions

View File

@ -19,6 +19,7 @@ const tipPerKudoInUsd = parseFloat(options.rules.tip_per_kudo_in_usd)
const tipPerReactionInUsd = parseFloat(options.rules.tip_per_reaction_in_usd) const tipPerReactionInUsd = parseFloat(options.rules.tip_per_reaction_in_usd)
const reactionThreshold = parseInt(options.rules.reaction_threshold) const reactionThreshold = parseInt(options.rules.reaction_threshold)
const interTransactionDelay = parseInt(options.options.inter_transaction_delay) const interTransactionDelay = parseInt(options.options.inter_transaction_delay)
const paymentPeriodicityInDays = parseInt(options.options.payment_periodicity_in_days)
const tokenID = process.env.DEBUG ? 'STT' : 'SNT' const tokenID = process.env.DEBUG ? 'STT' : 'SNT'
const token = options.payments[tokenID] const token = options.payments[tokenID]
@ -37,7 +38,7 @@ module.exports = robot => {
} }
setTimeout(() => processKudosChannelUpdates(robot), process.env.DISABLE_DELAY ? 1 * 1000 : 30 * 1000) setTimeout(() => processKudosChannelUpdates(robot), process.env.DISABLE_DELAY ? 1 * 1000 : 30 * 1000)
setInterval(() => processKudosChannelUpdates(robot), 24 * 60 * 60 * 1000) setInterval(() => processKudosChannelUpdates(robot), paymentPeriodicityInDays * 24 * 60 * 60 * 1000)
} }
function getOptions (optionsString) { function getOptions (optionsString) {
@ -224,7 +225,7 @@ async function processPendingPayments (robot, data, saveStateAsyncFunc) {
} }
} }
} }
robot.log.debug(`Total payments: ${totalPayments}`) robot.log.debug(`Total payments: ${totalPayments} ${tokenID}`)
} }
function compareBalances (userToPendingPayouts, a, b) { function compareBalances (userToPendingPayouts, a, b) {