E1863 Issues related to assignment creation: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
 
(39 intermediate revisions by 3 users not shown)
Line 1: Line 1:
== Introduction ==
== Introduction ==


Assignment creation can be done in Expertiza by an instructor or a TA for a particular course. It is available from the '''Manage -> Assignments''' drop down on the expertiza site. Two types of assignments can be created - private and public. The various properties of assignemtns are grouped into tabs - General, Topics, Rubrics, Review strategy, Due dates and Other stuff. There were various issues related to saving data in these. The main motive behind this project is to fix these issues and maintain data integrity.
Assignment creation can be done in Expertiza by an instructor or a TA for a particular course. It is available from the '''Manage -> Assignments''' drop down on the expertiza site. Two types of assignments can be created - private and public. The various properties of assignments are grouped into tabs - General, Topics, Rubrics, Review strategy, Due dates and Other stuff. There were some issues related to the assignment creation. The main motive behind this project is to fix these issues and provide improved functionalities.


There are 5 issues that are being dealt with in this project and each of them are explained in detail below.  
There are in all 5 issues that are being dealt within this project and each of them are explained in detail below.


==Issue #1008 - Issue related to staggered deadline==
==Issue #1008 - Issue related to staggered deadline==
Line 11: Line 11:
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.
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.


===Proposed Solution===
===Implementation===


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'''.
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'''.
Line 33: Line 33:
</pre>
</pre>


Fix to be implemented(tentative):  
Fix to be implemented:  
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.
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.


<pre>
<pre<!---->>
<% elsif ((@signup_topic_deadline.nil? || (Time.now < @signup_topic_deadline.due_at)) &&
<% 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)))) ||
                 (@assignment.staggered_deadline? && (Time.now < get_topic_deadline([@assignment.due_dates.find_by(deadline_type_id: 1)], topic.id))) %>
                 <span style=background:lightgreen>(@assignment.staggered_deadline? && (Time.now < get_topic_deadline([@assignment.due_dates.find_by(deadline_type_id: 1)], topic.id)))</span> %>
                       <td align="center"><%= link_to image_tag('Check-icon.png', :border => 0, :title => 'Signup', :align => 'middle'), :controller=>'sign_up_sheet', :action=> 'sign_up',  
                       <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>
                             :id=>params[:id],:topic_id => topic.id, :assignment_id => params[:assignment_id] %></td>
Line 73: Line 73:
<b>Automated Testing</b>
<b>Automated Testing</b>


Test cases would involve setting the topic submission deadline to a date later than the the signup deadline testing the view actions.
No automated test cases, only manual testing since the modifications are made to the view files.  


===References===
===References===


