CSC/ECE 517 Fall 2019 - E1976. Issues Related to Assignment Creation: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
Line 3: Line 3:
This page is a description of Expertiza OSS project E.1976 Issues Related to Assignment Creation.
This page is a description of Expertiza OSS project E.1976 Issues Related to Assignment Creation.
Project Github pull request: https://github.com/expertiza/expertiza/pull/1613
Project Github pull request: https://github.com/expertiza/expertiza/pull/1613
Github links about this project: https://github.com/Tian97/expertiza
Github links about this project: https://github.com/Tian97/expertiza
Video Presentations:
Video Presentations:



Revision as of 02:53, 7 December 2019

E1976. Issues Related to Assignment Creation

This page is a description of Expertiza OSS project E.1976 Issues Related to Assignment Creation. Project Github pull request: https://github.com/expertiza/expertiza/pull/1613

Github links about this project: https://github.com/Tian97/expertiza

Video Presentations:

Problem Statement

For this project E1976, like the OSS project, we have three issues that need to be fixed in the expertiza. Firstly, a TA can unassign an assignment from the course which he don't belong to, and when TA does this, the other TA may lose access to the assignment, so they can't fix it. The second issue is, Sometimes, when an instructor creates an assignment and hits “Save” without completely filling out the form, (s)he ends up editing a different assignment. And the third problem is On an instructor's/admin's/TA's homepage, in the assignment list, there are three rows of icons for performing several operations. But right now an instructor is not able to choose whether to see these actions on the homepage or on a tab associated with each assignment.

Proposed Solutions

Issue #1430 - Shouldn't be able to move an assignment. to a course you don't have access to.

Proposed solution: We want to make sure that the TA can't access other assignments except the assignment which he assigned to this courses And we should then check if he is not in this course, he will not grant the right to unassign assignments.

issue #1384 - Instructor should be able to choose where to see assignment actions

Proposed solution: An instructor should be able to choose whether to see these actions on the homepage or on a tab associated with each assignment. So there should be a setting in the instructor’s Profile that controls these actions.

Issue #1354 - Creating one assignment, I was dropped into another assignment!

Proposed solution: The problem can be because there are two assignments with the same name.so it would lead to the old assignment when it is created, the system will sort all the lists of assignment names, then find the past duplicate name assignment, resulting in ends up editing a different assignment

Implementation

Design Strategy

issue #1430

During changing the assignment, first we ask which course an assignment is a part of, and then list only those courses that the instructor or TA has access to. So the TA and the instructor can only deal with the courses they related to, but not the irrelevant courses.

issue #1384

The instructor could edit the course settings, and in "other stuff" the instructor could change the action icons to show whether these actions on the homepage or on a tab associated with each assignment. So in our cases we need to create a boolean attribute to control the action icons.


issue #1354

While the instructor creates the assignments having the same name with a created assignment, It was dropped into another assignment. In this problem, we need to set a double check while creating the assignments, if the name of the assignment has been used. That will fix the bug and also easy for the students to read.

Use Cases

issue#1430

Actual Results

Issue#1430

Log in as instructor6, create a course named "new course", add student34, student35 as TA in this course.

Assign an assignment named "new assignment" to "new course".

Log out, log in as student34, TA can view assignment named "new assignment" in the course named "new course".

Since student34 only been add as TA in "new course", when he/she edits the assignment, he/she can only view the course named "new course". Old version the TA can view all courses and the None option "-----------" (view in issue statement), now edit assignment only the instructor can view all courses and None option "-----------".
TA edit

Instructor edit

Issue#1384

Login as instructor6, click "profile" button, choose not enable Actions options in homepage

we have created a box named "Action options" in profile, only instructor can see this box.

go to the assignment page

