<commit_before>(function() {
        /**
         * Each key is in the form unit_sword and holds the total amount of the type in the village
         * (own and supporting troops combined)
         */
    var totalUnits = {},
        /**
         * Total population of all units (own + supporting)
         */
         totalFarm = 0,
        /**
         * Own population only (total - supporting)
         */
         ownFarmTotal = 0,
        /**
         * jQuery div with the troops in the village (becomes the own troops only div)
         */
         unitTable = $("#show_units"),
        /**
         * HTML table builder string for the supporting troops div
         */
         supportingTroopsTable = "<table class=vis width='100%'>";

    try {
        $("#show_units > h4").prepend(trans.sp.main.unitsReplacement);

        // calculate current stack
        $("table:first td", unitTable).not(":last").each(function () {
            var unit = $('img', this)[0].src,
                unitsSize,
                unitAmount;

            unit = unit.substr(unit.lastIndexOf('/') + 1);
            unit = unit.substr(0, unit.lastIndexOf('.'));
            unitsSize = world_data.unitsSize[unit];
            unitAmount = $('strong', this);
            unitAmount[0].id = "spAmount" + unit;
            unitAmount = unitAmount[0].innerHTML;
            totalUnits[unit] = unitAmount;
            totalFarm += unitsSize * unitAmount;<commit_msg>bugfix for showing supporting units<commit_after>(function() {
        /**
         * Each key is in the form unit_sword and holds the total amount of the type in the village
         * (own and supporting troops combined)
         */
    var totalUnits = {},
        /**
         * Total population of all units (own + supporting)
         */
         totalFarm = 0,
        /**
         * Own population only (total - supporting)
         */
         ownFarmTotal = 0,
        /**
         * jQuery div with the troops in the village (becomes the own troops only div)
         */
         unitTable = $("#show_units"),
        /**
         * HTML table builder string for the supporting troops div
         */
         supportingTroopsTable = "<table class=vis width='100%'>";

    try {
        $("#show_units > h4").prepend(trans.sp.main.unitsReplacement);

        // calculate current stack
        $("table:first td", unitTable).not(":last").each(function () {
            var unit = $('img', this)[0].src,
                unitsSize,
                unitAmount;

            unit = unit.substr(unit.lastIndexOf('/') + 1);
            unit = unit.substr(0, unit.lastIndexOf('.'));
            unitsSize = world_data.unitsSize[unit];
            unitAmount = $('strong', this);
            unitAmount[0].id = "spAmount" + unit;
            unitAmount = unitAmount[0].innerHTML;
            if( unit.match("knight") && !unitAmount ) {
                unitAmount = 1;
            }
            totalUnits[unit] = unitAmount;
            totalFarm += unitsSize * unitAmount;
{'fraction_non_alphanumeric': 0.12417437252311757, 'fraction_numerical': 0.007595772787318362, 'mean_word_length': 1.728828828828829, 'pattern_counts': {'":': 2, '<': 5, '<?xml version=': 0, '>': 7, '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': '2548795', 'n_tokens_mistral': 807, 'n_tokens_neox': 787, 'n_words': 222}