Javascript and Active Record Bliss

  • Nov 08, 2012
  • 1 Comment

After pulling my hair out last week trying to figure out why javascript wasn’t working, I was kind of dreading working on the page this week. Thankfully, a couple days away from the problem and some fancy-dan de-bugging apps on firefox made the process much smoother.

I was able to successfully have switch between different groups of videos and have a sidescroll animation for each level on the badges info page. Much of the code for the sidescrolling tabbed videos was already implemented on the Challenges page, but the hard part was making sure the animation for the videos for each level aren't conflicting with each other and the video animations as a whole are not conflicting with the expansion and contraction of the levels themselves.

I was also pleasantly surprised with the ease of implementing the active record queries for the different categories of worlds (badge earning, recommended remixes, and top remixes). It’s important that these categories be from active record queries because iterating through a collection of worlds to sort them in the manner that you require is really inefficient. Historically, writing these queries has been a frustrating and arduous process. This time, though, I was able to find some really great online resources and help boards that pointed me in the right direction. I learned how to sort objects in a database by the number of associations it has to another database (e.g. sorting worlds by the number of skills they have in order to find less-complicated worlds). I also learned how to join more than one database (so that I can find the worlds that were remixed into another world).

Tomorrow, I will put these queries through a more rigorous test as well as clean up some of the visuals on the page. Next week, I hope to add a couple more features to the info page (breadcrumbs, something to tie it to badges, and links to the worlds page from the thumbnails) and maybe even get started on the badges index page.

 

Comments

  • kyle

    kyle said:

    <p>The test for tomorrow... is this you testing or rails tests?</p> <p>&nbsp;</p>

    Posted on Nov 09, 2012

Log In or Sign Up to leave a comment.