<commit_before>namespace :taproot do
  namespace :update do

    task :one_one => :environment do
      Template.all.each do |template|

        slug = template.slug.gsub(/\-/, '_')

        children = []
        template.children.each do |child|
          unless child.blank?
            children << child.gsub(/\-/, '_')
          end
        end

        template.update!(
          :can_be_root => true,
          :slug => slug,
          :children => children
        )

        template.page_templates.split("\n").reject(&:blank?).each do |pt|
          if pt == template.slug
            template.add_default_fields
          else
            new_template = template.dup
            new_template.slug = pt
            new_template.save!

            template.template_groups.each do |group|
              new_group = group.dup
              new_group.template = new_template
              new_group.save!
<commit_msg>fixes #86 -- update template title when creating new template on update task<commit_after>namespace :taproot do
  namespace :update do

    task :one_one => :environment do
      Template.all.each do |template|

        slug = template.slug.gsub(/\-/, '_')

        children = []
        template.children.each do |child|
          unless child.blank?
            children << child.gsub(/\-/, '_')
          end
        end

        template.update!(
          :can_be_root => true,
          :slug => slug,
          :children => children
        )

        template.page_templates.split("\n").reject(&:blank?).each do |pt|
          pt = pt.strip
          if pt == template.slug
            template.add_default_fields
          else
            new_template = template.dup
            new_template.slug = pt
            new_template.title = pt.titleize
            new_template.save!

            template.template_groups.each do |group|
              new_group = group.dup
              new_group.template = new_template
              new_group.save!

{'fraction_non_alphanumeric': 0.10202020202020202, 'fraction_numerical': 0.00101010101010101, 'mean_word_length': 1.5929319371727748, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, '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': '5092106', 'n_tokens_mistral': 541, 'n_tokens_neox': 529, 'n_words': 121}