Before a few renames

This commit is contained in:
Jason Jordan
2026-03-19 00:42:27 -04:00
parent 011ee91707
commit 3300819ed5
46 changed files with 994 additions and 467 deletions
@@ -0,0 +1,31 @@
module EmployerAutomation
extend ActiveSupport::Concern
# included do
# # Code in this block becomes instance methods or class macros (like scopes, validations, associations) in the including class.
# scope :visible, -> { where(visible: true) }
# scope :invisible, -> { where(visible: false) }
# validates :status, inclusion: { in: %w(visible invisible), message: "%{value} is not a valid status" }
# end
# class_methods do
# # Methods in this block become class methods of the including class.
# def count_all_visible
# visible.count
# end
# end
# Any other methods defined here become instance methods automatically.
def up_to_date?
self.pl_plan_key.present? &&
self.company_pb_entity_key.present? &&
self.plan_id.present? &&
self.group_number.present? &&
self.effect_date.present?
end
def sync_with_vhcs
sql_query = "SELECT PLPlanKey, PlanId, ShortDesc FROM PLPlanHeader WHERE ActiveInactive = 'Active' And PLPlanKey = 57"
plan_header = VhcsRecord.connection.select_all(sql_query).first
end
end
+7 -6
View File
@@ -46,14 +46,15 @@ class Employer < ApplicationRecord
false
end
# def name_to_logo_filename(extension)
# self.employer_trim_name(self.name).titleize.gsub(/\s+/, '').concat('Logo').concat(extension.downcase)
# end
def name_to_logo_filename(extension)
self.employer_trim_name(self.name).titleize.gsub(/[^a-zA-Z]/, '').concat('Logo').concat(extension.downcase)
end
def employer_trim_name(name)
regex_source = Regexp.union(["health", "plan", "the", "inc", "llc"]).source
def employer_trim_name(name = nil)
employer_name = name.present? ? name : self.name
regex_source = Regexp.union(["health ", "plan", "the", "inc", "llc"]).source
case_insensitive_regex = Regexp.new(regex_source, "i")
name.gsub(case_insensitive_regex, "").squish
employer_name.gsub(case_insensitive_regex, "").gsub(/[^[:alpha:][:space:]]/, "").squish
end
def self.permitted_params(params)
+3 -3
View File
@@ -1,15 +1,15 @@
module IdCard
class EmployerLogo < ApplicationRecord
before_save :calculate_aspect_ratio, if: :image_data_changed?
before_validation :calculate_aspect_ratio, if: :image_data_changed?
private
def calculate_aspect_ratio
image_io = StringIO.new(image_data)
image_io = StringIO.new(self.image_data)
width, height = FastImage.size(image_io)
image_ratio = width.to_f / height
if image_ratio
aspect_ratio = image_ratio.round(2)
self.aspect_ratio = image_ratio.round(2)
end
end
end
+1 -1
View File
@@ -7,7 +7,7 @@ module IdCard
class << self
def medcost
defaults.where("filename LIKE ?", "%Medcost%")
defaults.where("filename LIKE ?", "%MedCost%")
end
def cigna
+1
View File
@@ -47,6 +47,7 @@ module IdCard
def permitted_params(params)
params.require(:id_card_configuration).permit(
plans_attributes: [
:id,
:title,
:pb_product_key,
:pl_plan_key,
+1 -1
View File
@@ -1,5 +1,5 @@
class Member < ApplicationRecord
belongs_to :plan
belongs_to :id_card_plan, class_name: 'IdCard::Plan', optional: true
belongs_to :employer