CSC/E1869 GRADING AUDIT TRAIL: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
No edit summary
 
(17 intermediate revisions by 2 users not shown)
Line 7: Line 7:
:2. Comments previously provided by other instructors must also be preserved.
:2. Comments previously provided by other instructors must also be preserved.


This information needs to be stored every time an instructor edits a grade / comment and clicks the save button.
This information needs to be stored every time an instructor edits a grade/comment and clicks the save button.


Currently, there are two places need to add grading audit trail:  
Currently, there are two places need to add grading audit trail:  
Line 16: Line 16:


===Design===
===Design===
We will create a database called grading_history in the system contains elements instructor id, assignment id, grade type, student id, grade, comment, and timestamp.
We will create a database called grading_history in the system contains elements of instructor id, assignment id, grade type, student id, grade, comment, and timestamp.


We will use MVC design to create a model, a controller, and a view for both of '''Review Grade''' and '''Submission Grade'''.
We will use MVC design to create a model, a controller, and a view for both of '''Review Grade''' and '''Submission Grade'''.


:Model: grading_history.rb. Has a list of attributes contains instructor id, assignment id, grade type, student id, grade, comment, and timestamp.
:Model: grading_history.rb. Has a list of attributes contains instructor id, assignment id, grade type, student id, grade, comment, and timestamp.
:Controller: grading_history_controller.rb. Saves a new entry into database every time a review grade or submission grade is saved
:Controller: grading_history_controller.rb. Saves a new entry into the database every time a review grade or submission grade is saved
:View: index_html.erb. Displays current submission or review's grading history. An existing example of this is submission record in the system.
:View: index_html.erb. Displays current submission or review's grading history. An existing example of this is a submission record in the system.


We also need to modified grades controller, so that every time, a grade is submitted or edited, grading_history_controller.rb will call a method to create a entry saves into database.
We also need to modified grades controller, so that every time, a grade is submitted or edited, grading_history_controller.rb will call a method to create an entry saves into the database.


===Expected View===
===Expected View===
Expected view for submission list
[[File:E1869-Screenshot-1.jpg]]


==== The list submission page with the new "grade history" option====
[[Image: E1869-Screenshot-1.jpg|50]]


 
==== The review report page with the new "grade history" option====
Expected view for review report
[[File:E1869-Screenshot-2.jpg]]
[[File:E1869-Screenshot-2.jpg]]


==== Grade history for a given team====
[[File:E1869-Screenshot-3.jpg]]


Expected view for grade record
[[File:E1869-Screenshot-3.jpg]]
===Diagram===
===Diagram===
[[File:E1869_Grading_Audit_Trails_UML.jpg]]
[[File:E1869_Grading_Audit_Trails_UML.jpg]]
=='''Files Changed'''==
===Files Added===
*app/models/grading_history.rb
'''This is a model for grading audit trail, containing attributes of grading history'''
*app/controllers/grading_history_controller.rb
'''This is a controller for grading audit trail, it can add grading history into the system'''
*app/views/grading_history/index_html.erb
'''This is a view for grading audit trail, it will display all grading histories of a submission/review'''
===Files Modified===
* app/controllers/grades_controller.rb
'''Add code to call methods in grading_history_controller.rb to create new grading history'''
* app/views/assignments/list_submissions.html.erb
'''Add code to support view changes for Grade Record'''
* app/views/review_mapping/_review_report.html.erb
'''Add code to support view changes for Grade Record'''


=='''Testing Plan'''==
=='''Testing Plan'''==
Line 64: Line 44:
Functional testing:
Functional testing:


For “Review grade”:
1. Test if SubmissionGradeHistory.create is being called when a submission grade is changed.  
  spec/controllers/grades_controller_spec.rb https://bit.ly/2EpJaGS
1.Log in as instructor
 
2.Navigate to Manage -> Assignments
3.Click on Review Report
 
A report with following details will show up:
Timestamp, Instructor Id, Assignment id, Grade type, Student id, Grade, Comment
 
4.Every time an instructor edits or comments on the grade the report is updated with the new entry and timestamp.


2. Test if ReviewGradeHistory.create is being called when a submission grade is changed.
  spec/controllers/review_mapping_controller_spec.rb https://bit.ly/2LjM4OF


For “Submission grade”:
3. Test if GradeHistory.where is being called when grading history button is clicked.
 
  spec/controllers/grading_histories_controller_test.rb https://bit.ly/2PFLknz
1.Log in as instructor
 
2. Navigate to Manage -> Assignments
 
3.Click on View Submission -> History
 
A report with following details whill show up:
Timestamp, Instructor Id, Assignment id, Grade type, Student id, Grade, Comment
 
4.Every time an instructor edits or comments on the grade the report is updated with the new entry and timestamp.


