WIP. Adding A/B/C Testing

Thanks, good to know.  Changed.


On Tue, Jun 24, 2014 at 7:53 AM, Laurel <notifications@github.com> wrote:

> In app/models/frequent_unsuccessful_level_source.rb:
>
> > +         having num_of_attempts >= #{freq_cutoff}
> > +         order by num_of_attempts DESC"
> > +    else
> > +      query = "select level_source_id, level_id, count(*) as num_of_attempts
> > +         from activities
> > +         where test_result <= #{Activity::MAXIMUM_NONOPTIMAL_RESULT}
> > +         group by level_source_id
> > +         having num_of_attempts >= #{freq_cutoff}
> > +         order by num_of_attempts DESC"
> > +    end
> > +
> > +    # Execute the query, adding level_sources to the model if they are
> > +    # standardized (do not contain an xmlns attribute).  The active column
> > +    # is set to indicate whether more crowdsourced hints are needed.
> > +    Activity.connection.execute(query).each do |level_source_id, level_id, count|
> > +      if !level_source_id.nil? && !level_id.nil?
>
> next if/next unless is a ruby idiom that sometimes makes loops like this
> clearer (if you subscribe to the "thing you want to do in the normal case
> should not be inside multiple nested loops" philosophy), eg:
>
>     Activity.connection.execute(query).each do |level_source_id, level_id, count|
>       next unless level_source_id && level_id
>       level_source = LevelSource.find(level_source_id)
>       next unless level_source.is_standardized?
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/code-dot-org/dashboard/pull/776/files#r14133585>.
>