<commit_before>var tek = require('tek'),
    copy = tek['meta']['copy'],
    util = require('../util'),
    findAllModels = util['mdl']['findAllModels'],
    obj = util['obj'],
    toNameMap = obj['toNameMap'],
    toIdMap = obj['toIdMap'],
    db = require('../db'),
    resolve = require('path').resolve,
    config = require('../app.config'),
    models = db.models,
    Client = models['Client'],
    Developer = models['Developer'];


/**
 * show index page
 *
 * @param req
 * @param res
 */
exports.index = function (req, res) {
    var q = req.query,
        client_group_id = q['client_group_id'],
        clients = res.locals.clients;

    exports.getData(client_group_id, clients, function (data) {
        res.render('chart/index.jade', {
            headRow: data.headRow,
            rows: data.rows
        });
    });
};
exports.getData = function (client_group_id, clients, callback) {
    findAllModels([Developer, Client], function (developers, all_clients) {
        var allClientMap = toIdMap(all_clients) || {};
        if (!clients.length) {
            callback({
                headRow: [],
                rows: []
            }, topLvGroups, topLv);
            return;
        }

        var system_names = Client.listSystemNames(clients);
        var rows = clients
            .map(function (client) {
                client.parent_names = client.listParentNames(allClientMap) || [];
                client.full_name = [client.parent_names, client.name].join(' ');
                return client;
            })
            .sort(function (a, b) {
                return (a.full_name || '').localeCompare(b.full_name || '');
            })
            .map(function (client) {
                var systems = client.systems || [],
                    systemsMap = toNameMap(systems),
                    developersMap = toIdMap(developers);
                var href = resolve('/', config.context || '', 'client/' + client._id);
                return [
                    {
                        prefix: client.parent_names.length && client.parent_names.join('  ') || null,
                        text: client.name,
                        href: [ href, 't=' + new Date().getTime()].join('?')<commit_msg>remove levels<commit_after>var tek = require('tek'),
    copy = tek['meta']['copy'],
    util = require('../util'),
    findAllModels = util['mdl']['findAllModels'],
    obj = util['obj'],
    toNameMap = obj['toNameMap'],
    toIdMap = obj['toIdMap'],
    db = require('../db'),
    resolve = require('path').resolve,
    config = require('../app.config'),
    models = db.models,
    Client = models['Client'],
    Developer = models['Developer'];


/**
 * show index page
 *
 * @param req
 * @param res
 */
exports.index = function (req, res) {
    var q = req.query,
        client_group_id = q['client_group_id'],
        clients = res.locals.clients;

    exports.getData(client_group_id, clients, function (data) {
        res.render('chart/index.jade', {
            headRow: data.headRow,
            rows: data.rows
        });
    });
};
exports.getData = function (client_group_id, clients, callback) {
    findAllModels([Developer, Client], function (developers, all_clients) {
        var allClientMap = toIdMap(all_clients) || {};
        if (!clients.length) {
            callback({
                headRow: [],
                rows: []
            });
            return;
        }

        var system_names = Client.listSystemNames(clients);
        var rows = clients
            .map(function (client) {
                client.parent_names = client.listParentNames(allClientMap) || [];
                client.full_name = [client.parent_names, client.name].join(' ');
                return client;
            })
            .sort(function (a, b) {
                return (a.full_name || '').localeCompare(b.full_name || '');
            })
            .map(function (client) {
                var systems = client.systems || [],
                    systemsMap = toNameMap(systems),
                    developersMap = toIdMap(developers);
                var href = resolve('/', config.context || '', 'client/' + client._id);
                return [
                    {
                        prefix: client.parent_names.length && client.parent_names.join('  ') || null,
                        text: client.name,
                        href: [ href, 't=' + new Date().getTime()].join('?')
{'fraction_non_alphanumeric': 0.151392632524708, 'fraction_numerical': 0.0, 'mean_word_length': 1.8326972010178118, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6297931', 'n_tokens_mistral': 1267, 'n_tokens_neox': 1224, 'n_words': 244}