kuali_toolbox 0.41 → 0.42

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ff0fe7e4b41d157f2dbe3bcbd892eb81328b050e
4
- data.tar.gz: 70060a8d700825d2dc643359a8526f52e0fc0407
3
+ metadata.gz: 4247d6c4bb00a266d556c58051c2d0ee70a24322
4
+ data.tar.gz: 649bddc5ccb7ffd32fda70571c8ae511fa3cd51e
5
5
  SHA512:
6
- metadata.gz: 6dc410080bf76e551112d3d628e881ba40ce4ae00194bccdc7a4757829411279b9d88bd7c9c426765d8c667a1afd9348c2193a50b4bf6e666abd499a0a94cf8d
7
- data.tar.gz: ed51b281d44b15579f43fc485d142401bad7a50067dfb6433786d0e2c988b2955e62f2434a9b9f945d4f5cce08c42fb3df576d4891f479192daa40604905b84e
6
+ metadata.gz: 0c0bb722051db60343b7cd4f42b18512d1a362bbd974bd5a904eb7a056f08154fd70e66619300ae842b1e3f5473955e01dc2497a28ff269362fe113bbef925f0
7
+ data.tar.gz: 223df77e098c555ca51d5180d0a4ebfb377ab572356864a877074a19c22dc78482e30e7f58de8ef6f5fbbdf09213b270795d79fcc6379615d42813aafe5c75d7
@@ -189,7 +189,7 @@ def buildAffiliations(row)
189
189
 
190
190
  if (!emp.empty?)
191
191
  emp[:primaryEmployment] = true
192
- aff[:employment] = []
192
+ aff[:employment] = [];
193
193
  aff[:employment].push(emp);
194
194
  end
195
195
  if (!aff.empty?)
@@ -295,6 +295,20 @@ def addToListIfNotIncluded(item, list)
295
295
  end
296
296
  end
297
297
 
298
+ def mergeEmployment(record, newAffiliation)
299
+ if (!newAffiliation[:employment].nil?)
300
+ newAffiliation[:employment].each do |employmentInfo|
301
+ if (record[:employment].nil?)
302
+ record[:employment] = []
303
+ end
304
+ if (!record[:employment].find{ |x| x[:primaryEmployment] }.nil?)
305
+ employmentInfo[:primaryEmployment] = false
306
+ end
307
+ record[:employment].push(employmentInfo)
308
+ end
309
+ end
310
+ end
311
+
298
312
  opt = parse_command_line_options (File.basename $0), ARGF.argv
299
313
 
300
314
  text_parse_errors = []
@@ -315,8 +329,23 @@ CSV.open(opt[:csv_filename], opt[:csv_options]) do |csv|
315
329
  if (!newAffiliation.nil? && record[:affiliations].nil?)
316
330
  record[:affiliations] = []
317
331
  end
318
- if (!record[:affiliations].include? newAffiliation)
332
+ duplicateAffil = record[:affiliations].find{ |affil| affil[:affiliationType] == newAffiliation[:affiliationType] && affil[:campus] == newAffiliation[:campus]};
333
+ if (duplicateAffil.nil?)
334
+ if (newAffiliation[:default] && !record[:affiliations].find{ |x| x[:default] }.nil?)
335
+ newAffiliation[:default] = false
336
+ end
337
+ mergeEmployment(record, newAffiliation)
319
338
  record[:affiliations].push(newAffiliation)
339
+ else
340
+ duplicateAffil[:employment].each do |employmentInfo|
341
+ newAffiliation[:employment].each do |newEmployment|
342
+ if (employmentInfo.select{ |key, value| key != :primaryEmployment} != newEmployment.select{ |key, value| key != :primaryEmployment})
343
+ e = Struct.new(:message).new("WARNING:Duplicate employment info for single affiliation. Skipping extra employment info on #{$.}");
344
+ puts e.message;
345
+ text_parse_errors.push e;
346
+ end
347
+ end
348
+ end
320
349
  end
321
350
 
322
351
  record[:names] = addToListIfNotIncluded(buildName(row), record[:names])
@@ -16,5 +16,5 @@
16
16
 
17
17
  module KualiCo
18
18
  # The gem version number.
19
- VERSION = "0.41"
19
+ VERSION = "0.42"
20
20
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kuali_toolbox
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.41'
4
+ version: '0.42'
5
5
  platform: ruby
6
6
  authors:
7
7
  - KualiCo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-14 00:00:00.000000000 Z
11
+ date: 2015-07-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: builder