<commit_before>class Category < ActiveRecord::Base
  acts_as_list
  has_and_belongs_to_many :articles, :order => "created_at DESC"
  
  def self.find_all_with_article_counters
    self.find_by_sql(%{
      SELECT id, name, permalink, position, COUNT(article_id) AS article_counter
      FROM categories LEFT OUTER JOIN articles_categories 
        ON articles_categories.category_id = categories.id
      GROUP BY categories.id, categories.name, categories.position<commit_msg>Fix category sidebar on Postgres<commit_after>class Category < ActiveRecord::Base
  acts_as_list
  has_and_belongs_to_many :articles, :order => "created_at DESC"
  
  def self.find_all_with_article_counters
    self.find_by_sql(%{
      SELECT id, name, permalink, position, COUNT(article_id) AS article_counter
      FROM categories LEFT OUTER JOIN articles_categories 
        ON articles_categories.category_id = categories.id
      GROUP BY categories.id, categories.name, categories.position, categories.permalink
{'fraction_non_alphanumeric': 0.06633165829145729, 'fraction_numerical': 0.0, 'mean_word_length': 4.757225433526012, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '7621647', 'n_tokens_mistral': 305, 'n_tokens_neox': 287, 'n_words': 72}