Commit 10f8f7e7 authored by therealwolf's avatar therealwolf 💯
Browse files

add queryAsset for benefactorRewards

parent 3f94feaa
......@@ -2,10 +2,10 @@ import * as db_data from '../../database/data.db'
import { query, TIME_GROUP_ORDER_QUERY, TIME_GROUP_QUERY, TIMESTAMP, convert_grouped } from './query'
export let rewards_benefactor = async (app: string, account: string, asset: string, last_update) => {
export let rewards_benefactor = async (app: string, account: string, asset: string, queryAsset: string, last_update) => {
try {
console.log(`REWARDS_BENEFACTOR_${asset}`)
const column_name = (asset.toLowerCase() === 'vests' ? 'vesting' : asset.toLowerCase()) + '_payout'
const column_name = (queryAsset.toLowerCase() === 'vests' ? 'vesting' : queryAsset.toLowerCase()) + '_payout'
let q = `SELECT SUM(${column_name}), ${TIMESTAMP()} FROM VOCommentBenefactorRewards WHERE[benefactor] = '${account}' AND ${column_name} > 0 ${TIME_GROUP_ORDER_QUERY(last_update)}`
const result = await query(q)
const data_type = `REWARDS_BENEFACTOR_${asset}`.toLowerCase()
......
......@@ -68,7 +68,8 @@ export let update_data = async () => {
if (acc.benefactor) {
await dau_benefactor(app.name, acc.name, last_update_data)
for (let asset of ['HBD', 'HIVE', 'VESTS']) {
await rewards_benefactor(app.name, acc.name, asset, last_update_data)
const queryAsset = getQueryAsset(asset)
await rewards_benefactor(app.name, acc.name, asset, queryAsset, last_update_data)
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment