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

	// super simple service
	// each function returns a promise object
	.factory('Todos', ['$http',function($http) {
		return {
			//WEB API SECTION
			get : function() {
				return $http.get('/api/todos');
			},
			create : function(todoData) {
				return $http.post('/api/todos', todoData);
			},
			delete : function(id) {
				return $http.delete('/api/todos/' + id);
			},
			update : function(todoData){
				return $http.put('/api/todos/'+ todoData._id, todoData)
			},
			//LOCAL MANIPULATION
			organise: function(current, index, array){
				var currentTime = new Date()
				if(current.locked){
					return current
				}

				if (array[index-1]) {
				  var previousEntry = array[index-1]
				  current.begin = new Date(previousEntry.end)
				  current.end = new Date(previousEntry.end.getTime() + current.duration*60000)//helperMethods.addMinutes(previousEntry.end, current.duration)
				} else {
				  current.begin = new Date(currentTime)
				  current.end = new Date(currentTime.getTime() + current.duration*60000)//helperMethods.addMinutes(currentTime, current.duration)
				}
				//if beginning/end time is after 5pm or beginning/end time is before 8am
				if (current.begin.getHours() >= 18 || current.begin.getHours() <= 8) {
				  var newTime = new Date()
				  newTime.setDate(current.begin.getDate() + 1)
				  newTime.setHours(9)
				  newTime.setMinutes(0)
				  current.begin = new Date(newTime)
				  current.end = new Date(current.begin.getTime() + current.duration*60000)
				}

				while(current.begin.getDay() >= 5)
				{
					current.begin.setDate(current.begin.getDate() + 1)
				}

				return current
		  },
			eventStream: function(inputEvents){
		    return inputEvents.filter(
		      function (current){
		        return current.active === true
		    })
		    .sort(
		      function (previous, current){
		        return current.duration - previous.duration
		    })
		    .sort(
		      function (previous, current){
		        return current.priority - previous.priority
		    })
		    .map(this.organise,[])
		  }

		}
	}]);
<commit_msg>changed scheduling algorithm to end at 1600<commit_after>angular.module('todoService', [])

	// super simple service
	// each function returns a promise object
	.factory('Todos', ['$http',function($http) {
		return {
			//WEB API SECTION
			get : function() {
				return $http.get('/api/todos');
			},
			create : function(todoData) {
				return $http.post('/api/todos', todoData);
			},
			delete : function(id) {
				return $http.delete('/api/todos/' + id);
			},
			update : function(todoData){
				return $http.put('/api/todos/'+ todoData._id, todoData)
			},
			//LOCAL MANIPULATION
			organise: function(current, index, array){
				var currentTime = new Date()
				if(current.locked){
					return current
				}

				if (array[index-1]) {
				  var previousEntry = array[index-1]
				  current.begin = new Date(previousEntry.end)
				  current.end = new Date(previousEntry.end.getTime() + current.duration*60000)//helperMethods.addMinutes(previousEntry.end, current.duration)
				} else {
				  current.begin = new Date(currentTime)
				  current.end = new Date(currentTime.getTime() + current.duration*60000)//helperMethods.addMinutes(currentTime, current.duration)
				}
				//if beginning/end time is after 5pm or beginning/end time is before 8am
				if (current.begin.getHours() >= 17 || current.begin.getHours() <= 8) {
				  var newTime = new Date()
				  newTime.setDate(current.begin.getDate() + 1)
				  newTime.setHours(9)
				  newTime.setMinutes(0)
				  current.begin = new Date(newTime)
				  current.end = new Date(current.begin.getTime() + current.duration*60000)
				}

				while(current.begin.getDay() >= 5)
				{
					current.begin.setDate(current.begin.getDate() + 1)
				}

				return current
		  },
			eventStream: function(inputEvents){
		    return inputEvents.filter(
		      function (current){
		        return current.active === true
		    })
		    .sort(
		      function (previous, current){
		        return current.duration - previous.duration
		    })
		    .sort(
		      function (previous, current){
		        return current.priority - previous.priority
		    })
		    .map(this.organise,[])
		  }

		}
	}]);

{'fraction_non_alphanumeric': 0.13911007025761124, 'fraction_numerical': 0.013583138173302109, 'mean_word_length': 2.743207712532866, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '6315562', 'n_tokens_mistral': 1688, 'n_tokens_neox': 1318, 'n_words': 272}