File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ Settings:
66 upload_host : " upload.lib.berkeley.edu"
77 upload_user : " ssullivan"
88 last_alma_purge : " 2023-06-30"
9- application_version : " 1.5.6 "
9+ application_version : " 1.5.8 "
1010
1111# TODO - flesh this out
1212# http://docopt.org/
Original file line number Diff line number Diff line change @@ -9,21 +9,6 @@ module UCPath
99 class Jobs
1010 attr_accessor :job , :first_job
1111
12- class << self
13- # We're no longer skipping users who do not have an eligible job.
14- # But we still need a "job record" quick and dirty to create a dummy job
15- # and set the expiration date (expected_end_date) to today.
16- def dummy_job
17- OpenStruct . new (
18- hr_status_code : 'I' ,
19- expected_end_date : Date . today . to_s ,
20- org_relationship_code : nil ,
21- dept_desc : 'NO_JOB_FOUND' ,
22- job_code : nil
23- )
24- end
25- end
26-
2712 def initialize ( id )
2813 # Fetch the raw job data
2914 job_data = fetch_jobs ( id )
Original file line number Diff line number Diff line change @@ -58,15 +58,22 @@ def initialize(id)
5858 # date to the current date so that they will get purged from Alma.
5959 # We'll either use the first job found (which is the users most recent job)
6060 # or we'll create a dummy job with the expected_end_date set to today.
61+ # AP-359: Update, if there is no job (elgible or otherwise) then, like
62+ # Gandalf said: YOU SHALL NOT PASS!
6163 unless @jobs . eligible_job?
6264 if @jobs . first_job
6365 logger . info "#{ id } - No eligible job found, using first job"
6466 @jobs . job = @jobs . first_job
6567
6668 @jobs . job . expected_end_date = Date . today . to_s
6769 else
68- logger . info "#{ id } - No job found, using a dummy job"
69- @jobs . job = Jobs . dummy_job
70+ @eligible = false
71+ @jobs = nil
72+ @user = nil
73+ @ucpath_rec = nil
74+
75+ logger . info "#{ id } - Eligible: #{ eligible? } "
76+ return
7077 end
7178 end
7279
Original file line number Diff line number Diff line change 524524 expect ( u . rec . job_description ) . to eq ( 'FIRST_JOB_DESCRIPTION' )
525525 end
526526
527- it 'uses a dummy job if no jobs are found' do
527+ it 'skips a user if no jobs are found' do
528528 id = '999999999'
529529 stub_ucpath_user ( id )
530530 stub_ucpath_jobs ( id )
531531
532- # Stub our LDAP
533- ldap_id = '0000'
534- ldap_stub = stub_ldap ( ldap_id )
535- entries = [
536- { 'sn' => [ 'test_last_name' ] } ,
537- { 'givenname' => [ 'test_first_name' ] }
538- ]
539-
540- allow ( Net ::LDAP ) . to receive ( :new ) . with ( ldap_stub [ 'params' ] ) . and_return ( ldap_stub [ 'connection' ] )
541- expect ( ldap_stub [ 'connection' ] ) . to receive ( :bind )
542- expect ( ldap_stub [ 'connection' ] ) . to receive ( :search ) . with ( ldap_stub [ 'base' ] ) . and_yield ( entries [ 0 ] ) . and_yield ( entries [ 1 ] )
543-
544532 u = UCPath ::User . new ( id )
545533
546- expect ( u . rec . job_description ) . to eq ( 'NO_JOB_FOUND' )
534+ expect ( u . eligible? ) . to be ( false )
547535 end
548536
549537 it 'skips users that have a termination date before the last Alma purge date' do
You can’t perform that action at this time.
0 commit comments