<commit_before>$(function() {

    var buildsDivId = 'build-container'

    function loadTemplate(src, id, callback) {
        $.ajax({
            url: src,
            success: function(resp) {
                var $script = $('<script type="text/template" id="' + id + '_tmpl">' + resp + '</script>');
                $('body').append($script);
                callback(null, id + '_tmpl');
            },
            failure: callback
        });
    }

    function buildTravisUrl(repoSlug, buildId) {
        return 'https://travis-ci.org/' + repoSlug + '/builds/' + buildId;
    }

    function buildPullRequestUrl(repoSlug, prId) {
        return 'https://github.com/' + repoSlug + '/pull/' + prId;
    }

    function renderBuilds(templateId, builds) {
        console.log(builds);
        _.each(builds, function(repoBuilds, repoName) {
            _.each(repoBuilds, function(build) {
                if (build.started_at) {
                    build.started_ago = moment(build.started_at).from(new Date());
                } else {
                    build.started_ago = '';
                }
                build.html_url = buildTravisUrl('numenta/' + repoName, build.id);
                if (build.pull_request) {
                    build.pr_url = buildPullRequestUrl('numenta/' + repoName, build.pull_request_number);
                }
            });
        });
        template = Handlebars.compile($('#' + templateId).html())
        $('#' + buildsDivId).html(template({builds: builds}));
    }

    loadTemplate('/js/builds/builds.html', 'builds', function(err, templId) {
        if (err) {
            return console.log(err);
        }
        console.log(templId + ' template loaded');
        $.getJSON('/_builds/', function(builds) {
            renderBuilds(templId, builds);
        });
    });
});<commit_msg>Not showing repos with no builds.<commit_after>$(function() {

    var buildsDivId = 'build-container'

    function loadTemplate(src, id, callback) {
        $.ajax({
            url: src,
            success: function(resp) {
                var $script = $('<script type="text/template" id="' + id + '_tmpl">' + resp + '</script>');
                $('body').append($script);
                callback(null, id + '_tmpl');
            },
            failure: callback
        });
    }

    function buildTravisUrl(repoSlug, buildId) {
        return 'https://travis-ci.org/' + repoSlug + '/builds/' + buildId;
    }

    function buildPullRequestUrl(repoSlug, prId) {
        return 'https://github.com/' + repoSlug + '/pull/' + prId;
    }

    function renderBuilds(templateId, builds) {
        var doomed = [];
        _.each(builds, function(repoBuilds, repoName) {
            if (! repoBuilds.length) {
                doomed.push(repoName);
            }
            _.each(repoBuilds, function(build) {
                if (build.started_at) {
                    build.started_ago = moment(build.started_at).from(new Date());
                } else {
                    build.started_ago = '';
                }
                build.html_url = buildTravisUrl('numenta/' + repoName, build.id);
                if (build.pull_request) {
                    build.pr_url = buildPullRequestUrl('numenta/' + repoName, build.pull_request_number);
                }
            });
        });
        _.each(doomed, function(repoToRemove) {
            delete builds[repoToRemove];
        });
        template = Handlebars.compile($('#' + templateId).html())
        $('#' + buildsDivId).html(template({builds: builds}));
    }

    loadTemplate('/js/builds/builds.html', 'builds', function(err, templId) {
        if (err) {
            return console.log(err);
        }
        console.log(templId + ' template loaded');
        $.getJSON('/_builds/', function(builds) {
            renderBuilds(templId, builds);
        });
    });
});
{'fraction_non_alphanumeric': 0.15093854461301107, 'fraction_numerical': 0.0, 'mean_word_length': 1.7905308464849354, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 4, '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': '6058079', 'n_tokens_mistral': 1155, 'n_tokens_neox': 1111, 'n_words': 193}