-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathissues.py
52 lines (40 loc) · 1.3 KB
/
issues.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# -*- coding: utf8 -*-
class BlankFinder:
def get_issues(self, number):
issues = []
for i in range(number):
issues.append(self.BlankIssue())
return issues
class BlankIssue:
raw = {}
class BoardFinder:
def __init__(self, jira):
self.jira = jira
self.boards = {}
for board in self.jira.boards():
name = board.name
id = board.id
self.boards[name] = id
def get_board_names(self):
return self.boards.keys()
def get_open_sprint(self, board_name):
board_id = self.boards[board_name]
sprint_id = None
for sprint in self.jira.sprints(board_id):
if not sprint.closed:
sprint_id = sprint.id
if sprint_id is None:
print('No open sprint for board ' + board_name)
exit(1)
return self.jira.search_issues('Sprint = ' + str(sprint_id) + ' AND Sprint not in closedSprints()')
class IssueFinder:
def __init__(self, jira):
self.jira = jira
def get_issues(self, issue_ids):
issues = []
for issue_id in issue_ids:
try:
issues.append(self.jira.issue(issue_id))
except:
print('Issue ' + issue_id + ' not found')
return issues