Changeset 531 for Dev/trunk/src/server/config
- Timestamp:
- 03/27/14 14:44:36 (11 years ago)
- Location:
- Dev/trunk/src/server/config
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
Dev/trunk/src/server/config/couchdb-design-docs.js
r525 r531 30 30 _id: "schemaInfo", 31 31 version: "4", 32 viewsVersion: " 1"32 viewsVersion: "2" 33 33 }, 34 34 … … 49 49 by_type: { 50 50 map: function(doc){ 51 emit(doc.type, doc); 52 } 51 emit(doc.type, 1); 52 }, 53 reduce: function(keys,values){ return sum(values); } 53 54 }, 54 55 typeless: { … … 104 105 emit(doc.topic||"(default)",1); 105 106 }, 106 reduce: function(key, values , rereduce) { return sum(values); }107 reduce: function(key, values ) { return sum(values); } 107 108 }, 108 109 all_variables: { … … 137 138 map: function(doc){ 138 139 if ( doc.type !== 'Question' ) { return; } 139 emit(doc.code,doc); 140 } 140 emit(doc.code,1); 141 }, 142 reduce: function(key, values) { return sum(values); } 141 143 }, 142 144 published_by_code: { 143 145 map: function(doc){ 144 if ( doc.type !== 'Question' || !doc.publicationDate ) { return; } 145 emit(doc.code,doc); 146 } 146 if ( doc.type !== 'Question' || 147 !doc.publicationDate ) { return; } 148 emit(doc.code,1); 149 }, 150 reduce: function(key, values) { return sum(values); } 147 151 }, 148 152 lib: { … … 159 163 drafts: { 160 164 map: function(doc){ 161 if ( doc.type !== 'Survey' || doc.publicationDate ) { return; } 165 if ( doc.type !== 'Survey' || 166 doc.publicationDate ) { return; } 162 167 emit(doc._id,doc); 163 168 } … … 165 170 published: { 166 171 map: function(doc){ 167 if ( doc.type !== 'Survey' || !doc.publicationDate ) { return; } 172 if ( doc.type !== 'Survey' || 173 !doc.publicationDate ) { return; } 168 174 emit(doc._id,doc); 169 175 } … … 176 182 language: "javascript", 177 183 views: { 178 by_ dates: {184 by_start_date: { 179 185 map: function(doc){ 180 186 if ( doc.type !== 'SurveyRun' ) { return; } 181 var startDate = doc.startDate || ""; 182 var endDate = doc.endDate || {}; 183 emit([startDate,endDate,doc.liveName||null],doc); 184 } 187 emit(doc.startDate||null,1); 188 }, 189 reduce: function(keys,values){ return sum(values); } 190 }, 191 by_end_date: { 192 map: function(doc){ 193 if ( doc.type !== 'SurveyRun' ) { return; } 194 emit(doc.endDate||{},1); 195 }, 196 reduce: function(keys,values){ return sum(values); } 185 197 } 186 198 } … … 194 206 map: function(doc){ 195 207 if ( doc.type !== 'Response' ) { return; } 196 emit(doc.surveyRunId, doc); 197 } 208 emit(doc.surveyRunId, 1); 209 }, 210 reduce: function(keys,values){ return sum(values); } 198 211 } 199 212 } -
Dev/trunk/src/server/config/couchdb-schema.json
r525 r531 10 10 "definitions": { 11 11 "nonEmptyString": { "type": "string", "minLength": 1 }, 12 "codeString": { "type": "string", "pattern": "^[A-Za-z0-9]+$" }, 13 "subcodeString": { "type": "string", "pattern": "^[A-Za-z0-9]*$" }, 12 "code": { "type": "string", "pattern": "^[A-Za-z0-9]+$" }, 13 "subcode": { "type": "string", "pattern": "^[A-Za-z0-9]*$" }, 14 "datetime": {"type": "string", "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}\\.[0-9]{3}Z$"}, 15 "html5Email": {"type": "string", "pattern": "^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$"}, 14 16 "schemaInfo": { 15 17 "type": "object", … … 40 42 "_rev": { "$ref": "#/definitions/nonEmptyString" }, 41 43 "categories": { "type": "array", "items": { "$ref": "#/definitions/nonEmptyString" } }, 42 "code": { "$ref": "#/definitions/code String" },44 "code": { "$ref": "#/definitions/code" }, 43 45 "content": { "type": "array", "items": { "$ref": "#/definitions/content/any" } }, 44 46 "description": { "$ref": "#/definitions/nonEmptyString" }, 45 "publicationDate": { " type": "string", "format": "datetime" },47 "publicationDate": { "$ref": "#/definitions/datetime" }, 46 48 "title": { "$ref": "#/definitions/nonEmptyString" }, 47 49 "topic": { "$ref": "#/definitions/nonEmptyString" } … … 57 59 "_rev": { "$ref": "#/definitions/nonEmptyString" }, 58 60 "description": { "$ref": "#/definitions/nonEmptyString" }, 59 "publicationDate": { " type": "string", "format": "datetime" },61 "publicationDate": { "$ref": "#/definitions/datetime" }, 60 62 "questions": { "type": "array", "items": { "$ref": "#/definitions/docs/Question" } }, 61 63 "title": { "$ref": "#/definitions/nonEmptyString" } … … 71 73 "_rev": { "$ref": "#/definitions/nonEmptyString" }, 72 74 "description": { "$ref": "#/definitions/nonEmptyString" }, 73 "endDate": { "type": "string", "format": "datetime" }, 74 "liveName": { "$ref": "#/definitions/nonEmptyString" }, 75 "endDate": { "$ref": "#/definitions/datetime" }, 75 76 "mode": { "type": "string", "enum": [ "open", "closed" ] }, 76 77 "respondentCanDeleteOwnResponse": { "type": "boolean" }, 77 78 "secret": { "$ref": "#/definitions/nonEmptyString" }, 78 "startDate": { " type": "string", "format": "datetime" },79 "startDate": { "$ref": "#/definitions/datetime" }, 79 80 "survey": { "$ref": "#/definitions/docs/Survey" }, 80 81 "title": { "$ref": "#/definitions/nonEmptyString" } … … 96 97 "additionalProperties": false 97 98 }, 98 "email": { "type": "string", "format": "email" }, 99 "publicationDate": { "type": "string", "format": "datetime" }, 99 "publicationDate": { "$ref": "#/definitions/datetime" }, 100 100 "secret": { "$ref": "#/definitions/nonEmptyString" }, 101 101 "surveyRunId": { "$ref": "#/definitions/nonEmptyString" } … … 149 149 "properties": { 150 150 "type": { "type": "string", "pattern": "^StringInput$" }, 151 "subcode": { "$ref": "#/definitions/subcode String" },151 "subcode": { "$ref": "#/definitions/subcode" }, 152 152 "text": { "$ref": "#/definitions/nonEmptyString" } 153 153 }, … … 160 160 "type": { "type": "string", "pattern": "^TextInput$" }, 161 161 "maxLength": { "type": "integer" }, 162 "subcode": { "$ref": "#/definitions/subcode String" },162 "subcode": { "$ref": "#/definitions/subcode" }, 163 163 "text": { "$ref": "#/definitions/nonEmptyString" } 164 164 }, … … 173 173 "max": { "type": "integer" }, 174 174 "places": { "type": "integer" }, 175 "subcode": { "$ref": "#/definitions/subcode String" },175 "subcode": { "$ref": "#/definitions/subcode" }, 176 176 "text": { "$ref": "#/definitions/nonEmptyString" } 177 177 }, … … 193 193 "minLabel": { "$ref": "#/definitions/nonEmptyString" }, 194 194 "maxLabel": { "$ref": "#/definitions/nonEmptyString" }, 195 "subcode": { "$ref": "#/definitions/subcode String" },195 "subcode": { "$ref": "#/definitions/subcode" }, 196 196 "text": { "$ref": "#/definitions/nonEmptyString" } 197 197 }, … … 219 219 "type": "object", 220 220 "properties": { 221 "subcode": { "$ref": "#/definitions/subcode String" }221 "subcode": { "$ref": "#/definitions/subcode" } 222 222 }, 223 223 "required": ["subcode"], 224 224 "additionalProperties": false 225 225 }, 226 "subcode": { "$ref": "#/definitions/subcode String" }226 "subcode": { "$ref": "#/definitions/subcode" } 227 227 }, 228 228 "required":["type","items","subcode"], … … 236 236 "type": "object", 237 237 "properties": { 238 "subcode": { "$ref": "#/definitions/subcode String" },238 "subcode": { "$ref": "#/definitions/subcode" }, 239 239 "text": { "$ref": "#/definitions/nonEmptyString" } 240 240 }, … … 245 245 "type": "object", 246 246 "properties": { 247 "subcode": { "$ref": "#/definitions/subcode String" }247 "subcode": { "$ref": "#/definitions/subcode" } 248 248 }, 249 249 "required": ["subcode"],
Note: See TracChangeset
for help on using the changeset viewer.