summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2017-04-14 02:06:15 +0200
committeremkael <emkael@tlen.pl>2017-04-14 02:06:15 +0200
commitbed78f3f27f66a0411b27b8989e8e7b6c2333eb9 (patch)
tree4ff47c96705a3d7a1be787c2f29fa0593337e520
parentda4e3a5b6670e5116c95d7c6db8d7155d66968e6 (diff)
Extended page subtitles, with ranking edition detailed titles
-rwxr-xr-xbin/build.sh2
l---------config/dates.json2
-rw-r--r--ranking.py11
-rw-r--r--templates/ranking.html4
4 files changed, 11 insertions, 8 deletions
diff --git a/bin/build.sh b/bin/build.sh
index 4cd0f90..14b4f98 100755
--- a/bin/build.sh
+++ b/bin/build.sh
@@ -9,7 +9,7 @@ cat config/dates.json |
xargs -n4 |
while read DATE URL INDEX NAME
do
- python ranking.py $DATE $PREV_DATE > $DIR/$URL
+ python ranking.py "$NAME" $INDEX $DATE $PREV_DATE > $DIR/$URL
PREV_DATE=$DATE
done
find $DIR -maxdepth 1 -type f -name \*.html |
diff --git a/config/dates.json b/config/dates.json
index f302866..4388d7d 120000
--- a/config/dates.json
+++ b/config/dates.json
@@ -1 +1 @@
-prod-dates.json \ No newline at end of file
+test-dates.json \ No newline at end of file
diff --git a/ranking.py b/ranking.py
index e74864e..3382d8d 100644
--- a/ranking.py
+++ b/ranking.py
@@ -3,9 +3,12 @@ from bs4 import BeautifulSoup as bs4
from pyranking.fetch import fetch_ranking
-ranking_date = sys.argv[1]
+ranking_date = sys.argv[3]
+subtitle = 'notowanie %s (%s), stan na %s' % (
+ sys.argv[1], sys.argv[2], '.'.join(ranking_date.split('-')[::-1])
+)
ranking = fetch_ranking(ranking_date)
-old_ranking = fetch_ranking(sys.argv[2], True) if len(sys.argv) > 2 else {}
+old_ranking = fetch_ranking(sys.argv[4], True) if len(sys.argv) > 4 else {}
for row in ranking:
if row['pid'] in old_ranking:
@@ -28,9 +31,7 @@ table = bs4(file('templates/ranking.html'), 'lxml')
table_body = table.select('tbody')[0]
table_row = table_body.select('tr')[0].extract()
-table.select('.page-header h1 small')[0].string = 'stan na %s' % (
- '.'.join(ranking_date.split('-')[::-1])
-)
+table.select('.page-header h2 small')[0].string = subtitle
for row in ranking:
new_row = copy.copy(table_row)
diff --git a/templates/ranking.html b/templates/ranking.html
index c630753..a9b77e1 100644
--- a/templates/ranking.html
+++ b/templates/ranking.html
@@ -10,8 +10,10 @@
<div class="page-header">
<h1>
Oficjalny Ranking Brydżowy PZBS
- <small></small>
</h1>
+ <h2>
+ <small></small>
+ </h2>
</div>
<div class="panel panel-default filters">
<div class="panel-heading" role="button" data-toggle="collapse" data-target="#filters" aria-expanded="false" aria-controls="filters">