<commit_before>
/*
#     CloudBoost - Core Engine that powers Bakend as a Service
#     (c) 2014 HackerBay, Inc. 
#     CloudBoost may be freely distributed under the Apache 2 License
*/


var q = require('q');

module.exports = function () {

	return {
		sendEmail: function (appId, emailBody, emailSubject, query, isMasterKey) {
			var deferred = q.defer();
			global.customService.find(appId, 'User', { email: true }, null, null, null, {}, query, isMasterKey).then(function (data) {
				if (data.length != 0) {
					var emailPromises = [];
					for (var k in data) {
						if (data[k].email) {
							emailPromises.push(global.mailService.emailCampaign(appId, data[k].email, emailBody, emailSubject));
						}
					}
					q.all(emailPromises).then(function (data) {
						deferred.resolve(data);
					}, function (err) {
						deferred.reject(err);
					})
				} else {<commit_msg>changed query parameter position<commit_after>
/*
#     CloudBoost - Core Engine that powers Bakend as a Service
#     (c) 2014 HackerBay, Inc. 
#     CloudBoost may be freely distributed under the Apache 2 License
*/


var q = require('q');

module.exports = function () {

	return {
		sendEmail: function (appId, emailBody, emailSubject, query, isMasterKey) {
			var deferred = q.defer();
			global.customService.find(appId, query, 'User', { email: true }, null, null, null, {}, isMasterKey).then(function (data) {
				if (data.length != 0) {
					var emailPromises = [];
					for (var k in data) {
						if (data[k].email) {
							emailPromises.push(global.mailService.emailCampaign(appId, data[k].email, emailBody, emailSubject));
						}
					}
					q.all(emailPromises).then(function (data) {
						deferred.resolve(data);
					}, function (err) {
						deferred.reject(err);
					})
				} else {
{'fraction_non_alphanumeric': 0.1387800783435926, 'fraction_numerical': 0.006715165081141578, 'mean_word_length': 3.0821917808219177, 'pattern_counts': {'":': 0, '<': 3, '<?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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2845745', 'n_tokens_mistral': 704, 'n_tokens_neox': 563, 'n_words': 149}