<commit_before>class Enrollee
  include Mongoid::Document
  include Mongoid::Timestamps

  BENEFIT_STATUS_CODE_LIST      = ["active", "cobra", "surving insured", "tefra"]
  EMPLOYMENT_STATUS_CODE_LIST   = ["active", "full-time", "part-time", "retired", "terminated"]
  RELATIONSHIP_STATUS_CODE_LIST = ["self", "spouse", "child", "ward"]  

  include MergingModel

  field :m_id, as: :hbx_member_id, type: String

  field :ds, as: :disabled_status, type: Boolean, default: false
  field :ben_stat, as: :benefit_status_code, type: String
  field :emp_stat, as: :employment_status_code, type: String
  field :rel_code, as: :relationship_status_code, type: String

  field :c_id, as: :carrier_member_id, type: String
  field :cp_id, as: :carrier_policy_id, type: String
  field :pre_amt, as: :premium_amount, type: BigDecimal
  field :coverage_start, type: Date
  field :coverage_end, type: Date
  field :coverage_status, type: String, default: "active"

  embedded_in :policy

  validates_presence_of :m_id, :relationship_status_code

  validates_inclusion_of :benefit_status_code, in: BENEFIT_STATUS_CODE_LIST
  validates_inclusion_of :employment_status_code, in: EMPLOYMENT_STATUS_CODE_LIST
  validates_inclusion_of :relationship_status_code, in: RELATIONSHIP_STATUS_CODE_LIST

  def person
    Person.where({
      "members.hbx_member_id" => m_id}).first
  end

  def member
    Member.find_for_member_id(self.m_id)
  end


  def merge_enrollee(m_enrollee, p_action)
    merge_without_blanking(
      m_enrollee,
      :pre_amt,
      :c_id,
      :cp_id,
      :coverage_start,
      :coverage_end,
      :ben_stat,
      :rel_code,
      :emp_stat,
      :ds
    )
    case p_action
    when :add
      self.coverage_status = 'active'
      self.coverage_end = nil
      if subscriber?
        self.policy.aasm_state = "submitted"<commit_msg>Enrollee#member to call member query directly, instead of calling through Member<commit_after>class Enrollee
  include Mongoid::Document
  include Mongoid::Timestamps

  BENEFIT_STATUS_CODE_LIST      = ["active", "cobra", "surving insured", "tefra"]
  EMPLOYMENT_STATUS_CODE_LIST   = ["active", "full-time", "part-time", "retired", "terminated"]
  RELATIONSHIP_STATUS_CODE_LIST = ["self", "spouse", "child", "ward"]  

  include MergingModel

  field :m_id, as: :hbx_member_id, type: String

  field :ds, as: :disabled_status, type: Boolean, default: false
  field :ben_stat, as: :benefit_status_code, type: String
  field :emp_stat, as: :employment_status_code, type: String
  field :rel_code, as: :relationship_status_code, type: String

  field :c_id, as: :carrier_member_id, type: String
  field :cp_id, as: :carrier_policy_id, type: String
  field :pre_amt, as: :premium_amount, type: BigDecimal
  field :coverage_start, type: Date
  field :coverage_end, type: Date
  field :coverage_status, type: String, default: "active"

  embedded_in :policy

  validates_presence_of :m_id, :relationship_status_code

  validates_inclusion_of :benefit_status_code, in: BENEFIT_STATUS_CODE_LIST
  validates_inclusion_of :employment_status_code, in: EMPLOYMENT_STATUS_CODE_LIST
  validates_inclusion_of :relationship_status_code, in: RELATIONSHIP_STATUS_CODE_LIST

  def person
    Person.where({
      "members.hbx_member_id" => m_id}).first
  end

  def member
    MemberByHBXIDQuery.new(m_id).execute
  end

  def merge_enrollee(m_enrollee, p_action)
    merge_without_blanking(
      m_enrollee,
      :pre_amt,
      :c_id,
      :cp_id,
      :coverage_start,
      :coverage_end,
      :ben_stat,
      :rel_code,
      :emp_stat,
      :ds
    )
    case p_action
    when :add
      self.coverage_status = 'active'
      self.coverage_end = nil
      if subscriber?
        self.policy.aasm_state = "submitted"
{'fraction_non_alphanumeric': 0.09696323921150772, 'fraction_numerical': 0.0, 'mean_word_length': 4.273876404494382, 'pattern_counts': {'":': 0, '<': 3, '<?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': '2093323', 'n_tokens_mistral': 1382, 'n_tokens_neox': 1323, 'n_words': 293}