Code coverage report for api/datum/DatumState.js

Statements: 84.21% (16 / 19)      Branches: 66.67% (8 / 12)      Functions: 100% (3 / 3)      Lines: 84.21% (16 / 19)      Ignored: none     

All files » api/datum/ » DatumState.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 741 1                                       1 223 223   223 223     1                                               894 3 3   894     220     220       220         1  
var FieldDBObject = require("./../FieldDBObject").FieldDBObject;
var UserMask = require("./../user/UserMask").UserMask;
 
/**
 * @class The datum state lets the fieldlinguists assign their own state
 *        categories to data (ie check with consultant, check with x,
 *        checked, checked and wrong, hidden, deleted), whatever state they
 *        decide. They an make each state have a color so that the team can
 *        see quickly if there is something that needs to be done with that
 *        data. We also added an optional field, Consultant that they can use
 *        to say who they want to check with in case they have mulitple
 *        consultants and the consultants have different grammaticality
 *        judgements. When users change the state of the datum, we will add
 *        a note in the datum"s comments field so that the history of its
 *        state is kept in an annotated format.
 *
 * @name  DatumState
 *
 * @extends FieldDBObject
 * @constructs
 */
var DatumState = function DatumState(options) {
  Eif (!this._fieldDBtype) {
    this._fieldDBtype = "DatumState";
  }
  this.debug("Constructing DatumState ", options);
  FieldDBObject.apply(this, arguments);
};
 
DatumState.prototype = Object.create(FieldDBObject.prototype, /** @lends DatumState.prototype */ {
  constructor: {
    value: DatumState
  },
 
  defaults: {
    value: {
      state: "Checked",
      color: "",
      consultant: UserMask, //TODO comment out htis line when we confirm that state is working
      showInSearchResults: "checked",
      selected: ""
    }
  },
 
  // Internal models: used by the parse function
  INTERNAL_MODELS: {
    value: {
      consultant: UserMask
    }
  },
 
  validationStatus: {
    get: function() {
      if (!this._validationStatus && this.state) {
        this.warn("state is deprecated, use validationStatus instead.");
        this._validationStatus = this.state;
      }
      return this._validationStatus || FieldDBObject.DEFAULT_STRING;
    },
    set: function(value) {
      Iif (value === this._validationStatus) {
        return;
      }
      Iif (!value) {
        delete this._validationStatus;
        return;
      }
      this._validationStatus = value.trim();
    }
  }
 
});
exports.DatumState = DatumState;