<commit_before>var redis = require('redis');

/*
 * GET home page.
 */

exports.index = function(req, res){
	redis.client.multi().keys('messages.*', function (err, replies) {
		// NOTE: code in this callback is NOT atomic
		// this only happens after the the .exec call finishes.]

		redis.client.mget(replies, function(err, result) {
			var json = new Array();
			for (var i = 0; i < result.length; i++){
				json.push(result[i])
			}
			res.render('index', {guestMessages:json});
		});
	})
	.exec(function (err, replies) {
		replies.forEach(function (reply, index) {
			
		});
	});
};<commit_msg>index shows only approved messages<commit_after>var redis = require('redis');

/*
 * GET home page.
 */

exports.index = function(req, res){
	redis.client.multi().keys('messages.*', function (err, replies) {
		// NOTE: code in this callback is NOT atomic
		// this only happens after the the .exec call finishes.]

		redis.client.mget(replies, function(err, result) {
			var json = new Array();
			for (var i = 0; i < result.length; i++){
				var jsonObject = JSON.parse(result[i]);
				if(jsonObject.approved == true) {
					json.push(result[i]);
				}
			}
			res.render('index', {guestMessages:json});
		});
	})
	.exec(function (err, replies) {
		replies.forEach(function (reply, index) {
			
		});
	});
};

{'fraction_non_alphanumeric': 0.17507645259938837, 'fraction_numerical': 0.0015290519877675841, 'mean_word_length': 3.3926174496644297, 'pattern_counts': {'":': 0, '<': 5, '<?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': '7009027', 'n_tokens_mistral': 498, 'n_tokens_neox': 440, 'n_words': 115}