Ignore:
Timestamp:
03/09/14 14:23:42 (11 years ago)
Author:
hendrikvanantwerpen
Message:
  • Enable/disable buttons on content change.
  • One place to do date formatting, because it was going wrong again.
  • Serialize questions in survey properly.
  • _ComplexValueMixin consumes submit events, but does trigger outer forms if present.
  • Trigger dialog show/hide for login only after previous effect is finished.
  • Check that documents are actually valid, not just that validator returned a result.
  • Validate email and timestamp formats.
  • Prepared for live runs.
Location:
Dev/trunk/src/server/config
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • Dev/trunk/src/server/config/check-couchdb.js

    r487 r492  
    11var Q = require('q')
    22  , _ = require('underscore')
    3   , tv4 = require('tv4')
     3  , validator = require('../util/validator')
    44  , CouchDB = require('../util/couch').CouchDB
    55  ;
     
    1010    var server = new CouchDB(couchServerURL,dbName);
    1111    var designRe = /^_design\//;
     12
     13    var codes = {};
     14    function codeUnique(code) {
     15        if ( code in codes ) {
     16            return false;
     17        } else {
     18            codes[code] = true;
     19            return true;
     20        }
     21    }
     22
    1223    return server.get('/_all_docs')
    1324    .then(function(allDocs){
     
    2031                return server.get(doc.id)
    2132                .then(function(doc){
    22                     var valid = tv4.validateResult(doc,schema);
     33                    var valid = validator(doc,schema);
     34                    if ( doc.type === "Question" && !codeUnique(doc.code) ) {
     35                        valid.valid = false;
     36                        valid.error = "Question code "+doc.code+" is not unique.";
     37                    }
    2338                    result[doc._id] = valid;
    2439                    return result;
  • Dev/trunk/src/server/config/couchdb-design-docs.js

    r487 r492  
    125125    },
    126126
     127    "qed/_design/surveyRuns": {
     128        __configAction: "replace",
     129        _id: "_design/surveys",
     130        language: "javascript",
     131        views: {
     132            by_dates: {
     133                map: function(doc){
     134                    if ( doc.type !== 'SurveyRun' ) { return; }
     135                    var startDate = doc.startDate || "";
     136                    var endDate = doc.endDate || {};
     137                    emit([startDate,endDate,doc.liveName||null],doc);
     138                }
     139            }
     140        }
     141    },
     142
    127143    "qed/_design/responses": {
    128144        __configAction: "replace",
  • Dev/trunk/src/server/config/couchdb-schema.json

    r487 r492  
    3636          "_rev": { "type": "string" },
    3737          "categories": { "type": "array", "items": { "type": "string" } },
    38           "code": { "type": "string" },
     38          "code": { "type": "string", "minLength": 1 },
    3939          "content": { "type": "array", "items": { "$ref": "#/definitions/content/any" } },
    4040          "description": { "type": "string" },
     
    5252          "_id": { "type": "string" },
    5353          "_rev": { "type": "string" },
     54          "description": { "type": "string" },
    5455          "publicationDate": { "type": "string", "format": "datetime" },
    5556          "questions": { "type": "array", "items": { "$ref": "#/definitions/docs/Question" } },
     
    6768          "description": { "type": "string" },
    6869          "endDate": { "type": "string", "format": "datetime" },
     70          "liveName": { "type": "string" },
    6971          "mode": { "type": "string", "enum": [ "open", "closed" ] },
    70           "secret": { "type": "string", "minLength": 8 },
     72          "respondentCanDeleteOwnResponse": { "type": "boolean" },
     73          "secret": { "type": "string", "minLength": 1 },
    7174          "startDate": { "type": "string", "format": "datetime" },
    7275          "survey": { "$ref": "#/definitions/docs/Survey" },
     
    8386          "_rev": { "type": "string" },
    8487          "answers": { "type": "object" },
     88          "email": { "type": "string", "format": "email" },
    8589          "publicationDate": { "type": "string", "format": "datetime" },
    86           "secret": { "type": "string", "minLength": 8 },
     90          "secret": { "type": "string", "minLength": 1 },
    8791          "surveyRunId": { "type": "string" }
    8892        },
  • Dev/trunk/src/server/config/upgrade-couchdb.js

    r487 r492  
    11var Q = require('q')
    22  , _ = require('underscore')
    3   , tv4 = require('tv4')
    43  , CouchDB = require('../util/couch').CouchDB
    54  ;
Note: See TracChangeset for help on using the changeset viewer.