Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
frozen
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
CSE6
frozen
Commits
043eb5cc
Commit
043eb5cc
authored
2 years ago
by
Arno Wunderlich
Browse files
Options
Downloads
Patches
Plain Diff
view current bid instead of starting price
parent
19f8c59f
No related branches found
No related tags found
1 merge request
!41
Bidding frontend backend integration fixes
Pipeline
#15527
passed
2 years ago
Stage: build
Stage: test
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/tjts5901/templates/listBid.html
+1
-1
1 addition, 1 deletion
src/tjts5901/templates/listBid.html
src/tjts5901/templates/view.html
+2
-2
2 additions, 2 deletions
src/tjts5901/templates/view.html
src/tjts5901/views.py
+8
-2
8 additions, 2 deletions
src/tjts5901/views.py
with
11 additions
and
5 deletions
src/tjts5901/templates/listBid.html
+
1
−
1
View file @
043eb5cc
...
...
@@ -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"
>
...
...
This diff is collapsed.
Click to expand it.
src/tjts5901/templates/view.html
+
2
−
2
View file @
043eb5cc
...
...
@@ -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.start
in
g
_bid }}"
placeholder=
"write your bid"
>
<input
class=
"col-md-9"
id=
"bid"
name =
"bid"
type=
"number"
min=
"{{
m
in_bid }}"
placeholder=
"write your bid"
>
<button
for=
"bid"
type=
"submit"
class=
"btn btn-primary col-md-3"
>
Validate
</button>
</form>
</div>
...
...
This diff is collapsed.
Click to expand it.
src/tjts5901/views.py
+
8
−
2
View file @
043eb5cc
...
...
@@ -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
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment