@@ -78,10 +78,16 @@ def generate_bug_changes(self, startday, endday, alt_startday, alt_endday):
78
78
for bugs whose total number of daily or weekly occurrences meet
79
79
the appropriate threshold) and potentially an updated whiteboard
80
80
or priority status."""
81
+ days = [startday ]
82
+ if self .weekly_mode :
83
+ days = [
84
+ (datetime .strptime (startday , "%Y-%m-%d" ) + timedelta (days = i )).strftime ("%Y-%m-%d" )
85
+ for i in range (7 )
86
+ ]
81
87
82
88
bug_ids , bugs = self .get_bugs (startday , endday )
83
89
option_collection_map = OptionCollection .objects .get_option_collection_map ()
84
- bug_map = self .build_bug_map (bugs , option_collection_map , startday , endday )
90
+ bug_map = self .build_bug_map (bugs , option_collection_map , days )
85
91
86
92
alt_date_bug_totals = self .get_alt_date_bug_totals (alt_startday , alt_endday , bug_ids )
87
93
@@ -388,32 +394,26 @@ def get_bug_run_info(self, bug):
388
394
info .build_type = "unknown build"
389
395
return info
390
396
391
- def get_task_labels_and_count (self , manifest , start_day , end_day ):
397
+ def get_task_labels_and_count (self , manifest , days , job_name ):
392
398
tasks_and_count = {}
393
399
summary_groups = (
394
- fetch .fetch_summary_groups (start_day , end_day )
395
- if self .summary_groups is None
396
- else self .summary_groups
400
+ fetch .fetch_summary_groups (days ) if self .summary_groups is None else self .summary_groups
397
401
)
398
- days = [start_day ]
399
- if self .weekly_mode :
400
- for j in range (6 ):
401
- jj = datetime .strptime (days [- 1 ], "%Y-%m-%d" ) + timedelta (days = 1 )
402
- days .append (jj .strftime ("%Y-%m-%d" ))
403
402
for day in days :
404
403
if day not in summary_groups :
405
404
continue
406
405
all_task_labels = summary_groups [day ]["job_type_names" ]
407
406
for tasks_by_manifest in summary_groups [day ]["manifests" ]:
408
- for man , tasks in tasks_by_manifest . items () :
409
- if manifest == man :
410
- for task_index , _ , _ , count in tasks :
411
- task_label = all_task_labels [ task_index ]
407
+ if manifest in tasks_by_manifest :
408
+ for task_index , _ , _ , count in tasks_by_manifest [ manifest ] :
409
+ task_label = all_task_labels [ task_index ]
410
+ if task_label == job_name :
412
411
tasks_and_count .setdefault (task_label , 0 )
413
412
tasks_and_count [task_label ] += count
414
- return tasks_and_count
413
+ break
414
+ return tasks_and_count .get (job_name , 0 )
415
415
416
- def build_bug_map (self , bugs , option_collection_map , start_day , end_day ):
416
+ def build_bug_map (self , bugs , option_collection_map , days ):
417
417
"""Build bug_map
418
418
eg:
419
419
{
@@ -452,15 +452,10 @@ def build_bug_map(self, bugs, option_collection_map, start_day, end_day):
452
452
if test_name :
453
453
manifest = all_tests [test_name ][0 ]
454
454
if manifest :
455
- """
456
- # Bug 1972307 - disabled due to no comments
457
- tasks_count = self.get_task_labels_and_count(manifest, start_day, end_day)
458
455
job_name = bug ["job__signature__job_type_name" ]
459
- for task_name, count in tasks_count.items():
460
- if task_name == job_name or task_name == job_name.rsplit("-", 1)[0]:
461
- run_count = count
462
- break
463
- """
456
+ if len (job_name .rsplit ("-" , 1 )) == 2 and job_name .rsplit ("-" , 1 )[1 ].isdigit ():
457
+ job_name = job_name .rsplit ("-" , 1 )[0 ]
458
+ run_count = self .get_task_labels_and_count (manifest , days , job_name )
464
459
testrun_matrix = (
465
460
fetch .fetch_testrun_matrix ()
466
461
if self .testrun_matrix is None
0 commit comments