@@ -329,7 +329,10 @@ def generate_markdown(
329
329
report .append ('' )
330
330
else :
331
331
report .append ('No saved files' )
332
- report .append ('' )
332
+
333
+ if priority <= priority_filter :
334
+ report .append ('' )
335
+
333
336
except TypeError as exception :
334
337
log .warning (f'Error formatting the Markdown report: { exception !s} ' )
335
338
@@ -347,27 +350,9 @@ def __init__(self, request_data: dict):
347
350
348
351
sorted_tasks = sorted (
349
352
request_data .get ('tasks' ), key = lambda x :
350
- (x ['report_priority' ], x ['name' ]))
353
+ (x ['report_priority' ] if x [ 'report_priority' ] else 0 , x ['name' ]))
351
354
352
- tasks = [TaskMarkdownReport (task ) for task in sorted_tasks ]
353
- task_counter = defaultdict (int )
354
- unique_tasks = []
355
- filtered_tasks = []
356
-
357
- # Get unique tasks and task counts
358
- for task in tasks :
359
- task_counter [task ] += 1
360
- if task not in unique_tasks :
361
- unique_tasks .append (task )
362
-
363
- # Generate task list with counts
364
- for task in unique_tasks :
365
- if task_counter [task ] > 1 :
366
- filtered_tasks .append (f'{ task } ({ task_counter [task ]} x)' )
367
- else :
368
- filtered_tasks .append (task )
369
-
370
- self .add_components (filtered_tasks )
355
+ self .add_components ([TaskMarkdownReport (task ) for task in sorted_tasks ])
371
356
372
357
def add (self , component : MarkdownReportComponent ) -> None :
373
358
if component :
@@ -419,10 +404,21 @@ def generate_markdown(self, priority_filter=None, show_all=False) -> str:
419
404
except TypeError as exception :
420
405
log .warning (f'Error formatting the Markdown report: { exception !s} ' )
421
406
407
+ task_counter = defaultdict (int )
408
+ unique_tasks = []
422
409
for task in self .components :
423
- report .append (
424
- task .generate_markdown (
425
- priority_filter = priority_filter , show_all = show_all , compact = True ))
410
+ markdown = task .generate_markdown (
411
+ priority_filter = priority_filter , show_all = show_all , compact = True )
412
+ task_counter [markdown ] += 1
413
+ if markdown not in unique_tasks :
414
+ unique_tasks .append (markdown )
415
+
416
+ # Generate task list with counts
417
+ for task in unique_tasks :
418
+ if task_counter [task ] > 1 :
419
+ report .append (f'{ task } ({ task_counter [task ]} x)' )
420
+ else :
421
+ report .append (task )
426
422
427
423
self .report = '\n ' .join (report )
428
424
return self .report
0 commit comments