CSC/ECE 517 Fall 2019 - E1953. Tagging report for student

From Expertiza_Wiki
Jump to navigation Jump to search

CSC/ECE 517 Fall 2019 - E1953. Tagging report for student

Introduction

About Expertiza

Expertiza is an open source project based on Ruby on Rails framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.

Problem Statement

The following tasks were accomplished in this project:

  • If tagging is enabled, number of total tags per round is shown on student's score page
  • Implemented feature which shows number of tags student have entered
  • Implemented feature to show number of tags entered and total number of tags in Assignment page.
  • Implemented feature to show tagging counts dynamically when student change tagging type in score page
  • Added RSPEC testcases for testing changes done for tagging

About Tagging

Expertiza has a feature of peer review where other teams can provide feedback on student's work. There is also another feature of "Tags", where a student can answer if the feedback provided were helpful or not. Tags can vary from assignment to assignment but the main motive of it is to provide information on whether the feedback provides helpful information for student's assignment. The picture below shows an example of tags.

Motivation

For a particular assignment, there may be a lot of questions and hence multiple feedback. Students might miss a few tags and they might go unanswered. This feature will provide students to keep track of answered tags and show them how many tags have they answered out of total tags on the page.

Design

For counting, we are primarily concerned with two numbers: the number of possible tags for an assignment and the number of completed tags for an assignment. The latter is easy to calculate as it's directly stored as AnswerTags. The former is more difficult: possible tags are stored as TagPromptDeployments which do not have a 1:1 correspondence to the number of prompts the user sees on their page.

The green classes are used to count the number of tags done, the red classes are used to count the number of tags possible, and the yellow classes are used to calculate both counts. All classes help to narrow the scope to a specific user and assignment.

Implementation

Task 1 : Count answered tags in an assignment on Assignment Homepage

Description

On clicking of particular Assignment, student can see his/her teams, work, scores, etc. There is no feature which allows student to show how many of the review tags has he/she answered on this page. This task implements this feature where student can see answered tags with respect to total tags in Assignment page.

Code Implemented

app/controllers/student_task_controller.rb - The following code counts the number of Tags present in an assignment and total number of answered tags in that particular assignment.

    @completed_tags = 0
    @total_tags = 0
    vmlist.each do |vm|
      vm.list_of_rows.each do |r|
        r.score_row.each do |row|
          vm_prompts = row.vm_prompts.select {|prompt| prompt.tag_dep.tag_prompt.control_type.downcase != "checkbox"}
          @total_tags += vm_prompts.count
          vm_prompts.each do |vm_prompt|
            answer_tag = AnswerTag.where(tag_prompt_deployment_id: vm_prompt.tag_dep, user_id: @participant.user_id, answer: vm_prompt.answer).first
            if !answer_tag.nil? and answer_tag.value != "0"
              @completed_tags += 1
            end
          end
        end
      end
    end

Task 2 : Count answered tags in an assignment per rounds on Summary Report Page

Description

On clicking of particular Assignment>Your Scores> student can see his/her score. Student can also see all the reviews per rounds in particular assignment. This new feature will allow student to see number of answered tags per round with respect to number of total tags present in particular round

Code Implemented

app/controllers/grades_controller.rb - The following code counts the number of Tags present in a round and total number of answered tags in that particular round.

    @vmlist.each do |vm|
        if vm.round == @round
          vm.list_of_rows.each do |r|
            r.score_row.each do |row|
              vm_prompts = row.vm_prompts.select {|prompt| prompt.tag_dep.tag_prompt.control_type.downcase != "checkbox"}
              if vm_prompts.count > 0
                @total_tags += vm_prompts.count
                vm_prompts.each do |vm_prompt|
                  answer_tag = AnswerTag.where(tag_prompt_deployment_id: vm_prompt.tag_dep, user_id: @participant.user_id, answer: vm_prompt.answer).first
                  if !answer_tag.nil? and answer_tag.value != "0"
                    @completed_tags += 1
                  end
                end
              end
            end
          end
        end
      end
      @total_tags_array.append(@total_tags)
      @completed_tags_array.append(@completed_tags)

Task 3 : Per round tag counts should be automatically updated as soon as tags are changed

Description

If a user changes their tags, the page formerly needed to be refreshed in order to display the correct counts. This functionality ensures that the tag counts always accurately reflect the results on the page.

Code Implemented

app/assets/javascripts/answer_tags.js - The following code correctly increments/decrements the tag count on the page based on the user's action.

