vr_12_score 1.0.0 → 1.0.1

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/vr_12_score.rb +8 -8
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0e650a4cb7490c1fba739a0ce2ddd6602737f95f
4
- data.tar.gz: 90281394a78b1766d0f706fba13118658593b3d4
3
+ metadata.gz: 5a5c1bbc3386ccf7f0c85d319d01a6cd2d18fa1b
4
+ data.tar.gz: cf847a8ee67cbacf1671c51b9dba0ae4bc4cd742
5
5
  SHA512:
6
- metadata.gz: 568a46370d1fb631856c7eaa99c4f8bd192c35b22a6df12ee41321cc9018f0519e4f5fbdc1f0cd365a8d380614c379f62c421be82e13bf48372d22eb840e60a5
7
- data.tar.gz: d853941687edb5bee03adbeb211d87a857ad3bc4c54f59e27f141ecd98d52f9fd570d92b722b3b9666948696cdbd63edf20788ce55118da69b4324fd51d00012
6
+ metadata.gz: 536bf72b8f5ccd90926ce44e519dd8cb59676caccb6079e3eb3efe2d1b4634ef4aa8100099805583ea0fe4ad66a628cd7afe3dfad4a4bb0abf59427bf1936725
7
+ data.tar.gz: e6857d1993790613d1cb015f5395842b534e86a1e485fc8a076f641c70f686c5915f1391ac300c3aec7201a6e1d48b44db42dd2fbddcba6aabdd20e066ddf4dc
data/lib/vr_12_score.rb CHANGED
@@ -101,8 +101,8 @@ class Vr12Score
101
101
  key = 0
102
102
  blank_questions.each {|q| key |= 1 << QUESTION_LABELS.reverse.index(q)}
103
103
 
104
- pcs_row = pcs_data[:key].index(key)
105
- mcs_row = mcs_data[:key].index(key)
104
+ pcs_row = pcs_data[:key].index("#{key}")
105
+ mcs_row = mcs_data[:key].index("#{key}")
106
106
 
107
107
  pcs = mcs = nil
108
108
  if pcs_row
@@ -111,12 +111,12 @@ class Vr12Score
111
111
  # then adding the appropriate constant term, based on which questions were answered.
112
112
  # Convert survey answers to integers to handle nil values (will not affect the weighted sum)
113
113
  # Add 'x' to end of question labels to look up weights to match the headers of the weight files.
114
- pcs = QUESTION_LABELS.map {|q| survey[q].to_i * pcs_weights[weight_name(q)]}.reduce(&:+) + pcs_weights[:cons]
114
+ pcs = QUESTION_LABELS.map {|q| survey[q].to_i * pcs_weights[weight_name(q)].to_f}.reduce(&:+) + pcs_weights[:cons].to_f
115
115
  end
116
116
 
117
117
  if mcs_row
118
118
  mcs_weights = mcs_data[mcs_row]
119
- mcs = QUESTION_LABELS.map {|q| survey[q].to_i * mcs_weights[weight_name(q)]}.reduce(&:+) + mcs_weights[:cons]
119
+ mcs = QUESTION_LABELS.map {|q| survey[q].to_i * mcs_weights[weight_name(q)].to_f}.reduce(&:+) + mcs_weights[:cons].to_f
120
120
  end
121
121
 
122
122
  return {pcs: pcs, mcs: mcs}
@@ -130,18 +130,18 @@ class Vr12Score
130
130
  end
131
131
 
132
132
  def pcs_phone_data
133
- @pcs_phone_data ||= CSV.table(File.join(@weights_dir, @pcs_phone_file))
133
+ @pcs_phone_data ||= CSV.table(File.join(@weights_dir, @pcs_phone_file), converters: nil)
134
134
  end
135
135
 
136
136
  def mcs_phone_data
137
- @mcs_phone_data ||= CSV.table(File.join(@weights_dir, @mcs_phone_file))
137
+ @mcs_phone_data ||= CSV.table(File.join(@weights_dir, @mcs_phone_file), converters: nil)
138
138
  end
139
139
 
140
140
  def pcs_mail_data
141
- @pcs_mail_data ||= CSV.table(File.join(@weights_dir, @pcs_mail_file))
141
+ @pcs_mail_data ||= CSV.table(File.join(@weights_dir, @pcs_mail_file), converters: nil)
142
142
  end
143
143
 
144
144
  def mcs_mail_data
145
- @mcs_mail_data ||= CSV.table(File.join(@weights_dir, @mcs_mail_file))
145
+ @mcs_mail_data ||= CSV.table(File.join(@weights_dir, @mcs_mail_file), converters: nil)
146
146
  end
147
147
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vr_12_score
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Trainer Rx