Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Update submission schema for old marks in remark request #941
To fix Issue 904 we need to update the submission schema such that when we query @submission.result we don't rely on the database ordering and timestamp if possible (which it may not be).
Currently the Submission model has the line:
has_one :result, :dependent => :destroy
Since we know for sure that these models will sometimes have more than one, @ioev suggested that we change has_one to has_many.
As Joey suggested, write a method in the Result model "get_result" that does this, and then write another "get_old_result" that returns the marks that are being requested to be remarked.
@mikeing2001 I'm still trying to get a feel of the code base but wouldn't we want to add the "get_result" and "get_old_result" methods in the Submission model instead of the Result, since we are trying to change "has_one :result, :dependent => :destroy" to "has_many :result, :dependent => :destroy" in the Submission model? Then would I be trying to update the references of "@submission.result" in results_controller.rb so that they are using the appropriate methods?