<commit_before>var StatementUI = (function(){
    "use strict";
    var tableID = "statement-table";
    var columns = ["date", "ref", "payout", "act", "desc", "credit", "bal", "details"];
    var allData = [];
    var oauth_apps = {};

    function createEmptyStatementTable(){
        var header = [
            Content.localize().textDate,
            Content.localize().textRef,
            page.text.localize('Potential Payout'),
            Content.localize().textAction,
            Content.localize().textDescription,
            Content.localize().textCreditDebit,
            Content.localize().textBalance,
            Content.localize().textDetails
        ];

        var jpClient = japanese_client();

        header[6] = header[6] + (jpClient ? "" : (TUser.get().currency ? " (" + TUser.get().currency + ")" : ""));

        var metadata = {
            id: tableID,
            cols: columns
        };
        var data = [];
        var $tableContainer = Table.createFlexTable(data, metadata, header);
        return $tableContainer;
    }

    function updateStatementTable(transactions){
        Table.appendTableBody(tableID, transactions, createStatementRow);
    }

    function clearTableContent(){
        Table.clearTableBody(tableID);
        allData = [];
        $("#" + tableID +">tfoot").hide();
    }

    function createStatementRow(transaction){
        var statement_data = Statement.getStatementData(transaction, TUser.get().currency, japanese_client());
        allData.push(statement_data);
        var creditDebitType = (parseFloat(statement_data.amount) >= 0) ? "profit" : "loss";

        var $statementRow = Table.createFlexTableRow([
                statement_data.date,
                '<span' + showTooltip(statement_data.app_id, oauth_apps[statement_data.app_id]) + '>' + statement_data.ref + '</span>',
                statement_data.payout,
                page.text.localize(statement_data.action),
                '',
                statement_data.amount,
                statement_data.balance,
                ''
            ], columns, "data");
        
        $statementRow.children(".credit").addClass(creditDebitType);
        $statementRow.children(".date").addClass("pre");
        $statementRow.children(".desc").html(statement_data.desc + "<br>");

        //create view button and append
        if (statement_data.action === "Sell" || statement_data.action === "Buy") {
            var $viewButtonSpan = Button.createBinaryStyledButton();
            var $viewButton = $viewButtonSpan.children(".button").first();
            $viewButton.text(page.text.localize("View"));
            $viewButton.addClass("open_contract_detailsws");
            $viewButton.attr("contract_id", statement_data.id);

            $statementRow.children(".desc,.details").append($viewButtonSpan);
        }

        return $statementRow[0];        //return DOM instead of jquery object
    }

    function errorMessage(msg) {
        var $err = $('#statement-ws-container #err-msg');
        if(msg) {
            $err.removeClass('invisible').text(msg);
        } else {
            $err.addClass('invisible').text('');
        }<commit_msg>Translate action type in exported csv<commit_after>var StatementUI = (function(){
    "use strict";
    var tableID = "statement-table";
    var columns = ["date", "ref", "payout", "act", "desc", "credit", "bal", "details"];
    var allData = [];
    var oauth_apps = {};

    function createEmptyStatementTable(){
        var header = [
            Content.localize().textDate,
            Content.localize().textRef,
            page.text.localize('Potential Payout'),
            Content.localize().textAction,
            Content.localize().textDescription,
            Content.localize().textCreditDebit,
            Content.localize().textBalance,
            Content.localize().textDetails
        ];

        var jpClient = japanese_client();

        header[6] = header[6] + (jpClient ? "" : (TUser.get().currency ? " (" + TUser.get().currency + ")" : ""));

        var metadata = {
            id: tableID,
            cols: columns
        };
        var data = [];
        var $tableContainer = Table.createFlexTable(data, metadata, header);
        return $tableContainer;
    }

    function updateStatementTable(transactions){
        Table.appendTableBody(tableID, transactions, createStatementRow);
    }

    function clearTableContent(){
        Table.clearTableBody(tableID);
        allData = [];
        $("#" + tableID +">tfoot").hide();
    }

    function createStatementRow(transaction){
        var statement_data = Statement.getStatementData(transaction, TUser.get().currency, japanese_client());
        statement_data.action = page.text.localize(statement_data.action);
        allData.push(statement_data);
        var creditDebitType = (parseFloat(statement_data.amount) >= 0) ? "profit" : "loss";

        var $statementRow = Table.createFlexTableRow([
                statement_data.date,
                '<span' + showTooltip(statement_data.app_id, oauth_apps[statement_data.app_id]) + '>' + statement_data.ref + '</span>',
                statement_data.payout,
                statement_data.action,
                '',
                statement_data.amount,
                statement_data.balance,
                ''
            ], columns, "data");
        
        $statementRow.children(".credit").addClass(creditDebitType);
        $statementRow.children(".date").addClass("pre");
        $statementRow.children(".desc").html(statement_data.desc + "<br>");

        //create view button and append
        if (statement_data.action === "Sell" || statement_data.action === "Buy") {
            var $viewButtonSpan = Button.createBinaryStyledButton();
            var $viewButton = $viewButtonSpan.children(".button").first();
            $viewButton.text(page.text.localize("View"));
            $viewButton.addClass("open_contract_detailsws");
            $viewButton.attr("contract_id", statement_data.id);

            $statementRow.children(".desc,.details").append($viewButtonSpan);
        }

        return $statementRow[0];        //return DOM instead of jquery object
    }

    function errorMessage(msg) {
        var $err = $('#statement-ws-container #err-msg');
        if(msg) {
            $err.removeClass('invisible').text(msg);
        } else {
            $err.addClass('invisible').text('');
        }
{'fraction_non_alphanumeric': 0.14301225376143942, 'fraction_numerical': 0.0012408872343725764, 'mean_word_length': 2.3635889410537296, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 13, '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': '261383', 'n_tokens_mistral': 1773, 'n_tokens_neox': 1711, 'n_words': 289}