<commit_before>import withdraw_helper
import decimal

def field_name_2(field, ben='Ben'):
    return "document.forms[1]['" + field + "'].value='%s';"

cursor = withdraw_helper.cursor()
withdrawals = withdraw_helper.get_withdrawals(cursor, 'AWAIT')

total = decimal.Decimal(0)
count = 1
for reqid, amount, name, bank, acc_num, sort_code in withdrawals:
    print count, '/', len(withdrawals)
    print
    count += 1

    # truncate decimals to 2 places
    amount = withdraw_helper.quantize(amount)
    total += amount

    print 'Search for: \t', acc_num[0:4], acc_num[4:]
    print
    print 'Name =\t\t', name

    if len(sort_code) != 6:
        print 'Sort code is wrong length'
        print 'Request ID =\t', reqid
        break
    sort_code = sort_code[0:2], sort_code[2:4], sort_code[4:6]

    print 'Sort code =\t', sort_code[0], sort_code[1], sort_code[2]
    print 'Amount =\t', amount

    if len(acc_num) != 8:
        print 'Account number is not 8 digits'
        print acc_num
        print 'Request ID =\t', reqid
        break

    form_info = "javascript:function f(){"
    form_info += field_name_2('Name')%name
    form_info += "}f();\n";
    withdraw_helper.copy_to_clipboard(form_info)

    print<commit_msg>BUGFIX: actually copy amount to clipboard in show_withdraws<commit_after>import withdraw_helper
import decimal

cursor = withdraw_helper.cursor()
withdrawals = withdraw_helper.get_withdrawals(cursor, 'AWAIT')

total = decimal.Decimal(0)
count = 1
for reqid, amount, name, bank, acc_num, sort_code in withdrawals:
    print count, '/', len(withdrawals)
    print
    count += 1

    # truncate decimals to 2 places
    amount = withdraw_helper.quantize(amount)
    total += amount

    print 'Search for: \t', acc_num[0:4], acc_num[4:]
    print
    print 'Name =\t\t', name

    if len(sort_code) != 6:
        print 'Sort code is wrong length'
        print 'Request ID =\t', reqid
        break
    sort_code = sort_code[0:2], sort_code[2:4], sort_code[4:6]

    print 'Sort code =\t', sort_code[0], sort_code[1], sort_code[2]
    print 'Amount =\t', amount

    if len(acc_num) != 8:
        print 'Account number is not 8 digits'
        print acc_num
        print 'Request ID =\t', reqid
        break

    form_info = "javascript:function f(){"
    form_info += "document.forms[0]['frmMakePayment:amount'].value='%s';"%amount
    form_info += "}f();\n";
    withdraw_helper.copy_to_clipboard(form_info)

    print
{'fraction_non_alphanumeric': 0.13004484304932734, 'fraction_numerical': 0.017121891561353443, 'mean_word_length': 3.275261324041812, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4598060', 'n_tokens_mistral': 847, 'n_tokens_neox': 818, 'n_words': 223}