<commit_before>angular.module('taotrack.controllers', ['ngMessages', 'highcharts-ng'])

  .controller('AppCtrl', function($scope) {
  })

  .controller('CyclesCtrl', function($scope) {
    Date.prototype.addDays = function(days) {
      var dat = new Date(this.valueOf());
      dat.setDate(dat.getDate() + days);
      return dat;
    };

    $scope.calculateCycle = function(startDate, endDate, cycleLength) {
      var currentDate = startDate;
      var increment = (cycleLength / 2.0) * 24 * 60 * 60 * 1000;
      var cycles = [];
      var currentValue = false;
      while (currentDate < endDate) {
        cycles.push([currentDate.getTime(), currentValue * 100.0]);
        currentValue = !currentValue;
        currentDate = new Date(currentDate.getTime() + increment);
      }
      return cycles;
    };

    var updateGraph = function(birthDate) {
      var todayDate = new Date();
      var endDate = todayDate.addDays(14);

      $scope.chartConfig.series = [{
        name: 'Physical',
        color: '#E31230',
        data: $scope.calculateCycle(birthDate, endDate, 23)
      }, {
        name: 'Emotional',
        color: '#0f76ed',
        data: $scope.calculateCycle(birthDate, endDate, 28)
      }, {
        name: 'Intellectual',
        color: '#551A8B',
        data: $scope.calculateCycle(birthDate, endDate, 33)
      }];

      // If this is enabled, the graph does not display until the range selector is clicked manually
      //$scope.chartConfig.options.rangeSelector.selected = 1;
    };

    $scope.updateBirthDate = function(birthDateString) {
      var timestamp = Date.parse(birthDateString);
      if (!isNaN(timestamp)) {
        var birthDate = new Date(timestamp);
        window.localStorage.birthDate = birthDate.toISOString();
        updateGraph(birthDate);
      }
    };

    $scope.params = {};

    var content = angular.element(document.querySelector('#cycles-content')),
      header = angular.element(document.querySelector('ion-header-bar')),
      tabBar = angular.element(document.querySelector('.tab-nav')),
      form = angular.element(document.querySelector('form')),
      height = content.prop('offsetHeight') - header.prop('offsetHeight')
                - tabBar.prop('offsetHeight') - form.prop('offsetHeight') - 26;

    $scope.chartConfig = {
      options: {
        chart: {
          type: 'spline',<commit_msg>Fixed lint error<commit_after>angular.module('taotrack.controllers', ['ngMessages', 'highcharts-ng'])

  .controller('AppCtrl', function($scope) {
  })

  .controller('CyclesCtrl', function($scope) {
    Date.prototype.addDays = function(days) {
      var dat = new Date(this.valueOf());
      dat.setDate(dat.getDate() + days);
      return dat;
    };

    $scope.calculateCycle = function(startDate, endDate, cycleLength) {
      var currentDate = startDate;
      var increment = (cycleLength / 2.0) * 24 * 60 * 60 * 1000;
      var cycles = [];
      var currentValue = false;
      while (currentDate < endDate) {
        cycles.push([currentDate.getTime(), currentValue * 100.0]);
        currentValue = !currentValue;
        currentDate = new Date(currentDate.getTime() + increment);
      }
      return cycles;
    };

    var updateGraph = function(birthDate) {
      var todayDate = new Date();
      var endDate = todayDate.addDays(14);

      $scope.chartConfig.series = [{
        name: 'Physical',
        color: '#E31230',
        data: $scope.calculateCycle(birthDate, endDate, 23)
      }, {
        name: 'Emotional',
        color: '#0f76ed',
        data: $scope.calculateCycle(birthDate, endDate, 28)
      }, {
        name: 'Intellectual',
        color: '#551A8B',
        data: $scope.calculateCycle(birthDate, endDate, 33)
      }];

      // If this is enabled, the graph does not display until the range selector is clicked manually
      //$scope.chartConfig.options.rangeSelector.selected = 1;
    };

    $scope.updateBirthDate = function(birthDateString) {
      var timestamp = Date.parse(birthDateString);
      if (!isNaN(timestamp)) {
        var birthDate = new Date(timestamp);
        window.localStorage.birthDate = birthDate.toISOString();
        updateGraph(birthDate);
      }
    };

    $scope.params = {};

    var content = angular.element(document.querySelector('#cycles-content')),
      header = angular.element(document.querySelector('ion-header-bar')),
      tabBar = angular.element(document.querySelector('.tab-nav')),
      form = angular.element(document.querySelector('form')),
      height = content.prop('offsetHeight') - header.prop('offsetHeight') -
        tabBar.prop('offsetHeight') - form.prop('offsetHeight') - 26;

    $scope.chartConfig = {
      options: {
        chart: {
          type: 'spline',
{'fraction_non_alphanumeric': 0.14024005053695515, 'fraction_numerical': 0.016424510423247, 'mean_word_length': 2.772835583796664, 'pattern_counts': {'":': 0, '<': 5, '<?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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3180760', 'n_tokens_mistral': 1483, 'n_tokens_neox': 1375, 'n_words': 279}