<commit_before>edition_translation_data = {
  526403 => ["en", "zh", "zh-tw"],
  654995  => ["cy", "en"],
  679612  => ["cy", "en"],
  505871  => ["cy", "en"],
  474060  => ["cy", "en"],
  698000  => ["cy", "en"],
  610495  => ["cy", "en"],
  630871  => ["cy", "en"],
  665884  => ["cy", "en"],
  599695  => ["cy", "en"],
  626791  => ["cy", "en"],
  440210  => ["cy", "en"],
  571531  => ["cy", "en"],
  537197  => ["cy", "en"],
  533156  => ["cy", "en"],
  545235  => ["cy", "en"],
  641072  => ["cy", "en"],
  647249  => ["en", "ja", "ko", "zh"],
}

edition_translation_data.each do |edition_id, locales|
  edition = Edition.find_by(id: edition_id)
  if edition
    edition_translation_locales = edition.translations.map(&:locale).map(&:to_s)
    locales.each do |locale|
      unless edition_translation_locales.include?(locale)
        alternative_url = Whitehall::UrlMaker.new.public_document_url(edition)
        explanation = "This translation is no longer available. You can find the original version of this content at [#{alternative_url}](#{alternative_url})"
        PublishingApiGoneWorker(edition.content_id, nil, explanation, locale, true)
      end
    end
  end
end<commit_msg>Fix data migration<commit_after>edition_translation_data = {
  526403 => ["en", "zh", "zh-tw"],
  654995  => ["cy", "en"],
  679612  => ["cy", "en"],
  505871  => ["cy", "en"],
  474060  => ["cy", "en"],
  698000  => ["cy", "en"],
  610495  => ["cy", "en"],
  630871  => ["cy", "en"],
  665884  => ["cy", "en"],
  599695  => ["cy", "en"],
  626791  => ["cy", "en"],
  440210  => ["cy", "en"],
  571531  => ["cy", "en"],
  537197  => ["cy", "en"],
  533156  => ["cy", "en"],
  545235  => ["cy", "en"],
  641072  => ["cy", "en"],
  647249  => ["en", "ja", "ko", "zh"],
}

edition_translation_data.each do |edition_id, locales|
  edition = Edition.find_by(id: edition_id)
  if edition
    edition_translation_locales = edition.translations.map(&:locale).map(&:to_s)
    locales.each do |locale|
      unless edition_translation_locales.include?(locale)
        alternative_url = Whitehall::UrlMaker.new.public_document_url(edition)
        explanation = "This translation is no longer available. You can find the original version of this content at [#{alternative_url}](#{alternative_url})"
        PublishingApiGoneWorker.perform_async(edition.content_id, nil, explanation, locale, true)
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.2098047361861238, 'fraction_numerical': 0.08973826339842127, 'mean_word_length': 3.8353413654618476, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 39, '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': '2146703', 'n_tokens_mistral': 1009, 'n_tokens_neox': 886, 'n_words': 207}