Skip to content

Conversation

davestimpert
Copy link

Basic, not-so-elegant solution to #16
Could be made more generic for complex columns, though this may be a one-of-a-kind situation so I didn't take time to over-engineer it.

@@ -23,7 +23,11 @@ exports.getTransactions = async (transactionColumns, categoryOverrides, currentM
* { "category.0": "Food and Drink", "category.1": "Restaurants" }
*/
_.forEach(transactionColumns, column => {
sanitized[column] = _.get(sanitized, column);
if(column == "_ACCOUNT_NAME") {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be ===

@kevinschaich
Copy link
Owner

kevinschaich commented Feb 11, 2019

This looks OK for now. If we run into this again, I think I'd prefer a "fallback list" for each column:

  const defaultTransactionColumns = [
    'date',
    'amount',
    'name',
    ['account_details.official_name', 'account_details.name'],
    'category.0',
    'category.1',
    'pending'
  ];

where in the code, we loop through and take the first value that is defined for that column.

@kevinschaich
Copy link
Owner

Closing in favor of #28, discussion to continue in #16

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants