renalware-core 2.0.26 → 2.0.27

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0c79d277b0b81eceb715ec9f31c7a25cc280b0e3ec6ce8347136d6632cb5f8cc
4
- data.tar.gz: 05aac190cf455654b306f86e6cdac5e46eefcb0f5aa9171fe9c3b52cc3d36aa0
3
+ metadata.gz: 3db179c3655e0116ae6346710b5ab13ee30478ebf6155dd148ed4297481b71cb
4
+ data.tar.gz: d6dec13d3ed966b1a334dcf1ed7a760b03f0745140b1fe91c2e2842060d91dc8
5
5
  SHA512:
6
- metadata.gz: df11ef7661930acd45bc1a4c05d313abed4f9bb111602ebd1019fd8faf99b8c8514a1757329d6bfe0912f08177efca748f024dce62eff5c4d96f79bde64901a9
7
- data.tar.gz: 6d82a3f8a45dba2cf167a6709a09a8c2b023b1d2b83b346cd60b53259acc101a9081f8605a77cbf0a6f6d9826d46826599144eccec515a5c0e67ec5e5c2ce891
6
+ metadata.gz: c42e3954747469956ebafe5df3a8228530ac36d2196ec541f08661c99a80be74167bc3c864ed9224e77bcd74d7e876f5ef8bc77fa6c00af3e74f040e2b98082e
7
+ data.tar.gz: cead17eef7473469f7d8fe9b31a99890e601a3d98f68098b0caa5a4d5e10270e97357b18a7871c29557dc18bbc577e32530876621d4e8ccf7dfadfe38c0f55c4
@@ -16,16 +16,18 @@ class DatePickerInput < SimpleForm::Inputs::StringInput
16
16
  end
17
17
  end
18
18
 
19
+ # rubocop:disable Metrics/AbcSize
19
20
  def input_column(_wrapper_options = {})
20
21
  html_options = input_html_options
21
22
  html_options[:class] ||= []
22
23
  html_options[:class] << class_name
23
24
  template.content_tag(:div, class: "small-10 columns") do
24
25
  datestamp = @builder.object.public_send(attribute_name)
25
- value = datestamp.present? ? I18n.l(datestamp) : ""
26
+ value = format_date(datestamp)
26
27
  template.concat @builder.text_field(attribute_name, html_options.merge(value: value))
27
28
  end
28
29
  end
30
+ # rubocop:enable Metrics/AbcSize
29
31
 
30
32
  def icon_calendar
31
33
  "<span class='prefix'><i class='fa fa-calendar'></i></span>".html_safe
@@ -38,4 +40,20 @@ class DatePickerInput < SimpleForm::Inputs::StringInput
38
40
  def class_name
39
41
  "datepicker"
40
42
  end
43
+
44
+ private
45
+
46
+ # Note that datestamp will be some kind of Date object *unless* its an invalid date string
47
+ # e.g. "12-00-2010" that has for example been imported from another system, and its one we
48
+ # happen to store in Rw2 in jsonb where there is no database type checking.
49
+ # We have seen this in LowClerance::Profile.document.
50
+ # So if we get an error converting an invalid date string, return it as is and let the
51
+ # user correct it in the UI. Note that without this error handling, the user will
52
+ # not be able to view the form to correct the data.
53
+ def format_date(datestamp)
54
+ return "" if datestamp.blank?
55
+ I18n.l(datestamp)
56
+ rescue I18n::ArgumentError # e.g. its a string containing an invalid date
57
+ datestamp
58
+ end
41
59
  end
@@ -22,7 +22,7 @@ module Renalware
22
22
  def validate_diastolic_less_than_systolic(bp)
23
23
  errors = bp.errors
24
24
  return if errors.any?
25
- unless bp.diastolic < bp.systolic
25
+ unless bp.diastolic.to_f < bp.systolic.to_f
26
26
  errors.add(:diastolic, :must_be_less_than_systolic)
27
27
  end
28
28
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Renalware
4
- VERSION = "2.0.26"
4
+ VERSION = "2.0.27"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: renalware-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.26
4
+ version: 2.0.27
5
5
  platform: ruby
6
6
  authors:
7
7
  - Airslie
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-05-21 00:00:00.000000000 Z
11
+ date: 2018-05-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: active_type