From d911ddbd77ffb1dcc618571736e87a6aa088abf9 Mon Sep 17 00:00:00 2001 From: Lukas Trippe Date: Tue, 10 Sep 2024 11:51:41 +0200 Subject: [PATCH] fix: better ariadne text (#19) --- scripts/draft_comment.py | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/scripts/draft_comment.py b/scripts/draft_comment.py index f32fdc36..bfa76be0 100644 --- a/scripts/draft_comment.py +++ b/scripts/draft_comment.py @@ -474,11 +474,29 @@ def create_details_block(summary: str, content: str) -> str: else: return "" + if self.variables_comparison and self.changed_variables_plots: + if self.variables_deviation_df.empty: + variables_txt = ( + "**Ariadne Variables**\n" + "No significant changes in variables detected. :white_check_mark:" + ) + else: + variables_txt = ( + f"**Ariadne Variables**\n" + f"{create_details_block('Comparison', self.variables_comparison)}" + f"{create_details_block('Plots', self.changed_variables_plots)}" + ) + elif self.variables_comparison or self.changed_variables_plots: + raise ValueError( + "Both variables_comparison and changed_variables_plots must be set or unset." + ) + else: + variables_txt = "" return ( - f"{create_details_block('Variables comparison', self.variables_comparison)}" - f"{create_details_block('Variables changed plots', self.changed_variables_plots)}" - f"{create_details_block('General Plots comparison', self.plots_table)}" - f"{create_details_block('General Files comparison', self.files_table)}" + f"{variables_txt}" + f"**General**\n" + f"{create_details_block('Plots comparison', self.plots_table)}" + f"{create_details_block('Files comparison', self.files_table)}" ) def __call__(self) -> str: