From 0599b03daa356bfb42150b69597a9110d4e694b7 Mon Sep 17 00:00:00 2001 From: Felix Stupp Date: Sat, 5 Nov 2022 22:52:38 +0100 Subject: [PATCH] generate_preference_list: Separate sections of god method --- server/entertainment_decider/models.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/server/entertainment_decider/models.py b/server/entertainment_decider/models.py index 8afe0d0..39a4e65 100644 --- a/server/entertainment_decider/models.py +++ b/server/entertainment_decider/models.py @@ -397,6 +397,8 @@ def generate_preference_list( ) -> List[MediaElement]: res_ids = list[int]() element_list = object_gen() + + # add tags corresponding to collections collections: Iterable[MediaCollection] = MediaCollection.select() for coll in collections: coll.tag_list.add( @@ -405,7 +407,11 @@ def generate_preference_list( use_for_preferences=True, ) ) + + # flush after custom tags orm.flush() + + # gen elements while True: if len(element_list) <= 0: break