<commit_before>var inspect  = require('eyes').inspector({ stream: null });

module.exports = {

  index: function(req, res, next){

    process.database.games.find(function(error, games){
      if(error){res.send(error); return false;}

      games.toArray(function(err, results){
        if(err){res.send(err); return false;}

        console.log(inspect(results));
        res.send(results);
      });

    });

  }
<commit_msg>Create game logic / fetch games form current project<commit_after>var inspect  = require('eyes').inspector({ stream: null });

module.exports = {

  index: function(req, res, next){
    var project_id = req.query.project_id;

    process.database.games.find({project_id: project_id}, function(error, games){
      if(error){res.send(error); return false;}

      games.toArray(function(err, results){
        if(err){res.send(err); return false;}

        res.send(results);
      });

    });

  },

  create: function(req, res, next){

    var game = {
      _id: req.body._id,
      name: req.body.name,
      project_id: req.body.projectId
    };

    process.database.games.save(game, function(error, savedGame){
      if(error){res.send(error); return false;}

      res.send({sucess: true});
    });

  }

{'fraction_non_alphanumeric': 0.1610305958132045, 'fraction_numerical': 0.0, 'mean_word_length': 3.0754098360655737, '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': '1338153', 'n_tokens_mistral': 410, 'n_tokens_neox': 387, 'n_words': 75}