E1863 Issues related to assignment creation

From Expertiza_Wiki
Jump to navigation Jump to search

Introduction

An instructor or TA can create assignments within a course. There are a lot of configurations that can be made while creating these assignments and there are a few known issues related to this.

Problem statement

There are 5 issues that are being dealt with in this project:

Issue #1008 - Issue related to staggered deadline

If there are multiple topics added in an staggered-deadlined assignment and if the deadline of those topics are in future, students are not able to sign up for any of them. Overall assignment due dates are taking precedence, on the Due Dates tab. Due dates for the assignment needs to be changed manually to the due dates for the new topics just added. Students are able to sign up for topics only when all of the assignment due dates are in the future AND the due date for the topic they are choosing is in the future. They should be able to sign up if only the due date for the topic they are choosing is in the future. The overall assignment due dates should be irrelevant. In other words, topic should obey just the topic deadlines and not the assignment deadlines.

Issue #1017 - Issue related to deleting assignment

At present, when the TA creates a new assignment, only he has the ability to delete it. The task at hand is to allow the instructor to delete the assignment that is created by a TA.

When an assignment is created by a participant, it assigns the delete option to self. This needs to be overridden in that the instructor must be able to view the assignment list by having an additional parameter to classify the creator of that assignment as Teaching Assistant or Instructor, and giving the Instructor the option to delete an assignment created by TA.

Issue #1065 - Issue related to rubrics when an assignment is copied

There are assignments that have rubrics that vary by round, i.e. each round of the assignment review will have a different set of rubrics. When such an assignment is copied, there exists a problem where the rubrics from the original assignment are not copied over properly to the new assignment. This new assignment does not have rubrics that vary by round, as in the original assignment, but have the rubric from Round 1 in the original assignment copied over for all rounds. This makes the copying of assignments incomplete and thus, needs to be fixed.

Issue #1072 - Issue related to instructor's assignment participation

The Issue is that the Instructor is not able to participate in a given assignment. This issues require a fix so that the instructor can also add himself as a participant in the assignment created .This fix will allow the instructor to perform the same functionality as the other student participants as reviewing peer assignments , submitting assignment, etc.

Issue #308 - Issue related to questionnaire weight

While creating/editing an assignment, one of the configurations is setting up of the rubrics. This is done in the 'Rubrics' tab of the assignment page. While setting up the rubrics, we can assign a weight to each of it, so that the final score will be the weighted sum of the different rubric scores. The default weight of a rubric is always 0%, meaning that it's not counted towards the final score. But if any of the rubric is assigned with a non-zero weight, we need to make sure that the sum of all the weights of the various rubrics add up to 100%. This is not enforced currently, allowing the user to have a total weight which is between 0% and 100%. This needs to be fixed to bring in a hard stop, if the sum of the weights don't add up to 0% or 100%.

Proposed Solution

Issue #1008 - Issue related to staggered deadline

For staggered deadline assignments, different topics might have different deadlines. So, the deadline for each topic needs to be checked on an individual basis. Deadlines for individual topics are stored in a table called due_dates with the parent_id as the identifier of the particular topic in place of the assignment identifier. A logic for getting the due dates of individual topics for staggered deadline assignments is found in the method check_topic_due_date_value in the module SignUpSheetHelper.

topic_due_date = TopicDueDate.where(parent_id: topic_id, deadline_type_id: deadline_type_id, round:review_round).first rescue nil
if !topic_due_date.nil?
   due_date = topic_due_date.due_at
else
   due_date = assignment_due_dates[review_round - 1].due_at.to_s

Currently, if the signup deadline of the the assignment is earlier that the submission deadline for a topic, that topic is not available for taking. This is restricted by the following piece of code in _all_actions.html.erb.

<% elsif (@signup_topic_deadline.nil? || (Time.now < @signup_topic_deadline.due_at)) &&
              (!@assignment.staggered_deadline? || (Time.now < get_topic_deadline([@assignment.due_dates.find_by(deadline_type_id: 1)], topic.id))) %>
              <td align="center"><%= link_to image_tag('Check-icon.png', :border => 0, :title => 'Signup', :align => 'middle'), :controller=>'sign_up_sheet', :action=> 'sign_up',
               :id=>params[:id],:topic_id => topic.id, :assignment_id => params[:assignment_id] %></td>
<% end %>

Fix to be implemented(tentative): Change the above piece of code to allow signing up staggered assignment topics bases on the topic deadline and not on the assignment sign up deadline. The prospective change is shown below.

<% elsif ((@signup_topic_deadline.nil? || (Time.now < @signup_topic_deadline.due_at)) &&
                (!@assignment.staggered_deadline? || (Time.now < get_topic_deadline([@assignment.due_dates.find_by(deadline_type_id: 1)], topic.id)))) ||
                (@assignment.staggered_deadline? || (Time.now < get_topic_deadline([@assignment.due_dates.find_by(deadline_type_id: 1)], topic.id)))%>
              <td align="center"><%= link_to image_tag('Check-icon.png', :border => 0, :title => 'Signup', :align => 'middle'), :controller=>'sign_up_sheet', :action=> 'sign_up', 
               :id=>params[:id],:topic_id => topic.id, :assignment_id => params[:assignment_id] %></td>
<% end %>

Issue #1017 - Issue related to deleting assignment

Task Description: Teaching Assistant creating an assignment

Precondition: Has the instructor set up the page for assignment creation.

