module SectionsHelper

  def all_sections
    section_tags = TagRepository.load_all(:type => 'section')
    section_tags.map { |tag| [tag.title, tag.tag_id] }
  end
end
module SectionsHelper

  def all_sections
    section_tags = TagRepository.load_all(:type => 'section')

    title_counts = Hash.new(0)
    section_tags.each { |tag| title_counts[tag.title] += 1 }

    section_tags.map do |tag|
      # Annotate tags, where necessary, with their IDs
      if title_counts[tag.title] > 1
        display_name = "#{tag.title} [#{tag.tag_id}]"
      else
        display_name = tag.title
      end
      [display_name, tag.tag_id]
    end
  end
end

Annotate ambiguous sections with their IDs.
Annotate ambiguous sections with their IDs.

This problem should go away as we migrate the section data in future
and, for instance, have a single 'Children' section.
