Sort fics properly

This commit is contained in:
trémeur 2023-11-20 21:26:41 +00:00
parent d1003797f2
commit 663cac35b9
5 changed files with 59 additions and 12 deletions

View file

@ -70,7 +70,7 @@ def eventlist(local=False):
if revealed == True:
try:
if fileread.eventname == theevent:
evententries.append({"ficno":ficcount,"year":(fileread.datewords[0])["date"].year,"fandom":fileread.fandom})
evententries.append({"ficno":ficcount,"year":(fileread.datewords[0])["date"].year,"fandom":fileread.fandom,"update":(fileread.datewords[-1])["date"]})
except:
pass
eventfandoms = []
@ -102,13 +102,17 @@ def eventlist(local=False):
yearlist = []
for entry in evententries:
if int(entry["year"]) == startyear:
yearlist.append(entry["ficno"])
ficdict = {"thefic":entry["ficno"],"thedate":entry["update"]}
yearlist.append(ficdict)
if len(yearlist) > 0:
yearlist = sorted(yearlist)
yearlist = sorted(yearlist,key=lambda d: d["thedate"])
newyear = []
for fic in yearlist:
newyear.append(fic["thefic"])
filewrite = open(output, "a")
filewrite.write("<h1>" + str(startyear) + "</h1>\n")
filewrite.close()
for fic in yearlist:
for fic in newyear:
makeheader.ficgen(fic,False,output,local)
filewrite = open(output, "a")
filewrite.write("</details>\n")