mlinke-ai / kev_in

kev.in is a self hosted learning platform for programming beginners.
GNU General Public License v3.0
10 stars 0 forks source link

GET data solution_exercise_title (_type and _lang) #196

Closed just-Jana closed 1 year ago

just-Jana commented 1 year ago

I want to display the title (and probably the type and language) of the exercise to which a solution belongs. May I get these information by the solutions GET-request?

Looby72 commented 1 year ago

So you want this by sending one request to the API? By now this is possible by sending another GET request to the /exercise endpoint

mlinke-ai commented 1 year ago

No, you have to take the solution_exercise and perform a GET request at the /exercise endpoint with this value as the exercise_id.

Pymon commented 1 year ago

The problem is, that you had to perform this GET request for every single element of a solution list, which is highly inefficient. A better approach would be to send the data in the same format as exercise sends it. By sending solution_exercise_value and solution_exercise_name no additional requests would be required.

mlinke-ai commented 1 year ago

That's why most programming languages have loops.

Anyway, there is a way to allow one argument being passed multiple times in the URL. Should look something like this exercise_id=1&exercise_id=2&exercise_id=3. We could then query the database for all these values and return all results. You would only need one GET request to the endpoint. Would this suit your needs?

just-Jana commented 1 year ago

I can try doing this, thanks for your ideas on that :)

just-Jana commented 1 year ago

That's why most programming languages have loops.

Anyway, there is a way to allow one argument being passed multiple times in the URL. Should look something like this exercise_id=1&exercise_id=2&exercise_id=3. We could then query the database for all these values and return all results. You would only need one GET request to the endpoint. Would this suit your needs?

Wait... have you already implemented this or offered to do this?

mlinke-ai commented 1 year ago

I have not yet implemented this feature. I can get a prototype ready till monday.