add gamecard progress

This commit is contained in:
2022-06-10 16:54:14 -05:00
parent a93d37a083
commit 9172a37bcc
3 changed files with 246 additions and 153 deletions

View File

@@ -1,4 +1,4 @@
@import url("../../css/paper.css"); @import url("paper.css");
@import url('https://fonts.googleapis.com/css2?family=Roboto&display=swap'); @import url('https://fonts.googleapis.com/css2?family=Roboto&display=swap');
@import url('../fonts/vera/bitstreamvera.css'); @import url('../fonts/vera/bitstreamvera.css');
@import url('../fonts/verdana/verdanapro.css'); @import url('../fonts/verdana/verdanapro.css');
@@ -48,7 +48,7 @@ card-right {
height: 100%; height: 100%;
width: 100%; width: 100%;
/* padding: .1in; */ /* padding: .1in; */
outline: solid grey; /*outline: solid grey;*/
} }
table { table {
@@ -59,12 +59,39 @@ table {
white-space: nowrap; white-space: nowrap;
text-overflow: ellipsis; text-overflow: ellipsis;
overflow-x: hidden; overflow-x: hidden;
overflow-y: hidden;
width: 100%; width: 100%;
} }
th, tr, td { table.lineup {
/* box-sizing: content-box; */ text-transform: uppercase;
border: 0.5px solid black; width: 100%;
border: black;
}
.cell-checkbox {
color: grey;
font-size: .75em;
}
.cell-info-lastname {
width: 70px;
text-transform: uppercase;
font-stretch: condensed;
}
.in-starting-lineup {
font-weight: bold;
}
th{
background: black;
color: white;
border: none;
}
tr, td {
border: 0.5px solid grey;
height: 17px; height: 17px;
text-overflow: ellipsis; text-overflow: ellipsis;
overflow-x: hidden; overflow-x: hidden;
@@ -82,13 +109,18 @@ th, tr, td {
font-weight: bolder; font-weight: bolder;
} }
.numbercell { .cell-smalltext {
font-family: "m+1m"; font-stretch: condensed;
text-align: center;
font-stretch: condensed;
font-size: 10px; font-size: 10px;
} }
.day-of-the-week{
font-family: "m+1m";
font-size: 8px;
transform: rotate(-90deg);
display: inline-block
}
.statscell { .statscell {
font-family: "m+1m"; font-family: "m+1m";
text-align: center; text-align: center;
@@ -97,16 +129,13 @@ th, tr, td {
width: 60px; width: 60px;
} }
tr:nth-child(even) {background-color: #f2f2f2;} tr:nth-child(even) {
background-color: #f2f2f2;
th{
background: black;
color: white;
border: none;
} }
.customcol{
width: 120px;
{
text-transform: uppercase; text-transform: uppercase;
} }
@@ -116,9 +145,21 @@ th{
font-stretch: condensed; font-stretch: condensed;
} }
.square { .cell-square {
height: 14px; height: 14px;
width: 14px; width: 14px;
text-align: center;
}
.cell-square.narrow {
width: 10px;
}
.cell-mono {
font-family: "m+1m";
}
.cell-condensed {
font-stretch: condensed;
} }
.available-status-code-1{ .available-status-code-1{

View File

@@ -23,70 +23,70 @@
</tr> </tr>
</thead> </thead>
</table> </table>
<table> <table class="lineup">
<thead> <thead>
<tr> <tr>
<th class="numbercell"> <th class="cell-square">
</th> </th>
<th class="customcol"> <th class="customcol">
</th> </th>
<th class="numbercell"> <th class="cell-square">
</th> </th>
<th class="numbercell"> <th class="cell-square">
</th>
<th class="numbercell">1
</th>
<th class="numbercell">2
</th>
<th class="numbercell">3
</th>
<th class="numbercell">4
</th>
<th class="numbercell">5
</th>
<th class="numbercell">6
</th>
<th class="numbercell">7
</th>
<th class="numbercell">X
</th> </th>
{% for inning in '1234567X' %}
<th class="cell-square">{{ inning }}
</th>
{% endfor %}
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{% for member in members_startinglineup %} {% for member in members_startinglineup %}
<tr> <tr>
<td class="numbercell">{{ member.lineup_entry.sequence | add:"1" }}</td> <td class="cell-square cell-smalltext cell-mono">{{ member.lineup_entry.sequence | add:"1" }}</td>
<td class="customcol">{{ member.member.last_name }}</td> <td class="customcol">{{ member.member.last_name }}</td>
<td class="numbercell">{{ member.member.jersey_number }}</td> <td class="cell-square cell-smalltext">{{ member.member.jersey_number }}</td>
<td class="numbercell">{{ member.lineup_entry.label }}</td> <td class="cell-square cell-smalltext cell-mono">{{ member.lineup_entry.label }}</td>
<td></td> {% for inning in '1234567X' %}
<td></td> <td class="cell-square"></td>
<td></td> {% endfor %}
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>
</table> </table>
<table> <table class="lineup">
<tbody> <tbody>
{% for member in members_startingpositiononly %} {% for member in members_startingpositiononly %}
<tr> <tr>
<td class="numbercell"></td> <td class="cell-square"></td>
<td class="customcol">{{ member.member.last_name }}</td> <td class="">{{ member.member.last_name }}</td>
<td class="numbercell">{{ member.member.jersey_number }}</td> <td class="cell-square cell-smalltext">{{ member.member.jersey_number }}</td>
<td class="numbercell">{{ member.lineup_entry.label }}</td> <td class="cell-square cell-smalltext cell-mono">{{ member.lineup_entry.label }}</td>
<td></td> {% for inning in '1234567X' %}
<td></td> <td class="cell-square"></td>
<td></td> {% endfor %}
<td></td> </tr>
<td></td> {% endfor %}
<td></td> {% for member in members_bench %}
<td></td> <tr>
<td></td> <td class="cell-square"></td>
<td class="">{{ member.member.last_name }}</td>
<td class="cell-square cell-smalltext">{{ member.member.jersey_number }}</td>
<td class="cell-square cell-smalltext cell-mono">{{ member.lineup_entry.label }}</td>
{% for inning in '1234567X' %}
<td class="cell-square"></td>
{% endfor %}
</tr>
{% endfor %}
{% for _ in blankrows_lineup %}
<tr>
<td class="cell-square"></td>
<td class="">{{ member.member.last_name }}</td>
<td class="cell-square cell-smalltext">{{ member.member.jersey_number }}</td>
<td class="cell-square cell-smalltext cell-mono">{{ member.lineup_entry.label }}</td>
{% for inning in '1234567X' %}
<td class="cell-square"></td>
{% endfor %}
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>
@@ -95,96 +95,137 @@
</div> </div>
<div class="half-card"> <div class="half-card">
<div class="content card-right"> <div class="content card-right">
<table class="tg"> <div style="width:100%">
<thead> <table class="">
<tr> <thead>
<th class="numbercell"></th>
<th class="numbercell"></th>
<th class="condensedNameCell">Available</th>
<th class="statscell">AVG/OBP/SLG:PA</th>
<th class="numbercell">P</th>
<th class="numbercell">C</th>
<th class="numbercell">IF</th>
<th class="numbercell">OF</th>
{% for event in events_future %}
<th class="numbercell">
<span style="transform: rotate(-90deg);display: inline-block">
{{ event.data.start_date|date:'D' }}
</span>
</th>
{% endfor %}
{% for event in events_past %}
<th class="numbercell">
<span style="transform: rotate(-90deg);display: inline-block">
{{ event.data.start_date|date:'D' }}
</span>
</th>
{% endfor %}
</tr>
</thead>
<tbody>
{% for member in members %}
<tr> <tr>
<td class="numbercell"></td> <th class="cell-square"></th>
<td class="numbercell available-status-code-{{ member.availability.status_code }}">{{ member.member.jersey_number }}</td> <th class="cell-square"></th>
<td class="condensedNameCell available-status-code-{{ member.availability.status_code }}">{{ member.member.last_name }}</td> <th class="condensedNameCell">Available</th>
<td class="statscell"></td> <th class="statscell">AVG/OBP/SLG:PA</th>
<td class="numbercell"> <th class="cell-square cell-smalltext narrow">P</th>
{% if "P" in member.member.position %} <th class="cell-square cell-smalltext narrow">C</th>
<i class="bi bi-check-square-fill"></i> <th class="cell-square cell-smalltext narrow">IF</th>
{% else %} <th class="cell-square cell-smalltext narrow">OF</th>
<i class="bi bi-square"></i> {% for event in events_future %}
{% endif %} <th class="cell-square cell-smalltext cell-condensed narrow">
<td class="numbercell"> <span class="day-of-the-week">{{ event.data.start_date|date:'D' }}</span>
{% if "C" in member.member.position %} </th>
<i class="bi bi-check-square-fill"></i> {% endfor %}
{% else %} {% for event in events_past %}
<i class="bi bi-square"></i> <th class="cell-square cell-smalltext cell-condensed narrow">
{% endif %} <span class="day-of-the-week">{{ event.data.start_date|date:'D' }}</span>
</td> </th>
<td class="numbercell"> {% endfor %}
{% if "IF" in member.member.position or "1B" in member.member.position %}
<i class="bi bi-check-square-fill"></i>
{% else %}
<i class="bi bi-square"></i>
{% endif %}
</td>
<td class="numbercell">
{% if "OF" in member.member.position %}
<i class="bi bi-check-square-fill"></i>
{% else %}
<i class="bi bi-square"></i>
{% endif %}
</td>
<td class="numbercell available-status-code-{{ member.availability_future.0.data.status_code }}">
{{ member.availability_future.0.data.status.0 }}
</td>
<td class="numbercell available-status-code-{{ member.availability_future.1.data.status_code }}">
{{ member.availability_future.1.data.status.0 }}
</td>
<td class="numbercell available-status-code-{{ member.availability_future.2.data.status_code }}">
{{ member.availability_future.2.data.status.0 }}
</td>
<td class="numbercell available-status-code-{{ member.availability_future.3.data.status_code }}">
{{ member.availability_future.3.data.status.0 }}
</td>
<td class="numbercell available-status-code-{{ member.availability_past.0.data.status_code }}">
{{ member.availability_past.0.data.status.0 }}
</td>
<td class="numbercell available-status-code-{{ member.availability_past.1.data.status_code }}">
{{ member.availability_past.1.data.status.0 }}
</td>
<td class="numbercell available-status-code-{{ member.availability_past.2.data.status_code }}">
{{ member.availability_past.2.data.status.0 }}
</td>
<td class="numbercell available-status-code-{{ member.availability_past.3.data.status_code }}">
{{ member.availability_past.3.data.status.0 }}
</td>
</tr> </tr>
{% endfor %} </thead>
</tbody> <tbody>
</table> {% for member in members %}
<tr>
<td class="cell-square"></td>
<td class="cell-square cell-smalltext cell-mono available-status-code-{{ member.availability.status_code }} {% if member.in_starting_lineup %}in-starting-lineup{% endif %}">{{ member.member.jersey_number }}</td>
<td class="cell-info-lastname available-status-code-{{ member.availability.status_code }} {% if member.in_starting_lineup %}in-starting-lineup{% endif %}">{{ member.member.last_name }}</td>
<td class="statscell"></td>
<td class="cell-square cell-checkbox narrow no-inside-border">
{% if "P" in member.member.position %}
<i class="bi bi-check-square-fill"></i>
{% else %}
<i class="bi bi-square"></i>
{% endif %}
<td class="cell-square cell-checkbox narrow no-inside-border">
{% if "C" in member.member.position %}
<i class="bi bi-check-square-fill"></i>
{% else %}
<i class="bi bi-square"></i>
{% endif %}
</td>
<td class="cell-square cell-checkbox narrow no-inside-border">
{% if "IF" in member.member.position or "1B" in member.member.position or "2B" in member.member.position or "3B" in member.member.position or "SS" in member.member.position %}
<i class="bi bi-check-square-fill"></i>
{% else %}
<i class="bi bi-square"></i>
{% endif %}
</td>
<td class="cell-square cell-checkbox narrow no-inside-border">
{% if "OF" in member.member.position or "LF" in member.member.position or "CF" in member.member.position or "RF" in member.member.position %}
<i class="bi bi-check-square-fill"></i>
{% else %}
<i class="bi bi-square"></i>
{% endif %}
</td>
<td class="cell-square narrow cell-smalltext cell-mono no-inside-border available-status-code-{{ member.availability_future.0.data.status_code }}">
{{ member.availability_future.0.data.status.0 }}
</td>
<td class="cell-square narrow cell-smalltext cell-mono no-inside-border available-status-code-{{ member.availability_future.1.data.status_code }}">
{{ member.availability_future.1.data.status.0 }}
</td>
<td class="cell-square narrow cell-smalltext cell-mono no-inside-border available-status-code-{{ member.availability_future.2.data.status_code }}">
{{ member.availability_future.2.data.status.0 }}
</td>
<td class="cell-square narrow cell-smalltext cell-mono no-inside-border available-status-code-{{ member.availability_future.3.data.status_code }}">
{{ member.availability_future.3.data.status.0 }}
</td>
<td class="cell-square narrow cell-smalltext cell-mono available-status-code-{{ member.availability_past.0.data.status_code }}">
{{ member.availability_past.0.data.status.0 }}
</td>
<td class="cell-square narrow cell-smalltext cell-mono available-status-code-{{ member.availability_past.1.data.status_code }}">
{{ member.availability_past.1.data.status.0 }}
</td>
<td class="cell-square narrow cell-smalltext cell-mono available-status-code-{{ member.availability_past.2.data.status_code }}">
{{ member.availability_past.2.data.status.0 }}
</td>
<td class="cell-square narrow cell-smalltext cell-mono available-status-code-{{ member.availability_past.3.data.status_code }}">
{{ member.availability_past.3.data.status.0 }}
</td>
</tr>
{% endfor %}
{% for _ in blankrows_info %}
<tr>
<td class="cell-square"></td>
<td class="cell-square"></td>
<td class="cell-square"></td>
<td class="statscell"></td>
<td class="cell-square narrow"></td>
<td class="cell-square narrow"></td>
<td class="cell-square narrow"></td>
<td class="cell-square narrow"></td>
<td class="cell-square narrow available-status-code"></td>
<td class="cell-square narrow available-status-code"></td>
<td class="cell-square narrow available-status-code"></td>
<td class="cell-square narrow available-status-code"></td>
<td class="cell-square narrow available-status-code"></td>
<td class="cell-square narrow available-status-code"></td>
<td class="cell-square narrow available-status-code"></td>
<td class="cell-square narrow available-status-code"></td>
</tr>
{% endfor %}
</tbody>
</table>
<table class="">
<thead>
<tr>
</tr>
</thead>
<tbody>
{% for member in members %}
<tr>
</tr>
{% endfor %}
{% for _ in blankrows_info %}
<tr>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div> </div>
</div> </div>
</div> </div>
@@ -198,17 +239,17 @@
<table> <table>
<thead> <thead>
<tr> <tr>
<th class="numbercell" style="background-color: #323669"> <th class="cell-square" style="background-color: #323669">
{{ event.data.start_date|date:"D, F j, Y g:i A" }} {{ event.data.start_date|date:"D, F j, Y g:i A" }}
</th> </th>
</tr> </tr>
<tr> <tr>
<th class="numbercell" style="background-color: #323669"> <th class="cell-square" style="background-color: #323669">
{{ event.data.location_name }} {{ event.data.location_name }}
</th> </th>
</tr> </tr>
<tr> <tr>
<th class="numbercell" style="background-color: lightgray"> <th class="cell-square" style="background-color: lightgray">
</th> </th>
</tr> </tr>

View File

@@ -106,6 +106,7 @@ def gamecard(request, team_id, event_id):
members_startinglineup = [] members_startinglineup = []
members_startingpositiononly = [] members_startingpositiononly = []
members_bench = []
for member in members: for member in members:
if re.search( if re.search(
@@ -123,9 +124,14 @@ def gamecard(request, team_id, event_id):
member["lineup_entry"]["label"] = position member["lineup_entry"]["label"] = position
if member["lineup_entry"].get("id") and not position_only: if member["lineup_entry"].get("id") and not position_only:
member["in_starting_lineup"] = True
members_startinglineup.append(member) members_startinglineup.append(member)
elif member["lineup_entry"].get("id") and position_only: elif member["lineup_entry"].get("id") and position_only:
member["in_starting_lineup"] = False
members_startingpositiononly.append(member) members_startingpositiononly.append(member)
elif member["availability"]["status_code"] in [1, 2]:
member["in_starting_lineup"] = False
members_bench.append(member)
members_startinglineup = sorted( members_startinglineup = sorted(
members_startinglineup, members_startinglineup,
@@ -139,7 +145,12 @@ def gamecard(request, team_id, event_id):
"members": members, "members": members,
"members_startinglineup": members_startinglineup, "members_startinglineup": members_startinglineup,
"members_startingpositiononly": members_startingpositiononly, "members_startingpositiononly": members_startingpositiononly,
"members_bench": members_bench,
"blankrows_lineup": range(
13 - len(members_startingpositiononly) - len(members_bench)
),
"ts_team": Team.objects.get(id=team_id), "ts_team": Team.objects.get(id=team_id),
"ts_opponent": Opponent.objects.filter(id=ts_event.data["opponent_id"]).first, "ts_opponent": Opponent.objects.filter(id=ts_event.data["opponent_id"]).first,
"blankrows_info": range(25 - len(members)),
} }
return render(request, "gamecard/gamecard.html", context=context) return render(request, "gamecard/gamecard.html", context=context)