Skip to content
Snippets Groups Projects
Commit 043eb5cc authored by Arno Wunderlich's avatar Arno Wunderlich
Browse files

view current bid instead of starting price

parent 19f8c59f
No related branches found
No related tags found
1 merge request!41Bidding frontend backend integration fixes
Pipeline #15527 passed
......@@ -20,7 +20,7 @@
<small>{{ item.created_at }}</small>
</div>
<p class="mb-1">{{ item.description }}</p>
<small>{{ item.starting_bid }}</small>
<small>{{ item.current_price}}</small>
<a href="{{ url_for('views.page_bid', id=item.id) }}"><button class="btn btn-primary">Bid</button></a>
</div>
<div class="row justify-content-md-center">
......
......@@ -18,9 +18,9 @@
<h5 class="mb-1">{{ item.title }}</h5>
<p class="mb-1">{{ item.description }}</p>
<p class="mb-1">Created : {{ item.created_at }}</p>
<p class="mb-1">Current bid : {{ item.starting_bid }}</p><br/>
<p class="mb-1">Current bid : {{ current_price }}</p><br/>
<form method="POST" action="{{ url_for('views.bid', id=item.id)}}" class="row" enctype="multipart/form-data">
<input class="col-md-9" id="bid" name ="bid" type="number" min="{{ item.starting_bid }}" placeholder="write your bid">
<input class="col-md-9" id="bid" name ="bid" type="number" min="{{ min_bid }}" placeholder="write your bid">
<button for="bid" type="submit" class="btn btn-primary col-md-3">Validate</button>
</form>
</div>
......
......@@ -168,6 +168,7 @@ def list_bid():
for item in items:
item.image_base64 = base64.b64encode(item.image.read()).decode('utf-8')
item.current_price = get_item_price(item) - MIN_BID_INCREMENT
html = render_template("listBid.html", items=items)
return html
......@@ -207,7 +208,7 @@ def bid(id):
)
bid.save()
except Exception as exc:
flash(("Error placing bid: %(exc)s", exc=exc))
flash(_("Error placing bid: %(exc)s", exc=exc))
else:
flash(("Bid placed successfully!"))
......@@ -319,11 +320,16 @@ def page_bid(id):
item = Item.objects.get_or_404(id=id)
# Set the current price for the bid according to current highest bid
winning_bid = get_winning_bid(item)
min_bid = get_item_price(item)
current_price = min_bid - MIN_BID_INCREMENT
item.image_base64 = base64.b64encode(item.image.read()).decode('utf-8')
# Dark pattern to show enticing message to user
#if item.closes_at < datetime.utcnow() + timedelta(hours=1):
# flash("This item is closing soon! Act now! Now! Now!")
return render_template('view.html', item=item)
return render_template('view.html', item=item, current_price=current_price, min_bid=min_bid)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment