CSC/ECE 517 Fall 2021 - E2164. Heatgrid fixes and improvements

From Expertiza_Wiki
Jump to navigation Jump to search

Project Background

Heatgrid is the page where instructor can visit and view the work done by participant using Reviews, Author Feedbacks and Meta Reviews. This one web page displays all the evaluations done by peers of the participant for his project. The page is displayed in the format of table with colors. The columns in the table can be sorted with the requirement of the project. Heatgrid shows scores assigned by reviewers on individual rubric items for participant.

What is wrong with it

It is called from Instructor's "Assign Grades" function and student's view scores functions. But, there is an issue where the students can review their own assignments. However, win the databases (old database) we were provided with do not have any student with Student id: 9277, and the assignment Madeup Problem 3 hasn't even existed. Also, the column name "metric-1" in the heatgrid is not self-explanatory and needs to be changed.

Issue 2019

Problem Definition

When an instructor is trying to Assign a Grade for student 9277, he/she is not able to see Reviews for Round-1. However, we were not able to reproduce the same issue, as the student with id-9277 does not exist in our database.

Current Implementation

Overview

In the current review system implementation, the instructor has the ability to select or deselect the "Allow Self Reviews?" checkbox from the "Review Strategy" tab of the Edit Assignment page. On deselecting this checkbox, a student will not be able to review his/her own work.

UI Screenshots

The following images show how this functionality works currently:

The instructor will get the error "You cannot assign this student to review his/her own artifact." when an attempt to add a student as a reviewer to his/her own assignment is made.

Control Flow


Observations

Whenever an instructor assigns a reviewer for an assignment of a team, there is already a check present and it is not allowing instructor to assign the team member of the team for the review.

