-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMVPCount.py
37 lines (30 loc) · 1005 Bytes
/
MVPCount.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import requests
import re
def fetch(url):
response = requests.get(url)
return response
def updateMemberMVPCount(team, found):
if not found in team:
team[found] = 0
for name in team.keys():
if name.lower() in found.lower():
team[name] += 1
def printMVPList():
URL = 'https://{gitlab url}/api/v4/groups/486/milestones?private_token={token}'
beginningMilestoneId = 0
team = {}
# fetch milestone data
milestones = fetch(URL).json()
for milestone in milestones:
# count only after beginningMilstoneId
if milestone['iid'] < beginningMilstoneId:
continue
# fromat: Sprint MVP - Zam
match = re.search(r'Sprint MVP - (\w*)', str(milestone['description']))
if bool(match):
foundMember = match.group(1)
updateMemberMVPCount(team, foundMember)
print(milestone['title'] + ': ' + foundMember)
# show team member MVP count
print(team)
printMVPList()