One last wafer thin change for today…

Complete.
Need to be able to add percentage statistics but only select one from browser, color_depth, resolution, operating system. Added 'All' record to these tables then added clause to both various rails order's and sql order by's to get the 'All's to appear first. In the case of months order needed to be ASC, for others rails, DESC, i.e.
sql:

    find_by_sql("...id order by browser_name_source")
    find_by_sql("...id order by os_name_source")

rails:

    @colors            = ColorDepth.find(..., :order => 'depth DESC')
    @statistics_months = StatisticsMonth.find(..., :order => 'month_name ASC')
    @resolutions       = Resolution.find(..., :order => 'resolution DESC')

Tried it out and was mostly ok, except month name by name actually isn't good! However still wanted to avoid find_by_sql, so by combining using month_num '0' for an 'all' record I can

:order => 'month_num ASC'

but display the name and thus get 'All' followed by Jan, Feb, etc.
Always a way.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s