update_tag_count = function(tag_prompt, round_number) {
    //Get the previous value of this tag prompt from an HTML attribute
    var old_value =  tag_prompt.getAttribute('data-prev_value')
    //This is the new value of the tag prompt
    var new_value = tag_prompt.value
    //Store the new value back into the HTML attribute
    tag_prompt.setAttribute('data-prev_value', new_value)
    //This is the current tag count for the round this tag is in
    var current_count = parseInt(document.getElementById('tag_counts_' + (round_number)).innerHTML);
    if(old_value != "0" && new_value == "0") {
      //The user has reset the value of this tag. Decrement the tag count
      document.getElementById('tag_counts_' + round_number).innerHTML = current_count - 1;
    } else if(old_value == "0" && new_value != "0"){
      //The user has set the value of this tag to something meaningful. Increment the count
      document.getElementById('tag_counts_' + round_number).innerHTML = current_count + 1;
    }
}

Process

Test Plan

RSpec Tests

Please find below RSpec Test cases for this feature

Issue 1: Show tagging count for Assignment Homepage

spec/controllers/student_task_controller_spec.rb

Follow the below steps to Verify the fix for this issue:

Test Case 1

it "reports zero completed tags correctly" do
  allow(AnswerTag).to receive(:where).with(tag_prompt_deployment_id: deployment1, user_id: 1, answer: answer2).and_return([])
  allow(AnswerTag).to receive(:where).with(tag_prompt_deployment_id: deployment2, user_id: 1, answer: answer2).and_return([])
  allow(AnswerTag).to receive(:where).with(tag_prompt_deployment_id: deployment3, user_id: 1, answer: answer2).and_return([])
  allow(AnswerTag).to receive(:where).with(tag_prompt_deployment_id: deployment4, user_id: 1, answer: answer2).and_return([])

  allow(AnswerTag).to receive(:where).with(tag_prompt_deployment_id: deployment1, user_id: 1, answer: answer1).and_return([])
  allow(AnswerTag).to receive(:where).with(tag_prompt_deployment_id: deployment2, user_id: 1, answer: answer1).and_return([])
  allow(AnswerTag).to receive(:where).with(tag_prompt_deployment_id: deployment3, user_id: 1, answer: answer1).and_return([])
  allow(AnswerTag).to receive(:where).with(tag_prompt_deployment_id: deployment4, user_id: 1, answer: answer1).and_return([])
  params = {id: 1}
  get :view, params
  expect(controller.instance_variable_get(:@participant)).to eq(participant)
  expect(assigns(:completed_tags)).to eq(0)
  expect(assigns(:total_tags)).to eq(6)
end

Test Case 2

it "reports some completed tags correctly" do
  answer_tags = [AnswerTag.new(value: 0), AnswerTag.new(value: 1), AnswerTag.new(value: -1), AnswerTag.new(value: 1),
  AnswerTag.new(value: 1), AnswerTag.new(value: 1), AnswerTag.new(value: -1), AnswerTag.new(value: 0),]
        
  allow(AnswerTag).to receive(:where).with(tag_prompt_deployment_id: deployment1, user_id: 1, answer: answer2).and_return([answer_tags[0]])
  allow(AnswerTag).to receive(:where).with(tag_prompt_deployment_id: deployment2, user_id: 1, answer: answer2).and_return([answer_tags[1]])
  allow(AnswerTag).to receive(:where).with(tag_prompt_deployment_id: deployment3, user_id: 1, answer: answer2).and_return([answer_tags[2]])
  allow(AnswerTag).to receive(:where).with(tag_prompt_deployment_id: deployment4, user_id: 1, answer: answer2).and_return([answer_tags[3]])
       
  allow(AnswerTag).to receive(:where).with(tag_prompt_deployment_id: deployment1, user_id: 1, answer: answer1).and_return([answer_tags[4]])
  allow(AnswerTag).to receive(:where).with(tag_prompt_deployment_id: deployment2, user_id: 1, answer: answer1).and_return([answer_tags[5]])
  allow(AnswerTag).to receive(:where).with(tag_prompt_deployment_id: deployment3, user_id: 1, answer: answer1).and_return([answer_tags[6]])
  allow(AnswerTag).to receive(:where).with(tag_prompt_deployment_id: deployment4, user_id: 1, answer: answer1).and_return([answer_tags[7]])
  params = {id: 1}
  get :view, params
  expect(controller.instance_variable_get(:@participant)).to eq(participant)
  expect(assigns(:completed_tags)).to eq(5)
  expect(assigns(:total_tags)).to eq(6)
end

Issue 2: Show tagging count for review page

spec/controllers/grades_controller_spec.rb

Follow the below steps to Verify the fix for this issue:

Test Case 1

