<commit_before>var express = require('express');
var router = express.Router();
var db = require('../db');

router.get('/',function(req,res){
	console.log('GET request to /ballot route');
	console.log(req.query);
	var roomcode = Number(req.query.code);
	var username = req.query.username;

	db.Room.findOne({roomcode:roomcode},function(err,room){
		if (err){
			console.log('error finding room');
			res.send(err);
		}
		else {
			console.log('found room: ',room);
			if (!room.voters) {
				room.voters = {};
			}
			room.voters[username]=true;
			room.markModified('voters');
			room.save(function(err,room){
				res.json(room);
			})<commit_msg>[feat] initializes voter to false upon entering ballot<commit_after>var express = require('express');
var router = express.Router();
var db = require('../db');

router.get('/',function(req,res){
	console.log('GET request to /ballot route');
	console.log(req.query);
	var roomcode = Number(req.query.code);
	var username = req.query.username;

	db.Room.findOne({roomcode:roomcode},function(err,room){
		if (err){
			console.log('error finding room');
			res.send(err);
		}
		else {
			console.log('found room: ',room);
			if (!room.voters) {
				room.voters = {};
			}
			room.voters[username]=false;
			room.markModified('voters');
			room.save(function(err,room){
				res.json(room);
			})
{'fraction_non_alphanumeric': 0.18535127055306427, 'fraction_numerical': 0.0, 'mean_word_length': 4.23046875, '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': '900434', 'n_tokens_mistral': 523, 'n_tokens_neox': 463, 'n_words': 87}