Skip to content

Commit 1915095

Browse files
committed
improve issue body
1 parent 6916e38 commit 1915095

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

scripts/create_issue.py

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@
1414
from potodo.potodo import PoFileStats
1515

1616
PYTHON_VERSION = "3.13"
17-
ISSUE_LABELS = [PYTHON_VERSION, "good first issue"]
17+
PENDING_ENTRIES_FOR_GOOD_FIRST_ISSUE = 5
18+
GOOD_FIRST_ISSUE_LABEL = "good first_issue"
19+
ISSUE_LABELS = [PYTHON_VERSION]
1820
ISSUE_TITLE = 'Translate `{pofilename}`'
1921
ISSUE_BODY = '''This needs to reach 100% translated.
2022
@@ -23,10 +25,10 @@
2325
2426
Current stats for `{pofilename}`:
2527
26-
- Fuzzy: {pofile_fuzzy}
27-
- Percent translated: {pofile_percent_translated}%
28-
- Entries: {pofile_entries}
29-
- Untranslated: {pofile_untranslated}
28+
- Total entries: {pofile_entries}
29+
- Entries that need work: {pending_entries} - ({pofile_percent_translated}%)
30+
- Fuzzy: {pofile_fuzzy}
31+
- Untranslated: {pofile_untranslated}
3032
3133
Please, comment here if you want this file to be assigned to you and a member will assign it to you as soon as possible, so you can start working on it.
3234
@@ -79,6 +81,13 @@ def issue_generator(self, pofilename):
7981
self.check_issue_not_already_existing(pofilename)
8082
self.check_translation_is_pending(pofile)
8183

84+
pending_entries = pofile.fuzzy + pofile.untranslated
85+
86+
if pending_entries <= PENDING_ENTRIES_FOR_GOOD_FIRST_ISSUE:
87+
labels = ISSUE_LABELS + [GOOD_FIRST_ISSUE_LABEL]
88+
else:
89+
labels = ISSUE_LABELS
90+
8291
urlfile = pofilename.replace('.po', '.html')
8392
title = ISSUE_TITLE.format(pofilename=pofilename)
8493
body = ISSUE_BODY.format(
@@ -89,9 +98,10 @@ def issue_generator(self, pofilename):
8998
pofile_percent_translated=pofile.percent_translated,
9099
pofile_entries=pofile.entries,
91100
pofile_untranslated=pofile.untranslated,
101+
pending_entries=pending_entries,
92102
)
93103
# https://pygithub.readthedocs.io/en/latest/github_objects/Repository.html#github.Repository.Repository.create_issue
94-
issue = self.repo.create_issue(title=title, body=body, labels=ISSUE_LABELS)
104+
issue = self.repo.create_issue(title=title, body=body, labels=labels)
95105

96106
return issue
97107

0 commit comments

Comments
 (0)