<commit_before><?php
require '../../util.php';

function b_query($query)
{
    #echo $query;
    do_query($query);
}

function deposref_exists($deposref)
{
    $query = "
        SELECT 1
        FROM
            users
        WHERE
            deposref='$deposref'
        LIMIT 1
        ";
    $result = do_query($query);
    return has_results($result);
}

$query = "
    SELECT
        bid, entry
    FROM
        bank_statement
    WHERE
        reqid IS NULL
        AND status='VERIFY'
    ";
$result = do_query($query);

while ($row = mysql_fetch_array($result)) {
    $bid = $row[0];
    $query = "
        UPDATE
            bank_statement
        SET
            status='PROC'
        WHERE
            bid='$bid'
            AND status='VERIFY'
        ";
    b_query($query);
    $line = $row[1];
    print "$line\n";
    $info = split(',', $line);
    if ($info[5] != '') {
        echo "Skipping payment out...\n";
        continue;
    }
    $acc = split('[.]', $info[4]);
    if (count($acc) < 2) 
        $deposref = $info[4];
    else 
        $deposref = $acc[1];

    $deposref = trim($deposref, " \"'\n");
    if (!deposref_exists($deposref)) {
        echo "\n$deposref deposref doesn't exist!\n\n";
        exit(-1);
    }
    $amount = $info[6];
    $amount = numstr_to_internal($amount);
    print "$deposref <= $amount\n";

    $query = "
        INSERT INTO requests (
            req_type,
            uid,
            amount,
            curr_type
        ) SELECT
            'DEPOS',
            uid,
            '$amount',
            'GBP'
        FROM users
        WHERE
            deposref='$deposref'
        ";
    b_query($query);<commit_msg>new format for bank statements.<commit_after><?php
require '../../util.php';

function b_query($query)
{
    #echo $query;
    do_query($query);
}

function deposref_exists($deposref)
{
    $query = "
        SELECT 1
        FROM
            users
        WHERE
            deposref='$deposref'
        LIMIT 1
        ";
    $result = do_query($query);
    return has_results($result);
}

$query = "
    SELECT
        bid, entry
    FROM
        bank_statement
    WHERE
        reqid IS NULL
        AND status='VERIFY'
    ";
$result = do_query($query);

while ($row = mysql_fetch_array($result)) {
    $bid = $row[0];
    $query = "
        UPDATE
            bank_statement
        SET
            status='PROC'
        WHERE
            bid='$bid'
            AND status='VERIFY'
        ";
    b_query($query);
    $line = $row[1];
    print "$line\n";
    $info = split(',', $line);
    if ($info[5] != '') {
        echo "Skipping payment out...\n";
        continue;
    }
    $acc = split('[.]', $info[4]);
    if (count($acc) < 2) 
        $deposref = $info[4];
    else 
        $deposref = $acc[1];

    $deposref = trim($deposref, " \"'\n");
    # trim off the date
    $deposref = split(' ', $deposref); 
    $deposref = $deposref[0];
    if (!deposref_exists($deposref)) {
        echo "\n$deposref deposref doesn't exist!\n\n";
        exit(-1);
    }
    $amount = $info[6];
    $amount = numstr_to_internal($amount);
    print "$deposref <= $amount\n";

    $query = "
        INSERT INTO requests (
            req_type,
            uid,
            amount,
            curr_type
        ) SELECT
            'DEPOS',
            uid,
            '$amount',
            'GBP'
        FROM users
        WHERE
            deposref='$deposref'
        ";
    b_query($query);
{'fraction_non_alphanumeric': 0.1502873563218391, 'fraction_numerical': 0.0066091954022988505, 'mean_word_length': 1.5595588235294118, 'pattern_counts': {'":': 0, '<': 9, '<?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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2335569', 'n_tokens_mistral': 1154, 'n_tokens_neox': 1130, 'n_words': 238}