GuglielmoTor commited on
Commit
3938a94
·
verified ·
1 Parent(s): 3c8e890

Update ui/okr_ui_generator.py

Browse files
Files changed (1) hide show
  1. ui/okr_ui_generator.py +17 -6
ui/okr_ui_generator.py CHANGED
@@ -456,20 +456,29 @@ def get_initial_okr_display() -> str:
456
  </div>
457
  """
458
 
459
- def format_okrs_for_enhanced_display(raw_results: dict) -> str:
460
  """
461
  Enhanced formatting function that creates beautiful HTML for OKR display
462
- from the raw results dictionary.
463
 
464
  Args:
465
- raw_results (dict): The dictionary containing the 'actionable_okrs' data.
466
- Expected structure: {'actionable_okrs': {'okrs': List[OKR_dict]}}
467
 
468
  Returns:
469
  str: A comprehensive HTML string representing the OKRs, or an empty state HTML.
470
  """
471
- if not raw_results or not raw_results.get("actionable_okrs"):
472
- logger.warning("No raw results or 'actionable_okrs' found for display.")
 
 
 
 
 
 
 
 
 
473
  return get_empty_okr_state()
474
 
475
  actionable_okrs = raw_results.get("actionable_okrs", {})
@@ -479,6 +488,8 @@ def format_okrs_for_enhanced_display(raw_results: dict) -> str:
479
  logger.info("No OKRs found in 'actionable_okrs' list.")
480
  return get_empty_okr_state()
481
 
 
 
482
  # Calculate statistics for the stats bar
483
  total_objectives = len(okrs_list)
484
  total_key_results = sum(len(okr.get('key_results', [])) for okr in okrs_list)
 
456
  </div>
457
  """
458
 
459
+ def format_okrs_for_enhanced_display(reconstruction_cache: dict) -> str:
460
  """
461
  Enhanced formatting function that creates beautiful HTML for OKR display
462
+ from the reconstruction cache dictionary.
463
 
464
  Args:
465
+ reconstruction_cache (dict): The reconstruction cache containing reconstructed data.
466
+ Expected to contain report data with 'actionable_okrs' key.
467
 
468
  Returns:
469
  str: A comprehensive HTML string representing the OKRs, or an empty state HTML.
470
  """
471
+ if not reconstruction_cache:
472
+ logger.warning("No reconstruction cache found for display.")
473
+ return get_empty_okr_state()
474
+
475
+ # Extract actionable_okrs from the first (and typically only) report in cache
476
+ for report_id, report_data in reconstruction_cache.items():
477
+ if isinstance(report_data, dict) and 'actionable_okrs' in report_data:
478
+ raw_results = {'actionable_okrs': report_data['actionable_okrs']}
479
+ break
480
+ else:
481
+ logger.warning("No 'actionable_okrs' found in reconstruction cache for display.")
482
  return get_empty_okr_state()
483
 
484
  actionable_okrs = raw_results.get("actionable_okrs", {})
 
488
  logger.info("No OKRs found in 'actionable_okrs' list.")
489
  return get_empty_okr_state()
490
 
491
+ # Rest of the function remains the same...
492
+
493
  # Calculate statistics for the stats bar
494
  total_objectives = len(okrs_list)
495
  total_key_results = sum(len(okr.get('key_results', [])) for okr in okrs_list)