These two weeks the focus was to add a feature so that users can give their own suggestions in addition to the automatic feedback. So I started with creating a Feedback Model that is associated with the Assignment model such that feedback belongs_to assignment and assignment has_many feedbacks (Feedbacks isn’t a proper plural but that is how Rails works :|).

For creating feedback I created an endpoint through FeedbacksController
POST  ‘/feedbacks’

For fetching feedback, the endpoint used to retrieve automatic feedback is used with just an addition of a key. The following code is on index.json.jbuilder of revision feedback controller.

json.rating @rating
json.suggestions @feedback do |message|
 json.message messageend
json.custom @user_feedback
 do |feedback| json.message feedback.text

This was used to get the custom feedback along with automatic feedback and display it on the modal.