<commit_before>'use strict';

let log_iface = require("../backend/logger.js");
let systemLogger = log_iface.systemLogger;
let config = require("../backend/config.js");
let DB = require('../backend/db/db')(systemLogger);
let User = require('../backend/models/user');
let C = require("../backend/constants");
let ghosts = C.REPO_BLACKLIST_USERNAME;

DB.getDB('default').then( db => {
	// set db to singleton modelFactory class
	require('../backend/models/factory/modelFactory').setDB(db);

}).then(() => {
	
	let promises = [];
	
	ghosts.forEach(username => {
		promises.push(
			User.findByUserName(username).then(user => {

				if(user){
					console.log(`Ghost user ${username} already exists.`);
				} else {

					console.log(`Ghost user ${username} not found. Creating...`);

					return User.createUser(systemLogger, username, '', {}, -1).then(() => {
						console.log(`Ghost user ${username} created.`);
					}).catch(() => {
						console.log(`Failed to create ghost user ${username}`);<commit_msg>#222 fix create ghosts script<commit_after>'use strict';

let log_iface = require("../backend/logger.js");
let systemLogger = log_iface.systemLogger;
let config = require("../backend/config.js");
let DB = require('../backend/db/db')(systemLogger);
let User = require('../backend/models/user');
let C = require("../backend/constants");
let ghosts = C.REPO_BLACKLIST_USERNAME;

DB.getDB('default').then( db => {
	// set db to singleton modelFactory class
	require('../backend/models/factory/modelFactory').setDB(db);

}).then(() => {
	
	let promises = [];
	
	ghosts.forEach(username => {
		promises.push(
			User.findByUserName(username).then(user => {

				if(user){
					console.log(`Ghost user ${username} already exists.`);
				} else {

					console.log(`Ghost user ${username} not found. Creating...`);

					return User.createUser(systemLogger, username, '', { email: '<EMAIL>' }, -1).then(() => {
						console.log(`Ghost user ${username} created.`);
					}).catch(err => {
						console.log(`Failed to create ghost user ${username}`, err);
{'fraction_non_alphanumeric': 0.19444444444444445, 'fraction_numerical': 0.0024366471734892786, 'mean_word_length': 3.8764845605700713, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 16, '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': '3912225', 'n_tokens_mistral': 715, 'n_tokens_neox': 632, 'n_words': 138}