# [https://piazza.com/class/jl1cgvwxl0f1nl?cid=539 Video Link]
1. [https://youtu.be/G9rWkcBSPnU Demo Video Link]


# [http://wiki.expertiza.ncsu.edu/index.php/Main_Page Pull Request]
2. [https://github.com/expertiza/expertiza/pull/1320 Pull Request]


==Issue #1017 - Issue related to deleting assignment==
==Issue #1017 - Issue related to deleting assignment==
Line 85: Line 85:
===Problem Statement===
===Problem Statement===


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 the instructor or by the TA , the delete option is assigned to self, that is, to the one who created the assignment. 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.
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 the instructor or by the TA , the delete option is assigned to self, that is, to the one who created the assignment. This needs to be overridden in that the instructor must be able to delete any assignment that shows up in the list without the need for matching the assignment Id with it's own and giving Instructor the ability to delete any assignment created by a TA.


===Proposed Solution===
===Implementation===


The flow diagram given below specifies the sequence of events that will aim at resolving the issue related to deleting an assignment :
The flow diagram given below specifies the sequence of events that will aim at resolving the issue related to deleting an assignment :


[[File:Issue1017.png]]
[[File:E1863-Issue1017.png]]
 
The fix to resolve the issue involves the delete function in the assignment controller.


The fix to resolve the issue involves the delete function in the assignment controller. The code at present checks for the current user and allows it the permission to delete the file.  
The code at present checks for the current user and allows it the permission to delete the file if it's id matches with the Id of assignment creator.  


   if id != @assignment_form.assignment.instructor_id
   <span style=background:yellow>if id != @assignment_form.assignment.instructor_id</span>
     ExpertizaLogger.info LoggerMessage.new(controller_name, session[:user].name, "You are not authorized to delete this assignment.", request)
     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."
     raise "You are not authorized to delete this assignment."
Line 106: Line 108:
To allow instructor to delete an assignment created by TA, the if-else block is fixed as given:  
To allow instructor to delete an assignment created by TA, the if-else block is fixed as given:  


   if id == @assignment_form.assignment.instructor_id or (@user.role == "Instructor" and @assignment_form.assignment.instructor.name.role == "ta")
   <span style=background:lightgreen>if @user.role.name == "Instructor" or (@user.role.name == "Teaching Assistant" and id == @assignment_form.assignment.instructor_id)</span>
    # allow instructor to delete assignment
    # allow delete
    @assignment_form.delete(params[:force])
    @assignment_form.delete(params[:force])
    ExpertizaLogger.info LoggerMessage.new(controller_name, session[:user].name, "Assignment #{@assignment_form.assignment.id} was deleted.", request)
    ExpertizaLogger.info LoggerMessage.new(controller_name, session[:user].name, "Assignment #{@assignment_form.assignment.id} was deleted.", request)
    flash[:success] = "The assignment was successfully deleted."
    flash[:success] = "The assignment was successfully deleted."
   else
   else
    # throw error
    # throw error
    ExpertizaLogger.info LoggerMessage.new(controller_name, session[:user].name, "You are not authorized to delete this assignment.", request)
    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."
    raise "You are not authorized to delete this assignment."
   end
   end


Line 125: Line 127:
''Task Description:'' Teaching Assistant creating an assignment
''Task Description:'' Teaching Assistant creating an assignment


''Precondition:'' The instructor has set up the page for assignment creation.
''Precondition:'' The instructor has set up the page for assignment creation


''Primary Flow:''
''Primary Flow:''
Line 136: Line 138:




''Task Description:'' Instructor or Teaching Assistant deleting an assignment
''Task Description:'' Instructor deleting an assignment


''Precondition:'' There exists at least one assignment created by TA.
''Precondition:'' There exists at least one assignment created by TA.
Line 143: Line 145:


# Log in to Expertiza
# Log in to Expertiza
# Select the '''Delete''' option in the action section for an assignment created by the '''TA'''.   
# Select the '''Delete''' option in the action section for an assignment that is created by the '''TA'''.   
# If Logged in as '''Instructor or Teaching Assistant''', the assignment gets deleted for that action.
# If Logged in as '''Instructor''', the assignment gets deleted for that action.
# Else, the '''current participant''' is shown the '''error''' message that they do not have authorization to execute the delete option.
# Else, the '''current participant''' is shown the '''error''' message that they do not have authorization to execute the delete option if they '''did not create that assignment'''.




<b>Automated Testing</b>
<b>Automated Testing</b>


Test cases mainly involve controller testing to check the '''assignment created by TA''' and it '''can be deleted by instructor''' through invocation of the '''''delete''''' method.
The issue as such did not require modifying the controller spec file for assignments, since the changes were only made to the delete function and the test cases written check for the display of proper flash message that could be mapped for the modified code functionality. Only '''manual testing''' was performed to determine '''successful deletion''' by '''instructor'''.


===References===
===References===


# [https://piazza.com/class/jl1cgvwxl0f1nl?cid=539 Video Link]
1. [https://www.youtube.com/watch?v=-3PTZjRLN-o&t=2s Demo Video Link]


# [http://wiki.expertiza.ncsu.edu/index.php/Main_Page Pull Request]
2. [https://github.com/expertiza/expertiza/pull/1324 Pull Request]


==Issue #1065 - Issue related to rubrics when an assignment is copied==
==Issue #1065 - Issue related to rubrics when an assignment is copied==
Line 164: Line 166:
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.
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.


===Proposed Solution===
===Implementation===


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.
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.
Line 217: Line 219:
<b>Automated Testing</b>
<b>Automated Testing</b>


This would mainly involve controller testing to see if the rubrics are copied entirely after the invocation of the ''copy_assignment_questionnaire'' method.
This would reuse the existing automation tests.


===References===
===References===


# [https://piazza.com/class/jl1cgvwxl0f1nl?cid=539 Video Link]
1. [https://www.youtube.com/watch?v=io89e3xlRPA Demo Video Link]


# [http://wiki.expertiza.ncsu.edu/index.php/Main_Page Pull Request]
2. [https://github.com/expertiza/expertiza/pull/1328 Pull Request]


==Issue #1072 - Issue related to instructor's assignment participation==
==Issue #1072 - Issue related to instructor's assignment participation==
Line 231: Line 233:
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.
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.


===Proposed Solution===
===Implementation===


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.  
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.  
Line 251: Line 253:


<pre>
<pre>
<div class = "">


<table id="" class="table table-striped" style="font-size: 15px">
<table id="" class="table table-striped" style="font-size: 15px">
   <tr>
    
    <th colspan=5 style="background-color: white; border-top: 0px"></th>
    <th colspan=3 >E-mail on ...</th>
    <th colspan=3 >Permissions ...</th>
  </tr> 
  <tr>
    <th class="head">Name</th>
    <th class="head">Full Name</th>
    <th class="head">Email Address</th>
    <th class="head">Role</th>
    <th class="head">Parent</th>
    <% if params[:model] == 'Assignment' and Assignment.find_by(id: params[:id]).has_badge? %>
      <th class="head">Badges</th>
    <% end %> 
    <th class="head">Review</th>
    <th class="head">Submission</th>
    <th class="head">Metareview</th>
    <th class="head">Submit</th>
    <th class="head">Review</th>
    <th class="head">Take quiz</th>
    <th class="head">Handle</th>
    <th class="head">Action</th>
  </tr>
  <!--E1721 changes begin-->
  <% @user_id = [] %>
  <%= render partial: 'participants/participant', collection: user_list, :locals => {:userid => @user_id, :controller => 'participants'}%>
  <!--E1721 changes End-->
</table>
 
 
</div>
 
<script>
    var participants = <%=@user_id%>;
    participants.forEach(function(participant){
        $('#'.concat(participant.toString())).change(function(){
            $('#button'.concat(participant.toString())).show();
        });
    });
</script>
</pre>
</pre>


Line 301: Line 263:
<pre<!---->>
<pre<!---->>
<% unless flash[:error] %>
<% unless flash[:error] %>
$<span style=background:lightgreen>("#user_list")</span>.append(
$("<span style=background:yellow>#user_list</span>").append(
"<%= j render :partial => 'participant', :locals => {participant: @participant, :userid => @participant.user_id, :controller => 'participants'} %>");
"<%= j render :partial => 'participant', :locals => {participant: @participant, :userid => @participant.user_id, :controller => 'participants'} %>");
<% end %>
<% end %>
Line 309: Line 271:
<b> _user_list.html.erb file</b>
<b> _user_list.html.erb file</b>


<pre>
<pre<!---->>
<div class = "">
<table id="<span style=background:lightgreen>user_list</span>" class="table table-striped" style="font-size: 15px"> # here the table id is changed to user_list
 
<table id="user_list" class="table table-striped" style="font-size: 15px"> <span style=background:lightgreen>the id is changed to user_list</span>
  <tr>
    <th colspan=5 style="background-color: white; border-top: 0px"></th>
    <th colspan=3 >E-mail on ...</th>
    <th colspan=3 >Permissions ...</th>
  </tr> 
  <tr>
    <th class="head">Name</th>
    <th class="head">Full Name</th>
    <th class="head">Email Address</th>
    <th class="head">Role</th>
    <th class="head">Parent</th>
    <% if params[:model] == 'Assignment' and Assignment.find_by(id: params[:id]).has_badge? %>
      <th class="head">Badges</th>
    <% end %> 
    <th class="head">Review</th>
    <th class="head">Submission</th>
    <th class="head">Metareview</th>
    <th class="head">Submit</th>
    <th class="head">Review</th>
    <th class="head">Take quiz</th>
    <th class="head">Handle</th>
    <th class="head">Action</th>
  </tr>
  <!--E1721 changes begin-->
  <% @user_id = [] %>
  <%= render partial: 'participants/participant', collection: user_list, :locals => {:userid => @user_id, :controller => 'participants'}%>
  <!--E1721 changes End-->
</table>
 
 
</div>
 
<script>
    var participants = <%=@user_id%>;
    participants.forEach(function(participant){
        $('#'.concat(participant.toString())).change(function(){
            $('#button'.concat(participant.toString())).show();
        });
    });
</script>
</pre>
</pre>


Line 367: Line 287:
<b>Automated Testing</b>
<b>Automated Testing</b>


This would involve the controller and view testing to see if the instructor is added to the assignment as a participant through the add and list methods that are being invoked with the participant list showing instructor as the participant.
No automated test cases, only manual testing since the modifications are made to the view files


===References===
===References===


# [https://piazza.com/class/jl1cgvwxl0f1nl?cid=539 Video Link]
1. [https://www.youtube.com/watch?v=5LImhZ3F_RA&t=2s Demo Video Link]


# [https://github.com/expertiza/expertiza/pull/1323 pull request]
2. [https://github.com/expertiza/expertiza/pull/1323 Pull request]


==Issue #308 - Issue related to questionnaire weight==
==Issue #308 - Issue related to questionnaire weight==
Line 381: Line 301:
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%.
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===
===Implementation===


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.
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.
Line 442: Line 362:
<b>Automated Testing</b>
<b>Automated Testing</b>


This would mainly involve controller testing to see if the notice is set correctly when the ''update_assignment_questionnaires'' method is invoked with the sum of weights not being 0 or 100.
The following test was added to '''assignment_form_spec.rb''' to test if there is an error if the sum of weights of the rubrics do not add up to 0 or 100.
 
<pre>
    context 'when both save and update_attributes method do not work with wrong rubrics weights' do
        it 'changes @has_errors value to true and returns nil' do
          allow(assignment_questionnaire).to receive(:save).and_return(true)
          allow(assignment_questionnaire2).to receive(:update_attributes).with(assignment_questionnaire2).and_return(true)
          allow(assignment_questionnaire2).to receive(:[]).with(:questionnaire_weight).and_return(12)
          expect(assignment_form.update_assignment_questionnaires(attributes)).to eq(nil)
          expect(assignment_form.instance_variable_get(:@has_errors)).to be true
        end
      end
</pre>


===References===
===References===


# [https://piazza.com/class/jl1cgvwxl0f1nl?cid=539 Video Link]
1. [https://www.youtube.com/watch?v=3RKdJe1lxS0 Demo Video Link]


# [http://wiki.expertiza.ncsu.edu/index.php/Main_Page Pull Request]
2. [https://github.com/expertiza/expertiza/pull/1328 Pull Request]

Latest revision as of 20:43, 11 December 2018

Introduction

Assignment creation can be done in Expertiza by an instructor or a TA for a particular course. It is available from the Manage -> Assignments drop down on the expertiza site. Two types of assignments can be created - private and public. The various properties of assignments are grouped into tabs - General, Topics, Rubrics, Review strategy, Due dates and Other stuff. There were some issues related to the assignment creation. The main motive behind this project is to fix these issues and provide improved functionalities.

There are in all 5 issues that are being dealt within this project and each of them are explained in detail below.

Issue #1008 - Issue related to staggered deadline

Problem Statement

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.

Implementation

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: 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))) %>
                      <%= 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] %>
<% end %>

Test Plan

Manual Testing

  1. Log in to Expertiza with the credentials: instructor6/password (on google chrome)
  2. Go to the Manage -> Assignments.
  3. Click on New Public Assignment
  4. On the new assignment creation page, under the General tab, give details for Assignment name, Course (choose CSC 517, Spring 2016) and Submission directory.
  5. Check the Staggered deadline assignment? checkbox.
  6. Click on the Rubrics tab and give some values for Review and Author Feedback, if there are any other fields apart from these give values to that too.
  7. Click on Create at the bottom.
  8. Now, click on the the Topics tab and further click on New Topic.
  9. Give suitable values to the fields and click on Create.
  10. Click on the Due dates tab.
  11. Check the Use signup deadline checkbox and give suitable dates for Signup, Round1: Submission and Round1: Review.
  12. Go back to the Topics tab and click on Show start/due date at the bottom.
  13. Change the Submission deadline date to date later than the date given for Signup on the Due dates tab.
  14. Click on save at the bottom.
  15. Now, click on the Other stuff tab and and further click on Add participant. It will open in a new tab.
  16. Click on Copy participants from course. After it adds the participants, close the tab.
  17. Go to Manage -> Impersonate User.
  18. Give student6360 for the Enter user account field and click on Impersonate.
  19. Click on Assignments and further click on the assignment that was created in the earlier steps.
  20. Click on Signup Sheet.
  21. You should be able to see a green tick mark under the Actions header and should be able to click on it and signup, which means the issue is fixed.

Automated Testing

No automated test cases, only manual testing since the modifications are made to the view files.

References

1. Demo Video Link

2. Pull Request

Issue #1017 - Issue related to deleting assignment

Problem Statement

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 the instructor or by the TA , the delete option is assigned to self, that is, to the one who created the assignment. This needs to be overridden in that the instructor must be able to delete any assignment that shows up in the list without the need for matching the assignment Id with it's own and giving Instructor the ability to delete any assignment created by a TA.

Implementation

The flow diagram given below specifies the sequence of events that will aim at resolving the issue related to deleting an assignment :

The fix to resolve the issue involves the delete function in the assignment controller.

The code at present checks for the current user and allows it the permission to delete the file if it's id matches with the Id of assignment creator.

 if id != @assignment_form.assignment.instructor_id
   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."
 else
   @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."
 end

To allow instructor to delete an assignment created by TA, the if-else block is fixed as given:

 if @user.role.name == "Instructor" or (@user.role.name == "Teaching Assistant" and id == @assignment_form.assignment.instructor_id)
    # 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

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'.

Test Plan

Manual Testing

Task Description: Teaching Assistant creating an assignment

Precondition: The instructor has 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 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 that is created by the TA.
  3. If Logged in as Instructor, the assignment gets deleted for that action.
  4. Else, the current participant is shown the error message that they do not have authorization to execute the delete option if they did not create that assignment.


Automated Testing

The issue as such did not require modifying the controller spec file for assignments, since the changes were only made to the delete function and the test cases written check for the display of proper flash message that could be mapped for the modified code functionality. Only manual testing was performed to determine successful deletion by instructor.

References

1. Demo Video Link

2. Pull Request

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

Problem Statement

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.

Implementation

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

Test Plan

Manual Testing

  1. Log into Expertiza as instructor
  2. Access the Assignments listing
  3. Access an assignment and go to the 'Rubrics' tab to see if there are multiple rubrics defined
  4. Copy the assignment, if there are multiple rubrics, from the assignments listing screen
  5. Access the newly copied assignment
  6. Check if the rubrics tab lists down rubrics for all rounds in the original assignment

Automated Testing

This would reuse the existing automation tests.

References

1. Demo Video Link

2. Pull Request

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

Problem Statement

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.

Implementation

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.

The issue was not with the instructor been not able to get added as the participant but it was that the list was not getting updated after adding the participant and that was due to inconsistent referencing in the view and javascript file. the inconsistent version of both the file is shown as below

add.js.erb file

<% unless flash[:error] %>
$("#plist").append(
	"<%= j render :partial => 'participant', :locals => {participant: @participant, :userid => @participant.user_id, :controller => 'participants'} %>");
<% end %>
+$("#flash_message").html("<%= j render partial: "shared/flash_messages" %>");

_user_list.html.erb file


<table id="" class="table table-striped" style="font-size: 15px">
  

The changed versions are as follows:

add.js.erb file

<% unless flash[:error] %>
$("#user_list").append(
	"<%= j render :partial => 'participant', :locals => {participant: @participant, :userid => @participant.user_id, :controller => 'participants'} %>");
<% end %>
+$("#flash_message").html("<%= j render partial: "shared/flash_messages" %>");

_user_list.html.erb file

<table id="user_list" class="table table-striped" style="font-size: 15px"> # here the table id is changed to user_list

Test Plan

Manual Testing

  1. Log into Expertiza as instructor
  2. Create a new Assignment
  3. Click on the add participant button for the assignment created
  4. Modify the participant list by adding instructor as a participant
  5. Check the list to see the instructor added to the assignment as participant

Automated Testing

No automated test cases, only manual testing since the modifications are made to the view files

References

1. Demo Video Link

2. Pull request

Issue #308 - Issue related to questionnaire weight

Problem Statement

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%.

Implementation

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

Test Plan

Manual Testing

  1. Log into Expertiza as instructor
  2. Access the Assignments listing
  3. Access an assignment and go to the 'Rubrics' tab
  4. Modify the data in the rubric weights column in such a way that it adds up to a value other than 0 or 100
  5. Click save
  6. Check to see if there is an error thrown and the rubrics tab is not saved

Automated Testing

The following test was added to assignment_form_spec.rb to test if there is an error if the sum of weights of the rubrics do not add up to 0 or 100.

     context 'when both save and update_attributes method do not work with wrong rubrics weights' do
        it 'changes @has_errors value to true and returns nil' do
          allow(assignment_questionnaire).to receive(:save).and_return(true)
          allow(assignment_questionnaire2).to receive(:update_attributes).with(assignment_questionnaire2).and_return(true)
          allow(assignment_questionnaire2).to receive(:[]).with(:questionnaire_weight).and_return(12)
          expect(assignment_form.update_assignment_questionnaires(attributes)).to eq(nil)
          expect(assignment_form.instance_variable_get(:@has_errors)).to be true
        end
      end

References

1. Demo Video Link

2. Pull Request