<commit_before>var monetaFilters = angular.module('monetaFilters', []);

monetaFilters.filter('taskfilter', function ($filter) {
	return function(items, expression) {
		if (!expression) {
			return items;
		}

		expression = expression.toLowerCase().split(" ")

		var result = [];

		function match_tag(task, tag)
		{
			for (var t = 0; t < task.tags.length; t++)
			{
				if (task.tags[t].toLowerCase().indexOf(tag) > -1)
					return true;
			}

			return false;
		}

		function match_title(task, title)
		{
			return task.name.toLowerCase().indexOf(title) > -1;
		}

		function xor(a,b)
		{
			return ( a || b ) && !( a && b );
		}

		angular.forEach(items, function(task, taskid) {
			for (var i = 0; i < expression.length; i++)
			{
				var item = expression[i];

				var negate = false;
				if (item[0] == '-')
				{
					negate = true;
					item = item.substr(1);
				}
				
				if (item.lastIndexOf('tag:', 0) === 0)
				{
					item = item.substr(4);

					if (xor(negate, !match_tag(task, item)))
						return;
				}
				else if (item.lastIndexOf('title:', 0) === 0)
				{
					item = item.substr(6);
					if (xor(negate, !match_title(task, item)))
						return;
				}
				else 
				{
					if (xor(negate, !(match_title(task, item) || match_tag(task, item))))
						return;
				}
			}

			result.push(task);
		});

		return result;
	};
});


monetaFilters.filter('taskhastag', function ($filter) {
	return function(items, expression) {
		if (!expression) {
			return items;
		}

		if (expression[0] == "!") {
			negate = true;<commit_msg>Add pool: and enabled: filters.<commit_after>var monetaFilters = angular.module('monetaFilters', []);

monetaFilters.filter('taskfilter', function ($filter) {
	return function(items, expression) {
		if (!expression) {
			return items;
		}

		expression = expression.toLowerCase().split(" ")

		var result = [];

		function match_pool(task, pool)
		{
			for (var t = 0; t < task.pools.length; t++)
			{
				if (task.pools[t].toLowerCase().indexOf(pool) > -1)
					return true;
			}

			return false;
		}

		function match_tag(task, tag)
		{
			for (var t = 0; t < task.tags.length; t++)
			{
				if (task.tags[t].toLowerCase().indexOf(tag) > -1)
					return true;
			}

			return false;
		}

		function match_title(task, title)
		{
			return task.name.toLowerCase().indexOf(title) > -1;
		}

		function xor(a,b)
		{
			return ( a || b ) && !( a && b );
		}

		angular.forEach(items, function(task, taskid) {
			for (var i = 0; i < expression.length; i++)
			{
				var item = expression[i];

				var negate = false;
				if (item[0] == '-')
				{
					negate = true;
					item = item.substr(1);
				}
				
				if (item.lastIndexOf('tag:', 0) === 0)
				{
					item = item.substr(4);

					if (xor(negate, !match_tag(task, item)))
						return;
				}
				else if (item.lastIndexOf('pool:', 0) === 0)
				{
					item = item.substr(5);

					if (xor(negate, !match_pool(task, item)))
						return;
				}
				else if (item.lastIndexOf('title:', 0) === 0)
				{
					item = item.substr(6);
					if (xor(negate, !match_title(task, item)))
						return;
				}
				else if (item.lastIndexOf('enabled:', 0) === 0)
				{
					item = item.substr(8);
					if (item == 'false' || item == 'no')
						negate = !negate;

					if (xor(negate, !task.enabled))
						return;
				}
				else 
				{
					if (xor(negate, !(match_title(task, item) || match_tag(task, item))))
						return;
				}
			}

			result.push(task);
		});

		return result;
	};
});


monetaFilters.filter('taskhastag', function ($filter) {
	return function(items, expression) {
		if (!expression) {
			return items;
		}

		if (expression[0] == "!") {
			negate = true;
{'fraction_non_alphanumeric': 0.17745017745017744, 'fraction_numerical': 0.009282009282009281, 'mean_word_length': 2.5676728334956183, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, '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': '7077957', 'n_tokens_mistral': 1715, 'n_tokens_neox': 1329, 'n_words': 284}