truncate changelog respects action now

This commit is contained in:
iou1name 2019-06-15 12:44:58 -04:00
parent 5602893670
commit e3df6b4276

View File

@ -6,6 +6,7 @@ import os
import re
import sqlite3
from datetime import datetime
from collections import defaultdict
import bs4
import requests
@ -226,11 +227,16 @@ def generate_summary():
change_log = ""
for date, items in changes.items():
change_log += f"<i>{date}</i><ul>"
if len(items) > 10:
change_log += f"<li>{len(items)} mods added</li>"
else:
for item in items:
change_log += f"<li>{item}</li>"
items_sorted = defaultdict(list)
for item in items:
action, _, message = item.partition(' ')
items_sorted[action].append(message)
for action, messages in items_sorted.items():
if len(messages) > 10:
change_log += f"<li>{len(messages)} mods {action.lower()}</li>"
else:
for message in messages:
change_log += f"<li>{action} {message}</li>"
change_log += "</ul>"
mod_table = ""