<commit_before>import { Component } from '@angular/core';

import { NavController, NavParams } from 'ionic-angular';

import { FirebaseListObservable } from 'angularfire2';

import { Subject } from 'rxjs/Subject';
import { BehaviorSubject } from 'rxjs/BehaviorSubject';

// app pages
import { TransactionPage } from '../transaction/transaction';

// services
import { UserData } from '../../../providers/user-data';
import { TransactionData } from '../../../providers/transaction-data';

// models
import { IAccount } from '../../../models/account.model';
import { Transaction, ITransaction } from '../../../models/transaction.model';

import * as moment from 'moment';

@Component({
  selector: 'page-transaction-list',
  templateUrl: 'transaction-list.html'
})

export class TransactionsPage {

  title: string;
  trans: FirebaseListObservable<any>;
  account: IAccount;
  searchTerm: string = '';
  equalToSubject: Subject<any>;
  orderByChild: Subject<any>;

  constructor(
      public nav: NavController,
      public navParams: NavParams,
      public userData: UserData,
      public transactionData: TransactionData) {

        this.account = this.navParams.data.paramAccount;
        this.title = this.account.accountname;

      }

  ionViewDidLoad() {
    //this.trans = this.userData.getTransactionsByDate(this.account);
    this.equalToSubject = new BehaviorSubject(null);
    this.orderByChild = new BehaviorSubject('date');
    this.trans = this.userData.getFilteredTransactions(this.account, this.orderByChild, this.equalToSubject);
    this.trans.subscribe(data => {
      this.userData.LoadingControllerDismiss();
    });
  }

  ionViewWillEnter() {
    let referrer = this.transactionData.getReferrer();
    switch (referrer) {
      case 'TransactionPage': {
        if (this.transactionData.ismodified) {
          this.userData.syncAccountBalances(this.account);
        }
        break;
      }
    }
  }

  search() {
    console.log('search here');
  }

  filterBy(size: string) {
    //this.orderByChild.next('payeelower');
    //this.equalToSubject.next('starbucks');<commit_msg>fix: adding unsubscribe equivalent to FirebaseListObservable<commit_after>import { Component } from '@angular/core';

import { NavController, NavParams } from 'ionic-angular';

import { FirebaseListObservable } from 'angularfire2';

import { Subject } from 'rxjs/Subject';
import { BehaviorSubject } from 'rxjs/BehaviorSubject';

// app pages
import { TransactionPage } from '../transaction/transaction';

// services
import { UserData } from '../../../providers/user-data';
import { TransactionData } from '../../../providers/transaction-data';

// models
import { IAccount } from '../../../models/account.model';
import { Transaction, ITransaction } from '../../../models/transaction.model';

import * as moment from 'moment';

@Component({
  selector: 'page-transaction-list',
  templateUrl: 'transaction-list.html'
})

export class TransactionsPage {

  title: string;
  trans: FirebaseListObservable<any>;
  account: IAccount;
  searchTerm: string = '';
  equalToSubject: Subject<any>;
  orderByChild: Subject<any>;

  constructor(
      public nav: NavController,
      public navParams: NavParams,
      public userData: UserData,
      public transactionData: TransactionData) {

        this.account = this.navParams.data.paramAccount;
        this.title = this.account.accountname;

      }

  ionViewDidLoad() {
    //this.trans = this.userData.getTransactionsByDate(this.account);
    this.equalToSubject = new BehaviorSubject(null);
    this.orderByChild = new BehaviorSubject('date');
    this.trans = this.userData.getFilteredTransactions(this.account, this.orderByChild, this.equalToSubject);
    this.trans.first().subscribe(snapshots => {
      this.userData.LoadingControllerDismiss();
    });
  }

  ionViewWillEnter() {
    let referrer = this.transactionData.getReferrer();
    switch (referrer) {
      case 'TransactionPage': {
        if (this.transactionData.ismodified) {
          this.userData.syncAccountBalances(this.account);
        }
        break;
      }
    }
  }

  search() {
    console.log('search here');
  }

  filterBy(size: string) {
    //this.orderByChild.next('payeelower');
    //this.equalToSubject.next('starbucks');
{'fraction_non_alphanumeric': 0.13851193261581657, 'fraction_numerical': 0.0004679457182966776, 'mean_word_length': 3.495268138801262, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6983301', 'n_tokens_mistral': 1243, 'n_tokens_neox': 1228, 'n_words': 248}