module Report
    class EmployerCardComparison < ApplicationRecord
        has_many :comparison_errors, dependent: :destroy
        accepts_nested_attributes_for :comparison_errors, allow_destroy: true, reject_if: :all_blank

        has_many :member_card_comparisons
        has_many :member_comparison_errors, through: :member_card_comparisons, source: :comparison_errors


        def employer_total_errors
            self.comparison_errors.count + self.member_comparison_errors.count
        end

    end
end