Primary Flow:

  1. Log in to Expertiza
  2. Select New Assignment
  3. Enter the Assignment Name and select Course.
  4. Check the parameters for the teams, quiz, badges categories etc.
  5. Click Create


Task Description: Instructor or Teaching Assistant deleting an assignment

Precondition: There exists at least one assignment created by TA.

Primary Flow:

  1. Log in to Expertiza
  2. Select the Delete option in the action section for an assignment created by the TA.
  3. If Logged in as Instructor or Teaching Assistant, the assignment gets deleted for that action.
  4. Else, the current participant cannot execute the option.


This can be understood through the flow diagram provided below:

The fix to resolve the issue is given below:

 def delete
   begin
     @assignment_form = AssignmentForm.create_form_object(params[:id])
     @user = session[:user]
     id = @user.get_instructor
     # allow delete if @user.id has role instructor and @assingment_form.assignment.instrutor_id has role ta
     # (@user.role == "Instructor" and @assignment_form.assignment.instructor.name.role == "ta")
     if id == @assignment_form.assignment.instructor_id or (@user.role == "Instructor" and @assignment_form.assignment.instructor.name.role == "ta")
       # allow delete
       @assignment_form.delete(params[:force])
       ExpertizaLogger.info LoggerMessage.new(controller_name, session[:user].name, "Assignment #{@assignment_form.assignment.id} was deleted.", request)
       flash[:success] = "The assignment was successfully deleted."
     else
       #  throw error
       ExpertizaLogger.info LoggerMessage.new(controller_name, session[:user].name, "You are not authorized to delete this assignment.", request)
       raise "You are not authorized to delete this assignment."
     end
   rescue StandardError => e
     flash[:error] = e.message
   end
   redirect_to list_tree_display_index_path
 end

Modifications made to the code check for the form id and allow permission to delete when the id belongs to assignment creator or when the role of the current user is 'Instructor'.

Issue #1065 - Issue related to rubrics when an assignment is copied

When an assignment is copied, all the rubric data is to be copied over. As the copying over was incomplete, there were issues. This is fixed in the copy_assignment_questionnaire method of assignment_form.rb file.

The current code is shown below. We can see that the data (columns) related to the various rounds are not copied over. This needs to be fixed.

def self.copy_assignment_questionnaire(old_assign, new_assign, user)
  old_assign.assignment_questionnaires.each do |aq|
    AssignmentQuestionnaire.create(
      assignment_id: new_assign.id,
      questionnaire_id: aq.questionnaire_id,
      user_id: user.id,
      notification_limit: aq.notification_limit,
      questionnaire_weight: aq.questionnaire_weight
    )
  end
end

After the fix, the code looks like below. The columns related to the various rounds will be copied over from now on.

def self.copy_assignment_questionnaire(old_assign, new_assign, user)
  old_assign.assignment_questionnaires.each do |aq|
    AssignmentQuestionnaire.create(
      assignment_id: new_assign.id,
      questionnaire_id: aq.questionnaire_id,
      user_id: user.id,
      notification_limit: aq.notification_limit,
      questionnaire_weight: aq.questionnaire_weight,
      used_in_round: aq.used_in_round,
      dropdown: aq.dropdown
    )
  end
end

Issue #1072 - Issue related to instructor's assignment participation

Log in as a Instructor. When the instructor is logged in he can create a new assignment or use an existing assignment . All the assignments that are created would require participants which happens to be the responsibility of the instructor . Thus the Instructor adds the participants to the assignment and with this fix the instructor will be added as a participant by default every time a new assignment is created.The new functionality in the assignment controller will be modified to resolve the issue.

Issue #308 - Issue related to questionnaire weight

When we save a new/existing assignment, we need to bring in a check to see if the sum of the weights of the various rubrics add up to 0 or 100%. If this check fails, we need to throw a notice that says, "Sum of weights of rubrics need to be 0 or 100%.". The user has to make the corresponding modification to the weights and try again. If the check succeeds, we continue with the assignment saving process.

A new validation method validate_assignment_questionnaires_weights called in the update_assignment_questionnaires method of assignment_form.rb would do the checking:

  # code to save assignment questionnaires
  def update_assignment_questionnaires(attributes)
    return false unless attributes
    validate_assignment_questionnaires_weights(attributes)
    @errors = @assignment.errors
    unless @has_errors
      existing_aqs = AssignmentQuestionnaire.where(assignment_id: @assignment.id)
      existing_aqs.each(&:delete)
      attributes.each do |assignment_questionnaire|
        if assignment_questionnaire[:id].nil? or assignment_questionnaire[:id].blank?
          aq = AssignmentQuestionnaire.new(assignment_questionnaire)
          unless aq.save
            @errors = @assignment.errors.to_s
            @has_errors = true
          end
        else
          aq = AssignmentQuestionnaire.find(assignment_questionnaire[:id])
          unless aq.update_attributes(assignment_questionnaire)
            @errors = @assignment.errors.to_s
            @has_errors = true
          end
        end
      end
    end
  end
  
  # checks to see if the sum of weights of all rubrics add up to either 0 or 100%
  def validate_assignment_questionnaires_weights(attributes)
    total_weight=0
    attributes.each do |assignment_questionnaire|
      total_weight+=assignment_questionnaire[:questionnaire_weight].to_i
    end
    if total_weight != 0 and total_weight != 100
      @assignment.errors.add(:message,'Total weight of rubrics should add up to either 0 or 100%')
      @has_errors = true
    end
  end