CSC/ECE 517 Fall 2019 - E1959. Intelligent copying of assignments without topics: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
Line 96: Line 96:
We have created a new web page that is triggered on clicking the copy icon for the assignment. The view page is the checktopicscopy.html.erb under the views/assignments folder.
We have created a new web page that is triggered on clicking the copy icon for the assignment. The view page is the checktopicscopy.html.erb under the views/assignments folder.


The code modifications and their coverage have been covered in a below section.
The code modifications and their coverage have been covered in the following section.


== '''Testing (Test Plan)''' ==
== '''Testing (Test Plan)''' ==

Revision as of 16:43, 5 November 2019

Wiki Page Description

This wiki page describes about the E1959. Intelligent copying of assignments without topics (Issue #1341). We will explain about the issue and also the steps to resolve the issue.

Introduction

Expertiza is an open source web application project developed using Ruby on Rails framework. Let us list some of the functionalities that Expertiza allows us to do under different roles:

As an Instructor:

We can create new assignments, edit the existing assignments, copy the assignments and also delete the assignment. The instructor can also add participants, reviewers to a particular assignment.

As a Student:

They can form teams to work on various projects and also bid for the projects they would like to work on. They can also review other student's work and can give feedback on them. They can also submit various types of documents including the URLs and wiki pages for their project or assignment submission.

Design Pattern

Design patterns are not applicable as our task involved just modification of existing methods.

Problem Statement

Background

When an instructor or a TA logs in to expertiza, s(he) can see a list of assignments under the assignment tab. An instructor or a TA can copy an assignment to use the same event in another course or as another assignment. When the user copies the assignment, the assignment is being copied without providing required flexibility to the users. Majorly, we are focused on implementing two features that shall add flexibility to the copy functionality.

Issues

Issue 1: While copying an assignment, the user (instructor or TA) is not asked whether they wants to copy the topics along with the assignment or not. Currently, it is copying the topics, without providing any choice for user to not have the topics.

Issue 2: While copying an assignment, the teams/students assigned to each topic are not getting copied. The user might want to copy the teams/students mapped to the topics as well.

Steps to generate the issue <Existing system, without our implementation> <Requires Instructor credentials>

1) Login to expertiza.ncsu.edu using instructor credentials.

2) Navigate to Assignments section. (Hover on Manage Tab -> Click on Assignments)

3) Copy the assignment of your choice by clicking copy icon located on the right side the specific assignment.

Above steps copy the assignment. Remember that this process did not give you the flexibility of choosing whether to copy/not copy.

1) Topics linked to assignment.

2) Students/Teams linked to each topic.

Present system copies the topics but doesn't copy the students, even if you don't want it this way. Our implementation is to provide the user with the functionality to choose to copy/not copy topics linked to an assignment and students/teams linked to each topic.

Testing our work

By following the below stated process, you can test the implementation that we worked on, which is: Target 1: Provide the user with the option to select copy/not copy topics linked to an assignment. Target 2: Provide the user with the option to select copy/not copy students/teams linked to a topic.

Step 1: Visit http://152.46.17.204:8080/ . Enter the credentials:
Username: instructor6
Password: password

Step 2: On the top, hover on Manage tab. Click Assignments.

Step 3: Choose an assignment that you want to copy. We would recommend you choosing a robust assignment that has Topics and students/teams associated with topics. OSS Projects generally have these. [Please make sure that you are under the Assignments tab or select the assignment besides the course]

If you want to check and see if an assignment has topics or not, click on Edit (pencil icon) on the right. - If this assignment has topics, you will see a tab named Topics on the right of General tab. If there are no topics, you won't see Topics tab. - On clicking the Topics tab, you can see the list of topics. If students/teams are assigned to topics, you will see student names (alias representations, like student1234 student2343) under each Topic name in 'Topic name(s) column'. If you don't see any such, it means that teams/students are not assigned to topics.

Step 4: After you chose the assignment that you want to copy, click on the copy icon on the right of the corresponding assignment.

Where is the copy button located? Check the image below.


Step 5: Clicking the copy button will take you to copy options page, where you can select the options for copying. The page looks like this:


Step 6: Choose the option you wish to test. Click create. Now the assignment shall be copied with the options you provided.


Step 7: After copying, the application takes you to 'Edit' page for the assignment where you can edit/view the details pertaining to the assignment. Here, you can test our implementation. In step 6, if you chose to

- copy without topics: You won't see 'Topics' tab near General tab.

- copy with topics: You will see 'Topics' tab near General tab(As shown in image below). Navigate to Topics tab where you can see and check that the respective topics have been copied. You won't see students under each topic in 'Topic Name(s)' column(If there are topics under Topics tab in original assignment from which you created this copy).

- copy with topics and students: You will see 'Topics' tab near General tab(As shown in image below). Navigate to Topics tab where you can see and check that the respective topics have been copied. You will see students under each topic in 'Topic Name(s)' column(If there are topics and students under Topics tab in original assignment from which you created this copy).

