premierlangage icon indicating copy to clipboard operation
premierlangage copied to clipboard

[ENHANCEMENT] POsibility to define a log entrie in evaluator

Open nimdanor opened this issue 4 years ago • 3 comments

I need a syntaxe to give to playexo a string that will be save in the answer data base table.

proposition: if the variable "log" is defined in the exercice after the execution of the grader or the builder then the pair "log": value is added to the json in the answer table.

nimdanor avatar Dec 04 '20 10:12 nimdanor

To ensure strict decoupling between playexo app and all future smart applications (stats, recommendation, smart activity), I would rather go to a new field to Answer model (something like traces) (and yes, one more field, which will be empty for all the old logs before it) as well as a new feature at sandboxio.py. Regarding the name, I would rather go for very very explicit trick add_user_trace (key, value) usable as many times as possible inside buider/grader with the communication constraints (json for the rest API I imagine).

So another json field is not a perfect option but :

  • Separate technical traces and pedagogical traces is good
  • This will allow to download pedagogical (chosen by teacher-editor) trace without include huge technical trace answer (close to undownloadble currently...). Also, mixing all together make sometimes the read of answer tricky.
  • No problem of backward compatibility (either you use log or not... either exercise generate pedagogical trace or not...)

This is a choice... My intuition go for a separation of the information. traces would really contains thing one could want to reuse outside the exercise (typically for smart activities) and answer field stay the technical data to ensure the exo is working on its own. Not perfect but my intuition.

nborie avatar Jan 11 '21 14:01 nborie

Ok let's have a json dictionnary in traces, for the communication from the sandbox to the server we need a name that will not collide with a name in the executor. I choose "+" the positive signe. As it can't be used as a variable name.

the function addtrace (key, value) will add the pair (key,value) to the context variable['+']. Dans la fonction evaluer du playexo on récupère ce dictionnaire (qui est déja sous forme de json a ce stade, et on le sauvegarde dans le nouveau champs jsonField "traces" du model answer).

The function must be defined in a base template. for use in the evaluator def addtrace(key : str, value : str): if "+" not in globals(): globals()['+']= {} globals()['+'][key] = value

nimdanor avatar Jan 13 '21 20:01 nimdanor

This is something we discus monday this is the way to do it. ;)

nimdanor avatar Jan 13 '21 20:01 nimdanor