malawi_hiv_program_reports 1.0.4 → 1.0.6

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: 983a5f42853899df0a2bda901e81fd8f2295eeac7bcf166bd8a6eeaceb79ad5e
4
- data.tar.gz: 55628f6d08dc32cfd83d1f143fc63271d7946193b6d71b3c5258af32d4e9d7dd
3
+ metadata.gz: e6d7725bbae83b356b36e8124d6e938b16bf43ca789948da6d9a89964b97f2d8
4
+ data.tar.gz: 9cd388fee4284e632399135f1dfcd7810ffe9b6c6bc8158ff70f6b3ed8431702
5
5
  SHA512:
6
- metadata.gz: c29ba90dced14c1b93b02dc67d9d592713749f8107c1aed265a70437081040b69044a149828c6c8843ffe3c0183d2ca88df59718d7f7f91ca755c539f71dbfe2
7
- data.tar.gz: 74da135406319339851244013d6b192d60b5e0c93386dd0f9003bbd0e36044b43b1357c575195117c56c5ec17eaa4ad9713e9f33f92c0db5d1c8acfd6cb3f7d5
6
+ metadata.gz: fcb5645fe7df71c690e0d1c4548c4ccb7dc9c261ff8fea52bc19a134354ffc0b4faa9032ab56c55597b50ab3790b45205773a1df52f41d216d55473aa55f7f8d
7
+ data.tar.gz: f66a1b98edfe2fc4ecdf4594d91a9f9a1a6bfd6c279536f9cc2f74e7c9bb4f75571d6abfbdcd718cdcb9569139beb940ef81b949996cf760ebfee8f6f5cbbba8
@@ -82,7 +82,7 @@ module MalawiHivProgramReports
82
82
 
83
83
  ActiveRecord::Base.connection.execute <<~SQL
84
84
  INSERT INTO temp_patient_outcomes
85
- SELECT patients.patient_id, 'Patient died', MIN(patient_state.start_date), #{@location}
85
+ SELECT patients.patient_id, 'Patient died', patient_state.start_date, #{@location}
86
86
  FROM temp_earliest_start_date AS patients
87
87
  INNER JOIN patient_program
88
88
  ON patient_program.patient_id = patients.patient_id
@@ -94,6 +94,10 @@ module MalawiHivProgramReports
94
94
  AND patient_state.start_date < #{interval_manager(date:, value: 1, interval: 'DAY', operator: '+')}
95
95
  AND patient_state.voided = 0 #{site_manager(operator: 'AND', column: 'patient_state.site_id', location: @location)}
96
96
  WHERE patients.date_enrolled <= #{date} #{site_manager(operator: 'AND', column: 'patients.site_id', location: @location)}
97
+ AND patient_state.date_created = (SELECT MAX(date_created)
98
+ FROM patient_state ps#{' '}
99
+ WHERE ps.patient_program_id = patient_state.patient_program_id #{site_manager(operator: 'AND', column: 'ps.site_id', location: @location)}#{' '}
100
+ AND ps.state = patient_state.state AND ps.voided = 0)
97
101
  GROUP BY patients.patient_id
98
102
  SQL
99
103
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MalawiHivProgramReports
4
- VERSION = '1.0.4'
4
+ VERSION = '1.0.6'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: malawi_hiv_program_reports
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roy Chanunkha