Commit b69dc894 authored by Markus Shepherd's avatar Markus Shepherd

added BGA recommendations for liked games

parent 27e36587
......@@ -284,22 +284,24 @@ class GameViewSet(PermissionsModelViewSet):
def recommend_bga(self, request):
''' recommend games with Board Game Atlas data '''
user = request.query_params.get('user')
path = getattr(settings, 'BGA_RECOMMENDER_PATH', None)
recommender = load_recommender(path, 'bga')
if recommender is None:
return self.list(request)
user = request.query_params.get('user')
like = request.query_params.getlist('like')
recommendation = recommender.recommend(
users=(user,),
similarity_model=request.query_params.get('model') == 'similarity',
# exclude_known=parse_bool(take_first(params.get('exclude_known'))),
# exclude_clusters=parse_bool(take_first(params.get('exclude_clusters'))),
star_percentiles=getattr(settings, 'STAR_PERCENTILES', None),
)
) if user or not like else recommender.recommend_similar(games=like)
del path, recommender
del path, recommender, user, like
page = self.paginate_queryset(recommendation)
return (
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment