Skip to content

Commit a7fe426

Browse files
committed
add abstain vote, use checkmarks in table
1 parent 61a09c1 commit a7fe426

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

gitconsensus/repository.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ def __init__(self, repository, number):
8787

8888
self.yes = []
8989
self.no = []
90+
self.abstain = []
9091
self.users = []
9192
for reaction in reactions:
9293
content = reaction['content']
@@ -109,6 +110,8 @@ def __init__(self, repository, number):
109110
self.yes.append(user['login'])
110111
elif content == '-1':
111112
self.no.append(user['login'])
113+
elif content == 'confused':
114+
self.abstain.append(user['login'])
112115
else:
113116
continue
114117

@@ -178,18 +181,23 @@ def vote_merge(self):
178181
self.addComment(message)
179182

180183
def buildVoteTable(self):
181-
table = '| User | Yes | No |\n|--------|-----|----|'
184+
table = '| User | Yes | No | Abstain |\n|--------|-----|----|----|'
182185
for user in self.users:
183186
if user in self.yes:
184-
yes = 'Yes'
187+
yes = ''
185188
else:
186189
yes = ' '
187190
if user in self.no:
188-
no = 'No'
191+
no = ''
189192
else:
190193
no = ' '
194+
if user in self.abstain:
195+
abstain = '✔'
196+
else:
197+
abstain = ' '
198+
191199
user_label = '[%s](https://github.com/%s)' % (user, user)
192-
row = "| %s | %s | %s |" % (user_label, yes, no)
200+
row = "| %s | %s | %s | %s |" % (user_label, yes, no, abstain)
193201
table = "%s\n%s" % (table, row)
194202
return table
195203

0 commit comments

Comments
 (0)