tournesol-app / tournesol

Free and open source code of the https://tournesol.app platform. Meet the community on Discord https://discord.gg/WvcSG55Bf3
https://tournesol.app
Other
321 stars 46 forks source link

[back] feat: /tocompare/ API uses the user's preferred languages #1961

Closed GresilleSiffle closed 2 months ago

GresilleSiffle commented 2 months ago

related issues #1834


Description

This PR makes the endpoint /users/me/suggestions/{poll_name}/tocompare/ able to return recommended entities matching the logged user's preferred languages. This should close the milestone Video selector redesign.

The preferred languages are determined using the following procedure:

The fallback language en is explicitly hardcoded in the back end. This might not be satisfactory if we want to make the back end generic. This trick ensures new users without entities in their rate-later list will always be suggested entities by the Auto button, even if there is no recommendations matching their preferred languages.

See also the behaviour of the tutorial: https://github.com/tournesol-app/tournesol/blob/4f67252a9a702b0e376d961577ad439b81a3d69d/frontend/src/utils/polls/videos.tsx#L54

to-do

model - User

view - SuggestionsToCompare

tests

Checklist