-
Notifications
You must be signed in to change notification settings - Fork 2
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
First draft of paper slips #3
Conversation
@@ -50,5 +51,24 @@ def home(): | |||
) | |||
rows = sorted(rows, key=lambda row: row["player_1"].lower()) | |||
return render_template("pairings.html", rows=rows, **ctx) | |||
elif request.form["action"] == "match_slips": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: You don't need an elif
and could do with an if
, since we return
in the block above
|
||
rows = [] | ||
for pairing in pairings: | ||
# We want to display each pairing twice, once for each player |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment can go (I imagine it was copy pasted)
"player_2_points": pairing.player_2.points, | ||
}, | ||
) | ||
rows = sorted(rows, key=lambda row: row["player_1"].lower()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably want to order by table number, and do some neat things with modulo to ease up the cutting
rows = sorted(rows, key=lambda row: row["player_1"].lower()) | ||
now = datetime.now() | ||
date = now.strftime("%d/%m/%Y") | ||
return render_template("paper_slips.html", date=date, rows=rows, **ctx) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return render_template("paper_slips.html", date=date, rows=rows, **ctx) | |
return render_template("match_slips.html", date=date, rows=rows, **ctx) |
Let's be consistent with the naming
now = datetime.now() | ||
date = now.strftime("%d/%m/%Y") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- There's a
datetime.date
library which lets you manipulate dates without time, which is probably what you want to do here - Because of this,
date
is more or less a reserved name :>
Something like this should work:
now = datetime.now() | |
date = now.strftime("%d/%m/%Y") | |
from datetime import date | |
today_str = date.today().strftime("%d/%m/%Y") |
|
||
<div class="row paper-slip__p2-infos"> | ||
<div class="col-6"> | ||
Player 1: {{ row["player_2"] }}<br> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Player 1: {{ row["player_2"] }}<br> | |
Player 2: {{ row["player_2"] }}<br> |
border-bottom: 2px solid black; | ||
height: 100%; | ||
} | ||
@media print { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll have a look, I'm surprised we need all of this custom CSS for print, whereas I didn't need anything for the pairings / standings (?)
Closing in favour of #14 |
#6