Пример #1
0
def view_transactions():
    """
    Transaction history page for user's dashboard.
    """
    if 'username' not in session:
        return redirect(url_for('login'))
    else:
        if not session['type_of_user'] == "user":
            return render_template("access_denied.html")

        balance = 0
        if session['type_of_user'] == "developer":
            balance = Developer.get_info(session['username'])["balance"]
        else:
            balance = Client.get_info(session['username'])["balance"]

        outgoing = Transaction.get_transactions_by_sender(session['username'])
        incoming = Transaction.get_transactions_by_recipient(
            session['username'])
        return render_template("myTransactions.html",
                               balance=balance,
                               outgoing=outgoing,
                               incoming=incoming)