Skip to content
This repository has been archived by the owner on Feb 16, 2023. It is now read-only.

Commit

Permalink
Now sorting posts and subscribers by date
Browse files Browse the repository at this point in the history
  • Loading branch information
berrysauce committed Jul 10, 2021
1 parent 79acd1b commit 74724ef
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tools/htmlgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ def postcode():
if len(entries) == 0:
posts_html = """<p>You have no posts</p>"""
else:
entries.sort(key = lambda x:x["date"])
entries = entries[::-1]
posts_html = """"""
with open("templates/elements/post_card.html", "r") as f:
posts_html_template = jinja2.Template(f.read())
Expand All @@ -35,6 +37,10 @@ def subscribertable():
monthly_subscribers = 0
table_html = """"""

if len(entries) != 0:
entries.sort(key = lambda x:x["subscribed_on"])
entries = entries[::-1]

for entry in entries:
if month in entry["subscribed_on"]:
monthly_subscribers += 1
Expand Down

0 comments on commit 74724ef

Please sign in to comment.