E1838 Project Red
Introduction
Problem Statement
In Expertiza, if the instructor doesn’t specify the assignment directory for a submission, the directory defaults to the home directory. This can lead to multiple assignment submissions being in the same place and creating confusion. The aim of the project if to handle all the scenarios that can arise when the instructor is not specifying any directory name.
Issues to be fixed
Issue #391: In Expertiza, if the instructor doesn’t specify the assignment directory for a submission, the directory defaults to the home directory. This can lead to multiple assignment submissions being in the same place and creating confusion. Please take a look at the Github issue for suggestions on how to solve this.
Issue #1190: An issue with conflicting directories for copied assignments was fixed. You need to write the test to verify that this issue doesn’t recur. This test should check that the assignment directories for copied assignments are distinct from the original directories.
Issue #1201: Expertiza has the feature to auto generate the directory names for submissions from the assignment name. However, this may be concerning if two assignments have the same name, in which case the submission folders would be the same and this would again create a problem. This needs to be fixed.
Modified Files
1) assignment_controller.rb
2) assignment.rb
3) assignment/new.html.erb
Approach taken to resolve the issues
Issue #391
-> When the instructor has not specified a directory path, there is no directory where the files can be stored. -> Hence we allow only links to be submitted in such an assignment. -> In the view of submitted content controller we disabled the button to upload files in such assignment where the directory path is null. -> We displayed the message 'Fie submissions are disabled' whenever anyone tries to upload files to such assignment.
Pseudo Code:
Added following logic in /app/views/submitted_content/_submitted_files.html.erb
<% if @assignment.directory_path != "" %> <% puts "Assign Directory: #{@assignment.directory_path}" %> <%= submit_tag 'Upload file', class: 'btn btn-default' %> <% else %> <%= 'File Submissions are disabled' %> <%end%>
Explanation: If the assignment directory path is specified by the instructor then the button to upload files will be displayed else the warning message 'File submissions are disabled will be displayed'.
Issue #1201
When an instructor creates a new assignment, (s)he can do it without specifying the directory to which assignment belongs. In this case since the directory is not specified, although the user will not be able to submit any files, he can submit links. Whenever the instructor would click on create assignment it would show an warning stating 'You have not mentioned directory path hence student would not be able to upload files'.
Added the following logic in assignments_controller.rb create method
1) Inserted a check that checks if the assignment directory path is null 2) If the path is null, raises a warning that the given path is null and only links can be submitted.
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
- To test the changes clone the following repository https://github.com/daxamin/expertiza .