diff --git a/app/controllers/admin/statistics_controller.rb b/app/controllers/admin/statistics_controller.rb index 3781e29232..2d06d926bc 100644 --- a/app/controllers/admin/statistics_controller.rb +++ b/app/controllers/admin/statistics_controller.rb @@ -15,5 +15,7 @@ def index @comment_count = Comment.count @request_by_state = InfoRequest.group('described_state').count @tracks_by_type = TrackThing.group('track_type').count + + @monthly_transactions = Statistics::MonthlyTransactions.new end end diff --git a/app/views/admin/statistics/index.html.erb b/app/views/admin/statistics/index.html.erb index 7a05c48570..4471bb22f1 100644 --- a/app/views/admin/statistics/index.html.erb +++ b/app/views/admin/statistics/index.html.erb @@ -80,3 +80,27 @@ + +
+
+

Transactions

+ + + <% @monthly_transactions.each_with_index do |row, index| %> + + <% if index.zero? %> + <% row.each do |cell| %> + + <% end %> + <% else %> + <% row.each do |cell| %> + <%= tag.td cell, class: { muted: cell.to_i.zero? } %> + <% end %> + <% end %> + + <% end %> +
+ <%= cell %> +
+
+
diff --git a/spec/controllers/admin/statistics_controller_spec.rb b/spec/controllers/admin/statistics_controller_spec.rb index 009332e7bd..9dd5fdde94 100644 --- a/spec/controllers/admin/statistics_controller_spec.rb +++ b/spec/controllers/admin/statistics_controller_spec.rb @@ -59,5 +59,11 @@ "all_successful_requests" => 6, "all_new_requests" => 7 }) end + + it 'assigns the monthly transactions' do + get :index + expect(assigns[:monthly_transactions]). + to be_a(Statistics::MonthlyTransactions) + end end end