toji 1.6.3 → 1.6.4

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: fa71d753d4af9a4c3c73c00fe9a1c8d3e759ebceee63adc6ccdc2583c85153d1
4
- data.tar.gz: 3a432ecd4fcb2d55aaaac3df83138bd41cf23c17c8e1481b7741d1ee13b09dcd
3
+ metadata.gz: ea7f317a8523e02571115e31cddcd0c5f02aed9a89d64cb8ff58955545817f5c
4
+ data.tar.gz: 0c431190ff6c2120477f50e778043f7b2163d1f18d25168c635187b37610c000
5
5
  SHA512:
6
- metadata.gz: 65b271cc91a9628587e77c984db514cfb103560ff6121f1b57de6957abfa169e30e376c65241dcaeaa0cd3843bf743d80f319312d4de4ec19242038d14af13ac
7
- data.tar.gz: 0654f03b646d83039c3fd0f2b95886bd3c33c26448833b89a517357932493a3b997481d58a811db3f19113e0f5696f993ec063006b11df7fb90d02d646ddf4e4
6
+ metadata.gz: 0e10824774f5b262428d06f60c5b8b57d5d7545f0a35dc15728423eba2fe9d8fdeddde865a007adc52448e6636f75a6c43a74a4c0dd4d8540a59f7747c7ef85b
7
+ data.tar.gz: eb02aca9c2f3754c2abd31bd07aaa9cd32482d5e0ed42e99345ff61ec02cd9ba644df235ad288eef7c730bf52344a17fa8a6a2388168869bad385db734f9498c
@@ -63,14 +63,14 @@ module Toji
63
63
  date_row = _date_rows[date]
64
64
  if date_row
65
65
  koji_len.times {|i|
66
- columns << (date_row.kojis[i]&.text || "")
66
+ columns << (date_row.kojis[i]&.to_h_a || [])
67
67
  }
68
68
  rice_len.times {|i|
69
- columns << (date_row.rices[i]&.text || "")
69
+ columns << (date_row.rices[i]&.to_h_a || [])
70
70
  }
71
71
  else
72
72
  (koji_len + rice_len).times {
73
- columns << ""
73
+ columns << []
74
74
  }
75
75
  end
76
76
 
@@ -82,8 +82,26 @@ module Toji
82
82
  {header: headers, rows: rows}
83
83
  end
84
84
 
85
- def table
85
+ def table_text_data
86
86
  data = table_data
87
+ data[:rows] = data[:rows].map {|row|
88
+ row.map {|column|
89
+ if Array===column
90
+ column.map{|c|
91
+ name = c[:product_name]
92
+ weight = "%.17g" % c[:weight]
93
+ "#{name}: #{weight}"
94
+ }.join("<br>")
95
+ else
96
+ column
97
+ end
98
+ }
99
+ }
100
+ data
101
+ end
102
+
103
+ def table
104
+ data = table_text_data
87
105
 
88
106
  Plotly::Plot.new(
89
107
  data: [{
@@ -29,7 +29,8 @@ module Toji
29
29
  def to_h_a
30
30
  event_groups.map {|es|
31
31
  {
32
- product: es.first.product.to_h,
32
+ product_id: es.first.product.id,
33
+ product_name: es.first.product.name,
33
34
  weight: es.map(&:weight).sum,
34
35
  }
35
36
  }
@@ -1,6 +1,7 @@
1
1
  module Toji
2
2
  module Schedule
3
3
  class Product
4
+ attr_reader :id
4
5
  attr_reader :name
5
6
  attr_reader :description
6
7
  attr_reader :recipe
@@ -10,7 +11,8 @@ module Toji
10
11
 
11
12
  attr_reader :color
12
13
 
13
- def initialize(name, description, recipe, koji_dates, rice_dates, color=nil)
14
+ def initialize(id, name, description, recipe, koji_dates, rice_dates, color=nil)
15
+ @id = id
14
16
  @name = name
15
17
  @description = description
16
18
  @recipe = recipe
@@ -64,6 +66,7 @@ module Toji
64
66
  end
65
67
 
66
68
  new(
69
+ args[:id],
67
70
  args[:name],
68
71
  args[:description],
69
72
  recipe,
data/lib/toji/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Toji
2
- VERSION = "1.6.3"
2
+ VERSION = "1.6.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: toji
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.3
4
+ version: 1.6.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yoshida Tetsuya