CSC/ECE 517 Fall 2021 - E2158. Grading audit trail

From Expertiza_Wiki
Jump to navigation Jump to search

Problem Definition

After an instructor gave a grade to an assignment, there is no way to track who gave the grade. Any instructor can assign/edit a grade freely. There is no way of tracking who did it.

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

The grading audit trail can probably be implemented as the submission records history on Expertiza. The required page can be reached by logging in as instructor -> Manage -> Assignments -> View Submissions -> History

At the minimum, a grading log entry must include the instructor id, assignment id, student id, grade, comment and timestamp.

Previous Implementation

Links

Previous Wiki Page

Screencast


Review

1. Review grade part in the previous implementation served well, we only need to fix some UI issues in the current implementation;
2. But for Submission grade part, we need to add a table in order to save submission history including the instructor id, assignment id, student id, grade, comment, and timestamp.

Issues with Previous Work

1. For review grades, the “Grading History” link must not be in a separate column. It should be in smaller text below in the “Save” button.
2. In the view grading record page, remove the receiver column and add it to the title.
3. Restrict the column width on the grading record page.
4. Add comments on list_submissions.html.erb to indicate that the alignment was changed to fix code climate issues.
5. Revert changes made to list_review_mapping.html.erb.
6. Remove the review_report-html.erb file.

Proposed Solution

Code changes

1. \app\controllers\grades_controller.rb

Add create submission record function

GradingHistory.create(instructor_id: session[:user].id,
  assignment_id: participant.assignment.id,
  grading_type: "Submission",
  grade_receiver_id: @team.id,
  grade: @team.grade_for_submission,
  comment: @team.comment_for_submission)

2. \app\controllers\grading_histories_controller.rb

Create grading_histories_controller.rb

class GradingHistoriesController < ApplicationController
    before_action :set_grading_history, only: %i[show]
  
    def action_allowed?
      return true if ['Super-Administrator', 'Administrator'].include? current_role_name
      check_type(params[:grade_type])
      if @assignment.instructor_id == current_user.id
        true
      elsif TaMapping.exists?(ta_id: current_user.id, course_id: @assignment.course_id) &&
          (TaMapping.where(course_id: @assignment.course_id).include? TaMapping.where(ta_id: current_user.id, course_id: @assignment.course_id).first)
        true
      elsif @assignment.course_id && Course.find(@assignment.course_id).instructor_id == current_user.id
        true
      end
    end
  
  
    def check_type(type)
      if type.eql? "Submission"
        assignment_team = AssignmentTeam.find(params[:grade_receiver_id])
        @assignment = Assignment.find(assignment_team.parent_id)
      end
      if type.eql? "Review"
        participant_id = params[:participant_id]
        grade_receiver = AssignmentParticipant.find(participant_id)
        @assignment = Assignment.find(grade_receiver.parent_id)
      end
    end
  
    def index
      @grading_histories = GradingHistory.where(grade_receiver_id: params[:grade_receiver_id], grading_type: params[:grade_type]).reverse_order
    end
  end

3. \app\controllers\review_mapping_controller.rb

Add create review record function

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])

4. \app\helpers\grading_histories_helper.rb

Create grading_histories_helper.rb

module GradingHistoriesHelper
end

5. \app\models\grading_history.rb

Create grading_history.rb

class GradingHistory < ActiveRecord::Base
  attr_protected
    belongs_to :instructor, inverse_of: :instructor_id
    belongs_to :assignment, inverse_of: :assignment_id
end

6. \app\models\review_grading_history.rb

Create review_grading_history.rb

class ReviewGradingHistory < GradingHistory
  attr_protected
    belongs_to :grade_receiver, class_name: 'Participant', inverse_of: :grade_receiver_id
end

7. \app\models\submission_grading_history.rb

Create submission_grading_history.rb

class SubmissionGradingHistory < GradingHistory
  attr_protected
    belongs_to :grade_receiver, class_name: 'Team', inverse_of: :grade_receiver_id
end

8. \app\views\assignments\list_submissions.html.erb

Add "Grading History" link to submissions page

9. \app\views\grading_histories\index.html.erb

Create grading histories index page

10. \app\views\reports\_review_report.html.erb

Add "Grading History" link to review report page

11. \config\routes.rb

Configure the routes

resources :grading_histories, only: [:index]

12. \app\views\assignments\list_submissions.html.erb

Create table grading_histories

class CreateGradingHistories < ActiveRecord::Migration
  def change
    create_table :grading_histories do |t|
       t.integer :instructor_id
       t.integer :assignment_id
       t.string  :grading_type
       t.integer :grade_receiver_id
       t.integer :grade
       t.text :comment
       t.timestamps null: false
     end
  end
end

Expected View







History of Comment and Grade for Reviews

In this part, we will modify the current view of review page, to add the link "history" to a proper place as the expected design picture shows.

The related table from databases is review_scores. The ER table of review_scores is shown as below.

Review History Flow

History of Comment and Grade for Submissions

In Expertiza, we find the fields related to grade and comment are located in the model team, which is only able to be overwritten. Since there is no table to store the history of the comment and score given by instructors and TAs, we need to do:

1. Review the related implementation of previous work in order to evaluate and understand the process of adding new models.
2. Implement the related Model, View and Controller:
  • Model: grading_history.rb
  • Controller: grading_history_controller.rb
  • View: related pages.

Because in Expertiza the team ID will be generated for each given assignment, so the original design of grade / comment of team's submission are the field belongs to team. So our model uses the foreign key to only the team but not the related assignments or submissions.

The expected class of grading history could be shown as:

Team History Flow

Testing Plan

Rspec Unit Tests

For History of the Grade of Reviews

The history of the grade and comments are related to this controller app/controllers/review_mapping_controller.rb and this view app/views/reports/_review_report.html.erb.

So the related RSpec tests are planned to be executed:

   spec/controllers/review_mapping_controller_spec.rb

For History of the Grade of Team Submissions

The history of the grade and comments are related to the new model grading_history.rb and the new controller grading_history_controller.rb.

So the related RSpec tests are planned to be executed:

   spec/models/grading_history.rb
   spec/controllers/grading_history_controller.rb

For the feature part, test if the grading history and instructor can be shown in chronological order:

   spec/features/grade_histories_spec.rb
   spec/features/helpers/grade_histories_helper.rb

Manual UI Tests

To start the test, we need to log in as instructor or TA first. These accounts should have access to the assignment. For example: we can use intructor6/password or teaching_assistant8631/password;

Scenario 1: Grading histories of submissions

Step 1. Log in as instructor/TA -> Manage -> Assignments -> View submissions


Step 2. The instructor/TA can assign grades to a team by clicking 'Assign Grade' in the 'Team name' column:


Step 3. The instructor/TA can view the grading audit trail by clicking 'Grading History' in the 'History' column, here is the record page:


Scenario 2: Grading histories of reviews

Step 1. Log in as instructor/TA -> Manage -> Assignments -> View Reports


Step 2. Select 'Review Report' then click 'View', here is the Review Report page. The instructor/TA can assign grades to a review by inputing 'Grade' and 'Comment' then clicking 'Save' button:


Step 3. The instructor/TA can view the grading audit trail by clicking 'Grading History' as Step 2 figure shows, here is the record page:


Important Links

  1. Git Repo
  2. Pull Request
  3. Test1
  4. Test2

Team

Mentor: Xiao, Kai (yxiao28)

Yao, Kaiyong (kyao)

Hou, Guanyu (ghou3)

Du, Haoze (hdu5)

Du, Liwen (ldu2)