<commit_before>'use strict';
app.factory('classFactory', function ($q, $http, FBCreds) {

	//saves fb url
	let url = FBCreds.databaseURL;

	// returns array with class names, uid, and uglyId
	const makeArray = (obj) => {
		return Object.keys(obj).map(key => {
			obj[key].id = key;
			return obj[key];
		});
	};

	//shows all classes associated with current user
	const getAllClasses = (userId) => {
		return $q((resolve, reject) => {
			$http.get(`${url}/classes.json?orderBy="uid"&equalTo="${userId}"`)
				.then(classes => resolve(makeArray(classes.data)))
				.catch(error => console.log("error from getAllClasses", error.message));
		});
	};

	//gets one class object by class uglyId
	const getSingleClass = (uglyId) => {
		return $q((resolve, reject) => {
			$http.get(`${url}/classes/${uglyId}.json`)
				.then(classes => {
					classes.data.id = uglyId;
					console.log("classes from getSingleClass", classes.data);
					resolve(classes.data);
				})
				.catch(error => console.log("error from getSingleClass", error.message));
		});
	};

	//adds new class to classes collection w/ object taken from classesCtrl
	const postClass = (classInfo) => {
		let newClass = JSON.stringify(classInfo);
		return $http.post(`${url}/classes.json`, newClass)
			.then(data => console.log("data from postStudents", data))
			.catch(error => console.log("error from postStudents", error.message));
	};

	//removes class from classes collection by ID<commit_msg>posts new class w/o errors<commit_after>'use strict';
app.factory('classFactory', function ($q, $http, FBCreds) {

	//saves fb url
	let url = FBCreds.databaseURL;

	// returns array with class names, uid, and uglyId
	const makeArray = (obj) => {
		return Object.keys(obj).map(key => {
			obj[key].id = key;
			return obj[key];
		});
	};

	//shows all classes associated with current user
	const getAllClasses = (userId) => {
		return $q((resolve, reject) => {
			$http.get(`${url}/classes.json?orderBy="uid"&equalTo="${userId}"`)
				.then(classes => resolve(makeArray(classes.data)))
				.catch(error => console.log("error from getAllClasses", error.message));
		});
	};

	//gets one class object by class uglyId
	const getSingleClass = (uglyId) => {
		return $q((resolve, reject) => {
			$http.get(`${url}/classes/${uglyId}.json`)
				.then(classes => {
					classes.data.id = uglyId;
					console.log("classes from getSingleClass", classes.data);
					resolve(classes.data);
				})
				.catch(error => console.log("error from getSingleClass", error.message));
		});
	};

	//adds new class to classes collection w/ object taken from classesCtrl
	const postClass = (classInfo) => {
		let newClass = angular.toJson(classInfo);
		return $http.post(`${url}/classes.json`, newClass)
			.then(data => console.log("data from postClass", data))
			.catch(error => console.log("error from postClass", error.message));
	};

	//removes class from classes collection by ID
{'fraction_non_alphanumeric': 0.16900925608501885, 'fraction_numerical': 0.0, 'mean_word_length': 3.9625850340136055, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 29, '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': '1981521', 'n_tokens_mistral': 1034, 'n_tokens_neox': 929, 'n_words': 233}