Skip to content

Commit

Permalink
Append data to patched_figure_ids
Browse files Browse the repository at this point in the history
- Additionally log bulk update summary
  • Loading branch information
tnagorra committed Jun 5, 2024
1 parent 1ffec47 commit 48d2693
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions apps/entry/management/commands/fix_ahhs_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
from apps.entry.models import Figure
from utils.common import round_half_up

logger = logging.getLogger(__name__)


class Command(BaseCommand):

help = "Patch AHHS household size data."
Expand Down Expand Up @@ -60,7 +57,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}"))
Expand All @@ -72,9 +70,9 @@ def patch_figure_household_from_csv(self, file_path):
self.stdout.write(self.style.ERROR(f"Change in reported value figure ids: {change_in_reported_value_figures}"))

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"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}")

@transaction.atomic()
Expand Down

0 comments on commit 48d2693

Please sign in to comment.