weight-recorder 0.1.9 → 0.1.10
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 +4 -4
- data/lib/application.rb +12 -2
- data/lib/recorder/version.rb +1 -1
- data/lib/views/layout.haml +3 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 74b82aad9cbceb4cccbb238299e320480092c8ba
|
4
|
+
data.tar.gz: 8690d758f23d762c18d2ef5b2f715267de6aab88
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e83f583ead21d9d83e77895e674afcc5917a33930e4bf1f3658d1b125f57283b14be6bcdcd1a425d6f2b762e2a629d668dc7d5c3d66416907ccd90d41fbcc314
|
7
|
+
data.tar.gz: c2e543be74ea5a12947b381732ae1e9fc83640cd05ad1f25c5d06d2693c7e3e08227406194bf04e0aec23ba4828cfcd831e2573ee71267a8eae6464ddfeea337
|
data/lib/application.rb
CHANGED
@@ -107,18 +107,28 @@ module Recorder
|
|
107
107
|
haml :chart
|
108
108
|
end
|
109
109
|
|
110
|
+
get '/chart_recent' do
|
111
|
+
@weight_options = {min: @min, max: @max}
|
112
|
+
@bodyfat_options = {min: @min, max: @max}
|
113
|
+
@weight_data,@bodyfat_data = get_data(:recent)
|
114
|
+
haml :chart
|
115
|
+
end
|
116
|
+
|
110
117
|
require 'date'
|
111
118
|
require 'time'
|
112
119
|
|
113
|
-
def get_data(period=:
|
120
|
+
def get_data(period=:whole)
|
114
121
|
@data = Data.order('created_at DESC')
|
115
122
|
weight_data,bodyfat_data=[],[]
|
116
123
|
today = Date.today
|
117
124
|
week_before=Time.parse((today-7).strftime)
|
118
125
|
month_before=Time.parse((today-28).strftime)
|
126
|
+
recent=Time.parse('2016-8-26')
|
119
127
|
@data.each{|d|
|
120
128
|
case period
|
121
|
-
when :
|
129
|
+
when :whole
|
130
|
+
when :recent
|
131
|
+
next if d.date < recent
|
122
132
|
when :week
|
123
133
|
next if d.date < week_before
|
124
134
|
when :month
|
data/lib/recorder/version.rb
CHANGED
data/lib/views/layout.haml
CHANGED
@@ -21,11 +21,13 @@
|
|
21
21
|
%button{class: ('btn btn-default navbar-btn')}
|
22
22
|
%a(class="glyphicon glyphicon-th-list"){href: uri('data')} data
|
23
23
|
%button{class: ('btn btn-default navbar-btn')}
|
24
|
-
%a(class="glyphicon glyphicon-picture"){href: uri('chart')}
|
24
|
+
%a(class="glyphicon glyphicon-picture"){href: uri('chart')} whole
|
25
25
|
%button{class: ('btn btn-default navbar-btn')}
|
26
26
|
%a(class="glyphicon glyphicon-picture"){href: uri('chart_week')} week
|
27
27
|
%button{class: ('btn btn-default navbar-btn')}
|
28
28
|
%a(class="glyphicon glyphicon-picture"){href: uri('chart_month')} month
|
29
|
+
%button{class: ('btn btn-default navbar-btn')}
|
30
|
+
%a(class="glyphicon glyphicon-picture"){href: uri('chart_recent')} recent
|
29
31
|
|
30
32
|
.container
|
31
33
|
!=yield
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: weight-recorder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shigeto R. Nishitani
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-11-
|
11
|
+
date: 2016-11-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|