CSC/ECE 517 Fall 2017/E1767 Improve imports
This page deals with issues picked up the project E1767 and the solutions developed. It is based on Expertiza, an open source project.
Introduction
A Note on Expertiza
Expertiza is an open source project created using Ruby on Rails. This project is an software primarily to create reusable learning objects through peer review and also supports team projects. Expertiza allows the creation of instructors and student accounts. This allows the instructors to post assignments (student learning objects) which can be viewed and worked upon by students. These can also be peer reviewed by students later. The Expertiza project is supported by the National Science Foundation. It supports many types of documents, including articles, code, web sites, URLs and wiki pages.
Motivation of this Project
Being an open source project, Expertiza is constantly improved. In particular, bugs are often found and resolved. Also new features are often added. The aim of this work is to rectify bugs around the import feature.
Background of this project
Expertiza being an online software to learn via peer reviews and team projects. Hence it has several types of users: instructors, students. The instructors are "administrative" in nature, they have many roles. Typically a course has 2 or 3 instructors and many students. This project is related to the import feature, which enables the instructor to do an adminstrative task for many students at once, like assigning a project.
As there are many students in the course database, adding several things (for each user) individually and manually will be cumbersome and time consuming. Hence another method involving importing things from a file has been developed. Several things, like all students from a class, or all teams for a particular project, or even all possible topics for students for a particular assignment/project can be imported from a file. The reason for doing this is that some lists, like the teams students have formed, may not be available online but rather on a sheet of paper the students have filled offline. In addition, a bug on passwords when importing users (like students) will also be looked into.
Project Requirements
Existing Project Functionality
In Expertiza, various kinds of data may be imported from .csv files, including users, participants in an assignment, topics, and teams. In particular, the file must be a text file and have the data separated by commas.
Problem Statement
- If no password is present in the password column in the CSV file for an user (while importing a list of users), Expertiza returns an error “each record in the file you are importing does not have enough records”. (Issue 183)
- There should be an option of importing teams (for a particular project/assignment) from an CSV file. (Issue 153)
- While importing teams, if one (existing) team has the same name as a team being imported, there should be an option of renaming the existing team (Issue 329)
- The User Interface for importing a course participant and an assignment participant should be similar
- The Interface for exporting the list of course participants and assignment participants should be similar (Issue 1079)
- If the file being imported does not have the required fields, the system prints "The import process expects the following columns:". However the required column names are not given (Issue 719)
- Currently the system does not have the feature of exporting review mappings (Issue 1081)
Setting Up The Working Environment
Working on this project requires us to set up an Expertiza environment. There are several options, such as setting up on Linux, or on a virtual environment or some more.
The one which is recommended and we adopted is:-
Install an image of Ubuntu having Expertiza set up on Virtual Box ( Ubuntu-Expertiza image (.OVA) )
The steps to do this are as follows:
- Download the image :This is the link for the image. (https://drive.google.com/a/ncsu.edu/file/d/0B2vDvVjH76uEUmNKVncxRUhUVVE/view?usp=sharing)
- Install VirtualBox and import the downloaded image into VirtualBox.
- Optional: Some machines/operating systems may require you to enable virtualization
- After this, run the following commands.
- cd expertiza
- bash ./setup.sh
- bundle install
- rake db:migrate
- For logging in as an instructor:-
- Username: instructor6
- Password: password
Understanding the Current Implementation
After studying the problem statement, we tested the existing Expertiza environment after careful examination it was determined that the following tasks were already implemented:
- Issue 719 : If topics are imported without correct data fields , the import page gives this message: “The import process expects the following columns:” but it doesn’t say what the columns are (topic number, topic name, category, number of slots, category)
- Issue dealing with blank final fields in data file, including Issue 183: It should be possible to leave off the final fields in a line of a CSV file. These fields are often not specified anyway. For example, if a password isn’t specified when a new user is created, the system generates a password (see Issue 183). When importing topics, topic categories are rarely specified. But if the final field is blank, the import requires the CSV line to end with “, “ (comma and space). This should be fixed for all imports.
Resolving Issues
Dealing with Issue 153 (Sign-up sheet)
Files changed
Import_file_controller.rb , models/sign_up_sheet.rb , views/sign_up_sheet/_add_topics.html.erb
Approach Used
This deals with the addition of a new feature, hence new code needs to be added.
In the existing code, we note that in the controller there was no model object to link the sign up sheet, as shown by following code fragement:
elsif params[:model] == 'SignUpTopic'
In the modified code, it is replaced by :
elsif params[:model] == 'SignUpTopic' || params[:model] == 'SignUpSheet'
Also the model code shown below is added
Original Functionality
Currently, we cannot import teams from a file. Teams have to be created individually, (by the instructor or a student)
Solution
The solution dealt with adding the feature. This involved adding a method in the model which is showed in the following code fragment:
The other changes are to add the method to an appropriate place in the views and the controller.
Dealing with Issue 329 (Rename Existing Team)
Files changed
models/team.rb , views/import_file/_start.html.erb
Approach
We note that we have to make an change to an existing function. To be more specific, there is a function self.handle_duplicate with several parameters to handle cases in which a new team name is the same as an existing team name. In this function, thus we added a new case to rename the existing team. It is shown in the code fragement below.
Original Functionality
While importing teams from a file, if a new team name is an exact match with an existing team, then the options for managing the conflict is either ignore (and not add) the new team, or to add the new team with a new name or to delete the old team and to add the new team in it's place.
Solution
The solution dealt with adding the feature. This involved adding a method in the model which is showed in the following code fragment:
Also, neccessary changes are made to the view.
Import User Interface Fix
Solution
When importing assignment participants and course participants, the User Interface indicates that there are multiple fields expected. However, in fact, user can only import file with 1 column which is user names. We can expect that the imported users are already in the system (otherwise, there should be an error message). Fixing the User Interface and also the code of importation accordingly.
For the feature Improve Import Functionalities and Some Export Functionalities, we have added a couple of RSpec tests, as follows:
Code Fragement showing test for signup sheet
Code Fragement showing change for one more test
Dealing with Issue 1079: Export Enhancement
Files changed
app/models/assignment_participant.rb, app/models/course_participant.rb, app/models/participant.rb, app/views/export_file/start.html.erb
Original Functionality
Exporting Course Participants and Assignment Participants neither share the same User Interface nor the same code. Assignment Participants used the common User Interface designed for export functionality. Due to this, the export feature of Assignment Participants return blank file.
Approach
We decided to use a common user interface everywhere. This involves removing the methods self.export and self.export_fields from both files app/models/assignment_participant.rb and app/models/course_participant.rb. New code is added as below so to ensure that the feature is not lost.
Solution
Course Participants and Assignment Participants have same User Interface for Export feature as shown in the below image. Course Participants and Assignment Participants are derived from base class named Participants, the export feature can be generalized for both of them by moving it to Participants, which removed redundancy from the code base.
Export methods added to participants.rb
Dealing with Issue 1081: Export Review Mapping Functionality
Files changed
app/views/export_file/_reviewer_mapping.html.erb, app/views/export_file/start.html.erb
Original Functionality
We have the feature to import review mappings, but we simply do not have the feature to export the review mappings.
Approach
Created a partial render for Review Response Map. Add the feature of exporting review mapping and making sure it exports in the same format as importations. The changes in the 2 view files are as below:
Diagram: Changes in the _review_mapping.html.erb file
Diagram: Changes in the _start.html.erb file
Test Plan
Issue 329
Manual Test
- Login as instructor
- In the interface which comes up, on the top menu click Manage and then select Courses.
- Scroll down to the course you want to add a new team
- In the right hand side of the screen, corresponding to the course, select the button "Create Teams"
- In the screen which comes up note the name of any one team. Note the names of the users of this team. (The team must have users)
- Create a text file with one line like this
team_name, user1, user2, user3
Note that team name must be similar to an existing team name. Also user1, user2 and user3 should not be the same as above.
- On the lower left of the screen, click the option "Import team"
- Keep Delimiter as comma, and select option "Rename existing team", and import using the file you made
- Now note a new team is added. The new team (with the users as in the import file) will have the desired name, but the team (formerly with the name) will have a new name.
Screenshots
Edge/Test Cases
- In the case a new team is proposed without valid user names (or without any user names): The team should form, but there should be an appropriate warning message (No such user exists)
User Interface
Manual Test
- Login as instructor
- In the interface which comes up, on the top menu click Manage and then select Assignments
- Scroll to the bottom of the screen, and select the option Import assignment participants.
- In a text file create one line like:
user_name, User_First_Name User_Last_name, user_email
- Import the file
- Even without password, the user is imported
Screenshots
Fragment if a user with incomplete details is tried to be imported
Fragement after the issue was solved
Issue About Export Mappings
Manual Test
- Login as instructor
- In the interface which comes up, on the top menu click Manage and then select Assignments
- Scroll to the assignment you want to check, then click Add Reviewer
- Scroll to the bottom of the screen, and click the "Export Reviewer mappings"
Screenshots
Issue: Uniform Export Interface
Manual Test
- Login as instructor
- In the interface which comes up, on the top menu click Manage and then select Assignments
- Scroll down to the assignment of interest and click "Add participant"
- Scroll down to the end and click Export Assignment Participants
- Note the export interface
- In the interface which comes up, on the top menu click Manage and then select Courses
- Scroll down to the course of interest and click "Add participant"
- Scroll down to the end and click Export Course Participants
- Note the export interface
Screenshots
Team Contact
- MEMBERS
- Arjun Sharma: asharm33@ncsu.edu
- Bikram Singh: bsingh8@ncsu.edu
- MENTOR
- Yifan Guo: yguo14@ncsu.edu