<commit_before>from connections import connector
from globals import globals
from lib import *
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import render
import math

def index(request, page=0):
    '''
    handler for the transactions
    '''
    page = int(page)
    items_per_page = 10
    page_title = "Transactions"
    
    transactions = getTransactions(connector = connector, sort_by = 'timereceived', reverse_order = True)
    for transaction in transactions:
        transaction['currency_symbol'] = getCurrencySymbol(transaction['currency'].lower())
        if transaction['category'] == 'receive':
            transaction['icon'] = 'glyphicon-circle-arrow-down'
        elif transaction['category'] == 'send':
            transaction['icon'] = 'glyphicon-circle-arrow-up'
        elif transaction['category'] == 'move':
            transaction['icon'] = 'glyphicon-circle-arrow-right'
    
    # pagify
    if page is 0:
        # pager off
        selected_transactions = transactions
        max_page = 0
        pages = []
        show_pager = False
    else:
        # pager on
        page_id = page-1
        selected_transactions = transactions[(page_id*items_per_page):((page_id*items_per_page)+items_per_page)]
        max_page = int(math.ceil(len(transactions)/items_per_page))+1
        pages = [i+1 for i in range(max_page)]
        show_pager = True
    <commit_msg>sort by time<commit_after>from connections import connector
from globals import globals
from lib import *
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import render
import math

def index(request, page=0):
    '''
    handler for the transactions
    '''
    page = int(page)
    items_per_page = 10
    page_title = "Transactions"
    
    transactions = getTransactions(connector = connector, sort_by = 'time', reverse_order = True)
    for transaction in transactions:
        transaction['currency_symbol'] = getCurrencySymbol(transaction['currency'].lower())
        if transaction['category'] == 'receive':
            transaction['icon'] = 'glyphicon-circle-arrow-down'
        elif transaction['category'] == 'send':
            transaction['icon'] = 'glyphicon-circle-arrow-up'
        elif transaction['category'] == 'move':
            transaction['icon'] = 'glyphicon-circle-arrow-right'
    
    # pagify
    if page is 0:
        # pager off
        selected_transactions = transactions
        max_page = 0
        pages = []
        show_pager = False
    else:
        # pager on
        page_id = page-1
        selected_transactions = transactions[(page_id*items_per_page):((page_id*items_per_page)+items_per_page)]
        max_page = int(math.ceil(len(transactions)/items_per_page))+1
        pages = [i+1 for i in range(max_page)]
        show_pager = True
    
{'fraction_non_alphanumeric': 0.1054481546572935, 'fraction_numerical': 0.00562390158172232, 'mean_word_length': 3.0028129395218004, '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': '882246', 'n_tokens_mistral': 805, 'n_tokens_neox': 785, 'n_words': 190}