ELTE-Clean/Clean-Administration-Platform

Change Layout of Testcases in the DB

Closed this issue · 1 comments

When a task is created, some test cases are given as well in the request in a specific JSON object in the body called testcases. The current implementation translates these test cases into indented yaml textual representation and stores it in the DB (in testQuestions column). The YAML format is needed when the grading script is executed. Thus, when the grading script endpoint is called, we extract information from database and just store that into a file (Configuration for the grading script). The aforementioned implementation is not adequate when the frontend tries to query the data of the test cases (It will be returned from the database as a YAML textual representation).

For this issue, store the testcases (passed to the tasks creation endpoint) as a stringified JSON textual representation in the testQuestions inside the database. And, when the grading script is executed, the JSON textual representation (Gotten from our database) will be translated to YAML representation and saved to the configuration file for the script. Simply put, move the JSON -> YAML from the task creation to the script execution endpoint.

Related PR: #74
Observably, the returned testcases when we get the tasks info is in YAML format (Not good for visual representation), while it is in JSON format when a task is first created.

.