<commit_before>import { Component } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { ViewController } from 'ionic-angular';
import * as _ from 'lodash';
import { Logger } from '../../../providers/logger/logger';

// Providers
import { FeeProvider } from '../../../providers/fee/fee';
import { PopupProvider } from '../../../providers/popup/popup';

@Component({
  selector: 'page-choose-fee-level',
  templateUrl: 'choose-fee-level.html',
})
export class ChooseFeeLevelPage {

  private FEE_MULTIPLIER: number = 10;
  private FEE_MIN: number = 0;
  public maxFeeRecommended: number;
  public minFeeRecommended: number;
  private minFeeAllowed: number;
  public maxFeeAllowed: number;

  public network: string;
  public feeLevel: string;
  public customFeePerKB: string;
  public feePerSatByte: string;
  public selectedFee: string;
  public feeOpts: any[];
  public loadingFee: boolean;
  public feeLevels: any;
  public coin: string;
  public avgConfirmationTime: number;
  public customSatPerByte: number;
  public maxFee: number;
  public minFee: number;
  public showError: boolean;
  public showMaxWarning: boolean;
  public showMinWarning: boolean;

  constructor(
    private viewCtrl: ViewController,
    private logger: Logger,
    private popupProvider: PopupProvider,
    private feeProvider: FeeProvider,
    private translate: TranslateService
  ) {
    // From parent controller
    this.network = this.viewCtrl.data.network;
    this.feeLevel = this.viewCtrl.data.feeLevel;

    // IF usingCustomFee
    this.customFeePerKB = this.viewCtrl.data.customFeePerKB ? this.viewCtrl.data.customFeePerKB : null;
    this.feePerSatByte = this.viewCtrl.data.feePerSatByte ? this.viewCtrl.data.feePerSatByte : null;

    if (_.isEmpty(this.feeLevel)) this.showErrorAndClose(null, this.translate.instant('Fee level is not defined'));
    this.selectedFee = this.feeLevel;

    this.feeOpts = Object.keys(this.feeProvider.feeOpts);
    this.loadingFee = true;
    this.feeProvider.getFeeLevels(this.coin).then((levels: any) => {
      this.loadingFee = false;
      if (_.isEmpty(levels)) {
        this.showErrorAndClose(null, this.translate.instant('Could not get fee levels'));
        return;
      }
      this.feeLevels = levels;
      this.updateFeeRate();
    }).catch((err: any) => {
      this.loadingFee = false;
      this.showErrorAndClose(null, err);
      return;
    });
  }

  public close() {
    this.viewCtrl.dismiss({ newFeeLevel: "Hola mundo" });
  }

  private showErrorAndClose(title: string, msg: string): void {
    title = title ? title : this.translate.instant('Error');
    this.logger.error(msg);
    this.popupProvider.ionicAlert(title, msg).then(() => {
      this.viewCtrl.dismiss();
    });
  }
<commit_msg>Fix: Remove unnecessary function from choose fee level modal<commit_after>import { Component } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { ViewController } from 'ionic-angular';
import * as _ from 'lodash';
import { Logger } from '../../../providers/logger/logger';

// Providers
import { FeeProvider } from '../../../providers/fee/fee';
import { PopupProvider } from '../../../providers/popup/popup';

@Component({
  selector: 'page-choose-fee-level',
  templateUrl: 'choose-fee-level.html',
})
export class ChooseFeeLevelPage {

  private FEE_MULTIPLIER: number = 10;
  private FEE_MIN: number = 0;
  public maxFeeRecommended: number;
  public minFeeRecommended: number;
  private minFeeAllowed: number;
  public maxFeeAllowed: number;

  public network: string;
  public feeLevel: string;
  public customFeePerKB: string;
  public feePerSatByte: string;
  public selectedFee: string;
  public feeOpts: any[];
  public loadingFee: boolean;
  public feeLevels: any;
  public coin: string;
  public avgConfirmationTime: number;
  public customSatPerByte: number;
  public maxFee: number;
  public minFee: number;
  public showError: boolean;
  public showMaxWarning: boolean;
  public showMinWarning: boolean;

  constructor(
    private viewCtrl: ViewController,
    private logger: Logger,
    private popupProvider: PopupProvider,
    private feeProvider: FeeProvider,
    private translate: TranslateService
  ) {
    // From parent controller
    this.network = this.viewCtrl.data.network;
    this.feeLevel = this.viewCtrl.data.feeLevel;

    // IF usingCustomFee
    this.customFeePerKB = this.viewCtrl.data.customFeePerKB ? this.viewCtrl.data.customFeePerKB : null;
    this.feePerSatByte = this.viewCtrl.data.feePerSatByte ? this.viewCtrl.data.feePerSatByte : null;

    if (_.isEmpty(this.feeLevel)) this.showErrorAndClose(null, this.translate.instant('Fee level is not defined'));
    this.selectedFee = this.feeLevel;

    this.feeOpts = Object.keys(this.feeProvider.feeOpts);
    this.loadingFee = true;
    this.feeProvider.getFeeLevels(this.coin).then((levels: any) => {
      this.loadingFee = false;
      if (_.isEmpty(levels)) {
        this.showErrorAndClose(null, this.translate.instant('Could not get fee levels'));
        return;
      }
      this.feeLevels = levels;
      this.updateFeeRate();
    }).catch((err: any) => {
      this.loadingFee = false;
      this.showErrorAndClose(null, err);
      return;
    });
  }

  private showErrorAndClose(title: string, msg: string): void {
    title = title ? title : this.translate.instant('Error');
    this.logger.error(msg);
    this.popupProvider.ionicAlert(title, msg).then(() => {
      this.viewCtrl.dismiss();
    });
  }

{'fraction_non_alphanumeric': 0.12425393380358112, 'fraction_numerical': 0.0010851871947911015, 'mean_word_length': 3.706382978723404, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '4818265', 'n_tokens_mistral': 1771, 'n_tokens_neox': 1712, 'n_words': 392}