weight-recorder 0.1.5 → 0.1.6

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
  SHA1:
3
- metadata.gz: 0f6944195147fc778f858c2ac0fd38b33d3164ae
4
- data.tar.gz: 4c70a8b41f2f92e2bf9ea15456cb3c9ba26dbb57
3
+ metadata.gz: 37b8cef4286eff5f68a74e5bce11df52c7c51750
4
+ data.tar.gz: f1c9cac910de4bef254e232b311955cce3283a62
5
5
  SHA512:
6
- metadata.gz: 2419a8349fc7f277510ba97dfdde77b3f83b1c174eba4ecdcf3db603837d8c359ffecc89a9462db7833e89c6c218ab1160a73513868816126e83db22ebefae51
7
- data.tar.gz: a6ef9c191b2b3e6a5f21a3deeb52e44d0484ba06ba9f4c8e78aa705fe328ee351f8990528e90e5966e4886a45c07962ee8f33ebc0ca925d6a01d983a0fbb9db3
6
+ metadata.gz: 6d1b3af76a0a36c67e9ef4f75508fd3e16d68d9f066c71d1b22400fd7eca92d1ca6a9a5f3239d42ddb6f504960d76ae72995978122ef4234f591d4db4806f7fb
7
+ data.tar.gz: 099b9af4aee0e3081b39ab11d38e26070f99abc91cd2b3fc96a262a1deb095e57d6d67e71f9255dc192dd0e0bf9a378e7273afb4348df250c670a5f97441e5e4
@@ -97,6 +97,12 @@ cid name type notnull dflt_value pk
97
97
  sqlite> .quit
98
98
  >>>
99
99
 
100
+ !sqlite3の編集
101
+ ...>
102
+ で抜けられなくなって...
103
+ ...>;
104
+ でした.
105
+
100
106
  ! weight-recorderの修正
101
107
  以降の修正は,
102
108
  bundle exec rackup
@@ -86,14 +86,40 @@ module Recorder
86
86
  get '/chart' do
87
87
  @weight_options = {min: 84, max: 90}
88
88
  @bodyfat_options = {min: 15, max: 30}
89
- @weight_data,@bodyfat_data = get_data
89
+ @weight_data,@bodyfat_data = get_data()
90
90
  haml :chart
91
91
  end
92
92
 
93
- def get_data
93
+ get '/chart_week' do
94
+ @weight_options = {min: 84, max: 90}
95
+ @bodyfat_options = {min: 15, max: 30}
96
+ @weight_data,@bodyfat_data = get_data(:week)
97
+ haml :chart
98
+ end
99
+
100
+ get '/chart_month' do
101
+ @weight_options = {min: 84, max: 90}
102
+ @bodyfat_options = {min: 15, max: 30}
103
+ @weight_data,@bodyfat_data = get_data(:month)
104
+ haml :chart
105
+ end
106
+
107
+ require 'date'
108
+ require 'time'
109
+ def get_data(period=:all)
94
110
  @data = Data.order('created_at DESC')
95
111
  weight_data,bodyfat_data=[],[]
