lib/elevator-engine/elevator-engine.js
function(floors, options, callback) {
                if(floors && options && options.ascending === false) {
                    levelController.saveCurrentLevel(Level.create(options.identifierRange.min), function(error) {
                        if(error) {
                            logger.error('>>>> Stuck at floor ' + options.identifierRange.min + '. Failed to store the current level.');
                        }
                        return callback(error);
                    });                    
                } else {
                    return callback(null);
                }
            }
function(floors, options, callback) {
                if(floors && options && options.ascending === false) {
                    levelController.saveCurrentLevel(Level.create(options.identifierRange.min), function(error) {
                        if(error) {
                            logger.error('>>>> Stuck at floor ' + options.identifierRange.min + '. Failed to store the current level.');
                        }
                        return callback(error);
                    });                    
                } else {
                    return callback(null);
                }
            }
function ( floors , options , callback ) { if ( floors && options && options . ascending === false ) { levelController . saveCurrentLevel ( Level . create ( options . identifierRange . min ) , function ( error ) { if ( error ) { logger . error ( '>>>> Stuck at floor ' + options . identifierRange . min + '. Failed to store the current level.' ) ; } return callback ( error ) ; } ) ; } else { return callback ( null ) ; } }
Save the last level if going down, because the last level is not stored yet
Save the last level if going down because the last level is not stored yet