use correct number of total commits for large pushes

This commit is contained in:
Lephenixnoir 2024-03-18 22:56:54 +01:00
parent 6ff873fb9f
commit bc9b9a5829
Signed by: Lephenixnoir
GPG Key ID: 1BBA026E13FC0495
1 changed files with 5 additions and 4 deletions

9
app.py
View File

@ -41,15 +41,16 @@ def main():
pr_url = None
commits = data["commits"]
commit_count = f"{len(commits)} commit{'s' if len(commits) > 1 else ''}"
total_commits = data.get("total_commits", len(commits))
commit_count = f"{total_commits} commit{'s' if total_commits > 1 else ''}"
message = "[inlinecode]" + commits[0]["message"].split('\n',1)[0] + "[/inlinecode]"
if len(commits) <= 1:
if total_commits <= 1:
others = ""
elif len(commits) == 2:
elif total_commits == 2:
others = " (et 1 autre commit)"
else:
others = f" (et {len(commits)-1} autres commits)"
others = f" (et {total_commits-1} autres commits)"
url_user = make_url_user(data['pusher'])