Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <%= form_tag "", method: :get do %>
- <p><%= label_tag :start_date %><%= text_field_tag :start, @start.strftime("%Y-%m-%d") %></p>
- <p><%= label_tag :end_date %><%= text_field_tag :end, @end.strftime("%Y-%m-%d") %></p>
- <p><%= submit_tag :View, name: nil %></p>
- <% end %>
- <table>
- <thead>
- <tr>
- <th>Date</th>
- <th>Visitors</th>
- <th>Customers</th>
- </tr>
- </thead>
- <tbody>
- <% @end.downto(@start) do |date| %>
- <% customer_count = @customers.find { |c| c.date_created_at == date.strftime("%Y-%m-%d") } %>
- <% visitor_count = @visitors.find { |v| v.date_created_at == date.strftime("%Y-%m-%d") } %>
- <tr>
- <td><%= date %></td>
- <td><%= visitor_count.present? ? visitor_count.count_all : 0 %></td>
- <td><%= customer_count.present? ? customer_count.count_all : 0 %></td>
- </tr>
- <% end %>
- </tbody>
- </table>
Add Comment
Please, Sign In to add comment