<commit_before>(function() {
  angular
    .module("app.services")
    .factory("pointValidator", pointValidator);

  pointValidator.$inject = ["config"];

  function pointValidator(config) {
    var service = {
      validateMaximumPoints: validateMaximumPoints,
      incrementPoint: incrementPoint
    };

    return service;

    function validateMaximumPoints() {
      var today       = new Date();
      var lastDate    = localStorage["last_date"]    ? new Date(localStorage["last_date"])    : new Date();
      var pointsCount = localStorage["points_count"] ? parseInt(localStorage["points_count"]) : 0;

      today.setHours(0, 0, 0, 0);
      lastDate.setHours(0, 0, 0, 0);

      if (today > lastDate) {
        pointsCount = 0;

        localStorage["last_date"]    = today;
        localStorage["points_count"] = pointsCount;
      }

      return pointsCount < config.maxPoints;
    };

    function incrementPoint(amount) {
      amount    = amount                       ? amount                                 : 1;
      var count = localStorage["points_count"] ? parseInt(localStorage["points_count"]) : 0;

      localStorage["points_count"] = count + amount;

      return localStorage["points_count"];
    };
  };
})();<commit_msg>Corrige validação de marcação de pontos<commit_after>(function() {
  angular
    .module("app.services")
    .factory("pointValidator", pointValidator);

  pointValidator.$inject = ["config"];

  function pointValidator(config) {
    var service = {
      validateMaximumPoints: validateMaximumPoints,
      incrementPoint: incrementPoint
    };

    return service;

    function validateMaximumPoints() {
      var today       = new Date();
      var lastDate    = localStorage["last_date"]    ? new Date(localStorage["last_date"])    : new Date(getYesterday());
      var pointsCount = localStorage["points_count"] ? parseInt(localStorage["points_count"]) : 0;

      today.setHours(0, 0, 0, 0);
      lastDate.setHours(0, 0, 0, 0);

      if (today > lastDate) {
        pointsCount = 0;

        localStorage["last_date"]    = today;
        localStorage["points_count"] = pointsCount;
      }

      return pointsCount < config.maxPoints;
    };

    function incrementPoint(amount) {
      amount    = amount                       ? amount                                 : 1;
      var count = localStorage["points_count"] ? parseInt(localStorage["points_count"]) : 0;

      localStorage["points_count"] = count + amount;

      return localStorage["points_count"];
    };

    function getYesterday() {
      var date = new Date();

      return date.setDate(date.getDate() - 1);
    };
  };
})();
{'fraction_non_alphanumeric': 0.12448288830387363, 'fraction_numerical': 0.009402030838661151, 'mean_word_length': 2.5849056603773586, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2390529', 'n_tokens_mistral': 770, 'n_tokens_neox': 718, 'n_words': 156}