it "reports zero completed tags correctly" do
  allow(AnswerTag).to receive(:where).with(tag_prompt_deployment_id: deployment1, user_id: 1, answer: answer2).and_return([])
  allow(AnswerTag).to receive(:where).with(tag_prompt_deployment_id: deployment2, user_id: 1, answer: answer2).and_return([])
  allow(AnswerTag).to receive(:where).with(tag_prompt_deployment_id: deployment3, user_id: 1, answer: answer2).and_return([])
  allow(AnswerTag).to receive(:where).with(tag_prompt_deployment_id: deployment4, user_id: 1, answer: answer2).and_return([])

  allow(AnswerTag).to receive(:where).with(tag_prompt_deployment_id: deployment1, user_id: 1, answer: answer1).and_return([])
  allow(AnswerTag).to receive(:where).with(tag_prompt_deployment_id: deployment2, user_id: 1, answer: answer1).and_return([])
  allow(AnswerTag).to receive(:where).with(tag_prompt_deployment_id: deployment3, user_id: 1, answer: answer1).and_return([])
  allow(AnswerTag).to receive(:where).with(tag_prompt_deployment_id: deployment4, user_id: 1, answer: answer1).and_return([])
  params = {id: 1}
  get :view_team, params
  expect(controller.instance_variable_get(:@participant)).to eq(participant)
  expect(assigns(:completed_tags)).to eq(0)
  expect(assigns(:total_tags)).to eq(6)
end

Test Case 2

it "reports some completed tags correctly" do
  answer_tags = [AnswerTag.new(value: 0), AnswerTag.new(value: 1), AnswerTag.new(value: -1), AnswerTag.new(value: 1),
  AnswerTag.new(value: 1), AnswerTag.new(value: 1), AnswerTag.new(value: -1), AnswerTag.new(value: 0),]
        
  allow(AnswerTag).to receive(:where).with(tag_prompt_deployment_id: deployment1, user_id: 1, answer: answer2).and_return([answer_tags[0]])
  allow(AnswerTag).to receive(:where).with(tag_prompt_deployment_id: deployment2, user_id: 1, answer: answer2).and_return([answer_tags[1]])
  allow(AnswerTag).to receive(:where).with(tag_prompt_deployment_id: deployment3, user_id: 1, answer: answer2).and_return([answer_tags[2]])
  allow(AnswerTag).to receive(:where).with(tag_prompt_deployment_id: deployment4, user_id: 1, answer: answer2).and_return([answer_tags[3]])
       
  allow(AnswerTag).to receive(:where).with(tag_prompt_deployment_id: deployment1, user_id: 1, answer: answer1).and_return([answer_tags[4]])
  allow(AnswerTag).to receive(:where).with(tag_prompt_deployment_id: deployment2, user_id: 1, answer: answer1).and_return([answer_tags[5]])
  allow(AnswerTag).to receive(:where).with(tag_prompt_deployment_id: deployment3, user_id: 1, answer: answer1).and_return([answer_tags[6]])
  allow(AnswerTag).to receive(:where).with(tag_prompt_deployment_id: deployment4, user_id: 1, answer: answer1).and_return([answer_tags[7]])
  params = {id: 1}
  get :view_team, params
  expect(controller.instance_variable_get(:@participant)).to eq(participant)
  expect(assigns(:completed_tags)).to eq(5)
  expect(assigns(:total_tags)).to eq(6)
end

Regression Tests

Since new changes were added to existing function, we ran the existing tests to ensure none of them were failing.

Manual Tests

We needed to check if the feature implemented were resulting the expected behavior. To test this we followed following steps:-

1. Login as a student

2. Select Assignment for Assignment Home Page


Test Case 1

This page should show number of tags completed and total tags present including all the rounds in that particular assignment. ✓


Test Case 2

On selecting Your Scores on Student Task page, Each round should show Review Tagged Column. ✓


Test Case 3

Review Tagged Column should consist of tags completed and total tags count for that particular round. ✓


Test Case 4

Review Tagged Column should not consist of tags completed in all rounds and total tags count. ✓


Test Case 5

Review Tagged Column should dynamically increase or decrease tag count when user change their tagging. ✓

Deployed Example

Below are instructions for navigating through expertiza to see the review tags in action.

1. Go to http://152.46.18.192:8080/ and log in as {username: student7552 password: password}.

2. After you log in if you are not at the assignments landing page (152.46.18.192:8080//student_task/list) click on Assignments to navigate there.

3. Click on "Final project (and design doc)" from the list of assignments in the table at the bottom of the page.

4. Behold the tag counter next to the bullet labeled "Your scores". It reads (You have tagged the available tags completed / total available reviews).

5. Further, click on "Your scores". On the next page that shows up, click on a row in the table to see the tags. Notice in the last column of the header of the table is a cell containing the available tags completed / total available tags.

6. After clicking on a row to reveal tags drag the blue square towards 'No,' 'Yes,' or the middle. Observe that the tags left / total tags has updated.

7. To observe the new per round tagging capabilities log out and then log in as {username: student8115 password: password}.

8. Select the first Program 2 from the list of assignments. In the next page click on "Your scores" as in step 4 above. Scroll down and behold tagging statistics for each round in the last column of the table headers.

Teammates

Mentor -Akanksha Mohan

  • Sameer Adhikari (sadhika2)
  • Spencer Yoder (smyoder)
  • Mark Trawick (mtrawic)

References

  1. Github Repository for Expertiza
  2. Expertiza Documentation on Database Tables
  3. Rails Guide Documentation