epicodus/epicenter — pull request #78 by dustinbrownman (2014-11-20 20:05:13+00:00)
Title: use sql to better query for billable students

Before we were using the ruby select method to filter through all
the students who's latest payment was within a certain amount of
time. This created an n + 1 situation where we were querying for
students, then looping through and querying for each student's
payments. Not ideal. Now it's all done in one fairly complex SQL
statement.