<commit_before>angular.module('pie')
.factory('documentService', function($http, apiBaseUrl) {
	return {
		currentDocument: undefined,
		get: function(id) {
			var t = this;
			var p = $http({
				method: "GET",
				url: apiBaseUrl + "/documents/" + id,
				withCredentials: true
			});
			p.success(function(data) {
				t.currentDocument = data;
			});
			return p;
		},
		post: function() {
			var p = $http({
				method: "POST",
				url: apiBaseUrl + "/documents",
				data : this.currentDocument,
				withCredentials: true
			});
			return p;
		},
		update: function() {
			var p = $http({
				method: "PUT",
				url: apiBaseUrl + "/documents/" + this.currentDocument._id,
				data : this.currentDocument,
				withCredentials: true
			});
			return p;
		},
		create: function() {
			this.currentDocument = {
				title: '',
				owner : '',
				collaborators : [],
				content: [
					{title: '', level: 1, discussions: [], owner : undefined},
					{title: '', level: 1, discussions: [], owner : undefined},
					{title: '', level: 1, discussions: [], owner : undefined}
				],
				docId: undefined,
				version: undefined
			};
		},
		downloadUrl: function(id) {
			return apiBaseUrl + '/documents/' + id + '.pdf';
		},
		newVersion: function() {
			console.log(' new version ');
			delete this.currentDocument._id;
			delete this.currentDocument._rev;
			_.each(this.currentDocument.content, function(elem) {
				elem.discussions = [];
			});
		}
	};
});
<commit_msg>Added filter for resolved/unresolved discussions<commit_after>angular.module('pie')
.factory('documentService', function($http, apiBaseUrl) {
	return {
		currentDocument: undefined,
		get: function(id) {
			var t = this;
			var p = $http({
				method: "GET",
				url: apiBaseUrl + "/documents/" + id,
				withCredentials: true
			});
			p.success(function(data) {
				t.currentDocument = data;
			});
			return p;
		},
		post: function() {
			var p = $http({
				method: "POST",
				url: apiBaseUrl + "/documents",
				data : this.currentDocument,
				withCredentials: true
			});
			return p;
		},
		update: function() {
			var p = $http({
				method: "PUT",
				url: apiBaseUrl + "/documents/" + this.currentDocument._id,
				data : this.currentDocument,
				withCredentials: true
			});
			return p;
		},
		create: function() {
			this.currentDocument = {
				title: '',
				owner : '',
				collaborators : [],
				content: [
					{title: '', level: 1, discussions: [], owner : undefined},
					{title: '', level: 1, discussions: [], owner : undefined},
					{title: '', level: 1, discussions: [], owner : undefined}
				],
				docId: undefined,
				version: undefined
			};
		},
		downloadUrl: function(id) {
			return apiBaseUrl + '/documents/' + id + '.pdf';
		},
		newVersion: function() {
			console.log(' new version ');
			delete this.currentDocument._id;
			delete this.currentDocument._rev;
			_.each(this.currentDocument.content, function(elem) {
				for (var i = 0 ; i < elem.discussions.length ; i++)
					if (elem.discussions[i].resolved)
						elem.discussions.splice(i, 1);
			});
		}
	};
});

{'fraction_non_alphanumeric': 0.16612589227774172, 'fraction_numerical': 0.0025957170668397143, 'mean_word_length': 2.90253164556962, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4362412', 'n_tokens_mistral': 1256, 'n_tokens_neox': 982, 'n_words': 232}