=='''Actual Implementation'''==
=='''Actual Implementation'''==
===Actual View===
===Actual View===
Actual view for submission list
== The list submission page with the new "grade history" option==
[[File:E1869-Actual-1.JPG]]
[[File:E1869-Actual-1.JPG]]






Actual view for review report
== The Review Report page with the new "grade history" option==
[[File:E1869-Actual-3.png]]
[[File:E1869-Actual-3.png]]






Actual view for submission grade record
== Grade history page for a given team(submission grade history)==
[[File:E1869-Actual-2.JPG]]
[[File:E1869-Actual-2.JPG]]




Actual view for review grade record
== Grade history for a given student(review grade history)==
[[File:E1869-Actual-4.png]]
[[File:E1869-Actual-4.png]]
===Actual Code Change===
 
==Files Added==
===Code Changes===
*app/models/grading_history.rb
 
==Files Modified==
*app/controllers/grades_controller.rb https://bit.ly/2Cg9WzR
'''
'''
  class GradingHistory < ActiveRecord::Base
    Creates a Grading History Record for every Submission grade edited by the instructor for a Team.
    attr_protected
    belongs_to :instructor, inverse_of: :instructor_id
    belongs_to :assignment, inverse_of: :assignment_id
  end
'''
'''
*app/controllers/grading_history_controller.rb
 
*app/controllers/review_mapping_controller.rb https://bit.ly/2QywzZc
'''
'''
<pre>
  class GradingHistoriesController < ApplicationController
    before_action :set_grading_history, only: %i[show]


    def action_allowed?
    Creates a Grading History Record for every Review grade edited by the instructor for a Student.
      return true if ['Instructor', 'Teaching Assistant', 'Super-Administrator', 'Administrator'].include? current_role_name
'''
    end


    # GET /grading_histories
* app/views/assignments/list_submissions.html.erb https://bit.ly/2UHNRkO
    def index
      @grading_histories = GradingHistory.where(grade_receiver_id: params[:grade_receiver_id])
    end
  end
</pre>
'''
'''
*app/views/grading_history/index_html.erb
    Add code to support view changes for Grade Record
'''
'''
<pre>
  <h1 class="center">Grading Record</h1>


  <table class="table table-striped">
* app/views/review_mapping/_review_report.html.erb https://bit.ly/2GfTqUj
    <thead>
    <tr>
      <th>Instructor</th>
      <th>Assignment</th>
      <th>Grade Receiver</th>
      <th>Grade</th>
      <th>Comment</th>
      <th>Graded At</th>
    </tr>
    </thead>
    <!--This is the main view of the table. This will add table with either hyperlink or the content nased on the operation. -->
    <tbody>
    <% @grading_histories.each do |record| %>
        <tr>
          <td><%= User.where(id: record.instructor_id).pluck(:fullname).first %></td>
          <td><%= Assignment.where(id: record.assignment_id).pluck(:name).first %></td>
          <% if record.grading_type == "Submission" %>
              <td><%= Team.where(id: record.grade_receiver_id).pluck(:name).first %></td>
          <% else %>
              <td><%= User.where(id: record.grade_receiver_id).pluck(:fullname).first %></td>
          <% end %>
          <td><%= record.grade %></td>
          <td><%= record.comment %></td>
          <td><%= record.created_at %></td>
        </tr>
    <% end %>
    </tbody>
  </table>
</pre>
'''
'''
==Files Modified==
    Add code to support view changes for Grade Record
* app/controllers/grades_controller.rb
'''
'''
 
  def save_grade_and_comment_for_submission
==Files Added==
    participant = AssignmentParticipant.find_by(id: params[:participant_id])
 
    @team = participant.team
*app/controllers/grading_histories_controller.rb https://bit.ly/2RY5xa6
    @team.grade_for_submission = params[:grade_for_submission]
'''
    @team.comment_for_submission = params[:comment_for_submission]
    Calls the grading history view after validaing Submission and Review Type.
    begin
 
