<commit_before>Router.route('/download-trades', function() {
  var data = Trades.find({}, {sort: {createdAt: -1}}).fetch();
  var fields = [
    {
      key: 'priceType',
      title: 'Price type'
    },
    {
      key: 'exchangeRateProvider',
      title: 'Exchange rate provider',
      transform: function (val) {
        return ExchangeRateProviders.findOne(val).name;
      }
    },
    {
      key: 'exchangeRate',
      title: 'Exchange rate',
      type: 'number'
    },
    {
      key: 'percentageFee',
      title: 'Base fee (%)',
      type: 'number'
    },
    {
      key: 'companyPrice',
      title: 'Company price',
      type: 'number'
    },
    {
      key: 'subtotal',
      title: 'Subtotal',
      type: 'number'
    },
    {
      key: 'flatFee',
      title: 'Flat fee',
      type: 'number'
    },
    {
      key: 'percentageFeeForAmountReceived',
      title: 'Payment method fee (%)',
      type: 'number'
    },
    {
      key: 'calculatedFeeForAmountReceived',
      title: 'Calculated fee',
      type: 'number'
    },
    {
      key: 'amountReceived',
      title: 'Amount received',
      type: 'number'
    },
    {
      key: 'paymentMethodForAmountReceived',
      title: 'Payment method',
      transform: function (val) {
        var paymentMethod = PaymentMethods.findOne(val);
        var currency = Currencies.findOne(paymentMethod.currency);
        return paymentMethod.name + ' (' + currency.code + ')';
      }
    },
    {
      key: 'amountSent',
      title: 'Amount sent',
      type: 'number'
    },
    {
      key: 'paymentMethodForAmountSent',
      title: 'Payment method',
      transform: function (val) {
        var paymentMethod = PaymentMethods.findOne(val);
        var currency = Currencies.findOne(paymentMethod.currency);
        return paymentMethod.name + ' (' + currency.code + ')';
      }
    },
    // {
    //   key: 'marketValue',
    //   title: 'Market value',
    //   type: 'number'
    // },
    // {
    //   key: 'marketValueCurrency',
    //   title: 'Market value currency',
    //   transform: function (val) {
    //     return Currencies.findOne(val).code;
    //   }
    // },
    // {
    //   key: 'member',
    //   title: 'Member number',
    //   type: 'number',
    //   transform: function (val) {
    //     return Members.findOne(val).number;
    //   }
    // },
    {
      key: 'createdBy',
      title: 'Employee',
      transform: function (val) {
        return Meteor.users.findOne(val).profile.name;
      }
    },
    {
      key: 'createdAt',
      title: 'Date',
      transform: function (val) {
        return moment(val).format('M/D/YYYY HH:mm:ss');
      }
    }<commit_msg>add member number when exporting trades<commit_after>Router.route('/download-trades', function() {
  var data = Trades.find({}, {sort: {createdAt: -1}}).fetch();
  var fields = [
    {
      key: 'priceType',
      title: 'Price type'
    },
    // {
    //   key: 'exchangeRateProvider',
    //   title: 'Exchange rate provider',
    //   transform: function (val) {
    //     return ExchangeRateProviders.findOne(val).name;
    //   }
    // },
    {
      key: 'exchangeRate',
      title: 'Exchange rate',
      type: 'number'
    },
    {
      key: 'percentageFee',
      title: 'Base fee (%)',
      type: 'number'
    },
    {
      key: 'companyPrice',
      title: 'Company price',
      type: 'number'
    },
    {
      key: 'subtotal',
      title: 'Subtotal',
      type: 'number'
    },
    {
      key: 'flatFee',
      title: 'Flat fee',
      type: 'number'
    },
    {
      key: 'percentageFeeForAmountReceived',
      title: 'Payment method fee (%)',
      type: 'number'
    },
    {
      key: 'calculatedFeeForAmountReceived',
      title: 'Calculated fee',
      type: 'number'
    },
    {
      key: 'amountReceived',
      title: 'Amount received',
      type: 'number'
    },
    {
      key: 'paymentMethodForAmountReceived',
      title: 'Payment method',
      transform: function (val) {
        var paymentMethod = PaymentMethods.findOne(val);
        var currency = Currencies.findOne(paymentMethod.currency);
        return paymentMethod.name + ' (' + currency.code + ')';
      }
    },
    {
      key: 'amountSent',
      title: 'Amount sent',
      type: 'number'
    },
    {
      key: 'paymentMethodForAmountSent',
      title: 'Payment method',
      transform: function (val) {
        var paymentMethod = PaymentMethods.findOne(val);
        var currency = Currencies.findOne(paymentMethod.currency);
        return paymentMethod.name + ' (' + currency.code + ')';
      }
    },
    {
      key: 'marketValue',
      title: 'Market value',
      type: 'number'
    },
    {
      key: 'marketValueCurrency',
      title: 'Market value currency',
      transform: function (val) {
        return Currencies.findOne(val).code;
      }
    },
    {
      key: 'member',
      title: 'Member number',
      type: 'number',
      transform: function (val) {
        return Members.findOne(val).number;
      }
    },
    {
      key: 'createdBy',
      title: 'Employee',
      transform: function (val) {
        return Meteor.users.findOne(val).profile.name;
      }
    },
    {
      key: 'createdAt',
      title: 'Date',
      transform: function (val) {
        return moment(val).format('M/D/YYYY HH:mm:ss');
      }
    }
{'fraction_non_alphanumeric': 0.15332960268606602, 'fraction_numerical': 0.00037306472673008767, 'mean_word_length': 1.9220708446866486, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '741363', 'n_tokens_mistral': 1694, 'n_tokens_neox': 1661, 'n_words': 349}