<commit_before>"use strict";

var db = require("./firebase");

// Ensure the updated timestamp is always accurate-ish
module.exports = function(ref) {
    ref.on("child_changed", function(snap) {
        var key = snap.key(),
            auth;
        
        // Avoid looping forever
        if(key === "updated_at" || key === "updated_by") {
            return;
        }
        
        auth = db.getAuth();
        
        // Clean up any old updated timestamps floating around
        ref.child("updated").remove();
        
        ref.child("updated_at").set(db.TIMESTAMP);
        ref.child("updated_by").set(auth.uid);
    });
};<commit_msg>Convert two .set() calls into one .update()<commit_after>"use strict";

var db = require("./firebase");

// Ensure the updated timestamp is always accurate-ish
module.exports = function(ref) {
    ref.on("child_changed", function(snap) {
        var key = snap.key(),
            auth;
        
        // Avoid looping forever
        if(key === "updated_at" || key === "updated_by") {
            return;
        }
        
        auth = db.getAuth();
        
        // Clean up any old updated timestamps floating around
        ref.child("updated").remove();
        
        ref.update({
            updated_at : db.TIMESTAMP,
            updated_by : auth.uid
        });
    });
};
{'fraction_non_alphanumeric': 0.140625, 'fraction_numerical': 0.0, 'mean_word_length': 1.8375527426160339, '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': '6839878', 'n_tokens_mistral': 377, 'n_tokens_neox': 378, 'n_words': 91}