commit ee22d2986de7e8e55fd56ffdf12f7f784a0667b2
parent f4b4442e0f97c9a3db091fc3172210fa0a318f45
Author: alex wennerberg <alex@alexwennerberg.com>
Date: Tue, 6 Feb 2024 15:09:46 -0500
some changes
Diffstat:
2 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/getdata.py b/getdata.py
@@ -103,8 +103,8 @@ def save_sheet(cur, sheet, n, final):
row = rows[i]
i += 1
player = row[0]
- if len(player) > 50:
- player = "[messy-name]"
+ if len(player) > 50 and player[0] == "B":
+ player = "Beefman"
cards = row[1].split("\n")
if not final: #already done
cur.execute("insert into deck values (?,?,?,?,?);", (n, player, clean_card(cards[0]), clean_card(cards[1]), clean_card(cards[2])))
@@ -143,6 +143,7 @@ def best_guess(card):
def replacement(card):
m = {
+ "Gargadon (Neither Greater Nor lesser": "Gargadon",
"Tabernacle at Penrall Vale": "The Tabernacle at Pendrell Value",
"Nesumi Shortfang": "Nezumi Shortfang // Stabwhisker the Odious",
"Filigree Sylex": "The Filigree Sylex",
@@ -192,7 +193,7 @@ def export_html():
with open("sql/export.sql") as f:
query = f.read()
res = con.cursor().execute(query)
- print("""<html><head>
+ print("""<html charset='UTF-8'><head>
<style> table { font-family: Arial, Helvetica, sans-serif; border-collapse: collapse; width: 100%; }
td, th { border: 1px solid #ddd; padding: 8px; }
tr:nth-child(even){background-color: #f2f2f2;}
@@ -204,13 +205,12 @@ def export_html():
background-color: #04AA6D;
color: white;
}</style>
- </head><body><h1>3 card blind all data</h1><b>bold</b> = best showing for this card<br>
+ </head><body><h1>3 card blind all data</h1><br>
<table>
<th><td>player</td><td>card_1</td><td>card 2</td>
<td>card 3</td><td>group</td><td>score</td><td>final</td>
</th>
""")
- # header TODO
# html escape TODO
for row in res:
print("<tr>")
@@ -218,8 +218,8 @@ def export_html():
for i in range(2,5):
card = row[i]
cardl = card_link(card)
- if row[i+3]:
- print(f"<td><b><a href='{cardl}'>{card}</a></b></td>")
+ if row[i+3]: # TODO fix
+ print(f"<td><a href='{cardl}'>{card}</a></td>")
else:
print(f"<td><a href='{cardl}'>{card}</a></td>")
print(f"<td>{row[8]}</td>")
@@ -234,7 +234,7 @@ def export_html():
if __name__ == "__main__":
for table in schema:
con.execute(table)
- # update_bans()
- # main()
+ update_bans()
+ main()
export_html()
diff --git a/sql/export.sql b/sql/export.sql
@@ -17,7 +17,7 @@ select
sum(case when match.group_name = 'final' then match.score * 100 else match.score end) as score
from card
join match on card.round = match.round and card.player = match.player
-group by 1),
+group by 1,2),
top_scores as (
select card, round, player, max(score) as score from ranked_cards group by 1),
@@ -35,13 +35,13 @@ sum(case when match.group_name = 'final' then match.score else null end) as fina
from deck join match
on deck.round = match.round and deck.player = match.player
left join top_scores ts1
-on deck.player = ts1.player
+on deck.round = ts1.round
and deck.card1 = ts1.card
left join top_scores ts2
-on deck.player = ts2.player
+on deck.round = ts2.round
and deck.card2 = ts2.card
left join top_scores ts3
-on deck.player = ts3.player
+on deck.round = ts3.round
and deck.card3 = ts3.card
group by 1,2 order by 1 desc, prelim_group,2)