Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issues found during the show practice runthrough #111

Merged
merged 5 commits into from
Jan 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion artshow/bid_entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def get_bids(piece):
'last_updated': bids_updated,
'location': piece.location,
'locations': piece.artist.assigned_locations(),
'buy_now': float(piece.buy_now),
'buy_now': None if piece.buy_now is None else float(piece.buy_now),
})


Expand Down
3 changes: 2 additions & 1 deletion artshow/static/artshow/bidder_agreement.css
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ body {
grid-gap: 0px 10px;
grid-auto-flow: column;
grid-template-rows: 20px repeat(2, 1fr);
grid-template-columns: 2fr repeat(3, 1fr);
grid-template-columns: repeat(3, 1fr);
background-color: lightgrey;
border: 1px solid black;
border-radius: 5px;
Expand All @@ -63,6 +63,7 @@ body {

.bid-sticker {
grid-row: 2 / 4;
grid-column: 3;
display: table;
height: 0.75in;
width: 1.75in;
Expand Down
4 changes: 1 addition & 3 deletions artshow/templates/artshow/bidder_agreement.html
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,7 @@ <h2>Rules</h2>
<div class="field-label">Staff initials:</div>
<div class="field-line">&nbsp;</div>
</div>
<div class="bid-sticker"><span>1st bid sticker</span></div>
<div class="bid-sticker"><span>2nd bid sticker</span></div>
<div class="bid-sticker"><span>3rd bid sticker</span></div>
<div class="bid-sticker"><span>Place bid sticker here.</span></div>
</div>
</body>
</html>
6 changes: 3 additions & 3 deletions artshow/templates/artshow/workflows_artist_checkin.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@
<th>Name/Title</th>
<th>Media</th>
<th>Adult?</th>
<th>Reproduction rights included?</th>
<th>Not For Sale</th>
<th><span title="Reproduction rights included">RPR</span></th>
<th><span title="Not for sale">NFS</span></th>
<th>Min Bid</th>
<th>Buy Now</th>
<th>Location</th>
Expand Down Expand Up @@ -135,7 +135,7 @@
A25,45,0,2,1,1,N,"${escape(pieceName.slice(0, 24))}"
A25,65,0,2,1,1,N,"${escape(pieceName.slice(24, 49))}"
A25,105,0,2,1,1,N,"${escape(media.slice(0, 24))}"
A355,5,1,2,2,2,N,"${json.artistId}-${sticker.pieceId}"
A350,10,1,2,2,2,N,"${json.artistId}-${sticker.pieceId}"
JB
P1
`;
Expand Down
4 changes: 3 additions & 1 deletion artshow/templates/artshow/workflows_bidder_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
</p>

<p>
<input type="number" min="1" max="10" value="10" id="bid-sticker-count">
<button id="print-bid-stickers">Print Bid Stickers</button>
<span id="label-printer-status">No label printer detected.</span>
</p>
Expand All @@ -72,14 +73,15 @@
setUpLabelPrinter('label-printer-status');

const json = JSON.parse(document.getElementById('json-data').textContent);
const stickerCount = document.getElementById('bid-sticker-count');
const printButton = document.getElementById('print-bid-stickers');
printButton.disabled = json.bidderId == null;
printButton.addEventListener('click', async () => {
const data = `N
A50,40,0,7,2,2,N,"${json.bidderId}"
A160,46,0,5,1,1,N,"$"
LO160,100,165,5
P10
P${stickerCount.value}
`;

printLabels(data);
Expand Down
19 changes: 18 additions & 1 deletion artshow/tests/test_bid_entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ def setUp(self):
bid = Bid(bidder=bidder, piece=piece, amount=20)
bid.save()

# Piece 1-3 has no buy now price.
piece = Piece(artist=artist, pieceid=3, min_bid=5,
status=Piece.StatusInShow,
location='A2')
piece.save()

self.client = Client()
self.client.login(username='test', password='test')

Expand All @@ -73,7 +79,7 @@ def test_invalid_artist(self):
self.assertEqual(response.json(), expected)

def test_invalid_piece(self):
response = self.client.get('/artshow/entry/bids/1/3/')
response = self.client.get('/artshow/entry/bids/1/4/')
expected = {
'error': {
'field': 'piece_id',
Expand Down Expand Up @@ -110,6 +116,17 @@ def test_piece_two_bids(self):
}
self.assertEqual(response.json(), expected)

def test_piece_no_buy_now(self):
response = self.client.get('/artshow/entry/bids/1/3/')
expected = {
'bids': [],
'buy_now': None,
'last_updated': None,
'location': 'A2',
'locations': ['A1', 'A2'],
}
self.assertEqual(response.json(), expected)

def test_invalid_bidder(self):
data = {
'bids': [
Expand Down
Loading