class SoftSkillValue < ApplicationRecord

  include Indexable
  indexable :tag

  belongs_to :soft_skill

  validates :soft_skill, :tag, presence: true
  validates :tag, uniqueness: true

  def compute_compatibility candidate_value, offer_value
    cv = candidate_value.value.to_f
    ov = offer_value.value.to_f
    first_result = ((cv - ov).abs * 100) / 6
    100 - first_result
  end

end