rename var
This commit is contained in:
parent
679d1429f3
commit
ab098dda0d
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue