<commit_before>/*
 * Copyright 2013, <NAME> <<EMAIL>>. All rights reserved.
 * Distributed under the MIT license
 */

require(["app/lib/ready", "app/config", "app/api", "app/isso", "app/count", "app/dom", "app/markup", "app/text/css"], function(domready, config, api, isso, count, $, Mark, css) {

    "use strict";

    domready(function() {

        if (config["css"]) {
            var style = $.new("style");
            style.type = "text/css";
            style.textContent = css.inline;
            $("head").append(style);
        }

        count();

        if ($("#isso-thread") === null) {
            return console.log("abort, #isso-thread is missing");
        }

        $("#isso-thread").append($.new('h4'));
        $("#isso-thread").append(new isso.Postbox(null));
        $("#isso-thread").append('<div id="isso-root"></div>');

        api.fetch($("#isso-thread").getAttribute("data-isso-id"), limit = config["max-comments"]).then(
            function(rv) {
                if (rv.total_replies == 0) {
                    $("#isso-thread > h4").textContent = Mark.up("{{ i18n-no-comments }}");
                    return;
                }

                $("#isso-thread > h4").textContent = Mark.up("{{ i18n-num-comments | pluralize : `n` }}", {n: rv.total_replies});
                var lastcreated = 0;
                rv.replies.forEach(function(commentObject) {
                    isso.insert(commentObject, false);
                    if(commentObject.created > lastcreated) {
                        lastcreated = commentObject.created;
                    }
                });<commit_msg>Correct total comments count<commit_after>/*
 * Copyright 2013, <NAME> <<EMAIL>>. All rights reserved.
 * Distributed under the MIT license
 */

require(["app/lib/ready", "app/config", "app/api", "app/isso", "app/count", "app/dom", "app/markup", "app/text/css"], function(domready, config, api, isso, count, $, Mark, css) {

    "use strict";

    domready(function() {

        if (config["css"]) {
            var style = $.new("style");
            style.type = "text/css";
            style.textContent = css.inline;
            $("head").append(style);
        }

        count();

        if ($("#isso-thread") === null) {
            return console.log("abort, #isso-thread is missing");
        }

        $("#isso-thread").append($.new('h4'));
        $("#isso-thread").append(new isso.Postbox(null));
        $("#isso-thread").append('<div id="isso-root"></div>');

        api.fetch($("#isso-thread").getAttribute("data-isso-id"), limit = config["max-comments"]).then(
            function(rv) {
                if (rv.total_replies == 0) {
                    $("#isso-thread > h4").textContent = Mark.up("{{ i18n-no-comments }}");
                    return;
                }

                var lastcreated = 0;
                var total_count = rv.total_replies;
                rv.replies.forEach(function(commentObject) {
                    isso.insert(commentObject, false);
                    if(commentObject.created > lastcreated) {
                        lastcreated = commentObject.created;
                    }
                    total_count = total_count + commentObject.total_replies;
                });
                $("#isso-thread > h4").textContent = Mark.up("{{ i18n-num-comments | pluralize : `n` }}", {n: total_count});
{'fraction_non_alphanumeric': 0.18020679468242246, 'fraction_numerical': 0.007680945347119645, 'mean_word_length': 1.898972602739726, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 19, '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': '181623', 'n_tokens_mistral': 1022, 'n_tokens_neox': 977, 'n_words': 179}