Statistics data from db with method for different view (week/month/year)

hi to everybody ! :slight_smile: before ask something I prefer to say sorry for may bad english and sorry because I'm a junior developer of rails, in last 3 days I've tried to visualize some statistics in rails but I found a lot of problem somebody can help me ? I leave my DB struct if someone have some good idea

THIS IS WHAT I TRY TO DO: I've tried to visualize some data in a table for know how many event I've all day, and visualize: TOTAL PRICE, TOTAL_EVENT, TOTAL_PAX every day, if you see the DB table you can see I use a date range for every Event, and there I become to get MAD ! in the DB every event ha the struct

event price pax room_numer start_date end_date
1 2 2 1 10-10-2015 12-10-2015
2 3 12 2 8-10-2015 18-10-2015
3 2 20 3 12-10-2015 17-10-2015

AND this is what I want visualize

data total_event total_price total_pax
08/10 1 2 12
09/10 1 2 12
10/10 2 5 14
11/10 2 5 14
12/10 3 4 34
13/10 2 4 22
14/10 2 4 22
15/10 2 4 22
16/10 2 4 22
17/10 2 4 22
18/10 1 2 12
19/10 0 0 0

for made that I need to use a model because I've 3 view... week / month / year and I think is better use one Method ? right ?

somebody can help me ?

No you don't need another model. Models relate to objects not views.
Most likely this would be be handled by the events controller by a
dedicated action with url parameters to specify date range and whether
it week/month/year.

The first thing to do is probably to write Event scopes to provide all
the events relevant to a particular day week or year. Look at the
Rails Guides on ActiveRecord Queries if you don't know how to do that.
Make sure you provide tests in your automated tests to check it works.
When that is going come back if you can't see where to go from there.

Colin