96
- @data.each{|d|
112
+ today = Date.today
113
+ week_before=Time.parse((today-7).strftime)
114
+ month_before=Time.parse((today-28).strftime)
115
+ @data.each{|d|
116
+ case period
117
+ when :all
118
+ when :week
119
+ next if d.date < week_before
120
+ when :month
121
+ next if d.date < month_before
122
+ end
97
123
  weight_data << [d.date,d.weight]
98
124
  bodyfat_data << [d.date,d.bodyfat]
99
125
  }
@@ -1,3 +1,3 @@
1
1
  module Recorder
2
- VERSION = "0.1.5"
2
+ VERSION = "0.1.6"
3
3
  end
@@ -0,0 +1,8 @@
1
+ %h1 Editing data
2
+
3
+ %form.form-horizontal(method='post'){action: uri("/data/#{@data.id}")}
4
+ != haml :_form, locals: {task: @task}
5
+ %input(name='_method' type='hidden' value='put')
6
+ .form-group
7
+ .col-sm-offset-2.col-sm-10
8
+ %button(name='commit' type='submit') Update
@@ -17,10 +17,14 @@
17
17
  %a.navbar-brand Bob's weight
18
18
  %button{class: ('btn btn-default navbar-btn')}
19
19
  %a(class="glyphicon glyphicon-pencil"){href: uri('data/new')} new
20
- %button{class: ('btn btn-default navbar-btn')}
21
- %a(class="glyphicon glyphicon-picture"){href: uri('chart')} chart
22
20
  %button{class: ('btn btn-default navbar-btn')}
23
21
  %a(class="glyphicon glyphicon-th-list"){href: uri('data')} data
22
+ %button{class: ('btn btn-default navbar-btn')}
23
+ %a(class="glyphicon glyphicon-picture"){href: uri('chart')} all
24
+ %button{class: ('btn btn-default navbar-btn')}
25
+ %a(class="glyphicon glyphicon-picture"){href: uri('chart_week')} week
26
+ %button{class: ('btn btn-default navbar-btn')}
27
+ %a(class="glyphicon glyphicon-picture"){href: uri('chart_month')} month
24
28
 
25
29
  .container
26
30
  !=yield
@@ -1,18 +1,7 @@
1
1
  %h1 New Data
2
2
 
3
3
  %form.form-horizontal(method='post'){action: uri('/data')}
4
- .control-group
5
- %label.control-label(for='weight') Weight[kg]
6
- .controls
7
- %input#weight.span3(name='weight' type='text'){value: @data.weight}
8
- .control-group
9
- %label.control-label(for='bodyfat') Body Fat[%]
10
- .controls
11
- %input#bodyfat.span3(name='bodyfat' type='text'){value: @data.bodyfat}
12
- .control-group
13
- %label.control-label(for='date') Measuring Time
14
- .controls
15
- %input#bodyfat.span3(name='date' type='text'){value: @data.date}
4
+ != haml :_form, locals: {task: @task}
16
5
  .control-group
17
6
  .controls
18
7
  %button(name='commit' type='submit') Create
@@ -0,0 +1,18 @@
1
+ %h1 New Data
2
+
3
+ %form.form-horizontal(method='post'){action: uri('/data')}
4
+ .control-group
5
+ %label.control-label(for='weight') Weight[kg]
6
+ .controls
7
+ %input#weight.span3(name='weight' type='text'){value: @data.weight}
8
+ .control-group
9
+ %label.control-label(for='bodyfat') Body Fat[%]
10
+ .controls
11
+ %input#bodyfat.span3(name='bodyfat' type='text'){value: @data.bodyfat}
12
+ .control-group
13
+ %label.control-label(for='date') Measuring Time
14
+ .controls
15
+ %input#bodyfat.span3(name='date' type='text'){value: @data.date}
16
+ .control-group
17
+ .controls
18
+ %button(name='commit' type='submit') Create
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.5
4
+ version: 0.1.6
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-09-29 00:00:00.000000000 Z
11
+ date: 2016-09-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -243,7 +243,7 @@ files:
243
243
  - lib/recorder/data.rb
244
244
  - lib/recorder/db.rb
245
245
  - lib/recorder/version.rb
246
- - lib/views/#layout.haml#
246
+ - lib/views/#edit.haml#
247
247
  - lib/views/_errors.haml
248
248
  - lib/views/_form.haml
249
249
  - lib/views/chart.haml
@@ -251,6 +251,7 @@ files:
251
251
  - lib/views/index.haml
252
252
  - lib/views/layout.haml
253
253
  - lib/views/new.haml
254
+ - lib/views/new.haml.old
254
255
  - weight-recorder.gemspec
255
256
  - weight-recorder.wiki/README_en.md
256
257
  - weight-recorder.wiki/modify_db.md
@@ -1,17 +0,0 @@
1
- !!!
2
- %html
3
- %head
4
- %meta(charset='utf-8')
5
- %meta(name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1,user-scalable=no")
6
- %title Weight Recorder
7
- /%link(href='/css/bootstrap.min.css' rel='stylesheet' type='text/css')
8
- %link(rel='stylesheet' type='text/css'){href: uri('css/bootstrap.min.css')}
9
-
10
- %a(class="glyphicon glyphicon-plus-sign" href='data/new') new
11
- %button{class: ('btn btn-default navbar-btn')}
12
- %a(class="glyphicon glyphicon-asterisk" href='chart') chart
13
- %a(class="glyphicon glyphicon-asterisk" href='data') data
14
- %button{class: ('btn btn-default navbar-btn')}
15
-
16
- .container
17
- !=yield