<commit_before>async = require 'async'
Account = require '../models/account'

CozyInstance = require '../models/cozy_instance'

module.exports.main = (req, res, next) ->
    async.parallel [
        (cb) -> CozyInstance.getLocale cb
        (cb) -> Account.request 'all', cb
    ], (err, results) ->

        if err?
            # for now we handle error case loosely
            console.log err
            res.render 'test.jade', imports: """
                console.log("#{err}")
                window.locale = "en";
                window.accounts = {};
            """
        else
            [locale, accounts] = results
            res.render 'test.jade', imports: """
                window.locale   = "#{locale}";
                window.accounts = #{JSON.stringify accounts};
            """<commit_msg>change test page loading<commit_after>async = require 'async'
Account = require '../models/account'

CozyInstance = require '../models/cozy_instance'

module.exports.main = (req, res, next) ->
    async.series [
        (cb) -> CozyInstance.getLocale cb
        (cb) -> Account.request 'all', cb
    ], (err, results) ->

        if err?
            # for now we handle error case loosely
            console.log err
            res.render 'test.jade', imports: """
                console.log("#{err}")
                window.locale = "en";
                window.accounts = {};
            """
        else
            [locale, accounts] = results
            res.render 'test.jade', imports: """
                window.locale   = "#{locale}";
                window.accounts = #{JSON.stringify accounts};
            """
{'fraction_non_alphanumeric': 0.14050091631032377, 'fraction_numerical': 0.0, 'mean_word_length': 1.625, 'pattern_counts': {'":': 0, '<': 3, '<?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': '5806974', 'n_tokens_mistral': 446, 'n_tokens_neox': 431, 'n_words': 109}