diff --git a/recommendation_engine.py b/recommendation_engine.py index 64d7fe5..28bd228 100644 --- a/recommendation_engine.py +++ b/recommendation_engine.py @@ -62,8 +62,10 @@ class Engine: self.state['userKeywordsWeights'] = { 'themeTags': {'locked': False, 'value': 0.3}, 'characterTags': {'locked': False, 'value': 0.7}, - 'random' : {'locked': False, 'value': True} + 'random': {'locked': False, 'value': False} } + if 'random' not in self.state['userKeywordsWeights']: + self.state['userKeywordsWeights']['random'] = {'locked': False, 'value': False} self.update_keywords() @property @@ -263,7 +265,7 @@ class Engine: playlists.remove(playlist) # Generate random weights if random option is chosen in the dashboard: - if userKeywordsWeights['random']: + if userKeywordsWeights.get('random'): themeWeights = random.random() charWeights = 1-themeWeights else: