From 597b4c7f004d3a6a29461a0c36183f1d5098f7c1 Mon Sep 17 00:00:00 2001 From: stanislas Date: Fri, 13 Jun 2025 23:42:41 +0200 Subject: [PATCH] set date in menus class --- menus.py | 4 ++++ result_file.py | 8 ++------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/menus.py b/menus.py index 2c8461d..0a602bb 100644 --- a/menus.py +++ b/menus.py @@ -1,3 +1,4 @@ +import datetime from pathlib import Path from jinja2 import Environment @@ -38,6 +39,9 @@ class Menus: self.month = cells[0] self.days = cells[6:11] + def date(self): + return f"{self.days[0]} {self.month} {datetime.date.today().year}" + class Line: def __init__(self, text: str): diff --git a/result_file.py b/result_file.py index c4ca839..1c8fd6f 100644 --- a/result_file.py +++ b/result_file.py @@ -20,14 +20,10 @@ class ResultFile: if not self.path.exists(): return False content = self.path.read_text() - return ( - f"{sha256} - {menus.days[0]} - {menus.month} - {datetime.date.today().year}" - in content - ) + return f"{sha256} - {menus.date()}" in content def is_update(self, sha256: str, menus: Menus): if not self.path.exists(): return False content = self.path.read_text() - date = f"{menus.days[0]} - {menus.month} - {datetime.date.today().year}" - return f"{sha256} - {date}" not in content and date in content + return f"{sha256} - {menus.date()}" not in content and menus.date() in content