<commit_before>class OperatingSystemsController < InheritedResources::Base
  layout "admin"

  def index
    @operating_systems = OperatingSystem.arrange(order: [:name, :asc])
    @os_servers_count = Server.all.group_by(&:operating_system_id)
                                   .inject({}) { |memo,(k,v)| memo[k] = v.count; memo }
    @os_servers_count.default = 0
    if params[:graph_subtree]
      @root_os = OperatingSystem.find(params[:graph_subtree].to_s)
      @os_subtree = @root_os.descendants.arrange(order: [:name, :asc]) if @root_os.present?
    else
      @os_subtree = @operating_systems
    end
    @last_updated_server = Server.order_by(:updated_at.desc).first
    @last_updated_system = OperatingSystem.order_by(:updated_at.desc).first
  end

  def create
    create! { operating_systems_url }
  end

  def update
    update! { operating_systems_url }
  end
end
<commit_msg>Stringify keys in @os_servers_count in operating_systems/index, since the view expects @os.id.to_s<commit_after>class OperatingSystemsController < InheritedResources::Base
  layout "admin"

  def index
    @operating_systems = OperatingSystem.arrange(order: [:name, :asc])
    @os_servers_count = Server.all.group_by(&:operating_system_id)
                                  .inject({}) { |memo,(k,v)| memo[k.to_s] = v.count; memo }
    @os_servers_count.default = 0
    if params[:graph_subtree]
      @root_os = OperatingSystem.find(params[:graph_subtree].to_s)
      @os_subtree = @root_os.descendants.arrange(order: [:name, :asc]) if @root_os.present?
    else
      @os_subtree = @operating_systems
    end
    @last_updated_server = Server.order_by(:updated_at.desc).first
    @last_updated_system = OperatingSystem.order_by(:updated_at.desc).first
  end

  def create
    create! { operating_systems_url }
  end

  def update
    update! { operating_systems_url }
  end
end

{'fraction_non_alphanumeric': 0.11170497060395511, 'fraction_numerical': 0.0010689470871191875, 'mean_word_length': 3.68, 'pattern_counts': {'":': 0, '<': 5, '<?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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5518553', 'n_tokens_mistral': 646, 'n_tokens_neox': 621, 'n_words': 110}