Test Plan

  • If the "Allow Self Review?" checkbox is disabled, then the reviewer should not be able to review their own assignment.
  • If the "Allow Self Review?" checkbox is enabled, then the reviewer should be able to review their own assignment.
  • Files to be Targeted

  • app/controllers/grades_controller.rb:- Focussing on self-review and grades section.
  • app/views/_review_strategy.html.erb:- Here, the checkbox of "Allow Self Review?" is written.
  • app/helpers/grades_helper.rb:- Grades helper file.
  • spec/controllers/review_mapping_controller.rb:- Adding test cases for checking whether the reviewer can self-review if the "Allow Self Review?" checkkbox is disabled and the vice-versa too.
  • Issue 1869

    Problem Definition

    Notes that there is a “metric-1” column in the review report, but it doesn’t say what the metric is. Please figure out what the metric is, and change the column header accordingly. However, the intent was that eventually an instructor would be allowed to select a metric to be shown on the heatgrid. So, somewhere in the UI for creating/editing an assignment, there should be a way for the instructor to select a metric from a dropdown list. You don’t have to add any more metrics to this list other than the one that is currently displayed, just create a mechanism for adding metrics in the future.

    Current Implementation

    Overview

    In the current implementation, the columns in the heatgrid table are static. The "metric-1" column in the table represents the count of comments for the respective question which have a word count greater than 10. On hovering over the column name, the correct information is displayed but the name itself does not make the information apparent at first glance.

    UI Screenshots

    The following image captures how the heatgrid is currently being displayed:

    Plan of work

    Implementation Details

    • In the view_team.html.erb and instead of pre-assigned value to be metric-1, a dropdown will be populated and the instructor can choose the metric for the review. By default in the dropdown, there will be only one metric to count the verbose comments.
    • Now, if the instructor wants to add any new metric, he/she just need to add the method for the metric in the app/views/assignment/edit/_general.html.erb file and that value will be stored in the database as a string in the heatgrid_metric variable and the same will be populated in the view of the heatgrid.

    Proposed Control Flow

    Detailed Implementation

    • in the database in the assignments table, one column named "heatgrid_metric" is added which will store the value of the dropdown menu.
    • app/views/assignments/edit/_general.html.erb:- In this file we have added the dropdown which takes the metric from the instructor and sets the metric accordingly. The code we added is mentioned below:-
    <tr>
        <td style='padding:5px' id='assignment_metrics_field'>
        <%= label_tag('assignment_form[assignment][heatgrid_metric]', 'Select a Metric to be displayed in the Report Heatgrid:') %>
        <%= select('assignment_form[assignment]', 'heatgrid_metric', [['--', ''], %w[Verbose-Comment-Count countofcomments]], 
        { :selected => @assignment_form.assignment.heatgrid_metric}, { :class => 'form-control', :style => 'width: 100px'}) %>
        </td>
    </tr>
    

    We have added assigned two values to the dropdown:- '--' and 'Verbose-Comment-Count'. This is how it looks after adding this dropdown on the expertiza:-



    • app/views/grades/view_team.html.erb:- In this file, there is a view for the heatgrid, so when the instructor clicks on Assign Grades, the view from this file is rendered. So, the column name is changed here from "metric-1" to "countofcomments" variable, which will take the store the value of the dropdown selected.

    The code that we have changed is:-

    
    <% case @assignment.heatgrid_metric %>
          <% when 'countofcomments' %>
          <th class="sorter-false">
          <span  data-toggle="tooltip" data-placement="right" title="A count of comments, for the respective question, 
           which have word count > 10. The purpose of this metric is to represent how many comments for the question are 
           of a substantial length to provide quality feedback.">Verbose Comment Count</span>
           </th>
           <%end%>
    

    This is how it now looks on expertiza:

    Test Plan

    • Capybara Test cases for the heat grid view are added to select the value from the dropdown menu. Both the 'Verbose-Comment-Count' and '--' are added.
    it "is able to create a public assignment with countofcomments metric" do
    		login_as("instructor6")
    		visit "/assignments/new?private=0"
    
    		fill_in 'assignment_form_assignment_name', with: 'public assignment for test'
    		select('Course 2', from: 'assignment_form_assignment_course_id')
    		fill_in 'assignment_form_assignment_directory_path', with: 'testDirectory'
    		fill_in 'assignment_form_assignment_spec_location', with: 'testLocation'
    		check("assignment_form_assignment_microtask")
    		check("assignment_form_assignment_reviews_visible_to_all")
    		check("assignment_form_assignment_is_calibrated")
    		uncheck("assignment_form_assignment_availability_flag")
    		expect(page).to have_select("assignment_form[assignment][reputation_algorithm]", options: %w[-- Hamer Lauw])
    		select "Verbose-Comment-Count", from: 'countsofcomment'
    
    		click_button 'Create'
    		assignment = Assignment.where(name: 'public assignment for test').first
    		expect(assignment).to have_attributes(
    			name: 'public assignment for test',
    			course_id: Course.find_by(name: 'Course 2').id,
    			directory_path: 'testDirectory',
    			spec_location: 'testLocation',
    			microtask: true,
    			is_calibrated: true,
    			availability_flag: false,
    			heatgrid_metric: 'countofcomments'
    		)
    	end
    
    	it "is able to create a public assignment with no metrics expected" do
    		login_as("instructor6")
    		visit "/assignments/new?private=0"
    
    		fill_in 'assignment_form_assignment_name', with: 'public assignment for test'
    		select('Course 2', from: 'assignment_form_assignment_course_id')
    		fill_in 'assignment_form_assignment_directory_path', with: 'testDirectory'
    		fill_in 'assignment_form_assignment_spec_location', with: 'testLocation'
    		check("assignment_form_assignment_microtask")
    		check("assignment_form_assignment_reviews_visible_to_all")
    		check("assignment_form_assignment_is_calibrated")
    		uncheck("assignment_form_assignment_availability_flag")
    		expect(page).to have_select("assignment_form[assignment][reputation_algorithm]", options: %w[-- Hamer Lauw])
    		select "--", from: 'countsofcomment'
    
    		click_button 'Create'
    		assignment = Assignment.where(name: 'public assignment for test').first
    		expect(assignment).to have_attributes(
    			name: 'public assignment for test',
    			course_id: Course.find_by(name: 'Course 2').id,
    			directory_path: 'testDirectory',
    			spec_location: 'testLocation',
    			microtask: true,
    			is_calibrated: true,
    			availability_flag: false,
    			heatgrid_metric: ''
    		)
    	end
    

    Spec test cases are added for the grades controller should be added to verify the responses returned from the controller.

    describe '#create with countofcomments' do
        before(:each) do
          allow(AssignmentForm).to receive(:new).with(any_args).and_return(assignment_form)
          @params = {
            button: '',
            assignment_form: {
              assignment_questionnaire: [{"assignment_id" => "1", "questionnaire_id" => "666", "dropdown" => "true",
                                          "questionnaire_weight" => "100", "notification_limit" => "15", "used_in_round" => "1"}],
              due_date: [{"id" => "", "parent_id" => "", "round" => "1", "deadline_type_id" => "1", "due_at" => "2017/12/05 00:00", "submission_allowed_id" => "3", "review_allowed_id" => "1", "teammate_review_allowed_id" => "3", "review_of_review_allowed_id" => "1", "threshold" => "1"},
                         {"id" => "", "parent_id" => "", "round" => "1", "deadline_type_id" => "2", "due_at" => "2017/12/02 00:00", "submission_allowed_id" => "1", "review_allowed_id" => "3", "teammate_review_allowed_id" => "3", "review_of_review_allowed_id" => "1", "threshold" => "1"}],
              assignment: {
                instructor_id: 2,
                course_id: 1,
                max_team_size: 1,
                id: 1,
                name: 'test assignment',
                directory_path: '/test',
                spec_location: '',
                private: false,
                show_teammate_reviews: false,
                require_quiz: false,
                num_quiz_questions: 0,
                staggered_deadline: false,
                microtask: false,
                reviews_visible_to_all: false,
                is_calibrated: false,
                availability_flag: true,
                reputation_algorithm: 'Lauw',
                heatgrid_metric: 'countofcomments',
                simicheck: -1,
                simicheck_threshold: 100
              }
            }
          }
        end
        context 'when assignment_form is saved successfully' do
          it 'redirects to assignment#edit page' do
            allow(assignment_form).to receive(:assignment).and_return(assignment)
            allow(assignment_form).to receive(:save).and_return(true)
            allow(assignment_form).to receive(:update).with(any_args).and_return(true)
            allow(assignment_form).to receive(:create_assignment_node).and_return(double('node'))
            allow(assignment).to receive(:id).and_return(1)
            allow(Assignment).to receive(:find_by).with(id: 1).and_return(assignment)
            allow_any_instance_of(AssignmentsController).to receive(:undo_link)
              .with('Assignment "test assignment" has been created successfully. ').and_return(true)
            post :create, @params
            expect(response).to redirect_to('/assignments/1/edit')
          end
        end
    
        context 'when assignment_form is not saved successfully' do
          it 'renders assignment#new page' do
            allow(assignment_form).to receive(:save).and_return(false)
            post :create, @params
            expect(response).to render_template(:new)
          end
        end
      end
    
    • Unit test cases are added to verify the logic of the number_of_comments_greater_than_10_words method of the vm_question_response model.
    describe '#heatgrid_metric' do
        it 'returns countofcomments by default' do      
          assignment = create(:assignment)
          expect(assignment.heatgrid_metric).to eq('countofcomments')
        end
    
        it 'none value can be selected' do
          assignment = build(:assignment, heatgrid_metric: '')
          expect(assignment.heatgrid_metric).to eq('')
        end
      end
    

    Important Links

    Team

    • Shlok Sayani (sdsayani)
    • Hardik Udeshi (hvudeshi)
    • Isha Gupta (igupta)
    • Manish Shinde (msshinde)