def active_losses():
    losses = []

    sql = "SELECT * FROM losses where recovered = False"
    results = run_sql(sql)

    for row in results:
        wizard = wiz_repo.select(row['wizard_id'])
        item = item_repo.select(row['item_id'])
        loss = Loss(row['day'], row['month'], row['year'], row['details'],
                    wizard, item, row['recovered'], row['id'])
        losses.append(loss)
    return losses
def select(id):
    loss = None
    sql = "SELECT * FROM losses WHERE id = %s"
    values = [id]
    result = run_sql(sql, values)[0]

    if result is not None:
        wizard = wiz_repo.select(result['wizard_id'])
        item = item_repo.select(result['spell_id'])
        loss = Loss(result['day'], result['month'], result['year'],
                    result['details'], wizard, item, result['recovered'],
                    result['id'])
    return loss
def loss_history(wizard):
    losses = []

    sql = "SELECT * FROM losses where wizard_id = %s AND recovered = False"
    values = [wizard.id]
    results = run_sql(sql, values)

    for row in results:
        wizard = wiz_repo.select(row['wizard_id'])
        item = item_repo.select(row['item_id'])
        loss = Loss(row['day'], row['month'], row['year'], row['details'],
                    wizard, item, row['recovered'], row['id'])
        losses.append(loss)
    return losses
def edit_item_view(id):
    item = item_repo.select(id)
    wizard = item.wizard.id
    return render_template('items/edit.html', item=item, wizard=wizard)
示例#5
0
def edit_item(id):
    item = item_repository.select(id)
    manufacturers = manufacturer_repository.select_all()
    return render_template("/items/edit.html",
                           item=item,
                           manufacturers=manufacturers)
示例#6
0
def show_item(id):
    item = item_repository.select(id)
    return render_template("/items/show.html", item=item)