his_emr_api_lab 1.0.3 → 1.0.4

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
  SHA256:
3
- metadata.gz: 2df320fe6cce133cd3cd516aebd842d8a9ab7320cb9cb5e2e79340f60b49539f
4
- data.tar.gz: 3d6ce39059259b7ce8cf6d7c0bc8c80ebf6d5ffc8866acdf1eebe31fa525d4d1
3
+ metadata.gz: 6142a8351eea3dc6cc2dde34b014948bd95c5d4398355ddc29d2aa0ddff8c095
4
+ data.tar.gz: ca4493c370000ab13cae02629c8cc3ea840f9bf03a70dee35a3f8bc3574e12e3
5
5
  SHA512:
6
- metadata.gz: 6aa3de66346efe68f9fd54cc1bea99867a7db756788d05e3e5bf642c5d4bd6ae54b50c075e99d8819f309e4649edfdbcda7cb9ff7130fa6175e29d2b585aa55d
7
- data.tar.gz: ae44bc491a32582b695aad56c0abfbb21cbd4b1f40843ad9f17cd2ff4d05205fbb5226c1e1cedb24eab9d3700ac6d0e54ba5256f8abb99796cc7827772ff47ec
6
+ metadata.gz: b18abf5a9f7e00c213ff41bea37c924f7c5abafbfefd5f63727c76093d26e057391ddb047e4a2583fbfdb9d98bd05895387cc6b26aacfe54df4a290cb804f9b9
7
+ data.tar.gz: e7e23b2a1eb5d387855e7acc7e1bd60dcdfca08938245693a07833a6fc43314e1127a9108eaaf8e1536fa3e16acaaa74ecf104d107b3fb71a98ad9b0c4b8a875
@@ -209,7 +209,7 @@ module Lab
209
209
  raise MissingAccessionNumber if order_dto[:tracking_number].blank?
210
210
 
211
211
  logger.info("Importing LIMS order ##{order_dto[:tracking_number]}")
212
- mapping = LimsOrderMapping.find_by(lims_id: order_dto[:_id])
212
+ mapping = find_order_mapping_by_lims_id(order_dto[:_id])
213
213
 
214
214
  ActiveRecord::Base.transaction do
215
215
  if mapping
@@ -221,7 +221,6 @@ module Lab
221
221
  order_id: order['id'],
222
222
  pulled_at: Time.now,
223
223
  revision: order_dto['_rev'])
224
- byebug unless mapping.errors.empty?
225
224
  end
226
225
 
227
226
  order
@@ -339,6 +338,16 @@ module Lab
339
338
  def last_seq_path
340
339
  LIMS_LOG_PATH.join('last_seq.dat')
341
340
  end
341
+
342
+ def find_order_mapping_by_lims_id(lims_id)
343
+ mapping = Lab::LimsOrderMapping.find_by(lims_id: lims_id)
344
+ return nil unless mapping
345
+
346
+ return mapping if Lab::LabOrder.where(order_id: mapping.order_id).exists?
347
+
348
+ mapping.destroy
349
+ nil
350
+ end
342
351
  end
343
352
  end
344
353
  end
data/lib/lab/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Lab
4
- VERSION = '1.0.3'
4
+ VERSION = '1.0.4'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: his_emr_api_lab
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elizabeth Glaser Pediatric Foundation Malawi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-06-10 00:00:00.000000000 Z
11
+ date: 2021-06-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: couchrest