<commit_before>'use strict';

/**
 * Module dependencies.
 */
var mongoose = require('mongoose'),
  Schema = mongoose.Schema;


/**
 * Competitor Schema
 */
var CompetitorSchema = new Schema({
  created: {
      type: Date,
      default: Date.now
  },
  gender: {
    type: String,
    required: true,
    trim: true
  },
  name: {
    type: String,
    required: true,
    trim: true
  },
  firstname: {
    type: String,
    required: true,
    trim: true
  },
  address: {
    type: String,
    required: true,
    trim: true
  },
  zip: {
    type: Number,
    required: true,
    trim: true
  },
  location: {
    type: String,
    required: true,
    trim: true
  },
  society: {
    type: String,
    required: false,
    trim: true
  },
  email: {
    type: String,
    required: true,
    trim: true
  },
  birthdate: {
    type: Date,
    required: true,
    trim: true
  },
  startnr: {
    type: String,
    required: false,
    trim: true
  },
  startnrfetched: {
    type: Boolean,
    required: true,
    default: false
  },
  user: {
    type: Schema.ObjectId,
    ref: 'User'
  },
  results: {
  	type: [DisciplineResultSchema]
  }
});

var DisciplineResultSchema = new Schema({
  disciplineId: {
  	type: Schema.ObjectId,
  	required: true,
  	trim: true
  },
  result: {
    type: String,
    required: false,
    trim: true
  }
});

/**
 * Validations
 */
// ArticleSchema.path('title').validate(function(title) {
  // return !!title;
// }, 'Title cannot be blank');
// 
// ArticleSchema.path('content').validate(function(content) {
  // return !!content;
// }, 'Content cannot be blank');

/**
 * Statics
 */
CompetitorSchema.statics.load = function(id, cb) {
  this.findOne({
    _id: id
  }).populate('user', 'name username').exec(cb);
};

mongoose.model('Competitor', CompetitorSchema);<commit_msg>Schema Reihenfolge korrigiert<commit_after>'use strict';

/**
 * Module dependencies.
 */
var mongoose = require('mongoose'),
  Schema = mongoose.Schema;

var DisciplineResultSchema = new Schema({
  disciplineId: {
    type: Schema.ObjectId,
    required: true,
    trim: true
  },
  result: {
    type: String,
    required: false,
    trim: true
  }
});

/**
 * Competitor Schema
 */
var CompetitorSchema = new Schema({
  created: {
      type: Date,
      default: Date.now
  },
  gender: {
    type: String,
    required: true,
    trim: true
  },
  name: {
    type: String,
    required: true,
    trim: true
  },
  firstname: {
    type: String,
    required: true,
    trim: true
  },
  address: {
    type: String,
    required: true,
    trim: true
  },
  zip: {
    type: Number,
    required: true,
    trim: true
  },
  location: {
    type: String,
    required: true,
    trim: true
  },
  society: {
    type: String,
    required: false,
    trim: true
  },
  email: {
    type: String,
    required: true,
    trim: true
  },
  birthdate: {
    type: Date,
    required: true,
    trim: true
  },
  startnr: {
    type: String,
    required: false,
    trim: true
  },
  startnrfetched: {
    type: Boolean,
    required: true,
    default: false
  },
  user: {
    type: Schema.ObjectId,
    ref: 'User'
  },
  results: {
  	type: [DisciplineResultSchema]
  }
});


/**
 * Validations
 */
// ArticleSchema.path('title').validate(function(title) {
  // return !!title;
// }, 'Title cannot be blank');
// 
// ArticleSchema.path('content').validate(function(content) {
  // return !!content;
// }, 'Content cannot be blank');

/**
 * Statics
 */
CompetitorSchema.statics.load = function(id, cb) {
  this.findOne({
    _id: id
  }).populate('user', 'name username').exec(cb);
};

mongoose.model('Competitor', CompetitorSchema);
{'fraction_non_alphanumeric': 0.15225102319236017, 'fraction_numerical': 0.0, 'mean_word_length': 2.5047801147227533, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3099514', 'n_tokens_mistral': 1264, 'n_tokens_neox': 1275, 'n_words': 305}