Skip to content

Instantly share code, notes, and snippets.

@mileszs
Created December 15, 2009 14:04
Show Gist options
  • Save mileszs/256956 to your computer and use it in GitHub Desktop.
Save mileszs/256956 to your computer and use it in GitHub Desktop.
<%# 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment