commit pluralization and new issues

* "1 autres commits" -> "1 autre commit"
* "<opened> un ticket" -> "créé un ticket"
This commit is contained in:
Lephenixnoir 2020-10-21 17:42:30 +02:00
parent 7ec136ab4a
commit 9561a01b61
Signed by: Lephenixnoir
GPG Key ID: 1BBA026E13FC0495
1 changed files with 8 additions and 2 deletions

10
app.py
View File

@ -24,7 +24,13 @@ def main():
commits = data["commits"]
commit_count = f"{len(commits)} commit{'s' if len(commits) > 1 else ''}"
message = "[inlinecode]" + commits[0]["message"].split('\n',1)[0] + "[/inlinecode]"
others = f" (et {len(commits)-1} autres commits)" if len(commits) > 1 else ""
if len(commits) <= 1:
others = ""
elif len(commits) == 2:
others = " (et 1 autre commit)"
else:
others = f" (et {len(commits)-1} autres commits)"
url_user = make_url_user(data['pusher'])
url_commits = f"[url={data['compare_url']}]{commit_count}[/url]"
@ -48,7 +54,7 @@ def main():
if data['action'] == "closed":
msg = f"{url_user} a fermé le ticket {url_issue} dans {url_repository}"
elif data['action'] == "created":
elif data['action'] in ["created", "opened"]:
msg = f"{url_user} a créé un ticket {url_issue} dans {url_repository}"
else:
msg = f"{url_user} a <{data['action']}> le ticket {url_issue} dans {url_repository}"