wcodesoft / sentency-server

Server for the Sentency Project
MIT License
0 stars 0 forks source link

Random Quote Localized #11

Closed walterjgsp closed 3 years ago

walterjgsp commented 3 years ago

Bug

The server has the use case of having a limited number of quotes translated and not all quotes. That makes it necessary to also fix the getRandom quote call.

Current issue

Now it will get a random quote and if that quote has the language we present it to the API calling otherwise we just send the English version of that quote. The way things are implemented is not the best since we can have languages that just have 3 or 4 quotes localized to id and when getting random the odds to get those quotes are really small.

Solution

Make a more complex SELECT that will get from the database only quotes that have the quote translated to the specified code before getting a random from them.