import Ember from 'ember';
import Base from 'ember-validations/validators/base';
import { definitionlike } from './definitionlike';
import { generic } from './generic';
import { sentencelike } from './sentencelike'

export default Base.extend({
  call() {
    var changes = this.model.get(this.property);
    var seqError = false;
    var meaningError = false;
    if(Ember.isEmpty(changes.seqs)) {
      this.errors.addObject("Must have at least one valid spelling.");
    } else {
      for(var i = 0; i < changes.seqs.length; i++) {
        var seq = changes.seqs[i];
        if(Ember.isBlank(seq.text) || (seq.text.length === 0)) {
          seqError = true;
        }
        if(seq.proposal_id) {
          seqError = true;
        }
      }
    }
    console.log("Made it here")
    if(Ember.isEmpty(changes.meanings)) {
      this.errors.addObject("Must have at least one valid meaning.");
    } else {
      for(var i = 0; i < changes.meanings.length; i++) {

        var meaning = changes.meanings[i];
        if( (generic(meaning.def) !== false ) ||
            (definitionlike(meaning.def, meaning.pos) !== false)) {
          console.log("def fail", meaning.def);
          meaningError = true;
        }
        if(sentencelike(meaning.example) !== false) {
          console.log("example fail", meaning.example);
          meaningError = true;
        }
      }
    }

    if(seqError) {
      this.errors.addObject("One of the spellings above is invalid");
    }
    if(meaningError) {
      this.errors.addObject("One of the meanings above is invalid");
    }
  }
});

@@ -751,40 +751,8 @@
   %7D%0A
-    console.log(%22Made it here%22)%0A
     
@@ -1094,56 +1094,8 @@
 ) %7B%0A
-          console.log(%22def fail%22, meaning.def);%0A
     
@@ -1189,64 +1189,8 @@
 ) %7B%0A
-          console.log(%22example fail%22, meaning.example);%0A
     

Remove some excessive console lines