<commit_before>function CourseRegistrationViewModel(registration) {
    this.titleFact = ko.observableArray();
    this.title = ko.computed(function () {
        return this.titleFact() ? this.titleFact().value : '';
    }, this);
    this.noteFacts = ko.observableArray();
    this.noteValue = ko.observable();
    this.noteChanged = ko.observable(false);
    this.notes = ko.computed({
        read: function () {
            if (this.noteChanged()) {
                return this.noteValue();
            }
            else {
                return this.noteFacts().reduce(function (sum, candidate) {
                    if (sum) {
                        return sum + '\n' + candidate.value;
                    }
                    else {
                        return candidate.value;
                    }
                }, '');
            }
        },
        write: function (value) {
            this.noteValue(value);
            this.noteChanged(true);
        },
        owner: this
    });
    this.registrations = ko.observableArray();

    this.agree = function () {
        j.fact(registration);
        if (this.noteChanged() && this.noteFacts.length !== 1 || this.noteFacts()[0].value !== this.noteValue()) {
            j.fact(createCourseRegistrationNote(registration.user, registration, this.noteValue(), this.noteFacts()));
        }
        $('#course-registration-dialog').modal('toggle');
    }
    this.save = function () {
        if (this.noteChanged() && this.noteFacts.length !== 1 || this.noteFacts()[0].value !== this.noteValue()) {
            j.fact(createCourseRegistrationNote(registration.user, registration, this.noteValue(), this.noteFacts()));
        }
        $('#course-registered-dialog').modal('toggle');
    }
    this.cancel = function () {
        if (window.confirm('Do you want to cancel your registration?')) {<commit_msg>Fixed predecence of note check.<commit_after>function CourseRegistrationViewModel(registration) {
    this.titleFact = ko.observableArray();
    this.title = ko.computed(function () {
        return this.titleFact() ? this.titleFact().value : '';
    }, this);
    this.noteFacts = ko.observableArray();
    this.noteValue = ko.observable();
    this.noteChanged = ko.observable(false);
    this.notes = ko.computed({
        read: function () {
            if (this.noteChanged()) {
                return this.noteValue();
            }
            else {
                return this.noteFacts().reduce(function (sum, candidate) {
                    if (sum) {
                        return sum + '\n' + candidate.value;
                    }
                    else {
                        return candidate.value;
                    }
                }, '');
            }
        },
        write: function (value) {
            this.noteValue(value);
            this.noteChanged(true);
        },
        owner: this
    });
    this.registrations = ko.observableArray();

    this.agree = function () {
        j.fact(registration);
        if (this.noteChanged() && (this.noteFacts.length !== 1 || this.noteFacts()[0].value !== this.noteValue())) {
            j.fact(createCourseRegistrationNote(registration.user, registration, this.noteValue(), this.noteFacts()));
        }
        $('#course-registration-dialog').modal('toggle');
    }
    this.save = function () {
        if (this.noteChanged() && (this.noteFacts.length !== 1 || this.noteFacts()[0].value !== this.noteValue())) {
            j.fact(createCourseRegistrationNote(registration.user, registration, this.noteValue(), this.noteFacts()));
        }
        $('#course-registered-dialog').modal('toggle');
    }
    this.cancel = function () {
        if (window.confirm('Do you want to cancel your registration?')) {
{'fraction_non_alphanumeric': 0.14804025423728814, 'fraction_numerical': 0.00211864406779661, 'mean_word_length': 1.9461778471138846, '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': '6513769', 'n_tokens_mistral': 1023, 'n_tokens_neox': 982, 'n_words': 172}