Skip to content

Commit 7480126

Browse files
Add exceptions for FTE check (#10)
* Add exceptions for FTE check * Add test for skip_fte_check? * Adding some integration tests for the fte check
1 parent 0032a1a commit 7480126

6 files changed

Lines changed: 87 additions & 5 deletions

File tree

config/config.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,15 @@ def check_ucpath_code(type, value)
5757
@ucpath_codes[type].include? value
5858
end
5959

60+
# If the Job Code is in either the fte_check_exclusions or emeritus_job_code
61+
# lists, you must skip the FTE check..., otherwise DO NOT skip the check.
62+
def skip_fte_check?(job_code)
63+
return true if check_ucpath_code('fte_check_exclusions', job_code)
64+
return true if check_ucpath_code('emeritus_job_code', job_code)
65+
66+
false
67+
end
68+
6069
private
6170

6271
def load_settings!(path)

config/ucpath_codes.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,3 +94,11 @@ uc_extension_faculty:
9494
# of any student affiliations
9595
priority_job_codes:
9696
- "006761"
97+
98+
# The 0FTE (percent of full time employment) excludes these
99+
# job codes
100+
fte_check_exclusions:
101+
- "CWR022"
102+
- "CWR015"
103+
- "CWR003"
104+
- "CWR016"

lib/ucpath/jobs.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,8 @@ def valid_org_relationship?(j)
107107
# 4. The job will be ineligible if the percentage of full time is zero
108108
# Note - percentage of full time can appear in 2 different places (ugh)
109109
def positive_full_time?(j)
110+
return true if Config.skip_fte_check?(j.job_code)
111+
110112
values = []
111113
values << j.percent_of_fulltime if j.respond_to?(:percent_of_fulltime)
112114
values << j.percent_of_fulltime_job if j.respond_to?(:percent_of_fulltime_job)

lib/ucpath/user.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ def create_user_record
149149
# PERCENT OF FULL TIME CHECK
150150
# AP-559 If an employee is in a position that is 0 FTE,
151151
# their record should should be filtered out from the UCPath files.
152-
if percent_of_fulltime.zero? && percent_of_fulltime_job.zero?
152+
if !Config.skip_fte_check?(job_code) && (percent_of_fulltime.zero? && percent_of_fulltime_job.zero?)
153153
logger.info "#{id} - Ineligible: Percentage of Full Time Check"
154154
return nil
155155
end

spec/lib/config_spec.rb

Lines changed: 66 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,73 @@
11
# frozen_string_literal: true
22

3+
# rubocop:disable Metrics/BlockLength
34
describe Config do
4-
it 'help returns help' do
5-
expect(Config.help).to start_with('Alma User Load Usage:')
5+
describe '.help' do
6+
it 'returns help' do
7+
expect(Config.help).to start_with('Alma User Load Usage:')
8+
end
69
end
710

8-
it 'config setting for change log days is 7' do
9-
expect(Config.setting('change_log_days')).to eq(7)
11+
describe '.setting' do
12+
it 'returns change log days as 7' do
13+
expect(Config.setting('change_log_days')).to eq(7)
14+
end
1015
end
1116
end
17+
18+
describe Config do
19+
describe '.skip_fte_check?' do
20+
let(:job_code) { 'TEST_CODE' }
21+
22+
before do
23+
allow(Config).to receive(:check_ucpath_code).and_return(false)
24+
end
25+
26+
context 'when job_code is in fte_check_exclusions' do
27+
before do
28+
allow(Config).to receive(:check_ucpath_code)
29+
.with('fte_check_exclusions', job_code)
30+
.and_return(true)
31+
end
32+
33+
it 'returns true' do
34+
expect(Config.skip_fte_check?(job_code)).to be(true)
35+
end
36+
end
37+
38+
context 'when job_code is in emeritus_job_code' do
39+
before do
40+
allow(Config).to receive(:check_ucpath_code)
41+
.with('emeritus_job_code', job_code)
42+
.and_return(true)
43+
end
44+
45+
it 'returns true' do
46+
expect(Config.skip_fte_check?(job_code)).to be(true)
47+
end
48+
end
49+
50+
context 'when job_code is in neither list' do
51+
it 'returns false' do
52+
expect(Config.skip_fte_check?(job_code)).to be(false)
53+
end
54+
end
55+
end
56+
end
57+
58+
describe Config do
59+
describe '.skip_fte_check? (with real config values)' do
60+
it 'returns true for a job code in fte_check_exclusions' do
61+
expect(Config.skip_fte_check?('CWR016')).to be(true)
62+
end
63+
64+
it 'returns true for a job code in emeritus_job_code' do
65+
expect(Config.skip_fte_check?('009902')).to be(true)
66+
end
67+
68+
it 'returns false for a job code not in either list' do
69+
expect(Config.skip_fte_check?('TOTALLY_FAKE_CODE')).to be(false)
70+
end
71+
end
72+
end
73+
# rubocop:enable Metrics/BlockLength

spec/lib/ucpath_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -528,6 +528,7 @@ def eligible(job)
528528

529529
before do
530530
allow(Date).to receive(:today).and_return(today)
531+
allow(Config).to receive(:skip_fte_check?).and_return(false)
531532
end
532533

533534
context "when hr_status_code is not 'A'" do

0 commit comments

Comments
 (0)