lita-diabetter 1.3.0 → 1.3.1

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
- SHA1:
3
- metadata.gz: 412f97fc8e7d7cc66dbc55a9671d6a0b62cc63c2
4
- data.tar.gz: 5870f41b7335fe4b98ca914e6946225a13521726
2
+ SHA256:
3
+ metadata.gz: 4075a9209e16c89636d2d9fab8396de3d0b6e192d58dadc5148686eb5ec76f8c
4
+ data.tar.gz: 2940024d613fa271bb67a4e00ada81af9a1babf5bdef2b00b12f259f113b0468
5
5
  SHA512:
6
- metadata.gz: f21ea54cb1393ffca56f8be06c88b0364fde195aa5bfad39b94f64a9c3a6396ea11a50d0d76ccbe40ee737130e773de27177ccf74044b132e1b592c2f5a75147
7
- data.tar.gz: 3fc7747e611c109aa713ea060d05856c9b65738fa5a799e312bd68ef864087374a224149a52922e8844d27da0df76bdb7b61c1aa75b55f07ac47c39017ad91c3
6
+ metadata.gz: 7bf5ea551902519976f56a0e98b0e21b0fcb3dbd2fa4af8dba00829e567f24109b31b9ebf992a571671605e13f2236ba45f3bea8cc2bb6d16c7ea5266f5faa2d
7
+ data.tar.gz: b52b9d5697c3fb857f24a743af8293da3044c318b1eb38275d66ab045f53c0647709498b0b3efb3a234dfd30fd1971bd97e3db219676577579c7c2f5d1b4f01a
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2015 Chris Baker
2
+ Modified 2017-2018 Cas Eliëns
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ of this software and associated documentation files (the "Software"), to deal
6
+ in the Software without restriction, including without limitation the rights
7
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the Software is
9
+ furnished to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in
12
+ all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20
+ THE SOFTWARE.
data/README.md CHANGED
@@ -1,9 +1,6 @@
1
1
  # lita-diabetter
2
2
 
3
3
  [![Build Status][travis-img]][travis-url]
4
- [![Gem Version][gem-img]][gem-url]
5
- [![Gem Downloads][gem-dl-img]][gem-url]
6
- [![Dependency status][gem-dep-img]][gem-dep-url]
7
4
  [![Codacy Badge][codacy-img]][codacy-url]
8
5
 
9
6
  TODO: Add a description of the plugin.
@@ -25,12 +22,7 @@ TODO: Describe any configuration attributes the plugin exposes.
25
22
  TODO: Describe the plugin's features and how to use them.
26
23
 
27
24
 
28
- [travis-img]: https://img.shields.io/travis/cascer1/lita-diabetter.svg
29
- [travis-url]: https://travis-ci.org/cascer1/lita-diabetter
30
- [gem-img]: https://img.shields.io/gem/v/lita-diabetter.svg
31
- [gem-url]: https://badge.fury.io/rb/lita-diabetter
32
- [gem-dl-img]: https://img.shields.io/gem/dv/lita-diabetter/stable.svg
33
- [gem-dep-img]: https://img.shields.io/gemnasium/cascer1/lita-diabetter.svg
34
- [gem-dep-url]: https://gemnasium.com/github.com/cascer1/lita-diabetter
35
- [codacy-img]: https://img.shields.io/codacy/grade/218ed88601a243ccae18e98e590b622d.svg
36
- [codacy-url]: https://www.codacy.com/app/cascer1/lita-diabetter?utm_source=github.com&utm_medium=referral&utm_content=cascer1/lita-diabetter&utm_campaign=Badge_Grade
25
+ [travis-img]: https://img.shields.io/travis/reddit-diabetes/lita-diabetter.svg
26
+ [travis-url]: https://travis-ci.org/reddit-diabetes/lita-diabetter
27
+ [codacy-img]: https://img.shields.io/codacy/grade/961f455809254f509472986930d06d46.svg
28
+ [codacy-url]: https://www.codacy.com/app/cascer1/lita-diabetter_2?utm_source=github.com&utm_medium=referral&utm_content=reddit-diabetes/lita-diabetter&utm_campaign=Badge_Grade
@@ -27,6 +27,10 @@ module Lita
27
27
  'estimate average [from a1c] <A1C>' => 'Estimates average blood glucose'
