Ignore:
Timestamp:
12/16/12 20:07:35 (12 years ago)
Author:
hendrikvanantwerpen
Message:

We can store answers for surveys now!

Introduces SurveyRun?, which can be edited. Workflow not quite clear yet. A
running survey can be accessed to leave a response. When the response
has an ID, it is loaded (used for closed surveys and continuations). A
researcher cannot create responses yet. He should also be able to add
comments to responses (that he creates).

Introduced caching of store requests.

Factored out path matching and formatting.

Put object creation in separate classes, to localize model/storage
dependency. Not consistent at the moment.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Dev/branches/rest-dojo-ui/client/qed/model/schema.js

    r417 r420  
    7474    //
    7575
     76    var Respondent = dbobject('Respondent',{
     77        secret: nestring()
     78    });
     79
     80    var Question = dbobject('Question',{
     81        code:nestring(),
     82        title: nestring(),
     83        description: string(optional()),
     84        topic: string(optional()),
     85        categories: array(nestring(),optional()),
     86        content: array([
     87            typedobject('Header',{
     88                content:string(optional())
     89            }),
     90            typedobject('Text',{
     91                content:string(optional())
     92            }),
     93            typedobject('Divider'),
     94            typedobject('StringInput'),
     95            typedobject('TextInput',{
     96                maxLength:integer()
     97            }),
     98            typedobject('IntegerInput',{
     99                min:integer(),
     100                max:integer(),
     101                step:integer()
     102            }),
     103            typedobject('MultipleChoiceInput',{
     104                multiple:boolean(),
     105                items:array(nestring())
     106            })
     107        ],optional()),
     108        publicationDate:datetime(optional())
     109    });
     110
     111    var Survey = dbobject('Survey',{
     112        title: nestring(),
     113        description: string(optional()),
     114        questions: array(Question,optional()),
     115        publicationDate:datetime(optional())
     116    });
     117
     118    var SurveyRun = dbobject('SurveyRun',{
     119        description: string(optional()),
     120        survey: Survey,
     121        publicationDate:datetime(optional()),
     122        startDate:datetime(optional()),
     123        endDate:datetime(optional()),
     124        mode:{type:'string',enum:['open','closed'],optional:true},
     125        metadata:string(optional())
     126    });
     127
     128    var Response = dbobject('Response',{
     129        surveyRunId: nestring(),
     130        answers:{type:'object',optional:true},
     131        publicationDate:datetime(optional())
     132    });
     133
     134    var Session = dbobject('Session',{
     135        title: nestring(),
     136        description: string(optional()),
     137        publicationDate: datetime(optional())
     138    });
     139
     140    var SessionTemplate = dbobject('SessionTemplate',{
     141        title: nestring(),
     142        description: string(optional()),
     143        publicationDate: datetime(optional()),
     144        plannedDate: datetime(optional())
     145    });
     146
    76147    var schema = {type:[
    77         dbobject('Question',{
    78             code:nestring(),
    79             title: nestring(),
    80             description: string(optional()),
    81             topic: string(optional()),
    82             categories: array(nestring(),optional()),
    83             content: array([
    84                 typedobject('Header',{
    85                     content:string(optional())
    86                 }),
    87                 typedobject('Text',{
    88                     content:string(optional())
    89                 }),
    90                 typedobject('Divider'),
    91                 typedobject('StringInput'),
    92                 typedobject('TextInput',{
    93                     maxLength:integer()
    94                 }),
    95                 typedobject('IntegerInput',{
    96                     min:integer(),
    97                     max:integer(),
    98                     step:integer()
    99                 }),
    100                 typedobject('MultipleChoiceInput',{
    101                     multiple:boolean(),
    102                     items:array(nestring())
    103                 })
    104             ],optional()),
    105             publicationDate:datetime(optional())
    106         }),
    107         dbobject('Survey',{
    108             title: nestring(),
    109             description: string(optional()),
    110             questions: array(nestring(),optional()),
    111             publicationDate:datetime(optional())
    112         }),
    113         dbobject('SurveyRun',{
    114             description: string(optional()),
    115             surveyId: nestring(),
    116             publicationDate:datetime(optional()),
    117             startDate:datetime(),
    118             endDate:datetime(),
    119             mode:{type:'string',enum:['open','closed']},
    120             respondents: array(nestring(),optional()),
    121             metadata:{type:'object',optional:true}
    122         }),
    123         dbobject('Session',{
    124             title: nestring(),
    125             description: string(optional()),
    126             publicationDate: datetime(optional())
    127         }),
    128         dbobject('SessionTemplate',{
    129             title: nestring(),
    130             description: string(optional()),
    131             publicationDate: datetime(optional()),
    132             plannedDate: datetime(optional())
    133         })
     148        Question,
     149        Survey,
     150        SurveyRun,
     151        Response,
     152        Session,
     153        SessionTemplate
    134154    ]};
    135155
Note: See TracChangeset for help on using the changeset viewer.