function initQuickInsertEventTableIntoAttendance(tableName) {

	var total = 0;
	mysql.query('SELECT * FROM `' + tableName +'`', function(err, rows) {

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

			if(rows[i].is_new != 1) {
				rows[i].is_new = 0;
			}

			mysql.query('INSERT INTO `attendance` (student_id, event_id, is_new) VALUES ("' + rows[i].student_id + '", "' + tableName + '", "' + rows[i].is_new + '")', function(err) {
				
				total++;

				console.log(total);

			});
		}
	});

}
/**
 * Init script, to be called after a connection with the database is made
 * Takes a table name and inserts its contents into `attendance`
 *
 * @param tableName String name of table
 */
Init script, to be called after a connection with the database is made
Takes a table name and inserts its contents into `attendance`

@param tableName String name of table
Init script to be called after a connection with the database is made Takes a table name and inserts its contents into ` attendance ` @param tableName String name of table
function initQuickInsertEventTableIntoAttendance(tableName) {
	var total = 0;
	mysql.query('SELECT * FROM `' + tableName +'`', function(err, rows) {
		for(var i = 0; i < rows.length; i++) {
			if(rows[i].is_new != 1) {
				rows[i].is_new = 0;
			}
			mysql.query('INSERT INTO `attendance` (student_id, event_id, is_new) VALUES ("' + rows[i].student_id + '", "' + tableName + '", "' + rows[i].is_new + '")', function(err) {
				total++;
				console.log(total);
			});
		}
	});
}
function initQuickInsertEventTableIntoAttendance ( tableName ) { var total = 0 ; mysql . query ( 'SELECT * FROM `' + tableName + '`' , function ( err , rows ) { for ( var i = 0 ; i < rows . length ; i ++ ) { if ( rows [ i ] . is_new != 1 ) { rows [ i ] . is_new = 0 ; } mysql . query ( 'INSERT INTO `attendance` (student_id, event_id, is_new) VALUES ("' + rows [ i ] . student_id + '", "' + tableName + '", "' + rows [ i ] . is_new + '")' , function ( err ) { total ++ ; console . log ( total ) ; } ) ; } } ) ; }
Init script, to be called after a connection with the database is made
 Takes a table name and inserts its contents into `attendance`
Init script to be called after a connection with the database is made Takes a table name and inserts its contents into ` attendance `