+    GradingHistory.create(instructor_id: session[:user].id,
'''
+                          assignment_id: participant.assignment.id,
 
+                          grading_type: "Submission",
*app/models/grading_history.rb https://bit.ly/2PHKNRY
+                          grade_receiver_id: @team.id,
'''
+                          grade: @team.grade_for_submission,
    Model for Grading History.
+                          comment: @team.comment_for_submission)
      @team.save
    rescue StandardError
      flash[:error] = $ERROR_INFO
    end
    redirect_to controller: 'assignments', action: 'list_submissions', id: @team.parent_id
  end'''
* app/controllers/review_mapping_controller.rb
'''
'''
def save_grade_and_comment_for_reviewer
    review_grade = ReviewGrade.find_by(participant_id: params[:participant_id])
    review_grade = ReviewGrade.create(participant_id: params[:participant_id]) if review_grade.nil?
    review_grade.grade_for_reviewer = params[:grade_for_reviewer] if params[:grade_for_reviewer]
    review_grade.comment_for_reviewer = params[:comment_for_reviewer] if params[:comment_for_reviewer]
    review_grade.review_graded_at = Time.now
    review_grade.reviewer_id = session[:user].id
    begin
+    GradingHistory.create(instructor_id: session[:user].id,
+                          assignment_id: params[:assignment_id],
+                          grading_type: "Review",
+                          grade_receiver_id: Participant.find(params[:participant_id]).user_id,
+                          grade: params[:grade_for_reviewer],
+                          comment: params[:comment_for_reviewer])
      review_grade.save!
    rescue StandardError
      flash[:error] = $ERROR_INFO
    end
    redirect_to controller: 'review_mapping', action: 'response_report', id: params[:assignment_id]
  end


*app/models/review_grading_history.rb https://bit.ly/2SPNR0e
'''
    Model containing specifics of Review Grading History. Inherits Grading History.
'''
'''
* app/views/assignments/list_submissions.html.erb
 
*app/models/submission_grading_history.rb https://bit.ly/2S5EI3J
'''
'''
132          <td align = 'left'>
    Model containing specifics of Submission Grading History. Inherits Grading History.
133            <%= link_to "Grading History", grading_histories_path(grade_receiver_id: Participant.where(id: r.id).pluck(:user_id).first) %>
134          </td>
'''
'''
* app/views/review_mapping/_review_report.html.erb
 
*app/views/grading_history/index_html.erb https://bit.ly/2rDiZF1
 
'''
'''
75      <td width="10%">
    This is a view for grading audit trail, it will display all grading histories of a submission/review
77          <%= link_to "Grading History", grading_histories_path(grade_receiver_id: team.id) %>
79      </td>
'''
'''



Latest revision as of 17:30, 16 December 2018

Introduction

Problem Statement

After an instructor gave a grade to an assignment, there is no way to track who gave the grade. A grading audit trail must be created and the following information needs to be stored:

1. When a grade is assigned by an instructor, there needs to be an indication of who did it and when it was done.
2. Comments previously provided by other instructors must also be preserved.

This information needs to be stored every time an instructor edits a grade/comment and clicks the save button.

Currently, there are two places need to add grading audit trail:

1. Review grade: Log in as instructor -> Manage -> Assignments -> View Review Report
2. Submission grade: Log in as instructor -> Manage -> Assignments -> View submissions

Proposed Solution

Design

We will create a database called grading_history in the system contains elements of instructor id, assignment id, grade type, student id, grade, comment, and timestamp.

We will use MVC design to create a model, a controller, and a view for both of Review Grade and Submission Grade.

Model: grading_history.rb. Has a list of attributes contains instructor id, assignment id, grade type, student id, grade, comment, and timestamp.
Controller: grading_history_controller.rb. Saves a new entry into the database every time a review grade or submission grade is saved
View: index_html.erb. Displays current submission or review's grading history. An existing example of this is a submission record in the system.

We also need to modified grades controller, so that every time, a grade is submitted or edited, grading_history_controller.rb will call a method to create an entry saves into the database.

Expected View

The list submission page with the new "grade history" option

50

The review report page with the new "grade history" option

Grade history for a given team

Diagram

Testing Plan

Functional testing:

1. Test if SubmissionGradeHistory.create is being called when a submission grade is changed.

  spec/controllers/grades_controller_spec.rb https://bit.ly/2EpJaGS

2. Test if ReviewGradeHistory.create is being called when a submission grade is changed.

  spec/controllers/review_mapping_controller_spec.rb https://bit.ly/2LjM4OF

3. Test if GradeHistory.where is being called when grading history button is clicked.

  spec/controllers/grading_histories_controller_test.rb https://bit.ly/2PFLknz

Actual Implementation

Actual View

The list submission page with the new "grade history" option


The Review Report page with the new "grade history" option


Grade history page for a given team(submission grade history)


Grade history for a given student(review grade history)

Code Changes

Files Modified

    Creates a Grading History Record for every Submission grade edited by the instructor for a Team. 

    Creates a Grading History Record for every Review grade edited by the instructor for a Student.

    Add code to support view changes for Grade Record

    Add code to support view changes for Grade Record

Files Added

    Calls the grading history view after validaing Submission and Review Type.

    Model for Grading History.

    Model containing specifics of Review Grading History. Inherits Grading History.

    Model containing specifics of Submission Grading History. Inherits Grading History.

    This is a view for grading audit trail, it will display all grading histories of a submission/review

Reference

Expertiza

Expertiza_wiki

Expertiza Documentation

Expertiza Github