<commit_before>var models = require('../models');

module.exports = function(req, res) {
  // find customer
  models.customers.findById(req.params.id, function(err, customer) {
    if (err) {
      res.json({error:{message:err}});
    }
    else {
      if (customer) {
        var now = new Date();
        // get count log by client_id, ip address and date
        models.logs.count({
          'client_id': req.params.id,
          'ip': req.heroku.ip,
          'created_at': {
            $lte: now
          }
        }, function(err, count) {
          if (err) {
            res.json({error:{message:err}});
          }
          else if (count <= process.env.LIMIT) {
            res.json({'status':true});
          }
          else {
            res.json({'status':false});
          }
        });
      }
      else {
        res.json({error:{message:'El usuario no existe'}});
      }
    }
  });
};<commit_msg>implement date-util<commit_after>var models = require('../models');
var dateUtil = require('date-utils');

module.exports = function(req, res) {
  // find customer
  models.customers.findById(req.params.id, function(err, customer) {
    if (err) {
      res.json({error:{message:err}});
    }
    else {
      if (customer) {
        var now = new Date();
        // get count log by client_id, ip address and date
        models.logs.count({
          'client_id': req.params.id,
          'ip': req.heroku.ip,
          'created_at': {
            '$gte': dateUtil.today(),
            '$lte': dateUtil.tomorrow()
          }
        }, function(err, count) {
          if (err) {
            res.json({error:{message:err}});
          }
          else if (count <= process.env.LIMIT) {
            res.json({'status':true});
          }
          else {
            res.json({'status':false});
          }
        });
      }
      else {
        res.json({error:{message:'El usuario no existe'}});
      }
    }
  });
};
{'fraction_non_alphanumeric': 0.16478439425051336, 'fraction_numerical': 0.0, 'mean_word_length': 1.6409214092140922, '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': '4782505', 'n_tokens_mistral': 596, 'n_tokens_neox': 601, 'n_words': 116}