<commit_before>class WelcomeController < ApplicationController
  def index
    @total_invoiced = Invoice.all.map{|i| i.total}.sum
    @total_payments_received = Payment.sum :amount
    @total_invoices_unpaid = @total_invoiced - @total_payments_received
  end

  def about
    adapter = Rails.configuration.database_configuration[Rails.env]['adapter']
    if adapter == 'sqlite3'
      @db_server_version = ActiveRecord::Base.connection.execute('select sqlite_version()')[0][0]
      @db_adapter = "SQLite3"
    elsif adapter == 'postgresql'
      @db_server_version = ActiveRecord::Base.connection.execute('select version()').first['version']
      @db_adapter = "PostgreSQL"
    else
      @db_adapter = "Database"
      @db_server_version = "unknown"
    end
  end
end<commit_msg>Fix display of postgresql version info<commit_after>class WelcomeController < ApplicationController
  def index
    @total_invoiced = Invoice.all.map{|i| i.total}.sum
    @total_payments_received = Payment.sum :amount
    @total_invoices_unpaid = @total_invoiced - @total_payments_received
  end

  def about
    adapter = Rails.configuration.database_configuration[Rails.env]['adapter']
    url = Rails.configuration.database_configuration[Rails.env]['url']
    if adapter == 'sqlite3'
      @db_server_version = ActiveRecord::Base.connection.execute('select sqlite_version()')[0][0]
      @db_adapter = "SQLite3"
    elsif adapter == 'postgresql' || /^postgresql/ =~ url
      @db_server_version = ActiveRecord::Base.connection.execute('select version()').first['version']
      @db_adapter = "PostgreSQL"
    else
      @db_adapter = "Database"
      @db_server_version = "unknown"
    end
  end
end
{'fraction_non_alphanumeric': 0.1169833729216152, 'fraction_numerical': 0.004750593824228029, 'mean_word_length': 4.332278481012659, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2748326', 'n_tokens_mistral': 532, 'n_tokens_neox': 516, 'n_words': 94}