Adds counts for each discriminatory phrase to the stats object returned by StatsController.get_stats. Displays the returned counts as an unordered list in stats/index.html.erb.
I changed date_range in app/models/listing.rb to find Listing entries instead of PhraseListing entries for two reasons:
It didn't make sense that querrying the listing model would return only PhraseListing entries. If we want a function to return PhraseListing entries, that should live in the PhraseListing model file
This function was causing a lot of database queries which was very slow even with the few listings we have in our seed data. I suspect that this is a combination of PhraseListing being a join table and the way the function is written. Someone with more rails experience may have a better explanation for this.
Adds counts for each discriminatory phrase to the stats object returned by
StatsController.get_stats
. Displays the returned counts as an unordered list instats/index.html.erb
.I changed
date_range
inapp/models/listing.rb
to findListing
entries instead ofPhraseListing
entries for two reasons:listing
model would return onlyPhraseListing
entries. If we want a function to returnPhraseListing
entries, that should live in thePhraseListing
model filePhraseListing
being a join table and the way the function is written. Someone with more rails experience may have a better explanation for this.