From 522ec21009cfaeab43136ce6ab5eda35761de9f2 Mon Sep 17 00:00:00 2001 From: Tiago Ribeiro Date: Mon, 26 Aug 2024 12:58:37 +0200 Subject: [PATCH] Fixes to Report - I noticed that the report was not generating the activity report, this was due to the fact that there was an inner join based on the bookmarks reviewed. Now it should correctly display the total Bookmarks even if users do not review any of them. - Title ordering. --- tools/report_generator/generate_report.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tools/report_generator/generate_report.py b/tools/report_generator/generate_report.py index 55c256b5..c6ca126c 100644 --- a/tools/report_generator/generate_report.py +++ b/tools/report_generator/generate_report.py @@ -393,16 +393,17 @@ def generate_active_users_table(active_user_read_ex_pd, bookmark_pd): ] if len(bookmark_count) > 0: reading_time_ex_time = reading_time_ex_time.merge( - bookmark_review_proportion, on="Language", how="inner" + bookmark_review_proportion, on="Language", how="outer" ) - reading_time_ex_time = reading_time_ex_time.merge( - bookmark_count, on="Language", how="inner" + bookmark_count, on="Language", how="outer" ) + reading_time_ex_time.loc[reading_time_ex_time["Bookmarks % Reviewed"].isna(),"Bookmarks % Reviewed"] = 0 else: reading_time_ex_time["Bookmarks % Reviewed"] = 0 reading_time_ex_time["Total Bookmarks"] = 0 + return generate_html_table( reading_time_ex_time[ [ @@ -553,9 +554,9 @@ def generate_html_page():
""" else: result += f""" -

Top Articles Read:

{generate_active_users_table(combined_user_activity_df, bookmark_df)}
+

Top Articles Read:

{generate_top_opened_articles(user_reading_time_df, data_extractor, feed_df)}