Skip to content

Commit 23bb61a

Browse files
authored
Jun, 5 Update (#39)
1 parent 73709ce commit 23bb61a

File tree

4 files changed

+13
-7
lines changed

4 files changed

+13
-7
lines changed

assets/templates/static_page.jinja2

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
{% endfor %}
6666
<div id="default-container" class="container" style="display: none;">
6767
<div class="metadata">
68-
<div class="metadata-item">המשחק ⚽ הבא: {{ games['game_1'][0] | babel_format_full_heb }}</div>
68+
<div class="metadata-item">המשחק ⚽ הבא: {{ games.get('game_1', ['אין משחקים קרבים'])[0] | babel_format_full_heb }}</div>
6969
<div class="metadata-item"><img src="assets/images/qrcode.png" alt="QR Code" style="max-width: 100px; margin-top: 1rem;"></div>
7070
{{ notification_channel() | indent(6) }}
7171
</div>

cron.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,12 @@ def random_choice(rand):
3737
def check_games_today(games):
3838
# Set today to datetime.date(YEAR, M, D) when debugging specific date
3939
today = datetime.date.today()
40-
for _, value in games.items():
41-
if today == value[0].date():
42-
logger.info("Yesh mishak!")
43-
yield value
40+
41+
if not isinstance(games, str):
42+
for _, value in games.items():
43+
if today == value[0].date():
44+
logger.info("Yesh mishak!")
45+
yield value
4446

4547
return False
4648

jinja_filters.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,7 @@ def babel_format_day_heb(s):
66

77

88
def babel_format_full_heb(s):
9-
return format_date(s, format="full", locale="he")
9+
try:
10+
return format_date(s, format="full", locale="he")
11+
except Exception:
12+
return s

web_scrape.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def scrape(self):
6060
games_list.append(text)
6161

6262
if len(games_list) < 2:
63-
msg = f"List returned empty, no games today? Scrape result: {result}"
63+
msg = f"List returned empty, no games today?"
6464
logger.warning(msg)
6565
return f"<pre>{msg}</pre>"
6666

@@ -73,6 +73,7 @@ def scrape(self):
7373

7474
def decoratored_games(self, scraped):
7575
if isinstance(scraped, str):
76+
gen_static_page({})
7677
return scraped
7778

7879
deco_games = {}

0 commit comments

Comments
 (0)