set date in menus class
This commit is contained in:
parent
d968e89e07
commit
597b4c7f00
2 changed files with 6 additions and 6 deletions
4
menus.py
4
menus.py
|
@ -1,3 +1,4 @@
|
||||||
|
import datetime
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from jinja2 import Environment
|
from jinja2 import Environment
|
||||||
|
@ -38,6 +39,9 @@ class Menus:
|
||||||
self.month = cells[0]
|
self.month = cells[0]
|
||||||
self.days = cells[6:11]
|
self.days = cells[6:11]
|
||||||
|
|
||||||
|
def date(self):
|
||||||
|
return f"{self.days[0]} {self.month} {datetime.date.today().year}"
|
||||||
|
|
||||||
|
|
||||||
class Line:
|
class Line:
|
||||||
def __init__(self, text: str):
|
def __init__(self, text: str):
|
||||||
|
|
|
@ -20,14 +20,10 @@ class ResultFile:
|
||||||
if not self.path.exists():
|
if not self.path.exists():
|
||||||
return False
|
return False
|
||||||
content = self.path.read_text()
|
content = self.path.read_text()
|
||||||
return (
|
return f"{sha256} - {menus.date()}" in content
|
||||||
f"{sha256} - {menus.days[0]} - {menus.month} - {datetime.date.today().year}"
|
|
||||||
in content
|
|
||||||
)
|
|
||||||
|
|
||||||
def is_update(self, sha256: str, menus: Menus):
|
def is_update(self, sha256: str, menus: Menus):
|
||||||
if not self.path.exists():
|
if not self.path.exists():
|
||||||
return False
|
return False
|
||||||
content = self.path.read_text()
|
content = self.path.read_text()
|
||||||
date = f"{menus.days[0]} - {menus.month} - {datetime.date.today().year}"
|
return f"{sha256} - {menus.date()}" not in content and menus.date() in content
|
||||||
return f"{sha256} - {date}" not in content and date in content
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue