function initShowStudentRecordsDiff() {
	
	var students = [];
	var other = [];

	mysql.query('SELECT * FROM `students`', function(err, rows) {
		students = rows;

		mysql.query('SELECT * FROM `students_2014_2015`', function(otherErr, otherRows) {
			other = otherRows;
			onFinish();
		});
	});

	function onFinish() {

		var studentIsLongest = (students.length > other.length);
		var longestArray = (studentIsLongest ? students : other);
		var shortestArray = (studentIsLongest ? other : students);
		var difference = [];

		for(var i = 0; i < longestArray.length; i++) {

			var currentEntryFound = false;

			for(var x = 0; x < shortestArray.length && !currentEntryFound; x++) {
				if(longestArray[i].student_id == shortestArray[x].student_id) {
					currentEntryFound = true;
				}
			}

			if(!currentEntryFound) {
				difference.push(longestArray[i]);
			}
		}

		console.log(difference.length + '', 'differences found.');
		console.log(difference);

	}

}
/**
 * Init script, to be called after a connection with the database is made
 * Displays entries present in previous semesters compared to the current one
 * Assumes `attendance` table exists and has been populated
 */
Init script, to be called after a connection with the database is made
Displays entries present in previous semesters compared to the current one
Assumes `attendance` table exists and has been populated
Init script to be called after a connection with the database is made Displays entries present in previous semesters compared to the current one Assumes ` attendance ` table exists and has been populated
function initShowStudentRecordsDiff() {
	var students = [];
	var other = [];
	mysql.query('SELECT * FROM `students`', function(err, rows) {
		students = rows;
		mysql.query('SELECT * FROM `students_2014_2015`', function(otherErr, otherRows) {
			other = otherRows;
			onFinish();
		});
	});
	function onFinish() {
		var studentIsLongest = (students.length > other.length);
		var longestArray = (studentIsLongest ? students : other);
		var shortestArray = (studentIsLongest ? other : students);
		var difference = [];
		for(var i = 0; i < longestArray.length; i++) {
			var currentEntryFound = false;
			for(var x = 0; x < shortestArray.length && !currentEntryFound; x++) {
				if(longestArray[i].student_id == shortestArray[x].student_id) {
					currentEntryFound = true;
				}
			}
			if(!currentEntryFound) {
				difference.push(longestArray[i]);
			}
		}
		console.log(difference.length + '', 'differences found.');
		console.log(difference);
	}
}
function initShowStudentRecordsDiff ( ) { var students = [ ] ; var other = [ ] ; mysql . query ( 'SELECT * FROM `students`' , function ( err , rows ) { students = rows ; mysql . query ( 'SELECT * FROM `students_2014_2015`' , function ( otherErr , otherRows ) { other = otherRows ; onFinish ( ) ; } ) ; } ) ; function onFinish ( ) { var studentIsLongest = ( students . length > other . length ) ; var longestArray = ( studentIsLongest ? students : other ) ; var shortestArray = ( studentIsLongest ? other : students ) ; var difference = [ ] ; for ( var i = 0 ; i < longestArray . length ; i ++ ) { var currentEntryFound = false ; for ( var x = 0 ; x < shortestArray . length && ! currentEntryFound ; x ++ ) { if ( longestArray [ i ] . student_id == shortestArray [ x ] . student_id ) { currentEntryFound = true ; } } if ( ! currentEntryFound ) { difference . push ( longestArray [ i ] ) ; } } console . log ( difference . length + '' , 'differences found.' ) ; console . log ( difference ) ; } }
Init script, to be called after a connection with the database is made
 Displays entries present in previous semesters compared to the current one
 Assumes `attendance` table exists and has been populated
Init script to be called after a connection with the database is made Displays entries present in previous semesters compared to the current one Assumes ` attendance ` table exists and has been populated