<commit_before>/**
 * Module dependencies.
 */
const Score     = require('./score');
const mongoose  = require('mongoose');
const Schema    = mongoose.Schema;

// create a schema
const gameSchema = new Schema({
  started_at: Date,
  ended_at: Date,
  teams: [Schema.Types.ObjectId],
  score: [Score.schema]
});

gameSchema.methods.start = function start(completion) {
  if (!this.started_at) {
    // game is already started
    this.started_at = new Date();
  }

  completion();
}

gameSchema.methods.finish = function finish(completion) {
  if (!this.ended_at && this.started_at) {
    // game is already completed
    this.ended_at = new Date();
  }

  completion();
}

// make this available to our users in our Node applications
module.exports = Game;<commit_msg>Create model<commit_after>/**
 * Module dependencies.
 */
const Score     = require('./score');
const mongoose  = require('mongoose');
const Schema    = mongoose.Schema;

// create a schema
const gameSchema = new Schema({
  started_at: Date,
  ended_at: Date,
  teams: [Schema.Types.ObjectId],
  score: [Score.schema]
});

gameSchema.methods.start = function start(completion) {
  if (!this.started_at) {
    // game is already started
    this.started_at = new Date();
  }

  completion();
}

gameSchema.methods.finish = function finish(completion) {
  if (!this.ended_at && this.started_at) {
    // game is already completed
    this.ended_at = new Date();
  }

  completion();
}

// create a model using schema
const Game = mongoose.model('Game', gameSchema);

// make this available to our users in our Node applications
module.exports = Game;
{'fraction_non_alphanumeric': 0.13366336633663367, 'fraction_numerical': 0.0, 'mean_word_length': 3.554929577464789, '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': '3340511', 'n_tokens_mistral': 500, 'n_tokens_neox': 493, 'n_words': 141}