diff --git a/src/recommender.py b/src/recommender.py index 9118c6f..365d6f3 100644 --- a/src/recommender.py +++ b/src/recommender.py @@ -109,18 +109,20 @@ class Recommender: Set the recommendation strategy. """ logging.info("Setting recommender strategy to \'%s\'" % strategy_str) + # Check if collaborative strategies can be instanciated + if "knn" in strategy_str: + if not self.cfg.popcon: + logging.info("Cannot perform collaborative strategy") + return 1 if self.cfg.pkgs_filter.split("/")[-1] == "desktopapps": self.items_repository = self.axi_desktopapps self.valid_pkgs = self.valid_desktopapps + if "knn" in strategy_str: + self.users_repository = self.popcon_desktopapps else: self.items_repository = self.axi_programs self.valid_pkgs = self.valid_programs - # Check if collaborative strategies can be instanciated - if ("col" in strategy_str) or ("knn" in strategy_str): - if not self.cfg.popcon: - logging.info("Cannot perform collaborative strategy") - return 1 - else: + if "knn" in strategy_str: self.users_repository = self.popcon_programs # Set strategy based on strategy_str if strategy_str == "cb": -- libgit2 0.21.2