CSC/ECE 517 Fall 2013/oss E804 spb
Expertiza Code Refactoring
Introduction
A way to query db models to return scores, without UI changes
Project Description
Classes:
- models/score.rb (159 lines)
- grades_controller.rb (241 lines)
What needs to be done:
- This code is very slow, due to many factors. Two of the most prominent are the fact that separate db queries are used for each rubric that has been filled out by anyone associated with the assignment; these queries are made sequentially while the HTML page is being written; and the fact that HTML for the whole page is generated, largely by controller methods, before anything is displayed.
- Need to refactor the score.rb model which contains complex methods.
Design Changes
- The model scores.rb has only two methods that compute scores for the participants and scores. But these methods have used hashes extensively to handle data. Also, the method get_total_score() makes many sequential queries to the database which increases the loading time for the page. These functions have logic which can be separated into two methods to make it more modular.