<commit_before>// vim: set ts=4 sts=4 sw=4 et:
// Common code across the various OpenPowerlifting pages.
'use strict';

var common = (function () {

return {
    kg2lbs: function(kg) {
        return Math.round(kg * 2.2042262 * 100) / 100;
    },
    
    // Roughly parse index.html?q=foo&a=bar into an object {q: foo, a: bar}.
    getqueryobj: function() {
        var url = document.location.href;
        var i = url.indexOf('?');
        var args = url.slice(i+1);

        var obj = {};
        var split = args.split('&');
        for (var j = 0; j < split.length; ++j) {
            var arg = split[j];
            if (arg.indexOf('=') >= 0) {
                var v = unescape(arg).split('=');
                obj[v[0]] = v[1];
            }
        }
        return obj;
    },

    // Return an object with properties set as strings to be presented.
    makeRowObj(row, index) {
        var meetrow = meetdb.data[row[opldb.MEETID]];

        var country = this.string(meetrow[meetdb.MEETCOUNTRY]);
        var state = this.string(meetrow[meetdb.MEETSTATE]);
        var location = country;
        if (country && state) {
            location = location + "-" + state;
        }

        var name = row[opldb.NAME];
        var fed = this.string(meetrow[meetdb.FEDERATION]);
        var date = this.string(meetrow[meetdb.DATE]);
        var meetname = this.string(meetrow[meetdb.MEETNAME]);
        var meeturl = this.makeMeetUrl(fed, date, meetname);

        return {
            rank:        index+1,
            place:       this.string(row[opldb.PLACE]),
            searchname:  name.toLowerCase(),
            name:        '<a href="' + this.makeLiftersUrl(name) + '">' + name + '</a>',
            fed:         fed,
            date:        '<a href="' + meeturl + '">' + date + '</a>',
            location:    location,
            division:    this.string(row[opldb.DIVISION]),
            meetname:    '<a href="' + meeturl + '">' + meetname + '</a>',
            sex:         this.string(row[opldb.SEX]),
            age:         this.string(row[opldb.AGE]),
            equip:       this.parseEquipment(row[opldb.EQUIPMENT]),
            bw:          weight(row[opldb.BODYWEIGHTKG]), // TODO: this.weight()<commit_msg>Fix makeRowObj definition.<commit_after>// vim: set ts=4 sts=4 sw=4 et:
// Common code across the various OpenPowerlifting pages.
'use strict';

var common = (function () {

return {
    kg2lbs: function(kg) {
        return Math.round(kg * 2.2042262 * 100) / 100;
    },
    
    // Roughly parse index.html?q=foo&a=bar into an object {q: foo, a: bar}.
    getqueryobj: function() {
        var url = document.location.href;
        var i = url.indexOf('?');
        var args = url.slice(i+1);

        var obj = {};
        var split = args.split('&');
        for (var j = 0; j < split.length; ++j) {
            var arg = split[j];
            if (arg.indexOf('=') >= 0) {
                var v = unescape(arg).split('=');
                obj[v[0]] = v[1];
            }
        }
        return obj;
    },

    // Return an object with properties set as strings to be presented.
    makeRowObj: function(row, index) {
        var meetrow = meetdb.data[row[opldb.MEETID]];

        var country = this.string(meetrow[meetdb.MEETCOUNTRY]);
        var state = this.string(meetrow[meetdb.MEETSTATE]);
        var location = country;
        if (country && state) {
            location = location + "-" + state;
        }

        var name = row[opldb.NAME];
        var fed = this.string(meetrow[meetdb.FEDERATION]);
        var date = this.string(meetrow[meetdb.DATE]);
        var meetname = this.string(meetrow[meetdb.MEETNAME]);
        var meeturl = this.makeMeetUrl(fed, date, meetname);

        return {
            rank:        index+1,
            place:       this.string(row[opldb.PLACE]),
            searchname:  name.toLowerCase(),
            name:        '<a href="' + this.makeLiftersUrl(name) + '">' + name + '</a>',
            fed:         fed,
            date:        '<a href="' + meeturl + '">' + date + '</a>',
            location:    location,
            division:    this.string(row[opldb.DIVISION]),
            meetname:    '<a href="' + meeturl + '">' + meetname + '</a>',
            sex:         this.string(row[opldb.SEX]),
            age:         this.string(row[opldb.AGE]),
            equip:       this.parseEquipment(row[opldb.EQUIPMENT]),
            bw:          weight(row[opldb.BODYWEIGHTKG]), // TODO: this.weight()
{'fraction_non_alphanumeric': 0.15220767694697138, 'fraction_numerical': 0.010650099844686045, 'mean_word_length': 1.8017402113113736, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, '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': '1420914', 'n_tokens_mistral': 1495, 'n_tokens_neox': 1430, 'n_words': 326}