KillaPL/gruzinow — pull request #72 by KillaPL (2014-04-05 19:38:48+00:00)
Title: Refactor main page

Ok, so this one is kind of tricky. We had n+1 queries problem at games/index page, where n queries were done to fetch votes. With a help of collegues form work, we managed to write sql, that does the job with a single query. This query is generated by Game::IndexQuery.new.to_query.

Next problem I noticed, if lot of games is in the index, we have n+1 renders for progress_bar partial. This leads to poor render performance. I wanted to use view models for some time already, so i decided to do this here. I used https://github.com/defunkt/mustache. I've created view model and template for progress bar.

This was fun ^^