Beispiel #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))
Beispiel #2
0
def my_account():
    username = session['user_logged_in']
    op,closed = api.get_my_auctions(username)
    winner_for_close = {}
    for close in closed:
        winner_for_close[close[0]] = api.get_winner(close[0])
    bids = []
    image = api.get_user_image(session['user_logged_in'])
    return render_template('myaccount.html',op=op,closed=closed,bids=bids,
        winner_map=winner_for_close,image=image)
Beispiel #3
0
def request_food():
    restaurants = api.get_restaurants()
    rest_dict = {}
    for restaurant in restaurants:
        rest_dict[restaurant] = api.parse_restaurant(restaurant)
    image = api.get_user_image(session['user_logged_in'])
    times = special_restaurant_dict()
    
    return render_template('request_food.html', restaurants=restaurants,
        rest_dict=rest_dict,locations=api.get_location_list(),image=image,
        username=session['user_logged_in'],times=times)
Beispiel #4
0
def my_auction():
    restaurant = request.form['restaurant']
    category = request.form['category']
    item,price = request.form['item'].split(',')
    auction_length = request.form['auction_length']
    location = request.form['location']
    order = restaurant + ": " + category + ": " + item + ": " + price
    image = api.get_user_image(session['user_logged_in'])
    image_map = api.user_image_map()
    aid = api.create_auction(session['user_logged_in'],order,price,auction_length,location)
    bids = api.get_bids(aid)
    return redirect(url_for('any_auction',auction_id=aid))
Beispiel #5
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)