CSC/ECE 517 Fall 2017/E1782 OSS Project Red Assignment Directories

From Expertiza_Wiki
Jump to navigation Jump to search

Introduction

Problem Statement

In Expertiza, students may submit links (which go into the Expertiza db) or files (which go into a directory in the Expertiza filespace).  A persistent problem in Expertiza has been that instructors have created multiple assignments that had the same submission directory.  In this case, the students’ submissions for one assignment went into the same directory as the submissions for another assignment, and reviewers who thought they were reviewing for one assignment were also presented with work submitted by a different student on another assignment.  The basic problem has been fixed, but there are some special cases that need to be addressed, and tests need to be written.


Issues to be fixed

Issue #391: When an assignment is created, there needs to be a check that the submission directory is not the same as the submission directory for any other assignment.  In Expertiza, the pathname for an assignment always has the instructor’s user-id (e.g., /efg) in the path, so it’s only necessary to check all assignments created by the current instructor to make sure that the specified directory path is not in use by another assignment.  Make sure that the check is made correctly even if it is a TA who creates the assignment. There is a method for setting path of the submission in assignment.rb.

Issue #404: When a previously created assignment is assigned to a course, any existing submissions need to be moved to a subdirectory of the course in the Expertiza filespace.  (In Expertiza, an assignment can be created without being assigned to any course, and can later be assigned to a course.)  Even the assigning the assignment to a course is implemented in assignment.rb


Modified Files

1) assignment_controller.rb

2) assignment.rb

3) assignment/new.html.erb


Approach taken to resolve the issues

Issue #391

-> When an instructor tries to create a new assignment with the storage directory similar to one of the other assignments or a sub-part of other pre-existing assignment the system would warn the instructor about this change and wouldn't save the assignment. -> The system once gets a create request compares the directory path to paths of all existing directories for similarity and sub-part check (sub part check is required because if not done a directory will have submission files of one assignment as well as a directory for some other assignment) and logs an error if similarity is found. -> If there errors they will be displayed in /assignment/new.html.erb

Pseudo Code:

   Added following logic in assignment.rb
   1) assignment_path (path user is trying to assign to new assignment)
   2) for each assignment in assignment_database
   3)    if assignment.directory_path includes assignment_path
   4)       add to errors "Directory is already assigned to some assignment"
   
   In assignment/new.html.erb
   1) Display error if any


Issue #404

When an instructor creates a new assignment, (s)he can do it without specifying the course to which assignment belongs. In this case, the directory path for the course is assigned as "<instructor_username>/path/mentioned/while/creating/" Eg. "instructor6/assignment4/Java/"

However when later s(he) assigns a course to the assignment, the assignment directory path should change to "<course_path>/>/path/mentioned/while/creating/" Eg. "CSC517/f17/assignment4/ruby"

Psuedo Code: Added the following logic in assignments_controller.rb update method

   1) assignment_path (old path where files are stored)
   2) assignment_new_path = course_path + assignment_path (As course assigned to an assignment it must be stored within the directory structure of that course)
   3) create directory assignment_new_path
   4) for each assignment_file in assignment_path
   5)      FileUtils.mv(assignment_file, assignment_new_path)
   6) assignment.save

How to Test

Link to ScreenCast Bug #391 : https://youtu.be/OVVknOBkG6Y

Link to ScreenCast Bug #404 : https://youtu.be/uvnamlY2wzg

Issue #391

Steps to test Issue #391:

1) Login as Instructor

2) Click on Manage , select assignments.

3) New public assignment/ New private assignment

4) Fill in the details and remember the directory path

5) Save

6) Create New assignment

7) Fill in the details and keep the directory path same as the one before.

8) You will see an error displayed on top of the page.


Issue #404

Steps to Test Issue #404:

1) Login as Instructor

2) Click on Manage , select assignments.

3) Find out an assignment which isn't assigned to a course.

4) Select assign to course badge

5) Select course from available radio button

6) Click Save

7) Now you will the updated path on assignment display list and instead of assign to course remove from course badge will be visible.

Automated tests for Issue #391 and #404

Following RSPEC Code is added to assignment_spec.rb:

1) To check if the directory storage path specified by the user is a part of any other submissions directory we check if the assignment.directory_path is a part of any existing directory path:

   1)describe 'check_directory_path' do:
   2)    it 'returns false if directory path already in use' do:
   3)        @assignment = create(:assignment)
   4)        expect(@assignment.check_directory_path).to eql(false)
   5)    end
   6)end


2) To check that an assignment object cannot be saved until a submission directory path is provided for that assignment:

1)it 'is not valid without directory_path' do
2)    assignment.directory_path = nil
3)    assignment.should_not be_valid
4)end

3) To check if after assigning course to an assignment is the directory path updated to contain the course path:

1)it 'should contain course in path name' do
2)    @assignment = create(:assignment)
3)    @assignment.directory_path = Course.first.directory_path.to_s + "/finaltest"
4)    expect(@assignment.directory_path).to include(Course.first.directory_path)
5)end