From e821e0cc3d9cf562f7708d72db96e7967856685b Mon Sep 17 00:00:00 2001 From: cdolfi Date: Tue, 2 Apr 2024 19:11:29 -0400 Subject: [PATCH] heatmap x axis time fix --- 8Knot/pages/codebase/visualizations/cntrb_file_heatmap.py | 8 +++++--- .../codebase/visualizations/reviewer_file_heatmap.py | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/8Knot/pages/codebase/visualizations/cntrb_file_heatmap.py b/8Knot/pages/codebase/visualizations/cntrb_file_heatmap.py index 87c90842..081f335e 100644 --- a/8Knot/pages/codebase/visualizations/cntrb_file_heatmap.py +++ b/8Knot/pages/codebase/visualizations/cntrb_file_heatmap.py @@ -80,6 +80,7 @@ classNames={"values": "dmc-multiselect-custom"}, searchable=True, clearable=False, + value="Top Level Directory", ), ], className="me-2", @@ -215,7 +216,7 @@ def directory_dropdown(repo_id): # add top level directory to the list of directories directories.insert(0, "Top Level Directory") - logging.warning(f"DIRECTORY DROPDOWN - FINISHED") + logging.warning(f"CNTRB DIRECTORY DROPDOWN - FINISHED") return directories, "Top Level Directory" @@ -533,8 +534,9 @@ def file_cntrb_activity_by_month(df_dynamic_directory: pd.DataFrame, df_actions: there will be a column for every month even if there is no "last contribution" date in it. This greatly improves the heatmap ploting""" - # dates based on action so it represents the length of the project - min_date = df_actions.created_at.min() + # dates based on action so it represents the length of the project, min based on PR + # open date to avoid committer inputted dates + min_date = df_actions[df_actions["Action"] == "PR Opened"].created_at.min() max_date = df_actions.created_at.max() dates = pd.date_range(start=min_date, end=max_date, freq="M", inclusive="both") df_fill = dates.to_frame(index=False, name="dates") diff --git a/8Knot/pages/codebase/visualizations/reviewer_file_heatmap.py b/8Knot/pages/codebase/visualizations/reviewer_file_heatmap.py index 003c9290..9020eba3 100644 --- a/8Knot/pages/codebase/visualizations/reviewer_file_heatmap.py +++ b/8Knot/pages/codebase/visualizations/reviewer_file_heatmap.py @@ -80,6 +80,7 @@ classNames={"values": "dmc-multiselect-custom"}, searchable=True, clearable=False, + value="Top Level Directory", ), ], className="me-2", @@ -215,7 +216,7 @@ def directory_dropdown(repo_id): # add top level directory to the list of directories directories.insert(0, "Top Level Directory") - logging.warning(f"DIRECTORY DROPDOWN - FINISHED") + logging.warning(f"REVIEWER DIRECTORY DROPDOWN - FINISHED") return directories, "Top Level Directory" @@ -532,8 +533,9 @@ def file_cntrb_activity_by_month(df_dynamic_directory: pd.DataFrame, df_actions: there will be a column for every month even if there is no "last contribution" date in it. This greatly improves the heatmap ploting""" - # dates based on action so it represents the length of the project - min_date = df_actions.created_at.min() + # dates based on action so it represents the length of the project, min based on PR + # open date to avoid committer inputted dates + min_date = df_actions[df_actions["Action"] == "PR Opened"].created_at.min() max_date = df_actions.created_at.max() dates = pd.date_range(start=min_date, end=max_date, freq="M", inclusive="both") df_fill = dates.to_frame(index=False, name="dates")