From ab098dda0d4e836850c0e8639707d3a106d63126 Mon Sep 17 00:00:00 2001 From: Sarah Date: Sun, 20 Feb 2022 21:36:53 +0000 Subject: [PATCH] rename var --- vcinema_utils/VCinemaUtils.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/vcinema_utils/VCinemaUtils.py b/vcinema_utils/VCinemaUtils.py index 9de968b..523eb57 100644 --- a/vcinema_utils/VCinemaUtils.py +++ b/vcinema_utils/VCinemaUtils.py @@ -36,15 +36,15 @@ def add_imdb_data_to_viewings(viewings, field_name): bar.finish() -def filter_viewings(viewings, pivot_field, remove_duplicates=True): +def filter_viewings(viewings, filter_field, remove_duplicates=True): viewings_filtered = {} for viewing in viewings: - viewing_field = viewing[pivot_field] + viewing_field = viewing[filter_field] if viewing_field in viewings_filtered.keys(): - if not remove_duplicates or (remove_duplicates and not any(x['imdb_id'] == viewing['imdb_id'] for x in viewings_filtered[viewing_field])): + if not remove_duplicates or not any(x['imdb_id'] == viewing['imdb_id'] for x in viewings_filtered[viewing_field]): viewings_filtered[viewing_field] += [viewing] else: - viewings_filtered[viewing[pivot_field]] = [viewing] + viewings_filtered[viewing[filter_field]] = [viewing] return viewings_filtered