28
28
  })
29
29
 
30
+ route(/estimate average(?: from a1c)?\s+(\d{1,3}\.?\d?)\s?+%$/i, :estimate_average_from_dcct, command: true, help: {
31
+ 'estimate average [from a1c] <A1C>%' => 'Estimates average blood glucose from DCCT HbA1c (%)'
32
+ })
33
+
30
34
  def convert(response)
31
35
  if response.message.body.match(URI.regexp(%w(http https))).nil?
32
36
  input = response.matches[0][0]
@@ -101,7 +105,7 @@ module Lita
101
105
  reply = "*I'm not sure if you entered mmol/L or mg/dL, so I'll give you both*\n"
102
106
  reply += make_average_sentence('mmol', mmol, dcct_alt, ifcc_alt) + "\n"
103
107
  reply += make_average_sentence('mgdl', mgdl, dcct, ifcc)
104
- elsif type=='mmol'
108
+ elsif type == 'mmol'
105
109
  reply = make_average_sentence('mmol', mmol, dcct, ifcc)
106
110
  else
107
111
  reply = make_average_sentence('mgdl', mgdl, dcct, ifcc)
@@ -136,12 +140,29 @@ module Lita
136
140
  end
137
141
 
138
142
  mgdl = dcct_to_mgdl(dcct)
143
+ mmol = mgdl_to_mmol(mgdl).round(1)
139
144
 
140
145
  reply = 'an A1C of ' + dcct.to_s + '% (DCCT) or '
141
146
  reply = reply + ifcc.to_s + ' mmol/mol (IFCC)'
142
147
  reply = reply + ' is about '
143
148
  reply = reply + mgdl.round.to_s + ' mg/dL or '
144
- reply = reply + mgdl_to_mmol(mgdl).round(1).to_s + ' mmol/L'
149
+ reply = reply + mmol.to_s + ' mmol/L'
150
+ response.reply(reply)
151
+ end
152
+
153
+ def estimate_average_from_dcct(response)
154
+ input = response.matches[0][0]
155
+ Lita.logger.debug('Converting a1c to BG for input "' + input + '"')
156
+ a1c = input.to_f
157
+ dcct = a1c.round(1)
158
+
159
+ mgdl = dcct_to_mgdl(dcct)
160
+ mmol = mgdl_to_mmol(mgdl).round(1)
161
+
162
+ reply = 'an A1C of ' + dcct.to_s + '%'
163
+ reply = reply + ' is about '
164
+ reply = reply + mgdl.round.to_s + ' mg/dL or '
165
+ reply = reply + mmol.to_s + ' mmol/L'
145
166
  response.reply(reply)
146
167
  end
147
168
 
@@ -1,5 +1,5 @@
1
1
  Gem::Specification.new do |spec|
2
- base_version = '1.3.0'
2
+ base_version = '1.3.1'
3
3
 
4
4
  spec.name = 'lita-diabetter'
5
5
  spec.version = base_version
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lita-diabetter
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cas Eliëns
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-25 00:00:00.000000000 Z
11
+ date: 2018-03-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lita
@@ -104,6 +104,7 @@ files:
104
104
  - ".gitignore"
105
105
  - ".travis.yml"
106
106
  - Gemfile
107
+ - LICENSE
107
108
  - README.md
108
109
  - Rakefile
109
110
  - lib/lita-diabetter.rb
@@ -135,7 +136,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
135
136
  version: '0'
136
137
  requirements: []
137
138
  rubyforge_project:
138
- rubygems_version: 2.4.5
139
+ rubygems_version: 2.7.6
139
140
  signing_key:
140
141
  specification_version: 4
141
142
  summary: Provides diabetes-related commands like glucose value conversions