mileszs
12/15/2009 - 2:04 PM

report_results.html.erb

    <%# Total number of tickets for this customer by time frame -%>
    <table>
      <thead>
        <tr>
          <th>Timeframe</th>
          <th>Opened</th>
          <th>Closed</th>
        </tr>
      </thead>
      <tbody>
        <% Timeframe.all.each do |timeframe| -%>
        <tr>
          <td><strong><%= timeframe.name %><strong></td>
          <td><%= @tickets.select {|t| t.timeframe_id == timeframe.id }.size %>
          <td><%= @tickets.select {|t| t.timeframe_id == timeframe.id }.select { |t| t.closed? }.size %>
        </tr>
        <% end -%>
        <tr>
          <td><strong>Totals</strong></td>
          <td><%= @tickets.size %></td>
          <td><%= @tickets.select {|t| t.closed? }.size %></td>
        </tr>
      </tbody>
    </table>
    <br />
    <br />
    <%# Total number of tickets for this customer by type -%>
    <table>
      <thead>
        <tr>
          <th>Type</th>
          <th>&nbsp;</th>
        </tr>
      </thead>
      <tbody>
      <% TicketType.all.each do |type| -%>
        <tr>
          <td><strong><%= type.name %></strong></td>
          <td><%= @tickets.select {|t| t.ticket_type_id == type.id }.size %>
        </tr>
      <% end -%>
      </tbody>
    </table>