Now instructor can only view few actions which are not included in original "other stuff" interface. (we rename "other stuff" to "Etc. ... as issue required)

enable the "Action options"

go to the assignment page

Now instructor can view all actions.

Issue#1354

Test Plan

issue#1384
  1. Login as an instructor
  2. Edit the course settings of other stuff
  3. Recording a video to show how the homepage change
issue#1430
  1. Login as TA
  2. Find out whether TA can view all assignment (this part our mentor need to discuss with the professor to clarify)
  3. Try to remove assignment which is not included in TA course
  4. Login as an instructor
  5. Try to remove the assignment
issue#1354

We have already reproduced this "same name" issue successfully.

  1. Create two assignments but choose a different course.
  2. First one's course is fall 2017, the second one's we choose fall 2016.
  3. Hit the "save" button of the second assignment, it will automatically show the page of the first assignment of course fall 2017.
  4. Add tests in files list below, and pass all tests.

File which are added/modified

issue#1430

fixed the issue relate with issue#1430

app/helpers/assignment_helper.rb

      # courses << Course.where(instructor_id: instructor.id)
      # courses.flatten!
      ta_ids = []
      ta_ids << Instructor.get_my_tas(session[:user].id)
      ta_ids.flatten!
      ta_ids.each do |ta_id|
        ta = Ta.find(ta_id)
        ta.ta_mappings.each {|mapping| courses << Course.find(mapping.course_id) }
      end
      options = []
      courses.each do |course|
        options << [course.name, course.id]
      end
      options.uniq.sort
    # Administrator and Super-Administrator can see all courses
    elsif session[:user].role.name == 'Administrator' or session[:user].role.name == 'Super-Administrator'
      courses = Course.all
      set_courses_options(courses)
    elsif session[:user].role.name == 'Instructor'
      courses = Course.where(instructor_id: instructor.id)
      # instructor can see courses his/her TAs created
@@ -20,13 +33,17 @@ def course_options(instructor)
        ta = Ta.find(ta_id)
        ta.ta_mappings.each {|mapping| courses << Course.find(mapping.course_id) }
      end
      set_courses_options(courses)
    end
  end

  def set_courses_options(courses)
      options = []
      options << ['-----------', nil]
      courses.each do |course|
      options << [course.name, course.id]
      end
      options.uniq.sort
  end
add comments for the code related with issue expertiza#1430

@@ -5,11 +5,11 @@ def course_options(instructor)
      ta = Ta.find(session[:user].id)
      ta.ta_mappings.each {|mapping| courses << Course.find(mapping.course_id) }
      # If a TA created some courses before, s/he can still add new assignments to these courses.
      # courses << Course.where(instructor_id: instructor.id)
      # courses.flatten!
      # E1976 issue #1430 the TA should not access a course s/he is not belong to.
      ta_ids = []
      ta_ids << Instructor.get_my_tas(session[:user].id)
      ta_ids.flatten!
      # find the TA and course mapping, add course which the TA assigned to to the course list.
      ta_ids.each do |ta_id|
        ta = Ta.find(ta_id)
        ta.ta_mappings.each {|mapping| courses << Course.find(mapping.course_id) }
@@ -36,9 +36,10 @@ def course_options(instructor)
      set_courses_options(courses)
    end
  end

  # E1976 set the courses option for creating an assignment.
  def set_courses_options(courses)
      options = []
      # the options can be nil which meaning the assignment can belong to no class.
      options << ['-----------', nil]
      courses.each do |course|
      options << [course.name, course.id]

issue#1384

app/views/assignments/edit.html.erb

 @@ -16,7 +16,7 @@
          <li><a href="#tabs-7" id="Badges">Badges</a></li>
        <% end %>

        <!--issue#1384, "other stuff" tab should be renamed to “Etc. …”-->
        <li><a href="#tabs-8" id="Other">Etc. …</a></li>
app/controllers/profile_controller.rb

 @@ -50,6 +50,7 @@ def user_params
                                 :timezonepref,
                                 :public_key,
                                 :copy_of_emails,
                                 :institution_id,
                                 :action_enable)
        end
    end
app/controllers/users_controller.rb

@@ -292,7 +292,8 @@ def user_params
                                 :timezonepref,
                                 :public_key,
                                 :copy_of_emails,
                                 :institution_id,
                                 :action_enable)
    end
app/helpers/import_file_helper.rb 

@@ -11,6 +11,7 @@ def self.define_attributes(row_hash)
    attributes["email_on_submission"] = 1
    attributes["email_on_review"] = 1
    attributes["email_on_review_of_review"] = 1
    attributes["action_enable"] = 1
    attributes
 end
app/helpers/participants_helper.rb

@@ -22,6 +22,7 @@ def self.define_attributes(line_split, config)
    attributes["email_on_submission"] = 1
    attributes["email_on_review"] = 1
    attributes["email_on_review_of_review"] = 1
    attributes["action_enable"] = 1
    attributes
  end
app/models/participant.rb

@@ -136,6 +136,7 @@ def self.export(csv, parent_id, options)
      tcsv.push(user.role.name) if options["role"] == "true"
      tcsv.push(user.parent.name) if options["parent"] == "true"
      tcsv.push(user.email_on_submission, user.email_on_review, user.email_on_review_of_review) if options["email_options"] == "true"
      tcsv.push(user.action_enable) if options["action_enable"] == "true"
      tcsv.push(part.handle) if options["handle"] == "true"
      csv << tcsv
    end
</bre>

<pre>
app/models/user.rb

@@ -231,6 +231,7 @@ def initialize(attributes = nil)
    @email_on_submission = true
    @email_on_review_of_review = true
    @copy_of_emails = false
    @action_enable = true
  end

  def self.export(csv, _parent_id, options)
