diff --git a/lib/new-admin/services/transactions.js b/lib/new-admin/services/transactions.js index 546ef0b3..8a838b64 100644 --- a/lib/new-admin/services/transactions.js +++ b/lib/new-admin/services/transactions.js @@ -50,6 +50,7 @@ function batch ( excludeTestingCustomers = false, simplified ) { + const isCsvExport = _.isBoolean(simplified) const packager = _.flow( _.flatten, _.orderBy(_.property('created'), ['desc']), @@ -92,7 +93,7 @@ function batch ( AND ($12 is null or txs.to_address = $12) AND ($13 is null or txs.txStatus = $13) ${excludeTestingCustomers ? `AND c.is_test_customer is false` : ``} - AND (error IS NOT null OR tb.error_message IS NOT null OR fiat > 0) + ${isCsvExport && !simplified ? '' : 'AND (error IS NOT null OR tb.error_message IS NOT null OR fiat > 0)'} ORDER BY created DESC limit $4 offset $5` const cashOutSql = `SELECT 'cashOut' AS tx_class, @@ -126,7 +127,7 @@ function batch ( AND ($13 is null or txs.txStatus = $13) AND ($14 is null or txs.swept = $14) ${excludeTestingCustomers ? `AND c.is_test_customer is false` : ``} - AND (fiat > 0) + ${isCsvExport ? '' : 'AND fiat > 0'} ORDER BY created DESC limit $4 offset $5` // The swept filter is cash-out only, so omit the cash-in query entirely @@ -152,14 +153,14 @@ function batch ( return Promise.all(promises) .then(packager) - .then(res => { - if (simplified) return simplifiedBatch(res) + .then(res => + !isCsvExport ? res : // GQL transactions and transactionsCsv both use this function and // if we don't check for the correct simplified value, the Transactions page polling // will continuously build a csv in the background - else if (simplified === false) return advancedBatch(res) - return res - }) + simplified ? simplifiedBatch(res) : + advancedBatch(res) + ) } function advancedBatch (data) {