Step 8: Please rename the assignment to some random string of your choice. Having it as 'Copy of'.. is creating issues of duplicate names when creating a new copy (more details in the section below, named 'Our Recommendation for a separate issue'. Not required for students). If not changed, the next tester might face difficulty while testing(which we don't want to see happening :)).

Step 9: This completes the testing. Reiterate from step 2, if you wish to test again.

Code Modification

We have modified 5 files and mainly we have modified code in two classes they are:

  1. apps/controllers/assignments_controller.rb and
  2. apps/models/assignment_form.rb.

We have created a new web page that is triggered on clicking the copy icon for the assignment. The view page is the checktopicscopy.html.erb under the views/assignments folder.

The code modifications and their coverage have been covered in the following section.

Testing (Test Plan)

Automated Testing using RSpec

We have made changes to the test cases and both the models/assignment_form.rb and also the controllers/assignments_controller.rb have passed all the test cases. The overall coverage has increased. See detailed report below.

1. models/assignment_form.rb
In this file the coverage has increased from 61.39% to 85.65% after modification.

Original file:

Modified file:

In the modified file the following code has been added,

def self.copy(assignment_id, copyoption, user) #Line 313 in the original file has been modified.
if copyoption != 'copyWithoutTopics' #Line 330 in modified file.
  topics = SignUpTopic.where(assignment_id: old_assign.id)
  topics.each do |topic|
    new_sign_up_topic = SignUpTopic.create(
	  topic_name: topic.topic_name,
	  assignment_id: new_assign_id,
	  max_choosers: topic.max_choosers,
	  category: topic.category,
	  topic_identifier: topic.topic_identifier,
	  micropayment: topic.micropayment
    )

  if copyoption == 'copyWithTopicsTeams'
	old_signed_up_teams = SignedUpTeam.where(topic_id: topic.id)
	old_signed_up_teams.each do |old_signed_up_team|
	  new_signed_up_team = old_signed_up_team.dup
	  new_signed_up_team.update_attribute('topic_id', new_sign_up_topic.id)
	  new_signed_up_team.save
	end
  end
end



2. controllers/assignments_controller.rb
In this file the coverage has increased from 88.66% to 88.8% after modification.

Original file:

Modified file:

In the modified file the following code has been added,

def checktopicscopy
    @assignment_id = params[:id]
end
new_assign_id = AssignmentForm.copy(params[:id], params[:copyoption], @user) #Line 115 in original file has been updated to Line 119 in modified file.

Manual Testing from UI (For Reviewers)

1) Please log in using the instructor credentials they are: Username: instructor6 Password: password

2) Then select the assignment tab under manage.

3) The assignment page opens and then select the copy button of the desired assignment. [NOTE: Before copying see that the assignment already has the topics or not by selecting the edit icon of the assignment]

4) If that particular assignment does not have the topics, choose another assignment which has topics to test our functionality.

5) On clicking the copy icon you will be redirected to the web page which has options, select one of the desired options and select the create button.

5) On clicking the Create button you will be redirected to the edit page of the newly created assignment. In the edit page if the topics tab appears it means that the topics are copied and you can check whether the students under the topics are copied or not. [NOTE: if the topics tab is absent beside the General Tab it indicates that the topics are not copied with assignment]

6) Check the new assignment based on the choice you selected while creating a copy of an assignment.

Our Work

The code we created can be found below. We have also linked the video of our tests running with coverage to showcase the work we have done.

Our Recommendation for a Separate Issue (For Instructors only)

In the current system, we identified an issue and would like to bring it to your notice.

Existing System

When a user attempts to copy an assignment, the code creates a duplicate ‘assignment’ object, renames it as ‘copy of’ + <name of existing assignment>, saves the object and redirects to the ‘edit’ page where user is supposed to rename the assignment to something meaningful.

Issue

The current naming scheme as ‘copy of’ + <name of existing assignment> is creating an issue. Say you are creating a copy for some assignment named ‘OSS Project’, the copy object will be named as ‘copy of OSS Project’, saved and redirected to edit page. Had there been an existing assignment names ‘copy of OSS Project’ (which is likely), the copy attempt shall fail, putting a flash message on the screen like:

The assignment was not able to be copied. Please check the original assignment for missing information.

The above error message is in no relevance to the real reason for the error. Even though the save attempt failed, a copy is being inserted into the assignments table in the database.

Proposed Recommendation

Current naming scheme must be changed to have randomness. The name of the assignment can be given a random string, or a string like ‘copy of ’ + <name of existing assignment> + <5 digit random code>.

The user is anyway supposed to edit the information in the edit page (where the application is redirected after copying is successful). So, here, he can change the name to have some meaningful string.

Team Information

  1. Sai Vishnu Muvvala (smuvval)
  2. Rohan Pillai (rspillai)
  3. Subha Sekhar Reddy Pereddy (speredd)

Mentor: Yashad Trivedi

References

  1. Expertiza on GitHub