11
11
ReportJIraQARequestsNewIssueType
12
12
)
13
13
from utils .datetime_utils import DatetimeUtils as dt
14
- from utils .constants import FILTER_ID_ALL_REQUESTS_2022 , MAX_RESULT
14
+ from utils .constants import FILTER_ID_ALL_REQUESTS_2022 , FILTER_ID_NEW_ISSUE_TYPES , MAX_RESULT # noqa
15
+ from utils .constants import JQL_QUERY , STORY_POINTS , FIREFOX_RELEASE_TRAIN , ENGINEERING_TEAM , DEFAULT_COLUMNS , COLUMNS_ISSUE_TYPE , TESTED_TRAINS # noqa
15
16
from utils .constants import FILTER_ID_QA_NEEDED_iOS
16
17
17
- # JQL query All QA Requests since 2022 filter_id: 13856
18
- # Extra fields needed
19
- STORY_POINTS = "customfield_10037"
20
- FIREFOX_RELEASE_TRAIN = "customfield_10155"
21
- ENGINEERING_TEAM = "customfield_10134"
22
- DEFAULT_COLUMNS = "id,key,status,created,summary,labels,assignee"
23
- DEFAULT_COLUMNS_ISSUE_TYPE = "id,key,status,created,summary,labels,assignee,issuetype,parent"
24
- TESTED_TRAINS = "customfield_11930"
25
-
26
- NEW_FILTER_ID = "14266"
27
-
28
- JQL_QUERY = 'jql=filter='
29
-
30
18
31
19
class Jira :
32
20
@@ -36,7 +24,6 @@ def __init__(self):
36
24
self .client = JiraAPIClient (JIRA_HOST )
37
25
self .client .user = os .environ ['JIRA_USER' ]
38
26
self .client .password = os .environ ['JIRA_PASSWORD' ]
39
-
40
27
except KeyError :
41
28
print ("ERROR: Missing jira env var" )
42
29
sys .exit (1 )
@@ -51,8 +38,9 @@ def filters(self):
51
38
return self .client .get_search (query )
52
39
53
40
def filters_new_issue_type (self ):
54
- query = JQL_QUERY + NEW_FILTER_ID + '&fields=' \
55
- + DEFAULT_COLUMNS_ISSUE_TYPE + ',' + STORY_POINTS + ',' \
41
+ query = JQL_QUERY + FILTER_ID_NEW_ISSUE_TYPES + '&fields=' \
42
+ + DEFAULT_COLUMNS + COLUMNS_ISSUE_TYPE + ',' \
43
+ + STORY_POINTS + ',' \
56
44
+ FIREFOX_RELEASE_TRAIN + ',' + TESTED_TRAINS + ',' \
57
45
+ ENGINEERING_TEAM + '&' + MAX_RESULT
58
46
@@ -87,7 +75,7 @@ def jira_qa_requests_new_issue_types(self):
87
75
88
76
self .db .qa_requests_delete ()
89
77
90
- data_frame = self .db .report_jira_qa_requests__new_issue_types_payload (payload )
78
+ data_frame = self .db .report_jira_qa_requests__new_issue_types_payload (payload ) # noqa
91
79
print (data_frame )
92
80
93
81
self .db .report_jira_qa_requests_insert_new_issue_types (data_frame )
@@ -159,6 +147,7 @@ def report_jira_qa_requests_payload(self, payload):
159
147
160
148
def report_jira_qa_requests__new_issue_types_payload (self , payload ):
161
149
# Normalize the JSON data
150
+ self .session .query (ReportJIraQARequestsNewIssueType ).delete ()
162
151
df = pd .json_normalize (payload , sep = '_' )
163
152
164
153
# Check if 'jira_assignee_username' exists
@@ -184,7 +173,7 @@ def report_jira_qa_requests__new_issue_types_payload(self, payload):
184
173
'fields_assignee_emailAddress' : 'jira_assignee_username' ,
185
174
'fields_labels' : 'jira_labels' ,
186
175
'fields_customfield_11930' : 'jira_tested_train' ,
187
- 'fields_issuetype_name' :'jira_issue_type' ,
176
+ 'fields_issuetype_name' : 'jira_issue_type' ,
188
177
'fields_parent_key' : 'jira_parent_link'
189
178
}
190
179
@@ -230,18 +219,17 @@ def report_jira_qa_requests_insert_new_issue_types(self, payload):
230
219
for index , row in payload .iterrows ():
231
220
print (row )
232
221
report = ReportJIraQARequestsNewIssueType (jira_key = row ['jira_key' ],
233
- jira_created_at = row ['jira_created_at' ].date (), # noqa
234
- jira_summary = row ['jira_summary' ], # noqa
235
- jira_firefox_release_train = row ['jira_firefox_release_train' ], # noqa
236
- jira_engineering_team = row ['jira_engineering_team' ], # noqa
237
- jira_story_points = row ['jira_story_points' ], # noqa
238
- jira_status = row ['jira_status' ], # noqa
239
- jira_assignee_username = row ['jira_assignee_username' ], # noqa
240
- jira_labels = row ['jira_labels' ],
241
- jira_tested_train = row ['jira_tested_train' ],
242
- jira_issue_type = row ['jira_issue_type' ],
243
- jira_parent_link = row ['jira_parent_link' ]
244
- )
222
+ jira_created_at = row ['jira_created_at' ].date (), # noqa
223
+ jira_summary = row ['jira_summary' ], # noqa
224
+ jira_firefox_release_train = row ['jira_firefox_release_train' ], # noqa
225
+ jira_engineering_team = row ['jira_engineering_team' ], # noqa
226
+ jira_story_points = row ['jira_story_points' ], # noqa
227
+ jira_status = row ['jira_status' ], # noqa
228
+ jira_assignee_username = row ['jira_assignee_username' ], # noqa
229
+ jira_labels = row ['jira_labels' ], # noqa
230
+ jira_tested_train = row ['jira_tested_train' ], # noqa
231
+ jira_issue_type = row ['jira_issue_type' ], # noqa
232
+ jira_parent_link = row ['jira_parent_link' ]) # noqa
245
233
self .session .add (report )
246
234
self .session .commit ()
247
235
0 commit comments