fdiazb

Untitled

Jul 11th, 2017
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 'use strict';
  2.  
  3. /**
  4.  * Module dependencies.
  5.  */
  6. var mongoose = require('mongoose'),
  7.     Schema = mongoose.Schema;
  8.  
  9. /**
  10.  * Tracking Schema
  11.  */
  12. var TrackingSchema = new Schema({
  13.   name: {
  14.     type: String,
  15.     default: '',
  16.     required: 'Please fill Tracking name',
  17.     trim: true
  18.   },
  19.   activity: {      // Attempts information
  20.     active: {                   // Indicates that an attempt is currently in progress for the activity.
  21.       type: Boolean,
  22.       default: false
  23.     },
  24.     suspended: {                // Indicates that activity is currently suspended.
  25.       type: Boolean,
  26.       default: false
  27.     },
  28.     /* availableChildren: {        // Indicates attempt progress information is meaningful.
  29.       type: Boolean,
  30.       default: false
  31.     } */
  32.     progressStatus: {           // Indicates attempt progress information is meaningful.
  33.       type: Boolean,
  34.       default: false
  35.     },
  36.     absoluteDuration: {         // Cumulative duration of all attempts on the activity. Unrealiable unless progressStatus is True.
  37.       type: Number,
  38.       default: 0
  39.     },
  40.     experiencedDuration: {      // Cumulative experienced duration of all attempts on the activity. No include suspend time. Unreliable unless progressStatus is True.
  41.       type: Number,
  42.       default: 0
  43.     },
  44.     attemptCount: {           // Number of attempts on the activity. Unreliable unless progressStatus is True.
  45.       type: Number,
  46.       default: 0
  47.     }
  48.   },
  49.   attempts: [     // Indicate learner's progress on an activity. Describes per attempt progress on activity.
  50.     {
  51.       progressStatus: {       // Indicates attempt progress information is meaningful. Unrealiable unless activity.progressStatus > 0.
  52.         type: Boolean,
  53.         default: false
  54.       },
  55.       completionAmount: {     // Measure of completion of the attempt on the activity (normalized [Not complete] 0..1 [Complete]). Unreliable unless progressStatus is True.
  56.         type: Number,
  57.         default: 0
  58.       },
  59.       completionStatus: {     // Indicates the attempt is completed. Unreliable unless progressStatus is True.
  60.         type: Boolean,
  61.         default: false
  62.       },
  63.       absoluteDuration: {
  64.         type: Number,         // Duration of attempt.
  65.         default: 0
  66.       },
  67.       experiencedDuration: {  // Duration of attempt (no include elapsed time while the activity attempt is suspendend.
  68.         type: Number,
  69.         default: 0
  70.       }
  71.     }
  72.   ],
  73.   objectives: [   // Indicate learner's progress related to learning objective.
  74.     {
  75.       progressStatus: {     // Indicates that objective currently has a 'satisfaction' value.
  76.         type: Boolean,
  77.         default: false
  78.       },
  79.       satisfiedStatus: {    // Indicates that objective is 'satisfied'. Valid only if 'progressStatus' = true.
  80.         type: Boolean,
  81.         default: false
  82.       },
  83.       measureStatus: {      // Indicates that objective has a 'measure' value.
  84.         type: Boolean,
  85.         default: false
  86.       },
  87.       normalizedMeasure: {  // Measure for the objective. Valid only if 'measureStatus'=true.
  88.         type: Number,
  89.         default: 0.0
  90.       }
  91.     }
  92.   ],
  93.   created: {
  94.     type: Date,
  95.     default: Date.now
  96.   },
  97.   user: {
  98.     type: Schema.ObjectId,
  99.     ref: 'User'
  100.   }
  101. });
  102.  
  103. mongoose.model('Tracking', TrackingSchema);
Add Comment
Please, Sign In to add comment