[Cubicweb] cubicweb-questionnaire : changing "Answer"

Dimitri Papadopoulos Orfanos dimitri.papadopoulos at cea.fr
Tue Mar 18 15:03:04 CET 2014

Dear all,

The "Answer" entity defined in the "questionnaire" cube has an attribute
"value" of type "float". This attribute is interpreted as either an
index in an array of possible answers, or a numerical value, based on
the value of the "type" attribute of the associated "Question".

We feel adding new textual answers is not easy:
* query list of possible answers,
* split into list of possible answers,
* append new answers missing from the existing list,
* join the list of possible answers,
* insert possible answers,
* insert new textual answers as an index.

Instead we suggest:
* Change the type of the "value" attribute from "float" to "str" (or
* Expand the possible values of the "type" attribute of the "Question"
entity: add "index" to "numerical" and "text".
* Handle the "value" attribute of "Answer" differently based on the
value of the "type" attribute of the associated "Question" entity.

We could submit a patch.

What would you recommend? Would you consider a patch for inclusion?

Dimitri Papadopoulos
I2BM, NeuroSpin
F-91191 Gif-sur-Yvette cedex, France

More information about the Cubicweb mailing list