From cd88c9c49667702da1a6e55ee3b5c68714d928f4 Mon Sep 17 00:00:00 2001 From: tnagorra Date: Tue, 4 Jun 2024 21:51:14 +0545 Subject: [PATCH] Append data to patched_figure_ids - Additionally log bulk update summary --- apps/entry/management/commands/fix_ahhs_data.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/entry/management/commands/fix_ahhs_data.py b/apps/entry/management/commands/fix_ahhs_data.py index 58f0af5c2..77b116ada 100644 --- a/apps/entry/management/commands/fix_ahhs_data.py +++ b/apps/entry/management/commands/fix_ahhs_data.py @@ -60,7 +60,8 @@ def patch_figure_household_from_csv(self, file_path): ), ), ) - bulk_mgr.done() + patched_figure_ids.append(row['figure_id']) + bulk_mgr.done() if figure_id_not_found: self.stdout.write(self.style.ERROR(f"Figure id not found ids: {figure_id_not_found}")) @@ -74,8 +75,9 @@ def patch_figure_household_from_csv(self, file_path): if no_change_in_household_figures: logger.info(f"No change in household size figure ids: {no_change_in_household_figures}") - self.stdout.write(f"Total number of figures patched: {len(patched_figure_ids)}") + self.stdout.write(self.style.SUCCESS(f'Bulk update summary: {bulk_mgr.summary()}')) self.stdout.write(f"IDs of figures patched: {patched_figure_ids}") + raise "hehe" @transaction.atomic() def handle(self, *args, **kwargs):