<commit_before>module Cti
  class CallerId < ApplicationModel
    self.table_name = 'cti_caller_ids'

=begin

  Cti::CallerId.maybe_add(
    caller_id: '49123456789',
    comment: 'Hairdresser <NAME>, San Francisco', #optional
    level: 'maybe', # known|maybe
    user_id: 1, # optional
    object: 'Ticket',
    o_id: 123,
  )

=end

    def self.maybe_add(data)
      record = find_or_initialize_by(
        caller_id: data[:caller_id],
        level:     data[:level],
        object:    data[:object],
        o_id:      data[:o_id],
        user_id:   data[:user_id],
      )
      return if !record.new_record?
      record.comment = data[:comment]
      record.save!
    end
<commit_msg>maybe_add should always return the record<commit_after>module Cti
  class CallerId < ApplicationModel
    self.table_name = 'cti_caller_ids'

=begin

  Cti::CallerId.maybe_add(
    caller_id: '49123456789',
    comment: 'Hairdresser <NAME>, San Francisco', #optional
    level: 'maybe', # known|maybe
    user_id: 1, # optional
    object: 'Ticket',
    o_id: 123,
  )

=end

    def self.maybe_add(data)
      record = find_or_initialize_by(
        caller_id: data[:caller_id],
        level:     data[:level],
        object:    data[:object],
        o_id:      data[:o_id],
        user_id:   data[:user_id],
      )
      return record if !record.new_record?
      record.comment = data[:comment]
      record.save!
    end

{'fraction_non_alphanumeric': 0.11649122807017544, 'fraction_numerical': 0.021052631578947368, 'mean_word_length': 2.628498727735369, 'pattern_counts': {'":': 0, '<': 7, '<?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': '4596308', 'n_tokens_mistral': 519, 'n_tokens_neox': 492, 'n_words': 104}