From 23c950a2fcd8975f8fc20814b768a7c5a62a1ced Mon Sep 17 00:00:00 2001 From: Chikako OHNO Date: Sun, 5 Jan 2020 11:46:42 +0900 Subject: [PATCH 1/2] =?UTF-8?q?=E7=B5=B1=E8=A8=88=E6=83=85=E5=A0=B1?= =?UTF-8?q?=E3=81=AB2019=E5=B9=B4=E3=83=87=E3=83=BC=E3=82=BF=E3=82=92?= =?UTF-8?q?=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/stats_controller.rb | 20 ++++++++++---------- app/models/high_charts_builder.rb | 18 +++++++++--------- app/views/stats/show.html.haml | 2 +- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/app/controllers/stats_controller.rb b/app/controllers/stats_controller.rb index cde29d315..2edc3aa44 100644 --- a/app/controllers/stats_controller.rb +++ b/app/controllers/stats_controller.rb @@ -10,16 +10,16 @@ def show @sum_of_dojos = DojoEventService.count('DISTINCT dojo_id') @sum_of_participants = EventHistory.sum(:participants) - # 2012年1月1日〜2018年12月31日までの集計結果 - period = Time.zone.local(2012).beginning_of_year..Time.zone.local(2018).end_of_year - stat = Stat.new(period) - @dojos = stat.annual_sum_total_of_aggregatable_dojo - @events = stat.annual_count_of_event_histories - @participants = stat.annual_sum_of_participants + # 2012年1月1日〜2019年12月31日までの集計結果 + period = Time.zone.local(2012).beginning_of_year..Time.zone.local(2019).end_of_year + statistics = Stat.new(period) + @dojos = statistics.annual_sum_total_of_aggregatable_dojo + @events = statistics.annual_count_of_event_histories + @participants = statistics.annual_sum_of_participants - @high_charts_globals = HighChartsBuilder.global_options - @annual_dojos_chart = stat.annual_dojos_chart - @annual_event_histories_chart = stat.annual_event_histories_chart - @annual_participants_chart = stat.annual_participants_chart + @high_charts_globals = HighChartsBuilder.global_options + @annual_dojos_chart = statistics.annual_dojos_chart + @annual_event_histories_chart = statistics.annual_event_histories_chart + @annual_participants_chart = statistics.annual_participants_chart end end diff --git a/app/models/high_charts_builder.rb b/app/models/high_charts_builder.rb index 8c0d90f11..91ce7d98e 100644 --- a/app/models/high_charts_builder.rb +++ b/app/models/high_charts_builder.rb @@ -15,10 +15,10 @@ def build_annual_dojos(source) f.series(type: 'column', name: '増加数', yAxis: 0, data: data[:increase_nums]) f.series(type: 'line', name: '累積合計', yAxis: 1, data: data[:cumulative_sums]) f.yAxis [ - { title: { text: '増加数' }}, - { title: { text: '累積合計' }, opposite: true } + { title: { text: '増加数' }, tickInterval: 15, max: 75 }, + { title: { text: '累積合計' }, tickInterval: 50, max: 250, opposite: true } ] - f.chart(width: 600) + f.chart(width: 600, alignTicks: false) f.colors(["#A0D3B5", "#505D6B"]) end end @@ -32,10 +32,10 @@ def build_annual_event_histories(source) f.series(type: 'column', name: '開催回数', yAxis: 0, data: data[:increase_nums]) f.series(type: 'line', name: '累積合計', yAxis: 1, data: data[:cumulative_sums]) f.yAxis [ - { title: { text: '開催回数' }, tickInterval: 300 }, - { title: { text: '累積合計' }, opposite: true } + { title: { text: '開催回数' }, tickInterval: 400, max: 2000 }, + { title: { text: '累積合計' }, tickInterval: 1000, max: 5000, opposite: true } ] - f.chart(width: 600) + f.chart(width: 600, alignTicks: false) f.colors(["#F4C34F", "#BD2561"]) end end @@ -49,10 +49,10 @@ def build_annual_participants(source) f.series(type: 'column', name: '参加者数', yAxis: 0, data: data[:increase_nums]) f.series(type: 'line', name: '累積合計', yAxis: 1, data: data[:cumulative_sums]) f.yAxis [ - { title: { text: '参加者数' } }, - { title: { text: '累積合計' }, opposite: true } + { title: { text: '参加者数' }, tickInterval: 2500, max: 12500 }, + { title: { text: '累積合計' }, tickInterval: 6000, max: 30000, opposite: true } ] - f.chart(width: 600) + f.chart(width: 600, alignTicks: false) f.colors(["#EF685E", "#35637D"]) end end diff --git a/app/views/stats/show.html.haml b/app/views/stats/show.html.haml index 1b2f24d72..6c371cbf8 100644 --- a/app/views/stats/show.html.haml +++ b/app/views/stats/show.html.haml @@ -56,7 +56,7 @@ %b / #{@dojo_count} Dojos %h3{style: "margin-top: 60px;"} 🆕 最新データ - 2019年のデータも含めた最新の統計情報は次のとおりです。 + 2020年のデータも含めた最新の統計情報は次のとおりです。 %div{style: "margin-top: 20px;", align: 'center' } %table{style: 'margin-top: 4px;'} %thead From 6d4ebf8515e4e3fa67c6da00cd989f4150622ca0 Mon Sep 17 00:00:00 2001 From: Chikako OHNO Date: Wed, 8 Jan 2020 23:23:15 +0900 Subject: [PATCH 2/2] =?UTF-8?q?=E6=8E=A8=E7=A7=BB=E3=83=86=E3=83=BC?= =?UTF-8?q?=E3=83=96=E3=83=AB=E3=81=AE=E9=81=93=E5=A0=B4=E6=95=B0=E5=90=88?= =?UTF-8?q?=E8=A8=88=E6=AC=84=E3=81=AB=E5=89=8D=E5=B9=B4=E3=81=AE=E5=80=A4?= =?UTF-8?q?=E3=82=92=E8=A1=A8=E7=A4=BA=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/stats/show.html.haml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/views/stats/show.html.haml b/app/views/stats/show.html.haml index 6c371cbf8..506161b0e 100644 --- a/app/views/stats/show.html.haml +++ b/app/views/stats/show.html.haml @@ -29,13 +29,14 @@ %tr %th - @dojos.keys.each do |year| - %td{style: 'padding: 0 5px; font-weight: bold;'} #{year}年 - %td{style: 'padding: 0 5px; font-weight: bold;'} 合計 + %th{style: 'padding: 0 5px;'} #{year}年 + %th{style: 'padding: 0 5px; text-align: center;'} 合計 %tbody{style: 'text-align: center;'} %tr %td 道場数 - @dojos.each_value do |num| %td= num + %td= @dojos.values.last %tr %td 開催数 - @events.each_value do |num|