<commit_before>/* jshint node: true */
/* jshint esnext: true */
'use strict';

const Q = require('q');
const moment = require('moment');
const race = require('../service/race');


let timeCalculator = {};

timeCalculator.timestamp = function(timestring) {
  const deferred = Q.defer();
  race.startTime()
    .then( starttime => {
      let timestamp = moment(starttime,'X');
      timestamp.hours(timestring.split(':')[0]);
      timestamp.minutes(timestring.split(':')[1]);
      timestamp.seconds(timestring.split(':')[2]);
      deferred.resolve(timestamp.unix());
    });
  return deferred.promise;
};

module.exports = timeCalculator;<commit_msg>As the IT for the participant service is failing on the CI and we cannot see exactly why, it shows that we need more robust 'error' handling when working with promises -> please use fail/catch/reject.<commit_after>/* jshint node: true */
/* jshint esnext: true */
'use strict';

const Q = require('q');
const moment = require('moment');
const race = require('../service/race');


let timeCalculator = {};

timeCalculator.timestamp = function(timestring) {
  const deferred = Q.defer();
  race.startTime()
    .then( starttime => {
      let timestamp = moment(starttime,'X');
      timestamp.hours(timestring.split(':')[0]);
      timestamp.minutes(timestring.split(':')[1]);
      timestamp.seconds(timestring.split(':')[2]);
      deferred.resolve(timestamp.unix());
    })
    .fail(deferred.reject);
  return deferred.promise;
};

module.exports = timeCalculator;
{'fraction_non_alphanumeric': 0.16578947368421051, 'fraction_numerical': 0.003947368421052632, 'mean_word_length': 4.104026845637584, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, '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': '84442', 'n_tokens_mistral': 481, 'n_tokens_neox': 460, 'n_words': 112}