<commit_before>var writeToFolder = require("modules/template").writeToFolder;
var eachTemplate = require("../each/template");
var Template = require("models/template");
var async = require("async");
var shouldWrite = {};

eachTemplate(
  function (user, blog, template, next) {
    if (!template) return next();

    if (blog.hideDates) {
      template.locals.hide_dates = true;
    }

    template.locals.date_display = blog.dateDisplay;

    if (template.localEditing) shouldWrite[template.id] = blog.id;
    console.log("Changed", template.id);
    Template.setMetadata(template.id, template.locals, next);
  },
  function () {
    console.log();
    console.log("Checking to see if any templates need to be written...");
    async.eachOfSeries(<commit_msg>Updates script to migrate date settings<commit_after>var eachTemplate = require("../each/template");
var writeToFolder = require("models/template").writeToFolder;
var Template = require("models/template");
var async = require("async");
var shouldWrite = {};

eachTemplate(
  function (user, blog, template, next) {
    if (!template) return next();

    let hide_dates = blog.hideDates === true;
    let date_display = blog.dateDisplay;
    let changes = false;

    if (hide_dates !== template.locals.hide_dates) {
      template.locals.hide_dates = hide_dates;
      changes = true;
    }

    if (date_display !== template.locals.date_display) {
      template.locals.date_display = blog.dateDisplay;
      changes = true;
    }

    if (changes) {
      console.log("Changed", template.id);
      if (template.localEditing) shouldWrite[template.id] = blog.id;

      Template.setMetadata(template.id, { locals: template.locals }, next);
    } else {
      next();
    }
  },
  function () {
    console.log();
    console.log("Checking to see if any templates need to be written...");
    async.eachOfSeries(
{'fraction_non_alphanumeric': 0.1388147357180993, 'fraction_numerical': 0.0, 'mean_word_length': 3.593137254901961, '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': '1675318', 'n_tokens_mistral': 558, 'n_tokens_neox': 547, 'n_words': 131}