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

First draft of paper slips #3

Closed
wants to merge 1 commit into from

Conversation

GLamarque
Copy link
Collaborator

@GLamarque GLamarque commented Apr 30, 2023

#6

@@ -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":
Copy link
Owner

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
Copy link
Owner

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())
Copy link
Owner

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)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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

Comment on lines +70 to +71
now = datetime.now()
date = now.strftime("%d/%m/%Y")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. There's a datetime.date library which lets you manipulate dates without time, which is probably what you want to do here
  2. Because of this, date is more or less a reserved name :>

Something like this should work:

Suggested change
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>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Player 1: {{ row["player_2"] }}<br>
Player 2: {{ row["player_2"] }}<br>

border-bottom: 2px solid black;
height: 100%;
}
@media print {
Copy link
Owner

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 (?)

@pmourlanne
Copy link
Owner

Closing in favour of #14

@pmourlanne pmourlanne closed this Apr 30, 2023
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants