<commit_before>'use strict';

/**
 * @ngdoc function
 * @name eagleeye.controller:ChartSetSettingsController
 * @description
 * # ChartSetSettingsController
 * Controller of the eagleeye
 */
angular.module('eagleeye')
  .controller('ChartSetSettingsController', [
    '$state',
    '$stateParams',
    '$q',
    'EagleEyeWebService',
    '$mdDialog',
    function($state, $stateParams, $q, EagleEyeWebService, $mdDialog) {
      var controller = this,
        id = $stateParams.id,
        friendlyUrlPrefix = 's-';

      this.showingURL = '';
      this.settings = {
        searchKeyword: ''
      };
      this.selectedCharts = [];

      this.filterFunction = function(chart) {
        return chart.options.title.indexOf(controller.settings.searchKeyword) >= 0 ||
          chart.description.indexOf(controller.settings.searchKeyword) >= 0;
      }

      var promiseChartSet = EagleEyeWebService.getChartSetById(id).then(function(chartSet) {
        angular.extend(controller.settings, chartSet);

        if (chartSet.friendlyUrl) {
          controller.showingURL = chartSet.friendlyUrl.substring(2);
        } else {
          controller.showingURL = '';
        }
      });

      var promiseCharts = EagleEyeWebService.getCharts().then(function(chartList) {
        controller.chartList = chartList;
      });

      $q.all([promiseChartSet, promiseCharts]).then(function(data) {
        if (controller.settings.charts && controller.settings.charts.length > 0 &&
          controller.chartList && controller.chartList.length > 0) {
          controller.chartList.forEach(function(chart) {
            controller.settings.charts.forEach(function(chartId) {
              if (chart._id === chartId) {
                chart.checked = true;
                controller.selectedCharts.push(chart);
              }
            });
          });
        }
      });

      this.onCheckboxChanged = function(chart) {
        var index = -1;

        if (chart.checked) {<commit_msg>Fix issue wrong chart order in chart set setting. Fixed #34<commit_after>'use strict';

/**
 * @ngdoc function
 * @name eagleeye.controller:ChartSetSettingsController
 * @description
 * # ChartSetSettingsController
 * Controller of the eagleeye
 */
angular.module('eagleeye')
  .controller('ChartSetSettingsController', [
    '$state',
    '$stateParams',
    '$q',
    'EagleEyeWebService',
    '$mdDialog',
    function($state, $stateParams, $q, EagleEyeWebService, $mdDialog) {
      var controller = this,
        id = $stateParams.id,
        friendlyUrlPrefix = 's-';

      this.showingURL = '';
      this.settings = {
        searchKeyword: ''
      };
      this.selectedCharts = [];

      this.filterFunction = function(chart) {
        return chart.options.title.indexOf(controller.settings.searchKeyword) >= 0 ||
          chart.description.indexOf(controller.settings.searchKeyword) >= 0;
      }

      var promiseChartSet = EagleEyeWebService.getChartSetById(id).then(function(chartSet) {
        angular.extend(controller.settings, chartSet);

        if (chartSet.friendlyUrl) {
          controller.showingURL = chartSet.friendlyUrl.substring(2);
        } else {
          controller.showingURL = '';
        }
      });

      var promiseCharts = EagleEyeWebService.getCharts().then(function(chartList) {
        controller.chartList = chartList;
      });

      $q.all([promiseChartSet, promiseCharts]).then(function(data) {
        if (controller.settings.charts && controller.settings.charts.length > 0 &&
          controller.chartList && controller.chartList.length > 0) {
          controller.settings.charts.forEach(function(chartId) {
            controller.chartList.forEach(function(chart) {
              if (chart._id === chartId) {
                chart.checked = true;
                controller.selectedCharts.push(chart);
              }
            });
          });
        }
      });

      this.onCheckboxChanged = function(chart) {
        var index = -1;

        if (chart.checked) {
{'fraction_non_alphanumeric': 0.1260587942202292, 'fraction_numerical': 0.003487792725460887, 'mean_word_length': 2.4852430555555554, 'pattern_counts': {'":': 0, '<': 3, '<?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': '4665097', 'n_tokens_mistral': 1145, 'n_tokens_neox': 1090, 'n_words': 174}