<commit_before>(function(){

  angular
       .module('gas')
       .controller('GasController', [
          'gasService', '$scope', '$mdDialog',
          GasController
       ]);

  /**
   * Main Controller for the Angular Material Starter App
   * @param $scope
   * @param $mdSidenav
   * @param avatarsService
   * @constructor
   */
  function GasController( gasService, $scope, $mdDialog ) {

    $scope.gasEntries   = [ ];
    $scope.addEntry     = addEntry;
    $scope.clearEntry   = clearEntry;
    $scope.showChangePricePrompt = showChangePricePrompt;
    $scope.showHelp     = showHelp;
    $scope.calculatePrice = calculatePrice;
    $scope.calculateLts = calculateLts;

    // Load all registered Gass

    reload();

    // *********************************
    // Internal methods
    // *********************************

    /**
     * Select the current avatars
     * @param menuId
     */
    function addEntry() {
      if($scope.entry && $scope.entry.price && $scope.entry.l && $scope.entry.kms) {
        gasService.saveEntry($scope.entry);
        clearEntry();
        reload();
      }
    }

    function clearEntry() {
      $scope.entry = {};
      $scope.showingLastEntry = false;
    }

    function reload() {
      gasService
        .loadAllEntries()
        .then( function( entries ) {
          $scope.gasEntries = [].concat(entries);
        });
      gasService
        .getGasPrice()
        .then(function(price) {
          $scope.gasPrice = parseFloat(price);
        });
    }

    function calculatePrice() {
      $scope.entry.price = Math.round(100 * $scope.entry.l * $scope.gasPrice) / 100;
    }
    function calculateLts() {
      $scope.entry.l = Math.round( 100 * $scope.entry.price / $scope.gasPrice) / 100;
    }

    function showHelp(ev) {
      $mdDialog.show(
        $mdDialog.alert()
          .parent(angular.element(document.querySelector('#app')))
          .clickOutsideToClose(true)
          .title('Gas tracker')
          .htmlContent('Version 0.1.0 <br /> Last updated: 2016-08-08 <br /> GitHub: <a href="https://github.com/Oscarwa" target="_blank">@Oscarwa</a>')
          .ok('Got it!')
          .targetEvent(ev)
      );
    }

    function showChangePricePrompt(ev) {
    // Appending dialog to document.body to cover sidenav in docs app
      var confirm = $mdDialog.prompt()
        .title('You like to set a new gas price?')<commit_msg>Improved help dialog.<commit_after>(function(){

  angular
       .module('gas')
       .controller('GasController', [
          'gasService', '$scope', '$mdDialog',
          GasController
       ]);

  /**
   * Main Controller for the Angular Material Starter App
   * @param $scope
   * @param $mdSidenav
   * @param avatarsService
   * @constructor
   */
  function GasController( gasService, $scope, $mdDialog ) {

    $scope.gasEntries   = [ ];
    $scope.addEntry     = addEntry;
    $scope.clearEntry   = clearEntry;
    $scope.showChangePricePrompt = showChangePricePrompt;
    $scope.showHelp     = showHelp;
    $scope.calculatePrice = calculatePrice;
    $scope.calculateLts = calculateLts;

    // Load all registered Gass

    reload();

    // *********************************
    // Internal methods
    // *********************************

    /**
     * Select the current avatars
     * @param menuId
     */
    function addEntry() {
      if($scope.entry && $scope.entry.price && $scope.entry.l && $scope.entry.kms) {
        gasService.saveEntry($scope.entry);
        clearEntry();
        reload();
      }
    }

    function clearEntry() {
      $scope.entry = {};
      $scope.showingLastEntry = false;
    }

    function reload() {
      gasService
        .loadAllEntries()
        .then( function( entries ) {
          $scope.gasEntries = [].concat(entries);
        });
      gasService
        .getGasPrice()
        .then(function(price) {
          $scope.gasPrice = parseFloat(price);
        });
    }

    function calculatePrice() {
      $scope.entry.price = Math.round(100 * $scope.entry.l * $scope.gasPrice) / 100;
    }
    function calculateLts() {
      $scope.entry.l = Math.round( 100 * $scope.entry.price / $scope.gasPrice) / 100;
    }

    function showHelp(ev) {
      $mdDialog.show(
        $mdDialog.alert()
          .parent(angular.element(document.querySelector('#app')))
          .clickOutsideToClose(true)
          .title('Gas tracker')
          .htmlContent(
            'Version 0.1.0 <br />' +
            'GitHub: <a href="https://github.com/Oscarwa/gas-counter" target="_blank">@Oscarwa</a> <br />' +
            '<br />' +
            ' # New features (2016-08-08)<br />' +
            ' - Added gas performance data.<br />' +
            ' - Added help menu<br />' +
            ' - Added ability to change gas price.<br />' +
            '<br />' +
            ' # ToDos:<br />' +
            ' - Preserve data on backend<br />' +
            ' - Multi-car support<br />'
          )
          .ok('Got it!')
          .targetEvent(ev)
      );
    }

    function showChangePricePrompt(ev) {
    // Appending dialog to document.body to cover sidenav in docs app
      var confirm = $mdDialog.prompt()
        .title('You like to set a new gas price?')
{'fraction_non_alphanumeric': 0.1645352166443978, 'fraction_numerical': 0.008780301584271807, 'mean_word_length': 2.0859835100117787, 'pattern_counts': {'":': 0, '<': 20, '<?xml version=': 0, '>': 20, 'https://': 2, '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': '6942625', 'n_tokens_mistral': 1637, 'n_tokens_neox': 1546, 'n_words': 308}