<commit_before>class Manufacturer < ActiveRecord::Base

  has_many :assets

  # default scope
  default_scope { order('code') }

  # Manufacturers that are maked as active
  scope :active, -> { where(:active => true) }
  # Notices that are active and visible for a specific organization
  scope :active_for_asset_type, -> (asset_type) { active.where("filter = ?", asset_type.class_name) }

  def self.search(text, filter, exact = true)
    if exact
      x = where('(name = ? OR code = ?) AND filter = ?', text, text, filter)
    else
      val = "%#{text}%"
      x = where('(name LIKE ? OR code LIKE ?) AND filter = ?', val, val, filter)
    end
    x.first
  end


  def asset_count(org)
    Asset.where(:organization_id => org.id, :manufacturer_id => id).count
  end

  def full_name
    name<commit_msg>set manufacturer list to always be vehicle list unless Equipment TTPLAT-31<commit_after>class Manufacturer < ActiveRecord::Base

  has_many :assets

  # default scope
  default_scope { order('code') }

  # Manufacturers that are maked as active
  scope :active, -> { where(:active => true) }
  # Notices that are active and visible for a specific organization
  scope :active_for_asset_type, -> (asset_type) { asset_type.class_name == 'Equpiment' ? active.where(filter: asset_type.class_name) : active.where(filter: 'Vehicle') }


  def self.search(text, filter, exact = true)
    if exact
      x = where('(name = ? OR code = ?) AND filter = ?', text, text, filter)
    else
      val = "%#{text}%"
      x = where('(name LIKE ? OR code LIKE ?) AND filter = ?', val, val, filter)
    end
    x.first
  end


  def asset_count(org)
    Asset.where(:organization_id => org.id, :manufacturer_id => id).count
  end

  def full_name
    name
{'fraction_non_alphanumeric': 0.12378223495702005, 'fraction_numerical': 0.001146131805157593, 'mean_word_length': 3.386934673366834, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, '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': '5687553', 'n_tokens_mistral': 573, 'n_tokens_neox': 546, 'n_words': 167}