<commit_before>var model = require('../model');

// ROUTES

exports.viewEditIntervieweeProfile = function(req, res) {
  
	if (req.query.email){ // form submit
		/*  fname or firstname?? */
		model.User.update({"email":req.session.user.email},
			{
				"firstname":req.query.fname,
				"lastname":req.query.lname,
				"email":req.query.email,
				"education":req.query.education,
				"occupation":req.query.occupation,
				"location":req.query.location
		}).exec(afterFind);
		function afterFind(err){
			if(err) {
				console.log(err)
				res.send(500)
			}
			else {
				model.User.find({"email":req.session.user.email}).exec(
					function(err,users){
						if (err) {
							console.log(err)
							res.send(500)
							}
						else {
							var found = users[0]
							req.session.user = found;
							res.render('interviewee/editIntervieweeProfile', req.session.user);							
					   }
					}   
				)
			}
		}			
	} 

}

exports.viewEditInterviewerProfile = function(req, res) {
  
	if (req.query.email){ // form submit
		/*  fname or firstname?? */
		model.User.update({"email":req.session.user.email},
			{
				"firstname":req.query.fname,
				"lastname":req.query.lname,
				"email":req.query.email,
				"education":req.query.education,
				"occupation":req.query.occupation,
				"location":req.query.location,
				"company":req.query.company
		}).exec(afterFind);
		function afterFind(err){
			if(err) {
				console.log(err)
				res.send(500)
			}
			else {
				model.User.find({"email":req.session.user.email}).exec(
					function(err,users){
						if (err) {
							console.log(err)
							res.send(500)
							}
						else {
							var found = users[0]
							req.session.user = found;
							res.render('interviewer/editInterviewerProfile', req.session.user);							
					   }
					}   
				)
			}
		}
		
	} 

}

exports.view = function(req, res){
  res.render('prelogin/index');
};

exports.viewIntervieweeAreasToImprove = function(req, res){
	function afterFind(err){
		if(err) {<commit_msg>fixed edit interviewer and ee<commit_after>var model = require('../model');

// ROUTES

exports.viewEditIntervieweeProfile = function(req, res) {
  
	function afterFind(err){
		if(err) {
			console.log(err)
			res.send(500)
		}
		else {
			model.User.find({"email":req.session.user.email}).exec(
				function(err,users){
					if (err) {
						console.log(err)
						res.send(500)
						}
					else {
						var found = users[0]
						req.session.user = found;
						res.render('interviewee/editIntervieweeProfile', req.session.user);							
				   }
				}   
			)
		}
	}
	if (req.query.email){ // form submit
		/*  fname or firstname?? */
		model.User.update({"email":req.session.user.email},
			{
				"firstname":req.query.fname,
				"lastname":req.query.lname,
				"email":req.query.email,
				"education":req.query.education,
				"occupation":req.query.occupation,
				"location":req.query.location
		}).exec(afterFind);			
	}
	else
		afterFind(null) 

}

exports.viewEditInterviewerProfile = function(req, res) {
  
	function afterFind(err){
		if(err) {
			console.log(err)
			res.send(500)
		}
		else {
			model.User.find({"email":req.session.user.email}).exec(
				function(err,users){
					if (err) {
						console.log(err)
						res.send(500)
						}
					else {
						var found = users[0]
						req.session.user = found;
						res.render('interviewer/editInterviewerProfile', req.session.user);							
				   }
				}   
			)
		}
	}
	if (req.query.email){ // form submit
		/*  fname or firstname?? */
		model.User.update({"email":req.session.user.email},
			{
				"firstname":req.query.fname,
				"lastname":req.query.lname,
				"email":req.query.email,
				"education":req.query.education,
				"occupation":req.query.occupation,
				"location":req.query.location,
				"company":req.query.company
		}).exec(afterFind);
		
	} 
	else
		afterFind(null)

}

exports.view = function(req, res){
  res.render('prelogin/index');
};

exports.viewIntervieweeAreasToImprove = function(req, res){
	function afterFind(err){
		if(err) {
{'fraction_non_alphanumeric': 0.1630327056491576, 'fraction_numerical': 0.006937561942517344, 'mean_word_length': 2.68675799086758, 'pattern_counts': {'":': 34, '<': 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': '2799374', 'n_tokens_mistral': 1903, 'n_tokens_neox': 1456, 'n_words': 190}