<commit_before>var BaseView = require('../../lib/base_view');
var template = require('./templates/count_editor');
var app = require('../../application');

var colorSet = require('../../helper/color_set');

var CountEditorView = BaseView.extend({
	id: 'count-editor-screen',
	template: template,

	events: {
		'click #submit-editor':	'submitEditor',
		'click #add-user'			: 'addUser',
		'click .currency'			: 'setCurrency',
	},


	initialize: function (params) {

    console.log('initialize');
    this.userList = [];
    this.currencies = [];
    this.countName = '';
    this.nameIsUsed = false;

		this.count = params.countId;
		BaseView.prototype.initialize.call(this);
	},


	render: function () {
    console.log('render')
    BaseView.prototype.render.call(this);
    console.log('afterRender')
		this.$('#input-name')[0].addEventListener('change', (function(_this) {
      console.log('event')
			return function (event) {_this.checkCountName(event);};
		})(this));
	},


	checkCountName(event) {
    console.log('checkCountname');
		var countName = event.target.value;

		var nameIsTaken = window.countCollection.find(function (elem) {
			if (elem.get('name')== countName) {
				return true;
			}
			return false;
		});

    console.log('count: ', nameIsTaken)
    if (nameIsTaken === undefined || nameIsTaken === null) {
      console.log('enter in archive');
      var nameIsTaken = window.archiveCollection.find(function (elem) {
        if (elem.get('name')== countName) {
          return true;
        }
        return false;
      });
    console.log('archive: ', nameIsTaken)
    }

    console.log('end: ', nameIsTaken)
		var inputGrp = this.$('#input-name-grp');
		if (nameIsTaken !== null && nameIsTaken !== undefined) {
			if (this.nameIsUsed === false) {
				inputGrp.addClass('has-error');
				inputGrp.append('<div id="name-used" class="alert alert-danger" role="alert">Name already use</div>');
				this.nameIsUsed = true;
			}
		} else {
				if (this.nameIsUsed === true) {
					this.$('#name-used').remove();
					inputGrp.removeClass('has-error');
					this.nameIsUsed = false;
				}
				this.countName = countName;
		}
	},

<commit_msg>Removes logs because problem solved! My instance had lot's of bugs<commit_after>var BaseView = require('../../lib/base_view');
var template = require('./templates/count_editor');
var app = require('../../application');

var colorSet = require('../../helper/color_set');

var CountEditorView = BaseView.extend({
	id: 'count-editor-screen',
	template: template,

	events: {
		'click #submit-editor':	'submitEditor',
		'click #add-user'			: 'addUser',
		'click .currency'			: 'setCurrency',
	},


	initialize: function (params) {

    this.userList = [];
    this.currencies = [];
    this.countName = '';
    this.nameIsUsed = false;

		this.count = params.countId;
		BaseView.prototype.initialize.call(this);
	},


	render: function () {
    BaseView.prototype.render.call(this);
		this.$('#input-name')[0].addEventListener('change', (function(_this) {
			return function (event) {_this.checkCountName(event);};
		})(this));
	},


	checkCountName(event) {
		var countName = event.target.value;

		var nameIsTaken = window.countCollection.find(function (elem) {
			if (elem.get('name')== countName) {
				return true;
			}
			return false;
		});

    if (nameIsTaken === undefined || nameIsTaken === null) {
      var nameIsTaken = window.archiveCollection.find(function (elem) {
        if (elem.get('name')== countName) {
          return true;
        }
        return false;
      });
    }

		var inputGrp = this.$('#input-name-grp');
		if (nameIsTaken !== null && nameIsTaken !== undefined) {
			if (this.nameIsUsed === false) {
				inputGrp.addClass('has-error');
				inputGrp.append('<div id="name-used" class="alert alert-danger" role="alert">Name already use</div>');
				this.nameIsUsed = true;
			}
		} else {
				if (this.nameIsUsed === true) {
					this.$('#name-used').remove();
					inputGrp.removeClass('has-error');
					this.nameIsUsed = false;
				}
				this.countName = countName;
		}
	},


{'fraction_non_alphanumeric': 0.17771232204221896, 'fraction_numerical': 0.0004909180166912126, 'mean_word_length': 3.312169312169312, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '4933375', 'n_tokens_mistral': 1460, 'n_tokens_neox': 1313, 'n_words': 248}