<commit_before>angular.module('bizGramFactories', ['firebase'])

.factory('Rooms', ['$firebaseArray', function ($firebaseArray){

	var ref = new Firebase ('https://bizgramer.firebaseio.com/hr/messages');
	var messages = $firebaseArray(ref);

	// create a rooms object to store the room names. Loop through the messages,
	// and return all the room names. Storing the rooms in an object will automatically
	// remove any duplicate room names.
	var getRooms = function(){
		var rooms = {};
		for(var i = 0; i < messages.length; i++){
			rooms[messages[i].room] = null;
		}

		// Return the room names in an array;
		return Object.keys(rooms);
	};

	return {
		getRooms: getRooms
	};
}])

.factory('Users', ['$firebaseArray', function ($firebaseArray){

	var ref = new Firebase ('https://bizgramer.firebaseio.com/hr/users');
	var users = $firebaseArray(ref);

	// parse the usernames from the database
	var getUsers = function(){
		var usernames = [];
		for(var i = 0; i < users.length; i++){
			usernames.push(users[i].username);
		}

		// Return the usernames in an array
		return usernames;
	};

	return {
		getUsers: getUsers
	};
}])
.factory('Auth',['$firebaseAuth',function($firebaseAuth){
	var authFactory = {};
	var ref = new Firebase('https://bizgramer.firebaseio.com/');

	var authObj = $firebaseAuth(ref);
	var getAuth= function(callback){
		var authData = authObj.$getAuth();
		console.log(authData);
		callback(authData);
	};
  var signin = function(email,password,callback,vm){
    authObj.$authWithPassword({
        email: email,
        password: password
      }).then(function(authData){
      data = authData;
      console.log('logged in as '+authData.uid);
      callback(data);
    }).catch(function(error){
      console.log('Error:',error);
    });
  };
	var signup = function(email,password, callback, vm){
    var data = null;
    authObj.$createUser({
      email: email,
      password: password
    }).then(function(userData){
      console.log("User " + userData.uid + " created successfully!");
      signin(email,password,callback,vm);
    }).catch(function(error){
      console.log('Error:',error);
    });

	};
	return {
    getAuth: getAuth,
    signin: signin,
    signup: signup
  };
}]);<commit_msg>(bug) debugging why not retrieving data from database<commit_after>angular.module('bizGramFactories', ['firebase'])

.factory('Rooms', ['$firebaseArray', function ($firebaseArray){

	var roomsFactory = {};
	var ref = new Firebase('https://bizgramer.firebaseio.com/hr/messages');
	var messages = $firebaseArray(ref);

	// create a rooms object to store the room names. Loop through the messages,
	// and return all the room names. Storing the rooms in an object will automatically
	// remove any duplicate room names.
	roomsFactory.getRooms = function(){
		var rooms = {};
		for(var i = 0; i < messages.length; i++){
			rooms[messages[i].room] = null;
		}

		// Return the room names in an array;
		return Object.keys(rooms);
	};

	return roomsFactory;
}])

.factory('Users', ['$firebaseArray', function ($firebaseArray){


	var userFactory = {};
	var ref = new Firebase('https://bizgramer.firebaseio.com/hr/users');
	var users = $firebaseArray(ref);

	// parse the usernames from the database
	userFactory.getUsers = function(){
		debugger;
		console.log(users);
		var usernames = [];
		for(var i = 0; i < users.length; i++){
			usernames.push(users[i].username);
		}

		// Return the usernames in an array
		return usernames;
	};

	return userFactory;
}])

.factory('Auth',['$firebaseAuth',function($firebaseAuth){
	
	var authFactory = {};
	var ref = new Firebase('https://bizgramer.firebaseio.com/');

	var authObj = $firebaseAuth(ref);
	var getAuth= function(callback){
		var authData = authObj.$getAuth();
		console.log(authData);
		callback(authData);
	};
  var signin = function(email,password,callback,vm){
    authObj.$authWithPassword({
        email: email,
        password: password
      }).then(function(authData){
      data = authData;
      console.log('logged in as '+authData.uid);
      callback(data);
    }).catch(function(error){
      console.log('Error:',error);
    });
  };
	var signup = function(email,password, callback, vm){
    var data = null;
    authObj.$createUser({
      email: email,
      password: password
    }).then(function(userData){
      console.log("User " + userData.uid + " created successfully!");
      signin(email,password,callback,vm);
    }).catch(function(error){
      console.log('Error:',error);
    });

	};
	return {
    getAuth: getAuth,
    signin: signin,
    signup: signup
  };

}]);
{'fraction_non_alphanumeric': 0.15503706934147404, 'fraction_numerical': 0.0008722197993894462, 'mean_word_length': 3.6901840490797544, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 6, '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': '3809732', 'n_tokens_mistral': 1523, 'n_tokens_neox': 1451, 'n_words': 359}