<commit_before>'use strict';

var ensureDatabase = require('dbjs/valid-dbjs')
  , debug          = require('debug-ext')('sent-back-trigger')
  , setupTriggers  = require('../_setup-triggers');

module.exports = function (db) {
	var businessProcesses = ensureDatabase(db).BusinessProcess.instances
		.filterByKey('isFromEregistrations', true)
		.filterByKey('isSentBack', false);

	setupTriggers({
		trigger: businessProcesses.filterByKey('sentBackSteps',
			function (steps) { return steps.size > 0; })
	}, function (businessProcess) {
		debug('on for %s', businessProcess.__id__);
		businessProcess.isSentBack = true;<commit_msg>Fix sentBackTrivver<commit_after>'use strict';

var ensureDatabase = require('dbjs/valid-dbjs')
  , debug          = require('debug-ext')('sent-back-trigger')
  , setupTriggers  = require('../_setup-triggers');

module.exports = function (db) {
	var businessProcesses = ensureDatabase(db).BusinessProcess.instances
		.filterByKey('isFromEregistrations', true)
		.filterByKey('isSubmitted', true)
		.filterByKey('isSentBack', false);

	setupTriggers({
		preTrigger: businessProcesses.filterByKey('sentBackSteps',
			function (steps) { return !steps.size; }),
		trigger: businessProcesses.filterByKey('sentBackSteps',
			function (steps) { return steps.size > 0; })
	}, function (businessProcess) {
		debug('on for %s', businessProcess.__id__);
		businessProcess.isSentBack = true;
{'fraction_non_alphanumeric': 0.14549325762952448, 'fraction_numerical': 0.0014194464158978, 'mean_word_length': 5.409090909090909, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '4609163', 'n_tokens_mistral': 459, 'n_tokens_neox': 439, 'n_words': 78}