On 22 Sep 2008, at 16:29, Brad Symons wrote:

>
> Fred
>
> Is there any way to do a count using the :find ...
>
> For example, supposing I want to list how many Pass, Fail etc
>
> But I only want to grab the number per testrun, per testcase with the
> most recent timestamp.
>

Have  a play with Outcome.count.

You can do stuff like Outcome.count :all, :joins => :testrun, :group  
=> 'resulttype'

Fred
> So for example:
> +----+---------------------+-------------+------------+-----------+
> | id | outcome_date        | testcase_id | testrun_id | result_id |
> +----+---------------------+-------------+------------+-----------+
> |  1 | 2008-09-22 11:51:28 |           1 |         16 |         4 |
> |  2 | 2008-09-22 12:23:10 |           1 |         26 |         1 |
> |  3 | 2008-09-22 12:31:00 |           1 |         26 |         2 |
> |  4 | 2008-09-22 13:25:44 |           2 |         26 |         3 |
> |  5 | 2008-09-22 13:29:52 |           3 |         26 |         2 |
> |  6 | 2008-09-22 13:33:33 |           4 |         26 |         2 |
>
>
> +----+------------+
> | id | resulttype |
> +----+------------+
> |  1 | Pass       |
> |  2 | Fail       |
> |  3 | N/A        |
> |  4 | Not Run    |
> +----+------------+
>
>
> for testrun 16: 1x4 (No of N/A= 1)
> testrun 26: 3x2(tc_id=1,tc_id=3, tc_id=4), 1x3(tc_id=2)
> Num of Fail = 3, Num of N/A = 1, Num of Pass = 0, Num of Not run=4
>
>
>
>
> -- 
> Posted via http://www.ruby-forum.com/.
>
> >


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to