CSC/ECE 517 Fall 2023 - E2383. Grading Audit Trail

From Expertiza_Wiki
Jump to navigation Jump to search

Introduction

Problem Statement

In the current implementation of expertiza, any instructor can assign or edit a grade but there is no way to track who gave the grade and when.

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 student teams have attempted to implement this functionality, but their implementations had issues. Our solution will build on the work of teams E1934 and E2237, addressing the problems in their implementations.

Overview of Major Changes By Previous Teams

E1934

Their Screencast

  • Created a database called grading_history to store elements for the Grading Audit Trail (instructor id, assignment id, grade tyoe, student id, grade, comment and timestamp)
  • Used MVC design to create a model, a controller, and a view for both of Review Grade and Submission Grade. These will be the links used in the View Submissions view and View Review Report view so that the grading trail for an assignments submission and reviews are seperate.
  • 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 that saves into the database.

Problems/Issues

1. For review grades, the “Grading History” link must not be in a separate column. It should be in :smaller text below the 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. Ensure that white space changes are separate commits
6. Revert changes made to list_review_mapping.html.erb
7. Remove the review_report_html.erb file
8. Design doc – mention why each of those files were changed

E2237

  • They fixed some issues that were causing the system to crash during testing
  • Altered the Grading History view
  • Explained the reasoning for changes made to files using diagrams and justifications

Problems/Issues

1. Redundant files generated by scaffolding need to be removed, along with debugging code. Ex) Coffee created by scaffolding and console logging for debugging.
2. Authentication could be done using existing utilities, no need to create their own.
3. Some formatting changes could be done especially on how cells span in review report page. Ex) Formatting change for spans in between cells in review report.
4. Code from previous implementation is a concern.

Proposed Solution

We plan on using the implementation of E2237 since it is the latest in the Grading Audit Trail projects and has the latest in terms of testing. These files cannot be added haphazardly since parts of the implementation is a cause to concern and caused the changes to not be implemented. It is also using an older version of expertiza so some parts may not be compatible.

We must first figure out exactly what changes and issues to address in their implementation by meeting with our mentor. We also need to reimplement the following files since none of their changes were implemented:

  • app/controllers/grading_histories_controller.rb

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

  • app/models/grading_history.rb

    Model for Grading History.

  • app/models/review_grading_history.rb

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

  • app/models/submission_grading_history.rb

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

  • 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

  • spec/features/grade_histories_spec.rb

    Feature test to check if the grades appear in chronological order

  • spec/features/helpers/grade_histories_helper.rb

    Helper file to facilitate the above mentioned feature test.

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


History of Comment and Grade for Reviews

Added the link "history" to a proper place as the expected design picture shows.


Review History Flow

Reimplementation

Since the previous teams implementations were not integrated we have to reimplement their files which we will do by looking at their commits and pull request to see what files are necessary and what can be left out to address the issues of their implementation.

Files being Reimplemented/Modified


Reimplemented

  • app/controllers/grading_histories_controller.rb

    This file was added because it was from the previous teams implementation which concerned the MVC of the grading_history they created. It dealt with allowing only the correct people to view the 
 grading history, checking the assignment type whether it be a submission or review, and indexing all the grading history for the assignment in chronological order.

  • app/models/grading_history.rb

    This file was added to follow the previous teams MVC of the grading_history they created. It was used to create the relationships that the grading history has with an instructor who is creating
the parts of the grading history and the assignments that will have a grading history.

  • app/models/review_grading_history.rb

    This file creates the relationship that a participant will have a Review Grading History 

  • app/models/submission_grading_history.rb

    This file create the relationship that a participant/grade_reciever will have a Submission Grading History

  • app/views/grading_histories/index.html.erb

    This file contains the view for the grading history table which will change depending on if its a Review or submission type

  • app/views/grading_histories/_form.html.erb

    This file contains the view for when a grading history contains any error when it is about to be saved

Modified

  • app/controllers/grades_controller.rb

    This file was modified based off the previous teams implementation because when the method save_grade_and_comment_for_submission was called it should also create a grading history so that
the grading audit can be created and added to. This was mainly focusing on the grading history of submissions and not reviews.

  • app/controllers/review_mapping_controller.rb

    This file was modified based off the previous teams implementation because when the method save_grade_and_comment_for_reviewer was called it should also create a grading history so that
the grading audit can be created and added to. This was mainly focusing on the grading history of reviews and not submissions.

  • app/views/assignments/list_submissions.html.erb

    It was modified to add the new hyperlink to display the grading history of a submission.

  • config/routes.rb

    It was to add the new route for grading histories

Solutions - Implemented

E1934

Problems/Issues

1. For review grades, the “Grading History” link must not be in a separate column. It should be in :smaller text below the 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. Ensure that white space changes are separate commits
6. Revert changes made to list_review_mapping.html.erb
7. Remove the review_report_html.erb file
8. Design doc – mention why each of those files were changed

Solutions

1. Found the correct location to put the Review Grading History link and also fix the previous teams creation of a grading history to work with the latest expertiza update.

Files changed include:

2. The previous implementatation of E2237 tackled this problem and moved it to the title.

3. The column widths were lessened by about 15px in the grading record page

Files changed include:

4.
5. All code climate changes are their own commits such as This
6. This issue was resolved by not adding in their implementation for the list_review_mapping.html.erb
7. This issue was resolved by not adding in the review_report_html.erb file
8. This issue is resolved in the Reimplementation section of this document


E2237

Problems/Issues

1. Redundant files generated by scaffolding need to be removed, along with debugging code. Ex) Coffee created by scaffolding and console logging for debugging.
2. Authentication could be done using existing utilities, no need to create their own.
3. Some formatting changes could be done especially on how cells span in review report page. Ex) Formatting change for spans in between cells in review report.
4. Code from previous implementation is a concern.

Solutions

1. These files have not been reimplemented.
2.
3. The column width was reduced by 15px refer to the solution for E1934 number 3.
4. Code for the review_mapping_controller was changed to match the current state of expertiza refer to the solution for E1934 number 1.

Testing Plan

We have added a test case to test if a grading history is getting created when valid parameters are used. The files include spec/controllers/grading_histories_controller_test.rb spec/factories/factories.rb spec/features/grade_histories_spec.rb spec/helpers/grade_histories_helper_spec.rb

[1]

Future Scope

This project may need further improvement since it does not seem like there should be an abundance of files added and perhaps using the MVC design is not necessarily needed. There can also be a reduction of code since the difference between the two main grading histories is just whether it is a review or submission type.

Relevant Links

Contributors to this project

  • Amulya Usem
  • Erik Lopez-Godinez
  • Gowtham Pollam
  • Mentor: Srilekha Gudipati