<commit_before>function(newDoc, oldDoc, userCtx) {
    // The user has to be logged in to perform updates
    if (!userCtx || userCtx.name == null) {
        throw({"unauthorized" : {"summary": "You must be logged in to add or edit records."}});
    }
    else {
        // If the user is logged in, we report remaining errors all at once
        var errors = [];

        var ValidTypes = ["ALIAS", "TRANSFORMATION","TRANSLATION","GENERAL","OPERATOR"];
        var ValidStatus = ["active","unreviewed","candidate","deleted"];

        if (!newDoc.type) {
            errors.push({"type" : "Record type is required."});
        }
        else {
            if (ValidTypes.indexOf(newDoc.type) == -1) {
                errors.push({"type" : "Record type '" + newDoc.type + " is not valid."});
            }
        }

        if (!newDoc.status) {
            errors.push({"status" : "Status is required."});
        }
        else {
            if (ValidStatus.indexOf(newDoc.status) == -1) {
                errors.push({"status" : "Status '" + newDoc.status + "' is not valid."});
            }
        }

        // The uniqueId can never be null
        if (!newDoc.uniqueId) {
            errors.push({"uniqueId" : "Unique ID is required."});
        }
        else {
            // if the record type is GENERAL, the uniqueId must be in lowerCamelCase
            if (newDoc.type && newDoc.type == "GENERAL" && !isLowerCamelCase(newDoc.uniqueId)) {<commit_msg>Added check to confirm that the "updated" field is set and is being set to a valid date per CTR-76.<commit_after>function(newDoc, oldDoc, userCtx) {
    // The user has to be logged in to perform updates
    if (!userCtx || userCtx.name == null) {
        throw({"unauthorized" : {"summary": "You must be logged in to add or edit records."}});
    }
    else {
        // If the user is logged in, we report remaining errors all at once
        var errors = [];

        var ValidTypes = ["ALIAS", "TRANSFORMATION","TRANSLATION","GENERAL","OPERATOR"];
        var ValidStatus = ["active","unreviewed","candidate","deleted"];

        // Set the date of the last update to a user-specified date and time or to today's date and time if no value is specified.
        if (newDoc.updated) {
            var newDate = new Date(newDoc.updated);
            if (newDate.getTime() > 0 ) {
            }
            // The user didn't pass a usable date.  Throw an error.
            else {
                errors.push({"updated" : "Date of last update '" + newDoc.updated + " is not valid."});
            }
        }
        else {
            errors.push({"updated" : "You must provide date at which this record was last updated."});
        }

        if (!newDoc.type) {
            errors.push({"type" : "Record type is required."});
        }
        else {
            if (ValidTypes.indexOf(newDoc.type) == -1) {
                errors.push({"type" : "Record type '" + newDoc.type + " is not valid."});
            }
        }

        if (!newDoc.status) {
            errors.push({"status" : "Status is required."});
        }
        else {
            if (ValidStatus.indexOf(newDoc.status) == -1) {
                errors.push({"status" : "Status '" + newDoc.status + "' is not valid."});
            }
        }

        // The uniqueId can never be null
        if (!newDoc.uniqueId) {
            errors.push({"uniqueId" : "Unique ID is required."});
        }
        else {
            // if the record type is GENERAL, the uniqueId must be in lowerCamelCase
            if (newDoc.type && newDoc.type == "GENERAL" && !isLowerCamelCase(newDoc.uniqueId)) {
{'fraction_non_alphanumeric': 0.13770311209033323, 'fraction_numerical': 0.0019278435692646654, 'mean_word_length': 1.89402390438247, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 4, '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': '1865848', 'n_tokens_mistral': 1037, 'n_tokens_neox': 1019, 'n_words': 319}