Skip to content

Commit

Permalink
backend fix: unique posts in recommendations
Browse files Browse the repository at this point in the history
  • Loading branch information
Songmin17 committed Dec 6, 2023
1 parent 621c42a commit ae7bc4f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion backend/post/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ class PostRecommendView(APIView):
def get(self, request):
user = request.user
today = date.today()
posts = Post.objects.filter(recommend_users=user,event_durations__event_day__gte=today).order_by("-recommend__score")
posts = Post.objects.filter(recommend_users=user,event_durations__event_day__gte=today).order_by("-recommend__score").distinct()
# scores = Recommend.objects.filter(user=request.user).values('score')
serializer = PostRecommendSerializer(posts, many=True, context={'request': request})
return Response(serializer.data, status=200)
Expand Down

0 comments on commit ae7bc4f

Please sign in to comment.