/quest-for-life

Crowsourcing the Drake Equation

Primary LanguageJavaScriptOtherNOASSERTION

Crowdsourcing the Drake Equation


Interview exercise notes
========================

Files changed:
  app/helpers/surveys_helper.rb
  app/views/surveys/_parameter_results.html.erb


To install old versions of things to get this app running:

rvm install ruby 1.8.7
rvm rubygems 1.3.5
gem install rake -v 0.8.7
gem install rails -v 2.3.5
gem install RedCloth -v 4.2.2

I replaced the HTML tables with plain JSON hashes to hold the chart
data.  The tables were hidden anyway, so it didn't seem like they were
intended to be there for, say, browsers with Javascript turned off.

I wasn't sure what column values to use for N.  I somewhat arbitrarily
chose 0, 1, 2, 3, 4, and then buckets for 5-9, 10-99, 100-999,
1000-9999, 10000+.

Some of the longer column labels overlap each other, e.g. "1 in
1,000,000".  Perhaps these could be combined into buckets also, or
else just stagger the labels vertically so they don't overlap.
Probably should consult a graphic designer and/or a data visualization
expert.  :)

I didn't do the extra credit: I'm not sure how to make tests for
Javascript behavior (capybara? haven't looked into it).  (Although it
just occurred to me that I could write unit tests for the surveys
helper.)  I didn't have time to do highlighting of the user's
parameter values.

Overall (not counting time spent figuring out what old versions of
things to install), this exercise took me about 6-7 hours, spread
across 3 hacking sessions.


Potential cleanup tasks:

Write a migration to clean up the data, e.g. change the age group
description '26-35' to '26 - 35' to match the others, and change the
null genders to 'Unknown'.

Add :order clauses to the queries (currently they rely on the fact
that the age groups and rational options are in the correct order in
the db).

Refactor chart_data to be a little cleaner/more efficient.

Put Javascript code into public/javascript.

Convert to Rails 3...