cms-dev / cms

Contest Management System
http://cms-dev.github.io/
GNU Affero General Public License v3.0
886 stars 360 forks source link

AWS treats badly TaskTypes that it doesn't know #42

Closed giomasce closed 11 years ago

giomasce commented 11 years ago

Apparently AWS messes up with the task_type_parameters when it doesn't know a task, because it tries to interpret task_type_parameters, fails and instead of leaving the same string, it writes another (probably empty). I believe that Giovanni Campagna ran into this problem during IOI 2012, maybe he can comment better.

lw commented 11 years ago

If I remember correctly, the problem that Giovanni Campagna run into was different: AWS had a hardcoded list of known TaskTypes and presented the choice among them using a drop-down menu. So, when the actual TaskType of the Task wasn't among these ones, the menu fell back on a known one (Batch, I guess) which could then be easily and inadvertently submitted and changed. I'm mentioning him (@gcampax) so he can confirm this.

giomasce commented 11 years ago

Il 12/10/2012 21:35, Luca Wehrstedt ha scritto:

If I remember correctly, the problem that Giovanni Campagna run into was different: AWS had a hardcoded list of known TaskTypes and presented the choice among them using a drop-down menu. So, when the actual TaskType of the Task wasn't among these ones, the menu fell back on a known one (Batch, I guess) which could then be easily and inadvertently submitted and changed. I'm mentioning him (@gcampax) so he can confirm this.

Probably you're right. Anyway, the problem has to be fixed anyway. :-)

Gio.

Giovanni Mascellani mascellani@poisson.phc.unipi.it Pisa, Italy

Web: http://poisson.phc.unipi.it/~mascellani Jabber: g.mascellani@jabber.org / giovanni@elabor.homelinux.org

gcampax commented 11 years ago

@lerks is right, the problem was the task type being reset to Batch at every task update because the list is hardcoded in the HTML template. I don't think AWS does any parsing for the task_type_parameters (as far as *S are concerned, it's an opaque JSON blob, and that's how AWS shows it), but if it does, the static list becomes a different issue.

lw commented 11 years ago

Actually, AWS does some parsing of task_type_parameters: it shows it using a table, dynamically computed using the HTML template snippets in the classes in cms/grading/ParameterTypes.py. You were probably thinking about score_parameters: that value is indeed presented as a plain JSON-encoded string.

Anyway, I think that fixing the hardcoded list of TaskTypes in AWS will also fix the problem that @giomasce reported.

lw commented 11 years ago

Since there doesn't seem to be an easy way to obtain a list of all available TaskTypes (correct me if I'm wrong) I think the best solution for this issue (for version 1.0) is to simply change the drop-down menu to a text input box. The major drawback is that the admin has to know in advance the exact name of the TaskType he/she wants to use, but we can add a list of the ones we provide by default in the label of the field. I'll do that soon.

stefano-maggiolo commented 11 years ago

Sorry, I did not see that the bug was already assigned. I fixed the problem of retrieving a list of known task type (there was a bug preventing the import of a task type placed in the plugin directory too). The behaviour now is that aws warns the user that the task type can't be found and ask him/her to make it visible or change it (same for score types). Patch coming in my tree for review. Sorry if you already stated working on it.

stefano-maggiolo commented 11 years ago

8b555650c96c0593f94c60055446dde253dfca48

lw commented 11 years ago

Don't worry, I did never actually start working on it. Your patch seems fine to me. I think you can push and close this issue.