<commit_before>const moment = require("moment");

var averageArray = arr => arr.reduce( ( p, c ) => p + c, 0 ) / arr.length;

module.exports = function(options, callback) {
    /* our dates are strings, and the mongo aggregation framework can't
       aggregate and do date calculations on dates that are strings. So,
       we'll aggregate them ourselves */
    options.db.pull_request.find({merged_at: {$ne: null}}).toArray().then(result => {
        var byMonth = {};
        var minMonth = moment();
        result.forEach(r => {
            var c = moment(r.created_at);
            var m = moment(r.merged_at);
            var my = c.format("YYYYMM");
            if (!byMonth[my]) byMonth[my] = [];
            byMonth[my].push(m.diff(c, "seconds"));
            if (c < minMonth) { minMonth = c; }
        });

        var now = moment();
        var values = [];
        while (minMonth < now) {
            var key = minMonth.format("YYYYMM");
            var prnt = minMonth.format("MM-YYYY");<commit_msg>Average time in hours, so the number in the tooltip at least makes a little sense<commit_after>const moment = require("moment");

var averageArray = arr => arr.reduce( ( p, c ) => p + c, 0 ) / arr.length;

module.exports = function(options, callback) {
    /* our dates are strings, and the mongo aggregation framework can't
       aggregate and do date calculations on dates that are strings. So,
       we'll aggregate them ourselves */
    options.db.pull_request.find({merged_at: {$ne: null}}).toArray().then(result => {
        var byMonth = {};
        var minMonth = moment();
        result.forEach(r => {
            var c = moment(r.created_at);
            var m = moment(r.merged_at);
            var my = c.format("YYYYMM");
            if (!byMonth[my]) byMonth[my] = [];
            byMonth[my].push(m.diff(c, "hours"));
            if (c < minMonth) { minMonth = c; }
        });

        var now = moment();
        var values = [];
        while (minMonth < now) {
            var key = minMonth.format("YYYYMM");
            var prnt = minMonth.format("MM-YYYY");
{'fraction_non_alphanumeric': 0.1434699714013346, 'fraction_numerical': 0.0009532888465204957, 'mean_word_length': 2.229230769230769, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, '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': '120721', 'n_tokens_mistral': 624, 'n_tokens_neox': 609, 'n_words': 180}