Store day of modification instead of 1 in data.js

This commit is contained in:
Benoit Marty 2024-04-12 12:02:58 +02:00 committed by Benoit Marty
parent 635843f860
commit 89aa137226
2 changed files with 48 additions and 9 deletions

View file

@ -132,7 +132,10 @@ def generateJavascriptFile():
simpleFile = file[:3] + "T" + file[4:-7] + l + file[-5:-4]
translatedFile = "./screenshots/" + l + "/" + simpleFile + ".png"
if os.path.exists(translatedFile):
dataForFile.append(1)
# Get the last modified date of the file in seconds and round to days
date = os.popen("git log -1 --format=%ct -- \"" + translatedFile + "\"").read().strip()
dateDay = int(date) // 86400
dataForFile.append(dateDay)
else:
dataForFile.append(0)
data.append(dataForFile)