@@ -241,6 +242,7 @@ def self.export(csv, _parent_id, options)
      tcsv.push(user.role.name) if options["role"] == "true"
      tcsv.push(user.parent.name) if options["parent"] == "true"
      tcsv.push(user.email_on_submission, user.email_on_review, user.email_on_review_of_review, user.copy_of_emails) if options["email_options"] == "true"
      tcsv.push(user.action_enable) if options["action_enable"] == "true"
      tcsv.push(user.handle) if options["handle"] == "true"
      csv << tcsv
    end
app/views/profile/edit.html.erb

@@ -10,6 +10,7 @@
  <%= render :partial => 'users/email' %>
  <%= render :partial => 'users/institutions' %>
  <%= render :partial => 'users/prefs' %>
  <%= render :partial => 'users/actions' %>
  <%= render :partial => 'handle' %>
  <% if @user.role.parent_id != nil %>
    <%= render :partial => 'limit' %>
app/views/users/_actions.html.erb 

@@ -0,0 +1,18 @@
<% request_user ||= false %>
<%if !request_user%>
  <div>
<!-- E1976   add action enable at instructor profile page-->
    <table class="table borderless">
      <% if @user.role_id == 2 %>
        <tr>
          <th align='left'>Action options</th>
        <tr>
          <td>Check the boxes representing that whether to see assignment actions on the homepage or on a tab associated with each assignment.
        <tr>
          <td><label for="action_enables">I want to view the assignment <strong>Actions</strong> on homepage</label></td>
          <td><%= check_box 'user', 'action_enable'%></td>
        </tr>
      <% end %>
    </table>
  </div>
<% end %> 
db/migrate/20191117015928_add_actions_enable_to_users.rb

@@ -0,0 +1,5 @@
class AddActionsEnableToUsers < ActiveRecord::Migration
  def change
    add_column :users, :action_enable, :boolean, default: true
  end
end
spec/controllers/users_controller_spec.rb

@@ -163,7 +163,8 @@
               timezonepref: 'Eastern Time (US & Canada)',
               public_key: nil,
               copy_of_emails: nil,
               institution_id: 1,
               action_enable: nil}
      }
      post :create, params, session
      allow_any_instance_of(User).to receive(:undo_link).with('The user "chenzy@gmail.com" has been successfully created. ').and_return(true)
@@ -193,7 +194,8 @@
               timezonepref: 'Eastern Time (US & Canada)',
               public_key: nil,
               copy_of_emails: nil,
               institution_id: 1,
               action_enable: nil}
      }

@@ -224,7 +226,8 @@
               timezonepref: 'Eastern Time (US & Canada)',
               public_key: nil,
               copy_of_emails: nil,
               institution_id: 1,
               action_enable: nil}
      }

spec/factories/factories.rb

@@ -53,6 +53,7 @@
    timezonepref nil
    public_key nil
    copy_of_emails  false
    action_enable true
  end

  factory :superadmin, class: User do
@@ -75,6 +76,7 @@
    timezonepref nil
    public_key nil
    copy_of_emails  false
    action_enable true
  end

  factory :student, class: User do
@@ -98,6 +100,7 @@
    timezonepref 'Eastern Time (US & Canada)'
    public_key nil
    copy_of_emails false
    action_enable true
  end

  factory :instructor, class: Instructor do
@@ -120,6 +123,7 @@
    timezonepref 'Eastern Time (US & Canada)'
    public_key nil
    copy_of_emails false
    action_enable true
  end

  factory :teaching_assistant, class: Ta do
@@ -142,6 +146,7 @@
    timezonepref 'Eastern Time (US & Canada)'
    public_key nil
    copy_of_emails  false
    action_enable true
  end

spec/models/user_spec.rb

@@ -1,7 +1,7 @@
describe User do
  let(:user) do
    User.new name: 'abc', fullname: 'abc xyz', email: 'abcxyz@gmail.com', password: '12345678', password_confirmation: '12345678',
             email_on_submission: 1, email_on_review: 1, email_on_review_of_review: 0, copy_of_emails: 1, handle: 'handle', action_enable: 1
  end
  let(:user1) { User.new name: 'abc', fullname: 'abc bbc', email: 'abcbbc@gmail.com', password: '123456789', password_confirmation: '123456789' }
  let(:user2) { User.new name: 'abc', fullname: 'abc bbc', email: 'abcbbe@gmail.com', password: '123456789', password_confirmation: '123456789' }

The following issues were fixed in a project last year, but they still lack tests.

issue#1008

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.
issue#1017

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 a check for the display of proper flash messages that could be mapped for the modified code functionality. Only manual testing was performed to determine ssuccessful deletion by instructor.

issue#1072

Manual Testing

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

Automated Testing

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


References

  1. Expertiza on Github
  2. GitHub Project Repository Fork
  3. Pull Request Link
  4. E1863_Issues_related_to_assignment_creation#Test_Plan