-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdata.py
71 lines (52 loc) · 2.09 KB
/
data.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
from jira import JIRA
jira = JIRA(basic_auth=('<Username>', '<Password>'), options={'server': '<Jira Server Link>'})
# Expand fields to get the required data
metas = jira.createmeta(projectKeys='<Jira Project Key>', expand='projects.issuetypes.fields')
# ---------------------- Print Reported Types -------------------------
RT_values = []
RT_cert_values = metas['projects'][0]['issuetypes'][0]['fields']['customfield_10230']['allowedValues']
RT_valuesDic = []
for i in range(len(RT_cert_values)):
RT_values.append(RT_cert_values[i]['value'])
for index, value in enumerate(RT_values):
ds = {'title': RT_values[index], 'value': RT_values[index]}
RT_valuesDic.append(ds)
# ---------------------- Print Request Types ------------------------
ReqT_values = []
ReqT_cert_values = metas['projects'][0]['issuetypes'][0]['fields']['customfield_20801']['allowedValues']
ReqT_valuesDic = []
for i in range(len(ReqT_cert_values)):
ReqT_values.append(ReqT_cert_values[i]['value'])
for index, value in enumerate(ReqT_values):
ds = {'title': ReqT_values[index], 'value': ReqT_values[index]}
ReqT_valuesDic.append(ds)
# -------------------Sub Categories of Request Types--------------------
ReqT_values_2 = []
ReqT_values_Dict_2 = []
for i in range(len(ReqT_cert_values)):
try:
for q in range(len(ReqT_cert_values[i]['children'])):
ReqT_values_2.append(ReqT_cert_values[i]['children'][q]['value'].strip())
except:
ReqT_values_2.append("NA")
for index, value in enumerate(ReqT_values_2):
RT = {'title': ReqT_values_2[index], 'value': ReqT_values_2[index]}
ReqT_values_Dict_2.append(RT)
print("-------------------------------------")
J = []
for i in range(len(ReqT_cert_values)):
try:
J.append(len(ReqT_cert_values[i]['children']))
except:
J.append(1)
fin_val = []
a = 0
y = 0
for k in J:
fin_val.append(ReqT_values_Dict_2[y:k+a])
y = k + a
a = k + a
benifit_array = []
for i in range(len(ReqT_cert_values)):
benifit_array.append(ReqT_cert_values[i]['value'])
Fin_req_types = dict(zip(benifit_array, fin_val))