Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions config/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,15 @@ def check_ucpath_code(type, value)
@ucpath_codes[type].include? value
end

# If the Job Code is in either the fte_check_exclusions or emeritus_job_code
# lists, you must skip the FTE check..., otherwise DO NOT skip the check.
def skip_fte_check?(job_code)
return true if check_ucpath_code('fte_check_exclusions', job_code)
return true if check_ucpath_code('emeritus_job_code', job_code)

false
end

private

def load_settings!(path)
Expand Down
8 changes: 8 additions & 0 deletions config/ucpath_codes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,11 @@ uc_extension_faculty:
# of any student affiliations
priority_job_codes:
- "006761"

# The 0FTE (percent of full time employment) excludes these
# job codes
fte_check_exclusions:
- "CWR022"
- "CWR015"
- "CWR003"
- "CWR016"
2 changes: 2 additions & 0 deletions lib/ucpath/jobs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ def valid_org_relationship?(j)
# 4. The job will be ineligible if the percentage of full time is zero
# Note - percentage of full time can appear in 2 different places (ugh)
def positive_full_time?(j)
return true if Config.skip_fte_check?(j.job_code)

values = []
values << j.percent_of_fulltime if j.respond_to?(:percent_of_fulltime)
values << j.percent_of_fulltime_job if j.respond_to?(:percent_of_fulltime_job)
Expand Down
2 changes: 1 addition & 1 deletion lib/ucpath/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def create_user_record
# PERCENT OF FULL TIME CHECK
# AP-559 If an employee is in a position that is 0 FTE,
# their record should should be filtered out from the UCPath files.
if percent_of_fulltime.zero? && percent_of_fulltime_job.zero?
if !Config.skip_fte_check?(job_code) && (percent_of_fulltime.zero? && percent_of_fulltime_job.zero?)
logger.info "#{id} - Ineligible: Percentage of Full Time Check"
return nil
end
Expand Down
70 changes: 66 additions & 4 deletions spec/lib/config_spec.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,73 @@
# frozen_string_literal: true

# rubocop:disable Metrics/BlockLength
describe Config do
it 'help returns help' do
expect(Config.help).to start_with('Alma User Load Usage:')
describe '.help' do
it 'returns help' do
expect(Config.help).to start_with('Alma User Load Usage:')
end
end

it 'config setting for change log days is 7' do
expect(Config.setting('change_log_days')).to eq(7)
describe '.setting' do
it 'returns change log days as 7' do
expect(Config.setting('change_log_days')).to eq(7)
end
end
end

describe Config do
describe '.skip_fte_check?' do
let(:job_code) { 'TEST_CODE' }

before do
allow(Config).to receive(:check_ucpath_code).and_return(false)
end

context 'when job_code is in fte_check_exclusions' do
before do
allow(Config).to receive(:check_ucpath_code)
.with('fte_check_exclusions', job_code)
.and_return(true)
end

it 'returns true' do
expect(Config.skip_fte_check?(job_code)).to be(true)
end
end

context 'when job_code is in emeritus_job_code' do
before do
allow(Config).to receive(:check_ucpath_code)
.with('emeritus_job_code', job_code)
.and_return(true)
end

it 'returns true' do
expect(Config.skip_fte_check?(job_code)).to be(true)
end
end

context 'when job_code is in neither list' do
it 'returns false' do
expect(Config.skip_fte_check?(job_code)).to be(false)
end
end
end
end

describe Config do
describe '.skip_fte_check? (with real config values)' do
it 'returns true for a job code in fte_check_exclusions' do
expect(Config.skip_fte_check?('CWR016')).to be(true)
end

it 'returns true for a job code in emeritus_job_code' do
expect(Config.skip_fte_check?('009902')).to be(true)
end

it 'returns false for a job code not in either list' do
expect(Config.skip_fte_check?('TOTALLY_FAKE_CODE')).to be(false)
end
end
end
# rubocop:enable Metrics/BlockLength
1 change: 1 addition & 0 deletions spec/lib/ucpath_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,7 @@ def eligible(job)

before do
allow(Date).to receive(:today).and_return(today)
allow(Config).to receive(:skip_fte_check?).and_return(false)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see you configured this but do you have a test to call the method with a true return and one for a false return?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call. The branch is covered..., but I don't have an explicit test for skip_fte_check (there are just tests that touch both scenarios), but probably good to have an explicit test for that purpose...I'll add that in!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added test for FTE function

end

context "when hr_status_code is not 'A'" do
Expand Down
Loading