-
Notifications
You must be signed in to change notification settings - Fork 974
Payment History CSV export download has correct filename (+row sorting and total row) #4346
Payment History CSV export download has correct filename (+row sorting and total row) #4346
Conversation
simpler: export is just a data URL link, filename suggested by <a> `download` attribute depends on brave/ledger-client@d50d59e fixes #4332
@@ -287,18 +286,6 @@ if (ipc) { | |||
if (balanceTimeoutId) clearTimeout(balanceTimeoutId) | |||
balanceTimeoutId = setTimeout(getBalance, 5 * msecs.second) | |||
}) | |||
|
|||
ipc.on(messages.OPEN_LEDGER_TRANSACTION_CSV, (event, viewingIds, csvFilename) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please also remove messages.OPEN_LEDGER_TRANSACTION_CSV
and aboutActions.receiptLinkClick
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
otherwise lgtm once @mrose17 releases brave/ledger-client#17
on second thought, it would be better to move the CSV export methods from ledger-client into js/lib/ledgerExportUtil.js so that #4332 can be fixed without requiring ledger-client updates |
- closes #4332 - rows are sorted by Publisher - a TOTAL row is added - moved the ledger transaction utilities into `js/lib/ledgerExportUtil.js` from `ledger-client/util` (see #4346 (comment)) - removed some obsolete code (#4346 (comment))
@diracdeltas, this is done (including rest of #4332) & everything is pulled into |
* Generates a contribution breakdown by publisher as a CSV data URL from an array of one or more transactions | ||
* @param {Object[]} transactions - array of transactions | ||
*/ | ||
let transactionsToCSVDataURL = function (transactions) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it would be good to add unit tests for this. (see test/unit/lib
)
return getTransactionCSVRows(transactions, viewingIds, addTotalRow).join('\n') | ||
} | ||
|
||
module.exports = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for future reference, you can just use es6 object property-value shorthand here. https://ariya.io/2013/02/es6-and-object-literal-property-value-shorthand. i.e.,
{
transactionsToCSVDataURL,
getTransactionCSVText,
...
}
thanks! merging for now |
Payment receipt CSV links now suggest a download filename with reconciliation date in it matching UI.
depends on brave/ledger-client@d50d59egit rebase -i
to squash commits (if needed).Test Plan:
brave_ledger9-23-2016.csv