set date in menus class

This commit is contained in:
Stanislas Jouffroy 2025-06-13 23:42:41 +02:00
parent d968e89e07
commit 597b4c7f00
2 changed files with 6 additions and 6 deletions

View file

@ -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):

View file

@ -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