Skip to content

Commit 76564e4

Browse files
authored
shift in whole day increments (#1948)
* shift in whole day increments * change variable to seconds_in_day
1 parent 2105f85 commit 76564e4

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

lib/cypress/population_clone_job.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,9 @@ def randomize_ids(patients, prng)
7676
randomization_ids = options['randomization_ids'].shuffle(random: prng)[0..how_many]
7777
random_patients = Patient.find(randomization_ids).to_a
7878
random_patients.each do |patient|
79+
seconds_in_day = 86_400 # 60 secs per min * 60 min per hour * 24 hours
7980
plus_minus = prng.rand(2).zero? ? 1 : -1 # use this to make move dates forward or backwards
80-
date_shift = prng.rand(1_944_000) * plus_minus # 1_944_000 = 60 secs per min * 60 min per hour * 24 hours in day * 10 days
81+
date_shift = prng.rand(10) * seconds_in_day * plus_minus
8182
patient.qdmPatient.shift_dates(date_shift)
8283
patients << patient
8384
end

0 commit comments

Comments
 (0)