<commit_before>var util = require('util'),
    Tab = require('../client/tab').Tab,
    rewriter = require('../util/jsonrewriter');

var BalanceTab = function ()
{
  Tab.call(this);
};

util.inherits(BalanceTab, Tab);

BalanceTab.prototype.mainMenu = 'wallet';

BalanceTab.prototype.generateHtml = function ()
{
  return require('../../jade/tabs/balance.jade')();
};

BalanceTab.prototype.angular = function (module)
{
  module.controller('BalanceCtrl', ['$scope', 'rpId', 'rpNetwork',
                                     function ($scope, $id, $network)
  {
    if (!$id.loginStatus) return $id.goId();

    $scope.transactions = [];
    $scope.current_page = 1;

    // filter effect types
    // Show only offer_funded, offer_partially_funded, offer_cancelled, offer_bought side effects
    var filterEffects = function (events) {
      var transactions = [];

      $.each(events,function(){
        var event = this;
        var effects = [];

        if (event.effects) {
          $.each(event.effects, function(){
            var effect = this;
            if (effect.type == 'offer_funded'
                || effect.type == 'offer_partially_funded'
                || effect.type == 'offer_bought') {
              effects.push(effect);
            }
          });

          event.effects = effects;
        }

        if (effects.length || event.transaction) {
          transactions.push(event);
        }
      });<commit_msg>Do want canceled offers to show as a side effect, just not on OfferCancel txs.<commit_after>var util = require('util'),
    Tab = require('../client/tab').Tab,
    rewriter = require('../util/jsonrewriter');

var BalanceTab = function ()
{
  Tab.call(this);
};

util.inherits(BalanceTab, Tab);

BalanceTab.prototype.mainMenu = 'wallet';

BalanceTab.prototype.generateHtml = function ()
{
  return require('../../jade/tabs/balance.jade')();
};

BalanceTab.prototype.angular = function (module)
{
  module.controller('BalanceCtrl', ['$scope', 'rpId', 'rpNetwork',
                                     function ($scope, $id, $network)
  {
    if (!$id.loginStatus) return $id.goId();

    $scope.transactions = [];
    $scope.current_page = 1;

    // filter effect types
    // Show only offer_funded, offer_partially_funded, offer_cancelled, offer_bought side effects
    var filterEffects = function (events) {
      var transactions = [];

      $.each(events,function(){
        var event = this;
        var effects = [];

        if (event.effects) {
          $.each(event.effects, function(){
            var effect = this;
            if (effect.type == 'offer_funded'
                || effect.type == 'offer_partially_funded'
                || effect.type == 'offer_bought'
                || (effect.type === 'offer_canceled' &&
                    event.transaction.type !== 'offercancel')) {
              effects.push(effect);
            }
          });

          event.effects = effects;
        }

        if (effects.length || event.transaction) {
          transactions.push(event);
        }
      });
{'fraction_non_alphanumeric': 0.1479908526625286, 'fraction_numerical': 0.0006533812479581836, 'mean_word_length': 2.206282722513089, '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': '3706053', 'n_tokens_mistral': 899, 'n_tokens_neox': 866, 'n_words': 180}