<commit_before>require "adapters"

class Section::ReorderService
  def initialize(user:, manual_id:, section_order:)
    @user = user
    @manual_id = manual_id
    @section_order = section_order
  end

  def call
    manual.draft
    manual.reorder_sections(section_order)
    manual.save(user)
    export_draft_manual_to_publishing_api

    [manual, sections]
  end

private

  attr_reader :user, :manual_id, :section_order

  def sections
    manual.sections
  end

  def manual
    @manual ||= Manual.find(manual_id, user)
  end

  def export_draft_manual_to_publishing_api
    Adapters.publishing.save(manual, include_sections: false)<commit_msg>Inline Section::ReorderService#sections<commit_after>require "adapters"

class Section::ReorderService
  def initialize(user:, manual_id:, section_order:)
    @user = user
    @manual_id = manual_id
    @section_order = section_order
  end

  def call
    manual.draft
    manual.reorder_sections(section_order)
    manual.save(user)
    export_draft_manual_to_publishing_api

    [manual, manual.sections]
  end

private

  attr_reader :user, :manual_id, :section_order

  def manual
    @manual ||= Manual.find(manual_id, user)
  end

  def export_draft_manual_to_publishing_api
    Adapters.publishing.save(manual, include_sections: false)
{'fraction_non_alphanumeric': 0.07965970610982212, 'fraction_numerical': 0.0, 'mean_word_length': 4.369294605809128, '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': '2124502', 'n_tokens_mistral': 451, 'n_tokens_neox': 415, 'n_words': 84}