<commit_before>(function() {
  'use strict';

  angular
    .module('dowser')
    .factory('AmChartParser', AmChartParserService);

  /** @ngInject */
  function AmChartParserService($filter) {
    function Result(category, date, value) {
      var result = {};
      result.date = date;
      result[category] = value;
      return result;
    }

    function AmChartParser(data) {
      this.results = {};
      this.__unparsedData = data;
    }

    AmChartParser.prototype.__convertDate = function(date) {
      return moment(date);
    };

    AmChartParser.prototype.__convertAllDates = function() {
      var self = this;

      this.__unparsedData.forEach(function(category) {
        category.data.forEach(function(data) {
          data.date = self.__convertDate(data.date);
        });
      });
    };

    AmChartParser.prototype.__formatResultDates = function() {
      this.results.forEach(function(result) {
        result.date = result.date.format('YYYY-MM-DD');
      });
    };

    AmChartParser.prototype.__getResultIndexByDate = function(date) {
      for (var i = 0; i < this.results.length; i += 1) {
        if (this.results[i].date.isSame(date)) {
          return i;
        }
      }
    };<commit_msg>Fix chart data dates parsing<commit_after>(function() {
  'use strict';

  angular
    .module('dowser')
    .factory('AmChartParser', AmChartParserService);

  /** @ngInject */
  function AmChartParserService($filter) {
    function Result(category, date, value) {
      var result = {};
      result.date = date;
      result[category] = value;
      return result;
    }

    function AmChartParser(data) {
      this.results = {};
      this.__unparsedData = data;
    }

    AmChartParser.prototype.__convertDate = function(date) {
      return moment(date).startOf('day');
    };

    AmChartParser.prototype.__convertAllDates = function() {
      var self = this;

      this.__unparsedData.forEach(function(category) {
        category.data.forEach(function(data) {
          data.date = self.__convertDate(data.date);
        });
      });
    };

    AmChartParser.prototype.__formatResultDates = function() {
      this.results.forEach(function(result) {
        result.date = result.date.format('YYYY-MM-DD');
      });
    };

    AmChartParser.prototype.__getResultIndexByDate = function(date) {
      for (var i = 0; i < this.results.length; i += 1) {
        if (this.results[i].date.isSame(date)) {
          return i;
        }
      }
    };
{'fraction_non_alphanumeric': 0.13694779116465863, 'fraction_numerical': 0.001606425702811245, 'mean_word_length': 2.518361581920904, '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': '3519637', 'n_tokens_mistral': 755, 'n_tokens_neox': 739, 'n_words': 122}