before adding users
This commit is contained in:
@@ -2,11 +2,8 @@ class EmployersController < ApplicationController
|
||||
|
||||
# View Methods
|
||||
def index
|
||||
@not_automation_ready = Employer.not_automation_ready
|
||||
@missing_keychain_initialization = Employer.missing_keychain_initialization
|
||||
@missing_plans_initialization = Employer.missing_plans_initialization
|
||||
@missing_members_initialization = Employer.missing_members_initialization
|
||||
@active_with_active_id_card_setup = Employer.active_with_active_id_card_setup
|
||||
@uninitialized = Employer.in_automation_initilization
|
||||
@with_active_id_card_setup = Employer.with_active_id_card_setup
|
||||
@deactivated = Employer.deactivated
|
||||
end
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ class UpdateEmployerJob < ApplicationJob
|
||||
|
||||
if employer_plan_header.present?
|
||||
pl_plan_key = employer_plan_header['PLPlanKey'].to_s
|
||||
employer_identifier[:pl_plan_key] = pl_plan_key
|
||||
elsif employer_identifier[:group_number]
|
||||
group_number = employer_identifier[:group_number]
|
||||
pl_plan_key = Vhcs::PlPlanGroupCode.find_by(group_code: group_number).pl_plan_key
|
||||
|
||||
@@ -2,34 +2,49 @@ module EmployerAutomation
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
included do
|
||||
|
||||
scope :uninitialized, -> {
|
||||
where(initialized: false)
|
||||
}
|
||||
|
||||
scope :initialized, -> {
|
||||
where(initialized: true)
|
||||
}
|
||||
|
||||
scope :not_automation_ready, -> {
|
||||
where(pl_plan_key: [nil, ''], group_number: [nil, ''])
|
||||
where(group_number: [nil, ''])
|
||||
}
|
||||
|
||||
scope :automation_ready, -> {
|
||||
where.not(pl_plan_key: [nil, ''])
|
||||
.or(where.not(group_number: [nil, '']))
|
||||
where.not(group_number: [nil, ''])
|
||||
}
|
||||
|
||||
scope :missing_keychain_values, -> {
|
||||
where(company_pb_entity_key: [nil, ''])
|
||||
.or(where(plan_id: [nil, '']))
|
||||
.or(where(group_number: [nil, '']))
|
||||
.or(where(pl_plan_key: [nil, '']))
|
||||
scope :in_automation_initilization, -> {
|
||||
joins(:id_card_setup)
|
||||
.where(initialized: false)
|
||||
.or(
|
||||
where(id_card_setup: {initialized: false})
|
||||
)
|
||||
}
|
||||
|
||||
# scope :missing_keychain_values, -> {
|
||||
# where(company_pb_entity_key: [nil, ''])
|
||||
# .or(where(plan_id: [nil, '']))
|
||||
# .or(where(group_number: [nil, '']))
|
||||
# .or(where(pl_plan_key: [nil, '']))
|
||||
# }
|
||||
|
||||
scope :missing_keychain_initialization, -> {
|
||||
inactive.automation_ready.missing_keychain_values
|
||||
uninitialized.automation_ready
|
||||
}
|
||||
|
||||
scope :building_id_card_setup, -> {
|
||||
active.left_outer_joins(:id_card_setup)
|
||||
.where(id_card_setup: {active: false})
|
||||
scope :uninitialized_id_card_setup, -> {
|
||||
joins(:id_card_setup)
|
||||
.where(id_card_setup: {initialized: false})
|
||||
}
|
||||
|
||||
scope :missing_plans_initialization, -> {
|
||||
building_id_card_setup
|
||||
.where.missing(:plans)
|
||||
scope :missing_plans, -> {
|
||||
where.missing(:plans)
|
||||
.or(
|
||||
where(
|
||||
id: joins(:plans)
|
||||
@@ -39,9 +54,8 @@ module EmployerAutomation
|
||||
)
|
||||
}
|
||||
|
||||
scope :missing_members_initialization, -> {
|
||||
building_id_card_setup
|
||||
.where.associated(:plans)
|
||||
scope :has_plans, -> {
|
||||
where.associated(:plans)
|
||||
.where.not(
|
||||
id: joins(:plans)
|
||||
.where(plans: { pb_product_key: [nil, ''] })
|
||||
@@ -49,22 +63,30 @@ module EmployerAutomation
|
||||
).distinct
|
||||
}
|
||||
|
||||
scope :active_with_active_id_card_setup, -> {
|
||||
scope :missing_plans_initialization, -> {
|
||||
uninitialized_id_card_setup.missing_plans
|
||||
}
|
||||
|
||||
scope :missing_members_initialization, -> {
|
||||
uninitialized_id_card_setup.has_plans
|
||||
}
|
||||
|
||||
scope :with_active_id_card_setup, -> {
|
||||
active.left_outer_joins(:id_card_setup)
|
||||
.where(id_card_setup: {active: true})
|
||||
}
|
||||
|
||||
scope :with_keychain_values, -> {
|
||||
where.not(
|
||||
pl_plan_key: [nil, ''],
|
||||
group_number: [nil, ''],
|
||||
company_pb_entity_key: [nil, ''],
|
||||
plan_id: [nil, '']
|
||||
)
|
||||
}
|
||||
# scope :with_keychain_values, -> {
|
||||
# where.not(
|
||||
# pl_plan_key: [nil, ''],
|
||||
# group_number: [nil, ''],
|
||||
# company_pb_entity_key: [nil, ''],
|
||||
# plan_id: [nil, '']
|
||||
# )
|
||||
# }
|
||||
|
||||
scope :deactivated, -> {
|
||||
inactive.with_keychain_values
|
||||
inactive.initialized
|
||||
}
|
||||
# Employer.joins(:id_card_setup)
|
||||
# .left_outer_joins(:plans)
|
||||
|
||||
@@ -9,14 +9,17 @@ class Employer < ApplicationRecord
|
||||
scope :inactive, -> { where(active: false) }
|
||||
|
||||
before_save :create_slug, if: :will_save_change_to_name?
|
||||
before_save :deactivation_check, if: :will_save_change_to_active?
|
||||
before_save :active_initialized_check, if: :will_save_change_to_active?
|
||||
|
||||
|
||||
def create_slug
|
||||
self.slug = Employer.employer_trim_name(name).parameterize
|
||||
end
|
||||
|
||||
def deactivation_check
|
||||
def active_initialized_check
|
||||
if active
|
||||
self.initialized = true
|
||||
end
|
||||
if active == false
|
||||
id_card_setup&.update(active: false)
|
||||
end
|
||||
|
||||
@@ -19,6 +19,14 @@ module IdCard
|
||||
FORM_COLORS = ['atmosphere', 'verdigris', 'bluemana', 'cobalt']
|
||||
MODULE_COLOR = 'atmosphere'
|
||||
|
||||
before_save :active_initialized_check, if: :will_save_change_to_active?
|
||||
|
||||
def active_initialized_check
|
||||
if active
|
||||
self.initialized = true
|
||||
end
|
||||
end
|
||||
|
||||
# def employer_logo_filename
|
||||
# self.employer_logo.filename
|
||||
# end
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
module AutomationService
|
||||
class BatchEmployerUpdate
|
||||
|
||||
def initialize(pl_plan_keys)
|
||||
def initialize(pl_plan_keys = nil)
|
||||
@pl_plan_keys = pl_plan_keys
|
||||
end
|
||||
|
||||
def call
|
||||
sql_query = "SELECT PLPlanKey, PlanId, ShortDesc FROM PLPlanHeader
|
||||
WHERE ActiveInactive = 'Active' AND PLPlanKey IN (#{@pl_plan_keys.join(',')})"
|
||||
WHERE ActiveInactive = 'Active'"
|
||||
if @pl_plan_keys.present?
|
||||
sql_query = sql_query.concat(" AND PLPlanKey IN (#{@pl_plan_keys.join(',')})")
|
||||
end
|
||||
employer_plan_headers = VhcsRecord.connection.select_all(sql_query)
|
||||
|
||||
employer_update_futures = employer_plan_headers.map do |employer_plan_header|
|
||||
|
||||
@@ -6,7 +6,20 @@ module IdCardQueueService
|
||||
end
|
||||
|
||||
def call
|
||||
CallStoredProc.new('BrittonGetQueuedIdCardCountsTPA', { PLPlanKeys: @employer_pl_plan_keys }).call.to_ary
|
||||
raw_employers_member_keys = CallStoredProc.new('HLGetQueuedIdCardMemberKeysTPA', { PLPlanKeys: @employer_pl_plan_keys }).call.to_ary
|
||||
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def format_employers_member_keys(raw_employers_member_keys)
|
||||
key_map = { "PlanKey" => :pl_plan_key, "MemberKeys" => :member_keys }
|
||||
|
||||
raw_employers_member_keys.map do |hash|
|
||||
hash["PlanKey"] = hash["PlanKey"].to_s
|
||||
hash["MemberKeys"] = hash["MemberKeys"].split(", ").map(&:to_i)
|
||||
hash.transform_keys(key_map)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -9,18 +9,18 @@
|
||||
<%= f.text_field :name, label: { text: "Employer Name" }, class: "w-full" %>
|
||||
</div>
|
||||
<div class="w-full">
|
||||
<%= f.text_field :slug, label: { text: "Slug" }, class: "w-full" %>
|
||||
<%= f.text_field :effective_date, label: { text: "Effective Date" }, class: "w-full" %>
|
||||
</div>
|
||||
<div class="w-full">
|
||||
<%= f.text_field :pl_plan_key, label: { text: "Pl Plan Key" }, class: "w-full" %>
|
||||
<%= f.text_field :group_number, label: { text: "Group/Medical Number" }, class: "w-full" %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex space-x-10">
|
||||
<div class="w-full">
|
||||
<%= f.text_field :group_number, label: { text: "Group/Medical Number" }, class: "w-full" %>
|
||||
<%= f.text_field :slug, label: { text: "Slug" }, class: "w-full" %>
|
||||
</div>
|
||||
<div class="w-full">
|
||||
<%= f.text_field :effective_date, label: { text: "Effective Date" }, class: "w-full" %>
|
||||
<%= f.text_field :pl_plan_key, label: { text: "Pl Plan Key" }, class: "w-full" %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,89 +1,111 @@
|
||||
<div class="bg-deepcove h-full w-full flex flex-col justify-start">
|
||||
<div class="flex items-center">
|
||||
<div class="flex items-center justify-between">
|
||||
<h1 class="font-bold text-4xl text-platinum my-5">Employers</h1>
|
||||
<%= link_to new_employer_path, class: "flex justify-center items-center h-8 w-8 ml-2 mb-6 text-sm text-bronze bg-deepcove hover:bg-cobalt font-semibold p-1 -l border-2 border-cobalt" do %>
|
||||
<%= icon "clipboard-plus", library: "lucide" %>
|
||||
<% end %>
|
||||
<div class="w-30 inline-flex flex-col text-platinum hover:text-limegreen font-bold px-4 mr-20 rounded-l-lg border-l-5 border-b-2 border-limegreen">
|
||||
<div class="w-full flex text-3xl">
|
||||
<%= link_to "NEW", new_employer_path %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% if @not_automation_ready.present? || @missing_keychain_initialization.present? || @missing_plans_initialization.present? || @missing_members_initialization.present? %>
|
||||
<% if @uninitialized.present? %>
|
||||
<h2 class="font-bold text-3xl text-brightlava my-5">In Process:</h2>
|
||||
<% no_employers_text = @not_automation_ready.present? ? "" : " NONE" %>
|
||||
<h3 class="font-bold text-xl text-bronze my-5 ml-10">
|
||||
<%= "Waiting for Groups Number/Pl Plan Key:#{no_employers_text}" %>
|
||||
</h2>
|
||||
<div class="flex flex-wrap w-full pl-20 pr-10 gap-x-4 gap-y-3">
|
||||
<% @not_automation_ready.each_with_index do |emp, index| %>
|
||||
<div class="w-[23%] inline-flex flex-col text-platinum font-bold px-4 rounded-l-lg border-l-5 border-b-2 border-bronze">
|
||||
<div class="w-full flex text-xl">
|
||||
<%= link_to emp.name, employer_path(emp.slug), class: "text-bronze hover:text-platinum" %>
|
||||
</div>
|
||||
<div class="w-full flex text-md font-medium">
|
||||
<%= "(Effective #{emp.effective_date})" %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<% no_employers_text = @missing_keychain_initialization.present? ? "" : " NONE" %>
|
||||
<h3 class="font-bold text-xl text-verdigris-vivid my-5 ml-10">
|
||||
<%= "Waiting for Employer to be created in VHCS:#{no_employers_text}" %>
|
||||
</h2>
|
||||
<div class="flex flex-wrap w-full pl-20 pr-10 gap-x-4 gap-y-3">
|
||||
<% @missing_keychain_initialization.each_with_index do |emp, index| %>
|
||||
<div class="w-[23%] inline-flex flex-col text-platinum font-bold px-4 rounded-l-lg border-l-5 border-b-2 border-verdigris-vivid">
|
||||
<div class="w-full flex text-xl">
|
||||
<%= link_to emp.name, employer_path(emp.slug), class: "text-verdigris-vivid hover:text-platinum" %>
|
||||
</div>
|
||||
<div class="w-full flex text-md font-medium">
|
||||
<%= "(Effective #{emp.effective_date})" %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<% no_employers_text = @missing_plans_initialization.present? ? "" : " NONE" %>
|
||||
<h3 class="font-bold text-xl text-copper my-5 ml-10">
|
||||
<%= "Waiting for Plans to be created in VHCS:#{no_employers_text}" %>
|
||||
</h2>
|
||||
<div class="flex flex-wrap w-full pl-20 pr-10 gap-x-4 gap-y-3">
|
||||
<% @missing_plans_initialization.each_with_index do |emp, index| %>
|
||||
<div class="w-[23%] inline-flex flex-col text-platinum font-bold px-4 rounded-l-lg border-l-5 border-b-2 border-copper">
|
||||
<div class="w-full flex text-xl">
|
||||
<%= link_to emp.name, employer_path(emp.slug), class: "text-copper hover:text-platinum" %>
|
||||
</div>
|
||||
<div class="w-full flex text-md font-medium">
|
||||
<%= "(Effective #{emp.effective_date})" %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<% no_employers_text = @missing_members_initialization.present? ? "" : " NONE" %>
|
||||
<h3 class="font-bold text-xl text-bluemana my-5 ml-10">
|
||||
<%= "Waiting for Inital Members to be created in VHCS:#{no_employers_text}" %>
|
||||
</h2>
|
||||
<div class="flex flex-wrap w-full pl-20 pr-10 gap-x-4 gap-y-3">
|
||||
<% @missing_members_initialization.each_with_index do |emp, index| %>
|
||||
<div class="w-[32%] inline-flex flex-col text-platinum font-bold px-4 rounded-l-lg border-l-5 border-b-2 border-bluemana">
|
||||
<div class="w-full flex">
|
||||
<%= link_to emp.name, employer_path(emp.slug), class: "text-bluemana hover:text-platinum" %>
|
||||
</div>
|
||||
<div class="w-full flex justify-between text-md font-medium">
|
||||
<% member_counter_color = "text-".concat(emp.members.present? ? "limegreen" : "brightlava") %>
|
||||
<div>
|
||||
Members:
|
||||
<span class="ml-2 <%= member_counter_color %>">
|
||||
<%= emp.members.count %>
|
||||
</span>
|
||||
<div class="flex flex-none items-center w-full px-10">
|
||||
<h3 class="flex-none font-bold text-xl text-bronze my-5">
|
||||
<%= "Waiting for Groups Number Entry" %>
|
||||
</h2>
|
||||
<% if @uninitialized.not_automation_ready.present? %>
|
||||
<div class="flex flex-wrap w-full gap-x-4 gap-y-3">
|
||||
<% @uninitialized.not_automation_ready.each do |emp| %>
|
||||
<div class="w-[23%] inline-flex flex-col text-platinum font-bold px-4 rounded-l-lg border-l-5 border-b-2 border-bronze">
|
||||
<div class="w-full flex text-xl">
|
||||
<%= link_to emp.name, employer_path(emp.slug), class: "text-bronze hover:text-platinum" %>
|
||||
</div>
|
||||
<div class="w-full flex text-md font-medium">
|
||||
<%= "(Effective #{emp.effective_date})" %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ml-2">
|
||||
<%= "(Effective #{emp.effective_date})" %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="grow h-[1px] mt-2 ml-1 bg-bronze"></div>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="flex flex-none items-center w-full px-10">
|
||||
<h3 class="font-bold text-xl text-verdigris-vivid my-5">
|
||||
<%= "Waiting for Employer to be created in VHCS" %>
|
||||
</h3>
|
||||
<% if @uninitialized.missing_keychain_initialization.present? %>
|
||||
<div class="flex flex-wrap w-full pl-20 pr-10 gap-x-4 gap-y-3">
|
||||
<% @uninitialized.missing_keychain_initialization.each do |emp| %>
|
||||
<div class="w-[23%] inline-flex flex-col text-platinum font-bold px-4 rounded-l-lg border-l-5 border-b-2 border-verdigris-vivid">
|
||||
<div class="w-full flex text-xl">
|
||||
<%= link_to emp.name, employer_path(emp.slug), class: "text-verdigris-vivid hover:text-platinum" %>
|
||||
</div>
|
||||
<div class="w-full flex text-md font-medium">
|
||||
<%= "(Effective #{emp.effective_date})" %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="grow h-[1px] mt-2 ml-1 bg-verdigris-vivid"></div>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="flex flex-none items-center w-full px-10">
|
||||
<h3 class="font-bold text-xl text-copper my-5">
|
||||
<%= "Waiting for Plans to be created in VHCS" %>
|
||||
</h3>
|
||||
<% if @uninitialized.missing_plans_initialization.present? %>
|
||||
<div class="flex flex-wrap w-full pl-20 pr-10 gap-x-4 gap-y-3">
|
||||
<% @uninitialized.missing_plans_initialization.each do |emp| %>
|
||||
<div class="w-[23%] inline-flex flex-col text-platinum font-bold px-4 rounded-l-lg border-l-5 border-b-2 border-copper">
|
||||
<div class="w-full flex text-xl">
|
||||
<%= link_to emp.name, employer_path(emp.slug), class: "text-copper hover:text-platinum" %>
|
||||
</div>
|
||||
<div class="w-full flex text-md font-medium">
|
||||
<%= "(Effective #{emp.effective_date})" %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="grow h-[1px] mt-2 ml-1 bg-copper"></div>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="flex flex-none items-center w-full px-10">
|
||||
<h3 class="flex flex-none font-bold text-xl text-bluemana my-5">
|
||||
<%= "Waiting for Inital Members to be created in VHCS" %>
|
||||
</h3>
|
||||
<% if @uninitialized.missing_members_initialization.present? %>
|
||||
<div class="flex flex-wrap w-full pl-20 pr-10 gap-x-4 gap-y-3">
|
||||
<% @uninitialized.missing_members_initialization.each do |emp| %>
|
||||
<div class="w-[23%] inline-flex flex-col text-platinum font-bold px-4 rounded-l-lg border-l-5 border-b-2 border-bluemana">
|
||||
<div class="w-full flex">
|
||||
<%= link_to emp.name, employer_path(emp.slug), class: "text-bluemana hover:text-platinum" %>
|
||||
</div>
|
||||
<div class="w-full flex justify-between text-md font-medium">
|
||||
<% member_counter_color = "text-".concat(emp.members.present? ? "limegreen" : "brightlava") %>
|
||||
<div>
|
||||
Members:
|
||||
<span class="ml-2 <%= member_counter_color %>">
|
||||
<%= emp.members.count %>
|
||||
</span>
|
||||
</div>
|
||||
<div class="ml-2">
|
||||
<%= "(Effective #{emp.effective_date})" %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="grow h-[1px] mt-2 ml-1 bg-bluemana"></div>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
<h2 class="font-bold text-3xl text-limegreen my-5">Live:</h2>
|
||||
<div class="flex flex-wrap w-full px-10 gap-x-4 gap-y-3">
|
||||
<% @active_with_active_id_card_setup.order(:name).each_with_index do |emp, index| %>
|
||||
<% @with_active_id_card_setup.order(:name).each do |emp| %>
|
||||
<div class="w-[23%] inline-flex flex-col text-platinum font-bold px-4 rounded-l-lg border-l-5 border-b-2 border-atmosphere">
|
||||
<div class="w-full flex text-xl space-x-4">
|
||||
<%= link_to emp.name, employer_path(emp.slug), class: "text-atmosphere hover:text-platinum" %>
|
||||
@@ -101,7 +123,7 @@
|
||||
</div>
|
||||
<h2 class="font-bold text-3xl text-[#ADADAD] my-5">Deactivated:</h2>
|
||||
<div class="flex flex-wrap w-full px-10 gap-x-4 gap-y-3">
|
||||
<% @deactivated.each_with_index do |emp, index| %>
|
||||
<% @deactivated.each do |emp| %>
|
||||
<div class="w-[23%] inline-flex flex-col text-[#ADADAD] font-bold px-4 rounded-l-lg border-l-5 border-b-2 border-[#ADADAD]">
|
||||
<div class="w-full flex text-xl space-x-4">
|
||||
<%= link_to emp.name, employer_path(emp.slug), class: "text-platinum hover:text-bluemana" %>
|
||||
|
||||
@@ -19,14 +19,12 @@
|
||||
<div class="w-full">
|
||||
<%= f.text_field :name, label: { text: "Employer Name" }, data: { logo_upload_target: "employer" }, class: "w-full" %>
|
||||
</div>
|
||||
<div class="w-full">
|
||||
<%= f.text_field :group_number, label: { text: "Group/Medical Number" }, class: "w-full" %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex space-x-10">
|
||||
<div class="w-full">
|
||||
<%= f.text_field :effective_date, label: { text: "Effective Date" }, class: "w-full" %>
|
||||
</div>
|
||||
<div class="w-full">
|
||||
<%= f.text_field :group_number, label: { text: "Group/Medical Number" }, class: "w-full" %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
printenv >> /etc/environment
|
||||
|
||||
echo "updating cron..."
|
||||
bundle exec whenever --update-crontab --set environment=development
|
||||
|
||||
# Start cron in foreground
|
||||
echo "starting cron..."
|
||||
cron
|
||||
# bundle exec whenever --update-crontab
|
||||
|
||||
# Then exec the container's main process (what's set as CMD in the Dockerfile).
|
||||
exec "$@"
|
||||
@@ -0,0 +1,13 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Remove a potentially pre-existing server.pid for Rails.
|
||||
rm -f /usr/src/app/tmp/pids/server.pid
|
||||
|
||||
rm -rf /usr/local/bundle/cache/*.gem
|
||||
|
||||
echo "bundle install..."
|
||||
bundle check || bundle install --jobs 4
|
||||
|
||||
# Then exec the container's main process (what's set as CMD in the Dockerfile).
|
||||
exec "$@"
|
||||
+16
-8
@@ -15,15 +15,13 @@ services:
|
||||
- HISTFILE=/usr/src/app/log/.bash_history
|
||||
- RAILS_ENV=development
|
||||
- TAILWIND_POLLING=true
|
||||
- PUID=1000
|
||||
- PGID=100
|
||||
# - PUID=1000
|
||||
# - PGID=100
|
||||
tty: true
|
||||
stdin_open: true
|
||||
# depends_on:
|
||||
# db:
|
||||
# condition: service_healthy
|
||||
# redis:
|
||||
# condition: service_started
|
||||
# db:
|
||||
# build:
|
||||
# context: .
|
||||
@@ -38,11 +36,21 @@ services:
|
||||
# timeout: 3s
|
||||
# retries: 10
|
||||
# start_period: 10s
|
||||
# redis:
|
||||
# image: redis
|
||||
# cron:
|
||||
# build:
|
||||
# context: ./
|
||||
# dockerfile: development3.Dockerfile
|
||||
# command: ./bin/cron-entrypoint
|
||||
# volumes:
|
||||
# - redis_data:/data
|
||||
|
||||
# - .:/usr/src/app
|
||||
# - bundle:/usr/local/bundle
|
||||
# environment:
|
||||
# - RAILS_ENV=development
|
||||
# - PUID=1000
|
||||
# - PGID=1001
|
||||
# depends_on:
|
||||
# - web
|
||||
# - db
|
||||
volumes:
|
||||
# redis_data:
|
||||
bundle:
|
||||
|
||||
+1
-2
@@ -2,8 +2,7 @@ set :output, "log/cron_log.log"
|
||||
set :environment, ENV['RAILS_ENV'] || 'development'
|
||||
|
||||
every 1.minute do
|
||||
runner "Rails.logger.info 'Cron test ran at: ' + Time.now.to_s"
|
||||
command "echo 'Cron test ran at: ' $(date) >> log/cron_log.log"
|
||||
rake "employer_automation:employer_initialize_test"
|
||||
end
|
||||
|
||||
every 1.day, at: ['6:00 am', '6:00 pm'] do
|
||||
|
||||
@@ -9,6 +9,7 @@ class CreateEmployers < ActiveRecord::Migration[7.2]
|
||||
t.string :group_number
|
||||
t.string :effective_date
|
||||
t.boolean :active, default: false
|
||||
t.boolean :initialized, default: false
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
@@ -7,9 +7,10 @@ class CreateIdCardSetups < ActiveRecord::Migration[7.2]
|
||||
t.string :card_color
|
||||
t.string :rx_group_number
|
||||
t.string :pl_plan_key
|
||||
t.boolean :active, default: false
|
||||
t.boolean :has_divisions, default: false
|
||||
t.boolean :has_dental, default: false
|
||||
t.boolean :active, default: false
|
||||
t.boolean :initialized, default: false
|
||||
t.belongs_to :employer, null: false, foreign_key: true
|
||||
t.belongs_to :employer_logo, null: true, foreign_key: { to_table: :id_card_employer_logos }
|
||||
t.belongs_to :network_logo, null: true, foreign_key: { to_table: :id_card_network_logos }
|
||||
|
||||
+3
-1
@@ -20,6 +20,7 @@ ActiveRecord::Schema[7.2].define(version: 2026_04_08_210447) do
|
||||
t.string "group_number"
|
||||
t.string "effective_date"
|
||||
t.boolean "active", default: false
|
||||
t.boolean "initialized", default: false
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
end
|
||||
@@ -239,9 +240,10 @@ ActiveRecord::Schema[7.2].define(version: 2026_04_08_210447) do
|
||||
t.string "card_color"
|
||||
t.string "rx_group_number"
|
||||
t.string "pl_plan_key"
|
||||
t.boolean "active", default: false
|
||||
t.boolean "has_divisions", default: false
|
||||
t.boolean "has_dental", default: false
|
||||
t.boolean "active", default: false
|
||||
t.boolean "initialized", default: false
|
||||
t.bigint "employer_id", null: false
|
||||
t.bigint "employer_logo_id"
|
||||
t.bigint "network_logo_id"
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
"seed_tasks:determine_network_fields",
|
||||
"seed_tasks:determine_employer_fields",
|
||||
|
||||
"seed_tasks:build_plans",
|
||||
"seed_tasks:build_members"
|
||||
]
|
||||
|
||||
|
||||
+7
-23
@@ -13,6 +13,8 @@ RUN --mount=type=cache,target=/var/cache/apt \
|
||||
build-essential \
|
||||
less \
|
||||
git \
|
||||
cron \
|
||||
dos2unix \
|
||||
tdsodbc \
|
||||
freetds-dev \
|
||||
libvips \
|
||||
@@ -27,34 +29,16 @@ WORKDIR /usr/src/app
|
||||
|
||||
RUN gem install foreman
|
||||
|
||||
# RUN chmod +x /usr/src/app/bin/jobs
|
||||
# COPY bin/development-entrypoint.sh /bin/development-entrypoint.sh
|
||||
# RUN chown root:root bin/development-entrypoint.sh && chmod +x bin/development-entrypoint.sh
|
||||
|
||||
# Copy runtime Ruby dependencies and the precompiled assets from the builder stage
|
||||
# COPY --from=builder /usr/local/bundle /usr/local/bundle
|
||||
# COPY --from=builder /usr/src/app /usr/src/app
|
||||
# COPY --from=watchman_builder /usr/local/bin/watchman /usr/local/bin/watchman
|
||||
# COPY --from=watchman_builder /usr/local/bin/watchman-wait /usr/local/bin/watchman-wait
|
||||
ENTRYPOINT ["./bin/development-entrypoint"]
|
||||
|
||||
# RUN mkdir -p /usr/local/var/run/watchman \
|
||||
# && touch /usr/local/var/run/watchman/.not-empty \
|
||||
# && chmod 2777 /usr/local/var/run/watchman
|
||||
ENTRYPOINT ["./bin/cron-entrypoint"]
|
||||
|
||||
# COPY . .
|
||||
|
||||
# 1. Add bin/jobs script to container
|
||||
COPY bin/jobs /usr/src/bin/jobs
|
||||
|
||||
# 2. Make the script executable
|
||||
RUN chmod +x /usr/src/bin/jobs
|
||||
|
||||
# 3. Set it as the entrypoint
|
||||
# ENTRYPOINT ["/usr/src/bin/jobs"]
|
||||
|
||||
# The entrypoint script is a good practice for handling Rails server startup
|
||||
ENTRYPOINT ["./bin/docker-entrypoint-development"]
|
||||
|
||||
# Expose the application port
|
||||
EXPOSE 3002
|
||||
|
||||
# Set the default command to run the Rails server
|
||||
CMD ["./bin/dev", "bin/jobs start"]
|
||||
CMD ["./bin/dev", "./bin/jobs start"]
|
||||
|
||||
@@ -3,9 +3,10 @@ namespace :employer_automation do
|
||||
desc "Employer Initialization Automation"
|
||||
# rake employer_automation:employer_initialize
|
||||
task employer_initialize: :environment do
|
||||
puts "Running Employer Init Automation"
|
||||
Employer.missing_keychain_initialization.map(&:sync_with_vhcs)
|
||||
Employer.missing_plans_initialization.map(&:sync_plans_with_vhcs)
|
||||
Employer.missing_initial_members.map(&:sync_members_with_vhcs)
|
||||
Employer.missing_members_initialization.map(&:sync_members_with_vhcs)
|
||||
end
|
||||
|
||||
desc "Employer Initialization Automation Test"
|
||||
@@ -26,8 +27,8 @@ namespace :employer_automation do
|
||||
# rake employer_automation:employer_maintenance
|
||||
task employer_maintenance: :environment do
|
||||
Employer.automation_ready.map(&:sync_with_vhcs)
|
||||
Employer.active.map(&:sync_plans_with_vhcs)
|
||||
Employer.active.map(&:sync_members_with_vhcs)
|
||||
Employer.with_active_id_card_setup.map(&:sync_plans_with_vhcs)
|
||||
Employer.with_active_id_card_setup.map(&:sync_members_with_vhcs)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
+32
-24
@@ -184,35 +184,44 @@ namespace :seed_tasks do
|
||||
plan_headers = VhcsRecord.connection.select_all(sql_query)
|
||||
|
||||
plan_headers.each do |plan_header|
|
||||
employer = UpdateEmployerJob.perform_now(employer_plan_header: plan_header, full_sync: true)
|
||||
UpdateEmployerJob.new.perform(employer_plan_header: plan_header, full_sync: true)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
desc "Build Initial Plans"
|
||||
# rake seed_tasks:build_plans
|
||||
task build_plans: :environment do
|
||||
puts "Importing Plans"
|
||||
|
||||
Employer.all.each do |employer|
|
||||
puts "-- #{employer.name}"
|
||||
UpdateEmployerPlansJob.new.perform(employer.pl_plan_key)
|
||||
# employer_plans = employer.id_card_setup.plans
|
||||
vhcs_plans = Vhcs::PbProduct.where(company_pb_entity_key: employer.company_pb_entity_key, is_active: 255)
|
||||
vhcs_plans.each do |vp|
|
||||
# plan = employer_plans.find_by(pb_product_key: vp.pb_product_key)
|
||||
# if plan.present?
|
||||
# plan_titles = employer_plans.pluck(:title)
|
||||
# plan_title_matcher = JaroWinkler.new(vp.short_description)
|
||||
# closest_title = plan_titles.max_by { |title| plan_title_matcher.match(title) }
|
||||
# plan = employer_plans.find_by(title: closest_title)
|
||||
# plan.update(pb_product_key: vp.pb_product_key)
|
||||
# end
|
||||
plan = employer.id_card_setup.plans.find_by(pb_product_key: vp.pb_product_key)
|
||||
|
||||
employer.id_card_setup.plans.each do |plan|
|
||||
puts "---- #{plan.title}"
|
||||
# plan.update(
|
||||
# title: vp.short_description,
|
||||
# pl_plan_key: employer.pl_plan_key
|
||||
# )
|
||||
vhcs_plan_benefits = Vhcs::HlEgglestonCardBenefit.where(plan_id: plan.pb_product_key)
|
||||
vhcs_plan_benefits.each do |vb|
|
||||
benefit = plan.plan_benefits.find_by(sequence: vb.sequence)
|
||||
benefit.update(benefit: vb.benefit)
|
||||
vhcs_plan_benefits.each do |vpb|
|
||||
if vpb.benefit.present?
|
||||
benefit = plan.plan_benefits.find_by(sequence: vpb.sequence)
|
||||
benefit.update(benefit: vpb.benefit)
|
||||
end
|
||||
end
|
||||
end
|
||||
if vhcs_plans.empty?
|
||||
employer.active = false
|
||||
end
|
||||
# vhcs_plans = Vhcs::PbProduct.where(company_pb_entity_key: employer.company_pb_entity_key, is_active: 255)
|
||||
# vhcs_plans.each do |vp|
|
||||
# plan = employer.id_card_setup.plans.find_by(pb_product_key: vp.pb_product_key)
|
||||
# puts "---- #{plan.title}"
|
||||
# vhcs_plan_benefits = Vhcs::HlEgglestonCardBenefit.where(plan_id: plan.pb_product_key)
|
||||
# vhcs_plan_benefits.each do |vb|
|
||||
# benefit = plan.plan_benefits.find_by(sequence: vb.sequence)
|
||||
# benefit.update(benefit: vb.benefit)
|
||||
# end
|
||||
# end
|
||||
# if vhcs_plans.empty?
|
||||
# employer.active = false
|
||||
# end
|
||||
employer.save
|
||||
end
|
||||
|
||||
@@ -223,8 +232,7 @@ namespace :seed_tasks do
|
||||
task build_members: :environment do
|
||||
puts "Importing Members"
|
||||
Employer.all.map(&:sync_members_with_vhcs)
|
||||
Employer.left_outer_joins(:members)
|
||||
.where(members: { id: nil })
|
||||
Employer.where.missing(:members)
|
||||
.update_all(active: false)
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user