Example #1
0
def any_auction(auction_id):
    if request.method == 'GET':
        auction_info = api.get_info_auction(auction_id)
        is_self = True
        if str(auction_info[0]) == str(session['user_logged_in']):
            is_self = False
        username_a = auction_info[0]
        bids = api.get_bids(auction_id)
        locations = api.get_location_list();
        image = api.get_user_image(session['user_logged_in'])
        image_map = api.user_image_map()
        winner = api.get_winner(auction_id)

        timeleft = api.time_dif(auction_info)
        api.check_current_auctions()
        print(winner)
        return render_template('any_auction.html',username_a=username_a,
            username=session['user_logged_in'],
            order=auction_info[1],location=auction_info[5],aid=auction_id,
            bids=bids,is_self=is_self,locations=locations,
            image=image,image_map=image_map, time_left=timeleft,
            winner=winner)
    
    location = request.form['location']
    price = request.form['price']
    cur_id = session['user_logged_in']
    api.add_bid_to_auction(auction_id,cur_id,price,location)

    return redirect(url_for('any_auction',auction_id=auction_id))
Example #2
0
def auction_list():
    api.check_current_auctions()
    auctionList = []
    image = api.get_user_image(session['user_logged_in'])
    image_map = api.user_image_map()
    time_list = {}
    for auctionID in api.get_all_active():
        info = api.get_info_auction(auctionID)
        time_list[auctionID] = api.time_dif(info)
        auctionList.append([auctionID] + info)
    return render_template('auction_list.html', auctionList=auctionList,
        image=image,image_map=image_map,username=session['user_logged_in'],
        time_list=time_list)