<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.expertiza.ncsu.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Nmchoks2</id>
	<title>Expertiza_Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.expertiza.ncsu.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Nmchoks2"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Nmchoks2"/>
	<updated>2026-06-06T03:15:28Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1987._Improving_search_facility_in_Expertiza&amp;diff=131222</id>
		<title>CSC/ECE 517 Fall 2019 - E1987. Improving search facility in Expertiza</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1987._Improving_search_facility_in_Expertiza&amp;diff=131222"/>
		<updated>2019-12-11T18:59:20Z</updated>

		<summary type="html">&lt;p&gt;Nmchoks2: /* Additional Links: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= E1987 - Improving search facility in Expertiza=&lt;br /&gt;
==Introduction:==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source application running on Ruby on Rails. It is used for management of courses and the assignments for respective courses, by the faculties and the students. The manage content section of the application has different views which displays information about the users, courses, assignments, questionnaires, and reviews. The application should have a fully functional search functionality throughout the views, so that a user can search any type of data with ease, on the basis of any number of parameters depending on his requirements. Users should be searched on the basis of one more parameters which include name, full name, email, etc. Similarly, assignments should be searched on the basis of name, created date, updated date, etc. However, the search functionality in the existing application is constrained to just a single parameter for users and assignments. Questionnaires management does not have a search functionality implemented as yet. This project works on improving the search functionality of Expertiza, by adding search bars if not present, introducing advanced search feature where user can search on the basis of more than one parameters and making the search functionality appear more elegant.&lt;br /&gt;
&lt;br /&gt;
==Problem Definition:==&lt;br /&gt;
&lt;br /&gt;
#An instructor or administrator can search for a user by name, user-ID, or other characteristics.&lt;br /&gt;
#An instructor should be able to search for assignments by name, due date, or other characteristics.&lt;br /&gt;
#An instructor should be able to search for rubrics (or other questionnaires) by name, or by the courses or assignments they have been used in.&lt;br /&gt;
##For the instructor, there also needs to be a way to quickly find rubrics (and other questionnaires) that have been used in a single course.  It should be possible to search or click somewhere to bring up a list of questionnaires used in the course, expanding only the applicable questionnaires in the list of questionnaires.&lt;br /&gt;
##One should also be able to search for questionnaires by words used in questions that belong to the questionnaires.&lt;br /&gt;
#There should be a way to search all reviews of a particular team’s work for particular scores or text strings.  Reviews should be able to be filtered by score, text comment length, reviewer and reviewee.&lt;br /&gt;
#An instructor or administrator should be able to search for all the assignments that a particular user has participated in.&lt;br /&gt;
#If more than one criteria needs to be specified, there should be an 'Advanced Search' button.&lt;br /&gt;
&lt;br /&gt;
==Proposed Solution:==&lt;br /&gt;
===Search for User:===&lt;br /&gt;
&lt;br /&gt;
In the current system workflow, we found that the user is unable to search in the Manage Users view. In the proposed workflow, we plan to enable the user to search by all the columns in the UI viz. Name, Full name, Email Address, Role, Parent by entering a partial or a complete text that matches with the particular field. We will also allow searching for fields irrespective of the case of the searched string. The user will be able to apply multiple filters at a time and the output of the query will match all filters applied. If no results are found, an empty list will be returned.&lt;br /&gt;
&lt;br /&gt;
Steps to reproduce the proposed workflow:&lt;br /&gt;
:#Log in to expertiza to view the home page&lt;br /&gt;
:#Go to Manage &amp;gt; Users&lt;br /&gt;
:#Type the search string in the search box available on the UI and select the column to search for from the dropdown.&lt;br /&gt;
:#To perform search based on multiple filters, the user can tap on the Advanced Search button adjacent to the Search button, the view renders a hidden div containing textboxes for all the columns, allowing the user to search based on multiple columns.&lt;br /&gt;
:#All the entries that match the specified criteria will be returned.&lt;br /&gt;
:#An empty list is returned if the search criteria doesn't match any valid records in the database.&lt;br /&gt;
&lt;br /&gt;
===Search for Assignments:===&lt;br /&gt;
&lt;br /&gt;
In the current system implementation, searching via the name of the assignment is supported with partial or complete assignment name. However, the search is case sensitive. In the proposed system, the user will be able to search for an assignment using additional filters such as Creation Date and Updated Date along with Assignment Name. The user will also be able to apply multiple filters at a time and the output of the query will match all filters applied. If no results are found, an empty list will be returned.&lt;br /&gt;
&lt;br /&gt;
To search for an assignment by Creation Date, the user will be prompted with a calendar where he can select a date and all the assignments created on or before the selected date will be displayed. &lt;br /&gt;
&lt;br /&gt;
To apply multiple filters, user can tap on the Advanced Search button available, adjacent to the Search button; a hidden div will then be rendered below containing textboxes for all the columns. All assignments that were created before the selected date for Creation Date or Updated Date columns and the ones that match other filters will be returned. A empty list will be returned if the search criteria doesn't match any records in the database.&lt;br /&gt;
&lt;br /&gt;
Steps to reproduce the proposed workflow:&lt;br /&gt;
:#Log in to expertiza to view the home page&lt;br /&gt;
:#Go to Manage &amp;gt; Assignments&lt;br /&gt;
:#Type the search criteria in the available search criteria and select the appropriate field from the dropdown.&lt;br /&gt;
:#To perform search based on multiple filters, the user can tap on the Advanced Search button adjacent to the Search button, the view renders a hidden div containing textboxes for all the columns, allowing the user to search based on multiple columns.&lt;br /&gt;
:#All the entries that match the given criteria will be returned.&lt;br /&gt;
:#An empty list is returned if the search criteria doesn't match any valid records in the database.&lt;br /&gt;
&lt;br /&gt;
===Search for Questionnaires:===&lt;br /&gt;
&lt;br /&gt;
The existing system does not have a search functionality under Questionnaires. The proposed system will implement a search functionality for searching via the name of the questionnaire, the text in the questions within a questionnaire, date of creation, and date updated by entering a partial or a complete text that matches with the particular field. We will also allow searching for fields irrespective of the case of the searched string. The user will be able to apply multiple filters at a time and the output of the query will match all the filters applied. If no results are found, an empty list will be returned.&lt;br /&gt;
&lt;br /&gt;
To search for an assignment by Creation Date, the user will be prompted with a calendar where he can select a date and all the assignments created on or before the selected date will be displayed. &lt;br /&gt;
&lt;br /&gt;
To apply multiple filters, user can tap on the Advanced Search button available, adjacent to the Search button; a hidden div will then be rendered below containing textboxes for all the columns. All assignments that were created before the selected date for Creation Date or Updated Date columns and the ones that match other filters will be returned. A empty list will be returned if the search criteria doesn't match any records in the database. The questionnaires will be grouped on the basis of their courses and will be expanded when clicked.&lt;br /&gt;
&lt;br /&gt;
Steps to reproduce the proposed workflow:&lt;br /&gt;
:#Log in to expertiza to view the home page&lt;br /&gt;
:#Go to Manage &amp;gt; Questionnaires&lt;br /&gt;
:#Type the search criteria in the available search criteria and select the appropriate field from the dropdown.&lt;br /&gt;
:#To perform search based on multiple filters, the user can tap on the Advanced Search button adjacent to the Search button, the view renders a hidden div containing textboxes for all the columns, allowing the user to search based on multiple columns.&lt;br /&gt;
:#All the entries that match the given criteria will be returned.&lt;br /&gt;
:#An empty list is returned if the search criteria doesn't match any valid records in the database.&lt;br /&gt;
&lt;br /&gt;
===Search for Reviews:===&lt;br /&gt;
&lt;br /&gt;
The existing system does not have a search functionality under Reviews. The proposed system will implement a search functionality for searching using the attributes like team name, score, reviewer, comment etc. by entering a partial or a complete text that matches with the particular field. We will also allow searching for fields irrespective of the case of the searched string. The user will be able to apply multiple filters at a time and the output of the query will match all the filters applied. If no results are found, an empty list will be returned.&lt;br /&gt;
&lt;br /&gt;
The user will be able to apply multiple filters at a time and the output of the query will match all filters applied. If no results are found, an empty list will be returned.&lt;br /&gt;
&lt;br /&gt;
Steps to reproduce the proposed workflow:&lt;br /&gt;
:#Log in to expertiza to view the home page&lt;br /&gt;
:#Go to Manage -&amp;gt; Assignment -&amp;gt; View Reports -&amp;gt; Review Report (View)&lt;br /&gt;
:#Type the search criteria in the available search criteria and select the appropriate field from the dropdown.&lt;br /&gt;
:#To perform search based on multiple filters, the user can tap on the Advanced Search button adjacent to the Search button, the view renders a hidden div containing textboxes for all the columns, allowing the user to search based on multiple columns.&lt;br /&gt;
:#All the entries that match the given criteria will be returned.&lt;br /&gt;
:#An empty list is returned if the search criteria doesn't match any valid records in the database.&lt;br /&gt;
&lt;br /&gt;
==Use Case Diagram==&lt;br /&gt;
[[File:UseCaseExpertizaSearch.png|center]]&lt;br /&gt;
&lt;br /&gt;
== Code Changes==&lt;br /&gt;
&lt;br /&gt;
The search feature could be implemented in a more RESTful manner by adding it to individual models rather than implementing it as a single controller.&lt;br /&gt;
&lt;br /&gt;
If we followed this approach the search query would be as follows:&lt;br /&gt;
#localhost:port/user/search?name=&amp;lt;&amp;gt;&lt;br /&gt;
#localhost:port/assignment/search?name=&amp;lt;&amp;gt;&lt;br /&gt;
#localhost:port/questionnaire/search?name=&amp;lt;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Following is the list of search attributes for a given entity along with a list of files that would altered in the process.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;User&amp;lt;/b&amp;gt;&lt;br /&gt;
*Search fields: username, fullname, email&lt;br /&gt;
&lt;br /&gt;
*Modified Files:&lt;br /&gt;
#app/views/users/list.html.erb&lt;br /&gt;
#app/views/users/_search.html.erb&lt;br /&gt;
#app/controllers/users_controller.rb&lt;br /&gt;
#app/models/user.rb&lt;br /&gt;
&lt;br /&gt;
The search functionality is no longer part of the list method, instead is passed as a parameter to the rendering method. The code has been modularized to separate the search parameter fetching and matching it with the user lists. Redundant search_id field has been removed from the code, the functionality is achieved using the search_uname parameter. Variable names have been renamed to increase readability. Comments have been added to further enhance readability and maintainability of the code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Assignment&amp;lt;/b&amp;gt;&lt;br /&gt;
*Search fields: assignment_name, assignee_username, assignee_name, due_date_before, due_date_after, created_before, created_after&lt;br /&gt;
&lt;br /&gt;
*Modified files&lt;br /&gt;
#app/models/assignment_node.rb&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Questionnaire&amp;lt;/b&amp;gt;&lt;br /&gt;
*Search fields: name, text, course, assignment&lt;br /&gt;
*Modified files&lt;br /&gt;
#app/models/questionnaire_node.rb&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Review&amp;lt;/b&amp;gt;&lt;br /&gt;
*Search fields: team, text, min_score, max_score&lt;br /&gt;
*Modified files&lt;br /&gt;
#app/views/review_mapping/_searchbox.html.erb&lt;br /&gt;
#app/controllers/review_mapping_controller.rb&lt;br /&gt;
&lt;br /&gt;
==Database Design==&lt;br /&gt;
Below is the simplified version of the ER diagram which displays the relationships between the entity sets. Team_users and assignment_questionnaires are many to many relationships which are implemented in table format as show below.&lt;br /&gt;
&lt;br /&gt;
[[File:ER diagram.png|center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Relevant Tables===&lt;br /&gt;
[[File:User table.png|center]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Screen Shot 2018-11-20 at 11.42.06 PM.png|center]]&lt;br /&gt;
&lt;br /&gt;
==Test Plan: ==&lt;br /&gt;
=== Automated Tests ===&lt;br /&gt;
Automated tests in RSpec will be added as we implement the search functionality for each modified file. Most of the tests added will be unit tests that cover the use cases for each flow and changes made in the model as per the requirement description.&amp;lt;br&amp;gt;&lt;br /&gt;
====Test Details:====&lt;br /&gt;
=====User Model ( spec/models/user_spec.rb )=====&lt;br /&gt;
# Search by user name&lt;br /&gt;
# Search by user name that does not exist&lt;br /&gt;
# Search by user email&lt;br /&gt;
# Search by user email that does not exist&lt;br /&gt;
# Search by user email containing a substring&lt;br /&gt;
# Search by user full name&lt;br /&gt;
# Search by user full name is empty&lt;br /&gt;
# Search by user name and email&lt;br /&gt;
# Search for assignments participated&lt;br /&gt;
=====Assignment Model ( spec/models/assignment_spec.rb )=====&lt;br /&gt;
# Search by user name&lt;br /&gt;
# Search by institution&lt;br /&gt;
# Search by creation date&lt;br /&gt;
# Search by updated date&lt;br /&gt;
=====Rubrics=====&lt;br /&gt;
# Search by name&lt;br /&gt;
# Search by courses used in&lt;br /&gt;
# Search by assignments used in&lt;br /&gt;
=====Reviews=====&lt;br /&gt;
# Search all reviews of a particular team’s work for particular scores or text strings.  &lt;br /&gt;
# Search by score&lt;br /&gt;
# Search by text comment length&lt;br /&gt;
# Search by reviewer and reviewee&lt;br /&gt;
=== Manual Tests ===&lt;br /&gt;
=====Search for User=====&lt;br /&gt;
# Setup: create a user with name=&amp;quot;student&amp;quot; and userId=&amp;quot;5000&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
# Action: Instructor clicks on manage - &amp;gt; users -&amp;gt; in textbox enters name=&amp;quot;student&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
# Response: Relevant details of student, name=&amp;quot;student&amp;quot; is displayed&amp;lt;br&amp;gt;&lt;br /&gt;
# Action: Instructor clicks on manage - &amp;gt; users -&amp;gt; advanced search-&amp;gt;clicks on checkbox student id and enters &amp;quot;5000&amp;quot; and click &amp;quot;ok&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
# Response: Relevant details of student, name=&amp;quot;student&amp;quot; is displayed&amp;lt;br&amp;gt;&lt;br /&gt;
=====Search for Assignments=====&lt;br /&gt;
# Setup create an assignment with name=&amp;quot;assignment&amp;quot; and set a due date&amp;lt;br&amp;gt;&lt;br /&gt;
# Action : Instructor clicks on Manage -&amp;gt; Assignments, in textbox enter &amp;quot;assignment&amp;quot; in relevant tab&amp;lt;br&amp;gt; &lt;br /&gt;
# Response : Relevant assignment should be displayed&amp;lt;br&amp;gt;&lt;br /&gt;
# Action : Instructor clicks on Manage -&amp;gt; Assignments-&amp;gt; drop down and apply filters for due date and enter date and click &amp;quot;ok&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
# Response : Relevant assignments should be displayed&amp;lt;br&amp;gt;&lt;br /&gt;
=====Search for Questionnaires=====&lt;br /&gt;
# Setup : Create a Questionnaire, add questions to it&amp;lt;br&amp;gt;&lt;br /&gt;
# Action : Log in as instructor,  Manage -&amp;gt; Questionnaires, in text box enter text&amp;lt;br&amp;gt;&lt;br /&gt;
# Response : Questionnaires matching text are shown&amp;lt;br&amp;gt;&lt;br /&gt;
# Action : Log in as instructor,  Manage -&amp;gt; Questionnaires, click advanced search and check creation date and enter value&amp;lt;br&amp;gt;&lt;br /&gt;
# Response : Questionnaires matching text are shown&amp;lt;br&amp;gt;&lt;br /&gt;
=====Search for Reviews=====&lt;br /&gt;
# Setup : Setup review for an assignment, login as student and then add review &amp;lt;br&amp;gt;&lt;br /&gt;
# Action : Log in as instructor, Manage -&amp;gt; Assignments, Click on Review Report icon on corresponding assignment&amp;lt;br&amp;gt;&lt;br /&gt;
# Result : Review should be seen&amp;lt;br&amp;gt;&lt;br /&gt;
# Action : Click Advanced search, check review by text  and enter text&amp;lt;br&amp;gt;  &lt;br /&gt;
# Result : Matching review should be visible&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Team:==&lt;br /&gt;
#Nisarg Mayank Chokshi (nmchoks2@ncsu.edu)&lt;br /&gt;
#Omkar Nivrutti Kashid (onkashid@ncsu.edu)&lt;br /&gt;
#Richa Dua (rdua2@ncsu.edu)&lt;br /&gt;
#Steve Victor Menezes  (smeneze@ncsu.edu)&lt;br /&gt;
'''Mentor:''' Harsh Agarwal (hagrawa2@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
==Additional Links:==&lt;br /&gt;
Pull Request: https://github.com/expertiza/expertiza/pull/1659 &amp;lt;br&amp;gt;&lt;br /&gt;
Github Project Board: https://github.com/stevemenezes/expertiza/projects/1&lt;/div&gt;</summary>
		<author><name>Nmchoks2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1987._Improving_search_facility_in_Expertiza&amp;diff=131221</id>
		<title>CSC/ECE 517 Fall 2019 - E1987. Improving search facility in Expertiza</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1987._Improving_search_facility_in_Expertiza&amp;diff=131221"/>
		<updated>2019-12-11T18:59:12Z</updated>

		<summary type="html">&lt;p&gt;Nmchoks2: /* Additional Links: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= E1987 - Improving search facility in Expertiza=&lt;br /&gt;
==Introduction:==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source application running on Ruby on Rails. It is used for management of courses and the assignments for respective courses, by the faculties and the students. The manage content section of the application has different views which displays information about the users, courses, assignments, questionnaires, and reviews. The application should have a fully functional search functionality throughout the views, so that a user can search any type of data with ease, on the basis of any number of parameters depending on his requirements. Users should be searched on the basis of one more parameters which include name, full name, email, etc. Similarly, assignments should be searched on the basis of name, created date, updated date, etc. However, the search functionality in the existing application is constrained to just a single parameter for users and assignments. Questionnaires management does not have a search functionality implemented as yet. This project works on improving the search functionality of Expertiza, by adding search bars if not present, introducing advanced search feature where user can search on the basis of more than one parameters and making the search functionality appear more elegant.&lt;br /&gt;
&lt;br /&gt;
==Problem Definition:==&lt;br /&gt;
&lt;br /&gt;
#An instructor or administrator can search for a user by name, user-ID, or other characteristics.&lt;br /&gt;
#An instructor should be able to search for assignments by name, due date, or other characteristics.&lt;br /&gt;
#An instructor should be able to search for rubrics (or other questionnaires) by name, or by the courses or assignments they have been used in.&lt;br /&gt;
##For the instructor, there also needs to be a way to quickly find rubrics (and other questionnaires) that have been used in a single course.  It should be possible to search or click somewhere to bring up a list of questionnaires used in the course, expanding only the applicable questionnaires in the list of questionnaires.&lt;br /&gt;
##One should also be able to search for questionnaires by words used in questions that belong to the questionnaires.&lt;br /&gt;
#There should be a way to search all reviews of a particular team’s work for particular scores or text strings.  Reviews should be able to be filtered by score, text comment length, reviewer and reviewee.&lt;br /&gt;
#An instructor or administrator should be able to search for all the assignments that a particular user has participated in.&lt;br /&gt;
#If more than one criteria needs to be specified, there should be an 'Advanced Search' button.&lt;br /&gt;
&lt;br /&gt;
==Proposed Solution:==&lt;br /&gt;
===Search for User:===&lt;br /&gt;
&lt;br /&gt;
In the current system workflow, we found that the user is unable to search in the Manage Users view. In the proposed workflow, we plan to enable the user to search by all the columns in the UI viz. Name, Full name, Email Address, Role, Parent by entering a partial or a complete text that matches with the particular field. We will also allow searching for fields irrespective of the case of the searched string. The user will be able to apply multiple filters at a time and the output of the query will match all filters applied. If no results are found, an empty list will be returned.&lt;br /&gt;
&lt;br /&gt;
Steps to reproduce the proposed workflow:&lt;br /&gt;
:#Log in to expertiza to view the home page&lt;br /&gt;
:#Go to Manage &amp;gt; Users&lt;br /&gt;
:#Type the search string in the search box available on the UI and select the column to search for from the dropdown.&lt;br /&gt;
:#To perform search based on multiple filters, the user can tap on the Advanced Search button adjacent to the Search button, the view renders a hidden div containing textboxes for all the columns, allowing the user to search based on multiple columns.&lt;br /&gt;
:#All the entries that match the specified criteria will be returned.&lt;br /&gt;
:#An empty list is returned if the search criteria doesn't match any valid records in the database.&lt;br /&gt;
&lt;br /&gt;
===Search for Assignments:===&lt;br /&gt;
&lt;br /&gt;
In the current system implementation, searching via the name of the assignment is supported with partial or complete assignment name. However, the search is case sensitive. In the proposed system, the user will be able to search for an assignment using additional filters such as Creation Date and Updated Date along with Assignment Name. The user will also be able to apply multiple filters at a time and the output of the query will match all filters applied. If no results are found, an empty list will be returned.&lt;br /&gt;
&lt;br /&gt;
To search for an assignment by Creation Date, the user will be prompted with a calendar where he can select a date and all the assignments created on or before the selected date will be displayed. &lt;br /&gt;
&lt;br /&gt;
To apply multiple filters, user can tap on the Advanced Search button available, adjacent to the Search button; a hidden div will then be rendered below containing textboxes for all the columns. All assignments that were created before the selected date for Creation Date or Updated Date columns and the ones that match other filters will be returned. A empty list will be returned if the search criteria doesn't match any records in the database.&lt;br /&gt;
&lt;br /&gt;
Steps to reproduce the proposed workflow:&lt;br /&gt;
:#Log in to expertiza to view the home page&lt;br /&gt;
:#Go to Manage &amp;gt; Assignments&lt;br /&gt;
:#Type the search criteria in the available search criteria and select the appropriate field from the dropdown.&lt;br /&gt;
:#To perform search based on multiple filters, the user can tap on the Advanced Search button adjacent to the Search button, the view renders a hidden div containing textboxes for all the columns, allowing the user to search based on multiple columns.&lt;br /&gt;
:#All the entries that match the given criteria will be returned.&lt;br /&gt;
:#An empty list is returned if the search criteria doesn't match any valid records in the database.&lt;br /&gt;
&lt;br /&gt;
===Search for Questionnaires:===&lt;br /&gt;
&lt;br /&gt;
The existing system does not have a search functionality under Questionnaires. The proposed system will implement a search functionality for searching via the name of the questionnaire, the text in the questions within a questionnaire, date of creation, and date updated by entering a partial or a complete text that matches with the particular field. We will also allow searching for fields irrespective of the case of the searched string. The user will be able to apply multiple filters at a time and the output of the query will match all the filters applied. If no results are found, an empty list will be returned.&lt;br /&gt;
&lt;br /&gt;
To search for an assignment by Creation Date, the user will be prompted with a calendar where he can select a date and all the assignments created on or before the selected date will be displayed. &lt;br /&gt;
&lt;br /&gt;
To apply multiple filters, user can tap on the Advanced Search button available, adjacent to the Search button; a hidden div will then be rendered below containing textboxes for all the columns. All assignments that were created before the selected date for Creation Date or Updated Date columns and the ones that match other filters will be returned. A empty list will be returned if the search criteria doesn't match any records in the database. The questionnaires will be grouped on the basis of their courses and will be expanded when clicked.&lt;br /&gt;
&lt;br /&gt;
Steps to reproduce the proposed workflow:&lt;br /&gt;
:#Log in to expertiza to view the home page&lt;br /&gt;
:#Go to Manage &amp;gt; Questionnaires&lt;br /&gt;
:#Type the search criteria in the available search criteria and select the appropriate field from the dropdown.&lt;br /&gt;
:#To perform search based on multiple filters, the user can tap on the Advanced Search button adjacent to the Search button, the view renders a hidden div containing textboxes for all the columns, allowing the user to search based on multiple columns.&lt;br /&gt;
:#All the entries that match the given criteria will be returned.&lt;br /&gt;
:#An empty list is returned if the search criteria doesn't match any valid records in the database.&lt;br /&gt;
&lt;br /&gt;
===Search for Reviews:===&lt;br /&gt;
&lt;br /&gt;
The existing system does not have a search functionality under Reviews. The proposed system will implement a search functionality for searching using the attributes like team name, score, reviewer, comment etc. by entering a partial or a complete text that matches with the particular field. We will also allow searching for fields irrespective of the case of the searched string. The user will be able to apply multiple filters at a time and the output of the query will match all the filters applied. If no results are found, an empty list will be returned.&lt;br /&gt;
&lt;br /&gt;
The user will be able to apply multiple filters at a time and the output of the query will match all filters applied. If no results are found, an empty list will be returned.&lt;br /&gt;
&lt;br /&gt;
Steps to reproduce the proposed workflow:&lt;br /&gt;
:#Log in to expertiza to view the home page&lt;br /&gt;
:#Go to Manage -&amp;gt; Assignment -&amp;gt; View Reports -&amp;gt; Review Report (View)&lt;br /&gt;
:#Type the search criteria in the available search criteria and select the appropriate field from the dropdown.&lt;br /&gt;
:#To perform search based on multiple filters, the user can tap on the Advanced Search button adjacent to the Search button, the view renders a hidden div containing textboxes for all the columns, allowing the user to search based on multiple columns.&lt;br /&gt;
:#All the entries that match the given criteria will be returned.&lt;br /&gt;
:#An empty list is returned if the search criteria doesn't match any valid records in the database.&lt;br /&gt;
&lt;br /&gt;
==Use Case Diagram==&lt;br /&gt;
[[File:UseCaseExpertizaSearch.png|center]]&lt;br /&gt;
&lt;br /&gt;
== Code Changes==&lt;br /&gt;
&lt;br /&gt;
The search feature could be implemented in a more RESTful manner by adding it to individual models rather than implementing it as a single controller.&lt;br /&gt;
&lt;br /&gt;
If we followed this approach the search query would be as follows:&lt;br /&gt;
#localhost:port/user/search?name=&amp;lt;&amp;gt;&lt;br /&gt;
#localhost:port/assignment/search?name=&amp;lt;&amp;gt;&lt;br /&gt;
#localhost:port/questionnaire/search?name=&amp;lt;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Following is the list of search attributes for a given entity along with a list of files that would altered in the process.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;User&amp;lt;/b&amp;gt;&lt;br /&gt;
*Search fields: username, fullname, email&lt;br /&gt;
&lt;br /&gt;
*Modified Files:&lt;br /&gt;
#app/views/users/list.html.erb&lt;br /&gt;
#app/views/users/_search.html.erb&lt;br /&gt;
#app/controllers/users_controller.rb&lt;br /&gt;
#app/models/user.rb&lt;br /&gt;
&lt;br /&gt;
The search functionality is no longer part of the list method, instead is passed as a parameter to the rendering method. The code has been modularized to separate the search parameter fetching and matching it with the user lists. Redundant search_id field has been removed from the code, the functionality is achieved using the search_uname parameter. Variable names have been renamed to increase readability. Comments have been added to further enhance readability and maintainability of the code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Assignment&amp;lt;/b&amp;gt;&lt;br /&gt;
*Search fields: assignment_name, assignee_username, assignee_name, due_date_before, due_date_after, created_before, created_after&lt;br /&gt;
&lt;br /&gt;
*Modified files&lt;br /&gt;
#app/models/assignment_node.rb&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Questionnaire&amp;lt;/b&amp;gt;&lt;br /&gt;
*Search fields: name, text, course, assignment&lt;br /&gt;
*Modified files&lt;br /&gt;
#app/models/questionnaire_node.rb&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Review&amp;lt;/b&amp;gt;&lt;br /&gt;
*Search fields: team, text, min_score, max_score&lt;br /&gt;
*Modified files&lt;br /&gt;
#app/views/review_mapping/_searchbox.html.erb&lt;br /&gt;
#app/controllers/review_mapping_controller.rb&lt;br /&gt;
&lt;br /&gt;
==Database Design==&lt;br /&gt;
Below is the simplified version of the ER diagram which displays the relationships between the entity sets. Team_users and assignment_questionnaires are many to many relationships which are implemented in table format as show below.&lt;br /&gt;
&lt;br /&gt;
[[File:ER diagram.png|center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Relevant Tables===&lt;br /&gt;
[[File:User table.png|center]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Screen Shot 2018-11-20 at 11.42.06 PM.png|center]]&lt;br /&gt;
&lt;br /&gt;
==Test Plan: ==&lt;br /&gt;
=== Automated Tests ===&lt;br /&gt;
Automated tests in RSpec will be added as we implement the search functionality for each modified file. Most of the tests added will be unit tests that cover the use cases for each flow and changes made in the model as per the requirement description.&amp;lt;br&amp;gt;&lt;br /&gt;
====Test Details:====&lt;br /&gt;
=====User Model ( spec/models/user_spec.rb )=====&lt;br /&gt;
# Search by user name&lt;br /&gt;
# Search by user name that does not exist&lt;br /&gt;
# Search by user email&lt;br /&gt;
# Search by user email that does not exist&lt;br /&gt;
# Search by user email containing a substring&lt;br /&gt;
# Search by user full name&lt;br /&gt;
# Search by user full name is empty&lt;br /&gt;
# Search by user name and email&lt;br /&gt;
# Search for assignments participated&lt;br /&gt;
=====Assignment Model ( spec/models/assignment_spec.rb )=====&lt;br /&gt;
# Search by user name&lt;br /&gt;
# Search by institution&lt;br /&gt;
# Search by creation date&lt;br /&gt;
# Search by updated date&lt;br /&gt;
=====Rubrics=====&lt;br /&gt;
# Search by name&lt;br /&gt;
# Search by courses used in&lt;br /&gt;
# Search by assignments used in&lt;br /&gt;
=====Reviews=====&lt;br /&gt;
# Search all reviews of a particular team’s work for particular scores or text strings.  &lt;br /&gt;
# Search by score&lt;br /&gt;
# Search by text comment length&lt;br /&gt;
# Search by reviewer and reviewee&lt;br /&gt;
=== Manual Tests ===&lt;br /&gt;
=====Search for User=====&lt;br /&gt;
# Setup: create a user with name=&amp;quot;student&amp;quot; and userId=&amp;quot;5000&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
# Action: Instructor clicks on manage - &amp;gt; users -&amp;gt; in textbox enters name=&amp;quot;student&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
# Response: Relevant details of student, name=&amp;quot;student&amp;quot; is displayed&amp;lt;br&amp;gt;&lt;br /&gt;
# Action: Instructor clicks on manage - &amp;gt; users -&amp;gt; advanced search-&amp;gt;clicks on checkbox student id and enters &amp;quot;5000&amp;quot; and click &amp;quot;ok&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
# Response: Relevant details of student, name=&amp;quot;student&amp;quot; is displayed&amp;lt;br&amp;gt;&lt;br /&gt;
=====Search for Assignments=====&lt;br /&gt;
# Setup create an assignment with name=&amp;quot;assignment&amp;quot; and set a due date&amp;lt;br&amp;gt;&lt;br /&gt;
# Action : Instructor clicks on Manage -&amp;gt; Assignments, in textbox enter &amp;quot;assignment&amp;quot; in relevant tab&amp;lt;br&amp;gt; &lt;br /&gt;
# Response : Relevant assignment should be displayed&amp;lt;br&amp;gt;&lt;br /&gt;
# Action : Instructor clicks on Manage -&amp;gt; Assignments-&amp;gt; drop down and apply filters for due date and enter date and click &amp;quot;ok&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
# Response : Relevant assignments should be displayed&amp;lt;br&amp;gt;&lt;br /&gt;
=====Search for Questionnaires=====&lt;br /&gt;
# Setup : Create a Questionnaire, add questions to it&amp;lt;br&amp;gt;&lt;br /&gt;
# Action : Log in as instructor,  Manage -&amp;gt; Questionnaires, in text box enter text&amp;lt;br&amp;gt;&lt;br /&gt;
# Response : Questionnaires matching text are shown&amp;lt;br&amp;gt;&lt;br /&gt;
# Action : Log in as instructor,  Manage -&amp;gt; Questionnaires, click advanced search and check creation date and enter value&amp;lt;br&amp;gt;&lt;br /&gt;
# Response : Questionnaires matching text are shown&amp;lt;br&amp;gt;&lt;br /&gt;
=====Search for Reviews=====&lt;br /&gt;
# Setup : Setup review for an assignment, login as student and then add review &amp;lt;br&amp;gt;&lt;br /&gt;
# Action : Log in as instructor, Manage -&amp;gt; Assignments, Click on Review Report icon on corresponding assignment&amp;lt;br&amp;gt;&lt;br /&gt;
# Result : Review should be seen&amp;lt;br&amp;gt;&lt;br /&gt;
# Action : Click Advanced search, check review by text  and enter text&amp;lt;br&amp;gt;  &lt;br /&gt;
# Result : Matching review should be visible&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Team:==&lt;br /&gt;
#Nisarg Mayank Chokshi (nmchoks2@ncsu.edu)&lt;br /&gt;
#Omkar Nivrutti Kashid (onkashid@ncsu.edu)&lt;br /&gt;
#Richa Dua (rdua2@ncsu.edu)&lt;br /&gt;
#Steve Victor Menezes  (smeneze@ncsu.edu)&lt;br /&gt;
'''Mentor:''' Harsh Agarwal (hagrawa2@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
==Additional Links:==&lt;br /&gt;
Pull Request: https://github.com/expertiza/expertiza/pull/1659 &amp;lt;br&amp;gt;&lt;br /&gt;
GIthub Project Board: https://github.com/stevemenezes/expertiza/projects/1&lt;/div&gt;</summary>
		<author><name>Nmchoks2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1987._Improving_search_facility_in_Expertiza&amp;diff=131220</id>
		<title>CSC/ECE 517 Fall 2019 - E1987. Improving search facility in Expertiza</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1987._Improving_search_facility_in_Expertiza&amp;diff=131220"/>
		<updated>2019-12-11T18:58:59Z</updated>

		<summary type="html">&lt;p&gt;Nmchoks2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= E1987 - Improving search facility in Expertiza=&lt;br /&gt;
==Introduction:==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source application running on Ruby on Rails. It is used for management of courses and the assignments for respective courses, by the faculties and the students. The manage content section of the application has different views which displays information about the users, courses, assignments, questionnaires, and reviews. The application should have a fully functional search functionality throughout the views, so that a user can search any type of data with ease, on the basis of any number of parameters depending on his requirements. Users should be searched on the basis of one more parameters which include name, full name, email, etc. Similarly, assignments should be searched on the basis of name, created date, updated date, etc. However, the search functionality in the existing application is constrained to just a single parameter for users and assignments. Questionnaires management does not have a search functionality implemented as yet. This project works on improving the search functionality of Expertiza, by adding search bars if not present, introducing advanced search feature where user can search on the basis of more than one parameters and making the search functionality appear more elegant.&lt;br /&gt;
&lt;br /&gt;
==Problem Definition:==&lt;br /&gt;
&lt;br /&gt;
#An instructor or administrator can search for a user by name, user-ID, or other characteristics.&lt;br /&gt;
#An instructor should be able to search for assignments by name, due date, or other characteristics.&lt;br /&gt;
#An instructor should be able to search for rubrics (or other questionnaires) by name, or by the courses or assignments they have been used in.&lt;br /&gt;
##For the instructor, there also needs to be a way to quickly find rubrics (and other questionnaires) that have been used in a single course.  It should be possible to search or click somewhere to bring up a list of questionnaires used in the course, expanding only the applicable questionnaires in the list of questionnaires.&lt;br /&gt;
##One should also be able to search for questionnaires by words used in questions that belong to the questionnaires.&lt;br /&gt;
#There should be a way to search all reviews of a particular team’s work for particular scores or text strings.  Reviews should be able to be filtered by score, text comment length, reviewer and reviewee.&lt;br /&gt;
#An instructor or administrator should be able to search for all the assignments that a particular user has participated in.&lt;br /&gt;
#If more than one criteria needs to be specified, there should be an 'Advanced Search' button.&lt;br /&gt;
&lt;br /&gt;
==Proposed Solution:==&lt;br /&gt;
===Search for User:===&lt;br /&gt;
&lt;br /&gt;
In the current system workflow, we found that the user is unable to search in the Manage Users view. In the proposed workflow, we plan to enable the user to search by all the columns in the UI viz. Name, Full name, Email Address, Role, Parent by entering a partial or a complete text that matches with the particular field. We will also allow searching for fields irrespective of the case of the searched string. The user will be able to apply multiple filters at a time and the output of the query will match all filters applied. If no results are found, an empty list will be returned.&lt;br /&gt;
&lt;br /&gt;
Steps to reproduce the proposed workflow:&lt;br /&gt;
:#Log in to expertiza to view the home page&lt;br /&gt;
:#Go to Manage &amp;gt; Users&lt;br /&gt;
:#Type the search string in the search box available on the UI and select the column to search for from the dropdown.&lt;br /&gt;
:#To perform search based on multiple filters, the user can tap on the Advanced Search button adjacent to the Search button, the view renders a hidden div containing textboxes for all the columns, allowing the user to search based on multiple columns.&lt;br /&gt;
:#All the entries that match the specified criteria will be returned.&lt;br /&gt;
:#An empty list is returned if the search criteria doesn't match any valid records in the database.&lt;br /&gt;
&lt;br /&gt;
===Search for Assignments:===&lt;br /&gt;
&lt;br /&gt;
In the current system implementation, searching via the name of the assignment is supported with partial or complete assignment name. However, the search is case sensitive. In the proposed system, the user will be able to search for an assignment using additional filters such as Creation Date and Updated Date along with Assignment Name. The user will also be able to apply multiple filters at a time and the output of the query will match all filters applied. If no results are found, an empty list will be returned.&lt;br /&gt;
&lt;br /&gt;
To search for an assignment by Creation Date, the user will be prompted with a calendar where he can select a date and all the assignments created on or before the selected date will be displayed. &lt;br /&gt;
&lt;br /&gt;
To apply multiple filters, user can tap on the Advanced Search button available, adjacent to the Search button; a hidden div will then be rendered below containing textboxes for all the columns. All assignments that were created before the selected date for Creation Date or Updated Date columns and the ones that match other filters will be returned. A empty list will be returned if the search criteria doesn't match any records in the database.&lt;br /&gt;
&lt;br /&gt;
Steps to reproduce the proposed workflow:&lt;br /&gt;
:#Log in to expertiza to view the home page&lt;br /&gt;
:#Go to Manage &amp;gt; Assignments&lt;br /&gt;
:#Type the search criteria in the available search criteria and select the appropriate field from the dropdown.&lt;br /&gt;
:#To perform search based on multiple filters, the user can tap on the Advanced Search button adjacent to the Search button, the view renders a hidden div containing textboxes for all the columns, allowing the user to search based on multiple columns.&lt;br /&gt;
:#All the entries that match the given criteria will be returned.&lt;br /&gt;
:#An empty list is returned if the search criteria doesn't match any valid records in the database.&lt;br /&gt;
&lt;br /&gt;
===Search for Questionnaires:===&lt;br /&gt;
&lt;br /&gt;
The existing system does not have a search functionality under Questionnaires. The proposed system will implement a search functionality for searching via the name of the questionnaire, the text in the questions within a questionnaire, date of creation, and date updated by entering a partial or a complete text that matches with the particular field. We will also allow searching for fields irrespective of the case of the searched string. The user will be able to apply multiple filters at a time and the output of the query will match all the filters applied. If no results are found, an empty list will be returned.&lt;br /&gt;
&lt;br /&gt;
To search for an assignment by Creation Date, the user will be prompted with a calendar where he can select a date and all the assignments created on or before the selected date will be displayed. &lt;br /&gt;
&lt;br /&gt;
To apply multiple filters, user can tap on the Advanced Search button available, adjacent to the Search button; a hidden div will then be rendered below containing textboxes for all the columns. All assignments that were created before the selected date for Creation Date or Updated Date columns and the ones that match other filters will be returned. A empty list will be returned if the search criteria doesn't match any records in the database. The questionnaires will be grouped on the basis of their courses and will be expanded when clicked.&lt;br /&gt;
&lt;br /&gt;
Steps to reproduce the proposed workflow:&lt;br /&gt;
:#Log in to expertiza to view the home page&lt;br /&gt;
:#Go to Manage &amp;gt; Questionnaires&lt;br /&gt;
:#Type the search criteria in the available search criteria and select the appropriate field from the dropdown.&lt;br /&gt;
:#To perform search based on multiple filters, the user can tap on the Advanced Search button adjacent to the Search button, the view renders a hidden div containing textboxes for all the columns, allowing the user to search based on multiple columns.&lt;br /&gt;
:#All the entries that match the given criteria will be returned.&lt;br /&gt;
:#An empty list is returned if the search criteria doesn't match any valid records in the database.&lt;br /&gt;
&lt;br /&gt;
===Search for Reviews:===&lt;br /&gt;
&lt;br /&gt;
The existing system does not have a search functionality under Reviews. The proposed system will implement a search functionality for searching using the attributes like team name, score, reviewer, comment etc. by entering a partial or a complete text that matches with the particular field. We will also allow searching for fields irrespective of the case of the searched string. The user will be able to apply multiple filters at a time and the output of the query will match all the filters applied. If no results are found, an empty list will be returned.&lt;br /&gt;
&lt;br /&gt;
The user will be able to apply multiple filters at a time and the output of the query will match all filters applied. If no results are found, an empty list will be returned.&lt;br /&gt;
&lt;br /&gt;
Steps to reproduce the proposed workflow:&lt;br /&gt;
:#Log in to expertiza to view the home page&lt;br /&gt;
:#Go to Manage -&amp;gt; Assignment -&amp;gt; View Reports -&amp;gt; Review Report (View)&lt;br /&gt;
:#Type the search criteria in the available search criteria and select the appropriate field from the dropdown.&lt;br /&gt;
:#To perform search based on multiple filters, the user can tap on the Advanced Search button adjacent to the Search button, the view renders a hidden div containing textboxes for all the columns, allowing the user to search based on multiple columns.&lt;br /&gt;
:#All the entries that match the given criteria will be returned.&lt;br /&gt;
:#An empty list is returned if the search criteria doesn't match any valid records in the database.&lt;br /&gt;
&lt;br /&gt;
==Use Case Diagram==&lt;br /&gt;
[[File:UseCaseExpertizaSearch.png|center]]&lt;br /&gt;
&lt;br /&gt;
== Code Changes==&lt;br /&gt;
&lt;br /&gt;
The search feature could be implemented in a more RESTful manner by adding it to individual models rather than implementing it as a single controller.&lt;br /&gt;
&lt;br /&gt;
If we followed this approach the search query would be as follows:&lt;br /&gt;
#localhost:port/user/search?name=&amp;lt;&amp;gt;&lt;br /&gt;
#localhost:port/assignment/search?name=&amp;lt;&amp;gt;&lt;br /&gt;
#localhost:port/questionnaire/search?name=&amp;lt;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Following is the list of search attributes for a given entity along with a list of files that would altered in the process.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;User&amp;lt;/b&amp;gt;&lt;br /&gt;
*Search fields: username, fullname, email&lt;br /&gt;
&lt;br /&gt;
*Modified Files:&lt;br /&gt;
#app/views/users/list.html.erb&lt;br /&gt;
#app/views/users/_search.html.erb&lt;br /&gt;
#app/controllers/users_controller.rb&lt;br /&gt;
#app/models/user.rb&lt;br /&gt;
&lt;br /&gt;
The search functionality is no longer part of the list method, instead is passed as a parameter to the rendering method. The code has been modularized to separate the search parameter fetching and matching it with the user lists. Redundant search_id field has been removed from the code, the functionality is achieved using the search_uname parameter. Variable names have been renamed to increase readability. Comments have been added to further enhance readability and maintainability of the code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Assignment&amp;lt;/b&amp;gt;&lt;br /&gt;
*Search fields: assignment_name, assignee_username, assignee_name, due_date_before, due_date_after, created_before, created_after&lt;br /&gt;
&lt;br /&gt;
*Modified files&lt;br /&gt;
#app/models/assignment_node.rb&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Questionnaire&amp;lt;/b&amp;gt;&lt;br /&gt;
*Search fields: name, text, course, assignment&lt;br /&gt;
*Modified files&lt;br /&gt;
#app/models/questionnaire_node.rb&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Review&amp;lt;/b&amp;gt;&lt;br /&gt;
*Search fields: team, text, min_score, max_score&lt;br /&gt;
*Modified files&lt;br /&gt;
#app/views/review_mapping/_searchbox.html.erb&lt;br /&gt;
#app/controllers/review_mapping_controller.rb&lt;br /&gt;
&lt;br /&gt;
==Database Design==&lt;br /&gt;
Below is the simplified version of the ER diagram which displays the relationships between the entity sets. Team_users and assignment_questionnaires are many to many relationships which are implemented in table format as show below.&lt;br /&gt;
&lt;br /&gt;
[[File:ER diagram.png|center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Relevant Tables===&lt;br /&gt;
[[File:User table.png|center]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Screen Shot 2018-11-20 at 11.42.06 PM.png|center]]&lt;br /&gt;
&lt;br /&gt;
==Test Plan: ==&lt;br /&gt;
=== Automated Tests ===&lt;br /&gt;
Automated tests in RSpec will be added as we implement the search functionality for each modified file. Most of the tests added will be unit tests that cover the use cases for each flow and changes made in the model as per the requirement description.&amp;lt;br&amp;gt;&lt;br /&gt;
====Test Details:====&lt;br /&gt;
=====User Model ( spec/models/user_spec.rb )=====&lt;br /&gt;
# Search by user name&lt;br /&gt;
# Search by user name that does not exist&lt;br /&gt;
# Search by user email&lt;br /&gt;
# Search by user email that does not exist&lt;br /&gt;
# Search by user email containing a substring&lt;br /&gt;
# Search by user full name&lt;br /&gt;
# Search by user full name is empty&lt;br /&gt;
# Search by user name and email&lt;br /&gt;
# Search for assignments participated&lt;br /&gt;
=====Assignment Model ( spec/models/assignment_spec.rb )=====&lt;br /&gt;
# Search by user name&lt;br /&gt;
# Search by institution&lt;br /&gt;
# Search by creation date&lt;br /&gt;
# Search by updated date&lt;br /&gt;
=====Rubrics=====&lt;br /&gt;
# Search by name&lt;br /&gt;
# Search by courses used in&lt;br /&gt;
# Search by assignments used in&lt;br /&gt;
=====Reviews=====&lt;br /&gt;
# Search all reviews of a particular team’s work for particular scores or text strings.  &lt;br /&gt;
# Search by score&lt;br /&gt;
# Search by text comment length&lt;br /&gt;
# Search by reviewer and reviewee&lt;br /&gt;
=== Manual Tests ===&lt;br /&gt;
=====Search for User=====&lt;br /&gt;
# Setup: create a user with name=&amp;quot;student&amp;quot; and userId=&amp;quot;5000&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
# Action: Instructor clicks on manage - &amp;gt; users -&amp;gt; in textbox enters name=&amp;quot;student&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
# Response: Relevant details of student, name=&amp;quot;student&amp;quot; is displayed&amp;lt;br&amp;gt;&lt;br /&gt;
# Action: Instructor clicks on manage - &amp;gt; users -&amp;gt; advanced search-&amp;gt;clicks on checkbox student id and enters &amp;quot;5000&amp;quot; and click &amp;quot;ok&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
# Response: Relevant details of student, name=&amp;quot;student&amp;quot; is displayed&amp;lt;br&amp;gt;&lt;br /&gt;
=====Search for Assignments=====&lt;br /&gt;
# Setup create an assignment with name=&amp;quot;assignment&amp;quot; and set a due date&amp;lt;br&amp;gt;&lt;br /&gt;
# Action : Instructor clicks on Manage -&amp;gt; Assignments, in textbox enter &amp;quot;assignment&amp;quot; in relevant tab&amp;lt;br&amp;gt; &lt;br /&gt;
# Response : Relevant assignment should be displayed&amp;lt;br&amp;gt;&lt;br /&gt;
# Action : Instructor clicks on Manage -&amp;gt; Assignments-&amp;gt; drop down and apply filters for due date and enter date and click &amp;quot;ok&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
# Response : Relevant assignments should be displayed&amp;lt;br&amp;gt;&lt;br /&gt;
=====Search for Questionnaires=====&lt;br /&gt;
# Setup : Create a Questionnaire, add questions to it&amp;lt;br&amp;gt;&lt;br /&gt;
# Action : Log in as instructor,  Manage -&amp;gt; Questionnaires, in text box enter text&amp;lt;br&amp;gt;&lt;br /&gt;
# Response : Questionnaires matching text are shown&amp;lt;br&amp;gt;&lt;br /&gt;
# Action : Log in as instructor,  Manage -&amp;gt; Questionnaires, click advanced search and check creation date and enter value&amp;lt;br&amp;gt;&lt;br /&gt;
# Response : Questionnaires matching text are shown&amp;lt;br&amp;gt;&lt;br /&gt;
=====Search for Reviews=====&lt;br /&gt;
# Setup : Setup review for an assignment, login as student and then add review &amp;lt;br&amp;gt;&lt;br /&gt;
# Action : Log in as instructor, Manage -&amp;gt; Assignments, Click on Review Report icon on corresponding assignment&amp;lt;br&amp;gt;&lt;br /&gt;
# Result : Review should be seen&amp;lt;br&amp;gt;&lt;br /&gt;
# Action : Click Advanced search, check review by text  and enter text&amp;lt;br&amp;gt;  &lt;br /&gt;
# Result : Matching review should be visible&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Team:==&lt;br /&gt;
#Nisarg Mayank Chokshi (nmchoks2@ncsu.edu)&lt;br /&gt;
#Omkar Nivrutti Kashid (onkashid@ncsu.edu)&lt;br /&gt;
#Richa Dua (rdua2@ncsu.edu)&lt;br /&gt;
#Steve Victor Menezes  (smeneze@ncsu.edu)&lt;br /&gt;
'''Mentor:''' Harsh Agarwal (hagrawa2@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
==Additional Links:==&lt;br /&gt;
Pull Request: https://github.com/expertiza/expertiza/pull/1659&lt;br /&gt;
GIthub Project Board: https://github.com/stevemenezes/expertiza/projects/1&lt;/div&gt;</summary>
		<author><name>Nmchoks2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1987._Improving_search_facility_in_Expertiza&amp;diff=128489</id>
		<title>CSC/ECE 517 Fall 2019 - E1987. Improving search facility in Expertiza</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1987._Improving_search_facility_in_Expertiza&amp;diff=128489"/>
		<updated>2019-11-11T03:22:03Z</updated>

		<summary type="html">&lt;p&gt;Nmchoks2: /* Automated Tests */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction:==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source application running on Ruby on Rails. It is used for management of courses and the assignments for respective courses, by the faculties and the students. The manage content section of the application has different views which displays information about the users, courses, assignments, questionnaires, and reviews. The application should have a fully functional search functionality throughout the views, so that a user can search any type of data with ease, on the basis of any number of parameters depending on his requirements. Users should be searched on the basis of one more parameters which include name, full name, email, etc. Similarly, assignments should be searched on the basis of name, created date, updated date, etc. However, the search functionality in the existing application is constrained to just a single parameter for users and assignments. Questionnaires management does not have a search functionality implemented as yet. This project works on improving the search functionality of Expertiza, by adding search bars if not present, introducing advanced search feature where user can search on the basis of more than one parameters and making the search functionality appear more elegant.&lt;br /&gt;
&lt;br /&gt;
==Problem Definition:==&lt;br /&gt;
&lt;br /&gt;
#An instructor or administrator can search for a user by name, user-ID, or other characteristics.&lt;br /&gt;
#An instructor should be able to search for assignments by name, due date, or other characteristics.&lt;br /&gt;
#An instructor should be able to search for rubrics (or other questionnaires) by name, or by the courses or assignments they have been used in.&lt;br /&gt;
##For the instructor, there also needs to be a way to quickly find rubrics (and other questionnaires) that have been used in a single course.  It should be possible to search or click somewhere to bring up a list of questionnaires used in the course, expanding only the applicable questionnaires in the list of questionnaires.&lt;br /&gt;
##One should also be able to search for questionnaires by words used in questions that belong to the questionnaires.&lt;br /&gt;
#There should be a way to search all reviews of a particular team’s work for particular scores or text strings.  Reviews should be able to be filtered by score, text comment length, reviewer and reviewee.&lt;br /&gt;
#An instructor or administrator should be able to search for all the assignments that a particular user has participated in.&lt;br /&gt;
#If more than one criteria needs to be specified, there should be an 'Advanced Search' button.&lt;br /&gt;
&lt;br /&gt;
==Proposed Solution:==&lt;br /&gt;
&lt;br /&gt;
==Use Case Diagram==&lt;br /&gt;
[[File:UseCaseExpertizaSearch.png|center]]&lt;br /&gt;
&lt;br /&gt;
==Proposed Code Changes==&lt;br /&gt;
===Search for User:===&lt;br /&gt;
&lt;br /&gt;
In the current system workflow, we found that the user is unable to search in the Manage Users view. In the proposed workflow, we plan to enable the user to search by all the columns in the UI viz. Name, Full name, Email Address, Role, Parent by entering a partial or a complete text that matches with the particular field. We will also allow searching for fields irrespective of the case of the searched string. The user will be able to apply multiple filters at a time and the output of the query will match all filters applied. If no results are found, an empty list will be returned.&lt;br /&gt;
&lt;br /&gt;
Steps to reproduce the proposed workflow:&lt;br /&gt;
:#Log in to expertiza to view the home page&lt;br /&gt;
:#Go to Manage &amp;gt; Users&lt;br /&gt;
:#Type the search string in the search box available on the UI and select the column to search for from the dropdown.&lt;br /&gt;
:#To perform search based on multiple filters, the user can tap on the Advanced Search button adjacent to the Search button, the view renders a hidden div containing textboxes for all the columns, allowing the user to search based on multiple columns.&lt;br /&gt;
:#All the entries that match the specified criteria will be returned.&lt;br /&gt;
:#An empty list is returned if the search criteria doesn't match any valid records in the database.&lt;br /&gt;
&lt;br /&gt;
===Search for Assignments:===&lt;br /&gt;
&lt;br /&gt;
In the current system implementation, searching via the name of the assignment is supported with partial or complete assignment name. However, the search is case sensitive. In the proposed system, the user will be able to search for an assignment using additional filters such as Creation Date and Updated Date along with Assignment Name. The user will also be able to apply multiple filters at a time and the output of the query will match all filters applied. If no results are found, an empty list will be returned.&lt;br /&gt;
&lt;br /&gt;
To search for an assignment by Creation Date, the user will be prompted with a calendar where he can select a date and all the assignments created on or before the selected date will be displayed. &lt;br /&gt;
&lt;br /&gt;
To apply multiple filters, user can tap on the Advanced Search button available, adjacent to the Search button; a hidden div will then be rendered below containing textboxes for all the columns. All assignments that were created before the selected date for Creation Date or Updated Date columns and the ones that match other filters will be returned. A empty list will be returned if the search criteria doesn't match any records in the database.&lt;br /&gt;
&lt;br /&gt;
Steps to reproduce the proposed workflow:&lt;br /&gt;
:#Log in to expertiza to view the home page&lt;br /&gt;
:#Go to Manage &amp;gt; Assignments&lt;br /&gt;
:#Type the search criteria in the available search criteria and select the appropriate field from the dropdown.&lt;br /&gt;
:#To perform search based on multiple filters, the user can tap on the Advanced Search button adjacent to the Search button, the view renders a hidden div containing textboxes for all the columns, allowing the user to search based on multiple columns.&lt;br /&gt;
:#All the entries that match the given criteria will be returned.&lt;br /&gt;
:#An empty list is returned if the search criteria doesn't match any valid records in the database.&lt;br /&gt;
&lt;br /&gt;
===Search for Questionnaires:===&lt;br /&gt;
&lt;br /&gt;
The existing system does not have a search functionality under Questionnaires. The proposed system will implement a search functionality for searching via the name of the questionnaire, the text in the questions within a questionnaire, date of creation, and date updated by entering a partial or a complete text that matches with the particular field. We will also allow searching for fields irrespective of the case of the searched string. The user will be able to apply multiple filters at a time and the output of the query will match all the filters applied. If no results are found, an empty list will be returned.&lt;br /&gt;
&lt;br /&gt;
To search for an assignment by Creation Date, the user will be prompted with a calendar where he can select a date and all the assignments created on or before the selected date will be displayed. &lt;br /&gt;
&lt;br /&gt;
To apply multiple filters, user can tap on the Advanced Search button available, adjacent to the Search button; a hidden div will then be rendered below containing textboxes for all the columns. All assignments that were created before the selected date for Creation Date or Updated Date columns and the ones that match other filters will be returned. A empty list will be returned if the search criteria doesn't match any records in the database. The questionnaires will be grouped on the basis of their courses and will be expanded when clicked.&lt;br /&gt;
&lt;br /&gt;
Steps to reproduce the proposed workflow:&lt;br /&gt;
:#Log in to expertiza to view the home page&lt;br /&gt;
:#Go to Manage &amp;gt; Questionnaires&lt;br /&gt;
:#Type the search criteria in the available search criteria and select the appropriate field from the dropdown.&lt;br /&gt;
:#To perform search based on multiple filters, the user can tap on the Advanced Search button adjacent to the Search button, the view renders a hidden div containing textboxes for all the columns, allowing the user to search based on multiple columns.&lt;br /&gt;
:#All the entries that match the given criteria will be returned.&lt;br /&gt;
:#An empty list is returned if the search criteria doesn't match any valid records in the database.&lt;br /&gt;
&lt;br /&gt;
===Search for Reviews:===&lt;br /&gt;
&lt;br /&gt;
The existing system does not have a search functionality under Reviews. The proposed system will implement a search functionality for searching using the attributes like team name, score, reviewer, comment etc. by entering a partial or a complete text that matches with the particular field. We will also allow searching for fields irrespective of the case of the searched string. The user will be able to apply multiple filters at a time and the output of the query will match all the filters applied. If no results are found, an empty list will be returned.&lt;br /&gt;
&lt;br /&gt;
The user will be able to apply multiple filters at a time and the output of the query will match all filters applied. If no results are found, an empty list will be returned.&lt;br /&gt;
&lt;br /&gt;
Steps to reproduce the proposed workflow:&lt;br /&gt;
:#Log in to expertiza to view the home page&lt;br /&gt;
:#&lt;br /&gt;
:#Type the search criteria in the available search criteria and select the appropriate field from the dropdown.&lt;br /&gt;
:#To perform search based on multiple filters, the user can tap on the Advanced Search button adjacent to the Search button, the view renders a hidden div containing textboxes for all the columns, allowing the user to search based on multiple columns.&lt;br /&gt;
:#All the entries that match the given criteria will be returned.&lt;br /&gt;
:#An empty list is returned if the search criteria doesn't match any valid records in the database.&lt;br /&gt;
&lt;br /&gt;
==Database Design==&lt;br /&gt;
Below is the simplified version of the ER diagram which displays the relationships between the entity sets. Team_users and assignment_questionnaires are many to many relationships which are implemented in table format as show below.&lt;br /&gt;
&lt;br /&gt;
[[File:ER diagram.png|center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Relevant Tables===&lt;br /&gt;
[[File:User table.png|center]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Screen Shot 2018-11-20 at 11.42.06 PM.png|center]]&lt;br /&gt;
&lt;br /&gt;
==Test Plan: ==&lt;br /&gt;
=== Automated Tests ===&lt;br /&gt;
Automated tests in RSpec will be added as we implement the search functionality for each modified file. Most of the tests added will be unit tests that cover the use cases for each flow and changes made in the model as per the requirement description.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
====Test Details:====&lt;br /&gt;
=====User Model ( spec/models/user_spec.rb )=====&lt;br /&gt;
# Search by user name&lt;br /&gt;
# Search by user name that does not exist&lt;br /&gt;
# Search by user email&lt;br /&gt;
# Search by user email that does not exist&lt;br /&gt;
# Search by user email containing a substring&lt;br /&gt;
# Search by user full name&lt;br /&gt;
# Search by user full name is empty&lt;br /&gt;
# Search by user name and email&lt;br /&gt;
# Search for assignments participated&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
=====Assignment Model ( spec/models/assignment_spec.rb )=====&lt;br /&gt;
# Search by user name&lt;br /&gt;
# Search by institution&lt;br /&gt;
# Search by creation date&lt;br /&gt;
# Search by updated date&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
=====Rubrics=====&lt;br /&gt;
# Search by name&lt;br /&gt;
# Search by courses used in&lt;br /&gt;
# Search by assignments used in&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
=====Reviews=====&lt;br /&gt;
# Search all reviews of a particular team’s work for particular scores or text strings.  &lt;br /&gt;
# Search by score&lt;br /&gt;
# Search by text comment length&lt;br /&gt;
# Search by reviewer and reviewee&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Manual Tests ===&lt;br /&gt;
=====Search for User=====&lt;br /&gt;
# Setup: create a user with name=&amp;quot;student&amp;quot; and userId=&amp;quot;5000&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
# Action: Instructor clicks on manage - &amp;gt; users -&amp;gt; in textbox enters name=&amp;quot;student&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
# Response: Relevant details of student, name=&amp;quot;student&amp;quot; is displayed&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
# Action: Instructor clicks on manage - &amp;gt; users -&amp;gt; advanced search-&amp;gt;clicks on checkbox student id and enters &amp;quot;5000&amp;quot; and click &amp;quot;ok&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
# Response: Relevant details of student, name=&amp;quot;student&amp;quot; is displayed&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
=====Search for Assignments=====&lt;br /&gt;
# Setup create an assignment with name=&amp;quot;assignment&amp;quot; and set a due date&amp;lt;br&amp;gt;&lt;br /&gt;
# Action : Instructor clicks on Manage -&amp;gt; Assignments, in textbox enter &amp;quot;assignment&amp;quot; in relevant tab&amp;lt;br&amp;gt; &lt;br /&gt;
# Response : Relevant assignment should be displayed&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
# Action : Instructor clicks on Manage -&amp;gt; Assignments-&amp;gt; drop down and apply filters for due date and enter date and click &amp;quot;ok&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
# Response : Relevant assignments should be displayed&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
=====Search for Questionnaires=====&lt;br /&gt;
# Setup : Create a Questionnaire, add questions to it&amp;lt;br&amp;gt;&lt;br /&gt;
# Action : Log in as instructor,  Manage -&amp;gt; Questionnaires, in text box enter text&amp;lt;br&amp;gt;&lt;br /&gt;
# Response : Questionnaires matching text are shown&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
# Action : Log in as instructor,  Manage -&amp;gt; Questionnaires, click advanced search and check creation date and enter value&amp;lt;br&amp;gt;&lt;br /&gt;
# Response : Questionnaires matching text are shown&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
=====Search for Reviews=====&lt;br /&gt;
# Setup : Setup review for an assignment, login as student and then add review &amp;lt;br&amp;gt;&lt;br /&gt;
# Action : Log in as instructor, Manage -&amp;gt; Assignments, Click on Review Report icon on corresponding assignment&amp;lt;br&amp;gt;&lt;br /&gt;
# Result : Review should be seen&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
# Action : Click Advanced search, check review by text  and enter text&amp;lt;br&amp;gt;  &lt;br /&gt;
# Result : Matching review should be visible&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Nmchoks2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1987._Improving_search_facility_in_Expertiza&amp;diff=128487</id>
		<title>CSC/ECE 517 Fall 2019 - E1987. Improving search facility in Expertiza</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1987._Improving_search_facility_in_Expertiza&amp;diff=128487"/>
		<updated>2019-11-11T03:21:43Z</updated>

		<summary type="html">&lt;p&gt;Nmchoks2: /* Manual Tests */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction:==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source application running on Ruby on Rails. It is used for management of courses and the assignments for respective courses, by the faculties and the students. The manage content section of the application has different views which displays information about the users, courses, assignments, questionnaires, and reviews. The application should have a fully functional search functionality throughout the views, so that a user can search any type of data with ease, on the basis of any number of parameters depending on his requirements. Users should be searched on the basis of one more parameters which include name, full name, email, etc. Similarly, assignments should be searched on the basis of name, created date, updated date, etc. However, the search functionality in the existing application is constrained to just a single parameter for users and assignments. Questionnaires management does not have a search functionality implemented as yet. This project works on improving the search functionality of Expertiza, by adding search bars if not present, introducing advanced search feature where user can search on the basis of more than one parameters and making the search functionality appear more elegant.&lt;br /&gt;
&lt;br /&gt;
==Problem Definition:==&lt;br /&gt;
&lt;br /&gt;
#An instructor or administrator can search for a user by name, user-ID, or other characteristics.&lt;br /&gt;
#An instructor should be able to search for assignments by name, due date, or other characteristics.&lt;br /&gt;
#An instructor should be able to search for rubrics (or other questionnaires) by name, or by the courses or assignments they have been used in.&lt;br /&gt;
##For the instructor, there also needs to be a way to quickly find rubrics (and other questionnaires) that have been used in a single course.  It should be possible to search or click somewhere to bring up a list of questionnaires used in the course, expanding only the applicable questionnaires in the list of questionnaires.&lt;br /&gt;
##One should also be able to search for questionnaires by words used in questions that belong to the questionnaires.&lt;br /&gt;
#There should be a way to search all reviews of a particular team’s work for particular scores or text strings.  Reviews should be able to be filtered by score, text comment length, reviewer and reviewee.&lt;br /&gt;
#An instructor or administrator should be able to search for all the assignments that a particular user has participated in.&lt;br /&gt;
#If more than one criteria needs to be specified, there should be an 'Advanced Search' button.&lt;br /&gt;
&lt;br /&gt;
==Proposed Solution:==&lt;br /&gt;
&lt;br /&gt;
==Use Case Diagram==&lt;br /&gt;
[[File:UseCaseExpertizaSearch.png|center]]&lt;br /&gt;
&lt;br /&gt;
==Proposed Code Changes==&lt;br /&gt;
===Search for User:===&lt;br /&gt;
&lt;br /&gt;
In the current system workflow, we found that the user is unable to search in the Manage Users view. In the proposed workflow, we plan to enable the user to search by all the columns in the UI viz. Name, Full name, Email Address, Role, Parent by entering a partial or a complete text that matches with the particular field. We will also allow searching for fields irrespective of the case of the searched string. The user will be able to apply multiple filters at a time and the output of the query will match all filters applied. If no results are found, an empty list will be returned.&lt;br /&gt;
&lt;br /&gt;
Steps to reproduce the proposed workflow:&lt;br /&gt;
:#Log in to expertiza to view the home page&lt;br /&gt;
:#Go to Manage &amp;gt; Users&lt;br /&gt;
:#Type the search string in the search box available on the UI and select the column to search for from the dropdown.&lt;br /&gt;
:#To perform search based on multiple filters, the user can tap on the Advanced Search button adjacent to the Search button, the view renders a hidden div containing textboxes for all the columns, allowing the user to search based on multiple columns.&lt;br /&gt;
:#All the entries that match the specified criteria will be returned.&lt;br /&gt;
:#An empty list is returned if the search criteria doesn't match any valid records in the database.&lt;br /&gt;
&lt;br /&gt;
===Search for Assignments:===&lt;br /&gt;
&lt;br /&gt;
In the current system implementation, searching via the name of the assignment is supported with partial or complete assignment name. However, the search is case sensitive. In the proposed system, the user will be able to search for an assignment using additional filters such as Creation Date and Updated Date along with Assignment Name. The user will also be able to apply multiple filters at a time and the output of the query will match all filters applied. If no results are found, an empty list will be returned.&lt;br /&gt;
&lt;br /&gt;
To search for an assignment by Creation Date, the user will be prompted with a calendar where he can select a date and all the assignments created on or before the selected date will be displayed. &lt;br /&gt;
&lt;br /&gt;
To apply multiple filters, user can tap on the Advanced Search button available, adjacent to the Search button; a hidden div will then be rendered below containing textboxes for all the columns. All assignments that were created before the selected date for Creation Date or Updated Date columns and the ones that match other filters will be returned. A empty list will be returned if the search criteria doesn't match any records in the database.&lt;br /&gt;
&lt;br /&gt;
Steps to reproduce the proposed workflow:&lt;br /&gt;
:#Log in to expertiza to view the home page&lt;br /&gt;
:#Go to Manage &amp;gt; Assignments&lt;br /&gt;
:#Type the search criteria in the available search criteria and select the appropriate field from the dropdown.&lt;br /&gt;
:#To perform search based on multiple filters, the user can tap on the Advanced Search button adjacent to the Search button, the view renders a hidden div containing textboxes for all the columns, allowing the user to search based on multiple columns.&lt;br /&gt;
:#All the entries that match the given criteria will be returned.&lt;br /&gt;
:#An empty list is returned if the search criteria doesn't match any valid records in the database.&lt;br /&gt;
&lt;br /&gt;
===Search for Questionnaires:===&lt;br /&gt;
&lt;br /&gt;
The existing system does not have a search functionality under Questionnaires. The proposed system will implement a search functionality for searching via the name of the questionnaire, the text in the questions within a questionnaire, date of creation, and date updated by entering a partial or a complete text that matches with the particular field. We will also allow searching for fields irrespective of the case of the searched string. The user will be able to apply multiple filters at a time and the output of the query will match all the filters applied. If no results are found, an empty list will be returned.&lt;br /&gt;
&lt;br /&gt;
To search for an assignment by Creation Date, the user will be prompted with a calendar where he can select a date and all the assignments created on or before the selected date will be displayed. &lt;br /&gt;
&lt;br /&gt;
To apply multiple filters, user can tap on the Advanced Search button available, adjacent to the Search button; a hidden div will then be rendered below containing textboxes for all the columns. All assignments that were created before the selected date for Creation Date or Updated Date columns and the ones that match other filters will be returned. A empty list will be returned if the search criteria doesn't match any records in the database. The questionnaires will be grouped on the basis of their courses and will be expanded when clicked.&lt;br /&gt;
&lt;br /&gt;
Steps to reproduce the proposed workflow:&lt;br /&gt;
:#Log in to expertiza to view the home page&lt;br /&gt;
:#Go to Manage &amp;gt; Questionnaires&lt;br /&gt;
:#Type the search criteria in the available search criteria and select the appropriate field from the dropdown.&lt;br /&gt;
:#To perform search based on multiple filters, the user can tap on the Advanced Search button adjacent to the Search button, the view renders a hidden div containing textboxes for all the columns, allowing the user to search based on multiple columns.&lt;br /&gt;
:#All the entries that match the given criteria will be returned.&lt;br /&gt;
:#An empty list is returned if the search criteria doesn't match any valid records in the database.&lt;br /&gt;
&lt;br /&gt;
===Search for Reviews:===&lt;br /&gt;
&lt;br /&gt;
The existing system does not have a search functionality under Reviews. The proposed system will implement a search functionality for searching using the attributes like team name, score, reviewer, comment etc. by entering a partial or a complete text that matches with the particular field. We will also allow searching for fields irrespective of the case of the searched string. The user will be able to apply multiple filters at a time and the output of the query will match all the filters applied. If no results are found, an empty list will be returned.&lt;br /&gt;
&lt;br /&gt;
The user will be able to apply multiple filters at a time and the output of the query will match all filters applied. If no results are found, an empty list will be returned.&lt;br /&gt;
&lt;br /&gt;
Steps to reproduce the proposed workflow:&lt;br /&gt;
:#Log in to expertiza to view the home page&lt;br /&gt;
:#&lt;br /&gt;
:#Type the search criteria in the available search criteria and select the appropriate field from the dropdown.&lt;br /&gt;
:#To perform search based on multiple filters, the user can tap on the Advanced Search button adjacent to the Search button, the view renders a hidden div containing textboxes for all the columns, allowing the user to search based on multiple columns.&lt;br /&gt;
:#All the entries that match the given criteria will be returned.&lt;br /&gt;
:#An empty list is returned if the search criteria doesn't match any valid records in the database.&lt;br /&gt;
&lt;br /&gt;
==Database Design==&lt;br /&gt;
Below is the simplified version of the ER diagram which displays the relationships between the entity sets. Team_users and assignment_questionnaires are many to many relationships which are implemented in table format as show below.&lt;br /&gt;
&lt;br /&gt;
[[File:ER diagram.png|center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Relevant Tables===&lt;br /&gt;
[[File:User table.png|center]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Screen Shot 2018-11-20 at 11.42.06 PM.png|center]]&lt;br /&gt;
&lt;br /&gt;
==Test Plan: ==&lt;br /&gt;
=== Automated Tests ===&lt;br /&gt;
Automated tests in RSpec will be added as we implement the search functionality for each modified file. Most of the tests added will be unit tests that cover the use cases for each flow and changes made in the model as per the requirement description.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
====Test Details:====&lt;br /&gt;
=====User Model ( spec/models/user_spec.rb )=====&lt;br /&gt;
# Search by user name&lt;br /&gt;
# Search by user name that does not exist&lt;br /&gt;
# Search by user email&lt;br /&gt;
# Search by user email that does not exist&lt;br /&gt;
# Search by user email containing a substring&lt;br /&gt;
# Search by user full name&lt;br /&gt;
# Search by user full name is empty&lt;br /&gt;
# Search by user name and email&lt;br /&gt;
# Search for assignments participated&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
=====Assignment Model ( spec/models/assignment_spec.rb )=====&lt;br /&gt;
# Search by user name&lt;br /&gt;
# Search by institution&lt;br /&gt;
# Search by creation date&lt;br /&gt;
# Search by updated date&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
=====Rubrics=====&lt;br /&gt;
# Search by name&lt;br /&gt;
# Search by courses used in&lt;br /&gt;
# Search by assignments used in&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
=====Reviews=====&lt;br /&gt;
# Search all reviews of a particular team’s work for particular scores or text strings.  &lt;br /&gt;
# Search by score&lt;br /&gt;
# Search by text comment length&lt;br /&gt;
# Search by reviewer and reviewee&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
=== Manual Tests ===&lt;br /&gt;
=====Search for User=====&lt;br /&gt;
# Setup: create a user with name=&amp;quot;student&amp;quot; and userId=&amp;quot;5000&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
# Action: Instructor clicks on manage - &amp;gt; users -&amp;gt; in textbox enters name=&amp;quot;student&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
# Response: Relevant details of student, name=&amp;quot;student&amp;quot; is displayed&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
# Action: Instructor clicks on manage - &amp;gt; users -&amp;gt; advanced search-&amp;gt;clicks on checkbox student id and enters &amp;quot;5000&amp;quot; and click &amp;quot;ok&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
# Response: Relevant details of student, name=&amp;quot;student&amp;quot; is displayed&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
=====Search for Assignments=====&lt;br /&gt;
# Setup create an assignment with name=&amp;quot;assignment&amp;quot; and set a due date&amp;lt;br&amp;gt;&lt;br /&gt;
# Action : Instructor clicks on Manage -&amp;gt; Assignments, in textbox enter &amp;quot;assignment&amp;quot; in relevant tab&amp;lt;br&amp;gt; &lt;br /&gt;
# Response : Relevant assignment should be displayed&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
# Action : Instructor clicks on Manage -&amp;gt; Assignments-&amp;gt; drop down and apply filters for due date and enter date and click &amp;quot;ok&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
# Response : Relevant assignments should be displayed&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
=====Search for Questionnaires=====&lt;br /&gt;
# Setup : Create a Questionnaire, add questions to it&amp;lt;br&amp;gt;&lt;br /&gt;
# Action : Log in as instructor,  Manage -&amp;gt; Questionnaires, in text box enter text&amp;lt;br&amp;gt;&lt;br /&gt;
# Response : Questionnaires matching text are shown&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
# Action : Log in as instructor,  Manage -&amp;gt; Questionnaires, click advanced search and check creation date and enter value&amp;lt;br&amp;gt;&lt;br /&gt;
# Response : Questionnaires matching text are shown&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
=====Search for Reviews=====&lt;br /&gt;
# Setup : Setup review for an assignment, login as student and then add review &amp;lt;br&amp;gt;&lt;br /&gt;
# Action : Log in as instructor, Manage -&amp;gt; Assignments, Click on Review Report icon on corresponding assignment&amp;lt;br&amp;gt;&lt;br /&gt;
# Result : Review should be seen&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
# Action : Click Advanced search, check review by text  and enter text&amp;lt;br&amp;gt;  &lt;br /&gt;
# Result : Matching review should be visible&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Nmchoks2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1987._Improving_search_facility_in_Expertiza&amp;diff=128486</id>
		<title>CSC/ECE 517 Fall 2019 - E1987. Improving search facility in Expertiza</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1987._Improving_search_facility_in_Expertiza&amp;diff=128486"/>
		<updated>2019-11-11T03:21:27Z</updated>

		<summary type="html">&lt;p&gt;Nmchoks2: /* Manual Tests */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction:==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source application running on Ruby on Rails. It is used for management of courses and the assignments for respective courses, by the faculties and the students. The manage content section of the application has different views which displays information about the users, courses, assignments, questionnaires, and reviews. The application should have a fully functional search functionality throughout the views, so that a user can search any type of data with ease, on the basis of any number of parameters depending on his requirements. Users should be searched on the basis of one more parameters which include name, full name, email, etc. Similarly, assignments should be searched on the basis of name, created date, updated date, etc. However, the search functionality in the existing application is constrained to just a single parameter for users and assignments. Questionnaires management does not have a search functionality implemented as yet. This project works on improving the search functionality of Expertiza, by adding search bars if not present, introducing advanced search feature where user can search on the basis of more than one parameters and making the search functionality appear more elegant.&lt;br /&gt;
&lt;br /&gt;
==Problem Definition:==&lt;br /&gt;
&lt;br /&gt;
#An instructor or administrator can search for a user by name, user-ID, or other characteristics.&lt;br /&gt;
#An instructor should be able to search for assignments by name, due date, or other characteristics.&lt;br /&gt;
#An instructor should be able to search for rubrics (or other questionnaires) by name, or by the courses or assignments they have been used in.&lt;br /&gt;
##For the instructor, there also needs to be a way to quickly find rubrics (and other questionnaires) that have been used in a single course.  It should be possible to search or click somewhere to bring up a list of questionnaires used in the course, expanding only the applicable questionnaires in the list of questionnaires.&lt;br /&gt;
##One should also be able to search for questionnaires by words used in questions that belong to the questionnaires.&lt;br /&gt;
#There should be a way to search all reviews of a particular team’s work for particular scores or text strings.  Reviews should be able to be filtered by score, text comment length, reviewer and reviewee.&lt;br /&gt;
#An instructor or administrator should be able to search for all the assignments that a particular user has participated in.&lt;br /&gt;
#If more than one criteria needs to be specified, there should be an 'Advanced Search' button.&lt;br /&gt;
&lt;br /&gt;
==Proposed Solution:==&lt;br /&gt;
&lt;br /&gt;
==Use Case Diagram==&lt;br /&gt;
[[File:UseCaseExpertizaSearch.png|center]]&lt;br /&gt;
&lt;br /&gt;
==Proposed Code Changes==&lt;br /&gt;
===Search for User:===&lt;br /&gt;
&lt;br /&gt;
In the current system workflow, we found that the user is unable to search in the Manage Users view. In the proposed workflow, we plan to enable the user to search by all the columns in the UI viz. Name, Full name, Email Address, Role, Parent by entering a partial or a complete text that matches with the particular field. We will also allow searching for fields irrespective of the case of the searched string. The user will be able to apply multiple filters at a time and the output of the query will match all filters applied. If no results are found, an empty list will be returned.&lt;br /&gt;
&lt;br /&gt;
Steps to reproduce the proposed workflow:&lt;br /&gt;
:#Log in to expertiza to view the home page&lt;br /&gt;
:#Go to Manage &amp;gt; Users&lt;br /&gt;
:#Type the search string in the search box available on the UI and select the column to search for from the dropdown.&lt;br /&gt;
:#To perform search based on multiple filters, the user can tap on the Advanced Search button adjacent to the Search button, the view renders a hidden div containing textboxes for all the columns, allowing the user to search based on multiple columns.&lt;br /&gt;
:#All the entries that match the specified criteria will be returned.&lt;br /&gt;
:#An empty list is returned if the search criteria doesn't match any valid records in the database.&lt;br /&gt;
&lt;br /&gt;
===Search for Assignments:===&lt;br /&gt;
&lt;br /&gt;
In the current system implementation, searching via the name of the assignment is supported with partial or complete assignment name. However, the search is case sensitive. In the proposed system, the user will be able to search for an assignment using additional filters such as Creation Date and Updated Date along with Assignment Name. The user will also be able to apply multiple filters at a time and the output of the query will match all filters applied. If no results are found, an empty list will be returned.&lt;br /&gt;
&lt;br /&gt;
To search for an assignment by Creation Date, the user will be prompted with a calendar where he can select a date and all the assignments created on or before the selected date will be displayed. &lt;br /&gt;
&lt;br /&gt;
To apply multiple filters, user can tap on the Advanced Search button available, adjacent to the Search button; a hidden div will then be rendered below containing textboxes for all the columns. All assignments that were created before the selected date for Creation Date or Updated Date columns and the ones that match other filters will be returned. A empty list will be returned if the search criteria doesn't match any records in the database.&lt;br /&gt;
&lt;br /&gt;
Steps to reproduce the proposed workflow:&lt;br /&gt;
:#Log in to expertiza to view the home page&lt;br /&gt;
:#Go to Manage &amp;gt; Assignments&lt;br /&gt;
:#Type the search criteria in the available search criteria and select the appropriate field from the dropdown.&lt;br /&gt;
:#To perform search based on multiple filters, the user can tap on the Advanced Search button adjacent to the Search button, the view renders a hidden div containing textboxes for all the columns, allowing the user to search based on multiple columns.&lt;br /&gt;
:#All the entries that match the given criteria will be returned.&lt;br /&gt;
:#An empty list is returned if the search criteria doesn't match any valid records in the database.&lt;br /&gt;
&lt;br /&gt;
===Search for Questionnaires:===&lt;br /&gt;
&lt;br /&gt;
The existing system does not have a search functionality under Questionnaires. The proposed system will implement a search functionality for searching via the name of the questionnaire, the text in the questions within a questionnaire, date of creation, and date updated by entering a partial or a complete text that matches with the particular field. We will also allow searching for fields irrespective of the case of the searched string. The user will be able to apply multiple filters at a time and the output of the query will match all the filters applied. If no results are found, an empty list will be returned.&lt;br /&gt;
&lt;br /&gt;
To search for an assignment by Creation Date, the user will be prompted with a calendar where he can select a date and all the assignments created on or before the selected date will be displayed. &lt;br /&gt;
&lt;br /&gt;
To apply multiple filters, user can tap on the Advanced Search button available, adjacent to the Search button; a hidden div will then be rendered below containing textboxes for all the columns. All assignments that were created before the selected date for Creation Date or Updated Date columns and the ones that match other filters will be returned. A empty list will be returned if the search criteria doesn't match any records in the database. The questionnaires will be grouped on the basis of their courses and will be expanded when clicked.&lt;br /&gt;
&lt;br /&gt;
Steps to reproduce the proposed workflow:&lt;br /&gt;
:#Log in to expertiza to view the home page&lt;br /&gt;
:#Go to Manage &amp;gt; Questionnaires&lt;br /&gt;
:#Type the search criteria in the available search criteria and select the appropriate field from the dropdown.&lt;br /&gt;
:#To perform search based on multiple filters, the user can tap on the Advanced Search button adjacent to the Search button, the view renders a hidden div containing textboxes for all the columns, allowing the user to search based on multiple columns.&lt;br /&gt;
:#All the entries that match the given criteria will be returned.&lt;br /&gt;
:#An empty list is returned if the search criteria doesn't match any valid records in the database.&lt;br /&gt;
&lt;br /&gt;
===Search for Reviews:===&lt;br /&gt;
&lt;br /&gt;
The existing system does not have a search functionality under Reviews. The proposed system will implement a search functionality for searching using the attributes like team name, score, reviewer, comment etc. by entering a partial or a complete text that matches with the particular field. We will also allow searching for fields irrespective of the case of the searched string. The user will be able to apply multiple filters at a time and the output of the query will match all the filters applied. If no results are found, an empty list will be returned.&lt;br /&gt;
&lt;br /&gt;
The user will be able to apply multiple filters at a time and the output of the query will match all filters applied. If no results are found, an empty list will be returned.&lt;br /&gt;
&lt;br /&gt;
Steps to reproduce the proposed workflow:&lt;br /&gt;
:#Log in to expertiza to view the home page&lt;br /&gt;
:#&lt;br /&gt;
:#Type the search criteria in the available search criteria and select the appropriate field from the dropdown.&lt;br /&gt;
:#To perform search based on multiple filters, the user can tap on the Advanced Search button adjacent to the Search button, the view renders a hidden div containing textboxes for all the columns, allowing the user to search based on multiple columns.&lt;br /&gt;
:#All the entries that match the given criteria will be returned.&lt;br /&gt;
:#An empty list is returned if the search criteria doesn't match any valid records in the database.&lt;br /&gt;
&lt;br /&gt;
==Database Design==&lt;br /&gt;
Below is the simplified version of the ER diagram which displays the relationships between the entity sets. Team_users and assignment_questionnaires are many to many relationships which are implemented in table format as show below.&lt;br /&gt;
&lt;br /&gt;
[[File:ER diagram.png|center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Relevant Tables===&lt;br /&gt;
[[File:User table.png|center]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Screen Shot 2018-11-20 at 11.42.06 PM.png|center]]&lt;br /&gt;
&lt;br /&gt;
==Test Plan: ==&lt;br /&gt;
=== Automated Tests ===&lt;br /&gt;
Automated tests in RSpec will be added as we implement the search functionality for each modified file. Most of the tests added will be unit tests that cover the use cases for each flow and changes made in the model as per the requirement description.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
====Test Details:====&lt;br /&gt;
=====User Model ( spec/models/user_spec.rb )=====&lt;br /&gt;
# Search by user name&lt;br /&gt;
# Search by user name that does not exist&lt;br /&gt;
# Search by user email&lt;br /&gt;
# Search by user email that does not exist&lt;br /&gt;
# Search by user email containing a substring&lt;br /&gt;
# Search by user full name&lt;br /&gt;
# Search by user full name is empty&lt;br /&gt;
# Search by user name and email&lt;br /&gt;
# Search for assignments participated&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
=====Assignment Model ( spec/models/assignment_spec.rb )=====&lt;br /&gt;
# Search by user name&lt;br /&gt;
# Search by institution&lt;br /&gt;
# Search by creation date&lt;br /&gt;
# Search by updated date&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
=====Rubrics=====&lt;br /&gt;
# Search by name&lt;br /&gt;
# Search by courses used in&lt;br /&gt;
# Search by assignments used in&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
=====Reviews=====&lt;br /&gt;
# Search all reviews of a particular team’s work for particular scores or text strings.  &lt;br /&gt;
# Search by score&lt;br /&gt;
# Search by text comment length&lt;br /&gt;
# Search by reviewer and reviewee&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
=== Manual Tests ===&lt;br /&gt;
=====Search for User=====&lt;br /&gt;
# Setup: create a user with name=&amp;quot;student&amp;quot; and userId=&amp;quot;5000&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
# Action: Instructor clicks on manage - &amp;gt; users -&amp;gt; in textbox enters name=&amp;quot;student&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
# Response: Relevant details of student, name=&amp;quot;student&amp;quot; is displayed&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
# Action: Instructor clicks on manage - &amp;gt; users -&amp;gt; advanced search-&amp;gt;clicks on checkbox student id and enters &amp;quot;5000&amp;quot; and click &amp;quot;ok&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
# Response: Relevant details of student, name=&amp;quot;student&amp;quot; is displayed&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Search for Assignments=====&lt;br /&gt;
# Setup create an assignment with name=&amp;quot;assignment&amp;quot; and set a due date&amp;lt;br&amp;gt;&lt;br /&gt;
# Action : Instructor clicks on Manage -&amp;gt; Assignments, in textbox enter &amp;quot;assignment&amp;quot; in relevant tab&amp;lt;br&amp;gt; &lt;br /&gt;
# Response : Relevant assignment should be displayed&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
# Action : Instructor clicks on Manage -&amp;gt; Assignments-&amp;gt; drop down and apply filters for due date and enter date and click &amp;quot;ok&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
# Response : Relevant assignments should be displayed&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Search for Questionnaires=====&lt;br /&gt;
# Setup : Create a Questionnaire, add questions to it&amp;lt;br&amp;gt;&lt;br /&gt;
# Action : Log in as instructor,  Manage -&amp;gt; Questionnaires, in text box enter text&amp;lt;br&amp;gt;&lt;br /&gt;
# Response : Questionnaires matching text are shown&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
# Action : Log in as instructor,  Manage -&amp;gt; Questionnaires, click advanced search and check creation date and enter value&amp;lt;br&amp;gt;&lt;br /&gt;
# Response : Questionnaires matching text are shown&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Search for Reviews=====&lt;br /&gt;
# Setup : Setup review for an assignment, login as student and then add review &amp;lt;br&amp;gt;&lt;br /&gt;
# Action : Log in as instructor, Manage -&amp;gt; Assignments, Click on Review Report icon on corresponding assignment&amp;lt;br&amp;gt;&lt;br /&gt;
# Result : Review should be seen&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
# Action : Click Advanced search, check review by text  and enter text&amp;lt;br&amp;gt;  &lt;br /&gt;
# Result : Matching review should be visible&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Nmchoks2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1987._Improving_search_facility_in_Expertiza&amp;diff=128484</id>
		<title>CSC/ECE 517 Fall 2019 - E1987. Improving search facility in Expertiza</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1987._Improving_search_facility_in_Expertiza&amp;diff=128484"/>
		<updated>2019-11-11T03:21:03Z</updated>

		<summary type="html">&lt;p&gt;Nmchoks2: /* Manual Tests */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction:==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source application running on Ruby on Rails. It is used for management of courses and the assignments for respective courses, by the faculties and the students. The manage content section of the application has different views which displays information about the users, courses, assignments, questionnaires, and reviews. The application should have a fully functional search functionality throughout the views, so that a user can search any type of data with ease, on the basis of any number of parameters depending on his requirements. Users should be searched on the basis of one more parameters which include name, full name, email, etc. Similarly, assignments should be searched on the basis of name, created date, updated date, etc. However, the search functionality in the existing application is constrained to just a single parameter for users and assignments. Questionnaires management does not have a search functionality implemented as yet. This project works on improving the search functionality of Expertiza, by adding search bars if not present, introducing advanced search feature where user can search on the basis of more than one parameters and making the search functionality appear more elegant.&lt;br /&gt;
&lt;br /&gt;
==Problem Definition:==&lt;br /&gt;
&lt;br /&gt;
#An instructor or administrator can search for a user by name, user-ID, or other characteristics.&lt;br /&gt;
#An instructor should be able to search for assignments by name, due date, or other characteristics.&lt;br /&gt;
#An instructor should be able to search for rubrics (or other questionnaires) by name, or by the courses or assignments they have been used in.&lt;br /&gt;
##For the instructor, there also needs to be a way to quickly find rubrics (and other questionnaires) that have been used in a single course.  It should be possible to search or click somewhere to bring up a list of questionnaires used in the course, expanding only the applicable questionnaires in the list of questionnaires.&lt;br /&gt;
##One should also be able to search for questionnaires by words used in questions that belong to the questionnaires.&lt;br /&gt;
#There should be a way to search all reviews of a particular team’s work for particular scores or text strings.  Reviews should be able to be filtered by score, text comment length, reviewer and reviewee.&lt;br /&gt;
#An instructor or administrator should be able to search for all the assignments that a particular user has participated in.&lt;br /&gt;
#If more than one criteria needs to be specified, there should be an 'Advanced Search' button.&lt;br /&gt;
&lt;br /&gt;
==Proposed Solution:==&lt;br /&gt;
&lt;br /&gt;
==Use Case Diagram==&lt;br /&gt;
[[File:UseCaseExpertizaSearch.png|center]]&lt;br /&gt;
&lt;br /&gt;
==Proposed Code Changes==&lt;br /&gt;
===Search for User:===&lt;br /&gt;
&lt;br /&gt;
In the current system workflow, we found that the user is unable to search in the Manage Users view. In the proposed workflow, we plan to enable the user to search by all the columns in the UI viz. Name, Full name, Email Address, Role, Parent by entering a partial or a complete text that matches with the particular field. We will also allow searching for fields irrespective of the case of the searched string. The user will be able to apply multiple filters at a time and the output of the query will match all filters applied. If no results are found, an empty list will be returned.&lt;br /&gt;
&lt;br /&gt;
Steps to reproduce the proposed workflow:&lt;br /&gt;
:#Log in to expertiza to view the home page&lt;br /&gt;
:#Go to Manage &amp;gt; Users&lt;br /&gt;
:#Type the search string in the search box available on the UI and select the column to search for from the dropdown.&lt;br /&gt;
:#To perform search based on multiple filters, the user can tap on the Advanced Search button adjacent to the Search button, the view renders a hidden div containing textboxes for all the columns, allowing the user to search based on multiple columns.&lt;br /&gt;
:#All the entries that match the specified criteria will be returned.&lt;br /&gt;
:#An empty list is returned if the search criteria doesn't match any valid records in the database.&lt;br /&gt;
&lt;br /&gt;
===Search for Assignments:===&lt;br /&gt;
&lt;br /&gt;
In the current system implementation, searching via the name of the assignment is supported with partial or complete assignment name. However, the search is case sensitive. In the proposed system, the user will be able to search for an assignment using additional filters such as Creation Date and Updated Date along with Assignment Name. The user will also be able to apply multiple filters at a time and the output of the query will match all filters applied. If no results are found, an empty list will be returned.&lt;br /&gt;
&lt;br /&gt;
To search for an assignment by Creation Date, the user will be prompted with a calendar where he can select a date and all the assignments created on or before the selected date will be displayed. &lt;br /&gt;
&lt;br /&gt;
To apply multiple filters, user can tap on the Advanced Search button available, adjacent to the Search button; a hidden div will then be rendered below containing textboxes for all the columns. All assignments that were created before the selected date for Creation Date or Updated Date columns and the ones that match other filters will be returned. A empty list will be returned if the search criteria doesn't match any records in the database.&lt;br /&gt;
&lt;br /&gt;
Steps to reproduce the proposed workflow:&lt;br /&gt;
:#Log in to expertiza to view the home page&lt;br /&gt;
:#Go to Manage &amp;gt; Assignments&lt;br /&gt;
:#Type the search criteria in the available search criteria and select the appropriate field from the dropdown.&lt;br /&gt;
:#To perform search based on multiple filters, the user can tap on the Advanced Search button adjacent to the Search button, the view renders a hidden div containing textboxes for all the columns, allowing the user to search based on multiple columns.&lt;br /&gt;
:#All the entries that match the given criteria will be returned.&lt;br /&gt;
:#An empty list is returned if the search criteria doesn't match any valid records in the database.&lt;br /&gt;
&lt;br /&gt;
===Search for Questionnaires:===&lt;br /&gt;
&lt;br /&gt;
The existing system does not have a search functionality under Questionnaires. The proposed system will implement a search functionality for searching via the name of the questionnaire, the text in the questions within a questionnaire, date of creation, and date updated by entering a partial or a complete text that matches with the particular field. We will also allow searching for fields irrespective of the case of the searched string. The user will be able to apply multiple filters at a time and the output of the query will match all the filters applied. If no results are found, an empty list will be returned.&lt;br /&gt;
&lt;br /&gt;
To search for an assignment by Creation Date, the user will be prompted with a calendar where he can select a date and all the assignments created on or before the selected date will be displayed. &lt;br /&gt;
&lt;br /&gt;
To apply multiple filters, user can tap on the Advanced Search button available, adjacent to the Search button; a hidden div will then be rendered below containing textboxes for all the columns. All assignments that were created before the selected date for Creation Date or Updated Date columns and the ones that match other filters will be returned. A empty list will be returned if the search criteria doesn't match any records in the database. The questionnaires will be grouped on the basis of their courses and will be expanded when clicked.&lt;br /&gt;
&lt;br /&gt;
Steps to reproduce the proposed workflow:&lt;br /&gt;
:#Log in to expertiza to view the home page&lt;br /&gt;
:#Go to Manage &amp;gt; Questionnaires&lt;br /&gt;
:#Type the search criteria in the available search criteria and select the appropriate field from the dropdown.&lt;br /&gt;
:#To perform search based on multiple filters, the user can tap on the Advanced Search button adjacent to the Search button, the view renders a hidden div containing textboxes for all the columns, allowing the user to search based on multiple columns.&lt;br /&gt;
:#All the entries that match the given criteria will be returned.&lt;br /&gt;
:#An empty list is returned if the search criteria doesn't match any valid records in the database.&lt;br /&gt;
&lt;br /&gt;
===Search for Reviews:===&lt;br /&gt;
&lt;br /&gt;
The existing system does not have a search functionality under Reviews. The proposed system will implement a search functionality for searching using the attributes like team name, score, reviewer, comment etc. by entering a partial or a complete text that matches with the particular field. We will also allow searching for fields irrespective of the case of the searched string. The user will be able to apply multiple filters at a time and the output of the query will match all the filters applied. If no results are found, an empty list will be returned.&lt;br /&gt;
&lt;br /&gt;
The user will be able to apply multiple filters at a time and the output of the query will match all filters applied. If no results are found, an empty list will be returned.&lt;br /&gt;
&lt;br /&gt;
Steps to reproduce the proposed workflow:&lt;br /&gt;
:#Log in to expertiza to view the home page&lt;br /&gt;
:#&lt;br /&gt;
:#Type the search criteria in the available search criteria and select the appropriate field from the dropdown.&lt;br /&gt;
:#To perform search based on multiple filters, the user can tap on the Advanced Search button adjacent to the Search button, the view renders a hidden div containing textboxes for all the columns, allowing the user to search based on multiple columns.&lt;br /&gt;
:#All the entries that match the given criteria will be returned.&lt;br /&gt;
:#An empty list is returned if the search criteria doesn't match any valid records in the database.&lt;br /&gt;
&lt;br /&gt;
==Database Design==&lt;br /&gt;
Below is the simplified version of the ER diagram which displays the relationships between the entity sets. Team_users and assignment_questionnaires are many to many relationships which are implemented in table format as show below.&lt;br /&gt;
&lt;br /&gt;
[[File:ER diagram.png|center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Relevant Tables===&lt;br /&gt;
[[File:User table.png|center]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Screen Shot 2018-11-20 at 11.42.06 PM.png|center]]&lt;br /&gt;
&lt;br /&gt;
==Test Plan: ==&lt;br /&gt;
=== Automated Tests ===&lt;br /&gt;
Automated tests in RSpec will be added as we implement the search functionality for each modified file. Most of the tests added will be unit tests that cover the use cases for each flow and changes made in the model as per the requirement description.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
====Test Details:====&lt;br /&gt;
=====User Model ( spec/models/user_spec.rb )=====&lt;br /&gt;
# Search by user name&lt;br /&gt;
# Search by user name that does not exist&lt;br /&gt;
# Search by user email&lt;br /&gt;
# Search by user email that does not exist&lt;br /&gt;
# Search by user email containing a substring&lt;br /&gt;
# Search by user full name&lt;br /&gt;
# Search by user full name is empty&lt;br /&gt;
# Search by user name and email&lt;br /&gt;
# Search for assignments participated&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
=====Assignment Model ( spec/models/assignment_spec.rb )=====&lt;br /&gt;
# Search by user name&lt;br /&gt;
# Search by institution&lt;br /&gt;
# Search by creation date&lt;br /&gt;
# Search by updated date&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
=====Rubrics=====&lt;br /&gt;
# Search by name&lt;br /&gt;
# Search by courses used in&lt;br /&gt;
# Search by assignments used in&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
=====Reviews=====&lt;br /&gt;
# Search all reviews of a particular team’s work for particular scores or text strings.  &lt;br /&gt;
# Search by score&lt;br /&gt;
# Search by text comment length&lt;br /&gt;
# Search by reviewer and reviewee&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
=== Manual Tests ===&lt;br /&gt;
=====Search for User=====&lt;br /&gt;
# Setup: create a user with name=&amp;quot;student&amp;quot; and userId=&amp;quot;5000&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
# Action: Instructor clicks on manage - &amp;gt; users -&amp;gt; in textbox enters name=&amp;quot;student&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
# Response: Relevant details of student, name=&amp;quot;student&amp;quot; is displayed&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Action: Instructor clicks on manage - &amp;gt; users -&amp;gt; advanced search-&amp;gt;clicks on checkbox student id and enters &amp;quot;5000&amp;quot; and click &amp;quot;ok&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
# Response: Relevant details of student, name=&amp;quot;student&amp;quot; is displayed&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Search for Assignments=====&lt;br /&gt;
# Setup create an assignment with name=&amp;quot;assignment&amp;quot; and set a due date&amp;lt;br&amp;gt;&lt;br /&gt;
# Action : Instructor clicks on Manage -&amp;gt; Assignments, in textbox enter &amp;quot;assignment&amp;quot; in relevant tab&amp;lt;br&amp;gt; &lt;br /&gt;
# Response : Relevant assignment should be displayed&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Action : Instructor clicks on Manage -&amp;gt; Assignments-&amp;gt; drop down and apply filters for due date and enter date and click &amp;quot;ok&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
# Response : Relevant assignments should be displayed&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Search for Questionnaires=====&lt;br /&gt;
# Setup : Create a Questionnaire, add questions to it&amp;lt;br&amp;gt;&lt;br /&gt;
# Action : Log in as instructor,  Manage -&amp;gt; Questionnaires, in text box enter text&amp;lt;br&amp;gt;&lt;br /&gt;
# Response : Questionnaires matching text are shown&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Action : Log in as instructor,  Manage -&amp;gt; Questionnaires, click advanced search and check creation date and enter value&amp;lt;br&amp;gt;&lt;br /&gt;
# Response : Questionnaires matching text are shown&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Search for Reviews=====&lt;br /&gt;
# Setup : Setup review for an assignment, login as student and then add review &amp;lt;br&amp;gt;&lt;br /&gt;
# Action : Log in as instructor, Manage -&amp;gt; Assignments, Click on Review Report icon on corresponding assignment&amp;lt;br&amp;gt;&lt;br /&gt;
# Result : Review should be seen&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Action : Click Advanced search, check review by text  and enter text&amp;lt;br&amp;gt;  &lt;br /&gt;
# Result : Matching review should be visible&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Nmchoks2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1987._Improving_search_facility_in_Expertiza&amp;diff=128483</id>
		<title>CSC/ECE 517 Fall 2019 - E1987. Improving search facility in Expertiza</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1987._Improving_search_facility_in_Expertiza&amp;diff=128483"/>
		<updated>2019-11-11T03:20:35Z</updated>

		<summary type="html">&lt;p&gt;Nmchoks2: /* Test Plan: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction:==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source application running on Ruby on Rails. It is used for management of courses and the assignments for respective courses, by the faculties and the students. The manage content section of the application has different views which displays information about the users, courses, assignments, questionnaires, and reviews. The application should have a fully functional search functionality throughout the views, so that a user can search any type of data with ease, on the basis of any number of parameters depending on his requirements. Users should be searched on the basis of one more parameters which include name, full name, email, etc. Similarly, assignments should be searched on the basis of name, created date, updated date, etc. However, the search functionality in the existing application is constrained to just a single parameter for users and assignments. Questionnaires management does not have a search functionality implemented as yet. This project works on improving the search functionality of Expertiza, by adding search bars if not present, introducing advanced search feature where user can search on the basis of more than one parameters and making the search functionality appear more elegant.&lt;br /&gt;
&lt;br /&gt;
==Problem Definition:==&lt;br /&gt;
&lt;br /&gt;
#An instructor or administrator can search for a user by name, user-ID, or other characteristics.&lt;br /&gt;
#An instructor should be able to search for assignments by name, due date, or other characteristics.&lt;br /&gt;
#An instructor should be able to search for rubrics (or other questionnaires) by name, or by the courses or assignments they have been used in.&lt;br /&gt;
##For the instructor, there also needs to be a way to quickly find rubrics (and other questionnaires) that have been used in a single course.  It should be possible to search or click somewhere to bring up a list of questionnaires used in the course, expanding only the applicable questionnaires in the list of questionnaires.&lt;br /&gt;
##One should also be able to search for questionnaires by words used in questions that belong to the questionnaires.&lt;br /&gt;
#There should be a way to search all reviews of a particular team’s work for particular scores or text strings.  Reviews should be able to be filtered by score, text comment length, reviewer and reviewee.&lt;br /&gt;
#An instructor or administrator should be able to search for all the assignments that a particular user has participated in.&lt;br /&gt;
#If more than one criteria needs to be specified, there should be an 'Advanced Search' button.&lt;br /&gt;
&lt;br /&gt;
==Proposed Solution:==&lt;br /&gt;
&lt;br /&gt;
==Use Case Diagram==&lt;br /&gt;
[[File:UseCaseExpertizaSearch.png|center]]&lt;br /&gt;
&lt;br /&gt;
==Proposed Code Changes==&lt;br /&gt;
===Search for User:===&lt;br /&gt;
&lt;br /&gt;
In the current system workflow, we found that the user is unable to search in the Manage Users view. In the proposed workflow, we plan to enable the user to search by all the columns in the UI viz. Name, Full name, Email Address, Role, Parent by entering a partial or a complete text that matches with the particular field. We will also allow searching for fields irrespective of the case of the searched string. The user will be able to apply multiple filters at a time and the output of the query will match all filters applied. If no results are found, an empty list will be returned.&lt;br /&gt;
&lt;br /&gt;
Steps to reproduce the proposed workflow:&lt;br /&gt;
:#Log in to expertiza to view the home page&lt;br /&gt;
:#Go to Manage &amp;gt; Users&lt;br /&gt;
:#Type the search string in the search box available on the UI and select the column to search for from the dropdown.&lt;br /&gt;
:#To perform search based on multiple filters, the user can tap on the Advanced Search button adjacent to the Search button, the view renders a hidden div containing textboxes for all the columns, allowing the user to search based on multiple columns.&lt;br /&gt;
:#All the entries that match the specified criteria will be returned.&lt;br /&gt;
:#An empty list is returned if the search criteria doesn't match any valid records in the database.&lt;br /&gt;
&lt;br /&gt;
===Search for Assignments:===&lt;br /&gt;
&lt;br /&gt;
In the current system implementation, searching via the name of the assignment is supported with partial or complete assignment name. However, the search is case sensitive. In the proposed system, the user will be able to search for an assignment using additional filters such as Creation Date and Updated Date along with Assignment Name. The user will also be able to apply multiple filters at a time and the output of the query will match all filters applied. If no results are found, an empty list will be returned.&lt;br /&gt;
&lt;br /&gt;
To search for an assignment by Creation Date, the user will be prompted with a calendar where he can select a date and all the assignments created on or before the selected date will be displayed. &lt;br /&gt;
&lt;br /&gt;
To apply multiple filters, user can tap on the Advanced Search button available, adjacent to the Search button; a hidden div will then be rendered below containing textboxes for all the columns. All assignments that were created before the selected date for Creation Date or Updated Date columns and the ones that match other filters will be returned. A empty list will be returned if the search criteria doesn't match any records in the database.&lt;br /&gt;
&lt;br /&gt;
Steps to reproduce the proposed workflow:&lt;br /&gt;
:#Log in to expertiza to view the home page&lt;br /&gt;
:#Go to Manage &amp;gt; Assignments&lt;br /&gt;
:#Type the search criteria in the available search criteria and select the appropriate field from the dropdown.&lt;br /&gt;
:#To perform search based on multiple filters, the user can tap on the Advanced Search button adjacent to the Search button, the view renders a hidden div containing textboxes for all the columns, allowing the user to search based on multiple columns.&lt;br /&gt;
:#All the entries that match the given criteria will be returned.&lt;br /&gt;
:#An empty list is returned if the search criteria doesn't match any valid records in the database.&lt;br /&gt;
&lt;br /&gt;
===Search for Questionnaires:===&lt;br /&gt;
&lt;br /&gt;
The existing system does not have a search functionality under Questionnaires. The proposed system will implement a search functionality for searching via the name of the questionnaire, the text in the questions within a questionnaire, date of creation, and date updated by entering a partial or a complete text that matches with the particular field. We will also allow searching for fields irrespective of the case of the searched string. The user will be able to apply multiple filters at a time and the output of the query will match all the filters applied. If no results are found, an empty list will be returned.&lt;br /&gt;
&lt;br /&gt;
To search for an assignment by Creation Date, the user will be prompted with a calendar where he can select a date and all the assignments created on or before the selected date will be displayed. &lt;br /&gt;
&lt;br /&gt;
To apply multiple filters, user can tap on the Advanced Search button available, adjacent to the Search button; a hidden div will then be rendered below containing textboxes for all the columns. All assignments that were created before the selected date for Creation Date or Updated Date columns and the ones that match other filters will be returned. A empty list will be returned if the search criteria doesn't match any records in the database. The questionnaires will be grouped on the basis of their courses and will be expanded when clicked.&lt;br /&gt;
&lt;br /&gt;
Steps to reproduce the proposed workflow:&lt;br /&gt;
:#Log in to expertiza to view the home page&lt;br /&gt;
:#Go to Manage &amp;gt; Questionnaires&lt;br /&gt;
:#Type the search criteria in the available search criteria and select the appropriate field from the dropdown.&lt;br /&gt;
:#To perform search based on multiple filters, the user can tap on the Advanced Search button adjacent to the Search button, the view renders a hidden div containing textboxes for all the columns, allowing the user to search based on multiple columns.&lt;br /&gt;
:#All the entries that match the given criteria will be returned.&lt;br /&gt;
:#An empty list is returned if the search criteria doesn't match any valid records in the database.&lt;br /&gt;
&lt;br /&gt;
===Search for Reviews:===&lt;br /&gt;
&lt;br /&gt;
The existing system does not have a search functionality under Reviews. The proposed system will implement a search functionality for searching using the attributes like team name, score, reviewer, comment etc. by entering a partial or a complete text that matches with the particular field. We will also allow searching for fields irrespective of the case of the searched string. The user will be able to apply multiple filters at a time and the output of the query will match all the filters applied. If no results are found, an empty list will be returned.&lt;br /&gt;
&lt;br /&gt;
The user will be able to apply multiple filters at a time and the output of the query will match all filters applied. If no results are found, an empty list will be returned.&lt;br /&gt;
&lt;br /&gt;
Steps to reproduce the proposed workflow:&lt;br /&gt;
:#Log in to expertiza to view the home page&lt;br /&gt;
:#&lt;br /&gt;
:#Type the search criteria in the available search criteria and select the appropriate field from the dropdown.&lt;br /&gt;
:#To perform search based on multiple filters, the user can tap on the Advanced Search button adjacent to the Search button, the view renders a hidden div containing textboxes for all the columns, allowing the user to search based on multiple columns.&lt;br /&gt;
:#All the entries that match the given criteria will be returned.&lt;br /&gt;
:#An empty list is returned if the search criteria doesn't match any valid records in the database.&lt;br /&gt;
&lt;br /&gt;
==Database Design==&lt;br /&gt;
Below is the simplified version of the ER diagram which displays the relationships between the entity sets. Team_users and assignment_questionnaires are many to many relationships which are implemented in table format as show below.&lt;br /&gt;
&lt;br /&gt;
[[File:ER diagram.png|center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Relevant Tables===&lt;br /&gt;
[[File:User table.png|center]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Screen Shot 2018-11-20 at 11.42.06 PM.png|center]]&lt;br /&gt;
&lt;br /&gt;
==Test Plan: ==&lt;br /&gt;
=== Automated Tests ===&lt;br /&gt;
Automated tests in RSpec will be added as we implement the search functionality for each modified file. Most of the tests added will be unit tests that cover the use cases for each flow and changes made in the model as per the requirement description.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
====Test Details:====&lt;br /&gt;
=====User Model ( spec/models/user_spec.rb )=====&lt;br /&gt;
# Search by user name&lt;br /&gt;
# Search by user name that does not exist&lt;br /&gt;
# Search by user email&lt;br /&gt;
# Search by user email that does not exist&lt;br /&gt;
# Search by user email containing a substring&lt;br /&gt;
# Search by user full name&lt;br /&gt;
# Search by user full name is empty&lt;br /&gt;
# Search by user name and email&lt;br /&gt;
# Search for assignments participated&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
=====Assignment Model ( spec/models/assignment_spec.rb )=====&lt;br /&gt;
# Search by user name&lt;br /&gt;
# Search by institution&lt;br /&gt;
# Search by creation date&lt;br /&gt;
# Search by updated date&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
=====Rubrics=====&lt;br /&gt;
# Search by name&lt;br /&gt;
# Search by courses used in&lt;br /&gt;
# Search by assignments used in&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
=====Reviews=====&lt;br /&gt;
# Search all reviews of a particular team’s work for particular scores or text strings.  &lt;br /&gt;
# Search by score&lt;br /&gt;
# Search by text comment length&lt;br /&gt;
# Search by reviewer and reviewee&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
=== Manual Tests ===&lt;br /&gt;
=====Search for User=====&lt;br /&gt;
# Setup: create a user with name=&amp;quot;student&amp;quot; and userId=&amp;quot;5000&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
# Action: Instructor clicks on manage - &amp;gt; users -&amp;gt; in textbox enters name=&amp;quot;student&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
# Response: Relevant details of student, name=&amp;quot;student&amp;quot; is displayed&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
# Action: Instructor clicks on manage - &amp;gt; users -&amp;gt; advanced search-&amp;gt;clicks on checkbox student id and enters &amp;quot;5000&amp;quot; and click &amp;quot;ok&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
# Response: Relevant details of student, name=&amp;quot;student&amp;quot; is displayed&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Search for Assignments=====&lt;br /&gt;
# Setup create an assignment with name=&amp;quot;assignment&amp;quot; and set a due date&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# Action : Instructor clicks on Manage -&amp;gt; Assignments, in textbox enter &amp;quot;assignment&amp;quot; in relevant tab&amp;lt;br&amp;gt; &lt;br /&gt;
# Response : Relevant assignment should be displayed&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Action : Instructor clicks on Manage -&amp;gt; Assignments-&amp;gt; drop down and apply filters for due date and enter date and click &amp;quot;ok&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
# Response : Relevant assignments should be displayed&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Search for Questionnaires=====&lt;br /&gt;
# Setup : Create a Questionnaire, add questions to it&amp;lt;br&amp;gt;&lt;br /&gt;
# Action : Log in as instructor,  Manage -&amp;gt; Questionnaires, in text box enter text&amp;lt;br&amp;gt;&lt;br /&gt;
# Response : Questionnaires matching text are shown&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Action : Log in as instructor,  Manage -&amp;gt; Questionnaires, click advanced search and check creation date and enter value&amp;lt;br&amp;gt;&lt;br /&gt;
# Response : Questionnaires matching text are shown&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Search for Reviews=====&lt;br /&gt;
# Setup : Setup review for an assignment, login as student and then add review &amp;lt;br&amp;gt;&lt;br /&gt;
# Action : Log in as instructor, Manage -&amp;gt; Assignments, Click on Review Report icon on corresponding assignment&amp;lt;br&amp;gt;&lt;br /&gt;
# Result : Review should be seen&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Action : Click Advanced search, check review by text  and enter text&amp;lt;br&amp;gt;  &lt;br /&gt;
# Result : Matching review should be visible&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Nmchoks2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1987._Improving_search_facility_in_Expertiza&amp;diff=128482</id>
		<title>CSC/ECE 517 Fall 2019 - E1987. Improving search facility in Expertiza</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1987._Improving_search_facility_in_Expertiza&amp;diff=128482"/>
		<updated>2019-11-11T03:19:38Z</updated>

		<summary type="html">&lt;p&gt;Nmchoks2: /* Manual Tests */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction:==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source application running on Ruby on Rails. It is used for management of courses and the assignments for respective courses, by the faculties and the students. The manage content section of the application has different views which displays information about the users, courses, assignments, questionnaires, and reviews. The application should have a fully functional search functionality throughout the views, so that a user can search any type of data with ease, on the basis of any number of parameters depending on his requirements. Users should be searched on the basis of one more parameters which include name, full name, email, etc. Similarly, assignments should be searched on the basis of name, created date, updated date, etc. However, the search functionality in the existing application is constrained to just a single parameter for users and assignments. Questionnaires management does not have a search functionality implemented as yet. This project works on improving the search functionality of Expertiza, by adding search bars if not present, introducing advanced search feature where user can search on the basis of more than one parameters and making the search functionality appear more elegant.&lt;br /&gt;
&lt;br /&gt;
==Problem Definition:==&lt;br /&gt;
&lt;br /&gt;
#An instructor or administrator can search for a user by name, user-ID, or other characteristics.&lt;br /&gt;
#An instructor should be able to search for assignments by name, due date, or other characteristics.&lt;br /&gt;
#An instructor should be able to search for rubrics (or other questionnaires) by name, or by the courses or assignments they have been used in.&lt;br /&gt;
##For the instructor, there also needs to be a way to quickly find rubrics (and other questionnaires) that have been used in a single course.  It should be possible to search or click somewhere to bring up a list of questionnaires used in the course, expanding only the applicable questionnaires in the list of questionnaires.&lt;br /&gt;
##One should also be able to search for questionnaires by words used in questions that belong to the questionnaires.&lt;br /&gt;
#There should be a way to search all reviews of a particular team’s work for particular scores or text strings.  Reviews should be able to be filtered by score, text comment length, reviewer and reviewee.&lt;br /&gt;
#An instructor or administrator should be able to search for all the assignments that a particular user has participated in.&lt;br /&gt;
#If more than one criteria needs to be specified, there should be an 'Advanced Search' button.&lt;br /&gt;
&lt;br /&gt;
==Proposed Solution:==&lt;br /&gt;
&lt;br /&gt;
==Use Case Diagram==&lt;br /&gt;
[[File:UseCaseExpertizaSearch.png|center]]&lt;br /&gt;
&lt;br /&gt;
==Proposed Code Changes==&lt;br /&gt;
===Search for User:===&lt;br /&gt;
&lt;br /&gt;
In the current system workflow, we found that the user is unable to search in the Manage Users view. In the proposed workflow, we plan to enable the user to search by all the columns in the UI viz. Name, Full name, Email Address, Role, Parent by entering a partial or a complete text that matches with the particular field. We will also allow searching for fields irrespective of the case of the searched string. The user will be able to apply multiple filters at a time and the output of the query will match all filters applied. If no results are found, an empty list will be returned.&lt;br /&gt;
&lt;br /&gt;
Steps to reproduce the proposed workflow:&lt;br /&gt;
:#Log in to expertiza to view the home page&lt;br /&gt;
:#Go to Manage &amp;gt; Users&lt;br /&gt;
:#Type the search string in the search box available on the UI and select the column to search for from the dropdown.&lt;br /&gt;
:#To perform search based on multiple filters, the user can tap on the Advanced Search button adjacent to the Search button, the view renders a hidden div containing textboxes for all the columns, allowing the user to search based on multiple columns.&lt;br /&gt;
:#All the entries that match the specified criteria will be returned.&lt;br /&gt;
:#An empty list is returned if the search criteria doesn't match any valid records in the database.&lt;br /&gt;
&lt;br /&gt;
===Search for Assignments:===&lt;br /&gt;
&lt;br /&gt;
In the current system implementation, searching via the name of the assignment is supported with partial or complete assignment name. However, the search is case sensitive. In the proposed system, the user will be able to search for an assignment using additional filters such as Creation Date and Updated Date along with Assignment Name. The user will also be able to apply multiple filters at a time and the output of the query will match all filters applied. If no results are found, an empty list will be returned.&lt;br /&gt;
&lt;br /&gt;
To search for an assignment by Creation Date, the user will be prompted with a calendar where he can select a date and all the assignments created on or before the selected date will be displayed. &lt;br /&gt;
&lt;br /&gt;
To apply multiple filters, user can tap on the Advanced Search button available, adjacent to the Search button; a hidden div will then be rendered below containing textboxes for all the columns. All assignments that were created before the selected date for Creation Date or Updated Date columns and the ones that match other filters will be returned. A empty list will be returned if the search criteria doesn't match any records in the database.&lt;br /&gt;
&lt;br /&gt;
Steps to reproduce the proposed workflow:&lt;br /&gt;
:#Log in to expertiza to view the home page&lt;br /&gt;
:#Go to Manage &amp;gt; Assignments&lt;br /&gt;
:#Type the search criteria in the available search criteria and select the appropriate field from the dropdown.&lt;br /&gt;
:#To perform search based on multiple filters, the user can tap on the Advanced Search button adjacent to the Search button, the view renders a hidden div containing textboxes for all the columns, allowing the user to search based on multiple columns.&lt;br /&gt;
:#All the entries that match the given criteria will be returned.&lt;br /&gt;
:#An empty list is returned if the search criteria doesn't match any valid records in the database.&lt;br /&gt;
&lt;br /&gt;
===Search for Questionnaires:===&lt;br /&gt;
&lt;br /&gt;
The existing system does not have a search functionality under Questionnaires. The proposed system will implement a search functionality for searching via the name of the questionnaire, the text in the questions within a questionnaire, date of creation, and date updated by entering a partial or a complete text that matches with the particular field. We will also allow searching for fields irrespective of the case of the searched string. The user will be able to apply multiple filters at a time and the output of the query will match all the filters applied. If no results are found, an empty list will be returned.&lt;br /&gt;
&lt;br /&gt;
To search for an assignment by Creation Date, the user will be prompted with a calendar where he can select a date and all the assignments created on or before the selected date will be displayed. &lt;br /&gt;
&lt;br /&gt;
To apply multiple filters, user can tap on the Advanced Search button available, adjacent to the Search button; a hidden div will then be rendered below containing textboxes for all the columns. All assignments that were created before the selected date for Creation Date or Updated Date columns and the ones that match other filters will be returned. A empty list will be returned if the search criteria doesn't match any records in the database. The questionnaires will be grouped on the basis of their courses and will be expanded when clicked.&lt;br /&gt;
&lt;br /&gt;
Steps to reproduce the proposed workflow:&lt;br /&gt;
:#Log in to expertiza to view the home page&lt;br /&gt;
:#Go to Manage &amp;gt; Questionnaires&lt;br /&gt;
:#Type the search criteria in the available search criteria and select the appropriate field from the dropdown.&lt;br /&gt;
:#To perform search based on multiple filters, the user can tap on the Advanced Search button adjacent to the Search button, the view renders a hidden div containing textboxes for all the columns, allowing the user to search based on multiple columns.&lt;br /&gt;
:#All the entries that match the given criteria will be returned.&lt;br /&gt;
:#An empty list is returned if the search criteria doesn't match any valid records in the database.&lt;br /&gt;
&lt;br /&gt;
===Search for Reviews:===&lt;br /&gt;
&lt;br /&gt;
The existing system does not have a search functionality under Reviews. The proposed system will implement a search functionality for searching using the attributes like team name, score, reviewer, comment etc. by entering a partial or a complete text that matches with the particular field. We will also allow searching for fields irrespective of the case of the searched string. The user will be able to apply multiple filters at a time and the output of the query will match all the filters applied. If no results are found, an empty list will be returned.&lt;br /&gt;
&lt;br /&gt;
The user will be able to apply multiple filters at a time and the output of the query will match all filters applied. If no results are found, an empty list will be returned.&lt;br /&gt;
&lt;br /&gt;
Steps to reproduce the proposed workflow:&lt;br /&gt;
:#Log in to expertiza to view the home page&lt;br /&gt;
:#&lt;br /&gt;
:#Type the search criteria in the available search criteria and select the appropriate field from the dropdown.&lt;br /&gt;
:#To perform search based on multiple filters, the user can tap on the Advanced Search button adjacent to the Search button, the view renders a hidden div containing textboxes for all the columns, allowing the user to search based on multiple columns.&lt;br /&gt;
:#All the entries that match the given criteria will be returned.&lt;br /&gt;
:#An empty list is returned if the search criteria doesn't match any valid records in the database.&lt;br /&gt;
&lt;br /&gt;
==Database Design==&lt;br /&gt;
Below is the simplified version of the ER diagram which displays the relationships between the entity sets. Team_users and assignment_questionnaires are many to many relationships which are implemented in table format as show below.&lt;br /&gt;
&lt;br /&gt;
[[File:ER diagram.png|center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Relevant Tables===&lt;br /&gt;
[[File:User table.png|center]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Screen Shot 2018-11-20 at 11.42.06 PM.png|center]]&lt;br /&gt;
&lt;br /&gt;
==Test Plan: ==&lt;br /&gt;
=== Automated Tests ===&lt;br /&gt;
Automated tests in RSpec will be added as we implement the search functionality for each modified file. Most of the tests added will be unit tests that cover the use cases for each flow and changes made in the model as per the requirement description.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
====Test Details:====&lt;br /&gt;
=====User Model ( spec/models/user_spec.rb )=====&lt;br /&gt;
# Search by user name&lt;br /&gt;
# Search by user name that does not exist&lt;br /&gt;
# Search by user email&lt;br /&gt;
# Search by user email that does not exist&lt;br /&gt;
# Search by user email containing a substring&lt;br /&gt;
# Search by user full name&lt;br /&gt;
# Search by user full name is empty&lt;br /&gt;
# Search by user name and email&lt;br /&gt;
# Search for assignments participated&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
=====Assignment Model ( spec/models/assignment_spec.rb )=====&lt;br /&gt;
# Search by user name&lt;br /&gt;
# Search by institution&lt;br /&gt;
# Search by creation date&lt;br /&gt;
# Search by updated date&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
=====Rubrics=====&lt;br /&gt;
# Search by name&lt;br /&gt;
# Search by courses used in&lt;br /&gt;
# Search by assignments used in&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
=====Reviews=====&lt;br /&gt;
# Search all reviews of a particular team’s work for particular scores or text strings.  &lt;br /&gt;
# Search by score&lt;br /&gt;
# Search by text comment length&lt;br /&gt;
# Search by reviewer and reviewee&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
=== Manual Tests ===&lt;br /&gt;
=====Search for User=====&lt;br /&gt;
*Setup: create a user with name=&amp;quot;student&amp;quot; and userId=&amp;quot;5000&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
*Action: Instructor clicks on manage - &amp;gt; users -&amp;gt; in textbox enters name=&amp;quot;student&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
*Response: Relevant details of student, name=&amp;quot;student&amp;quot; is displayed&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
*Action: Instructor clicks on manage - &amp;gt; users -&amp;gt; advanced search-&amp;gt;clicks on checkbox student id and enters &amp;quot;5000&amp;quot; and click &amp;quot;ok&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
*Response: Relevant details of student, name=&amp;quot;student&amp;quot; is displayed&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Search for Assignments=====&lt;br /&gt;
*Setup create an assignment with name=&amp;quot;assignment&amp;quot; and set a due date&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
*Action : Instructor clicks on Manage -&amp;gt; Assignments, in textbox enter &amp;quot;assignment&amp;quot; in relevant tab&amp;lt;br&amp;gt; &lt;br /&gt;
*Response : Relevant assignment should be displayed&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Action : Instructor clicks on Manage -&amp;gt; Assignments-&amp;gt; drop down and apply filters for due date and enter date and click &amp;quot;ok&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
*Response : Relevant assignments should be displayed&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Search for Questionnaires=====&lt;br /&gt;
*Setup : Create a Questionnaire, add questions to it&amp;lt;br&amp;gt;&lt;br /&gt;
*Action : Log in as instructor,  Manage -&amp;gt; Questionnaires, in text box enter text&amp;lt;br&amp;gt;&lt;br /&gt;
*Response : Questionnaires matching text are shown&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Action : Log in as instructor,  Manage -&amp;gt; Questionnaires, click advanced search and check creation date and enter value&amp;lt;br&amp;gt;&lt;br /&gt;
*Response : Questionnaires matching text are shown&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Search for Reviews=====&lt;br /&gt;
*Setup : Setup review for an assignment, login as student and then add review &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Action : Log in as instructor, Manage -&amp;gt; Assignments, Click on Review Report icon on corresponding assignment&amp;lt;br&amp;gt;&lt;br /&gt;
*Result : Review should be seen&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Action : Click Advanced search, check review by text  and enter text&amp;lt;br&amp;gt;  &lt;br /&gt;
*Result : Matching review should be visible&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Nmchoks2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1987._Improving_search_facility_in_Expertiza&amp;diff=128481</id>
		<title>CSC/ECE 517 Fall 2019 - E1987. Improving search facility in Expertiza</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1987._Improving_search_facility_in_Expertiza&amp;diff=128481"/>
		<updated>2019-11-11T03:18:55Z</updated>

		<summary type="html">&lt;p&gt;Nmchoks2: /* Test Plan: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction:==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source application running on Ruby on Rails. It is used for management of courses and the assignments for respective courses, by the faculties and the students. The manage content section of the application has different views which displays information about the users, courses, assignments, questionnaires, and reviews. The application should have a fully functional search functionality throughout the views, so that a user can search any type of data with ease, on the basis of any number of parameters depending on his requirements. Users should be searched on the basis of one more parameters which include name, full name, email, etc. Similarly, assignments should be searched on the basis of name, created date, updated date, etc. However, the search functionality in the existing application is constrained to just a single parameter for users and assignments. Questionnaires management does not have a search functionality implemented as yet. This project works on improving the search functionality of Expertiza, by adding search bars if not present, introducing advanced search feature where user can search on the basis of more than one parameters and making the search functionality appear more elegant.&lt;br /&gt;
&lt;br /&gt;
==Problem Definition:==&lt;br /&gt;
&lt;br /&gt;
#An instructor or administrator can search for a user by name, user-ID, or other characteristics.&lt;br /&gt;
#An instructor should be able to search for assignments by name, due date, or other characteristics.&lt;br /&gt;
#An instructor should be able to search for rubrics (or other questionnaires) by name, or by the courses or assignments they have been used in.&lt;br /&gt;
##For the instructor, there also needs to be a way to quickly find rubrics (and other questionnaires) that have been used in a single course.  It should be possible to search or click somewhere to bring up a list of questionnaires used in the course, expanding only the applicable questionnaires in the list of questionnaires.&lt;br /&gt;
##One should also be able to search for questionnaires by words used in questions that belong to the questionnaires.&lt;br /&gt;
#There should be a way to search all reviews of a particular team’s work for particular scores or text strings.  Reviews should be able to be filtered by score, text comment length, reviewer and reviewee.&lt;br /&gt;
#An instructor or administrator should be able to search for all the assignments that a particular user has participated in.&lt;br /&gt;
#If more than one criteria needs to be specified, there should be an 'Advanced Search' button.&lt;br /&gt;
&lt;br /&gt;
==Proposed Solution:==&lt;br /&gt;
&lt;br /&gt;
==Use Case Diagram==&lt;br /&gt;
[[File:UseCaseExpertizaSearch.png|center]]&lt;br /&gt;
&lt;br /&gt;
==Proposed Code Changes==&lt;br /&gt;
===Search for User:===&lt;br /&gt;
&lt;br /&gt;
In the current system workflow, we found that the user is unable to search in the Manage Users view. In the proposed workflow, we plan to enable the user to search by all the columns in the UI viz. Name, Full name, Email Address, Role, Parent by entering a partial or a complete text that matches with the particular field. We will also allow searching for fields irrespective of the case of the searched string. The user will be able to apply multiple filters at a time and the output of the query will match all filters applied. If no results are found, an empty list will be returned.&lt;br /&gt;
&lt;br /&gt;
Steps to reproduce the proposed workflow:&lt;br /&gt;
:#Log in to expertiza to view the home page&lt;br /&gt;
:#Go to Manage &amp;gt; Users&lt;br /&gt;
:#Type the search string in the search box available on the UI and select the column to search for from the dropdown.&lt;br /&gt;
:#To perform search based on multiple filters, the user can tap on the Advanced Search button adjacent to the Search button, the view renders a hidden div containing textboxes for all the columns, allowing the user to search based on multiple columns.&lt;br /&gt;
:#All the entries that match the specified criteria will be returned.&lt;br /&gt;
:#An empty list is returned if the search criteria doesn't match any valid records in the database.&lt;br /&gt;
&lt;br /&gt;
===Search for Assignments:===&lt;br /&gt;
&lt;br /&gt;
In the current system implementation, searching via the name of the assignment is supported with partial or complete assignment name. However, the search is case sensitive. In the proposed system, the user will be able to search for an assignment using additional filters such as Creation Date and Updated Date along with Assignment Name. The user will also be able to apply multiple filters at a time and the output of the query will match all filters applied. If no results are found, an empty list will be returned.&lt;br /&gt;
&lt;br /&gt;
To search for an assignment by Creation Date, the user will be prompted with a calendar where he can select a date and all the assignments created on or before the selected date will be displayed. &lt;br /&gt;
&lt;br /&gt;
To apply multiple filters, user can tap on the Advanced Search button available, adjacent to the Search button; a hidden div will then be rendered below containing textboxes for all the columns. All assignments that were created before the selected date for Creation Date or Updated Date columns and the ones that match other filters will be returned. A empty list will be returned if the search criteria doesn't match any records in the database.&lt;br /&gt;
&lt;br /&gt;
Steps to reproduce the proposed workflow:&lt;br /&gt;
:#Log in to expertiza to view the home page&lt;br /&gt;
:#Go to Manage &amp;gt; Assignments&lt;br /&gt;
:#Type the search criteria in the available search criteria and select the appropriate field from the dropdown.&lt;br /&gt;
:#To perform search based on multiple filters, the user can tap on the Advanced Search button adjacent to the Search button, the view renders a hidden div containing textboxes for all the columns, allowing the user to search based on multiple columns.&lt;br /&gt;
:#All the entries that match the given criteria will be returned.&lt;br /&gt;
:#An empty list is returned if the search criteria doesn't match any valid records in the database.&lt;br /&gt;
&lt;br /&gt;
===Search for Questionnaires:===&lt;br /&gt;
&lt;br /&gt;
The existing system does not have a search functionality under Questionnaires. The proposed system will implement a search functionality for searching via the name of the questionnaire, the text in the questions within a questionnaire, date of creation, and date updated by entering a partial or a complete text that matches with the particular field. We will also allow searching for fields irrespective of the case of the searched string. The user will be able to apply multiple filters at a time and the output of the query will match all the filters applied. If no results are found, an empty list will be returned.&lt;br /&gt;
&lt;br /&gt;
To search for an assignment by Creation Date, the user will be prompted with a calendar where he can select a date and all the assignments created on or before the selected date will be displayed. &lt;br /&gt;
&lt;br /&gt;
To apply multiple filters, user can tap on the Advanced Search button available, adjacent to the Search button; a hidden div will then be rendered below containing textboxes for all the columns. All assignments that were created before the selected date for Creation Date or Updated Date columns and the ones that match other filters will be returned. A empty list will be returned if the search criteria doesn't match any records in the database. The questionnaires will be grouped on the basis of their courses and will be expanded when clicked.&lt;br /&gt;
&lt;br /&gt;
Steps to reproduce the proposed workflow:&lt;br /&gt;
:#Log in to expertiza to view the home page&lt;br /&gt;
:#Go to Manage &amp;gt; Questionnaires&lt;br /&gt;
:#Type the search criteria in the available search criteria and select the appropriate field from the dropdown.&lt;br /&gt;
:#To perform search based on multiple filters, the user can tap on the Advanced Search button adjacent to the Search button, the view renders a hidden div containing textboxes for all the columns, allowing the user to search based on multiple columns.&lt;br /&gt;
:#All the entries that match the given criteria will be returned.&lt;br /&gt;
:#An empty list is returned if the search criteria doesn't match any valid records in the database.&lt;br /&gt;
&lt;br /&gt;
===Search for Reviews:===&lt;br /&gt;
&lt;br /&gt;
The existing system does not have a search functionality under Reviews. The proposed system will implement a search functionality for searching using the attributes like team name, score, reviewer, comment etc. by entering a partial or a complete text that matches with the particular field. We will also allow searching for fields irrespective of the case of the searched string. The user will be able to apply multiple filters at a time and the output of the query will match all the filters applied. If no results are found, an empty list will be returned.&lt;br /&gt;
&lt;br /&gt;
The user will be able to apply multiple filters at a time and the output of the query will match all filters applied. If no results are found, an empty list will be returned.&lt;br /&gt;
&lt;br /&gt;
Steps to reproduce the proposed workflow:&lt;br /&gt;
:#Log in to expertiza to view the home page&lt;br /&gt;
:#&lt;br /&gt;
:#Type the search criteria in the available search criteria and select the appropriate field from the dropdown.&lt;br /&gt;
:#To perform search based on multiple filters, the user can tap on the Advanced Search button adjacent to the Search button, the view renders a hidden div containing textboxes for all the columns, allowing the user to search based on multiple columns.&lt;br /&gt;
:#All the entries that match the given criteria will be returned.&lt;br /&gt;
:#An empty list is returned if the search criteria doesn't match any valid records in the database.&lt;br /&gt;
&lt;br /&gt;
==Database Design==&lt;br /&gt;
Below is the simplified version of the ER diagram which displays the relationships between the entity sets. Team_users and assignment_questionnaires are many to many relationships which are implemented in table format as show below.&lt;br /&gt;
&lt;br /&gt;
[[File:ER diagram.png|center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Relevant Tables===&lt;br /&gt;
[[File:User table.png|center]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Screen Shot 2018-11-20 at 11.42.06 PM.png|center]]&lt;br /&gt;
&lt;br /&gt;
==Test Plan: ==&lt;br /&gt;
=== Automated Tests ===&lt;br /&gt;
Automated tests in RSpec will be added as we implement the search functionality for each modified file. Most of the tests added will be unit tests that cover the use cases for each flow and changes made in the model as per the requirement description.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
====Test Details:====&lt;br /&gt;
=====User Model ( spec/models/user_spec.rb )=====&lt;br /&gt;
# Search by user name&lt;br /&gt;
# Search by user name that does not exist&lt;br /&gt;
# Search by user email&lt;br /&gt;
# Search by user email that does not exist&lt;br /&gt;
# Search by user email containing a substring&lt;br /&gt;
# Search by user full name&lt;br /&gt;
# Search by user full name is empty&lt;br /&gt;
# Search by user name and email&lt;br /&gt;
# Search for assignments participated&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
=====Assignment Model ( spec/models/assignment_spec.rb )=====&lt;br /&gt;
# Search by user name&lt;br /&gt;
# Search by institution&lt;br /&gt;
# Search by creation date&lt;br /&gt;
# Search by updated date&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
=====Rubrics=====&lt;br /&gt;
# Search by name&lt;br /&gt;
# Search by courses used in&lt;br /&gt;
# Search by assignments used in&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
=====Reviews=====&lt;br /&gt;
# Search all reviews of a particular team’s work for particular scores or text strings.  &lt;br /&gt;
# Search by score&lt;br /&gt;
# Search by text comment length&lt;br /&gt;
# Search by reviewer and reviewee&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
=== Manual Tests ===&lt;br /&gt;
=====Search for User=====&lt;br /&gt;
Setup: create a user with name=&amp;quot;student&amp;quot; and userId=&amp;quot;5000&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Action: Instructor clicks on manage - &amp;gt; users -&amp;gt; in textbox enters name=&amp;quot;student&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
Response: Relevant details of student, name=&amp;quot;student&amp;quot; is displayed&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Action: Instructor clicks on manage - &amp;gt; users -&amp;gt; advanced search-&amp;gt;clicks on checkbox student id and enters &amp;quot;5000&amp;quot; and click &amp;quot;ok&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
Response: Relevant details of student, name=&amp;quot;student&amp;quot; is displayed&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Search for Assignments=====&lt;br /&gt;
Setup create an assignment with name=&amp;quot;assignment&amp;quot; and set a due date&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Action : Instructor clicks on Manage -&amp;gt; Assignments, in textbox enter &amp;quot;assignment&amp;quot; in relevant tab&amp;lt;br&amp;gt; &lt;br /&gt;
Response : Relevant assignment should be displayed&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Action : Instructor clicks on Manage -&amp;gt; Assignments-&amp;gt; drop down and apply filters for due date and enter date and click &amp;quot;ok&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
Response : Relevant assignments should be displayed&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Search for Questionnaires=====&lt;br /&gt;
Setup : Create a Questionnaire, add questions to it&amp;lt;br&amp;gt;&lt;br /&gt;
Action : Log in as instructor,  Manage -&amp;gt; Questionnaires, in text box enter text&amp;lt;br&amp;gt;&lt;br /&gt;
Response : Questionnaires matching text are shown&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Action : Log in as instructor,  Manage -&amp;gt; Questionnaires, click advanced search and check creation date and enter value&amp;lt;br&amp;gt;&lt;br /&gt;
Response : Questionnaires matching text are shown&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Search for Reviews=====&lt;br /&gt;
Setup : Setup review for an assignment, login as student and then add review &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Action : Log in as instructor, Manage -&amp;gt; Assignments, Click on Review Report icon on corresponding assignment&amp;lt;br&amp;gt;&lt;br /&gt;
Result : Review should be seen&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Action : Click Advanced search, check review by text  and enter text&amp;lt;br&amp;gt;  &lt;br /&gt;
Result : Matching review should be visible&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Nmchoks2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1987._Improving_search_facility_in_Expertiza&amp;diff=128479</id>
		<title>CSC/ECE 517 Fall 2019 - E1987. Improving search facility in Expertiza</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1987._Improving_search_facility_in_Expertiza&amp;diff=128479"/>
		<updated>2019-11-11T03:17:34Z</updated>

		<summary type="html">&lt;p&gt;Nmchoks2: /* Test Plan: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction:==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source application running on Ruby on Rails. It is used for management of courses and the assignments for respective courses, by the faculties and the students. The manage content section of the application has different views which displays information about the users, courses, assignments, questionnaires, and reviews. The application should have a fully functional search functionality throughout the views, so that a user can search any type of data with ease, on the basis of any number of parameters depending on his requirements. Users should be searched on the basis of one more parameters which include name, full name, email, etc. Similarly, assignments should be searched on the basis of name, created date, updated date, etc. However, the search functionality in the existing application is constrained to just a single parameter for users and assignments. Questionnaires management does not have a search functionality implemented as yet. This project works on improving the search functionality of Expertiza, by adding search bars if not present, introducing advanced search feature where user can search on the basis of more than one parameters and making the search functionality appear more elegant.&lt;br /&gt;
&lt;br /&gt;
==Problem Definition:==&lt;br /&gt;
&lt;br /&gt;
#An instructor or administrator can search for a user by name, user-ID, or other characteristics.&lt;br /&gt;
#An instructor should be able to search for assignments by name, due date, or other characteristics.&lt;br /&gt;
#An instructor should be able to search for rubrics (or other questionnaires) by name, or by the courses or assignments they have been used in.&lt;br /&gt;
##For the instructor, there also needs to be a way to quickly find rubrics (and other questionnaires) that have been used in a single course.  It should be possible to search or click somewhere to bring up a list of questionnaires used in the course, expanding only the applicable questionnaires in the list of questionnaires.&lt;br /&gt;
##One should also be able to search for questionnaires by words used in questions that belong to the questionnaires.&lt;br /&gt;
#There should be a way to search all reviews of a particular team’s work for particular scores or text strings.  Reviews should be able to be filtered by score, text comment length, reviewer and reviewee.&lt;br /&gt;
#An instructor or administrator should be able to search for all the assignments that a particular user has participated in.&lt;br /&gt;
#If more than one criteria needs to be specified, there should be an 'Advanced Search' button.&lt;br /&gt;
&lt;br /&gt;
==Proposed Solution:==&lt;br /&gt;
&lt;br /&gt;
==Use Case Diagram==&lt;br /&gt;
[[File:UseCaseExpertizaSearch.png|center]]&lt;br /&gt;
&lt;br /&gt;
==Proposed Code Changes==&lt;br /&gt;
===Search for User:===&lt;br /&gt;
&lt;br /&gt;
In the current system workflow, we found that the user is unable to search in the Manage Users view. In the proposed workflow, we plan to enable the user to search by all the columns in the UI viz. Name, Full name, Email Address, Role, Parent by entering a partial or a complete text that matches with the particular field. We will also allow searching for fields irrespective of the case of the searched string. The user will be able to apply multiple filters at a time and the output of the query will match all filters applied. If no results are found, an empty list will be returned.&lt;br /&gt;
&lt;br /&gt;
Steps to reproduce the proposed workflow:&lt;br /&gt;
:#Log in to expertiza to view the home page&lt;br /&gt;
:#Go to Manage &amp;gt; Users&lt;br /&gt;
:#Type the search string in the search box available on the UI and select the column to search for from the dropdown.&lt;br /&gt;
:#To perform search based on multiple filters, the user can tap on the Advanced Search button adjacent to the Search button, the view renders a hidden div containing textboxes for all the columns, allowing the user to search based on multiple columns.&lt;br /&gt;
:#All the entries that match the specified criteria will be returned.&lt;br /&gt;
:#An empty list is returned if the search criteria doesn't match any valid records in the database.&lt;br /&gt;
&lt;br /&gt;
===Search for Assignments:===&lt;br /&gt;
&lt;br /&gt;
In the current system implementation, searching via the name of the assignment is supported with partial or complete assignment name. However, the search is case sensitive. In the proposed system, the user will be able to search for an assignment using additional filters such as Creation Date and Updated Date along with Assignment Name. The user will also be able to apply multiple filters at a time and the output of the query will match all filters applied. If no results are found, an empty list will be returned.&lt;br /&gt;
&lt;br /&gt;
To search for an assignment by Creation Date, the user will be prompted with a calendar where he can select a date and all the assignments created on or before the selected date will be displayed. &lt;br /&gt;
&lt;br /&gt;
To apply multiple filters, user can tap on the Advanced Search button available, adjacent to the Search button; a hidden div will then be rendered below containing textboxes for all the columns. All assignments that were created before the selected date for Creation Date or Updated Date columns and the ones that match other filters will be returned. A empty list will be returned if the search criteria doesn't match any records in the database.&lt;br /&gt;
&lt;br /&gt;
Steps to reproduce the proposed workflow:&lt;br /&gt;
:#Log in to expertiza to view the home page&lt;br /&gt;
:#Go to Manage &amp;gt; Assignments&lt;br /&gt;
:#Type the search criteria in the available search criteria and select the appropriate field from the dropdown.&lt;br /&gt;
:#To perform search based on multiple filters, the user can tap on the Advanced Search button adjacent to the Search button, the view renders a hidden div containing textboxes for all the columns, allowing the user to search based on multiple columns.&lt;br /&gt;
:#All the entries that match the given criteria will be returned.&lt;br /&gt;
:#An empty list is returned if the search criteria doesn't match any valid records in the database.&lt;br /&gt;
&lt;br /&gt;
===Search for Questionnaires:===&lt;br /&gt;
&lt;br /&gt;
The existing system does not have a search functionality under Questionnaires. The proposed system will implement a search functionality for searching via the name of the questionnaire, the text in the questions within a questionnaire, date of creation, and date updated by entering a partial or a complete text that matches with the particular field. We will also allow searching for fields irrespective of the case of the searched string. The user will be able to apply multiple filters at a time and the output of the query will match all the filters applied. If no results are found, an empty list will be returned.&lt;br /&gt;
&lt;br /&gt;
To search for an assignment by Creation Date, the user will be prompted with a calendar where he can select a date and all the assignments created on or before the selected date will be displayed. &lt;br /&gt;
&lt;br /&gt;
To apply multiple filters, user can tap on the Advanced Search button available, adjacent to the Search button; a hidden div will then be rendered below containing textboxes for all the columns. All assignments that were created before the selected date for Creation Date or Updated Date columns and the ones that match other filters will be returned. A empty list will be returned if the search criteria doesn't match any records in the database. The questionnaires will be grouped on the basis of their courses and will be expanded when clicked.&lt;br /&gt;
&lt;br /&gt;
Steps to reproduce the proposed workflow:&lt;br /&gt;
:#Log in to expertiza to view the home page&lt;br /&gt;
:#Go to Manage &amp;gt; Questionnaires&lt;br /&gt;
:#Type the search criteria in the available search criteria and select the appropriate field from the dropdown.&lt;br /&gt;
:#To perform search based on multiple filters, the user can tap on the Advanced Search button adjacent to the Search button, the view renders a hidden div containing textboxes for all the columns, allowing the user to search based on multiple columns.&lt;br /&gt;
:#All the entries that match the given criteria will be returned.&lt;br /&gt;
:#An empty list is returned if the search criteria doesn't match any valid records in the database.&lt;br /&gt;
&lt;br /&gt;
===Search for Reviews:===&lt;br /&gt;
&lt;br /&gt;
The existing system does not have a search functionality under Reviews. The proposed system will implement a search functionality for searching using the attributes like team name, score, reviewer, comment etc. by entering a partial or a complete text that matches with the particular field. We will also allow searching for fields irrespective of the case of the searched string. The user will be able to apply multiple filters at a time and the output of the query will match all the filters applied. If no results are found, an empty list will be returned.&lt;br /&gt;
&lt;br /&gt;
The user will be able to apply multiple filters at a time and the output of the query will match all filters applied. If no results are found, an empty list will be returned.&lt;br /&gt;
&lt;br /&gt;
Steps to reproduce the proposed workflow:&lt;br /&gt;
:#Log in to expertiza to view the home page&lt;br /&gt;
:#&lt;br /&gt;
:#Type the search criteria in the available search criteria and select the appropriate field from the dropdown.&lt;br /&gt;
:#To perform search based on multiple filters, the user can tap on the Advanced Search button adjacent to the Search button, the view renders a hidden div containing textboxes for all the columns, allowing the user to search based on multiple columns.&lt;br /&gt;
:#All the entries that match the given criteria will be returned.&lt;br /&gt;
:#An empty list is returned if the search criteria doesn't match any valid records in the database.&lt;br /&gt;
&lt;br /&gt;
==Database Design==&lt;br /&gt;
Below is the simplified version of the ER diagram which displays the relationships between the entity sets. Team_users and assignment_questionnaires are many to many relationships which are implemented in table format as show below.&lt;br /&gt;
&lt;br /&gt;
[[File:ER diagram.png|center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Relevant Tables===&lt;br /&gt;
[[File:User table.png|center]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Screen Shot 2018-11-20 at 11.42.06 PM.png|center]]&lt;br /&gt;
&lt;br /&gt;
==Test Plan: ==&lt;br /&gt;
=== Automated Tests ===&lt;br /&gt;
Automated tests in RSpec will be added as we implement the search functionality for each Model &amp;lt;br&amp;gt;&lt;br /&gt;
Most tests added will be unit tests that cover the test cases for each flow and changes in the model.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
====Test Details:====&lt;br /&gt;
=====User Model ( spec/models/user_spec.rb )=====&lt;br /&gt;
# Search by user name&lt;br /&gt;
# Search by user name that does not exist&lt;br /&gt;
# Search by user email&lt;br /&gt;
# Search by user email that does not exist&lt;br /&gt;
# Search by user email containing a substring&lt;br /&gt;
# Search by user full name&lt;br /&gt;
# Search by user full name is empty&lt;br /&gt;
# Search by user name and email&lt;br /&gt;
# Search for assignments participated&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
=====Assignment Model ( spec/models/assignment_spec.rb )=====&lt;br /&gt;
# Search by user name&lt;br /&gt;
# Search by institution&lt;br /&gt;
# Search by creation date&lt;br /&gt;
# Search by updated date&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
=====Rubrics=====&lt;br /&gt;
# Search by name&lt;br /&gt;
# Search by courses used in&lt;br /&gt;
# Search by assignments used in&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
=====Reviews=====&lt;br /&gt;
# Search all reviews of a particular team’s work for particular scores or text strings.  &lt;br /&gt;
# Search by score&lt;br /&gt;
# Search by text comment length&lt;br /&gt;
# Search by reviewer and reviewee&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
=== Manual Tests ===&lt;br /&gt;
=====Search for User=====&lt;br /&gt;
Setup: create a user with name=&amp;quot;student&amp;quot; and userId=&amp;quot;5000&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Action: Instructor clicks on manage - &amp;gt; users -&amp;gt; in textbox enters name=&amp;quot;student&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
Response: Relevant details of student, name=&amp;quot;student&amp;quot; is displayed&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Action: Instructor clicks on manage - &amp;gt; users -&amp;gt; advanced search-&amp;gt;clicks on checkbox student id and enters &amp;quot;5000&amp;quot; and click &amp;quot;ok&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
Response: Relevant details of student, name=&amp;quot;student&amp;quot; is displayed&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Search for Assignments=====&lt;br /&gt;
Setup create an assignment with name=&amp;quot;assignment&amp;quot; and set a due date&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Action : Instructor clicks on Manage -&amp;gt; Assignments, in textbox enter &amp;quot;assignment&amp;quot; in relevant tab&amp;lt;br&amp;gt; &lt;br /&gt;
Response : Relevant assignment should be displayed&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Action : Instructor clicks on Manage -&amp;gt; Assignments-&amp;gt; drop down and apply filters for due date and enter date and click &amp;quot;ok&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
Response : Relevant assignments should be displayed&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Search for Questionnaires=====&lt;br /&gt;
Setup : Create a Questionnaire, add questions to it&amp;lt;br&amp;gt;&lt;br /&gt;
Action : Log in as instructor,  Manage -&amp;gt; Questionnaires, in text box enter text&amp;lt;br&amp;gt;&lt;br /&gt;
Response : Questionnaires matching text are shown&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Action : Log in as instructor,  Manage -&amp;gt; Questionnaires, click advanced search and check creation date and enter value&amp;lt;br&amp;gt;&lt;br /&gt;
Response : Questionnaires matching text are shown&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Search for Reviews=====&lt;br /&gt;
Setup : Setup review for an assignment, login as student and then add review &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Action : Log in as instructor, Manage -&amp;gt; Assignments, Click on Review Report icon on corresponding assignment&amp;lt;br&amp;gt;&lt;br /&gt;
Result : Review should be seen&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Action : Click Advanced search, check review by text  and enter text&amp;lt;br&amp;gt;  &lt;br /&gt;
Result : Matching review should be visible&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Nmchoks2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1987._Improving_search_facility_in_Expertiza&amp;diff=128478</id>
		<title>CSC/ECE 517 Fall 2019 - E1987. Improving search facility in Expertiza</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1987._Improving_search_facility_in_Expertiza&amp;diff=128478"/>
		<updated>2019-11-11T03:16:57Z</updated>

		<summary type="html">&lt;p&gt;Nmchoks2: /* Test Plan: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction:==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source application running on Ruby on Rails. It is used for management of courses and the assignments for respective courses, by the faculties and the students. The manage content section of the application has different views which displays information about the users, courses, assignments, questionnaires, and reviews. The application should have a fully functional search functionality throughout the views, so that a user can search any type of data with ease, on the basis of any number of parameters depending on his requirements. Users should be searched on the basis of one more parameters which include name, full name, email, etc. Similarly, assignments should be searched on the basis of name, created date, updated date, etc. However, the search functionality in the existing application is constrained to just a single parameter for users and assignments. Questionnaires management does not have a search functionality implemented as yet. This project works on improving the search functionality of Expertiza, by adding search bars if not present, introducing advanced search feature where user can search on the basis of more than one parameters and making the search functionality appear more elegant.&lt;br /&gt;
&lt;br /&gt;
==Problem Definition:==&lt;br /&gt;
&lt;br /&gt;
#An instructor or administrator can search for a user by name, user-ID, or other characteristics.&lt;br /&gt;
#An instructor should be able to search for assignments by name, due date, or other characteristics.&lt;br /&gt;
#An instructor should be able to search for rubrics (or other questionnaires) by name, or by the courses or assignments they have been used in.&lt;br /&gt;
##For the instructor, there also needs to be a way to quickly find rubrics (and other questionnaires) that have been used in a single course.  It should be possible to search or click somewhere to bring up a list of questionnaires used in the course, expanding only the applicable questionnaires in the list of questionnaires.&lt;br /&gt;
##One should also be able to search for questionnaires by words used in questions that belong to the questionnaires.&lt;br /&gt;
#There should be a way to search all reviews of a particular team’s work for particular scores or text strings.  Reviews should be able to be filtered by score, text comment length, reviewer and reviewee.&lt;br /&gt;
#An instructor or administrator should be able to search for all the assignments that a particular user has participated in.&lt;br /&gt;
#If more than one criteria needs to be specified, there should be an 'Advanced Search' button.&lt;br /&gt;
&lt;br /&gt;
==Proposed Solution:==&lt;br /&gt;
&lt;br /&gt;
==Use Case Diagram==&lt;br /&gt;
[[File:UseCaseExpertizaSearch.png|center]]&lt;br /&gt;
&lt;br /&gt;
==Proposed Code Changes==&lt;br /&gt;
===Search for User:===&lt;br /&gt;
&lt;br /&gt;
In the current system workflow, we found that the user is unable to search in the Manage Users view. In the proposed workflow, we plan to enable the user to search by all the columns in the UI viz. Name, Full name, Email Address, Role, Parent by entering a partial or a complete text that matches with the particular field. We will also allow searching for fields irrespective of the case of the searched string. The user will be able to apply multiple filters at a time and the output of the query will match all filters applied. If no results are found, an empty list will be returned.&lt;br /&gt;
&lt;br /&gt;
Steps to reproduce the proposed workflow:&lt;br /&gt;
:#Log in to expertiza to view the home page&lt;br /&gt;
:#Go to Manage &amp;gt; Users&lt;br /&gt;
:#Type the search string in the search box available on the UI and select the column to search for from the dropdown.&lt;br /&gt;
:#To perform search based on multiple filters, the user can tap on the Advanced Search button adjacent to the Search button, the view renders a hidden div containing textboxes for all the columns, allowing the user to search based on multiple columns.&lt;br /&gt;
:#All the entries that match the specified criteria will be returned.&lt;br /&gt;
:#An empty list is returned if the search criteria doesn't match any valid records in the database.&lt;br /&gt;
&lt;br /&gt;
===Search for Assignments:===&lt;br /&gt;
&lt;br /&gt;
In the current system implementation, searching via the name of the assignment is supported with partial or complete assignment name. However, the search is case sensitive. In the proposed system, the user will be able to search for an assignment using additional filters such as Creation Date and Updated Date along with Assignment Name. The user will also be able to apply multiple filters at a time and the output of the query will match all filters applied. If no results are found, an empty list will be returned.&lt;br /&gt;
&lt;br /&gt;
To search for an assignment by Creation Date, the user will be prompted with a calendar where he can select a date and all the assignments created on or before the selected date will be displayed. &lt;br /&gt;
&lt;br /&gt;
To apply multiple filters, user can tap on the Advanced Search button available, adjacent to the Search button; a hidden div will then be rendered below containing textboxes for all the columns. All assignments that were created before the selected date for Creation Date or Updated Date columns and the ones that match other filters will be returned. A empty list will be returned if the search criteria doesn't match any records in the database.&lt;br /&gt;
&lt;br /&gt;
Steps to reproduce the proposed workflow:&lt;br /&gt;
:#Log in to expertiza to view the home page&lt;br /&gt;
:#Go to Manage &amp;gt; Assignments&lt;br /&gt;
:#Type the search criteria in the available search criteria and select the appropriate field from the dropdown.&lt;br /&gt;
:#To perform search based on multiple filters, the user can tap on the Advanced Search button adjacent to the Search button, the view renders a hidden div containing textboxes for all the columns, allowing the user to search based on multiple columns.&lt;br /&gt;
:#All the entries that match the given criteria will be returned.&lt;br /&gt;
:#An empty list is returned if the search criteria doesn't match any valid records in the database.&lt;br /&gt;
&lt;br /&gt;
===Search for Questionnaires:===&lt;br /&gt;
&lt;br /&gt;
The existing system does not have a search functionality under Questionnaires. The proposed system will implement a search functionality for searching via the name of the questionnaire, the text in the questions within a questionnaire, date of creation, and date updated by entering a partial or a complete text that matches with the particular field. We will also allow searching for fields irrespective of the case of the searched string. The user will be able to apply multiple filters at a time and the output of the query will match all the filters applied. If no results are found, an empty list will be returned.&lt;br /&gt;
&lt;br /&gt;
To search for an assignment by Creation Date, the user will be prompted with a calendar where he can select a date and all the assignments created on or before the selected date will be displayed. &lt;br /&gt;
&lt;br /&gt;
To apply multiple filters, user can tap on the Advanced Search button available, adjacent to the Search button; a hidden div will then be rendered below containing textboxes for all the columns. All assignments that were created before the selected date for Creation Date or Updated Date columns and the ones that match other filters will be returned. A empty list will be returned if the search criteria doesn't match any records in the database. The questionnaires will be grouped on the basis of their courses and will be expanded when clicked.&lt;br /&gt;
&lt;br /&gt;
Steps to reproduce the proposed workflow:&lt;br /&gt;
:#Log in to expertiza to view the home page&lt;br /&gt;
:#Go to Manage &amp;gt; Questionnaires&lt;br /&gt;
:#Type the search criteria in the available search criteria and select the appropriate field from the dropdown.&lt;br /&gt;
:#To perform search based on multiple filters, the user can tap on the Advanced Search button adjacent to the Search button, the view renders a hidden div containing textboxes for all the columns, allowing the user to search based on multiple columns.&lt;br /&gt;
:#All the entries that match the given criteria will be returned.&lt;br /&gt;
:#An empty list is returned if the search criteria doesn't match any valid records in the database.&lt;br /&gt;
&lt;br /&gt;
===Search for Reviews:===&lt;br /&gt;
&lt;br /&gt;
The existing system does not have a search functionality under Reviews. The proposed system will implement a search functionality for searching using the attributes like team name, score, reviewer, comment etc. by entering a partial or a complete text that matches with the particular field. We will also allow searching for fields irrespective of the case of the searched string. The user will be able to apply multiple filters at a time and the output of the query will match all the filters applied. If no results are found, an empty list will be returned.&lt;br /&gt;
&lt;br /&gt;
The user will be able to apply multiple filters at a time and the output of the query will match all filters applied. If no results are found, an empty list will be returned.&lt;br /&gt;
&lt;br /&gt;
Steps to reproduce the proposed workflow:&lt;br /&gt;
:#Log in to expertiza to view the home page&lt;br /&gt;
:#&lt;br /&gt;
:#Type the search criteria in the available search criteria and select the appropriate field from the dropdown.&lt;br /&gt;
:#To perform search based on multiple filters, the user can tap on the Advanced Search button adjacent to the Search button, the view renders a hidden div containing textboxes for all the columns, allowing the user to search based on multiple columns.&lt;br /&gt;
:#All the entries that match the given criteria will be returned.&lt;br /&gt;
:#An empty list is returned if the search criteria doesn't match any valid records in the database.&lt;br /&gt;
&lt;br /&gt;
==Database Design==&lt;br /&gt;
Below is the simplified version of the ER diagram which displays the relationships between the entity sets. Team_users and assignment_questionnaires are many to many relationships which are implemented in table format as show below.&lt;br /&gt;
&lt;br /&gt;
[[File:ER diagram.png|center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Relevant Tables===&lt;br /&gt;
[[File:User table.png|center]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Screen Shot 2018-11-20 at 11.42.06 PM.png|center]]&lt;br /&gt;
&lt;br /&gt;
==Test Plan: ==&lt;br /&gt;
=== Automated Tests ===&lt;br /&gt;
Automated tests in RSpec will be added as we implement the search functionality for each Model &amp;lt;br&amp;gt;&lt;br /&gt;
Most tests added will be unit tests that cover the test cases for each flow and changes in the model.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
====Test Details:====&lt;br /&gt;
=====User Model ( spec/models/user_spec.rb )=====&lt;br /&gt;
# Search by user name&lt;br /&gt;
# Search by user name that does not exist&lt;br /&gt;
# Search by user email&lt;br /&gt;
# Search by user email that does not exist&lt;br /&gt;
# Search by user email containing a substring&lt;br /&gt;
# Search by user full name&lt;br /&gt;
# Search by user full name is empty&lt;br /&gt;
# Search by user name and email&lt;br /&gt;
# Search for assignments participated&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
====Assignment Model ( spec/models/assignment_spec.rb )====&lt;br /&gt;
# Search by user name&lt;br /&gt;
# Search by institution&lt;br /&gt;
# Search by creation date&lt;br /&gt;
# Search by updated date&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
====Rubrics====&lt;br /&gt;
# Search by name&lt;br /&gt;
# Search by courses used in&lt;br /&gt;
# Search by assignments used in&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
====Reviews====&lt;br /&gt;
# Search all reviews of a particular team’s work for particular scores or text strings.  &lt;br /&gt;
# Search by score&lt;br /&gt;
# Search by text comment length&lt;br /&gt;
# Search by reviewer and reviewee&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
=== Manual Tests ===&lt;br /&gt;
====Search for User====&lt;br /&gt;
Setup: create a user with name=&amp;quot;student&amp;quot; and userId=&amp;quot;5000&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Action: Instructor clicks on manage - &amp;gt; users -&amp;gt; in textbox enters name=&amp;quot;student&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
Response: Relevant details of student, name=&amp;quot;student&amp;quot; is displayed&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Action: Instructor clicks on manage - &amp;gt; users -&amp;gt; advanced search-&amp;gt;clicks on checkbox student id and enters &amp;quot;5000&amp;quot; and click &amp;quot;ok&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
Response: Relevant details of student, name=&amp;quot;student&amp;quot; is displayed&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Search for Assignments====&lt;br /&gt;
Setup create an assignment with name=&amp;quot;assignment&amp;quot; and set a due date&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Action : Instructor clicks on Manage -&amp;gt; Assignments, in textbox enter &amp;quot;assignment&amp;quot; in relevant tab&amp;lt;br&amp;gt; &lt;br /&gt;
Response : Relevant assignment should be displayed&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Action : Instructor clicks on Manage -&amp;gt; Assignments-&amp;gt; drop down and apply filters for due date and enter date and click &amp;quot;ok&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
Response : Relevant assignments should be displayed&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Search for Questionnaires====&lt;br /&gt;
Setup : Create a Questionnaire, add questions to it&amp;lt;br&amp;gt;&lt;br /&gt;
Action : Log in as instructor,  Manage -&amp;gt; Questionnaires, in text box enter text&amp;lt;br&amp;gt;&lt;br /&gt;
Response : Questionnaires matching text are shown&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Action : Log in as instructor,  Manage -&amp;gt; Questionnaires, click advanced search and check creation date and enter value&amp;lt;br&amp;gt;&lt;br /&gt;
Response : Questionnaires matching text are shown&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Search for Reviews====&lt;br /&gt;
Setup : Setup review for an assignment, login as student and then add review &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Action : Log in as instructor, Manage -&amp;gt; Assignments, Click on Review Report icon on corresponding assignment&amp;lt;br&amp;gt;&lt;br /&gt;
Result : Review should be seen&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Action : Click Advanced search, check review by text  and enter text&amp;lt;br&amp;gt;  &lt;br /&gt;
Result : Matching review should be visible&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Nmchoks2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1987._Improving_search_facility_in_Expertiza&amp;diff=128477</id>
		<title>CSC/ECE 517 Fall 2019 - E1987. Improving search facility in Expertiza</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1987._Improving_search_facility_in_Expertiza&amp;diff=128477"/>
		<updated>2019-11-11T03:16:26Z</updated>

		<summary type="html">&lt;p&gt;Nmchoks2: /* Test Plan: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction:==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source application running on Ruby on Rails. It is used for management of courses and the assignments for respective courses, by the faculties and the students. The manage content section of the application has different views which displays information about the users, courses, assignments, questionnaires, and reviews. The application should have a fully functional search functionality throughout the views, so that a user can search any type of data with ease, on the basis of any number of parameters depending on his requirements. Users should be searched on the basis of one more parameters which include name, full name, email, etc. Similarly, assignments should be searched on the basis of name, created date, updated date, etc. However, the search functionality in the existing application is constrained to just a single parameter for users and assignments. Questionnaires management does not have a search functionality implemented as yet. This project works on improving the search functionality of Expertiza, by adding search bars if not present, introducing advanced search feature where user can search on the basis of more than one parameters and making the search functionality appear more elegant.&lt;br /&gt;
&lt;br /&gt;
==Problem Definition:==&lt;br /&gt;
&lt;br /&gt;
#An instructor or administrator can search for a user by name, user-ID, or other characteristics.&lt;br /&gt;
#An instructor should be able to search for assignments by name, due date, or other characteristics.&lt;br /&gt;
#An instructor should be able to search for rubrics (or other questionnaires) by name, or by the courses or assignments they have been used in.&lt;br /&gt;
##For the instructor, there also needs to be a way to quickly find rubrics (and other questionnaires) that have been used in a single course.  It should be possible to search or click somewhere to bring up a list of questionnaires used in the course, expanding only the applicable questionnaires in the list of questionnaires.&lt;br /&gt;
##One should also be able to search for questionnaires by words used in questions that belong to the questionnaires.&lt;br /&gt;
#There should be a way to search all reviews of a particular team’s work for particular scores or text strings.  Reviews should be able to be filtered by score, text comment length, reviewer and reviewee.&lt;br /&gt;
#An instructor or administrator should be able to search for all the assignments that a particular user has participated in.&lt;br /&gt;
#If more than one criteria needs to be specified, there should be an 'Advanced Search' button.&lt;br /&gt;
&lt;br /&gt;
==Proposed Solution:==&lt;br /&gt;
&lt;br /&gt;
==Use Case Diagram==&lt;br /&gt;
[[File:UseCaseExpertizaSearch.png|center]]&lt;br /&gt;
&lt;br /&gt;
==Proposed Code Changes==&lt;br /&gt;
===Search for User:===&lt;br /&gt;
&lt;br /&gt;
In the current system workflow, we found that the user is unable to search in the Manage Users view. In the proposed workflow, we plan to enable the user to search by all the columns in the UI viz. Name, Full name, Email Address, Role, Parent by entering a partial or a complete text that matches with the particular field. We will also allow searching for fields irrespective of the case of the searched string. The user will be able to apply multiple filters at a time and the output of the query will match all filters applied. If no results are found, an empty list will be returned.&lt;br /&gt;
&lt;br /&gt;
Steps to reproduce the proposed workflow:&lt;br /&gt;
:#Log in to expertiza to view the home page&lt;br /&gt;
:#Go to Manage &amp;gt; Users&lt;br /&gt;
:#Type the search string in the search box available on the UI and select the column to search for from the dropdown.&lt;br /&gt;
:#To perform search based on multiple filters, the user can tap on the Advanced Search button adjacent to the Search button, the view renders a hidden div containing textboxes for all the columns, allowing the user to search based on multiple columns.&lt;br /&gt;
:#All the entries that match the specified criteria will be returned.&lt;br /&gt;
:#An empty list is returned if the search criteria doesn't match any valid records in the database.&lt;br /&gt;
&lt;br /&gt;
===Search for Assignments:===&lt;br /&gt;
&lt;br /&gt;
In the current system implementation, searching via the name of the assignment is supported with partial or complete assignment name. However, the search is case sensitive. In the proposed system, the user will be able to search for an assignment using additional filters such as Creation Date and Updated Date along with Assignment Name. The user will also be able to apply multiple filters at a time and the output of the query will match all filters applied. If no results are found, an empty list will be returned.&lt;br /&gt;
&lt;br /&gt;
To search for an assignment by Creation Date, the user will be prompted with a calendar where he can select a date and all the assignments created on or before the selected date will be displayed. &lt;br /&gt;
&lt;br /&gt;
To apply multiple filters, user can tap on the Advanced Search button available, adjacent to the Search button; a hidden div will then be rendered below containing textboxes for all the columns. All assignments that were created before the selected date for Creation Date or Updated Date columns and the ones that match other filters will be returned. A empty list will be returned if the search criteria doesn't match any records in the database.&lt;br /&gt;
&lt;br /&gt;
Steps to reproduce the proposed workflow:&lt;br /&gt;
:#Log in to expertiza to view the home page&lt;br /&gt;
:#Go to Manage &amp;gt; Assignments&lt;br /&gt;
:#Type the search criteria in the available search criteria and select the appropriate field from the dropdown.&lt;br /&gt;
:#To perform search based on multiple filters, the user can tap on the Advanced Search button adjacent to the Search button, the view renders a hidden div containing textboxes for all the columns, allowing the user to search based on multiple columns.&lt;br /&gt;
:#All the entries that match the given criteria will be returned.&lt;br /&gt;
:#An empty list is returned if the search criteria doesn't match any valid records in the database.&lt;br /&gt;
&lt;br /&gt;
===Search for Questionnaires:===&lt;br /&gt;
&lt;br /&gt;
The existing system does not have a search functionality under Questionnaires. The proposed system will implement a search functionality for searching via the name of the questionnaire, the text in the questions within a questionnaire, date of creation, and date updated by entering a partial or a complete text that matches with the particular field. We will also allow searching for fields irrespective of the case of the searched string. The user will be able to apply multiple filters at a time and the output of the query will match all the filters applied. If no results are found, an empty list will be returned.&lt;br /&gt;
&lt;br /&gt;
To search for an assignment by Creation Date, the user will be prompted with a calendar where he can select a date and all the assignments created on or before the selected date will be displayed. &lt;br /&gt;
&lt;br /&gt;
To apply multiple filters, user can tap on the Advanced Search button available, adjacent to the Search button; a hidden div will then be rendered below containing textboxes for all the columns. All assignments that were created before the selected date for Creation Date or Updated Date columns and the ones that match other filters will be returned. A empty list will be returned if the search criteria doesn't match any records in the database. The questionnaires will be grouped on the basis of their courses and will be expanded when clicked.&lt;br /&gt;
&lt;br /&gt;
Steps to reproduce the proposed workflow:&lt;br /&gt;
:#Log in to expertiza to view the home page&lt;br /&gt;
:#Go to Manage &amp;gt; Questionnaires&lt;br /&gt;
:#Type the search criteria in the available search criteria and select the appropriate field from the dropdown.&lt;br /&gt;
:#To perform search based on multiple filters, the user can tap on the Advanced Search button adjacent to the Search button, the view renders a hidden div containing textboxes for all the columns, allowing the user to search based on multiple columns.&lt;br /&gt;
:#All the entries that match the given criteria will be returned.&lt;br /&gt;
:#An empty list is returned if the search criteria doesn't match any valid records in the database.&lt;br /&gt;
&lt;br /&gt;
===Search for Reviews:===&lt;br /&gt;
&lt;br /&gt;
The existing system does not have a search functionality under Reviews. The proposed system will implement a search functionality for searching using the attributes like team name, score, reviewer, comment etc. by entering a partial or a complete text that matches with the particular field. We will also allow searching for fields irrespective of the case of the searched string. The user will be able to apply multiple filters at a time and the output of the query will match all the filters applied. If no results are found, an empty list will be returned.&lt;br /&gt;
&lt;br /&gt;
The user will be able to apply multiple filters at a time and the output of the query will match all filters applied. If no results are found, an empty list will be returned.&lt;br /&gt;
&lt;br /&gt;
Steps to reproduce the proposed workflow:&lt;br /&gt;
:#Log in to expertiza to view the home page&lt;br /&gt;
:#&lt;br /&gt;
:#Type the search criteria in the available search criteria and select the appropriate field from the dropdown.&lt;br /&gt;
:#To perform search based on multiple filters, the user can tap on the Advanced Search button adjacent to the Search button, the view renders a hidden div containing textboxes for all the columns, allowing the user to search based on multiple columns.&lt;br /&gt;
:#All the entries that match the given criteria will be returned.&lt;br /&gt;
:#An empty list is returned if the search criteria doesn't match any valid records in the database.&lt;br /&gt;
&lt;br /&gt;
==Database Design==&lt;br /&gt;
Below is the simplified version of the ER diagram which displays the relationships between the entity sets. Team_users and assignment_questionnaires are many to many relationships which are implemented in table format as show below.&lt;br /&gt;
&lt;br /&gt;
[[File:ER diagram.png|center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Relevant Tables===&lt;br /&gt;
[[File:User table.png|center]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Screen Shot 2018-11-20 at 11.42.06 PM.png|center]]&lt;br /&gt;
&lt;br /&gt;
==Test Plan: ==&lt;br /&gt;
=== Automated Tests ===&lt;br /&gt;
Automated tests in RSpec will be added as we implement the search functionality for each Model &amp;lt;br&amp;gt;&lt;br /&gt;
Most tests added will be unit tests that cover the test cases for each flow and changes in the model.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
====Test Details:====&lt;br /&gt;
====User Model ( spec/models/user_spec.rb )====&lt;br /&gt;
# Search by user name&lt;br /&gt;
# Search by user name that does not exist&lt;br /&gt;
# Search by user email&lt;br /&gt;
# Search by user email that does not exist&lt;br /&gt;
# Search by user email containing a substring&lt;br /&gt;
# Search by user full name&lt;br /&gt;
# Search by user full name is empty&lt;br /&gt;
# Search by user name and email&lt;br /&gt;
# Search for assignments participated&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
====Assignment Model ( spec/models/assignment_spec.rb )====&lt;br /&gt;
# Search by user name&lt;br /&gt;
# Search by institution&lt;br /&gt;
# Search by creation date&lt;br /&gt;
# Search by updated date&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
====Rubrics====&lt;br /&gt;
# Search by name&lt;br /&gt;
# Search by courses used in&lt;br /&gt;
# Search by assignments used in&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
====Reviews====&lt;br /&gt;
# Search all reviews of a particular team’s work for particular scores or text strings.  &lt;br /&gt;
# Search by score&lt;br /&gt;
# Search by text comment length&lt;br /&gt;
# Search by reviewer and reviewee&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
=== Manual Tests ===&lt;br /&gt;
====Search for User====&lt;br /&gt;
Setup: create a user with name=&amp;quot;student&amp;quot; and userId=&amp;quot;5000&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Action: Instructor clicks on manage - &amp;gt; users -&amp;gt; in textbox enters name=&amp;quot;student&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
Response: Relevant details of student, name=&amp;quot;student&amp;quot; is displayed&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Action: Instructor clicks on manage - &amp;gt; users -&amp;gt; advanced search-&amp;gt;clicks on checkbox student id and enters &amp;quot;5000&amp;quot; and click &amp;quot;ok&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
Response: Relevant details of student, name=&amp;quot;student&amp;quot; is displayed&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Search for Assignments====&lt;br /&gt;
Setup create an assignment with name=&amp;quot;assignment&amp;quot; and set a due date&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Action : Instructor clicks on Manage -&amp;gt; Assignments, in textbox enter &amp;quot;assignment&amp;quot; in relevant tab&amp;lt;br&amp;gt; &lt;br /&gt;
Response : Relevant assignment should be displayed&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Action : Instructor clicks on Manage -&amp;gt; Assignments-&amp;gt; drop down and apply filters for due date and enter date and click &amp;quot;ok&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
Response : Relevant assignments should be displayed&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Search for Questionnaires====&lt;br /&gt;
Setup : Create a Questionnaire, add questions to it&amp;lt;br&amp;gt;&lt;br /&gt;
Action : Log in as instructor,  Manage -&amp;gt; Questionnaires, in text box enter text&amp;lt;br&amp;gt;&lt;br /&gt;
Response : Questionnaires matching text are shown&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Action : Log in as instructor,  Manage -&amp;gt; Questionnaires, click advanced search and check creation date and enter value&amp;lt;br&amp;gt;&lt;br /&gt;
Response : Questionnaires matching text are shown&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Search for Reviews====&lt;br /&gt;
Setup : Setup review for an assignment, login as student and then add review &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Action : Log in as instructor, Manage -&amp;gt; Assignments, Click on Review Report icon on corresponding assignment&amp;lt;br&amp;gt;&lt;br /&gt;
Result : Review should be seen&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Action : Click Advanced search, check review by text  and enter text&amp;lt;br&amp;gt;  &lt;br /&gt;
Result : Matching review should be visible&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Nmchoks2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1987._Improving_search_facility_in_Expertiza&amp;diff=128476</id>
		<title>CSC/ECE 517 Fall 2019 - E1987. Improving search facility in Expertiza</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1987._Improving_search_facility_in_Expertiza&amp;diff=128476"/>
		<updated>2019-11-11T03:15:49Z</updated>

		<summary type="html">&lt;p&gt;Nmchoks2: /* Test Plan: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction:==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source application running on Ruby on Rails. It is used for management of courses and the assignments for respective courses, by the faculties and the students. The manage content section of the application has different views which displays information about the users, courses, assignments, questionnaires, and reviews. The application should have a fully functional search functionality throughout the views, so that a user can search any type of data with ease, on the basis of any number of parameters depending on his requirements. Users should be searched on the basis of one more parameters which include name, full name, email, etc. Similarly, assignments should be searched on the basis of name, created date, updated date, etc. However, the search functionality in the existing application is constrained to just a single parameter for users and assignments. Questionnaires management does not have a search functionality implemented as yet. This project works on improving the search functionality of Expertiza, by adding search bars if not present, introducing advanced search feature where user can search on the basis of more than one parameters and making the search functionality appear more elegant.&lt;br /&gt;
&lt;br /&gt;
==Problem Definition:==&lt;br /&gt;
&lt;br /&gt;
#An instructor or administrator can search for a user by name, user-ID, or other characteristics.&lt;br /&gt;
#An instructor should be able to search for assignments by name, due date, or other characteristics.&lt;br /&gt;
#An instructor should be able to search for rubrics (or other questionnaires) by name, or by the courses or assignments they have been used in.&lt;br /&gt;
##For the instructor, there also needs to be a way to quickly find rubrics (and other questionnaires) that have been used in a single course.  It should be possible to search or click somewhere to bring up a list of questionnaires used in the course, expanding only the applicable questionnaires in the list of questionnaires.&lt;br /&gt;
##One should also be able to search for questionnaires by words used in questions that belong to the questionnaires.&lt;br /&gt;
#There should be a way to search all reviews of a particular team’s work for particular scores or text strings.  Reviews should be able to be filtered by score, text comment length, reviewer and reviewee.&lt;br /&gt;
#An instructor or administrator should be able to search for all the assignments that a particular user has participated in.&lt;br /&gt;
#If more than one criteria needs to be specified, there should be an 'Advanced Search' button.&lt;br /&gt;
&lt;br /&gt;
==Proposed Solution:==&lt;br /&gt;
&lt;br /&gt;
==Use Case Diagram==&lt;br /&gt;
[[File:UseCaseExpertizaSearch.png|center]]&lt;br /&gt;
&lt;br /&gt;
==Proposed Code Changes==&lt;br /&gt;
===Search for User:===&lt;br /&gt;
&lt;br /&gt;
In the current system workflow, we found that the user is unable to search in the Manage Users view. In the proposed workflow, we plan to enable the user to search by all the columns in the UI viz. Name, Full name, Email Address, Role, Parent by entering a partial or a complete text that matches with the particular field. We will also allow searching for fields irrespective of the case of the searched string. The user will be able to apply multiple filters at a time and the output of the query will match all filters applied. If no results are found, an empty list will be returned.&lt;br /&gt;
&lt;br /&gt;
Steps to reproduce the proposed workflow:&lt;br /&gt;
:#Log in to expertiza to view the home page&lt;br /&gt;
:#Go to Manage &amp;gt; Users&lt;br /&gt;
:#Type the search string in the search box available on the UI and select the column to search for from the dropdown.&lt;br /&gt;
:#To perform search based on multiple filters, the user can tap on the Advanced Search button adjacent to the Search button, the view renders a hidden div containing textboxes for all the columns, allowing the user to search based on multiple columns.&lt;br /&gt;
:#All the entries that match the specified criteria will be returned.&lt;br /&gt;
:#An empty list is returned if the search criteria doesn't match any valid records in the database.&lt;br /&gt;
&lt;br /&gt;
===Search for Assignments:===&lt;br /&gt;
&lt;br /&gt;
In the current system implementation, searching via the name of the assignment is supported with partial or complete assignment name. However, the search is case sensitive. In the proposed system, the user will be able to search for an assignment using additional filters such as Creation Date and Updated Date along with Assignment Name. The user will also be able to apply multiple filters at a time and the output of the query will match all filters applied. If no results are found, an empty list will be returned.&lt;br /&gt;
&lt;br /&gt;
To search for an assignment by Creation Date, the user will be prompted with a calendar where he can select a date and all the assignments created on or before the selected date will be displayed. &lt;br /&gt;
&lt;br /&gt;
To apply multiple filters, user can tap on the Advanced Search button available, adjacent to the Search button; a hidden div will then be rendered below containing textboxes for all the columns. All assignments that were created before the selected date for Creation Date or Updated Date columns and the ones that match other filters will be returned. A empty list will be returned if the search criteria doesn't match any records in the database.&lt;br /&gt;
&lt;br /&gt;
Steps to reproduce the proposed workflow:&lt;br /&gt;
:#Log in to expertiza to view the home page&lt;br /&gt;
:#Go to Manage &amp;gt; Assignments&lt;br /&gt;
:#Type the search criteria in the available search criteria and select the appropriate field from the dropdown.&lt;br /&gt;
:#To perform search based on multiple filters, the user can tap on the Advanced Search button adjacent to the Search button, the view renders a hidden div containing textboxes for all the columns, allowing the user to search based on multiple columns.&lt;br /&gt;
:#All the entries that match the given criteria will be returned.&lt;br /&gt;
:#An empty list is returned if the search criteria doesn't match any valid records in the database.&lt;br /&gt;
&lt;br /&gt;
===Search for Questionnaires:===&lt;br /&gt;
&lt;br /&gt;
The existing system does not have a search functionality under Questionnaires. The proposed system will implement a search functionality for searching via the name of the questionnaire, the text in the questions within a questionnaire, date of creation, and date updated by entering a partial or a complete text that matches with the particular field. We will also allow searching for fields irrespective of the case of the searched string. The user will be able to apply multiple filters at a time and the output of the query will match all the filters applied. If no results are found, an empty list will be returned.&lt;br /&gt;
&lt;br /&gt;
To search for an assignment by Creation Date, the user will be prompted with a calendar where he can select a date and all the assignments created on or before the selected date will be displayed. &lt;br /&gt;
&lt;br /&gt;
To apply multiple filters, user can tap on the Advanced Search button available, adjacent to the Search button; a hidden div will then be rendered below containing textboxes for all the columns. All assignments that were created before the selected date for Creation Date or Updated Date columns and the ones that match other filters will be returned. A empty list will be returned if the search criteria doesn't match any records in the database. The questionnaires will be grouped on the basis of their courses and will be expanded when clicked.&lt;br /&gt;
&lt;br /&gt;
Steps to reproduce the proposed workflow:&lt;br /&gt;
:#Log in to expertiza to view the home page&lt;br /&gt;
:#Go to Manage &amp;gt; Questionnaires&lt;br /&gt;
:#Type the search criteria in the available search criteria and select the appropriate field from the dropdown.&lt;br /&gt;
:#To perform search based on multiple filters, the user can tap on the Advanced Search button adjacent to the Search button, the view renders a hidden div containing textboxes for all the columns, allowing the user to search based on multiple columns.&lt;br /&gt;
:#All the entries that match the given criteria will be returned.&lt;br /&gt;
:#An empty list is returned if the search criteria doesn't match any valid records in the database.&lt;br /&gt;
&lt;br /&gt;
===Search for Reviews:===&lt;br /&gt;
&lt;br /&gt;
The existing system does not have a search functionality under Reviews. The proposed system will implement a search functionality for searching using the attributes like team name, score, reviewer, comment etc. by entering a partial or a complete text that matches with the particular field. We will also allow searching for fields irrespective of the case of the searched string. The user will be able to apply multiple filters at a time and the output of the query will match all the filters applied. If no results are found, an empty list will be returned.&lt;br /&gt;
&lt;br /&gt;
The user will be able to apply multiple filters at a time and the output of the query will match all filters applied. If no results are found, an empty list will be returned.&lt;br /&gt;
&lt;br /&gt;
Steps to reproduce the proposed workflow:&lt;br /&gt;
:#Log in to expertiza to view the home page&lt;br /&gt;
:#&lt;br /&gt;
:#Type the search criteria in the available search criteria and select the appropriate field from the dropdown.&lt;br /&gt;
:#To perform search based on multiple filters, the user can tap on the Advanced Search button adjacent to the Search button, the view renders a hidden div containing textboxes for all the columns, allowing the user to search based on multiple columns.&lt;br /&gt;
:#All the entries that match the given criteria will be returned.&lt;br /&gt;
:#An empty list is returned if the search criteria doesn't match any valid records in the database.&lt;br /&gt;
&lt;br /&gt;
==Database Design==&lt;br /&gt;
Below is the simplified version of the ER diagram which displays the relationships between the entity sets. Team_users and assignment_questionnaires are many to many relationships which are implemented in table format as show below.&lt;br /&gt;
&lt;br /&gt;
[[File:ER diagram.png|center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Relevant Tables===&lt;br /&gt;
[[File:User table.png|center]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Screen Shot 2018-11-20 at 11.42.06 PM.png|center]]&lt;br /&gt;
&lt;br /&gt;
==Test Plan: ==&lt;br /&gt;
=== Automated Tests ===&lt;br /&gt;
Automated tests in RSpec will be added as we implement the search functionality for each Model &amp;lt;br&amp;gt;&lt;br /&gt;
Most tests added will be unit tests that cover the test cases for each flow and changes in the model.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
====Test Details:====&lt;br /&gt;
====User Model==== ( spec/models/user_spec.rb )&lt;br /&gt;
# Search by user name&lt;br /&gt;
# Search by user name that does not exist&lt;br /&gt;
# Search by user email&lt;br /&gt;
# Search by user email that does not exist&lt;br /&gt;
# Search by user email containing a substring&lt;br /&gt;
# Search by user full name&lt;br /&gt;
# Search by user full name is empty&lt;br /&gt;
# Search by user name and email&lt;br /&gt;
# Search for assignments participated&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
====Assignment Model==== ( spec/models/assignment_spec.rb )&lt;br /&gt;
# Search by user name&lt;br /&gt;
# Search by institution&lt;br /&gt;
# Search by creation date&lt;br /&gt;
# Search by updated date&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
====Rubrics====&lt;br /&gt;
# Search by name&lt;br /&gt;
# Search by courses used in&lt;br /&gt;
# Search by assignments used in&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
====Reviews====&lt;br /&gt;
# Search all reviews of a particular team’s work for particular scores or text strings.  &lt;br /&gt;
# Search by score&lt;br /&gt;
# Search by text comment length&lt;br /&gt;
# Search by reviewer and reviewee&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
=== Manual Tests ===&lt;br /&gt;
====Search for User====&lt;br /&gt;
Setup: create a user with name=&amp;quot;student&amp;quot; and userId=&amp;quot;5000&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Action: Instructor clicks on manage - &amp;gt; users -&amp;gt; in textbox enters name=&amp;quot;student&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
Response: Relevant details of student, name=&amp;quot;student&amp;quot; is displayed&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Action: Instructor clicks on manage - &amp;gt; users -&amp;gt; advanced search-&amp;gt;clicks on checkbox student id and enters &amp;quot;5000&amp;quot; and click &amp;quot;ok&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
Response: Relevant details of student, name=&amp;quot;student&amp;quot; is displayed&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Search for Assignments====&lt;br /&gt;
Setup create an assignment with name=&amp;quot;assignment&amp;quot; and set a due date&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Action : Instructor clicks on Manage -&amp;gt; Assignments, in textbox enter &amp;quot;assignment&amp;quot; in relevant tab&amp;lt;br&amp;gt; &lt;br /&gt;
Response : Relevant assignment should be displayed&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Action : Instructor clicks on Manage -&amp;gt; Assignments-&amp;gt; drop down and apply filters for due date and enter date and click &amp;quot;ok&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
Response : Relevant assignments should be displayed&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Search for Questionnaires====&lt;br /&gt;
Setup : Create a Questionnaire, add questions to it&amp;lt;br&amp;gt;&lt;br /&gt;
Action : Log in as instructor,  Manage -&amp;gt; Questionnaires, in text box enter text&amp;lt;br&amp;gt;&lt;br /&gt;
Response : Questionnaires matching text are shown&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Action : Log in as instructor,  Manage -&amp;gt; Questionnaires, click advanced search and check creation date and enter value&amp;lt;br&amp;gt;&lt;br /&gt;
Response : Questionnaires matching text are shown&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Search for Reviews====&lt;br /&gt;
Setup : Setup review for an assignment, login as student and then add review &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Action : Log in as instructor, Manage -&amp;gt; Assignments, Click on Review Report icon on corresponding assignment&amp;lt;br&amp;gt;&lt;br /&gt;
Result : Review should be seen&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Action : Click Advanced search, check review by text  and enter text&amp;lt;br&amp;gt;  &lt;br /&gt;
Result : Matching review should be visible&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Nmchoks2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1987._Improving_search_facility_in_Expertiza&amp;diff=128475</id>
		<title>CSC/ECE 517 Fall 2019 - E1987. Improving search facility in Expertiza</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1987._Improving_search_facility_in_Expertiza&amp;diff=128475"/>
		<updated>2019-11-11T03:14:53Z</updated>

		<summary type="html">&lt;p&gt;Nmchoks2: /* Test Plan: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction:==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source application running on Ruby on Rails. It is used for management of courses and the assignments for respective courses, by the faculties and the students. The manage content section of the application has different views which displays information about the users, courses, assignments, questionnaires, and reviews. The application should have a fully functional search functionality throughout the views, so that a user can search any type of data with ease, on the basis of any number of parameters depending on his requirements. Users should be searched on the basis of one more parameters which include name, full name, email, etc. Similarly, assignments should be searched on the basis of name, created date, updated date, etc. However, the search functionality in the existing application is constrained to just a single parameter for users and assignments. Questionnaires management does not have a search functionality implemented as yet. This project works on improving the search functionality of Expertiza, by adding search bars if not present, introducing advanced search feature where user can search on the basis of more than one parameters and making the search functionality appear more elegant.&lt;br /&gt;
&lt;br /&gt;
==Problem Definition:==&lt;br /&gt;
&lt;br /&gt;
#An instructor or administrator can search for a user by name, user-ID, or other characteristics.&lt;br /&gt;
#An instructor should be able to search for assignments by name, due date, or other characteristics.&lt;br /&gt;
#An instructor should be able to search for rubrics (or other questionnaires) by name, or by the courses or assignments they have been used in.&lt;br /&gt;
##For the instructor, there also needs to be a way to quickly find rubrics (and other questionnaires) that have been used in a single course.  It should be possible to search or click somewhere to bring up a list of questionnaires used in the course, expanding only the applicable questionnaires in the list of questionnaires.&lt;br /&gt;
##One should also be able to search for questionnaires by words used in questions that belong to the questionnaires.&lt;br /&gt;
#There should be a way to search all reviews of a particular team’s work for particular scores or text strings.  Reviews should be able to be filtered by score, text comment length, reviewer and reviewee.&lt;br /&gt;
#An instructor or administrator should be able to search for all the assignments that a particular user has participated in.&lt;br /&gt;
#If more than one criteria needs to be specified, there should be an 'Advanced Search' button.&lt;br /&gt;
&lt;br /&gt;
==Proposed Solution:==&lt;br /&gt;
&lt;br /&gt;
==Use Case Diagram==&lt;br /&gt;
[[File:UseCaseExpertizaSearch.png|center]]&lt;br /&gt;
&lt;br /&gt;
==Proposed Code Changes==&lt;br /&gt;
===Search for User:===&lt;br /&gt;
&lt;br /&gt;
In the current system workflow, we found that the user is unable to search in the Manage Users view. In the proposed workflow, we plan to enable the user to search by all the columns in the UI viz. Name, Full name, Email Address, Role, Parent by entering a partial or a complete text that matches with the particular field. We will also allow searching for fields irrespective of the case of the searched string. The user will be able to apply multiple filters at a time and the output of the query will match all filters applied. If no results are found, an empty list will be returned.&lt;br /&gt;
&lt;br /&gt;
Steps to reproduce the proposed workflow:&lt;br /&gt;
:#Log in to expertiza to view the home page&lt;br /&gt;
:#Go to Manage &amp;gt; Users&lt;br /&gt;
:#Type the search string in the search box available on the UI and select the column to search for from the dropdown.&lt;br /&gt;
:#To perform search based on multiple filters, the user can tap on the Advanced Search button adjacent to the Search button, the view renders a hidden div containing textboxes for all the columns, allowing the user to search based on multiple columns.&lt;br /&gt;
:#All the entries that match the specified criteria will be returned.&lt;br /&gt;
:#An empty list is returned if the search criteria doesn't match any valid records in the database.&lt;br /&gt;
&lt;br /&gt;
===Search for Assignments:===&lt;br /&gt;
&lt;br /&gt;
In the current system implementation, searching via the name of the assignment is supported with partial or complete assignment name. However, the search is case sensitive. In the proposed system, the user will be able to search for an assignment using additional filters such as Creation Date and Updated Date along with Assignment Name. The user will also be able to apply multiple filters at a time and the output of the query will match all filters applied. If no results are found, an empty list will be returned.&lt;br /&gt;
&lt;br /&gt;
To search for an assignment by Creation Date, the user will be prompted with a calendar where he can select a date and all the assignments created on or before the selected date will be displayed. &lt;br /&gt;
&lt;br /&gt;
To apply multiple filters, user can tap on the Advanced Search button available, adjacent to the Search button; a hidden div will then be rendered below containing textboxes for all the columns. All assignments that were created before the selected date for Creation Date or Updated Date columns and the ones that match other filters will be returned. A empty list will be returned if the search criteria doesn't match any records in the database.&lt;br /&gt;
&lt;br /&gt;
Steps to reproduce the proposed workflow:&lt;br /&gt;
:#Log in to expertiza to view the home page&lt;br /&gt;
:#Go to Manage &amp;gt; Assignments&lt;br /&gt;
:#Type the search criteria in the available search criteria and select the appropriate field from the dropdown.&lt;br /&gt;
:#To perform search based on multiple filters, the user can tap on the Advanced Search button adjacent to the Search button, the view renders a hidden div containing textboxes for all the columns, allowing the user to search based on multiple columns.&lt;br /&gt;
:#All the entries that match the given criteria will be returned.&lt;br /&gt;
:#An empty list is returned if the search criteria doesn't match any valid records in the database.&lt;br /&gt;
&lt;br /&gt;
===Search for Questionnaires:===&lt;br /&gt;
&lt;br /&gt;
The existing system does not have a search functionality under Questionnaires. The proposed system will implement a search functionality for searching via the name of the questionnaire, the text in the questions within a questionnaire, date of creation, and date updated by entering a partial or a complete text that matches with the particular field. We will also allow searching for fields irrespective of the case of the searched string. The user will be able to apply multiple filters at a time and the output of the query will match all the filters applied. If no results are found, an empty list will be returned.&lt;br /&gt;
&lt;br /&gt;
To search for an assignment by Creation Date, the user will be prompted with a calendar where he can select a date and all the assignments created on or before the selected date will be displayed. &lt;br /&gt;
&lt;br /&gt;
To apply multiple filters, user can tap on the Advanced Search button available, adjacent to the Search button; a hidden div will then be rendered below containing textboxes for all the columns. All assignments that were created before the selected date for Creation Date or Updated Date columns and the ones that match other filters will be returned. A empty list will be returned if the search criteria doesn't match any records in the database. The questionnaires will be grouped on the basis of their courses and will be expanded when clicked.&lt;br /&gt;
&lt;br /&gt;
Steps to reproduce the proposed workflow:&lt;br /&gt;
:#Log in to expertiza to view the home page&lt;br /&gt;
:#Go to Manage &amp;gt; Questionnaires&lt;br /&gt;
:#Type the search criteria in the available search criteria and select the appropriate field from the dropdown.&lt;br /&gt;
:#To perform search based on multiple filters, the user can tap on the Advanced Search button adjacent to the Search button, the view renders a hidden div containing textboxes for all the columns, allowing the user to search based on multiple columns.&lt;br /&gt;
:#All the entries that match the given criteria will be returned.&lt;br /&gt;
:#An empty list is returned if the search criteria doesn't match any valid records in the database.&lt;br /&gt;
&lt;br /&gt;
===Search for Reviews:===&lt;br /&gt;
&lt;br /&gt;
The existing system does not have a search functionality under Reviews. The proposed system will implement a search functionality for searching using the attributes like team name, score, reviewer, comment etc. by entering a partial or a complete text that matches with the particular field. We will also allow searching for fields irrespective of the case of the searched string. The user will be able to apply multiple filters at a time and the output of the query will match all the filters applied. If no results are found, an empty list will be returned.&lt;br /&gt;
&lt;br /&gt;
The user will be able to apply multiple filters at a time and the output of the query will match all filters applied. If no results are found, an empty list will be returned.&lt;br /&gt;
&lt;br /&gt;
Steps to reproduce the proposed workflow:&lt;br /&gt;
:#Log in to expertiza to view the home page&lt;br /&gt;
:#&lt;br /&gt;
:#Type the search criteria in the available search criteria and select the appropriate field from the dropdown.&lt;br /&gt;
:#To perform search based on multiple filters, the user can tap on the Advanced Search button adjacent to the Search button, the view renders a hidden div containing textboxes for all the columns, allowing the user to search based on multiple columns.&lt;br /&gt;
:#All the entries that match the given criteria will be returned.&lt;br /&gt;
:#An empty list is returned if the search criteria doesn't match any valid records in the database.&lt;br /&gt;
&lt;br /&gt;
==Database Design==&lt;br /&gt;
Below is the simplified version of the ER diagram which displays the relationships between the entity sets. Team_users and assignment_questionnaires are many to many relationships which are implemented in table format as show below.&lt;br /&gt;
&lt;br /&gt;
[[File:ER diagram.png|center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Relevant Tables===&lt;br /&gt;
[[File:User table.png|center]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Screen Shot 2018-11-20 at 11.42.06 PM.png|center]]&lt;br /&gt;
&lt;br /&gt;
==Test Plan: ==&lt;br /&gt;
=== Automated Tests ===&lt;br /&gt;
Automated tests in RSpec will be added as we implement the search functionality for each Model &amp;lt;br&amp;gt;&lt;br /&gt;
Most tests added will be unit tests that cover the test cases for each flow and changes in the model.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Test Details&lt;br /&gt;
* User Model ( spec/models/user_spec.rb )&lt;br /&gt;
# Search by user name&lt;br /&gt;
# Search by user name that does not exist&lt;br /&gt;
# Search by user email&lt;br /&gt;
# Search by user email that does not exist&lt;br /&gt;
# Search by user email containing a substring&lt;br /&gt;
# Search by user full name&lt;br /&gt;
# Search by user full name is empty&lt;br /&gt;
# Search by user name and email&lt;br /&gt;
# Search for assignments participated&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
* Assignment Model ( spec/models/assignment_spec.rb )&lt;br /&gt;
# Search by user name&lt;br /&gt;
# Search by institution&lt;br /&gt;
# Search by creation date&lt;br /&gt;
# Search by updated date&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
* Rubrics&lt;br /&gt;
# Search by name&lt;br /&gt;
# Search by courses used in&lt;br /&gt;
# Search by assignments used in&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
* Reviews&lt;br /&gt;
# Search all reviews of a particular team’s work for particular scores or text strings.  &lt;br /&gt;
# Search by score&lt;br /&gt;
# Search by text comment length&lt;br /&gt;
# Search by reviewer and reviewee&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
=== Manual Tests ===&lt;br /&gt;
====Search for User====&lt;br /&gt;
Setup: create a user with name=&amp;quot;student&amp;quot; and userId=&amp;quot;5000&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Action: Instructor clicks on manage - &amp;gt; users -&amp;gt; in textbox enters name=&amp;quot;student&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
Response: Relevant details of student, name=&amp;quot;student&amp;quot; is displayed&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Action: Instructor clicks on manage - &amp;gt; users -&amp;gt; advanced search-&amp;gt;clicks on checkbox student id and enters &amp;quot;5000&amp;quot; and click &amp;quot;ok&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
Response: Relevant details of student, name=&amp;quot;student&amp;quot; is displayed&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Search for Assignments====&lt;br /&gt;
Setup create an assignment with name=&amp;quot;assignment&amp;quot; and set a due date&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Action : Instructor clicks on Manage -&amp;gt; Assignments, in textbox enter &amp;quot;assignment&amp;quot; in relevant tab&amp;lt;br&amp;gt; &lt;br /&gt;
Response : Relevant assignment should be displayed&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Action : Instructor clicks on Manage -&amp;gt; Assignments-&amp;gt; drop down and apply filters for due date and enter date and click &amp;quot;ok&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
Response : Relevant assignments should be displayed&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Search for Questionnaires====&lt;br /&gt;
Setup : Create a Questionnaire, add questions to it&amp;lt;br&amp;gt;&lt;br /&gt;
Action : Log in as instructor,  Manage -&amp;gt; Questionnaires, in text box enter text&amp;lt;br&amp;gt;&lt;br /&gt;
Response : Questionnaires matching text are shown&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Action : Log in as instructor,  Manage -&amp;gt; Questionnaires, click advanced search and check creation date and enter value&amp;lt;br&amp;gt;&lt;br /&gt;
Response : Questionnaires matching text are shown&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Search for Reviews====&lt;br /&gt;
Setup : Setup review for an assignment, login as student and then add review &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Action : Log in as instructor, Manage -&amp;gt; Assignments, Click on Review Report icon on corresponding assignment&amp;lt;br&amp;gt;&lt;br /&gt;
Result : Review should be seen&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Action : Click Advanced search, check review by text  and enter text&amp;lt;br&amp;gt;  &lt;br /&gt;
Result : Matching review should be visible&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Nmchoks2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1987._Improving_search_facility_in_Expertiza&amp;diff=128474</id>
		<title>CSC/ECE 517 Fall 2019 - E1987. Improving search facility in Expertiza</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1987._Improving_search_facility_in_Expertiza&amp;diff=128474"/>
		<updated>2019-11-11T03:11:34Z</updated>

		<summary type="html">&lt;p&gt;Nmchoks2: /* Test Plan: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction:==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source application running on Ruby on Rails. It is used for management of courses and the assignments for respective courses, by the faculties and the students. The manage content section of the application has different views which displays information about the users, courses, assignments, questionnaires, and reviews. The application should have a fully functional search functionality throughout the views, so that a user can search any type of data with ease, on the basis of any number of parameters depending on his requirements. Users should be searched on the basis of one more parameters which include name, full name, email, etc. Similarly, assignments should be searched on the basis of name, created date, updated date, etc. However, the search functionality in the existing application is constrained to just a single parameter for users and assignments. Questionnaires management does not have a search functionality implemented as yet. This project works on improving the search functionality of Expertiza, by adding search bars if not present, introducing advanced search feature where user can search on the basis of more than one parameters and making the search functionality appear more elegant.&lt;br /&gt;
&lt;br /&gt;
==Problem Definition:==&lt;br /&gt;
&lt;br /&gt;
#An instructor or administrator can search for a user by name, user-ID, or other characteristics.&lt;br /&gt;
#An instructor should be able to search for assignments by name, due date, or other characteristics.&lt;br /&gt;
#An instructor should be able to search for rubrics (or other questionnaires) by name, or by the courses or assignments they have been used in.&lt;br /&gt;
##For the instructor, there also needs to be a way to quickly find rubrics (and other questionnaires) that have been used in a single course.  It should be possible to search or click somewhere to bring up a list of questionnaires used in the course, expanding only the applicable questionnaires in the list of questionnaires.&lt;br /&gt;
##One should also be able to search for questionnaires by words used in questions that belong to the questionnaires.&lt;br /&gt;
#There should be a way to search all reviews of a particular team’s work for particular scores or text strings.  Reviews should be able to be filtered by score, text comment length, reviewer and reviewee.&lt;br /&gt;
#An instructor or administrator should be able to search for all the assignments that a particular user has participated in.&lt;br /&gt;
#If more than one criteria needs to be specified, there should be an 'Advanced Search' button.&lt;br /&gt;
&lt;br /&gt;
==Proposed Solution:==&lt;br /&gt;
&lt;br /&gt;
==Use Case Diagram==&lt;br /&gt;
[[File:UseCaseExpertizaSearch.png|center]]&lt;br /&gt;
&lt;br /&gt;
==Proposed Code Changes==&lt;br /&gt;
===Search for User:===&lt;br /&gt;
&lt;br /&gt;
In the current system workflow, we found that the user is unable to search in the Manage Users view. In the proposed workflow, we plan to enable the user to search by all the columns in the UI viz. Name, Full name, Email Address, Role, Parent by entering a partial or a complete text that matches with the particular field. We will also allow searching for fields irrespective of the case of the searched string. The user will be able to apply multiple filters at a time and the output of the query will match all filters applied. If no results are found, an empty list will be returned.&lt;br /&gt;
&lt;br /&gt;
Steps to reproduce the proposed workflow:&lt;br /&gt;
:#Log in to expertiza to view the home page&lt;br /&gt;
:#Go to Manage &amp;gt; Users&lt;br /&gt;
:#Type the search string in the search box available on the UI and select the column to search for from the dropdown.&lt;br /&gt;
:#To perform search based on multiple filters, the user can tap on the Advanced Search button adjacent to the Search button, the view renders a hidden div containing textboxes for all the columns, allowing the user to search based on multiple columns.&lt;br /&gt;
:#All the entries that match the specified criteria will be returned.&lt;br /&gt;
:#An empty list is returned if the search criteria doesn't match any valid records in the database.&lt;br /&gt;
&lt;br /&gt;
===Search for Assignments:===&lt;br /&gt;
&lt;br /&gt;
In the current system implementation, searching via the name of the assignment is supported with partial or complete assignment name. However, the search is case sensitive. In the proposed system, the user will be able to search for an assignment using additional filters such as Creation Date and Updated Date along with Assignment Name. The user will also be able to apply multiple filters at a time and the output of the query will match all filters applied. If no results are found, an empty list will be returned.&lt;br /&gt;
&lt;br /&gt;
To search for an assignment by Creation Date, the user will be prompted with a calendar where he can select a date and all the assignments created on or before the selected date will be displayed. &lt;br /&gt;
&lt;br /&gt;
To apply multiple filters, user can tap on the Advanced Search button available, adjacent to the Search button; a hidden div will then be rendered below containing textboxes for all the columns. All assignments that were created before the selected date for Creation Date or Updated Date columns and the ones that match other filters will be returned. A empty list will be returned if the search criteria doesn't match any records in the database.&lt;br /&gt;
&lt;br /&gt;
Steps to reproduce the proposed workflow:&lt;br /&gt;
:#Log in to expertiza to view the home page&lt;br /&gt;
:#Go to Manage &amp;gt; Assignments&lt;br /&gt;
:#Type the search criteria in the available search criteria and select the appropriate field from the dropdown.&lt;br /&gt;
:#To perform search based on multiple filters, the user can tap on the Advanced Search button adjacent to the Search button, the view renders a hidden div containing textboxes for all the columns, allowing the user to search based on multiple columns.&lt;br /&gt;
:#All the entries that match the given criteria will be returned.&lt;br /&gt;
:#An empty list is returned if the search criteria doesn't match any valid records in the database.&lt;br /&gt;
&lt;br /&gt;
===Search for Questionnaires:===&lt;br /&gt;
&lt;br /&gt;
The existing system does not have a search functionality under Questionnaires. The proposed system will implement a search functionality for searching via the name of the questionnaire, the text in the questions within a questionnaire, date of creation, and date updated by entering a partial or a complete text that matches with the particular field. We will also allow searching for fields irrespective of the case of the searched string. The user will be able to apply multiple filters at a time and the output of the query will match all the filters applied. If no results are found, an empty list will be returned.&lt;br /&gt;
&lt;br /&gt;
To search for an assignment by Creation Date, the user will be prompted with a calendar where he can select a date and all the assignments created on or before the selected date will be displayed. &lt;br /&gt;
&lt;br /&gt;
To apply multiple filters, user can tap on the Advanced Search button available, adjacent to the Search button; a hidden div will then be rendered below containing textboxes for all the columns. All assignments that were created before the selected date for Creation Date or Updated Date columns and the ones that match other filters will be returned. A empty list will be returned if the search criteria doesn't match any records in the database. The questionnaires will be grouped on the basis of their courses and will be expanded when clicked.&lt;br /&gt;
&lt;br /&gt;
Steps to reproduce the proposed workflow:&lt;br /&gt;
:#Log in to expertiza to view the home page&lt;br /&gt;
:#Go to Manage &amp;gt; Questionnaires&lt;br /&gt;
:#Type the search criteria in the available search criteria and select the appropriate field from the dropdown.&lt;br /&gt;
:#To perform search based on multiple filters, the user can tap on the Advanced Search button adjacent to the Search button, the view renders a hidden div containing textboxes for all the columns, allowing the user to search based on multiple columns.&lt;br /&gt;
:#All the entries that match the given criteria will be returned.&lt;br /&gt;
:#An empty list is returned if the search criteria doesn't match any valid records in the database.&lt;br /&gt;
&lt;br /&gt;
===Search for Reviews:===&lt;br /&gt;
&lt;br /&gt;
The existing system does not have a search functionality under Reviews. The proposed system will implement a search functionality for searching using the attributes like team name, score, reviewer, comment etc. by entering a partial or a complete text that matches with the particular field. We will also allow searching for fields irrespective of the case of the searched string. The user will be able to apply multiple filters at a time and the output of the query will match all the filters applied. If no results are found, an empty list will be returned.&lt;br /&gt;
&lt;br /&gt;
The user will be able to apply multiple filters at a time and the output of the query will match all filters applied. If no results are found, an empty list will be returned.&lt;br /&gt;
&lt;br /&gt;
Steps to reproduce the proposed workflow:&lt;br /&gt;
:#Log in to expertiza to view the home page&lt;br /&gt;
:#&lt;br /&gt;
:#Type the search criteria in the available search criteria and select the appropriate field from the dropdown.&lt;br /&gt;
:#To perform search based on multiple filters, the user can tap on the Advanced Search button adjacent to the Search button, the view renders a hidden div containing textboxes for all the columns, allowing the user to search based on multiple columns.&lt;br /&gt;
:#All the entries that match the given criteria will be returned.&lt;br /&gt;
:#An empty list is returned if the search criteria doesn't match any valid records in the database.&lt;br /&gt;
&lt;br /&gt;
==Database Design==&lt;br /&gt;
Below is the simplified version of the ER diagram which displays the relationships between the entity sets. Team_users and assignment_questionnaires are many to many relationships which are implemented in table format as show below.&lt;br /&gt;
&lt;br /&gt;
[[File:ER diagram.png|center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Relevant Tables===&lt;br /&gt;
[[File:User table.png|center]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Screen Shot 2018-11-20 at 11.42.06 PM.png|center]]&lt;br /&gt;
&lt;br /&gt;
==Test Plan: ==&lt;br /&gt;
=== Automated Tests ===&lt;br /&gt;
Automated tests in RSpec will be added as we implement the search functionality for each Model &amp;lt;br&amp;gt;&lt;br /&gt;
Most tests added will be unit tests that cover the test cases for each flow and changes in the model.&amp;lt;br&amp;gt;&lt;br /&gt;
***Test Details***&lt;br /&gt;
* User Model ( spec/models/user_spec.rb )&lt;br /&gt;
# Search by user name&lt;br /&gt;
# Search by user name that does not exist&lt;br /&gt;
# Search by user email&lt;br /&gt;
# Search by user email that does not exist&lt;br /&gt;
# Search by user email containing a substring&lt;br /&gt;
# Search by user full name&lt;br /&gt;
# Search by user full name is empty&lt;br /&gt;
# Search by user name and email&lt;br /&gt;
# Search for assignments participated in.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
* Assignment Model ( spec/models/assignment_spec.rb )&lt;br /&gt;
# Search by user name&lt;br /&gt;
# Search by institution&lt;br /&gt;
# Search by creation date&lt;br /&gt;
# Search by updated date&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
* Rubrics&lt;br /&gt;
# Search by name&lt;br /&gt;
# Search by courses used in&lt;br /&gt;
# Search by assignments used in&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
* Reviews&lt;br /&gt;
# Search all reviews of a particular team’s work for particular scores or text strings.  &lt;br /&gt;
# Search by score&lt;br /&gt;
# Search by text comment length&lt;br /&gt;
# Search by reviewer and reviewee&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
=== Manual Tests ===&lt;br /&gt;
====Search for User====&lt;br /&gt;
Setup: create a user with name=&amp;quot;student&amp;quot; and userId=&amp;quot;5000&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Action: Instructor clicks on manage - &amp;gt; users -&amp;gt; in textbox enters name=&amp;quot;student&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
Response: Relevant details of student, name=&amp;quot;student&amp;quot; is displayed&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Action: Instructor clicks on manage - &amp;gt; users -&amp;gt; advanced search-&amp;gt;clicks on checkbox student id and enters &amp;quot;5000&amp;quot; and click &amp;quot;ok&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
Response: Relevant details of student, name=&amp;quot;student&amp;quot; is displayed&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Search for Assignments====&lt;br /&gt;
Setup create an assignment with name=&amp;quot;assignment&amp;quot; and set a due date&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Action : Instructor clicks on Manage -&amp;gt; Assignments, in textbox enter &amp;quot;assignment&amp;quot; in relevant tab&amp;lt;br&amp;gt; &lt;br /&gt;
Response : Relevant assignment should be displayed&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Action : Instructor clicks on Manage -&amp;gt; Assignments-&amp;gt; drop down and apply filters for due date and enter date and click &amp;quot;ok&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
Response : Relevant assignments should be displayed&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Search for Questionnaires====&lt;br /&gt;
Setup : Create a Questionnaire, add questions to it&amp;lt;br&amp;gt;&lt;br /&gt;
Action : Log in as instructor,  Manage -&amp;gt; Questionnaires, in text box enter text&amp;lt;br&amp;gt;&lt;br /&gt;
Response : Questionnaires matching text are shown&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Action : Log in as instructor,  Manage -&amp;gt; Questionnaires, click advanced search and check creation date and enter value&amp;lt;br&amp;gt;&lt;br /&gt;
Response : Questionnaires matching text are shown&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Search for Reviews====&lt;br /&gt;
Setup : Setup review for an assignment, login as student and then add review &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Action : Log in as instructor, Manage -&amp;gt; Assignments, Click on Review Report icon on corresponding assignment&amp;lt;br&amp;gt;&lt;br /&gt;
Result : Review should be seen&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Action : Click Advanced search, check review by text  and enter text&amp;lt;br&amp;gt;  &lt;br /&gt;
Result : Matching review should be visible&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Nmchoks2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1987._Improving_search_facility_in_Expertiza&amp;diff=128473</id>
		<title>CSC/ECE 517 Fall 2019 - E1987. Improving search facility in Expertiza</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1987._Improving_search_facility_in_Expertiza&amp;diff=128473"/>
		<updated>2019-11-11T03:11:20Z</updated>

		<summary type="html">&lt;p&gt;Nmchoks2: /* Test Plan: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction:==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source application running on Ruby on Rails. It is used for management of courses and the assignments for respective courses, by the faculties and the students. The manage content section of the application has different views which displays information about the users, courses, assignments, questionnaires, and reviews. The application should have a fully functional search functionality throughout the views, so that a user can search any type of data with ease, on the basis of any number of parameters depending on his requirements. Users should be searched on the basis of one more parameters which include name, full name, email, etc. Similarly, assignments should be searched on the basis of name, created date, updated date, etc. However, the search functionality in the existing application is constrained to just a single parameter for users and assignments. Questionnaires management does not have a search functionality implemented as yet. This project works on improving the search functionality of Expertiza, by adding search bars if not present, introducing advanced search feature where user can search on the basis of more than one parameters and making the search functionality appear more elegant.&lt;br /&gt;
&lt;br /&gt;
==Problem Definition:==&lt;br /&gt;
&lt;br /&gt;
#An instructor or administrator can search for a user by name, user-ID, or other characteristics.&lt;br /&gt;
#An instructor should be able to search for assignments by name, due date, or other characteristics.&lt;br /&gt;
#An instructor should be able to search for rubrics (or other questionnaires) by name, or by the courses or assignments they have been used in.&lt;br /&gt;
##For the instructor, there also needs to be a way to quickly find rubrics (and other questionnaires) that have been used in a single course.  It should be possible to search or click somewhere to bring up a list of questionnaires used in the course, expanding only the applicable questionnaires in the list of questionnaires.&lt;br /&gt;
##One should also be able to search for questionnaires by words used in questions that belong to the questionnaires.&lt;br /&gt;
#There should be a way to search all reviews of a particular team’s work for particular scores or text strings.  Reviews should be able to be filtered by score, text comment length, reviewer and reviewee.&lt;br /&gt;
#An instructor or administrator should be able to search for all the assignments that a particular user has participated in.&lt;br /&gt;
#If more than one criteria needs to be specified, there should be an 'Advanced Search' button.&lt;br /&gt;
&lt;br /&gt;
==Proposed Solution:==&lt;br /&gt;
&lt;br /&gt;
==Use Case Diagram==&lt;br /&gt;
[[File:UseCaseExpertizaSearch.png|center]]&lt;br /&gt;
&lt;br /&gt;
==Proposed Code Changes==&lt;br /&gt;
===Search for User:===&lt;br /&gt;
&lt;br /&gt;
In the current system workflow, we found that the user is unable to search in the Manage Users view. In the proposed workflow, we plan to enable the user to search by all the columns in the UI viz. Name, Full name, Email Address, Role, Parent by entering a partial or a complete text that matches with the particular field. We will also allow searching for fields irrespective of the case of the searched string. The user will be able to apply multiple filters at a time and the output of the query will match all filters applied. If no results are found, an empty list will be returned.&lt;br /&gt;
&lt;br /&gt;
Steps to reproduce the proposed workflow:&lt;br /&gt;
:#Log in to expertiza to view the home page&lt;br /&gt;
:#Go to Manage &amp;gt; Users&lt;br /&gt;
:#Type the search string in the search box available on the UI and select the column to search for from the dropdown.&lt;br /&gt;
:#To perform search based on multiple filters, the user can tap on the Advanced Search button adjacent to the Search button, the view renders a hidden div containing textboxes for all the columns, allowing the user to search based on multiple columns.&lt;br /&gt;
:#All the entries that match the specified criteria will be returned.&lt;br /&gt;
:#An empty list is returned if the search criteria doesn't match any valid records in the database.&lt;br /&gt;
&lt;br /&gt;
===Search for Assignments:===&lt;br /&gt;
&lt;br /&gt;
In the current system implementation, searching via the name of the assignment is supported with partial or complete assignment name. However, the search is case sensitive. In the proposed system, the user will be able to search for an assignment using additional filters such as Creation Date and Updated Date along with Assignment Name. The user will also be able to apply multiple filters at a time and the output of the query will match all filters applied. If no results are found, an empty list will be returned.&lt;br /&gt;
&lt;br /&gt;
To search for an assignment by Creation Date, the user will be prompted with a calendar where he can select a date and all the assignments created on or before the selected date will be displayed. &lt;br /&gt;
&lt;br /&gt;
To apply multiple filters, user can tap on the Advanced Search button available, adjacent to the Search button; a hidden div will then be rendered below containing textboxes for all the columns. All assignments that were created before the selected date for Creation Date or Updated Date columns and the ones that match other filters will be returned. A empty list will be returned if the search criteria doesn't match any records in the database.&lt;br /&gt;
&lt;br /&gt;
Steps to reproduce the proposed workflow:&lt;br /&gt;
:#Log in to expertiza to view the home page&lt;br /&gt;
:#Go to Manage &amp;gt; Assignments&lt;br /&gt;
:#Type the search criteria in the available search criteria and select the appropriate field from the dropdown.&lt;br /&gt;
:#To perform search based on multiple filters, the user can tap on the Advanced Search button adjacent to the Search button, the view renders a hidden div containing textboxes for all the columns, allowing the user to search based on multiple columns.&lt;br /&gt;
:#All the entries that match the given criteria will be returned.&lt;br /&gt;
:#An empty list is returned if the search criteria doesn't match any valid records in the database.&lt;br /&gt;
&lt;br /&gt;
===Search for Questionnaires:===&lt;br /&gt;
&lt;br /&gt;
The existing system does not have a search functionality under Questionnaires. The proposed system will implement a search functionality for searching via the name of the questionnaire, the text in the questions within a questionnaire, date of creation, and date updated by entering a partial or a complete text that matches with the particular field. We will also allow searching for fields irrespective of the case of the searched string. The user will be able to apply multiple filters at a time and the output of the query will match all the filters applied. If no results are found, an empty list will be returned.&lt;br /&gt;
&lt;br /&gt;
To search for an assignment by Creation Date, the user will be prompted with a calendar where he can select a date and all the assignments created on or before the selected date will be displayed. &lt;br /&gt;
&lt;br /&gt;
To apply multiple filters, user can tap on the Advanced Search button available, adjacent to the Search button; a hidden div will then be rendered below containing textboxes for all the columns. All assignments that were created before the selected date for Creation Date or Updated Date columns and the ones that match other filters will be returned. A empty list will be returned if the search criteria doesn't match any records in the database. The questionnaires will be grouped on the basis of their courses and will be expanded when clicked.&lt;br /&gt;
&lt;br /&gt;
Steps to reproduce the proposed workflow:&lt;br /&gt;
:#Log in to expertiza to view the home page&lt;br /&gt;
:#Go to Manage &amp;gt; Questionnaires&lt;br /&gt;
:#Type the search criteria in the available search criteria and select the appropriate field from the dropdown.&lt;br /&gt;
:#To perform search based on multiple filters, the user can tap on the Advanced Search button adjacent to the Search button, the view renders a hidden div containing textboxes for all the columns, allowing the user to search based on multiple columns.&lt;br /&gt;
:#All the entries that match the given criteria will be returned.&lt;br /&gt;
:#An empty list is returned if the search criteria doesn't match any valid records in the database.&lt;br /&gt;
&lt;br /&gt;
===Search for Reviews:===&lt;br /&gt;
&lt;br /&gt;
The existing system does not have a search functionality under Reviews. The proposed system will implement a search functionality for searching using the attributes like team name, score, reviewer, comment etc. by entering a partial or a complete text that matches with the particular field. We will also allow searching for fields irrespective of the case of the searched string. The user will be able to apply multiple filters at a time and the output of the query will match all the filters applied. If no results are found, an empty list will be returned.&lt;br /&gt;
&lt;br /&gt;
The user will be able to apply multiple filters at a time and the output of the query will match all filters applied. If no results are found, an empty list will be returned.&lt;br /&gt;
&lt;br /&gt;
Steps to reproduce the proposed workflow:&lt;br /&gt;
:#Log in to expertiza to view the home page&lt;br /&gt;
:#&lt;br /&gt;
:#Type the search criteria in the available search criteria and select the appropriate field from the dropdown.&lt;br /&gt;
:#To perform search based on multiple filters, the user can tap on the Advanced Search button adjacent to the Search button, the view renders a hidden div containing textboxes for all the columns, allowing the user to search based on multiple columns.&lt;br /&gt;
:#All the entries that match the given criteria will be returned.&lt;br /&gt;
:#An empty list is returned if the search criteria doesn't match any valid records in the database.&lt;br /&gt;
&lt;br /&gt;
==Database Design==&lt;br /&gt;
Below is the simplified version of the ER diagram which displays the relationships between the entity sets. Team_users and assignment_questionnaires are many to many relationships which are implemented in table format as show below.&lt;br /&gt;
&lt;br /&gt;
[[File:ER diagram.png|center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Relevant Tables===&lt;br /&gt;
[[File:User table.png|center]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Screen Shot 2018-11-20 at 11.42.06 PM.png|center]]&lt;br /&gt;
&lt;br /&gt;
==Test Plan: ==&lt;br /&gt;
=== Automated Tests ===&lt;br /&gt;
Automated tests in RSpec will be added as we implement the search functionality for each Model &amp;lt;br&amp;gt;&lt;br /&gt;
Most tests added will be unit tests that cover the test cases for each flow and changes in the model.&amp;lt;br&amp;gt;&lt;br /&gt;
Test Details &lt;br /&gt;
* User Model ( spec/models/user_spec.rb )&lt;br /&gt;
# Search by user name&lt;br /&gt;
# Search by user name that does not exist&lt;br /&gt;
# Search by user email&lt;br /&gt;
# Search by user email that does not exist&lt;br /&gt;
# Search by user email containing a substring&lt;br /&gt;
# Search by user full name&lt;br /&gt;
# Search by user full name is empty&lt;br /&gt;
# Search by user name and email&lt;br /&gt;
# Search for assignments participated in.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
* Assignment Model ( spec/models/assignment_spec.rb )&lt;br /&gt;
# Search by user name&lt;br /&gt;
# Search by institution&lt;br /&gt;
# Search by creation date&lt;br /&gt;
# Search by updated date&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
* Rubrics&lt;br /&gt;
# Search by name&lt;br /&gt;
# Search by courses used in&lt;br /&gt;
# Search by assignments used in&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
* Reviews&lt;br /&gt;
# Search all reviews of a particular team’s work for particular scores or text strings.  &lt;br /&gt;
# Search by score&lt;br /&gt;
# Search by text comment length&lt;br /&gt;
# Search by reviewer and reviewee&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
=== Manual Tests ===&lt;br /&gt;
====Search for User====&lt;br /&gt;
Setup: create a user with name=&amp;quot;student&amp;quot; and userId=&amp;quot;5000&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Action: Instructor clicks on manage - &amp;gt; users -&amp;gt; in textbox enters name=&amp;quot;student&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
Response: Relevant details of student, name=&amp;quot;student&amp;quot; is displayed&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Action: Instructor clicks on manage - &amp;gt; users -&amp;gt; advanced search-&amp;gt;clicks on checkbox student id and enters &amp;quot;5000&amp;quot; and click &amp;quot;ok&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
Response: Relevant details of student, name=&amp;quot;student&amp;quot; is displayed&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Search for Assignments====&lt;br /&gt;
Setup create an assignment with name=&amp;quot;assignment&amp;quot; and set a due date&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Action : Instructor clicks on Manage -&amp;gt; Assignments, in textbox enter &amp;quot;assignment&amp;quot; in relevant tab&amp;lt;br&amp;gt; &lt;br /&gt;
Response : Relevant assignment should be displayed&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Action : Instructor clicks on Manage -&amp;gt; Assignments-&amp;gt; drop down and apply filters for due date and enter date and click &amp;quot;ok&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
Response : Relevant assignments should be displayed&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Search for Questionnaires====&lt;br /&gt;
Setup : Create a Questionnaire, add questions to it&amp;lt;br&amp;gt;&lt;br /&gt;
Action : Log in as instructor,  Manage -&amp;gt; Questionnaires, in text box enter text&amp;lt;br&amp;gt;&lt;br /&gt;
Response : Questionnaires matching text are shown&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Action : Log in as instructor,  Manage -&amp;gt; Questionnaires, click advanced search and check creation date and enter value&amp;lt;br&amp;gt;&lt;br /&gt;
Response : Questionnaires matching text are shown&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Search for Reviews====&lt;br /&gt;
Setup : Setup review for an assignment, login as student and then add review &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Action : Log in as instructor, Manage -&amp;gt; Assignments, Click on Review Report icon on corresponding assignment&amp;lt;br&amp;gt;&lt;br /&gt;
Result : Review should be seen&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Action : Click Advanced search, check review by text  and enter text&amp;lt;br&amp;gt;  &lt;br /&gt;
Result : Matching review should be visible&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Nmchoks2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1987._Improving_search_facility_in_Expertiza&amp;diff=128380</id>
		<title>CSC/ECE 517 Fall 2019 - E1987. Improving search facility in Expertiza</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1987._Improving_search_facility_in_Expertiza&amp;diff=128380"/>
		<updated>2019-11-11T01:45:52Z</updated>

		<summary type="html">&lt;p&gt;Nmchoks2: /* Automated Tests */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction:==&lt;br /&gt;
&lt;br /&gt;
The Expertiza application running on Ruby on Rails is used for a variety of purposes by students and faculty members. There are many pages that display information about students, assignments, rubrics and reviews. The information is displayed with attributes like name, ID, due date etc. This project works on improving the search facility by adding search criteria in existing search bars, making it look elegant and adding search bars if not present.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Problem Definition:==&lt;br /&gt;
&lt;br /&gt;
#An instructor or administrator can search for a user by name, user-ID, or other characteristics.&lt;br /&gt;
#An instructor should be able to search for assignments by name, due date, or other characteristics.&lt;br /&gt;
#An instructor should be able to search for rubrics (or other questionnaires) by name, or by the courses or assignments they have been used in.&lt;br /&gt;
##For the instructor, there also needs to be a way to quickly find rubrics (and other questionnaires) that have been used in a single course.  It should be possible to search or click somewhere to bring up a list of questionnaires used in the course, expanding only the applicable questionnaires in the list of questionnaires.&lt;br /&gt;
##One should also be able to search for questionnaires by words used in questions that belong to the questionnaires.&lt;br /&gt;
#There should be a way to search all reviews of a particular team’s work for particular scores or text strings.  Reviews should be able to be filtered by score, text comment length, reviewer and reviewee.&lt;br /&gt;
#An instructor or administrator should be able to search for all the assignments that a particular user has participated in.&lt;br /&gt;
#If more than one criteria needs to be specified, there should be an 'Advanced Search' button.&lt;br /&gt;
&lt;br /&gt;
==Proposed Solution:==&lt;br /&gt;
&lt;br /&gt;
==Use Case Diagram==&lt;br /&gt;
[[File:UseCaseExpertizaSearch.png|center]]&lt;br /&gt;
&lt;br /&gt;
==Proposed Code Changes==&lt;br /&gt;
&lt;br /&gt;
==Database Design==&lt;br /&gt;
Below is the simplified version of the ER diagram which displays the relationships between the entity sets. Team_users and assignment_questionnaires are many to many relationships which are implemented in table format as show below.&lt;br /&gt;
&lt;br /&gt;
[[File:ER diagram.png|center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Relevant Tables===&lt;br /&gt;
[[File:User table.png|center]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Screen Shot 2018-11-20 at 11.42.06 PM.png|center]]&lt;br /&gt;
&lt;br /&gt;
==Test Plan: ==&lt;br /&gt;
We plan to two types of testing &lt;br /&gt;
=== UI Tests ===&lt;br /&gt;
====Search for User====&lt;br /&gt;
Setup: create a user with name=&amp;quot;student&amp;quot; and userId=&amp;quot;5000&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Action: Instructor clicks on manage - &amp;gt; users -&amp;gt; in textbox enters name=&amp;quot;student&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
Response: Relevant details of student, name=&amp;quot;student&amp;quot; is displayed&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Action: Instructor clicks on manage - &amp;gt; users -&amp;gt; advanced search-&amp;gt;clicks on checkbox student id and enters &amp;quot;5000&amp;quot; and click &amp;quot;ok&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
Response: Relevant details of student, name=&amp;quot;student&amp;quot; is displayed&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Search for Assignments====&lt;br /&gt;
Setup create an assignment with name=&amp;quot;assignment&amp;quot; and set a due date&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Action : Instructor clicks on Manage -&amp;gt; Assignments, in textbox enter &amp;quot;assignment&amp;quot; in relevant tab&amp;lt;br&amp;gt; &lt;br /&gt;
Response : Relevant assignment should be displayed&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Action : Instructor clicks on Manage -&amp;gt; Assignments-&amp;gt; drop down and apply filters for due date and enter date and click &amp;quot;ok&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
Response : Relevant assignments should be displayed&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Search for Questionnaires====&lt;br /&gt;
Setup : Create a Questionnaire, add questions to it&amp;lt;br&amp;gt;&lt;br /&gt;
Action : Log in as instructor,  Manage -&amp;gt; Questionnaires, in text box enter text&amp;lt;br&amp;gt;&lt;br /&gt;
Response : Questionnaires matching text are shown&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Action : Log in as instructor,  Manage -&amp;gt; Questionnaires, click advanced search and check creation date and enter value&amp;lt;br&amp;gt;&lt;br /&gt;
Response : Questionnaires matching text are shown&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Search for Reviews====&lt;br /&gt;
Setup : Setup review for an assignment, login as student and then add review &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Action : Log in as instructor, Manage -&amp;gt; Assignments, Click on Review Report icon on corresponding assignment&amp;lt;br&amp;gt;&lt;br /&gt;
Result : Review should be seen&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Action : Click Advanced search, check review by text  and enter text&amp;lt;br&amp;gt;  &lt;br /&gt;
Result : Matching review should be visible&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Automated Tests ===&lt;br /&gt;
Automated tests in RSpec will be added as we implement the search functionality for each Model &amp;lt;br&amp;gt;&lt;br /&gt;
Most tests added will be unit tests that cover the test cases for each flow and changes in the model.&amp;lt;br&amp;gt;&lt;br /&gt;
Test Details &lt;br /&gt;
* User Model ( spec/models/user_spec.rb )&lt;br /&gt;
# Search by user name&lt;br /&gt;
# Search by user name that does not exist&lt;br /&gt;
# Search by user email&lt;br /&gt;
# Search by user email that does not exist&lt;br /&gt;
# Search by user email containing a substring&lt;br /&gt;
# Search by user full name&lt;br /&gt;
# Search by user full name is empty&lt;br /&gt;
# Search by user name and email&lt;br /&gt;
# Search for assignments participated in.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
* Assignment Model ( spec/models/assignment_spec.rb )&lt;br /&gt;
# Search by user name&lt;br /&gt;
# Search by institution&lt;br /&gt;
# Search by creation date&lt;br /&gt;
# Search by updated date&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
* Rubrics&lt;br /&gt;
# Search by name&lt;br /&gt;
# Search by courses used in&lt;br /&gt;
# Search by assignments used in&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
* Reviews&lt;br /&gt;
# Search all reviews of a particular team’s work for particular scores or text strings.  &lt;br /&gt;
# Search by score&lt;br /&gt;
# Search by text comment length&lt;br /&gt;
# Search by reviewer and reviewee&lt;/div&gt;</summary>
		<author><name>Nmchoks2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1987._Improving_search_facility_in_Expertiza&amp;diff=128355</id>
		<title>CSC/ECE 517 Fall 2019 - E1987. Improving search facility in Expertiza</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1987._Improving_search_facility_in_Expertiza&amp;diff=128355"/>
		<updated>2019-11-11T01:24:37Z</updated>

		<summary type="html">&lt;p&gt;Nmchoks2: /* Test Plan: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction:==&lt;br /&gt;
&lt;br /&gt;
The Expertiza application running on Ruby on Rails is used for a variety of purposes by students and faculty members. There are many pages that display information about students, assignments, rubrics and reviews. The information is displayed with attributes like name, ID, due date etc. This project works on improving the search facility by adding search criteria in existing search bars, making it look elegant and adding search bars if not present.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Problem Definition:==&lt;br /&gt;
&lt;br /&gt;
#An instructor or administrator can search for a user by name, user-ID, or other characteristics.&lt;br /&gt;
#An instructor should be able to search for assignments by name, due date, or other characteristics.&lt;br /&gt;
#An instructor should be able to search for rubrics (or other questionnaires) by name, or by the courses or assignments they have been used in.&lt;br /&gt;
##For the instructor, there also needs to be a way to quickly find rubrics (and other questionnaires) that have been used in a single course.  It should be possible to search or click somewhere to bring up a list of questionnaires used in the course, expanding only the applicable questionnaires in the list of questionnaires.&lt;br /&gt;
##One should also be able to search for questionnaires by words used in questions that belong to the questionnaires.&lt;br /&gt;
#There should be a way to search all reviews of a particular team’s work for particular scores or text strings.  Reviews should be able to be filtered by score, text comment length, reviewer and reviewee.&lt;br /&gt;
#An instructor or administrator should be able to search for all the assignments that a particular user has participated in.&lt;br /&gt;
#If more than one criteria needs to be specified, there should be an 'Advanced Search' button.&lt;br /&gt;
&lt;br /&gt;
==Proposed Solution:==&lt;br /&gt;
&lt;br /&gt;
==Use Case Diagram==&lt;br /&gt;
[[File:UseCaseExpertizaSearch.png|center]]&lt;br /&gt;
&lt;br /&gt;
==Proposed Code Changes==&lt;br /&gt;
&lt;br /&gt;
==Database Design==&lt;br /&gt;
&lt;br /&gt;
==Test Plan: ==&lt;br /&gt;
We plan to two types of testing &lt;br /&gt;
=== UI Tests ===&lt;br /&gt;
====Search for User====&lt;br /&gt;
Setup: create a user with name=&amp;quot;student&amp;quot; and userId=&amp;quot;5000&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Action: Instructor clicks on manage - &amp;gt; users -&amp;gt; in textbox enters name=&amp;quot;student&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
Response: Relevant details of student, name=&amp;quot;student&amp;quot; is displayed&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Action: Instructor clicks on manage - &amp;gt; users -&amp;gt; advanced search-&amp;gt;clicks on checkbox student id and enters &amp;quot;5000&amp;quot; and click &amp;quot;ok&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
Response: Relevant details of student, name=&amp;quot;student&amp;quot; is displayed&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Search for Assignments====&lt;br /&gt;
Setup create an assignment with name=&amp;quot;assignment&amp;quot; and set a due date&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Action : Instructor clicks on Manage -&amp;gt; Assignments, in textbox enter &amp;quot;assignment&amp;quot; in relevant tab&amp;lt;br&amp;gt; &lt;br /&gt;
Response : Relevant assignment should be displayed&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Action : Instructor clicks on Manage -&amp;gt; Assignments-&amp;gt; drop down and apply filters for due date and enter date and click &amp;quot;ok&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
Response : Relevant assignments should be displayed&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Search for Questionnaires====&lt;br /&gt;
Setup : Create a Questionnaire, add questions to it&amp;lt;br&amp;gt;&lt;br /&gt;
Action : Log in as instructor,  Manage -&amp;gt; Questionnaires, in text box enter text&amp;lt;br&amp;gt;&lt;br /&gt;
Response : Questionnaires matching text are shown&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Action : Log in as instructor,  Manage -&amp;gt; Questionnaires, click advanced search and check creation date and enter value&amp;lt;br&amp;gt;&lt;br /&gt;
Response : Questionnaires matching text are shown&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Search for Reviews====&lt;br /&gt;
Setup : Setup review for an assignment, login as student and then add review &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Action : Log in as instructor, Manage -&amp;gt; Assignments, Click on Review Report icon on corresponding assignment&amp;lt;br&amp;gt;&lt;br /&gt;
Result : Review should be seen&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Action : Click Advanced search, check review by text  and enter text&amp;lt;br&amp;gt;  &lt;br /&gt;
Result : Matching review should be visible&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Automated Tests ===&lt;br /&gt;
Automated tests in RSpec will be added as we implement the search functionality for each Model &amp;lt;br&amp;gt;&lt;br /&gt;
Most tests added will be unit tests that cover the test cases for each flow and changes in the model.&amp;lt;br&amp;gt;&lt;br /&gt;
Test Details &lt;br /&gt;
* User Model ( spec/models/user_spec.rb )&lt;br /&gt;
# Search by user name&lt;br /&gt;
# Search by user name that does not exist&lt;br /&gt;
# Search by user email&lt;br /&gt;
# Search by user email that does not exist&lt;br /&gt;
# Search by user email containing a substring&lt;br /&gt;
# Search by user full name&lt;br /&gt;
# Search by user full name is empty&lt;br /&gt;
# Search by user name and email&lt;/div&gt;</summary>
		<author><name>Nmchoks2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1987._Improving_search_facility_in_Expertiza&amp;diff=128323</id>
		<title>CSC/ECE 517 Fall 2019 - E1987. Improving search facility in Expertiza</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1987._Improving_search_facility_in_Expertiza&amp;diff=128323"/>
		<updated>2019-11-11T00:22:01Z</updated>

		<summary type="html">&lt;p&gt;Nmchoks2: /* Use Case Diagram */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction:==&lt;br /&gt;
&lt;br /&gt;
The Expertiza application running on Ruby on Rails is used for a variety of purposes by students and faculty members. There are many pages that display information about students, assignments, rubrics and reviews. The information is displayed with attributes like name, ID, due date etc. This project works on improving the search facility by adding search criteria in existing search bars, making it look elegant and adding search bars if not present.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Problem Definition:==&lt;br /&gt;
&lt;br /&gt;
#An instructor or administrator can search for a user by name, user-ID, or other characteristics.&lt;br /&gt;
#An instructor should be able to search for assignments by name, due date, or other characteristics.&lt;br /&gt;
#An instructor should be able to search for rubrics (or other questionnaires) by name, or by the courses or assignments they have been used in.&lt;br /&gt;
##For the instructor, there also needs to be a way to quickly find rubrics (and other questionnaires) that have been used in a single course.  It should be possible to search or click somewhere to bring up a list of questionnaires used in the course, expanding only the applicable questionnaires in the list of questionnaires.&lt;br /&gt;
##One should also be able to search for questionnaires by words used in questions that belong to the questionnaires.&lt;br /&gt;
#There should be a way to search all reviews of a particular team’s work for particular scores or text strings.  Reviews should be able to be filtered by score, text comment length, reviewer and reviewee.&lt;br /&gt;
#An instructor or administrator should be able to search for all the assignments that a particular user has participated in.&lt;br /&gt;
#If more than one criteria needs to be specified, there should be an 'Advanced Search' button.&lt;br /&gt;
&lt;br /&gt;
==Proposed Solution:==&lt;br /&gt;
&lt;br /&gt;
==Use Case Diagram==&lt;br /&gt;
[[File:Usecase search.png|center]]&lt;br /&gt;
&lt;br /&gt;
==Proposed Code Changes==&lt;br /&gt;
&lt;br /&gt;
==Database Design==&lt;br /&gt;
&lt;br /&gt;
==Test Plan: ==&lt;/div&gt;</summary>
		<author><name>Nmchoks2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1987._Improving_search_facility_in_Expertiza&amp;diff=128319</id>
		<title>CSC/ECE 517 Fall 2019 - E1987. Improving search facility in Expertiza</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1987._Improving_search_facility_in_Expertiza&amp;diff=128319"/>
		<updated>2019-11-11T00:17:05Z</updated>

		<summary type="html">&lt;p&gt;Nmchoks2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction:==&lt;br /&gt;
&lt;br /&gt;
The Expertiza application running on Ruby on Rails is used for a variety of purposes by students and faculty members. There are many pages that display information about students, assignments, rubrics and reviews. The information is displayed with attributes like name, ID, due date etc. This project works on improving the search facility by adding search criteria in existing search bars, making it look elegant and adding search bars if not present.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Problem Definition:==&lt;br /&gt;
&lt;br /&gt;
# An instructor or administrator can search for a user by name, user-ID, or other characteristics.&lt;br /&gt;
# An instructor should be able to search for assignments by name, due date, or other characteristics.&lt;br /&gt;
# An instructor should be able to search for rubrics (or other questionnaires) by name, or by the courses or assignments they have been used in.&lt;br /&gt;
## For the instructor, there also needs to be a way to quickly find rubrics (and other questionnaires) that have been used in a single course.  It should be possible to search or click somewhere to bring up a list of questionnaires used in the course, expanding only the applicable questionnaires in the list of questionnaires.&lt;br /&gt;
## One should also be able to search for questionnaires by words used in questions that belong to the questionnaires.&lt;br /&gt;
#There should be a way to search all reviews of a particular team’s work for particular scores or text strings.  Reviews should be able to be filtered by score, text comment length, reviewer and reviewee.&lt;br /&gt;
#An instructor or administrator should be able to search for all the assignments that a particular user has participated in.&lt;br /&gt;
#If more than one criteria needs to be specified, there should be an 'Advanced Search' button.&lt;br /&gt;
&lt;br /&gt;
==Proposed Solution:==&lt;br /&gt;
&lt;br /&gt;
==Use Case Diagram==&lt;br /&gt;
&lt;br /&gt;
==Proposed Code Changes==&lt;br /&gt;
&lt;br /&gt;
==Database Design==&lt;br /&gt;
&lt;br /&gt;
==Test Plan: ==&lt;/div&gt;</summary>
		<author><name>Nmchoks2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1987._Improving_search_facility_in_Expertiza&amp;diff=128307</id>
		<title>CSC/ECE 517 Fall 2019 - E1987. Improving search facility in Expertiza</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1987._Improving_search_facility_in_Expertiza&amp;diff=128307"/>
		<updated>2019-11-11T00:09:46Z</updated>

		<summary type="html">&lt;p&gt;Nmchoks2: Created page with &amp;quot;==Introduction:==  The Expertiza application running on Ruby on Rails is used for a variety of purposes by students and faculty members. There are many pages that display informa...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction:==&lt;br /&gt;
&lt;br /&gt;
The Expertiza application running on Ruby on Rails is used for a variety of purposes by students and faculty members. There are many pages that display information about students, assignments, rubrics and reviews. The information is displayed with attributes like name, ID, due date etc. This project works on improving the search facility by adding search criteria in existing search bars, making it look elegant and adding search bars if not present.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Problem Definition:==&lt;br /&gt;
&lt;br /&gt;
# An instructor or administrator can search for a user by name, user-ID, or other characteristics.&lt;br /&gt;
# An instructor should be able to search for assignments by name, due date, or other characteristics.&lt;br /&gt;
# An instructor should be able to search for rubrics (or other questionnaires) by name, or by the courses or assignments they have been used in.&lt;br /&gt;
## For the instructor, there also needs to be a way to quickly find rubrics (and other questionnaires) that have been used in a single course.  It should be possible to search or click somewhere to bring up a list of questionnaires used in the course, expanding only the applicable questionnaires in the list of questionnaires.&lt;br /&gt;
## One should also be able to search for questionnaires by words used in questions that belong to the questionnaires.&lt;br /&gt;
#There should be a way to search all reviews of a particular team’s work for particular scores or text strings.  Reviews should be able to be filtered by score, text comment length, reviewer and reviewee.&lt;br /&gt;
#An instructor or administrator should be able to search for all the assignments that a particular user has participated in.&lt;br /&gt;
#If more than one criteria needs to be specified, there should be an 'Advanced Search' button.&lt;br /&gt;
&lt;br /&gt;
==Use Case Diagram==&lt;br /&gt;
&lt;br /&gt;
==Proposed Solution:==&lt;br /&gt;
&lt;br /&gt;
==Database Design==&lt;br /&gt;
&lt;br /&gt;
==Test Plan: ==&lt;/div&gt;</summary>
		<author><name>Nmchoks2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019&amp;diff=128304</id>
		<title>CSC/ECE 517 Fall 2019</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019&amp;diff=128304"/>
		<updated>2019-11-11T00:07:28Z</updated>

		<summary type="html">&lt;p&gt;Nmchoks2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* [[CSC/ECE 517 Fall 2019 - Project E1947. Refactor quiz_questionnaire_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - Project E1965. Review report should link to the usual view for reviews]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - Project E1943. Refactor sign up sheet controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1972. OSS project J. Skellington: Accessing Assignment Rubrics]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1961. Email notification to reviewers and instructors]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1971. OSS project Finklestein: Instructors &amp;amp; Institutions]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1953. Tagging report for student]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1955.Write  unit tests for student_task.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1954. Auto-generate submission directory names based on assignment names]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1958. Two issues related to assignment management]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1948. Refactor review_mapping_helper.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1959. Intelligent copying of assignments without topics]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1968. Fixes for adding members to teams]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1969. Fixes for reviews not being available]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1951. Remove multiple topics at a time]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1957. Time travel Not Allowed..!!! Restrict TAs’ ability to change their own grade + limit file-size upload]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1963. Changing assignment participant role]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1941. Issues related to topic deadlines]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1966. Tabbed_reviews partial file refactor for displaying the alternate view of reviews]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1962. Email notification upon account creation]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1967. Fix glitches in author feedback]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1960. Create new late policy successfully and fixing &amp;quot;Back&amp;quot; link]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1939. OSS Project Juniper: Bookmark enhancements]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - M1950. Support Asynchronous Web Assembly Compilation]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1938. OSS project Duke Blue: Fix import glitches]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - M1951. Implement missing OffscreenCanvas APIs]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1940. Improving email notification]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1956. There is no shortcut to get free review points: Review Assignment Bug]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1942. Refactor stage deadlines in assignment.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - M1952. Missing DOM features project]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1945. Refactor users_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1964. Export review scores for projects]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1949. Write Unit Tests for Importing assignment participants and import glitches]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1944. Refactor review mapping controller]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1946. Refactor Questionnaire controller]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1982. Regulate changing of rubrics while projects are in progress]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1989. Track the time students look at other submissions]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1990. Integrate suggestion detection algorithm]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1995. Tests for email functionality]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1993 Track Time Between Successive Tag Assignments]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1979. Completion/Progress view]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1995. Weights in grade calculation]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1980. Sort instructor reports by name, ID, score, etc.]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1984. Improve self-review  Link peer review &amp;amp; self-review to derive grades]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1994. Mentor management for assignments without topics]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1997. Issues related to meta-reviewing]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1981. Student-generated questions added to rubric]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1996. Enhancements to review grader]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1987. Improving search facility in Expertiza]]&lt;/div&gt;</summary>
		<author><name>Nmchoks2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1938._OSS_project_Duke_Blue:_Fix_import_glitches&amp;diff=127747</id>
		<title>CSC/ECE 517 Fall 2019 - E1938. OSS project Duke Blue: Fix import glitches</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1938._OSS_project_Duke_Blue:_Fix_import_glitches&amp;diff=127747"/>
		<updated>2019-11-07T01:50:05Z</updated>

		<summary type="html">&lt;p&gt;Nmchoks2: /* Test Plan */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
== '''About Expertiza''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source project based on Ruby on Rails framework and the code is available on Github. Expertiza allows the instructor to create new assignments as well as edit new or existing assignments. Instructors can also create a list of topics the students can sign up for and specify deadlines for completion of various tasks. Students can form teams in Expertiza to work on various projects and assignments as well as peer review other students' submissions. Expertiza supports submission across various document types, including the URLs Wiki pages.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
The import feature is the most helpful feature for instructors to set up assignments. The instructors usually have a list of students, teams, etc from their learning management system. Being able to import these into expertiza saves a lot of time when setting up an assignment. Unfortunately this feature has some bugs that were identified as the following list. &lt;br /&gt;
&lt;br /&gt;
'''Issue 918''': It seems that non-ASCII characters in the description (e.g., a curly apostrophe, and perhaps also an en-dash) caused a SQL error in inserting the description string into the db. I had to edit the import file to remove non-ASCII characters. Any Unicode character ought to be allowed in a description. &lt;br /&gt;
&lt;br /&gt;
'''Issue 153''': There should be a way to import a list of who has signed up for which topic. When a signup sheet is used in Expertiza, users are expected to sign up for topics. But, the instructor might've taken signups offline, e.g., by passing around a signup sheet in class. There should be a way to import this list to Expertiza, rather than impersonate all the students one by one and sign them up for a topic. '''This issue is not a bug but an additional feature to the existing import topic functionality.'''&lt;br /&gt;
&lt;br /&gt;
'''Issue 329''': When importing teams there are different options to handle conflicting team names &lt;br /&gt;
&lt;br /&gt;
'''Issue 328''': When importing teams, and a conflict exists there is an option to merge the two teams by inserting the new members into an existing team. Unfortunately, this feature is broken. we tried to import a team and selected 'Insert any new members into existing team'. No new team members were in fact inserted into the team&lt;br /&gt;
&lt;br /&gt;
== '''Fixes''' ==&lt;br /&gt;
=====Issue 918=====&lt;br /&gt;
&lt;br /&gt;
'''Problem:''' The application is not able to import topics with non ascii characters in its description field. &amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' Before the topic object is persisted into the database, check for any non ascii characters in the description field and strip them. &amp;lt;br&amp;gt;&lt;br /&gt;
'''Code Changes'''&amp;lt;br&amp;gt;&lt;br /&gt;
New code introduced is as follows.&amp;lt;br&amp;gt;&lt;br /&gt;
File:app/helpers/import_topics_helper.rb &amp;lt;br&amp;gt;&lt;br /&gt;
Here, a new function 'trim_non_ascii' has been added which iterates a given string character by character, and replaces each non ascii character with a white space character. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  def self.define_attributes(row_hash)&lt;br /&gt;
    attributes = {}&lt;br /&gt;
    if !row_hash[:description].nil? and !row_hash[:description].ascii_only?&lt;br /&gt;
      row_hash[:description] = self.trim_non_ascii(row_hash[:description])&lt;br /&gt;
      puts row_hash[:description]&lt;br /&gt;
    end&lt;br /&gt;
    attributes[&amp;quot;topic_identifier&amp;quot;] = row_hash[:topic_identifier].strip&lt;br /&gt;
    attributes[&amp;quot;topic_name&amp;quot;] = row_hash[:topic_name].strip&lt;br /&gt;
    attributes[&amp;quot;max_choosers&amp;quot;] = row_hash[:max_choosers].strip&lt;br /&gt;
    attributes&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def self.trim_non_ascii(string)&lt;br /&gt;
    string.split('').each do |char|&lt;br /&gt;
      !char.ascii_only? ? string.tr!(char, ' ') : nil&lt;br /&gt;
    end&lt;br /&gt;
    string.gsub!(/\s+/, ' ')&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
=====Issue 328=====&lt;br /&gt;
&lt;br /&gt;
'''Problem''': When importing teams, and a conflict exists there is an option to merge the two teams by inserting the new members into an existing team.&lt;br /&gt;
&lt;br /&gt;
'''Solution''': This was an issue to fix the functionality of Insert any new members into existing team. This was due to faulty handling of the option handle_dups and incorrect checking of parameters.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Code was modified to ensure minimal impact to existing testcases and functionalities.&amp;lt;br&amp;gt;&lt;br /&gt;
The handling of handle_dups in options was done assuming that the parameter was a symbol. But when tested, it was found to be a string and hence the handling was updated accordingly.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
      name = handle_duplicate(team, name, id, options[&amp;quot;handle_dups&amp;quot;], teamtype)&lt;br /&gt;
Also, the if and else conditions for checking class type of used was wrong. This was updated based on how the variable was assigned in the '''import_file_controller.rb#import_from_hash'''&lt;br /&gt;
      if(teamtype.is_a?(CourseTeam.class))&lt;br /&gt;
          ...&lt;br /&gt;
      elsif  teamtype.is_a?(AssignmentTeam.class)&lt;br /&gt;
          ...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E1938_Before_D.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
After fixing changes&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Insert_new_in_old.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Issue 329=====&lt;br /&gt;
'''Problem''': When importing teams there are different options to handle conflicting team names as shown in the screenshot below. We’d like to add another option to rename EXISTING team when a conflict exist. Introduce an option to rename the existing team in import_file/start.html.erb, handle this option in import_file_controller.rb and team.rb→import.&lt;br /&gt;
&lt;br /&gt;
'''Solution''': This was a request to add an option to rename existing team if there was a conflict in the team name.&lt;br /&gt;
New code introduced was as follows:&amp;lt;br&amp;gt;&lt;br /&gt;
In '''start.html.erb'''&amp;lt;br&amp;gt;&lt;br /&gt;
In this file, the new option as displayed to the user is added&amp;lt;br&amp;gt;&lt;br /&gt;
          &amp;lt;option value=&amp;quot;rename_existing&amp;quot;&amp;gt;rename the existing team and import&amp;lt;/option&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In '''team.rb'''&amp;lt;br&amp;gt;&lt;br /&gt;
In this file, the handling of the new tag &amp;quot;rename_existing&amp;quot; is added wherein, the old team is updated with a new name.&amp;lt;br&amp;gt;&lt;br /&gt;
    # E1938: Added handling for renaming old team when conflict arises&lt;br /&gt;
    if handle_dups == &amp;quot;rename_existing&amp;quot;&lt;br /&gt;
      if teamtype.is_a?(CourseTeam.class)&lt;br /&gt;
        team.update(name: self.generate_team_name(Course.find(id).name))&lt;br /&gt;
      elsif  teamtype.is_a?(AssignmentTeam.class)&lt;br /&gt;
        team.update(name: self.generate_team_name(Assignment.find(id).name))&lt;br /&gt;
      end&lt;br /&gt;
      return name&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''The state of D before conflicting import''':&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E1938_Before_D_1.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
After fixing changes&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:After_D.PNG]]&lt;br /&gt;
[[File:After_old_team.PNG]]&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
As you can see the '''new team got the name D''' and the old file got renamed to '''Team_17'''.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Issue 153=====&lt;br /&gt;
'''Requirement''': There should be a way to import a list of who has signed up for which topic. When a signup sheet is used in Expertiza, users are expected to sign up for topics. But, the instructor might've taken signups offline, e.g., by passing around a signup sheet in class. There should be a way to import this list to Expertiza, rather than impersonate all the students one by one and sign them up for a topic. &lt;br /&gt;
&lt;br /&gt;
'''Solution''': We have modified the existing implementation for import topics to assign the teams to the topics. We have changed the files to handle another column where the teams have been assigned to topics. The column is optional because there might be topics that have not yet been assigned to any teams&lt;br /&gt;
&lt;br /&gt;
'''Expectations from the import file: &lt;br /&gt;
'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
* Assigned team name should exist in the system, otherwise the import will fail. Instructor has to make sure that the teams which are assigned in the import file should exist with same names in the system or database. &lt;br /&gt;
* Instructor also need to ensure that the topic for which the team is being assigned should not be full or can accommodate new team assignment to the respective topic. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''Code Changes:'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''import_file/_sign_up_topic.html.erb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
As there's already a screen with select options to map the columns with the fields for import. We are just adding another column so the best way is to extend the existing select tag with a new option for the teams assigned. All the select tags has been changed with an additional option &amp;quot;Assigned Team&amp;quot;. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
 &amp;lt;th&amp;gt;&lt;br /&gt;
            &amp;lt;select name=&amp;quot;select1&amp;quot; id=&amp;quot;select1&amp;quot; class=&amp;quot;form-control&amp;quot; style=&amp;quot;background-color:lightgrey&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;topic_identifier&amp;quot;&amp;gt;Topic Identifier (required)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;topic_name&amp;quot;&amp;gt;Topic Name (required)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;max_choosers&amp;quot;&amp;gt;Max Choosers (required)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;category&amp;quot;&amp;gt;Category (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;description&amp;quot;&amp;gt;Description (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;link&amp;quot;&amp;gt;Link (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;assigned_team&amp;quot;&amp;gt;Assigned Team (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
            &amp;lt;/select&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''model/sign_up_topic.rb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The existing import function in the model import the topics to the topic table. As per the requirement and validations, topic should be imported first and then only the team can be assigned to the topic. So the existing import method has been modified to assign the team once the topic is imported in the database table. As per the edge case mentioned in the requirement document that few topics may not have any team assigned to it, so we first check if topic has any team assigned, then only it tries to map the topic with the team. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
  def self.import(row_hash, session, _id = nil)&lt;br /&gt;
    if row_hash.length &amp;lt; 3&lt;br /&gt;
      raise ArgumentError, &amp;quot;The CSV File expects the format: Topic identifier, Topic name, Max choosers, Topic Category (optional), Topic Description (Optional), Topic Link (optional), Assigned Team Name (optional).&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
    topic = SignUpTopic.where(topic_name: row_hash[:topic_name], assignment_id: session[:assignment_id]).first&lt;br /&gt;
    if topic.nil?&lt;br /&gt;
      attributes = ImportTopicsHelper.define_attributes(row_hash)&lt;br /&gt;
      topic_new_id = ImportTopicsHelper.create_new_sign_up_topic(attributes, session)&lt;br /&gt;
      unless row_hash[:assigned_team].nil?&lt;br /&gt;
          team = Team.where(name: row_hash[:assigned_team]).first&lt;br /&gt;
          ImportTopicsHelper.assign_team_topic(topic_new_id, team.id)&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      topic.max_choosers = row_hash[:max_choosers]&lt;br /&gt;
      topic.topic_identifier = row_hash[:topic_identifier]&lt;br /&gt;
      topic.save&lt;br /&gt;
      unless row_hash[:assigned_team].nil?&lt;br /&gt;
        team = Team.where(name: row_hash[:assigned_team]).first&lt;br /&gt;
        newteam = SignedUpTeam.where(topic_id: topic.id, team_id: team.id).first&lt;br /&gt;
        if newteam.nil?&lt;br /&gt;
          ImportTopicsHelper.assign_team_topic(topic.id, team.id)&lt;br /&gt;
        else&lt;br /&gt;
          newteam.team_id = team.id&lt;br /&gt;
          newteam.save&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''helpers/import_topics_helper.rb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Having the assign_team_topic in the helper would organize the code but also in the unit testing. We can isolate the model logic and test this method separately by writing the test cases. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
  def self.assign_team_topic(topic_id, assigned_team)&lt;br /&gt;
    attributes = {}&lt;br /&gt;
    attributes[&amp;quot;topic_id&amp;quot;] = topic_id&lt;br /&gt;
    attributes[&amp;quot;team_id&amp;quot;] = assigned_team&lt;br /&gt;
    assign_team = SignedUpTeam.new(attributes)&lt;br /&gt;
    assign_team.save!&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
   def self.create_new_sign_up_topic(attributes, session)&lt;br /&gt;
     sign_up_topic = SignUpTopic.new(attributes)&lt;br /&gt;
     sign_up_topic.assignment_id = session[:assignment_id]&lt;br /&gt;
     sign_up_topic.save&lt;br /&gt;
     # sign_up_topic&lt;br /&gt;
     sign_up_topic.save!&lt;br /&gt;
     sign_up_topic.id&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''controllers/import_file_controller.rb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Existing implementation for import have many flaws and design issues. Most of the code has been written with nested if else, which is not the practice to be followed. Also the names of the fields have been hardcoded. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
As we cannot change the complete import implementation. So i had to use the existing one the way it is and make changes to extend the functionality. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    if (params[:assigned_team] == 'true')&lt;br /&gt;
        @optional_count += 1&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
    elsif params[:optional_count] == '4'&lt;br /&gt;
          new_header = [params[:select1], params[:select2], params[:select3], params[:select4], params[:select5], params[:select6], params[:select7]]&lt;br /&gt;
          @header_integrated_body = hash_rows_with_headers(new_header,contents_hash[:body])&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''views/sign_up_sheet/_add_topics.html.erb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
This code has been used to display the columns in the footer.As we already have implementation for other columns, so another column name 'Assigned Team' is added here in this part of the code. &lt;br /&gt;
        &amp;lt;%= link_to 'Import topics',&lt;br /&gt;
                {&lt;br /&gt;
                    :controller =&amp;gt; 'import_file',&lt;br /&gt;
                    :action =&amp;gt; 'start',&lt;br /&gt;
                    :model =&amp;gt; 'SignUpTopic',&lt;br /&gt;
                    :id =&amp;gt; params[:id],&lt;br /&gt;
                    :expected_fields =&amp;gt; 'Topic Identifier' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Name' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Max Choosers' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Category &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Description &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Link &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Assigned Team &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''' Changes in the application with new implementation  '''&lt;br /&gt;
&lt;br /&gt;
An option column checkbox (Teams Assigned) has been added to the UI&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Issue153SS8.jpg]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
A new column Assigned Team is added where the columns are being mapped. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File: Issue153SS7.jpg]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Test Plan''' ==&lt;br /&gt;
*'''RSpec:'''&lt;br /&gt;
&lt;br /&gt;
::We have added new testcases for the new pieces of code that were added by us.&lt;br /&gt;
&lt;br /&gt;
::'''[Problem 3 (329)]'''&lt;br /&gt;
::::New testcases were added to test this functionality. We use it to check if the older team gets the new name and the new team gets the requested name. These testcases run when we run bundle exec for the '''teams_spec.rb'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
*'''UI Testing:'''&lt;br /&gt;
&lt;br /&gt;
::'''[Problem 1 (918)]'''&lt;br /&gt;
::::1. Login to Expertiza using username: instructor6 &amp;amp; password: password.&lt;br /&gt;
::::2. Go to Assignments and click on edit for any of the listed assignments.&lt;br /&gt;
::::3. Click on Topics tab.&lt;br /&gt;
::::4. Scroll down to the bottom of the page and click on Import topics.&lt;br /&gt;
::::5. Click on Topic Description checkbox and import the following file. (sample.csv)&lt;br /&gt;
::::6. Click on next and make the header for 4th column as 'Description' from the dropdown.&lt;br /&gt;
::::7. Import topics.&lt;br /&gt;
::::8. After this, a new topic should be imported which can be viewed from the aforementioned Topics tab. This newly imported topic will not have any non-ascii characters.&lt;br /&gt;
&lt;br /&gt;
::'''[Problem 2 (153)]'''&lt;br /&gt;
::::1. Login to Expertiza using username: instructor6 &amp;amp; password: password.&lt;br /&gt;
::::2. Select Manage &amp;gt;Assignments &amp;gt; Edit Assignment &amp;gt; Topics&lt;br /&gt;
::::3. Scroll down to the screen and click on import topics&lt;br /&gt;
::::4. Upload a file with the topic details and a team assigned to topic&lt;br /&gt;
::::5. Check the Teams Assigned optional column&lt;br /&gt;
::::6. Click on import and map the columns in the mapping page&lt;br /&gt;
::::6. After submitting, team will be assigned to appropriate topic&lt;br /&gt;
&lt;br /&gt;
::'''[Problem 3 (329)]'''&lt;br /&gt;
::::1. Login to Expertiza using username: instructor6 &amp;amp; password: password.&lt;br /&gt;
::::2. Select Manage &amp;gt; Courses or Assignments &amp;gt; Add Teams button &amp;gt; Import Team&lt;br /&gt;
::::3. In the screen that loads, select &amp;quot;rename the existing team and import&amp;quot; in the handle conflicts section.&lt;br /&gt;
::::4. Upload a file with the team details and select the appropriate delimiter.&lt;br /&gt;
::::5. Click on Create&lt;br /&gt;
::::6. Verify that the new team got created with the assigned name and the older team's name got changed.&lt;br /&gt;
&lt;br /&gt;
::'''[Problem 4 (328)]'''&lt;br /&gt;
::::1. Login to Expertiza using username: instructor6 &amp;amp; password: password.&lt;br /&gt;
::::2. Select Manage &amp;gt; Courses or Assignments &amp;gt; Add Teams button &amp;gt; Import Team&lt;br /&gt;
::::3. In the screen that loads, select &amp;quot;Insert any new members into existing team&amp;quot; in the handle conflicts section.&lt;br /&gt;
::::4. Upload a file with the team details and select the appropriate delimiter.&lt;br /&gt;
::::5. Click on Create&lt;br /&gt;
::::6. Verify that the existing team got updated with the new team members&lt;br /&gt;
&lt;br /&gt;
== '''Possible Enhancements''' ==&lt;br /&gt;
&lt;br /&gt;
====='''Import functionality'''=====&lt;br /&gt;
&lt;br /&gt;
The existing import implementation does not follow DRY principle, rails code practices and even basic design principles. Most of the code is written based with nested if else conditions. This implementation can be improved. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Exception Handling: Before starting to work on this requirement. I tried few imports and in many cases, import was not successful and i was not able to figure out what's going wrong. My suggestion would be to develop a screen to show which rows were successfully imported and the failure reason which didn't. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Also, if there's no team in the system and instructor has used it in the import file so a new pop up can be displayed where the new team can be created or the import can be extended to create teams while assigning the topic.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
====='''Non Ascii character imports'''=====&lt;br /&gt;
The non ascii character issue exists for '''topic identifier''' and '''topic name''' fields as well. This should also be fixed in a similar way as is done for Issue #918 above.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1. Expertiza on GITHUB: https://github.com/expertiza/expertiza&lt;br /&gt;
&lt;br /&gt;
2. GitHub Project Repository Fork: https://github.com/NisargC/expertiza&lt;br /&gt;
&lt;br /&gt;
3. Demo link: http://152.46.19.138:8080/&lt;br /&gt;
&lt;br /&gt;
4. Expertiza project documentation wiki: http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2019_-_E1938._OSS_project_Duke_Blue:_Fix_import_glitches&lt;/div&gt;</summary>
		<author><name>Nmchoks2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1938._OSS_project_Duke_Blue:_Fix_import_glitches&amp;diff=127537</id>
		<title>CSC/ECE 517 Fall 2019 - E1938. OSS project Duke Blue: Fix import glitches</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1938._OSS_project_Duke_Blue:_Fix_import_glitches&amp;diff=127537"/>
		<updated>2019-11-06T23:30:14Z</updated>

		<summary type="html">&lt;p&gt;Nmchoks2: /* Non Ascii character imports */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
== '''About Expertiza''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source project based on Ruby on Rails framework and the code is available on Github. Expertiza allows the instructor to create new assignments as well as edit new or existing assignments. Instructors can also create a list of topics the students can sign up for and specify deadlines for completion of various tasks. Students can form teams in Expertiza to work on various projects and assignments as well as peer review other students' submissions. Expertiza supports submission across various document types, including the URLs Wiki pages.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
The import feature is the most helpful feature for instructors to set up assignments. The instructors usually have a list of students, teams, etc from their learning management system. Being able to import these into expertiza saves a lot of time when setting up an assignment. Unfortunately this feature has some bugs that were identified as the following list. &lt;br /&gt;
&lt;br /&gt;
'''Issue 918''': It seems that non-ASCII characters in the description (e.g., a curly apostrophe, and perhaps also an en-dash) caused a SQL error in inserting the description string into the db. I had to edit the import file to remove non-ASCII characters. Any Unicode character ought to be allowed in a description. &lt;br /&gt;
&lt;br /&gt;
'''Issue 153''': There should be a way to import a list of who has signed up for which topic. When a signup sheet is used in Expertiza, users are expected to sign up for topics. But, the instructor might've taken signups offline, e.g., by passing around a signup sheet in class. There should be a way to import this list to Expertiza, rather than impersonate all the students one by one and sign them up for a topic. '''This issue is not a bug but an additional feature to the existing import topic functionality.'''&lt;br /&gt;
&lt;br /&gt;
'''Issue 329''': When importing teams there are different options to handle conflicting team names &lt;br /&gt;
&lt;br /&gt;
'''Issue 328''': When importing teams, and a conflict exists there is an option to merge the two teams by inserting the new members into an existing team. Unfortunately, this feature is broken. we tried to import a team and selected 'Insert any new members into existing team'. No new team members were in fact inserted into the team&lt;br /&gt;
&lt;br /&gt;
== '''Fixes''' ==&lt;br /&gt;
=====Issue 918=====&lt;br /&gt;
&lt;br /&gt;
'''Problem:''' The application is not able to import topics with non ascii characters in its description field. &amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' Before the topic object is persisted into the database, check for any non ascii characters in the description field and strip them. &amp;lt;br&amp;gt;&lt;br /&gt;
'''Code Changes'''&amp;lt;br&amp;gt;&lt;br /&gt;
New code introduced is as follows.&amp;lt;br&amp;gt;&lt;br /&gt;
File:app/helpers/import_topics_helper.rb &amp;lt;br&amp;gt;&lt;br /&gt;
Here, a new function 'trim_non_ascii' has been added which iterates a given string character by character, and replaces each non ascii character with a white space character. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  def self.define_attributes(row_hash)&lt;br /&gt;
    attributes = {}&lt;br /&gt;
    if !row_hash[:description].nil? and !row_hash[:description].ascii_only?&lt;br /&gt;
      row_hash[:description] = self.trim_non_ascii(row_hash[:description])&lt;br /&gt;
      puts row_hash[:description]&lt;br /&gt;
    end&lt;br /&gt;
    attributes[&amp;quot;topic_identifier&amp;quot;] = row_hash[:topic_identifier].strip&lt;br /&gt;
    attributes[&amp;quot;topic_name&amp;quot;] = row_hash[:topic_name].strip&lt;br /&gt;
    attributes[&amp;quot;max_choosers&amp;quot;] = row_hash[:max_choosers].strip&lt;br /&gt;
    attributes&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def self.trim_non_ascii(string)&lt;br /&gt;
    string.split('').each do |char|&lt;br /&gt;
      !char.ascii_only? ? string.tr!(char, ' ') : nil&lt;br /&gt;
    end&lt;br /&gt;
    string.gsub!(/\s+/, ' ')&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
=====Issue 328=====&lt;br /&gt;
&lt;br /&gt;
'''Problem''': When importing teams, and a conflict exists there is an option to merge the two teams by inserting the new members into an existing team.&lt;br /&gt;
&lt;br /&gt;
'''Solution''': This was an issue to fix the functionality of Insert any new members into existing team. This was due to faulty handling of the option handle_dups and incorrect checking of parameters.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Code was modified to ensure minimal impact to existing testcases and functionalities.&amp;lt;br&amp;gt;&lt;br /&gt;
The handling of handle_dups in options was done assuming that the parameter was a symbol. But when tested, it was found to be a string and hence the handling was updated accordingly.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
      name = handle_duplicate(team, name, id, options[&amp;quot;handle_dups&amp;quot;], teamtype)&lt;br /&gt;
Also, the if and else conditions for checking class type of used was wrong. This was updated based on how the variable was assigned in the '''import_file_controller.rb#import_from_hash'''&lt;br /&gt;
      if(teamtype.is_a?(CourseTeam.class))&lt;br /&gt;
          ...&lt;br /&gt;
      elsif  teamtype.is_a?(AssignmentTeam.class)&lt;br /&gt;
          ...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E1938_Before_D.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
After fixing changes&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Insert_new_in_old.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Issue 329=====&lt;br /&gt;
'''Problem''': When importing teams there are different options to handle conflicting team names as shown in the screenshot below. We’d like to add another option to rename EXISTING team when a conflict exist. Introduce an option to rename the existing team in import_file/start.html.erb, handle this option in import_file_controller.rb and team.rb→import.&lt;br /&gt;
&lt;br /&gt;
'''Solution''': This was a request to add an option to rename existing team if there was a conflict in the team name.&lt;br /&gt;
New code introduced was as follows:&amp;lt;br&amp;gt;&lt;br /&gt;
In '''start.html.erb'''&amp;lt;br&amp;gt;&lt;br /&gt;
In this file, the new option as displayed to the user is added&amp;lt;br&amp;gt;&lt;br /&gt;
          &amp;lt;option value=&amp;quot;rename_existing&amp;quot;&amp;gt;rename the existing team and import&amp;lt;/option&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In '''team.rb'''&amp;lt;br&amp;gt;&lt;br /&gt;
In this file, the handling of the new tag &amp;quot;rename_existing&amp;quot; is added wherein, the old team is updated with a new name.&amp;lt;br&amp;gt;&lt;br /&gt;
    # E1938: Added handling for renaming old team when conflict arises&lt;br /&gt;
    if handle_dups == &amp;quot;rename_existing&amp;quot;&lt;br /&gt;
      if teamtype.is_a?(CourseTeam.class)&lt;br /&gt;
        team.update(name: self.generate_team_name(Course.find(id).name))&lt;br /&gt;
      elsif  teamtype.is_a?(AssignmentTeam.class)&lt;br /&gt;
        team.update(name: self.generate_team_name(Assignment.find(id).name))&lt;br /&gt;
      end&lt;br /&gt;
      return name&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''The state of D before conflicting import''':&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E1938_Before_D_1.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
After fixing changes&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:After_D.PNG]]&lt;br /&gt;
[[File:After_old_team.PNG]]&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
As you can see the '''new team got the name D''' and the old file got renamed to '''Team_17'''.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Issue 153=====&lt;br /&gt;
'''Requirement''': There should be a way to import a list of who has signed up for which topic. When a signup sheet is used in Expertiza, users are expected to sign up for topics. But, the instructor might've taken signups offline, e.g., by passing around a signup sheet in class. There should be a way to import this list to Expertiza, rather than impersonate all the students one by one and sign them up for a topic. &lt;br /&gt;
&lt;br /&gt;
'''Solution''': We have modified the existing implementation for import topics to assign the teams to the topics. We have changed the files to handle another column where the teams have been assigned to topics. The column is optional because there might be topics that have not yet been assigned to any teams&lt;br /&gt;
&lt;br /&gt;
'''Expectations from the import file: &lt;br /&gt;
'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
* Assigned team name should exist in the system, otherwise the import will fail. Instructor has to make sure that the teams which are assigned in the import file should exist with same names in the system or database. &lt;br /&gt;
* Instructor also need to ensure that the topic for which the team is being assigned should not be full or can accommodate new team assignment to the respective topic. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''Code Changes:'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''import_file/_sign_up_topic.html.erb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
As there's already a screen with select options to map the columns with the fields for import. We are just adding another column so the best way is to extend the existing select tag with a new option for the teams assigned. All the select tags has been changed with an additional option &amp;quot;Assigned Team&amp;quot;. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
 &amp;lt;th&amp;gt;&lt;br /&gt;
            &amp;lt;select name=&amp;quot;select1&amp;quot; id=&amp;quot;select1&amp;quot; class=&amp;quot;form-control&amp;quot; style=&amp;quot;background-color:lightgrey&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;topic_identifier&amp;quot;&amp;gt;Topic Identifier (required)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;topic_name&amp;quot;&amp;gt;Topic Name (required)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;max_choosers&amp;quot;&amp;gt;Max Choosers (required)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;category&amp;quot;&amp;gt;Category (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;description&amp;quot;&amp;gt;Description (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;link&amp;quot;&amp;gt;Link (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;assigned_team&amp;quot;&amp;gt;Assigned Team (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
            &amp;lt;/select&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''model/sign_up_topic.rb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The existing import function in the model import the topics to the topic table. As per the requirement and validations, topic should be imported first and then only the team can be assigned to the topic. So the existing import method has been modified to assign the team once the topic is imported in the database table. As per the edge case mentioned in the requirement document that few topics may not have any team assigned to it, so we first check if topic has any team assigned, then only it tries to map the topic with the team. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
  def self.import(row_hash, session, _id = nil)&lt;br /&gt;
    if row_hash.length &amp;lt; 3&lt;br /&gt;
      raise ArgumentError, &amp;quot;The CSV File expects the format: Topic identifier, Topic name, Max choosers, Topic Category (optional), Topic Description (Optional), Topic Link (optional), Assigned Team Name (optional).&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
    topic = SignUpTopic.where(topic_name: row_hash[:topic_name], assignment_id: session[:assignment_id]).first&lt;br /&gt;
    if topic.nil?&lt;br /&gt;
      attributes = ImportTopicsHelper.define_attributes(row_hash)&lt;br /&gt;
      topic_new_id = ImportTopicsHelper.create_new_sign_up_topic(attributes, session)&lt;br /&gt;
      unless row_hash[:assigned_team].nil?&lt;br /&gt;
          team = Team.where(name: row_hash[:assigned_team]).first&lt;br /&gt;
          ImportTopicsHelper.assign_team_topic(topic_new_id, team.id)&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      topic.max_choosers = row_hash[:max_choosers]&lt;br /&gt;
      topic.topic_identifier = row_hash[:topic_identifier]&lt;br /&gt;
      topic.save&lt;br /&gt;
      unless row_hash[:assigned_team].nil?&lt;br /&gt;
        team = Team.where(name: row_hash[:assigned_team]).first&lt;br /&gt;
        newteam = SignedUpTeam.where(topic_id: topic.id, team_id: team.id).first&lt;br /&gt;
        if newteam.nil?&lt;br /&gt;
          ImportTopicsHelper.assign_team_topic(topic.id, team.id)&lt;br /&gt;
        else&lt;br /&gt;
          newteam.team_id = team.id&lt;br /&gt;
          newteam.save&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''helpers/import_topics_helper.rb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Having the assign_team_topic in the helper would organize the code but also in the unit testing. We can isolate the model logic and test this method separately by writing the test cases. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
  def self.assign_team_topic(topic_id, assigned_team)&lt;br /&gt;
    attributes = {}&lt;br /&gt;
    attributes[&amp;quot;topic_id&amp;quot;] = topic_id&lt;br /&gt;
    attributes[&amp;quot;team_id&amp;quot;] = assigned_team&lt;br /&gt;
    assign_team = SignedUpTeam.new(attributes)&lt;br /&gt;
    assign_team.save!&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
   def self.create_new_sign_up_topic(attributes, session)&lt;br /&gt;
     sign_up_topic = SignUpTopic.new(attributes)&lt;br /&gt;
     sign_up_topic.assignment_id = session[:assignment_id]&lt;br /&gt;
     sign_up_topic.save&lt;br /&gt;
     # sign_up_topic&lt;br /&gt;
     sign_up_topic.save!&lt;br /&gt;
     sign_up_topic.id&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''controllers/import_file_controller.rb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Existing implementation for import have many flaws and design issues. Most of the code has been written with nested if else, which is not the practice to be followed. Also the names of the fields have been hardcoded. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
As we cannot change the complete import implementation. So i had to use the existing one the way it is and make changes to extend the functionality. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    if (params[:assigned_team] == 'true')&lt;br /&gt;
        @optional_count += 1&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
    elsif params[:optional_count] == '4'&lt;br /&gt;
          new_header = [params[:select1], params[:select2], params[:select3], params[:select4], params[:select5], params[:select6], params[:select7]]&lt;br /&gt;
          @header_integrated_body = hash_rows_with_headers(new_header,contents_hash[:body])&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''views/sign_up_sheet/_add_topics.html.erb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
This code has been used to display the columns in the footer.As we already have implementation for other columns, so another column name 'Assigned Team' is added here in this part of the code. &lt;br /&gt;
        &amp;lt;%= link_to 'Import topics',&lt;br /&gt;
                {&lt;br /&gt;
                    :controller =&amp;gt; 'import_file',&lt;br /&gt;
                    :action =&amp;gt; 'start',&lt;br /&gt;
                    :model =&amp;gt; 'SignUpTopic',&lt;br /&gt;
                    :id =&amp;gt; params[:id],&lt;br /&gt;
                    :expected_fields =&amp;gt; 'Topic Identifier' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Name' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Max Choosers' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Category &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Description &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Link &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Assigned Team &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
An option column checkbox (Teams Assigned) has been added to the UI&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Issue153SS8.jpg]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
A new column Assigned Team is added where the columns are being mapped. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File: Issue153SS7.jpg]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Test Plan''' ==&lt;br /&gt;
*'''RSpec:'''&lt;br /&gt;
&lt;br /&gt;
::We have added new testcases for the new pieces of code that were added by us.&lt;br /&gt;
&lt;br /&gt;
::'''[Problem 3 (329)]'''&lt;br /&gt;
::::A new testcase was added to test this functionality. We use it to check if the older team gets the new name and the new team gets the requested name. This testcase runs when we run bundle exec for the '''teams_spec.rb'''&lt;br /&gt;
      # New team name should remain the same, the old one gets updated&lt;br /&gt;
      context 'when handle_dups option is rename_existing' do&lt;br /&gt;
        it 'returns new team name' do&lt;br /&gt;
          allow(Course).to receive(:find).with(1).and_return(double('Course', name: 'course 1'))&lt;br /&gt;
          allow(Team).to receive(:generate_team_name).with('course 1').and_return('new name of team')&lt;br /&gt;
          expect(Team.handle_duplicate(team, 'no name', 1, 'rename_existing', CourseTeam)).to eq('no name')&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
*'''UI Testing:'''&lt;br /&gt;
&lt;br /&gt;
::'''[Problem 1 (918)]'''&lt;br /&gt;
::::1. Login to Expertiza using username: instructor6 &amp;amp; password: password.&lt;br /&gt;
::::2. Go to Assignments and click on edit for any of the listed assignments.&lt;br /&gt;
::::3. Click on Topics tab.&lt;br /&gt;
::::4. Scroll down to the bottom of the page and click on Import topics.&lt;br /&gt;
::::5. Click on Topic Description checkbox and import the following file. (sample.csv)&amp;lt;br&amp;gt; [[File:918 sample.png]] &amp;lt;br&amp;gt;&lt;br /&gt;
::::[[File:918_p1.png]]&lt;br /&gt;
::::6. Click on next and make the header for 4th column as 'Description' from the dropdown.&lt;br /&gt;
::::[[File:918_p2.png]]&lt;br /&gt;
::::7. Import topics.&lt;br /&gt;
::::8. After this, a new topic should be imported which can be viewed from the aforementioned Topics tab. This newly imported topic will not have any non-ascii characters.&lt;br /&gt;
&lt;br /&gt;
::'''[Problem 3 (329)]'''&lt;br /&gt;
::::1. Login to Expertiza using username: instructor6 &amp;amp; password: password.&lt;br /&gt;
::::2. Select Manage &amp;gt; Courses or Assignments &amp;gt; Add Teams button &amp;gt; Import Team&lt;br /&gt;
::::3. In the screen that loads, select &amp;quot;rename the existing team and import&amp;quot; in the handle conflicts section.&lt;br /&gt;
::::4. Upload a file with the team details and select the appropriate delimiter.&lt;br /&gt;
::::5. Click on Create&lt;br /&gt;
::::6. Verify that the new team got created with the assigned name and the older team's name got changed.&lt;br /&gt;
&lt;br /&gt;
::'''[Problem 4 (328)]'''&lt;br /&gt;
::::1. Login to Expertiza using username: instructor6 &amp;amp; password: password.&lt;br /&gt;
::::2. Select Manage &amp;gt; Courses or Assignments &amp;gt; Add Teams button &amp;gt; Import Team&lt;br /&gt;
::::3. In the screen that loads, select &amp;quot;Insert any new members into existing team&amp;quot; in the handle conflicts section.&lt;br /&gt;
::::4. Upload a file with the team details and select the appropriate delimiter.&lt;br /&gt;
::::5. Click on Create&lt;br /&gt;
::::6. Verify that the existing team got updated with the new team members&lt;br /&gt;
&lt;br /&gt;
== '''Possible Enhancements''' ==&lt;br /&gt;
&lt;br /&gt;
====='''Import functionality'''=====&lt;br /&gt;
&lt;br /&gt;
The existing import implementation does not follow DRY principle, rails code practices and even basic design principles. Most of the code is written based with nested if else conditions. This implementation can be improved. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Exception Handling: Before starting to work on this requirement. I tried few imports and in many cases, import was not successful and i was not able to figure out what's going wrong. My suggestion would be to develop a screen to show which rows were successfully imported and the failure reason which didn't. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Also, if there's no team in the system and instructor has used it in the import file so a new pop up can be displayed where the new team can be created or the import can be extended to create teams while assigning the topic.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
====='''Non Ascii character imports'''=====&lt;br /&gt;
The non ascii character issue exists for '''topic identifier''' and '''topic name''' fields as well. This should also be fixed in a similar way as is done for Issue #918 above.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1. Expertiza on GITHUB: https://github.com/expertiza/expertiza&lt;br /&gt;
&lt;br /&gt;
2. GitHub Project Repository Fork: https://github.com/NisargC/expertiza&lt;br /&gt;
&lt;br /&gt;
3. Demo link: http://152.46.19.138:8080/&lt;br /&gt;
&lt;br /&gt;
4. Expertiza project documentation wiki: http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2019_-_E1938._OSS_project_Duke_Blue:_Fix_import_glitches&lt;/div&gt;</summary>
		<author><name>Nmchoks2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1938._OSS_project_Duke_Blue:_Fix_import_glitches&amp;diff=127535</id>
		<title>CSC/ECE 517 Fall 2019 - E1938. OSS project Duke Blue: Fix import glitches</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1938._OSS_project_Duke_Blue:_Fix_import_glitches&amp;diff=127535"/>
		<updated>2019-11-06T23:29:38Z</updated>

		<summary type="html">&lt;p&gt;Nmchoks2: /* Non Ascii character imports */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
== '''About Expertiza''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source project based on Ruby on Rails framework and the code is available on Github. Expertiza allows the instructor to create new assignments as well as edit new or existing assignments. Instructors can also create a list of topics the students can sign up for and specify deadlines for completion of various tasks. Students can form teams in Expertiza to work on various projects and assignments as well as peer review other students' submissions. Expertiza supports submission across various document types, including the URLs Wiki pages.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
The import feature is the most helpful feature for instructors to set up assignments. The instructors usually have a list of students, teams, etc from their learning management system. Being able to import these into expertiza saves a lot of time when setting up an assignment. Unfortunately this feature has some bugs that were identified as the following list. &lt;br /&gt;
&lt;br /&gt;
'''Issue 918''': It seems that non-ASCII characters in the description (e.g., a curly apostrophe, and perhaps also an en-dash) caused a SQL error in inserting the description string into the db. I had to edit the import file to remove non-ASCII characters. Any Unicode character ought to be allowed in a description. &lt;br /&gt;
&lt;br /&gt;
'''Issue 153''': There should be a way to import a list of who has signed up for which topic. When a signup sheet is used in Expertiza, users are expected to sign up for topics. But, the instructor might've taken signups offline, e.g., by passing around a signup sheet in class. There should be a way to import this list to Expertiza, rather than impersonate all the students one by one and sign them up for a topic. '''This issue is not a bug but an additional feature to the existing import topic functionality.'''&lt;br /&gt;
&lt;br /&gt;
'''Issue 329''': When importing teams there are different options to handle conflicting team names &lt;br /&gt;
&lt;br /&gt;
'''Issue 328''': When importing teams, and a conflict exists there is an option to merge the two teams by inserting the new members into an existing team. Unfortunately, this feature is broken. we tried to import a team and selected 'Insert any new members into existing team'. No new team members were in fact inserted into the team&lt;br /&gt;
&lt;br /&gt;
== '''Fixes''' ==&lt;br /&gt;
=====Issue 918=====&lt;br /&gt;
&lt;br /&gt;
'''Problem:''' The application is not able to import topics with non ascii characters in its description field. &amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' Before the topic object is persisted into the database, check for any non ascii characters in the description field and strip them. &amp;lt;br&amp;gt;&lt;br /&gt;
'''Code Changes'''&amp;lt;br&amp;gt;&lt;br /&gt;
New code introduced is as follows.&amp;lt;br&amp;gt;&lt;br /&gt;
File:app/helpers/import_topics_helper.rb &amp;lt;br&amp;gt;&lt;br /&gt;
Here, a new function 'trim_non_ascii' has been added which iterates a given string character by character, and replaces each non ascii character with a white space character. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  def self.define_attributes(row_hash)&lt;br /&gt;
    attributes = {}&lt;br /&gt;
    if !row_hash[:description].nil? and !row_hash[:description].ascii_only?&lt;br /&gt;
      row_hash[:description] = self.trim_non_ascii(row_hash[:description])&lt;br /&gt;
      puts row_hash[:description]&lt;br /&gt;
    end&lt;br /&gt;
    attributes[&amp;quot;topic_identifier&amp;quot;] = row_hash[:topic_identifier].strip&lt;br /&gt;
    attributes[&amp;quot;topic_name&amp;quot;] = row_hash[:topic_name].strip&lt;br /&gt;
    attributes[&amp;quot;max_choosers&amp;quot;] = row_hash[:max_choosers].strip&lt;br /&gt;
    attributes&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def self.trim_non_ascii(string)&lt;br /&gt;
    string.split('').each do |char|&lt;br /&gt;
      !char.ascii_only? ? string.tr!(char, ' ') : nil&lt;br /&gt;
    end&lt;br /&gt;
    string.gsub!(/\s+/, ' ')&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
=====Issue 328=====&lt;br /&gt;
&lt;br /&gt;
'''Problem''': When importing teams, and a conflict exists there is an option to merge the two teams by inserting the new members into an existing team.&lt;br /&gt;
&lt;br /&gt;
'''Solution''': This was an issue to fix the functionality of Insert any new members into existing team. This was due to faulty handling of the option handle_dups and incorrect checking of parameters.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Code was modified to ensure minimal impact to existing testcases and functionalities.&amp;lt;br&amp;gt;&lt;br /&gt;
The handling of handle_dups in options was done assuming that the parameter was a symbol. But when tested, it was found to be a string and hence the handling was updated accordingly.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
      name = handle_duplicate(team, name, id, options[&amp;quot;handle_dups&amp;quot;], teamtype)&lt;br /&gt;
Also, the if and else conditions for checking class type of used was wrong. This was updated based on how the variable was assigned in the '''import_file_controller.rb#import_from_hash'''&lt;br /&gt;
      if(teamtype.is_a?(CourseTeam.class))&lt;br /&gt;
          ...&lt;br /&gt;
      elsif  teamtype.is_a?(AssignmentTeam.class)&lt;br /&gt;
          ...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E1938_Before_D.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
After fixing changes&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Insert_new_in_old.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Issue 329=====&lt;br /&gt;
'''Problem''': When importing teams there are different options to handle conflicting team names as shown in the screenshot below. We’d like to add another option to rename EXISTING team when a conflict exist. Introduce an option to rename the existing team in import_file/start.html.erb, handle this option in import_file_controller.rb and team.rb→import.&lt;br /&gt;
&lt;br /&gt;
'''Solution''': This was a request to add an option to rename existing team if there was a conflict in the team name.&lt;br /&gt;
New code introduced was as follows:&amp;lt;br&amp;gt;&lt;br /&gt;
In '''start.html.erb'''&amp;lt;br&amp;gt;&lt;br /&gt;
In this file, the new option as displayed to the user is added&amp;lt;br&amp;gt;&lt;br /&gt;
          &amp;lt;option value=&amp;quot;rename_existing&amp;quot;&amp;gt;rename the existing team and import&amp;lt;/option&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In '''team.rb'''&amp;lt;br&amp;gt;&lt;br /&gt;
In this file, the handling of the new tag &amp;quot;rename_existing&amp;quot; is added wherein, the old team is updated with a new name.&amp;lt;br&amp;gt;&lt;br /&gt;
    # E1938: Added handling for renaming old team when conflict arises&lt;br /&gt;
    if handle_dups == &amp;quot;rename_existing&amp;quot;&lt;br /&gt;
      if teamtype.is_a?(CourseTeam.class)&lt;br /&gt;
        team.update(name: self.generate_team_name(Course.find(id).name))&lt;br /&gt;
      elsif  teamtype.is_a?(AssignmentTeam.class)&lt;br /&gt;
        team.update(name: self.generate_team_name(Assignment.find(id).name))&lt;br /&gt;
      end&lt;br /&gt;
      return name&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''The state of D before conflicting import''':&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E1938_Before_D_1.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
After fixing changes&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:After_D.PNG]]&lt;br /&gt;
[[File:After_old_team.PNG]]&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
As you can see the '''new team got the name D''' and the old file got renamed to '''Team_17'''.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Issue 153=====&lt;br /&gt;
'''Requirement''': There should be a way to import a list of who has signed up for which topic. When a signup sheet is used in Expertiza, users are expected to sign up for topics. But, the instructor might've taken signups offline, e.g., by passing around a signup sheet in class. There should be a way to import this list to Expertiza, rather than impersonate all the students one by one and sign them up for a topic. &lt;br /&gt;
&lt;br /&gt;
'''Solution''': We have modified the existing implementation for import topics to assign the teams to the topics. We have changed the files to handle another column where the teams have been assigned to topics. The column is optional because there might be topics that have not yet been assigned to any teams&lt;br /&gt;
&lt;br /&gt;
'''Expectations from the import file: &lt;br /&gt;
'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
* Assigned team name should exist in the system, otherwise the import will fail. Instructor has to make sure that the teams which are assigned in the import file should exist with same names in the system or database. &lt;br /&gt;
* Instructor also need to ensure that the topic for which the team is being assigned should not be full or can accommodate new team assignment to the respective topic. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''Code Changes:'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''import_file/_sign_up_topic.html.erb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
As there's already a screen with select options to map the columns with the fields for import. We are just adding another column so the best way is to extend the existing select tag with a new option for the teams assigned. All the select tags has been changed with an additional option &amp;quot;Assigned Team&amp;quot;. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
 &amp;lt;th&amp;gt;&lt;br /&gt;
            &amp;lt;select name=&amp;quot;select1&amp;quot; id=&amp;quot;select1&amp;quot; class=&amp;quot;form-control&amp;quot; style=&amp;quot;background-color:lightgrey&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;topic_identifier&amp;quot;&amp;gt;Topic Identifier (required)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;topic_name&amp;quot;&amp;gt;Topic Name (required)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;max_choosers&amp;quot;&amp;gt;Max Choosers (required)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;category&amp;quot;&amp;gt;Category (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;description&amp;quot;&amp;gt;Description (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;link&amp;quot;&amp;gt;Link (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;assigned_team&amp;quot;&amp;gt;Assigned Team (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
            &amp;lt;/select&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''model/sign_up_topic.rb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The existing import function in the model import the topics to the topic table. As per the requirement and validations, topic should be imported first and then only the team can be assigned to the topic. So the existing import method has been modified to assign the team once the topic is imported in the database table. As per the edge case mentioned in the requirement document that few topics may not have any team assigned to it, so we first check if topic has any team assigned, then only it tries to map the topic with the team. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
  def self.import(row_hash, session, _id = nil)&lt;br /&gt;
    if row_hash.length &amp;lt; 3&lt;br /&gt;
      raise ArgumentError, &amp;quot;The CSV File expects the format: Topic identifier, Topic name, Max choosers, Topic Category (optional), Topic Description (Optional), Topic Link (optional), Assigned Team Name (optional).&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
    topic = SignUpTopic.where(topic_name: row_hash[:topic_name], assignment_id: session[:assignment_id]).first&lt;br /&gt;
    if topic.nil?&lt;br /&gt;
      attributes = ImportTopicsHelper.define_attributes(row_hash)&lt;br /&gt;
      topic_new_id = ImportTopicsHelper.create_new_sign_up_topic(attributes, session)&lt;br /&gt;
      unless row_hash[:assigned_team].nil?&lt;br /&gt;
          team = Team.where(name: row_hash[:assigned_team]).first&lt;br /&gt;
          ImportTopicsHelper.assign_team_topic(topic_new_id, team.id)&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      topic.max_choosers = row_hash[:max_choosers]&lt;br /&gt;
      topic.topic_identifier = row_hash[:topic_identifier]&lt;br /&gt;
      topic.save&lt;br /&gt;
      unless row_hash[:assigned_team].nil?&lt;br /&gt;
        team = Team.where(name: row_hash[:assigned_team]).first&lt;br /&gt;
        newteam = SignedUpTeam.where(topic_id: topic.id, team_id: team.id).first&lt;br /&gt;
        if newteam.nil?&lt;br /&gt;
          ImportTopicsHelper.assign_team_topic(topic.id, team.id)&lt;br /&gt;
        else&lt;br /&gt;
          newteam.team_id = team.id&lt;br /&gt;
          newteam.save&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''helpers/import_topics_helper.rb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Having the assign_team_topic in the helper would organize the code but also in the unit testing. We can isolate the model logic and test this method separately by writing the test cases. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
  def self.assign_team_topic(topic_id, assigned_team)&lt;br /&gt;
    attributes = {}&lt;br /&gt;
    attributes[&amp;quot;topic_id&amp;quot;] = topic_id&lt;br /&gt;
    attributes[&amp;quot;team_id&amp;quot;] = assigned_team&lt;br /&gt;
    assign_team = SignedUpTeam.new(attributes)&lt;br /&gt;
    assign_team.save!&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
   def self.create_new_sign_up_topic(attributes, session)&lt;br /&gt;
     sign_up_topic = SignUpTopic.new(attributes)&lt;br /&gt;
     sign_up_topic.assignment_id = session[:assignment_id]&lt;br /&gt;
     sign_up_topic.save&lt;br /&gt;
     # sign_up_topic&lt;br /&gt;
     sign_up_topic.save!&lt;br /&gt;
     sign_up_topic.id&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''controllers/import_file_controller.rb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Existing implementation for import have many flaws and design issues. Most of the code has been written with nested if else, which is not the practice to be followed. Also the names of the fields have been hardcoded. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
As we cannot change the complete import implementation. So i had to use the existing one the way it is and make changes to extend the functionality. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    if (params[:assigned_team] == 'true')&lt;br /&gt;
        @optional_count += 1&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
    elsif params[:optional_count] == '4'&lt;br /&gt;
          new_header = [params[:select1], params[:select2], params[:select3], params[:select4], params[:select5], params[:select6], params[:select7]]&lt;br /&gt;
          @header_integrated_body = hash_rows_with_headers(new_header,contents_hash[:body])&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''views/sign_up_sheet/_add_topics.html.erb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
This code has been used to display the columns in the footer.As we already have implementation for other columns, so another column name 'Assigned Team' is added here in this part of the code. &lt;br /&gt;
        &amp;lt;%= link_to 'Import topics',&lt;br /&gt;
                {&lt;br /&gt;
                    :controller =&amp;gt; 'import_file',&lt;br /&gt;
                    :action =&amp;gt; 'start',&lt;br /&gt;
                    :model =&amp;gt; 'SignUpTopic',&lt;br /&gt;
                    :id =&amp;gt; params[:id],&lt;br /&gt;
                    :expected_fields =&amp;gt; 'Topic Identifier' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Name' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Max Choosers' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Category &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Description &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Link &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Assigned Team &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
An option column checkbox (Teams Assigned) has been added to the UI&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Issue153SS8.jpg]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
A new column Assigned Team is added where the columns are being mapped. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File: Issue153SS7.jpg]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Test Plan''' ==&lt;br /&gt;
*'''RSpec:'''&lt;br /&gt;
&lt;br /&gt;
::We have added new testcases for the new pieces of code that were added by us.&lt;br /&gt;
&lt;br /&gt;
::'''[Problem 3 (329)]'''&lt;br /&gt;
::::A new testcase was added to test this functionality. We use it to check if the older team gets the new name and the new team gets the requested name. This testcase runs when we run bundle exec for the '''teams_spec.rb'''&lt;br /&gt;
      # New team name should remain the same, the old one gets updated&lt;br /&gt;
      context 'when handle_dups option is rename_existing' do&lt;br /&gt;
        it 'returns new team name' do&lt;br /&gt;
          allow(Course).to receive(:find).with(1).and_return(double('Course', name: 'course 1'))&lt;br /&gt;
          allow(Team).to receive(:generate_team_name).with('course 1').and_return('new name of team')&lt;br /&gt;
          expect(Team.handle_duplicate(team, 'no name', 1, 'rename_existing', CourseTeam)).to eq('no name')&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
*'''UI Testing:'''&lt;br /&gt;
&lt;br /&gt;
::'''[Problem 1 (918)]'''&lt;br /&gt;
::::1. Login to Expertiza using username: instructor6 &amp;amp; password: password.&lt;br /&gt;
::::2. Go to Assignments and click on edit for any of the listed assignments.&lt;br /&gt;
::::3. Click on Topics tab.&lt;br /&gt;
::::4. Scroll down to the bottom of the page and click on Import topics.&lt;br /&gt;
::::5. Click on Topic Description checkbox and import the following file. (sample.csv)&amp;lt;br&amp;gt; [[File:918 sample.png]] &amp;lt;br&amp;gt;&lt;br /&gt;
::::[[File:918_p1.png]]&lt;br /&gt;
::::6. Click on next and make the header for 4th column as 'Description' from the dropdown.&lt;br /&gt;
::::[[File:918_p2.png]]&lt;br /&gt;
::::7. Import topics.&lt;br /&gt;
::::8. After this, a new topic should be imported which can be viewed from the aforementioned Topics tab. This newly imported topic will not have any non-ascii characters.&lt;br /&gt;
&lt;br /&gt;
::'''[Problem 3 (329)]'''&lt;br /&gt;
::::1. Login to Expertiza using username: instructor6 &amp;amp; password: password.&lt;br /&gt;
::::2. Select Manage &amp;gt; Courses or Assignments &amp;gt; Add Teams button &amp;gt; Import Team&lt;br /&gt;
::::3. In the screen that loads, select &amp;quot;rename the existing team and import&amp;quot; in the handle conflicts section.&lt;br /&gt;
::::4. Upload a file with the team details and select the appropriate delimiter.&lt;br /&gt;
::::5. Click on Create&lt;br /&gt;
::::6. Verify that the new team got created with the assigned name and the older team's name got changed.&lt;br /&gt;
&lt;br /&gt;
::'''[Problem 4 (328)]'''&lt;br /&gt;
::::1. Login to Expertiza using username: instructor6 &amp;amp; password: password.&lt;br /&gt;
::::2. Select Manage &amp;gt; Courses or Assignments &amp;gt; Add Teams button &amp;gt; Import Team&lt;br /&gt;
::::3. In the screen that loads, select &amp;quot;Insert any new members into existing team&amp;quot; in the handle conflicts section.&lt;br /&gt;
::::4. Upload a file with the team details and select the appropriate delimiter.&lt;br /&gt;
::::5. Click on Create&lt;br /&gt;
::::6. Verify that the existing team got updated with the new team members&lt;br /&gt;
&lt;br /&gt;
== '''Possible Enhancements''' ==&lt;br /&gt;
&lt;br /&gt;
====='''Import functionality'''=====&lt;br /&gt;
&lt;br /&gt;
The existing import implementation does not follow DRY principle, rails code practices and even basic design principles. Most of the code is written based with nested if else conditions. This implementation can be improved. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Exception Handling: Before starting to work on this requirement. I tried few imports and in many cases, import was not successful and i was not able to figure out what's going wrong. My suggestion would be to develop a screen to show which rows were successfully imported and the failure reason which didn't. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Also, if there's no team in the system and instructor has used it in the import file so a new pop up can be displayed where the new team can be created or the import can be extended to create teams while assigning the topic.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
====='''Non Ascii character imports'''=====&lt;br /&gt;
The non ascii character issue exists for '''topic identifier''' and '''topic name''' fields as well. This should also be fixed in a similar way as is done for Issue #918&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1. Expertiza on GITHUB: https://github.com/expertiza/expertiza&lt;br /&gt;
&lt;br /&gt;
2. GitHub Project Repository Fork: https://github.com/NisargC/expertiza&lt;br /&gt;
&lt;br /&gt;
3. Demo link: http://152.46.19.138:8080/&lt;br /&gt;
&lt;br /&gt;
4. Expertiza project documentation wiki: http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2019_-_E1938._OSS_project_Duke_Blue:_Fix_import_glitches&lt;/div&gt;</summary>
		<author><name>Nmchoks2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1938._OSS_project_Duke_Blue:_Fix_import_glitches&amp;diff=127530</id>
		<title>CSC/ECE 517 Fall 2019 - E1938. OSS project Duke Blue: Fix import glitches</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1938._OSS_project_Duke_Blue:_Fix_import_glitches&amp;diff=127530"/>
		<updated>2019-11-06T23:27:27Z</updated>

		<summary type="html">&lt;p&gt;Nmchoks2: /* Non Ascii character imports */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
== '''About Expertiza''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source project based on Ruby on Rails framework and the code is available on Github. Expertiza allows the instructor to create new assignments as well as edit new or existing assignments. Instructors can also create a list of topics the students can sign up for and specify deadlines for completion of various tasks. Students can form teams in Expertiza to work on various projects and assignments as well as peer review other students' submissions. Expertiza supports submission across various document types, including the URLs Wiki pages.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
The import feature is the most helpful feature for instructors to set up assignments. The instructors usually have a list of students, teams, etc from their learning management system. Being able to import these into expertiza saves a lot of time when setting up an assignment. Unfortunately this feature has some bugs that were identified as the following list. &lt;br /&gt;
&lt;br /&gt;
'''Issue 918''': It seems that non-ASCII characters in the description (e.g., a curly apostrophe, and perhaps also an en-dash) caused a SQL error in inserting the description string into the db. I had to edit the import file to remove non-ASCII characters. Any Unicode character ought to be allowed in a description. &lt;br /&gt;
&lt;br /&gt;
'''Issue 153''': There should be a way to import a list of who has signed up for which topic. When a signup sheet is used in Expertiza, users are expected to sign up for topics. But, the instructor might've taken signups offline, e.g., by passing around a signup sheet in class. There should be a way to import this list to Expertiza, rather than impersonate all the students one by one and sign them up for a topic. '''This issue is not a bug but an additional feature to the existing import topic functionality.'''&lt;br /&gt;
&lt;br /&gt;
'''Issue 329''': When importing teams there are different options to handle conflicting team names &lt;br /&gt;
&lt;br /&gt;
'''Issue 328''': When importing teams, and a conflict exists there is an option to merge the two teams by inserting the new members into an existing team. Unfortunately, this feature is broken. we tried to import a team and selected 'Insert any new members into existing team'. No new team members were in fact inserted into the team&lt;br /&gt;
&lt;br /&gt;
== '''Fixes''' ==&lt;br /&gt;
=====Issue 918=====&lt;br /&gt;
&lt;br /&gt;
'''Problem:''' The application is not able to import topics with non ascii characters in its description field. &amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' Before the topic object is persisted into the database, check for any non ascii characters in the description field and strip them. &amp;lt;br&amp;gt;&lt;br /&gt;
'''Code Changes'''&amp;lt;br&amp;gt;&lt;br /&gt;
New code introduced is as follows.&amp;lt;br&amp;gt;&lt;br /&gt;
File:app/helpers/import_topics_helper.rb &amp;lt;br&amp;gt;&lt;br /&gt;
Here, a new function 'trim_non_ascii' has been added which iterates a given string character by character, and replaces each non ascii character with a white space character. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  def self.define_attributes(row_hash)&lt;br /&gt;
    attributes = {}&lt;br /&gt;
    if !row_hash[:description].nil? and !row_hash[:description].ascii_only?&lt;br /&gt;
      row_hash[:description] = self.trim_non_ascii(row_hash[:description])&lt;br /&gt;
      puts row_hash[:description]&lt;br /&gt;
    end&lt;br /&gt;
    attributes[&amp;quot;topic_identifier&amp;quot;] = row_hash[:topic_identifier].strip&lt;br /&gt;
    attributes[&amp;quot;topic_name&amp;quot;] = row_hash[:topic_name].strip&lt;br /&gt;
    attributes[&amp;quot;max_choosers&amp;quot;] = row_hash[:max_choosers].strip&lt;br /&gt;
    attributes&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def self.trim_non_ascii(string)&lt;br /&gt;
    string.split('').each do |char|&lt;br /&gt;
      !char.ascii_only? ? string.tr!(char, ' ') : nil&lt;br /&gt;
    end&lt;br /&gt;
    string.gsub!(/\s+/, ' ')&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
=====Issue 328=====&lt;br /&gt;
&lt;br /&gt;
'''Problem''': When importing teams, and a conflict exists there is an option to merge the two teams by inserting the new members into an existing team.&lt;br /&gt;
&lt;br /&gt;
'''Solution''': This was an issue to fix the functionality of Insert any new members into existing team. This was due to faulty handling of the option handle_dups and incorrect checking of parameters.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Code was modified to ensure minimal impact to existing testcases and functionalities.&amp;lt;br&amp;gt;&lt;br /&gt;
The handling of handle_dups in options was done assuming that the parameter was a symbol. But when tested, it was found to be a string and hence the handling was updated accordingly.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
      name = handle_duplicate(team, name, id, options[&amp;quot;handle_dups&amp;quot;], teamtype)&lt;br /&gt;
Also, the if and else conditions for checking class type of used was wrong. This was updated based on how the variable was assigned in the '''import_file_controller.rb#import_from_hash'''&lt;br /&gt;
      if(teamtype.is_a?(CourseTeam.class))&lt;br /&gt;
          ...&lt;br /&gt;
      elsif  teamtype.is_a?(AssignmentTeam.class)&lt;br /&gt;
          ...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E1938_Before_D.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
After fixing changes&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Insert_new_in_old.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Issue 329=====&lt;br /&gt;
'''Problem''': When importing teams there are different options to handle conflicting team names as shown in the screenshot below. We’d like to add another option to rename EXISTING team when a conflict exist. Introduce an option to rename the existing team in import_file/start.html.erb, handle this option in import_file_controller.rb and team.rb→import.&lt;br /&gt;
&lt;br /&gt;
'''Solution''': This was a request to add an option to rename existing team if there was a conflict in the team name.&lt;br /&gt;
New code introduced was as follows:&amp;lt;br&amp;gt;&lt;br /&gt;
In '''start.html.erb'''&amp;lt;br&amp;gt;&lt;br /&gt;
In this file, the new option as displayed to the user is added&amp;lt;br&amp;gt;&lt;br /&gt;
          &amp;lt;option value=&amp;quot;rename_existing&amp;quot;&amp;gt;rename the existing team and import&amp;lt;/option&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In '''team.rb'''&amp;lt;br&amp;gt;&lt;br /&gt;
In this file, the handling of the new tag &amp;quot;rename_existing&amp;quot; is added wherein, the old team is updated with a new name.&amp;lt;br&amp;gt;&lt;br /&gt;
    # E1938: Added handling for renaming old team when conflict arises&lt;br /&gt;
    if handle_dups == &amp;quot;rename_existing&amp;quot;&lt;br /&gt;
      if teamtype.is_a?(CourseTeam.class)&lt;br /&gt;
        team.update(name: self.generate_team_name(Course.find(id).name))&lt;br /&gt;
      elsif  teamtype.is_a?(AssignmentTeam.class)&lt;br /&gt;
        team.update(name: self.generate_team_name(Assignment.find(id).name))&lt;br /&gt;
      end&lt;br /&gt;
      return name&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''The state of D before conflicting import''':&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E1938_Before_D_1.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
After fixing changes&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:After_D.PNG]]&lt;br /&gt;
[[File:After_old_team.PNG]]&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
As you can see the '''new team got the name D''' and the old file got renamed to '''Team_17'''.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Issue 153=====&lt;br /&gt;
'''Requirement''': There should be a way to import a list of who has signed up for which topic. When a signup sheet is used in Expertiza, users are expected to sign up for topics. But, the instructor might've taken signups offline, e.g., by passing around a signup sheet in class. There should be a way to import this list to Expertiza, rather than impersonate all the students one by one and sign them up for a topic. &lt;br /&gt;
&lt;br /&gt;
'''Solution''': We have modified the existing implementation for import topics to assign the teams to the topics. We have changed the files to handle another column where the teams have been assigned to topics. The column is optional because there might be topics that have not yet been assigned to any teams&lt;br /&gt;
&lt;br /&gt;
'''Expectations from the import file: &lt;br /&gt;
'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
* Assigned team name should exist in the system, otherwise the import will fail. Instructor has to make sure that the teams which are assigned in the import file should exist with same names in the system or database. &lt;br /&gt;
* Instructor also need to ensure that the topic for which the team is being assigned should not be full or can accommodate new team assignment to the respective topic. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''Code Changes:'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''import_file/_sign_up_topic.html.erb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
As there's already a screen with select options to map the columns with the fields for import. We are just adding another column so the best way is to extend the existing select tag with a new option for the teams assigned. All the select tags has been changed with an additional option &amp;quot;Assigned Team&amp;quot;. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
 &amp;lt;th&amp;gt;&lt;br /&gt;
            &amp;lt;select name=&amp;quot;select1&amp;quot; id=&amp;quot;select1&amp;quot; class=&amp;quot;form-control&amp;quot; style=&amp;quot;background-color:lightgrey&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;topic_identifier&amp;quot;&amp;gt;Topic Identifier (required)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;topic_name&amp;quot;&amp;gt;Topic Name (required)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;max_choosers&amp;quot;&amp;gt;Max Choosers (required)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;category&amp;quot;&amp;gt;Category (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;description&amp;quot;&amp;gt;Description (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;link&amp;quot;&amp;gt;Link (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;assigned_team&amp;quot;&amp;gt;Assigned Team (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
            &amp;lt;/select&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''model/sign_up_topic.rb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The existing import function in the model import the topics to the topic table. As per the requirement and validations, topic should be imported first and then only the team can be assigned to the topic. So the existing import method has been modified to assign the team once the topic is imported in the database table. As per the edge case mentioned in the requirement document that few topics may not have any team assigned to it, so we first check if topic has any team assigned, then only it tries to map the topic with the team. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
  def self.import(row_hash, session, _id = nil)&lt;br /&gt;
    if row_hash.length &amp;lt; 3&lt;br /&gt;
      raise ArgumentError, &amp;quot;The CSV File expects the format: Topic identifier, Topic name, Max choosers, Topic Category (optional), Topic Description (Optional), Topic Link (optional), Assigned Team Name (optional).&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
    topic = SignUpTopic.where(topic_name: row_hash[:topic_name], assignment_id: session[:assignment_id]).first&lt;br /&gt;
    if topic.nil?&lt;br /&gt;
      attributes = ImportTopicsHelper.define_attributes(row_hash)&lt;br /&gt;
      topic_new_id = ImportTopicsHelper.create_new_sign_up_topic(attributes, session)&lt;br /&gt;
      unless row_hash[:assigned_team].nil?&lt;br /&gt;
          team = Team.where(name: row_hash[:assigned_team]).first&lt;br /&gt;
          ImportTopicsHelper.assign_team_topic(topic_new_id, team.id)&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      topic.max_choosers = row_hash[:max_choosers]&lt;br /&gt;
      topic.topic_identifier = row_hash[:topic_identifier]&lt;br /&gt;
      topic.save&lt;br /&gt;
      unless row_hash[:assigned_team].nil?&lt;br /&gt;
        team = Team.where(name: row_hash[:assigned_team]).first&lt;br /&gt;
        newteam = SignedUpTeam.where(topic_id: topic.id, team_id: team.id).first&lt;br /&gt;
        if newteam.nil?&lt;br /&gt;
          ImportTopicsHelper.assign_team_topic(topic.id, team.id)&lt;br /&gt;
        else&lt;br /&gt;
          newteam.team_id = team.id&lt;br /&gt;
          newteam.save&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''helpers/import_topics_helper.rb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Having the assign_team_topic in the helper would organize the code but also in the unit testing. We can isolate the model logic and test this method separately by writing the test cases. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
  def self.assign_team_topic(topic_id, assigned_team)&lt;br /&gt;
    attributes = {}&lt;br /&gt;
    attributes[&amp;quot;topic_id&amp;quot;] = topic_id&lt;br /&gt;
    attributes[&amp;quot;team_id&amp;quot;] = assigned_team&lt;br /&gt;
    assign_team = SignedUpTeam.new(attributes)&lt;br /&gt;
    assign_team.save!&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
   def self.create_new_sign_up_topic(attributes, session)&lt;br /&gt;
     sign_up_topic = SignUpTopic.new(attributes)&lt;br /&gt;
     sign_up_topic.assignment_id = session[:assignment_id]&lt;br /&gt;
     sign_up_topic.save&lt;br /&gt;
     # sign_up_topic&lt;br /&gt;
     sign_up_topic.save!&lt;br /&gt;
     sign_up_topic.id&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''controllers/import_file_controller.rb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Existing implementation for import have many flaws and design issues. Most of the code has been written with nested if else, which is not the practice to be followed. Also the names of the fields have been hardcoded. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
As we cannot change the complete import implementation. So i had to use the existing one the way it is and make changes to extend the functionality. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    if (params[:assigned_team] == 'true')&lt;br /&gt;
        @optional_count += 1&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
    elsif params[:optional_count] == '4'&lt;br /&gt;
          new_header = [params[:select1], params[:select2], params[:select3], params[:select4], params[:select5], params[:select6], params[:select7]]&lt;br /&gt;
          @header_integrated_body = hash_rows_with_headers(new_header,contents_hash[:body])&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''views/sign_up_sheet/_add_topics.html.erb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
This code has been used to display the columns in the footer.As we already have implementation for other columns, so another column name 'Assigned Team' is added here in this part of the code. &lt;br /&gt;
        &amp;lt;%= link_to 'Import topics',&lt;br /&gt;
                {&lt;br /&gt;
                    :controller =&amp;gt; 'import_file',&lt;br /&gt;
                    :action =&amp;gt; 'start',&lt;br /&gt;
                    :model =&amp;gt; 'SignUpTopic',&lt;br /&gt;
                    :id =&amp;gt; params[:id],&lt;br /&gt;
                    :expected_fields =&amp;gt; 'Topic Identifier' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Name' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Max Choosers' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Category &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Description &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Link &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Assigned Team &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
An option column checkbox (Teams Assigned) has been added to the UI&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Issue153SS8.jpg]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
A new column Assigned Team is added where the columns are being mapped. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File: Issue153SS7.jpg]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Test Plan''' ==&lt;br /&gt;
*'''RSpec:'''&lt;br /&gt;
&lt;br /&gt;
::We have added new testcases for the new pieces of code that were added by us.&lt;br /&gt;
&lt;br /&gt;
::'''[Problem 3 (329)]'''&lt;br /&gt;
::::A new testcase was added to test this functionality. We use it to check if the older team gets the new name and the new team gets the requested name. This testcase runs when we run bundle exec for the '''teams_spec.rb'''&lt;br /&gt;
      # New team name should remain the same, the old one gets updated&lt;br /&gt;
      context 'when handle_dups option is rename_existing' do&lt;br /&gt;
        it 'returns new team name' do&lt;br /&gt;
          allow(Course).to receive(:find).with(1).and_return(double('Course', name: 'course 1'))&lt;br /&gt;
          allow(Team).to receive(:generate_team_name).with('course 1').and_return('new name of team')&lt;br /&gt;
          expect(Team.handle_duplicate(team, 'no name', 1, 'rename_existing', CourseTeam)).to eq('no name')&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
*'''UI Testing:'''&lt;br /&gt;
&lt;br /&gt;
::'''[Problem 1 (918)]'''&lt;br /&gt;
::::1. Login to Expertiza using username: instructor6 &amp;amp; password: password.&lt;br /&gt;
::::2. Go to Assignments and click on edit for any of the listed assignments.&lt;br /&gt;
::::3. Click on Topics tab.&lt;br /&gt;
::::4. Scroll down to the bottom of the page and click on Import topics.&lt;br /&gt;
::::5. Click on Topic Description checkbox and import the following file. (sample.csv)&amp;lt;br&amp;gt; [[File:918 sample.png]] &amp;lt;br&amp;gt;&lt;br /&gt;
::::[[File:918_p1.png]]&lt;br /&gt;
::::6. Click on next and make the header for 4th column as 'Description' from the dropdown.&lt;br /&gt;
::::[[File:918_p2.png]]&lt;br /&gt;
::::7. Import topics.&lt;br /&gt;
::::8. After this, a new topic should be imported which can be viewed from the aforementioned Topics tab. This newly imported topic will not have any non-ascii characters.&lt;br /&gt;
&lt;br /&gt;
::'''[Problem 3 (329)]'''&lt;br /&gt;
::::1. Login to Expertiza using username: instructor6 &amp;amp; password: password.&lt;br /&gt;
::::2. Select Manage &amp;gt; Courses or Assignments &amp;gt; Add Teams button &amp;gt; Import Team&lt;br /&gt;
::::3. In the screen that loads, select &amp;quot;rename the existing team and import&amp;quot; in the handle conflicts section.&lt;br /&gt;
::::4. Upload a file with the team details and select the appropriate delimiter.&lt;br /&gt;
::::5. Click on Create&lt;br /&gt;
::::6. Verify that the new team got created with the assigned name and the older team's name got changed.&lt;br /&gt;
&lt;br /&gt;
::'''[Problem 4 (328)]'''&lt;br /&gt;
::::1. Login to Expertiza using username: instructor6 &amp;amp; password: password.&lt;br /&gt;
::::2. Select Manage &amp;gt; Courses or Assignments &amp;gt; Add Teams button &amp;gt; Import Team&lt;br /&gt;
::::3. In the screen that loads, select &amp;quot;Insert any new members into existing team&amp;quot; in the handle conflicts section.&lt;br /&gt;
::::4. Upload a file with the team details and select the appropriate delimiter.&lt;br /&gt;
::::5. Click on Create&lt;br /&gt;
::::6. Verify that the existing team got updated with the new team members&lt;br /&gt;
&lt;br /&gt;
== '''Possible Enhancements''' ==&lt;br /&gt;
&lt;br /&gt;
====='''Import functionality'''=====&lt;br /&gt;
&lt;br /&gt;
The existing import implementation does not follow DRY principle, rails code practices and even basic design principles. Most of the code is written based with nested if else conditions. This implementation can be improved. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Exception Handling: Before starting to work on this requirement. I tried few imports and in many cases, import was not successful and i was not able to figure out what's going wrong. My suggestion would be to develop a screen to show which rows were successfully imported and the failure reason which didn't. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Also, if there's no team in the system and instructor has used it in the import file so a new pop up can be displayed where the new team can be created or the import can be extended to create teams while assigning the topic.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
====='''Non Ascii character imports'''=====&lt;br /&gt;
The non ascii character issue exists for '''topic identifier''' and '''topic name''' fields as well.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1. Expertiza on GITHUB: https://github.com/expertiza/expertiza&lt;br /&gt;
&lt;br /&gt;
2. GitHub Project Repository Fork: https://github.com/NisargC/expertiza&lt;br /&gt;
&lt;br /&gt;
3. Demo link: http://152.46.19.138:8080/&lt;br /&gt;
&lt;br /&gt;
4. Expertiza project documentation wiki: http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2019_-_E1938._OSS_project_Duke_Blue:_Fix_import_glitches&lt;/div&gt;</summary>
		<author><name>Nmchoks2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1938._OSS_project_Duke_Blue:_Fix_import_glitches&amp;diff=127529</id>
		<title>CSC/ECE 517 Fall 2019 - E1938. OSS project Duke Blue: Fix import glitches</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1938._OSS_project_Duke_Blue:_Fix_import_glitches&amp;diff=127529"/>
		<updated>2019-11-06T23:26:49Z</updated>

		<summary type="html">&lt;p&gt;Nmchoks2: /* Possible Enhancements */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
== '''About Expertiza''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source project based on Ruby on Rails framework and the code is available on Github. Expertiza allows the instructor to create new assignments as well as edit new or existing assignments. Instructors can also create a list of topics the students can sign up for and specify deadlines for completion of various tasks. Students can form teams in Expertiza to work on various projects and assignments as well as peer review other students' submissions. Expertiza supports submission across various document types, including the URLs Wiki pages.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
The import feature is the most helpful feature for instructors to set up assignments. The instructors usually have a list of students, teams, etc from their learning management system. Being able to import these into expertiza saves a lot of time when setting up an assignment. Unfortunately this feature has some bugs that were identified as the following list. &lt;br /&gt;
&lt;br /&gt;
'''Issue 918''': It seems that non-ASCII characters in the description (e.g., a curly apostrophe, and perhaps also an en-dash) caused a SQL error in inserting the description string into the db. I had to edit the import file to remove non-ASCII characters. Any Unicode character ought to be allowed in a description. &lt;br /&gt;
&lt;br /&gt;
'''Issue 153''': There should be a way to import a list of who has signed up for which topic. When a signup sheet is used in Expertiza, users are expected to sign up for topics. But, the instructor might've taken signups offline, e.g., by passing around a signup sheet in class. There should be a way to import this list to Expertiza, rather than impersonate all the students one by one and sign them up for a topic. '''This issue is not a bug but an additional feature to the existing import topic functionality.'''&lt;br /&gt;
&lt;br /&gt;
'''Issue 329''': When importing teams there are different options to handle conflicting team names &lt;br /&gt;
&lt;br /&gt;
'''Issue 328''': When importing teams, and a conflict exists there is an option to merge the two teams by inserting the new members into an existing team. Unfortunately, this feature is broken. we tried to import a team and selected 'Insert any new members into existing team'. No new team members were in fact inserted into the team&lt;br /&gt;
&lt;br /&gt;
== '''Fixes''' ==&lt;br /&gt;
=====Issue 918=====&lt;br /&gt;
&lt;br /&gt;
'''Problem:''' The application is not able to import topics with non ascii characters in its description field. &amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' Before the topic object is persisted into the database, check for any non ascii characters in the description field and strip them. &amp;lt;br&amp;gt;&lt;br /&gt;
'''Code Changes'''&amp;lt;br&amp;gt;&lt;br /&gt;
New code introduced is as follows.&amp;lt;br&amp;gt;&lt;br /&gt;
File:app/helpers/import_topics_helper.rb &amp;lt;br&amp;gt;&lt;br /&gt;
Here, a new function 'trim_non_ascii' has been added which iterates a given string character by character, and replaces each non ascii character with a white space character. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  def self.define_attributes(row_hash)&lt;br /&gt;
    attributes = {}&lt;br /&gt;
    if !row_hash[:description].nil? and !row_hash[:description].ascii_only?&lt;br /&gt;
      row_hash[:description] = self.trim_non_ascii(row_hash[:description])&lt;br /&gt;
      puts row_hash[:description]&lt;br /&gt;
    end&lt;br /&gt;
    attributes[&amp;quot;topic_identifier&amp;quot;] = row_hash[:topic_identifier].strip&lt;br /&gt;
    attributes[&amp;quot;topic_name&amp;quot;] = row_hash[:topic_name].strip&lt;br /&gt;
    attributes[&amp;quot;max_choosers&amp;quot;] = row_hash[:max_choosers].strip&lt;br /&gt;
    attributes&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def self.trim_non_ascii(string)&lt;br /&gt;
    string.split('').each do |char|&lt;br /&gt;
      !char.ascii_only? ? string.tr!(char, ' ') : nil&lt;br /&gt;
    end&lt;br /&gt;
    string.gsub!(/\s+/, ' ')&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
=====Issue 328=====&lt;br /&gt;
&lt;br /&gt;
'''Problem''': When importing teams, and a conflict exists there is an option to merge the two teams by inserting the new members into an existing team.&lt;br /&gt;
&lt;br /&gt;
'''Solution''': This was an issue to fix the functionality of Insert any new members into existing team. This was due to faulty handling of the option handle_dups and incorrect checking of parameters.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Code was modified to ensure minimal impact to existing testcases and functionalities.&amp;lt;br&amp;gt;&lt;br /&gt;
The handling of handle_dups in options was done assuming that the parameter was a symbol. But when tested, it was found to be a string and hence the handling was updated accordingly.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
      name = handle_duplicate(team, name, id, options[&amp;quot;handle_dups&amp;quot;], teamtype)&lt;br /&gt;
Also, the if and else conditions for checking class type of used was wrong. This was updated based on how the variable was assigned in the '''import_file_controller.rb#import_from_hash'''&lt;br /&gt;
      if(teamtype.is_a?(CourseTeam.class))&lt;br /&gt;
          ...&lt;br /&gt;
      elsif  teamtype.is_a?(AssignmentTeam.class)&lt;br /&gt;
          ...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E1938_Before_D.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
After fixing changes&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Insert_new_in_old.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Issue 329=====&lt;br /&gt;
'''Problem''': When importing teams there are different options to handle conflicting team names as shown in the screenshot below. We’d like to add another option to rename EXISTING team when a conflict exist. Introduce an option to rename the existing team in import_file/start.html.erb, handle this option in import_file_controller.rb and team.rb→import.&lt;br /&gt;
&lt;br /&gt;
'''Solution''': This was a request to add an option to rename existing team if there was a conflict in the team name.&lt;br /&gt;
New code introduced was as follows:&amp;lt;br&amp;gt;&lt;br /&gt;
In '''start.html.erb'''&amp;lt;br&amp;gt;&lt;br /&gt;
In this file, the new option as displayed to the user is added&amp;lt;br&amp;gt;&lt;br /&gt;
          &amp;lt;option value=&amp;quot;rename_existing&amp;quot;&amp;gt;rename the existing team and import&amp;lt;/option&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In '''team.rb'''&amp;lt;br&amp;gt;&lt;br /&gt;
In this file, the handling of the new tag &amp;quot;rename_existing&amp;quot; is added wherein, the old team is updated with a new name.&amp;lt;br&amp;gt;&lt;br /&gt;
    # E1938: Added handling for renaming old team when conflict arises&lt;br /&gt;
    if handle_dups == &amp;quot;rename_existing&amp;quot;&lt;br /&gt;
      if teamtype.is_a?(CourseTeam.class)&lt;br /&gt;
        team.update(name: self.generate_team_name(Course.find(id).name))&lt;br /&gt;
      elsif  teamtype.is_a?(AssignmentTeam.class)&lt;br /&gt;
        team.update(name: self.generate_team_name(Assignment.find(id).name))&lt;br /&gt;
      end&lt;br /&gt;
      return name&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''The state of D before conflicting import''':&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E1938_Before_D_1.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
After fixing changes&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:After_D.PNG]]&lt;br /&gt;
[[File:After_old_team.PNG]]&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
As you can see the '''new team got the name D''' and the old file got renamed to '''Team_17'''.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Issue 153=====&lt;br /&gt;
'''Requirement''': There should be a way to import a list of who has signed up for which topic. When a signup sheet is used in Expertiza, users are expected to sign up for topics. But, the instructor might've taken signups offline, e.g., by passing around a signup sheet in class. There should be a way to import this list to Expertiza, rather than impersonate all the students one by one and sign them up for a topic. &lt;br /&gt;
&lt;br /&gt;
'''Solution''': We have modified the existing implementation for import topics to assign the teams to the topics. We have changed the files to handle another column where the teams have been assigned to topics. The column is optional because there might be topics that have not yet been assigned to any teams&lt;br /&gt;
&lt;br /&gt;
'''Expectations from the import file: &lt;br /&gt;
'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
* Assigned team name should exist in the system, otherwise the import will fail. Instructor has to make sure that the teams which are assigned in the import file should exist with same names in the system or database. &lt;br /&gt;
* Instructor also need to ensure that the topic for which the team is being assigned should not be full or can accommodate new team assignment to the respective topic. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''Code Changes:'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''import_file/_sign_up_topic.html.erb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
As there's already a screen with select options to map the columns with the fields for import. We are just adding another column so the best way is to extend the existing select tag with a new option for the teams assigned. All the select tags has been changed with an additional option &amp;quot;Assigned Team&amp;quot;. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
 &amp;lt;th&amp;gt;&lt;br /&gt;
            &amp;lt;select name=&amp;quot;select1&amp;quot; id=&amp;quot;select1&amp;quot; class=&amp;quot;form-control&amp;quot; style=&amp;quot;background-color:lightgrey&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;topic_identifier&amp;quot;&amp;gt;Topic Identifier (required)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;topic_name&amp;quot;&amp;gt;Topic Name (required)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;max_choosers&amp;quot;&amp;gt;Max Choosers (required)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;category&amp;quot;&amp;gt;Category (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;description&amp;quot;&amp;gt;Description (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;link&amp;quot;&amp;gt;Link (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;assigned_team&amp;quot;&amp;gt;Assigned Team (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
            &amp;lt;/select&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''model/sign_up_topic.rb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The existing import function in the model import the topics to the topic table. As per the requirement and validations, topic should be imported first and then only the team can be assigned to the topic. So the existing import method has been modified to assign the team once the topic is imported in the database table. As per the edge case mentioned in the requirement document that few topics may not have any team assigned to it, so we first check if topic has any team assigned, then only it tries to map the topic with the team. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
  def self.import(row_hash, session, _id = nil)&lt;br /&gt;
    if row_hash.length &amp;lt; 3&lt;br /&gt;
      raise ArgumentError, &amp;quot;The CSV File expects the format: Topic identifier, Topic name, Max choosers, Topic Category (optional), Topic Description (Optional), Topic Link (optional), Assigned Team Name (optional).&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
    topic = SignUpTopic.where(topic_name: row_hash[:topic_name], assignment_id: session[:assignment_id]).first&lt;br /&gt;
    if topic.nil?&lt;br /&gt;
      attributes = ImportTopicsHelper.define_attributes(row_hash)&lt;br /&gt;
      topic_new_id = ImportTopicsHelper.create_new_sign_up_topic(attributes, session)&lt;br /&gt;
      unless row_hash[:assigned_team].nil?&lt;br /&gt;
          team = Team.where(name: row_hash[:assigned_team]).first&lt;br /&gt;
          ImportTopicsHelper.assign_team_topic(topic_new_id, team.id)&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      topic.max_choosers = row_hash[:max_choosers]&lt;br /&gt;
      topic.topic_identifier = row_hash[:topic_identifier]&lt;br /&gt;
      topic.save&lt;br /&gt;
      unless row_hash[:assigned_team].nil?&lt;br /&gt;
        team = Team.where(name: row_hash[:assigned_team]).first&lt;br /&gt;
        newteam = SignedUpTeam.where(topic_id: topic.id, team_id: team.id).first&lt;br /&gt;
        if newteam.nil?&lt;br /&gt;
          ImportTopicsHelper.assign_team_topic(topic.id, team.id)&lt;br /&gt;
        else&lt;br /&gt;
          newteam.team_id = team.id&lt;br /&gt;
          newteam.save&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''helpers/import_topics_helper.rb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Having the assign_team_topic in the helper would organize the code but also in the unit testing. We can isolate the model logic and test this method separately by writing the test cases. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
  def self.assign_team_topic(topic_id, assigned_team)&lt;br /&gt;
    attributes = {}&lt;br /&gt;
    attributes[&amp;quot;topic_id&amp;quot;] = topic_id&lt;br /&gt;
    attributes[&amp;quot;team_id&amp;quot;] = assigned_team&lt;br /&gt;
    assign_team = SignedUpTeam.new(attributes)&lt;br /&gt;
    assign_team.save!&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
   def self.create_new_sign_up_topic(attributes, session)&lt;br /&gt;
     sign_up_topic = SignUpTopic.new(attributes)&lt;br /&gt;
     sign_up_topic.assignment_id = session[:assignment_id]&lt;br /&gt;
     sign_up_topic.save&lt;br /&gt;
     # sign_up_topic&lt;br /&gt;
     sign_up_topic.save!&lt;br /&gt;
     sign_up_topic.id&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''controllers/import_file_controller.rb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Existing implementation for import have many flaws and design issues. Most of the code has been written with nested if else, which is not the practice to be followed. Also the names of the fields have been hardcoded. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
As we cannot change the complete import implementation. So i had to use the existing one the way it is and make changes to extend the functionality. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    if (params[:assigned_team] == 'true')&lt;br /&gt;
        @optional_count += 1&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
    elsif params[:optional_count] == '4'&lt;br /&gt;
          new_header = [params[:select1], params[:select2], params[:select3], params[:select4], params[:select5], params[:select6], params[:select7]]&lt;br /&gt;
          @header_integrated_body = hash_rows_with_headers(new_header,contents_hash[:body])&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''views/sign_up_sheet/_add_topics.html.erb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
This code has been used to display the columns in the footer.As we already have implementation for other columns, so another column name 'Assigned Team' is added here in this part of the code. &lt;br /&gt;
        &amp;lt;%= link_to 'Import topics',&lt;br /&gt;
                {&lt;br /&gt;
                    :controller =&amp;gt; 'import_file',&lt;br /&gt;
                    :action =&amp;gt; 'start',&lt;br /&gt;
                    :model =&amp;gt; 'SignUpTopic',&lt;br /&gt;
                    :id =&amp;gt; params[:id],&lt;br /&gt;
                    :expected_fields =&amp;gt; 'Topic Identifier' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Name' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Max Choosers' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Category &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Description &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Link &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Assigned Team &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
An option column checkbox (Teams Assigned) has been added to the UI&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Issue153SS8.jpg]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
A new column Assigned Team is added where the columns are being mapped. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File: Issue153SS7.jpg]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Test Plan''' ==&lt;br /&gt;
*'''RSpec:'''&lt;br /&gt;
&lt;br /&gt;
::We have added new testcases for the new pieces of code that were added by us.&lt;br /&gt;
&lt;br /&gt;
::'''[Problem 3 (329)]'''&lt;br /&gt;
::::A new testcase was added to test this functionality. We use it to check if the older team gets the new name and the new team gets the requested name. This testcase runs when we run bundle exec for the '''teams_spec.rb'''&lt;br /&gt;
      # New team name should remain the same, the old one gets updated&lt;br /&gt;
      context 'when handle_dups option is rename_existing' do&lt;br /&gt;
        it 'returns new team name' do&lt;br /&gt;
          allow(Course).to receive(:find).with(1).and_return(double('Course', name: 'course 1'))&lt;br /&gt;
          allow(Team).to receive(:generate_team_name).with('course 1').and_return('new name of team')&lt;br /&gt;
          expect(Team.handle_duplicate(team, 'no name', 1, 'rename_existing', CourseTeam)).to eq('no name')&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
*'''UI Testing:'''&lt;br /&gt;
&lt;br /&gt;
::'''[Problem 1 (918)]'''&lt;br /&gt;
::::1. Login to Expertiza using username: instructor6 &amp;amp; password: password.&lt;br /&gt;
::::2. Go to Assignments and click on edit for any of the listed assignments.&lt;br /&gt;
::::3. Click on Topics tab.&lt;br /&gt;
::::4. Scroll down to the bottom of the page and click on Import topics.&lt;br /&gt;
::::5. Click on Topic Description checkbox and import the following file. (sample.csv)&amp;lt;br&amp;gt; [[File:918 sample.png]] &amp;lt;br&amp;gt;&lt;br /&gt;
::::[[File:918_p1.png]]&lt;br /&gt;
::::6. Click on next and make the header for 4th column as 'Description' from the dropdown.&lt;br /&gt;
::::[[File:918_p2.png]]&lt;br /&gt;
::::7. Import topics.&lt;br /&gt;
::::8. After this, a new topic should be imported which can be viewed from the aforementioned Topics tab. This newly imported topic will not have any non-ascii characters.&lt;br /&gt;
&lt;br /&gt;
::'''[Problem 3 (329)]'''&lt;br /&gt;
::::1. Login to Expertiza using username: instructor6 &amp;amp; password: password.&lt;br /&gt;
::::2. Select Manage &amp;gt; Courses or Assignments &amp;gt; Add Teams button &amp;gt; Import Team&lt;br /&gt;
::::3. In the screen that loads, select &amp;quot;rename the existing team and import&amp;quot; in the handle conflicts section.&lt;br /&gt;
::::4. Upload a file with the team details and select the appropriate delimiter.&lt;br /&gt;
::::5. Click on Create&lt;br /&gt;
::::6. Verify that the new team got created with the assigned name and the older team's name got changed.&lt;br /&gt;
&lt;br /&gt;
::'''[Problem 4 (328)]'''&lt;br /&gt;
::::1. Login to Expertiza using username: instructor6 &amp;amp; password: password.&lt;br /&gt;
::::2. Select Manage &amp;gt; Courses or Assignments &amp;gt; Add Teams button &amp;gt; Import Team&lt;br /&gt;
::::3. In the screen that loads, select &amp;quot;Insert any new members into existing team&amp;quot; in the handle conflicts section.&lt;br /&gt;
::::4. Upload a file with the team details and select the appropriate delimiter.&lt;br /&gt;
::::5. Click on Create&lt;br /&gt;
::::6. Verify that the existing team got updated with the new team members&lt;br /&gt;
&lt;br /&gt;
== '''Possible Enhancements''' ==&lt;br /&gt;
&lt;br /&gt;
====='''Import functionality'''=====&lt;br /&gt;
&lt;br /&gt;
The existing import implementation does not follow DRY principle, rails code practices and even basic design principles. Most of the code is written based with nested if else conditions. This implementation can be improved. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Exception Handling: Before starting to work on this requirement. I tried few imports and in many cases, import was not successful and i was not able to figure out what's going wrong. My suggestion would be to develop a screen to show which rows were successfully imported and the failure reason which didn't. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Also, if there's no team in the system and instructor has used it in the import file so a new pop up can be displayed where the new team can be created or the import can be extended to create teams while assigning the topic.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
====='''Non Ascii character imports'''=====&lt;br /&gt;
The non ascii character issue exists for topic identifier and topic name fields as well.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1. Expertiza on GITHUB: https://github.com/expertiza/expertiza&lt;br /&gt;
&lt;br /&gt;
2. GitHub Project Repository Fork: https://github.com/NisargC/expertiza&lt;br /&gt;
&lt;br /&gt;
3. Demo link: http://152.46.19.138:8080/&lt;br /&gt;
&lt;br /&gt;
4. Expertiza project documentation wiki: http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2019_-_E1938._OSS_project_Duke_Blue:_Fix_import_glitches&lt;/div&gt;</summary>
		<author><name>Nmchoks2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1938._OSS_project_Duke_Blue:_Fix_import_glitches&amp;diff=127527</id>
		<title>CSC/ECE 517 Fall 2019 - E1938. OSS project Duke Blue: Fix import glitches</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1938._OSS_project_Duke_Blue:_Fix_import_glitches&amp;diff=127527"/>
		<updated>2019-11-06T23:25:42Z</updated>

		<summary type="html">&lt;p&gt;Nmchoks2: /* Possible Enhancements */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
== '''About Expertiza''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source project based on Ruby on Rails framework and the code is available on Github. Expertiza allows the instructor to create new assignments as well as edit new or existing assignments. Instructors can also create a list of topics the students can sign up for and specify deadlines for completion of various tasks. Students can form teams in Expertiza to work on various projects and assignments as well as peer review other students' submissions. Expertiza supports submission across various document types, including the URLs Wiki pages.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
The import feature is the most helpful feature for instructors to set up assignments. The instructors usually have a list of students, teams, etc from their learning management system. Being able to import these into expertiza saves a lot of time when setting up an assignment. Unfortunately this feature has some bugs that were identified as the following list. &lt;br /&gt;
&lt;br /&gt;
'''Issue 918''': It seems that non-ASCII characters in the description (e.g., a curly apostrophe, and perhaps also an en-dash) caused a SQL error in inserting the description string into the db. I had to edit the import file to remove non-ASCII characters. Any Unicode character ought to be allowed in a description. &lt;br /&gt;
&lt;br /&gt;
'''Issue 153''': There should be a way to import a list of who has signed up for which topic. When a signup sheet is used in Expertiza, users are expected to sign up for topics. But, the instructor might've taken signups offline, e.g., by passing around a signup sheet in class. There should be a way to import this list to Expertiza, rather than impersonate all the students one by one and sign them up for a topic. '''This issue is not a bug but an additional feature to the existing import topic functionality.'''&lt;br /&gt;
&lt;br /&gt;
'''Issue 329''': When importing teams there are different options to handle conflicting team names &lt;br /&gt;
&lt;br /&gt;
'''Issue 328''': When importing teams, and a conflict exists there is an option to merge the two teams by inserting the new members into an existing team. Unfortunately, this feature is broken. we tried to import a team and selected 'Insert any new members into existing team'. No new team members were in fact inserted into the team&lt;br /&gt;
&lt;br /&gt;
== '''Fixes''' ==&lt;br /&gt;
=====Issue 918=====&lt;br /&gt;
&lt;br /&gt;
'''Problem:''' The application is not able to import topics with non ascii characters in its description field. &amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' Before the topic object is persisted into the database, check for any non ascii characters in the description field and strip them. &amp;lt;br&amp;gt;&lt;br /&gt;
'''Code Changes'''&amp;lt;br&amp;gt;&lt;br /&gt;
New code introduced is as follows.&amp;lt;br&amp;gt;&lt;br /&gt;
File:app/helpers/import_topics_helper.rb &amp;lt;br&amp;gt;&lt;br /&gt;
Here, a new function 'trim_non_ascii' has been added which iterates a given string character by character, and replaces each non ascii character with a white space character. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  def self.define_attributes(row_hash)&lt;br /&gt;
    attributes = {}&lt;br /&gt;
    if !row_hash[:description].nil? and !row_hash[:description].ascii_only?&lt;br /&gt;
      row_hash[:description] = self.trim_non_ascii(row_hash[:description])&lt;br /&gt;
      puts row_hash[:description]&lt;br /&gt;
    end&lt;br /&gt;
    attributes[&amp;quot;topic_identifier&amp;quot;] = row_hash[:topic_identifier].strip&lt;br /&gt;
    attributes[&amp;quot;topic_name&amp;quot;] = row_hash[:topic_name].strip&lt;br /&gt;
    attributes[&amp;quot;max_choosers&amp;quot;] = row_hash[:max_choosers].strip&lt;br /&gt;
    attributes&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def self.trim_non_ascii(string)&lt;br /&gt;
    string.split('').each do |char|&lt;br /&gt;
      !char.ascii_only? ? string.tr!(char, ' ') : nil&lt;br /&gt;
    end&lt;br /&gt;
    string.gsub!(/\s+/, ' ')&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
=====Issue 328=====&lt;br /&gt;
&lt;br /&gt;
'''Problem''': When importing teams, and a conflict exists there is an option to merge the two teams by inserting the new members into an existing team.&lt;br /&gt;
&lt;br /&gt;
'''Solution''': This was an issue to fix the functionality of Insert any new members into existing team. This was due to faulty handling of the option handle_dups and incorrect checking of parameters.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Code was modified to ensure minimal impact to existing testcases and functionalities.&amp;lt;br&amp;gt;&lt;br /&gt;
The handling of handle_dups in options was done assuming that the parameter was a symbol. But when tested, it was found to be a string and hence the handling was updated accordingly.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
      name = handle_duplicate(team, name, id, options[&amp;quot;handle_dups&amp;quot;], teamtype)&lt;br /&gt;
Also, the if and else conditions for checking class type of used was wrong. This was updated based on how the variable was assigned in the '''import_file_controller.rb#import_from_hash'''&lt;br /&gt;
      if(teamtype.is_a?(CourseTeam.class))&lt;br /&gt;
          ...&lt;br /&gt;
      elsif  teamtype.is_a?(AssignmentTeam.class)&lt;br /&gt;
          ...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E1938_Before_D.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
After fixing changes&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Insert_new_in_old.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Issue 329=====&lt;br /&gt;
'''Problem''': When importing teams there are different options to handle conflicting team names as shown in the screenshot below. We’d like to add another option to rename EXISTING team when a conflict exist. Introduce an option to rename the existing team in import_file/start.html.erb, handle this option in import_file_controller.rb and team.rb→import.&lt;br /&gt;
&lt;br /&gt;
'''Solution''': This was a request to add an option to rename existing team if there was a conflict in the team name.&lt;br /&gt;
New code introduced was as follows:&amp;lt;br&amp;gt;&lt;br /&gt;
In '''start.html.erb'''&amp;lt;br&amp;gt;&lt;br /&gt;
In this file, the new option as displayed to the user is added&amp;lt;br&amp;gt;&lt;br /&gt;
          &amp;lt;option value=&amp;quot;rename_existing&amp;quot;&amp;gt;rename the existing team and import&amp;lt;/option&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In '''team.rb'''&amp;lt;br&amp;gt;&lt;br /&gt;
In this file, the handling of the new tag &amp;quot;rename_existing&amp;quot; is added wherein, the old team is updated with a new name.&amp;lt;br&amp;gt;&lt;br /&gt;
    # E1938: Added handling for renaming old team when conflict arises&lt;br /&gt;
    if handle_dups == &amp;quot;rename_existing&amp;quot;&lt;br /&gt;
      if teamtype.is_a?(CourseTeam.class)&lt;br /&gt;
        team.update(name: self.generate_team_name(Course.find(id).name))&lt;br /&gt;
      elsif  teamtype.is_a?(AssignmentTeam.class)&lt;br /&gt;
        team.update(name: self.generate_team_name(Assignment.find(id).name))&lt;br /&gt;
      end&lt;br /&gt;
      return name&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''The state of D before conflicting import''':&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E1938_Before_D_1.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
After fixing changes&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:After_D.PNG]]&lt;br /&gt;
[[File:After_old_team.PNG]]&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
As you can see the '''new team got the name D''' and the old file got renamed to '''Team_17'''.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Issue 153=====&lt;br /&gt;
'''Requirement''': There should be a way to import a list of who has signed up for which topic. When a signup sheet is used in Expertiza, users are expected to sign up for topics. But, the instructor might've taken signups offline, e.g., by passing around a signup sheet in class. There should be a way to import this list to Expertiza, rather than impersonate all the students one by one and sign them up for a topic. &lt;br /&gt;
&lt;br /&gt;
'''Solution''': We have modified the existing implementation for import topics to assign the teams to the topics. We have changed the files to handle another column where the teams have been assigned to topics. The column is optional because there might be topics that have not yet been assigned to any teams&lt;br /&gt;
&lt;br /&gt;
'''Expectations from the import file: &lt;br /&gt;
'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
* Assigned team name should exist in the system, otherwise the import will fail. Instructor has to make sure that the teams which are assigned in the import file should exist with same names in the system or database. &lt;br /&gt;
* Instructor also need to ensure that the topic for which the team is being assigned should not be full or can accommodate new team assignment to the respective topic. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''Code Changes:'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''import_file/_sign_up_topic.html.erb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
As there's already a screen with select options to map the columns with the fields for import. We are just adding another column so the best way is to extend the existing select tag with a new option for the teams assigned. All the select tags has been changed with an additional option &amp;quot;Assigned Team&amp;quot;. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
 &amp;lt;th&amp;gt;&lt;br /&gt;
            &amp;lt;select name=&amp;quot;select1&amp;quot; id=&amp;quot;select1&amp;quot; class=&amp;quot;form-control&amp;quot; style=&amp;quot;background-color:lightgrey&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;topic_identifier&amp;quot;&amp;gt;Topic Identifier (required)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;topic_name&amp;quot;&amp;gt;Topic Name (required)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;max_choosers&amp;quot;&amp;gt;Max Choosers (required)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;category&amp;quot;&amp;gt;Category (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;description&amp;quot;&amp;gt;Description (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;link&amp;quot;&amp;gt;Link (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;assigned_team&amp;quot;&amp;gt;Assigned Team (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
            &amp;lt;/select&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''model/sign_up_topic.rb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The existing import function in the model import the topics to the topic table. As per the requirement and validations, topic should be imported first and then only the team can be assigned to the topic. So the existing import method has been modified to assign the team once the topic is imported in the database table. As per the edge case mentioned in the requirement document that few topics may not have any team assigned to it, so we first check if topic has any team assigned, then only it tries to map the topic with the team. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
  def self.import(row_hash, session, _id = nil)&lt;br /&gt;
    if row_hash.length &amp;lt; 3&lt;br /&gt;
      raise ArgumentError, &amp;quot;The CSV File expects the format: Topic identifier, Topic name, Max choosers, Topic Category (optional), Topic Description (Optional), Topic Link (optional), Assigned Team Name (optional).&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
    topic = SignUpTopic.where(topic_name: row_hash[:topic_name], assignment_id: session[:assignment_id]).first&lt;br /&gt;
    if topic.nil?&lt;br /&gt;
      attributes = ImportTopicsHelper.define_attributes(row_hash)&lt;br /&gt;
      topic_new_id = ImportTopicsHelper.create_new_sign_up_topic(attributes, session)&lt;br /&gt;
      unless row_hash[:assigned_team].nil?&lt;br /&gt;
          team = Team.where(name: row_hash[:assigned_team]).first&lt;br /&gt;
          ImportTopicsHelper.assign_team_topic(topic_new_id, team.id)&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      topic.max_choosers = row_hash[:max_choosers]&lt;br /&gt;
      topic.topic_identifier = row_hash[:topic_identifier]&lt;br /&gt;
      topic.save&lt;br /&gt;
      unless row_hash[:assigned_team].nil?&lt;br /&gt;
        team = Team.where(name: row_hash[:assigned_team]).first&lt;br /&gt;
        newteam = SignedUpTeam.where(topic_id: topic.id, team_id: team.id).first&lt;br /&gt;
        if newteam.nil?&lt;br /&gt;
          ImportTopicsHelper.assign_team_topic(topic.id, team.id)&lt;br /&gt;
        else&lt;br /&gt;
          newteam.team_id = team.id&lt;br /&gt;
          newteam.save&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''helpers/import_topics_helper.rb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Having the assign_team_topic in the helper would organize the code but also in the unit testing. We can isolate the model logic and test this method separately by writing the test cases. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
  def self.assign_team_topic(topic_id, assigned_team)&lt;br /&gt;
    attributes = {}&lt;br /&gt;
    attributes[&amp;quot;topic_id&amp;quot;] = topic_id&lt;br /&gt;
    attributes[&amp;quot;team_id&amp;quot;] = assigned_team&lt;br /&gt;
    assign_team = SignedUpTeam.new(attributes)&lt;br /&gt;
    assign_team.save!&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
   def self.create_new_sign_up_topic(attributes, session)&lt;br /&gt;
     sign_up_topic = SignUpTopic.new(attributes)&lt;br /&gt;
     sign_up_topic.assignment_id = session[:assignment_id]&lt;br /&gt;
     sign_up_topic.save&lt;br /&gt;
     # sign_up_topic&lt;br /&gt;
     sign_up_topic.save!&lt;br /&gt;
     sign_up_topic.id&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''controllers/import_file_controller.rb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Existing implementation for import have many flaws and design issues. Most of the code has been written with nested if else, which is not the practice to be followed. Also the names of the fields have been hardcoded. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
As we cannot change the complete import implementation. So i had to use the existing one the way it is and make changes to extend the functionality. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    if (params[:assigned_team] == 'true')&lt;br /&gt;
        @optional_count += 1&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
    elsif params[:optional_count] == '4'&lt;br /&gt;
          new_header = [params[:select1], params[:select2], params[:select3], params[:select4], params[:select5], params[:select6], params[:select7]]&lt;br /&gt;
          @header_integrated_body = hash_rows_with_headers(new_header,contents_hash[:body])&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''views/sign_up_sheet/_add_topics.html.erb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
This code has been used to display the columns in the footer.As we already have implementation for other columns, so another column name 'Assigned Team' is added here in this part of the code. &lt;br /&gt;
        &amp;lt;%= link_to 'Import topics',&lt;br /&gt;
                {&lt;br /&gt;
                    :controller =&amp;gt; 'import_file',&lt;br /&gt;
                    :action =&amp;gt; 'start',&lt;br /&gt;
                    :model =&amp;gt; 'SignUpTopic',&lt;br /&gt;
                    :id =&amp;gt; params[:id],&lt;br /&gt;
                    :expected_fields =&amp;gt; 'Topic Identifier' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Name' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Max Choosers' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Category &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Description &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Link &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Assigned Team &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
An option column checkbox (Teams Assigned) has been added to the UI&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Issue153SS8.jpg]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
A new column Assigned Team is added where the columns are being mapped. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File: Issue153SS7.jpg]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Test Plan''' ==&lt;br /&gt;
*'''RSpec:'''&lt;br /&gt;
&lt;br /&gt;
::We have added new testcases for the new pieces of code that were added by us.&lt;br /&gt;
&lt;br /&gt;
::'''[Problem 3 (329)]'''&lt;br /&gt;
::::A new testcase was added to test this functionality. We use it to check if the older team gets the new name and the new team gets the requested name. This testcase runs when we run bundle exec for the '''teams_spec.rb'''&lt;br /&gt;
      # New team name should remain the same, the old one gets updated&lt;br /&gt;
      context 'when handle_dups option is rename_existing' do&lt;br /&gt;
        it 'returns new team name' do&lt;br /&gt;
          allow(Course).to receive(:find).with(1).and_return(double('Course', name: 'course 1'))&lt;br /&gt;
          allow(Team).to receive(:generate_team_name).with('course 1').and_return('new name of team')&lt;br /&gt;
          expect(Team.handle_duplicate(team, 'no name', 1, 'rename_existing', CourseTeam)).to eq('no name')&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
*'''UI Testing:'''&lt;br /&gt;
&lt;br /&gt;
::'''[Problem 1 (918)]'''&lt;br /&gt;
::::1. Login to Expertiza using username: instructor6 &amp;amp; password: password.&lt;br /&gt;
::::2. Go to Assignments and click on edit for any of the listed assignments.&lt;br /&gt;
::::3. Click on Topics tab.&lt;br /&gt;
::::4. Scroll down to the bottom of the page and click on Import topics.&lt;br /&gt;
::::5. Click on Topic Description checkbox and import the following file. (sample.csv)&amp;lt;br&amp;gt; [[File:918 sample.png]] &amp;lt;br&amp;gt;&lt;br /&gt;
::::[[File:918_p1.png]]&lt;br /&gt;
::::6. Click on next and make the header for 4th column as 'Description' from the dropdown.&lt;br /&gt;
::::[[File:918_p2.png]]&lt;br /&gt;
::::7. Import topics.&lt;br /&gt;
::::8. After this, a new topic should be imported which can be viewed from the aforementioned Topics tab. This newly imported topic will not have any non-ascii characters.&lt;br /&gt;
&lt;br /&gt;
::'''[Problem 3 (329)]'''&lt;br /&gt;
::::1. Login to Expertiza using username: instructor6 &amp;amp; password: password.&lt;br /&gt;
::::2. Select Manage &amp;gt; Courses or Assignments &amp;gt; Add Teams button &amp;gt; Import Team&lt;br /&gt;
::::3. In the screen that loads, select &amp;quot;rename the existing team and import&amp;quot; in the handle conflicts section.&lt;br /&gt;
::::4. Upload a file with the team details and select the appropriate delimiter.&lt;br /&gt;
::::5. Click on Create&lt;br /&gt;
::::6. Verify that the new team got created with the assigned name and the older team's name got changed.&lt;br /&gt;
&lt;br /&gt;
::'''[Problem 4 (328)]'''&lt;br /&gt;
::::1. Login to Expertiza using username: instructor6 &amp;amp; password: password.&lt;br /&gt;
::::2. Select Manage &amp;gt; Courses or Assignments &amp;gt; Add Teams button &amp;gt; Import Team&lt;br /&gt;
::::3. In the screen that loads, select &amp;quot;Insert any new members into existing team&amp;quot; in the handle conflicts section.&lt;br /&gt;
::::4. Upload a file with the team details and select the appropriate delimiter.&lt;br /&gt;
::::5. Click on Create&lt;br /&gt;
::::6. Verify that the existing team got updated with the new team members&lt;br /&gt;
&lt;br /&gt;
== '''Possible Enhancements''' ==&lt;br /&gt;
&lt;br /&gt;
====='''Import functionality'''=====&lt;br /&gt;
&lt;br /&gt;
The existing import implementation does not follow DRY principle, rails code practices and even basic design principles. Most of the code is written based with nested if else conditions. This implementation can be improved. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Exception Handling: Before starting to work on this requirement. I tried few imports and in many cases, import was not successful and i was not able to figure out what's going wrong. My suggestion would be to develop a screen to show which rows were successfully imported and the failure reason which didn't. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Also, if there's no team in the system and instructor has used it in the import file so a new pop up can be displayed where the new team can be created or the import can be extended to create teams while assigning the topic. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The non ascii character issue exists for topic identifier and topic name fields as well.&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1. Expertiza on GITHUB: https://github.com/expertiza/expertiza&lt;br /&gt;
&lt;br /&gt;
2. GitHub Project Repository Fork: https://github.com/NisargC/expertiza&lt;br /&gt;
&lt;br /&gt;
3. Demo link: http://152.46.19.138:8080/&lt;br /&gt;
&lt;br /&gt;
4. Expertiza project documentation wiki: http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2019_-_E1938._OSS_project_Duke_Blue:_Fix_import_glitches&lt;/div&gt;</summary>
		<author><name>Nmchoks2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1938._OSS_project_Duke_Blue:_Fix_import_glitches&amp;diff=127519</id>
		<title>CSC/ECE 517 Fall 2019 - E1938. OSS project Duke Blue: Fix import glitches</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1938._OSS_project_Duke_Blue:_Fix_import_glitches&amp;diff=127519"/>
		<updated>2019-11-06T23:22:27Z</updated>

		<summary type="html">&lt;p&gt;Nmchoks2: /* Issue 329 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
== '''About Expertiza''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source project based on Ruby on Rails framework and the code is available on Github. Expertiza allows the instructor to create new assignments as well as edit new or existing assignments. Instructors can also create a list of topics the students can sign up for and specify deadlines for completion of various tasks. Students can form teams in Expertiza to work on various projects and assignments as well as peer review other students' submissions. Expertiza supports submission across various document types, including the URLs Wiki pages.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
The import feature is the most helpful feature for instructors to set up assignments. The instructors usually have a list of students, teams, etc from their learning management system. Being able to import these into expertiza saves a lot of time when setting up an assignment. Unfortunately this feature has some bugs that were identified as the following list. &lt;br /&gt;
&lt;br /&gt;
'''Issue 918''': It seems that non-ASCII characters in the description (e.g., a curly apostrophe, and perhaps also an en-dash) caused a SQL error in inserting the description string into the db. I had to edit the import file to remove non-ASCII characters. Any Unicode character ought to be allowed in a description. &lt;br /&gt;
&lt;br /&gt;
'''Issue 153''': There should be a way to import a list of who has signed up for which topic. When a signup sheet is used in Expertiza, users are expected to sign up for topics. But, the instructor might've taken signups offline, e.g., by passing around a signup sheet in class. There should be a way to import this list to Expertiza, rather than impersonate all the students one by one and sign them up for a topic. '''This issue is not a bug but an additional feature to the existing import topic functionality.'''&lt;br /&gt;
&lt;br /&gt;
'''Issue 329''': When importing teams there are different options to handle conflicting team names &lt;br /&gt;
&lt;br /&gt;
'''Issue 328''': When importing teams, and a conflict exists there is an option to merge the two teams by inserting the new members into an existing team. Unfortunately, this feature is broken. we tried to import a team and selected 'Insert any new members into existing team'. No new team members were in fact inserted into the team&lt;br /&gt;
&lt;br /&gt;
== '''Fixes''' ==&lt;br /&gt;
=====Issue 918=====&lt;br /&gt;
&lt;br /&gt;
'''Problem:''' The application is not able to import topics with non ascii characters in its description field. &amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' Before the topic object is persisted into the database, check for any non ascii characters in the description field and strip them. &amp;lt;br&amp;gt;&lt;br /&gt;
'''Code Changes'''&amp;lt;br&amp;gt;&lt;br /&gt;
New code introduced is as follows.&amp;lt;br&amp;gt;&lt;br /&gt;
File:app/helpers/import_topics_helper.rb &amp;lt;br&amp;gt;&lt;br /&gt;
Here, a new function 'trim_non_ascii' has been added which iterates a given string character by character, and replaces each non ascii character with a white space character. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  def self.define_attributes(row_hash)&lt;br /&gt;
    attributes = {}&lt;br /&gt;
    if !row_hash[:description].nil? and !row_hash[:description].ascii_only?&lt;br /&gt;
      row_hash[:description] = self.trim_non_ascii(row_hash[:description])&lt;br /&gt;
      puts row_hash[:description]&lt;br /&gt;
    end&lt;br /&gt;
    attributes[&amp;quot;topic_identifier&amp;quot;] = row_hash[:topic_identifier].strip&lt;br /&gt;
    attributes[&amp;quot;topic_name&amp;quot;] = row_hash[:topic_name].strip&lt;br /&gt;
    attributes[&amp;quot;max_choosers&amp;quot;] = row_hash[:max_choosers].strip&lt;br /&gt;
    attributes&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def self.trim_non_ascii(string)&lt;br /&gt;
    string.split('').each do |char|&lt;br /&gt;
      !char.ascii_only? ? string.tr!(char, ' ') : nil&lt;br /&gt;
    end&lt;br /&gt;
    string.gsub!(/\s+/, ' ')&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
=====Issue 328=====&lt;br /&gt;
&lt;br /&gt;
'''Problem''': When importing teams, and a conflict exists there is an option to merge the two teams by inserting the new members into an existing team.&lt;br /&gt;
&lt;br /&gt;
'''Solution''': This was an issue to fix the functionality of Insert any new members into existing team. This was due to faulty handling of the option handle_dups and incorrect checking of parameters.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Code was modified to ensure minimal impact to existing testcases and functionalities.&amp;lt;br&amp;gt;&lt;br /&gt;
The handling of handle_dups in options was done assuming that the parameter was a symbol. But when tested, it was found to be a string and hence the handling was updated accordingly.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
      name = handle_duplicate(team, name, id, options[&amp;quot;handle_dups&amp;quot;], teamtype)&lt;br /&gt;
Also, the if and else conditions for checking class type of used was wrong. This was updated based on how the variable was assigned in the '''import_file_controller.rb#import_from_hash'''&lt;br /&gt;
      if(teamtype.is_a?(CourseTeam.class))&lt;br /&gt;
          ...&lt;br /&gt;
      elsif  teamtype.is_a?(AssignmentTeam.class)&lt;br /&gt;
          ...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E1938_Before_D.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
After fixing changes&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Insert_new_in_old.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Issue 329=====&lt;br /&gt;
'''Problem''': When importing teams there are different options to handle conflicting team names as shown in the screenshot below. We’d like to add another option to rename EXISTING team when a conflict exist. Introduce an option to rename the existing team in import_file/start.html.erb, handle this option in import_file_controller.rb and team.rb→import.&lt;br /&gt;
&lt;br /&gt;
'''Solution''': This was a request to add an option to rename existing team if there was a conflict in the team name.&lt;br /&gt;
New code introduced was as follows:&amp;lt;br&amp;gt;&lt;br /&gt;
In '''start.html.erb'''&amp;lt;br&amp;gt;&lt;br /&gt;
In this file, the new option as displayed to the user is added&amp;lt;br&amp;gt;&lt;br /&gt;
          &amp;lt;option value=&amp;quot;rename_existing&amp;quot;&amp;gt;rename the existing team and import&amp;lt;/option&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In '''team.rb'''&amp;lt;br&amp;gt;&lt;br /&gt;
In this file, the handling of the new tag &amp;quot;rename_existing&amp;quot; is added wherein, the old team is updated with a new name.&amp;lt;br&amp;gt;&lt;br /&gt;
    # E1938: Added handling for renaming old team when conflict arises&lt;br /&gt;
    if handle_dups == &amp;quot;rename_existing&amp;quot;&lt;br /&gt;
      if teamtype.is_a?(CourseTeam.class)&lt;br /&gt;
        team.update(name: self.generate_team_name(Course.find(id).name))&lt;br /&gt;
      elsif  teamtype.is_a?(AssignmentTeam.class)&lt;br /&gt;
        team.update(name: self.generate_team_name(Assignment.find(id).name))&lt;br /&gt;
      end&lt;br /&gt;
      return name&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''The state of D before conflicting import''':&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E1938_Before_D_1.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
After fixing changes&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:After_D.PNG]]&lt;br /&gt;
[[File:After_old_team.PNG]]&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
As you can see the '''new team got the name D''' and the old file got renamed to '''Team_17'''.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Issue 153=====&lt;br /&gt;
'''Requirement''': There should be a way to import a list of who has signed up for which topic. When a signup sheet is used in Expertiza, users are expected to sign up for topics. But, the instructor might've taken signups offline, e.g., by passing around a signup sheet in class. There should be a way to import this list to Expertiza, rather than impersonate all the students one by one and sign them up for a topic. &lt;br /&gt;
&lt;br /&gt;
'''Solution''': We have modified the existing implementation for import topics to assign the teams to the topics. We have changed the files to handle another column where the teams have been assigned to topics. The column is optional because there might be topics that have not yet been assigned to any teams&lt;br /&gt;
&lt;br /&gt;
'''Expectations from the import file: &lt;br /&gt;
'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
* Assigned team name should exist in the system, otherwise the import will fail. Instructor has to make sure that the teams which are assigned in the import file should exist with same names in the system or database. &lt;br /&gt;
* Instructor also need to ensure that the topic for which the team is being assigned should not be full or can accommodate new team assignment to the respective topic. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''Code Changes:'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''import_file/_sign_up_topic.html.erb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
As there's already a screen with select options to map the columns with the fields for import. We are just adding another column so the best way is to extend the existing select tag with a new option for the teams assigned. All the select tags has been changed with an additional option &amp;quot;Assigned Team&amp;quot;. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
 &amp;lt;th&amp;gt;&lt;br /&gt;
            &amp;lt;select name=&amp;quot;select1&amp;quot; id=&amp;quot;select1&amp;quot; class=&amp;quot;form-control&amp;quot; style=&amp;quot;background-color:lightgrey&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;topic_identifier&amp;quot;&amp;gt;Topic Identifier (required)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;topic_name&amp;quot;&amp;gt;Topic Name (required)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;max_choosers&amp;quot;&amp;gt;Max Choosers (required)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;category&amp;quot;&amp;gt;Category (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;description&amp;quot;&amp;gt;Description (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;link&amp;quot;&amp;gt;Link (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;assigned_team&amp;quot;&amp;gt;Assigned Team (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
            &amp;lt;/select&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''model/sign_up_topic.rb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The existing import function in the model import the topics to the topic table. As per the requirement and validations, topic should be imported first and then only the team can be assigned to the topic. So the existing import method has been modified to assign the team once the topic is imported in the database table. As per the edge case mentioned in the requirement document that few topics may not have any team assigned to it, so we first check if topic has any team assigned, then only it tries to map the topic with the team. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
  def self.import(row_hash, session, _id = nil)&lt;br /&gt;
    if row_hash.length &amp;lt; 3&lt;br /&gt;
      raise ArgumentError, &amp;quot;The CSV File expects the format: Topic identifier, Topic name, Max choosers, Topic Category (optional), Topic Description (Optional), Topic Link (optional), Assigned Team Name (optional).&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
    topic = SignUpTopic.where(topic_name: row_hash[:topic_name], assignment_id: session[:assignment_id]).first&lt;br /&gt;
    if topic.nil?&lt;br /&gt;
      attributes = ImportTopicsHelper.define_attributes(row_hash)&lt;br /&gt;
      topic_new_id = ImportTopicsHelper.create_new_sign_up_topic(attributes, session)&lt;br /&gt;
      unless row_hash[:assigned_team].nil?&lt;br /&gt;
          team = Team.where(name: row_hash[:assigned_team]).first&lt;br /&gt;
          ImportTopicsHelper.assign_team_topic(topic_new_id, team.id)&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      topic.max_choosers = row_hash[:max_choosers]&lt;br /&gt;
      topic.topic_identifier = row_hash[:topic_identifier]&lt;br /&gt;
      topic.save&lt;br /&gt;
      unless row_hash[:assigned_team].nil?&lt;br /&gt;
        team = Team.where(name: row_hash[:assigned_team]).first&lt;br /&gt;
        newteam = SignedUpTeam.where(topic_id: topic.id, team_id: team.id).first&lt;br /&gt;
        if newteam.nil?&lt;br /&gt;
          ImportTopicsHelper.assign_team_topic(topic.id, team.id)&lt;br /&gt;
        else&lt;br /&gt;
          newteam.team_id = team.id&lt;br /&gt;
          newteam.save&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''helpers/import_topics_helper.rb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Having the assign_team_topic in the helper would organize the code but also in the unit testing. We can isolate the model logic and test this method separately by writing the test cases. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
  def self.assign_team_topic(topic_id, assigned_team)&lt;br /&gt;
    attributes = {}&lt;br /&gt;
    attributes[&amp;quot;topic_id&amp;quot;] = topic_id&lt;br /&gt;
    attributes[&amp;quot;team_id&amp;quot;] = assigned_team&lt;br /&gt;
    assign_team = SignedUpTeam.new(attributes)&lt;br /&gt;
    assign_team.save!&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
   def self.create_new_sign_up_topic(attributes, session)&lt;br /&gt;
     sign_up_topic = SignUpTopic.new(attributes)&lt;br /&gt;
     sign_up_topic.assignment_id = session[:assignment_id]&lt;br /&gt;
     sign_up_topic.save&lt;br /&gt;
     # sign_up_topic&lt;br /&gt;
     sign_up_topic.save!&lt;br /&gt;
     sign_up_topic.id&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''controllers/import_file_controller.rb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Existing implementation for import have many flaws and design issues. Most of the code has been written with nested if else, which is not the practice to be followed. Also the names of the fields have been hardcoded. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
As we cannot change the complete import implementation. So i had to use the existing one the way it is and make changes to extend the functionality. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    if (params[:assigned_team] == 'true')&lt;br /&gt;
        @optional_count += 1&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
    elsif params[:optional_count] == '4'&lt;br /&gt;
          new_header = [params[:select1], params[:select2], params[:select3], params[:select4], params[:select5], params[:select6], params[:select7]]&lt;br /&gt;
          @header_integrated_body = hash_rows_with_headers(new_header,contents_hash[:body])&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''views/sign_up_sheet/_add_topics.html.erb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
This code has been used to display the columns in the footer.As we already have implementation for other columns, so another column name 'Assigned Team' is added here in this part of the code. &lt;br /&gt;
        &amp;lt;%= link_to 'Import topics',&lt;br /&gt;
                {&lt;br /&gt;
                    :controller =&amp;gt; 'import_file',&lt;br /&gt;
                    :action =&amp;gt; 'start',&lt;br /&gt;
                    :model =&amp;gt; 'SignUpTopic',&lt;br /&gt;
                    :id =&amp;gt; params[:id],&lt;br /&gt;
                    :expected_fields =&amp;gt; 'Topic Identifier' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Name' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Max Choosers' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Category &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Description &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Link &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Assigned Team &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
An option column checkbox (Teams Assigned) has been added to the UI&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Issue153SS8.jpg]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
A new column Assigned Team is added where the columns are being mapped. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File: Issue153SS7.jpg]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Test Plan''' ==&lt;br /&gt;
*'''RSpec:'''&lt;br /&gt;
&lt;br /&gt;
::We have added new testcases for the new pieces of code that were added by us.&lt;br /&gt;
&lt;br /&gt;
::'''[Problem 3 (329)]'''&lt;br /&gt;
::::A new testcase was added to test this functionality. We use it to check if the older team gets the new name and the new team gets the requested name. This testcase runs when we run bundle exec for the '''teams_spec.rb'''&lt;br /&gt;
      # New team name should remain the same, the old one gets updated&lt;br /&gt;
      context 'when handle_dups option is rename_existing' do&lt;br /&gt;
        it 'returns new team name' do&lt;br /&gt;
          allow(Course).to receive(:find).with(1).and_return(double('Course', name: 'course 1'))&lt;br /&gt;
          allow(Team).to receive(:generate_team_name).with('course 1').and_return('new name of team')&lt;br /&gt;
          expect(Team.handle_duplicate(team, 'no name', 1, 'rename_existing', CourseTeam)).to eq('no name')&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
*'''UI Testing:'''&lt;br /&gt;
&lt;br /&gt;
::'''[Problem 1 (918)]'''&lt;br /&gt;
::::1. Login to Expertiza using username: instructor6 &amp;amp; password: password.&lt;br /&gt;
::::2. Go to Assignments and click on edit for any of the listed assignments.&lt;br /&gt;
::::3. Click on Topics tab.&lt;br /&gt;
::::4. Scroll down to the bottom of the page and click on Import topics.&lt;br /&gt;
::::5. Click on Topic Description checkbox and import the following file. (sample.csv)&amp;lt;br&amp;gt; [[File:918 sample.png]] &amp;lt;br&amp;gt;&lt;br /&gt;
::::[[File:918_p1.png]]&lt;br /&gt;
::::6. Click on next and make the header for 4th column as 'Description' from the dropdown.&lt;br /&gt;
::::[[File:918_p2.png]]&lt;br /&gt;
::::7. Import topics.&lt;br /&gt;
::::8. After this, a new topic should be imported which can be viewed from the aforementioned Topics tab. This newly imported topic will not have any non-ascii characters.&lt;br /&gt;
&lt;br /&gt;
::'''[Problem 3 (329)]'''&lt;br /&gt;
::::1. Login to Expertiza using username: instructor6 &amp;amp; password: password.&lt;br /&gt;
::::2. Select Manage &amp;gt; Courses or Assignments &amp;gt; Add Teams button &amp;gt; Import Team&lt;br /&gt;
::::3. In the screen that loads, select &amp;quot;rename the existing team and import&amp;quot; in the handle conflicts section.&lt;br /&gt;
::::4. Upload a file with the team details and select the appropriate delimiter.&lt;br /&gt;
::::5. Click on Create&lt;br /&gt;
::::6. Verify that the new team got created with the assigned name and the older team's name got changed.&lt;br /&gt;
&lt;br /&gt;
::'''[Problem 4 (328)]'''&lt;br /&gt;
::::1. Login to Expertiza using username: instructor6 &amp;amp; password: password.&lt;br /&gt;
::::2. Select Manage &amp;gt; Courses or Assignments &amp;gt; Add Teams button &amp;gt; Import Team&lt;br /&gt;
::::3. In the screen that loads, select &amp;quot;Insert any new members into existing team&amp;quot; in the handle conflicts section.&lt;br /&gt;
::::4. Upload a file with the team details and select the appropriate delimiter.&lt;br /&gt;
::::5. Click on Create&lt;br /&gt;
::::6. Verify that the existing team got updated with the new team members&lt;br /&gt;
&lt;br /&gt;
== '''Possible Enhancements''' ==&lt;br /&gt;
&lt;br /&gt;
====='''Import functionality'''=====&lt;br /&gt;
&lt;br /&gt;
The existing import implementation does not follow DRY principle, rails code practices and even basic design principles. Most of the code is written based with nested if else conditions. This implementation can be improved. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Exception Handling: Before starting to work on this requirement. I tried few imports and in many cases, import was not successful and i was not able to figure out what's going wrong. My suggestion would be to develop a screen to show which rows were successfully imported and the failure reason which didn't. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Also, if there's no team in the system and instructor has used it in the import file so a new pop up can be displayed where the new team can be created or the import can be extended to create teams while assigning the topic. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1. Expertiza on GITHUB: https://github.com/expertiza/expertiza&lt;br /&gt;
&lt;br /&gt;
2. GitHub Project Repository Fork: https://github.com/NisargC/expertiza&lt;br /&gt;
&lt;br /&gt;
3. Demo link: http://152.46.19.138:8080/&lt;br /&gt;
&lt;br /&gt;
4. Expertiza project documentation wiki: http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2019_-_E1938._OSS_project_Duke_Blue:_Fix_import_glitches&lt;/div&gt;</summary>
		<author><name>Nmchoks2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1938._OSS_project_Duke_Blue:_Fix_import_glitches&amp;diff=127516</id>
		<title>CSC/ECE 517 Fall 2019 - E1938. OSS project Duke Blue: Fix import glitches</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1938._OSS_project_Duke_Blue:_Fix_import_glitches&amp;diff=127516"/>
		<updated>2019-11-06T23:21:52Z</updated>

		<summary type="html">&lt;p&gt;Nmchoks2: /* Issue 329 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
== '''About Expertiza''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source project based on Ruby on Rails framework and the code is available on Github. Expertiza allows the instructor to create new assignments as well as edit new or existing assignments. Instructors can also create a list of topics the students can sign up for and specify deadlines for completion of various tasks. Students can form teams in Expertiza to work on various projects and assignments as well as peer review other students' submissions. Expertiza supports submission across various document types, including the URLs Wiki pages.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
The import feature is the most helpful feature for instructors to set up assignments. The instructors usually have a list of students, teams, etc from their learning management system. Being able to import these into expertiza saves a lot of time when setting up an assignment. Unfortunately this feature has some bugs that were identified as the following list. &lt;br /&gt;
&lt;br /&gt;
'''Issue 918''': It seems that non-ASCII characters in the description (e.g., a curly apostrophe, and perhaps also an en-dash) caused a SQL error in inserting the description string into the db. I had to edit the import file to remove non-ASCII characters. Any Unicode character ought to be allowed in a description. &lt;br /&gt;
&lt;br /&gt;
'''Issue 153''': There should be a way to import a list of who has signed up for which topic. When a signup sheet is used in Expertiza, users are expected to sign up for topics. But, the instructor might've taken signups offline, e.g., by passing around a signup sheet in class. There should be a way to import this list to Expertiza, rather than impersonate all the students one by one and sign them up for a topic. '''This issue is not a bug but an additional feature to the existing import topic functionality.'''&lt;br /&gt;
&lt;br /&gt;
'''Issue 329''': When importing teams there are different options to handle conflicting team names &lt;br /&gt;
&lt;br /&gt;
'''Issue 328''': When importing teams, and a conflict exists there is an option to merge the two teams by inserting the new members into an existing team. Unfortunately, this feature is broken. we tried to import a team and selected 'Insert any new members into existing team'. No new team members were in fact inserted into the team&lt;br /&gt;
&lt;br /&gt;
== '''Fixes''' ==&lt;br /&gt;
=====Issue 918=====&lt;br /&gt;
&lt;br /&gt;
'''Problem:''' The application is not able to import topics with non ascii characters in its description field. &amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' Before the topic object is persisted into the database, check for any non ascii characters in the description field and strip them. &amp;lt;br&amp;gt;&lt;br /&gt;
'''Code Changes'''&amp;lt;br&amp;gt;&lt;br /&gt;
New code introduced is as follows.&amp;lt;br&amp;gt;&lt;br /&gt;
File:app/helpers/import_topics_helper.rb &amp;lt;br&amp;gt;&lt;br /&gt;
Here, a new function 'trim_non_ascii' has been added which iterates a given string character by character, and replaces each non ascii character with a white space character. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  def self.define_attributes(row_hash)&lt;br /&gt;
    attributes = {}&lt;br /&gt;
    if !row_hash[:description].nil? and !row_hash[:description].ascii_only?&lt;br /&gt;
      row_hash[:description] = self.trim_non_ascii(row_hash[:description])&lt;br /&gt;
      puts row_hash[:description]&lt;br /&gt;
    end&lt;br /&gt;
    attributes[&amp;quot;topic_identifier&amp;quot;] = row_hash[:topic_identifier].strip&lt;br /&gt;
    attributes[&amp;quot;topic_name&amp;quot;] = row_hash[:topic_name].strip&lt;br /&gt;
    attributes[&amp;quot;max_choosers&amp;quot;] = row_hash[:max_choosers].strip&lt;br /&gt;
    attributes&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def self.trim_non_ascii(string)&lt;br /&gt;
    string.split('').each do |char|&lt;br /&gt;
      !char.ascii_only? ? string.tr!(char, ' ') : nil&lt;br /&gt;
    end&lt;br /&gt;
    string.gsub!(/\s+/, ' ')&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
=====Issue 328=====&lt;br /&gt;
&lt;br /&gt;
'''Problem''': When importing teams, and a conflict exists there is an option to merge the two teams by inserting the new members into an existing team.&lt;br /&gt;
&lt;br /&gt;
'''Solution''': This was an issue to fix the functionality of Insert any new members into existing team. This was due to faulty handling of the option handle_dups and incorrect checking of parameters.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Code was modified to ensure minimal impact to existing testcases and functionalities.&amp;lt;br&amp;gt;&lt;br /&gt;
The handling of handle_dups in options was done assuming that the parameter was a symbol. But when tested, it was found to be a string and hence the handling was updated accordingly.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
      name = handle_duplicate(team, name, id, options[&amp;quot;handle_dups&amp;quot;], teamtype)&lt;br /&gt;
Also, the if and else conditions for checking class type of used was wrong. This was updated based on how the variable was assigned in the '''import_file_controller.rb#import_from_hash'''&lt;br /&gt;
      if(teamtype.is_a?(CourseTeam.class))&lt;br /&gt;
          ...&lt;br /&gt;
      elsif  teamtype.is_a?(AssignmentTeam.class)&lt;br /&gt;
          ...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E1938_Before_D.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
After fixing changes&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Insert_new_in_old.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Issue 329=====&lt;br /&gt;
'''Problem''': When importing teams there are different options to handle conflicting team names as shown in the screenshot below. We’d like to add another option to rename EXISTING team when a conflict exist. Introduce an option to rename the existing team in import_file/start.html.erb, handle this option in import_file_controller.rb and team.rb→import.&lt;br /&gt;
&lt;br /&gt;
'''Solution''': This was a request to add an option to rename existing team if there was a conflict in the team name.&lt;br /&gt;
New code introduced was as follows:&amp;lt;br&amp;gt;&lt;br /&gt;
In '''start.html.erb'''&amp;lt;br&amp;gt;&lt;br /&gt;
In this file, the new option as displayed to the user is added&amp;lt;br&amp;gt;&lt;br /&gt;
          &amp;lt;option value=&amp;quot;rename_existing&amp;quot;&amp;gt;rename the existing team and import&amp;lt;/option&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In '''team.rb'''&amp;lt;br&amp;gt;&lt;br /&gt;
In this file, the handling of the new tag &amp;quot;rename_existing&amp;quot; is added wherein, the old team is updated with a new name.&amp;lt;br&amp;gt;&lt;br /&gt;
    # E1938: Added handling for renaming old team when conflict arises&lt;br /&gt;
    if handle_dups == &amp;quot;rename_existing&amp;quot;&lt;br /&gt;
      if teamtype.is_a?(CourseTeam.class)&lt;br /&gt;
        team.update(name: self.generate_team_name(Course.find(id).name))&lt;br /&gt;
      elsif  teamtype.is_a?(AssignmentTeam.class)&lt;br /&gt;
        team.update(name: self.generate_team_name(Assignment.find(id).name))&lt;br /&gt;
      end&lt;br /&gt;
      return name&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The state of D before conflicting import:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E1938_Before_D_1.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
After fixing changes&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:After_D.PNG]]&lt;br /&gt;
[[File:After_old_team.PNG]]&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
As you can see the new team got the name D and the old file got renamed to Team_17.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Issue 153=====&lt;br /&gt;
'''Requirement''': There should be a way to import a list of who has signed up for which topic. When a signup sheet is used in Expertiza, users are expected to sign up for topics. But, the instructor might've taken signups offline, e.g., by passing around a signup sheet in class. There should be a way to import this list to Expertiza, rather than impersonate all the students one by one and sign them up for a topic. &lt;br /&gt;
&lt;br /&gt;
'''Solution''': We have modified the existing implementation for import topics to assign the teams to the topics. We have changed the files to handle another column where the teams have been assigned to topics. The column is optional because there might be topics that have not yet been assigned to any teams&lt;br /&gt;
&lt;br /&gt;
'''Expectations from the import file: &lt;br /&gt;
'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
* Assigned team name should exist in the system, otherwise the import will fail. Instructor has to make sure that the teams which are assigned in the import file should exist with same names in the system or database. &lt;br /&gt;
* Instructor also need to ensure that the topic for which the team is being assigned should not be full or can accommodate new team assignment to the respective topic. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''Code Changes:'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''import_file/_sign_up_topic.html.erb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
As there's already a screen with select options to map the columns with the fields for import. We are just adding another column so the best way is to extend the existing select tag with a new option for the teams assigned. All the select tags has been changed with an additional option &amp;quot;Assigned Team&amp;quot;. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
 &amp;lt;th&amp;gt;&lt;br /&gt;
            &amp;lt;select name=&amp;quot;select1&amp;quot; id=&amp;quot;select1&amp;quot; class=&amp;quot;form-control&amp;quot; style=&amp;quot;background-color:lightgrey&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;topic_identifier&amp;quot;&amp;gt;Topic Identifier (required)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;topic_name&amp;quot;&amp;gt;Topic Name (required)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;max_choosers&amp;quot;&amp;gt;Max Choosers (required)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;category&amp;quot;&amp;gt;Category (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;description&amp;quot;&amp;gt;Description (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;link&amp;quot;&amp;gt;Link (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;assigned_team&amp;quot;&amp;gt;Assigned Team (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
            &amp;lt;/select&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''model/sign_up_topic.rb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The existing import function in the model import the topics to the topic table. As per the requirement and validations, topic should be imported first and then only the team can be assigned to the topic. So the existing import method has been modified to assign the team once the topic is imported in the database table. As per the edge case mentioned in the requirement document that few topics may not have any team assigned to it, so we first check if topic has any team assigned, then only it tries to map the topic with the team. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
  def self.import(row_hash, session, _id = nil)&lt;br /&gt;
    if row_hash.length &amp;lt; 3&lt;br /&gt;
      raise ArgumentError, &amp;quot;The CSV File expects the format: Topic identifier, Topic name, Max choosers, Topic Category (optional), Topic Description (Optional), Topic Link (optional), Assigned Team Name (optional).&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
    topic = SignUpTopic.where(topic_name: row_hash[:topic_name], assignment_id: session[:assignment_id]).first&lt;br /&gt;
    if topic.nil?&lt;br /&gt;
      attributes = ImportTopicsHelper.define_attributes(row_hash)&lt;br /&gt;
      topic_new_id = ImportTopicsHelper.create_new_sign_up_topic(attributes, session)&lt;br /&gt;
      unless row_hash[:assigned_team].nil?&lt;br /&gt;
          team = Team.where(name: row_hash[:assigned_team]).first&lt;br /&gt;
          ImportTopicsHelper.assign_team_topic(topic_new_id, team.id)&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      topic.max_choosers = row_hash[:max_choosers]&lt;br /&gt;
      topic.topic_identifier = row_hash[:topic_identifier]&lt;br /&gt;
      topic.save&lt;br /&gt;
      unless row_hash[:assigned_team].nil?&lt;br /&gt;
        team = Team.where(name: row_hash[:assigned_team]).first&lt;br /&gt;
        newteam = SignedUpTeam.where(topic_id: topic.id, team_id: team.id).first&lt;br /&gt;
        if newteam.nil?&lt;br /&gt;
          ImportTopicsHelper.assign_team_topic(topic.id, team.id)&lt;br /&gt;
        else&lt;br /&gt;
          newteam.team_id = team.id&lt;br /&gt;
          newteam.save&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''helpers/import_topics_helper.rb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Having the assign_team_topic in the helper would organize the code but also in the unit testing. We can isolate the model logic and test this method separately by writing the test cases. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
  def self.assign_team_topic(topic_id, assigned_team)&lt;br /&gt;
    attributes = {}&lt;br /&gt;
    attributes[&amp;quot;topic_id&amp;quot;] = topic_id&lt;br /&gt;
    attributes[&amp;quot;team_id&amp;quot;] = assigned_team&lt;br /&gt;
    assign_team = SignedUpTeam.new(attributes)&lt;br /&gt;
    assign_team.save!&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
   def self.create_new_sign_up_topic(attributes, session)&lt;br /&gt;
     sign_up_topic = SignUpTopic.new(attributes)&lt;br /&gt;
     sign_up_topic.assignment_id = session[:assignment_id]&lt;br /&gt;
     sign_up_topic.save&lt;br /&gt;
     # sign_up_topic&lt;br /&gt;
     sign_up_topic.save!&lt;br /&gt;
     sign_up_topic.id&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''controllers/import_file_controller.rb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Existing implementation for import have many flaws and design issues. Most of the code has been written with nested if else, which is not the practice to be followed. Also the names of the fields have been hardcoded. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
As we cannot change the complete import implementation. So i had to use the existing one the way it is and make changes to extend the functionality. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    if (params[:assigned_team] == 'true')&lt;br /&gt;
        @optional_count += 1&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
    elsif params[:optional_count] == '4'&lt;br /&gt;
          new_header = [params[:select1], params[:select2], params[:select3], params[:select4], params[:select5], params[:select6], params[:select7]]&lt;br /&gt;
          @header_integrated_body = hash_rows_with_headers(new_header,contents_hash[:body])&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''views/sign_up_sheet/_add_topics.html.erb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
This code has been used to display the columns in the footer.As we already have implementation for other columns, so another column name 'Assigned Team' is added here in this part of the code. &lt;br /&gt;
        &amp;lt;%= link_to 'Import topics',&lt;br /&gt;
                {&lt;br /&gt;
                    :controller =&amp;gt; 'import_file',&lt;br /&gt;
                    :action =&amp;gt; 'start',&lt;br /&gt;
                    :model =&amp;gt; 'SignUpTopic',&lt;br /&gt;
                    :id =&amp;gt; params[:id],&lt;br /&gt;
                    :expected_fields =&amp;gt; 'Topic Identifier' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Name' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Max Choosers' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Category &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Description &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Link &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Assigned Team &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
An option column checkbox (Teams Assigned) has been added to the UI&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Issue153SS8.jpg]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
A new column Assigned Team is added where the columns are being mapped. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File: Issue153SS7.jpg]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Test Plan''' ==&lt;br /&gt;
*'''RSpec:'''&lt;br /&gt;
&lt;br /&gt;
::We have added new testcases for the new pieces of code that were added by us.&lt;br /&gt;
&lt;br /&gt;
::'''[Problem 3 (329)]'''&lt;br /&gt;
::::A new testcase was added to test this functionality. We use it to check if the older team gets the new name and the new team gets the requested name. This testcase runs when we run bundle exec for the '''teams_spec.rb'''&lt;br /&gt;
      # New team name should remain the same, the old one gets updated&lt;br /&gt;
      context 'when handle_dups option is rename_existing' do&lt;br /&gt;
        it 'returns new team name' do&lt;br /&gt;
          allow(Course).to receive(:find).with(1).and_return(double('Course', name: 'course 1'))&lt;br /&gt;
          allow(Team).to receive(:generate_team_name).with('course 1').and_return('new name of team')&lt;br /&gt;
          expect(Team.handle_duplicate(team, 'no name', 1, 'rename_existing', CourseTeam)).to eq('no name')&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
*'''UI Testing:'''&lt;br /&gt;
&lt;br /&gt;
::'''[Problem 1 (918)]'''&lt;br /&gt;
::::1. Login to Expertiza using username: instructor6 &amp;amp; password: password.&lt;br /&gt;
::::2. Go to Assignments and click on edit for any of the listed assignments.&lt;br /&gt;
::::3. Click on Topics tab.&lt;br /&gt;
::::4. Scroll down to the bottom of the page and click on Import topics.&lt;br /&gt;
::::5. Click on Topic Description checkbox and import the following file. (sample.csv)&amp;lt;br&amp;gt; [[File:918 sample.png]]&lt;br /&gt;
::::[[File:918_p1.png]]&lt;br /&gt;
::::6. Click on next and make the header for 4th column as 'Description' from the dropdown.&lt;br /&gt;
::::[[File:918_p2.png]]&lt;br /&gt;
::::7. Import topics.&lt;br /&gt;
::::8. After this, a new topic should be imported which can be viewed from the aforementioned Topics tab. This newly imported topic will not have any non-ascii characters.&lt;br /&gt;
&lt;br /&gt;
::'''[Problem 3 (329)]'''&lt;br /&gt;
::::1. Login to Expertiza using username: instructor6 &amp;amp; password: password.&lt;br /&gt;
::::2. Select Manage &amp;gt; Courses or Assignments &amp;gt; Add Teams button &amp;gt; Import Team&lt;br /&gt;
::::3. In the screen that loads, select &amp;quot;rename the existing team and import&amp;quot; in the handle conflicts section.&lt;br /&gt;
::::4. Upload a file with the team details and select the appropriate delimiter.&lt;br /&gt;
::::5. Click on Create&lt;br /&gt;
::::6. Verify that the new team got created with the assigned name and the older team's name got changed.&lt;br /&gt;
&lt;br /&gt;
::'''[Problem 4 (328)]'''&lt;br /&gt;
::::1. Login to Expertiza using username: instructor6 &amp;amp; password: password.&lt;br /&gt;
::::2. Select Manage &amp;gt; Courses or Assignments &amp;gt; Add Teams button &amp;gt; Import Team&lt;br /&gt;
::::3. In the screen that loads, select &amp;quot;Insert any new members into existing team&amp;quot; in the handle conflicts section.&lt;br /&gt;
::::4. Upload a file with the team details and select the appropriate delimiter.&lt;br /&gt;
::::5. Click on Create&lt;br /&gt;
::::6. Verify that the existing team got updated with the new team members&lt;br /&gt;
&lt;br /&gt;
== '''Possible Enhancements''' ==&lt;br /&gt;
&lt;br /&gt;
====='''Import functionality'''=====&lt;br /&gt;
&lt;br /&gt;
The existing import implementation does not follow DRY principle, rails code practices and even basic design principles. Most of the code is written based with nested if else conditions. This implementation can be improved. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Exception Handling: Before starting to work on this requirement. I tried few imports and in many cases, import was not successful and i was not able to figure out what's going wrong. My suggestion would be to develop a screen to show which rows were successfully imported and the failure reason which didn't. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Also, if there's no team in the system and instructor has used it in the import file so a new pop up can be displayed where the new team can be created or the import can be extended to create teams while assigning the topic. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1. Expertiza on GITHUB: https://github.com/expertiza/expertiza&lt;br /&gt;
&lt;br /&gt;
2. GitHub Project Repository Fork: https://github.com/NisargC/expertiza&lt;br /&gt;
&lt;br /&gt;
3. Demo link: http://152.46.19.138:8080/&lt;br /&gt;
&lt;br /&gt;
4. Expertiza project documentation wiki: http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2019_-_E1938._OSS_project_Duke_Blue:_Fix_import_glitches&lt;/div&gt;</summary>
		<author><name>Nmchoks2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1938._OSS_project_Duke_Blue:_Fix_import_glitches&amp;diff=127512</id>
		<title>CSC/ECE 517 Fall 2019 - E1938. OSS project Duke Blue: Fix import glitches</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1938._OSS_project_Duke_Blue:_Fix_import_glitches&amp;diff=127512"/>
		<updated>2019-11-06T23:20:01Z</updated>

		<summary type="html">&lt;p&gt;Nmchoks2: /* Issue 329 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
== '''About Expertiza''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source project based on Ruby on Rails framework and the code is available on Github. Expertiza allows the instructor to create new assignments as well as edit new or existing assignments. Instructors can also create a list of topics the students can sign up for and specify deadlines for completion of various tasks. Students can form teams in Expertiza to work on various projects and assignments as well as peer review other students' submissions. Expertiza supports submission across various document types, including the URLs Wiki pages.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
The import feature is the most helpful feature for instructors to set up assignments. The instructors usually have a list of students, teams, etc from their learning management system. Being able to import these into expertiza saves a lot of time when setting up an assignment. Unfortunately this feature has some bugs that were identified as the following list. &lt;br /&gt;
&lt;br /&gt;
'''Issue 918''': It seems that non-ASCII characters in the description (e.g., a curly apostrophe, and perhaps also an en-dash) caused a SQL error in inserting the description string into the db. I had to edit the import file to remove non-ASCII characters. Any Unicode character ought to be allowed in a description. &lt;br /&gt;
&lt;br /&gt;
'''Issue 153''': There should be a way to import a list of who has signed up for which topic. When a signup sheet is used in Expertiza, users are expected to sign up for topics. But, the instructor might've taken signups offline, e.g., by passing around a signup sheet in class. There should be a way to import this list to Expertiza, rather than impersonate all the students one by one and sign them up for a topic. '''This issue is not a bug but an additional feature to the existing import topic functionality.'''&lt;br /&gt;
&lt;br /&gt;
'''Issue 329''': When importing teams there are different options to handle conflicting team names &lt;br /&gt;
&lt;br /&gt;
'''Issue 328''': When importing teams, and a conflict exists there is an option to merge the two teams by inserting the new members into an existing team. Unfortunately, this feature is broken. we tried to import a team and selected 'Insert any new members into existing team'. No new team members were in fact inserted into the team&lt;br /&gt;
&lt;br /&gt;
== '''Fixes''' ==&lt;br /&gt;
=====Issue 918=====&lt;br /&gt;
&lt;br /&gt;
'''Problem:''' The application is not able to import topics with non ascii characters in its description field. &amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' Before the topic object is persisted into the database, check for any non ascii characters in the description field and strip them. &amp;lt;br&amp;gt;&lt;br /&gt;
'''Code Changes'''&amp;lt;br&amp;gt;&lt;br /&gt;
New code introduced is as follows.&amp;lt;br&amp;gt;&lt;br /&gt;
File:app/helpers/import_topics_helper.rb &amp;lt;br&amp;gt;&lt;br /&gt;
Here, a new function 'trim_non_ascii' has been added which iterates a given string character by character, and replaces each non ascii character with a white space character. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  def self.define_attributes(row_hash)&lt;br /&gt;
    attributes = {}&lt;br /&gt;
    if !row_hash[:description].nil? and !row_hash[:description].ascii_only?&lt;br /&gt;
      row_hash[:description] = self.trim_non_ascii(row_hash[:description])&lt;br /&gt;
      puts row_hash[:description]&lt;br /&gt;
    end&lt;br /&gt;
    attributes[&amp;quot;topic_identifier&amp;quot;] = row_hash[:topic_identifier].strip&lt;br /&gt;
    attributes[&amp;quot;topic_name&amp;quot;] = row_hash[:topic_name].strip&lt;br /&gt;
    attributes[&amp;quot;max_choosers&amp;quot;] = row_hash[:max_choosers].strip&lt;br /&gt;
    attributes&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def self.trim_non_ascii(string)&lt;br /&gt;
    string.split('').each do |char|&lt;br /&gt;
      !char.ascii_only? ? string.tr!(char, ' ') : nil&lt;br /&gt;
    end&lt;br /&gt;
    string.gsub!(/\s+/, ' ')&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
=====Issue 328=====&lt;br /&gt;
&lt;br /&gt;
'''Problem''': When importing teams, and a conflict exists there is an option to merge the two teams by inserting the new members into an existing team.&lt;br /&gt;
&lt;br /&gt;
'''Solution''': This was an issue to fix the functionality of Insert any new members into existing team. This was due to faulty handling of the option handle_dups and incorrect checking of parameters.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Code was modified to ensure minimal impact to existing testcases and functionalities.&amp;lt;br&amp;gt;&lt;br /&gt;
The handling of handle_dups in options was done assuming that the parameter was a symbol. But when tested, it was found to be a string and hence the handling was updated accordingly.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
      name = handle_duplicate(team, name, id, options[&amp;quot;handle_dups&amp;quot;], teamtype)&lt;br /&gt;
Also, the if and else conditions for checking class type of used was wrong. This was updated based on how the variable was assigned in the '''import_file_controller.rb#import_from_hash'''&lt;br /&gt;
      if(teamtype.is_a?(CourseTeam.class))&lt;br /&gt;
          ...&lt;br /&gt;
      elsif  teamtype.is_a?(AssignmentTeam.class)&lt;br /&gt;
          ...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E1938_Before_D.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
After fixing changes&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Insert_new_in_old.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Issue 329=====&lt;br /&gt;
'''Problem''': When importing teams, and a conflict exists there is an option to merge the two teams by inserting the new members into an existing team.&lt;br /&gt;
&lt;br /&gt;
'''Solution''': This was an issue to fix the functionality of Insert any new members into existing team. This was due to faulty handling of the option handle_dups and incorrect checking of parameters.&lt;br /&gt;
This was a request to add an option to rename existing team if there was a conflict in the team name.&amp;lt;br&amp;gt;&lt;br /&gt;
New code introduced was as follows:&amp;lt;br&amp;gt;&lt;br /&gt;
In start.html.erb&amp;lt;br&amp;gt;&lt;br /&gt;
In this file, the new option as displayed to the user is added&amp;lt;br&amp;gt;&lt;br /&gt;
          &amp;lt;option value=&amp;quot;rename_existing&amp;quot;&amp;gt;rename the existing team and import&amp;lt;/option&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In '''team.rb'''&amp;lt;br&amp;gt;&lt;br /&gt;
In this file, the handling of the new tag &amp;quot;rename_existing&amp;quot; is added wherein, the old team is updated with a new name.&amp;lt;br&amp;gt;&lt;br /&gt;
    # E1938: Added handling for renaming old team when conflict arises&lt;br /&gt;
    if handle_dups == &amp;quot;rename_existing&amp;quot;&lt;br /&gt;
      if teamtype.is_a?(CourseTeam.class)&lt;br /&gt;
        team.update(name: self.generate_team_name(Course.find(id).name))&lt;br /&gt;
      elsif  teamtype.is_a?(AssignmentTeam.class)&lt;br /&gt;
        team.update(name: self.generate_team_name(Assignment.find(id).name))&lt;br /&gt;
      end&lt;br /&gt;
      return name&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The state of D before conflicting import:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E1938_Before_D_1.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
After fixing changes&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:After_D.PNG]]&lt;br /&gt;
[[File:After_old_team.PNG]]&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
As you can see the new team got the name D and the old file got renamed to Team_17.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Issue 153=====&lt;br /&gt;
'''Requirement''': There should be a way to import a list of who has signed up for which topic. When a signup sheet is used in Expertiza, users are expected to sign up for topics. But, the instructor might've taken signups offline, e.g., by passing around a signup sheet in class. There should be a way to import this list to Expertiza, rather than impersonate all the students one by one and sign them up for a topic. &lt;br /&gt;
&lt;br /&gt;
'''Solution''': We have modified the existing implementation for import topics to assign the teams to the topics. We have changed the files to handle another column where the teams have been assigned to topics. The column is optional because there might be topics that have not yet been assigned to any teams&lt;br /&gt;
&lt;br /&gt;
'''Expectations from the import file: &lt;br /&gt;
'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
* Assigned team name should exist in the system, otherwise the import will fail. Instructor has to make sure that the teams which are assigned in the import file should exist with same names in the system or database. &lt;br /&gt;
* Instructor also need to ensure that the topic for which the team is being assigned should not be full or can accommodate new team assignment to the respective topic. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''Code Changes:'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''import_file/_sign_up_topic.html.erb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
As there's already a screen with select options to map the columns with the fields for import. We are just adding another column so the best way is to extend the existing select tag with a new option for the teams assigned. All the select tags has been changed with an additional option &amp;quot;Assigned Team&amp;quot;. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
 &amp;lt;th&amp;gt;&lt;br /&gt;
            &amp;lt;select name=&amp;quot;select1&amp;quot; id=&amp;quot;select1&amp;quot; class=&amp;quot;form-control&amp;quot; style=&amp;quot;background-color:lightgrey&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;topic_identifier&amp;quot;&amp;gt;Topic Identifier (required)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;topic_name&amp;quot;&amp;gt;Topic Name (required)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;max_choosers&amp;quot;&amp;gt;Max Choosers (required)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;category&amp;quot;&amp;gt;Category (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;description&amp;quot;&amp;gt;Description (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;link&amp;quot;&amp;gt;Link (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;assigned_team&amp;quot;&amp;gt;Assigned Team (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
            &amp;lt;/select&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''model/sign_up_topic.rb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The existing import function in the model import the topics to the topic table. As per the requirement and validations, topic should be imported first and then only the team can be assigned to the topic. So the existing import method has been modified to assign the team once the topic is imported in the database table. As per the edge case mentioned in the requirement document that few topics may not have any team assigned to it, so we first check if topic has any team assigned, then only it tries to map the topic with the team. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
  def self.import(row_hash, session, _id = nil)&lt;br /&gt;
    if row_hash.length &amp;lt; 3&lt;br /&gt;
      raise ArgumentError, &amp;quot;The CSV File expects the format: Topic identifier, Topic name, Max choosers, Topic Category (optional), Topic Description (Optional), Topic Link (optional), Assigned Team Name (optional).&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
    topic = SignUpTopic.where(topic_name: row_hash[:topic_name], assignment_id: session[:assignment_id]).first&lt;br /&gt;
    if topic.nil?&lt;br /&gt;
      attributes = ImportTopicsHelper.define_attributes(row_hash)&lt;br /&gt;
      topic_new_id = ImportTopicsHelper.create_new_sign_up_topic(attributes, session)&lt;br /&gt;
      unless row_hash[:assigned_team].nil?&lt;br /&gt;
          team = Team.where(name: row_hash[:assigned_team]).first&lt;br /&gt;
          ImportTopicsHelper.assign_team_topic(topic_new_id, team.id)&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      topic.max_choosers = row_hash[:max_choosers]&lt;br /&gt;
      topic.topic_identifier = row_hash[:topic_identifier]&lt;br /&gt;
      topic.save&lt;br /&gt;
      unless row_hash[:assigned_team].nil?&lt;br /&gt;
        team = Team.where(name: row_hash[:assigned_team]).first&lt;br /&gt;
        newteam = SignedUpTeam.where(topic_id: topic.id, team_id: team.id).first&lt;br /&gt;
        if newteam.nil?&lt;br /&gt;
          ImportTopicsHelper.assign_team_topic(topic.id, team.id)&lt;br /&gt;
        else&lt;br /&gt;
          newteam.team_id = team.id&lt;br /&gt;
          newteam.save&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''helpers/import_topics_helper.rb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Having the assign_team_topic in the helper would organize the code but also in the unit testing. We can isolate the model logic and test this method separately by writing the test cases. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
  def self.assign_team_topic(topic_id, assigned_team)&lt;br /&gt;
    attributes = {}&lt;br /&gt;
    attributes[&amp;quot;topic_id&amp;quot;] = topic_id&lt;br /&gt;
    attributes[&amp;quot;team_id&amp;quot;] = assigned_team&lt;br /&gt;
    assign_team = SignedUpTeam.new(attributes)&lt;br /&gt;
    assign_team.save!&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
   def self.create_new_sign_up_topic(attributes, session)&lt;br /&gt;
     sign_up_topic = SignUpTopic.new(attributes)&lt;br /&gt;
     sign_up_topic.assignment_id = session[:assignment_id]&lt;br /&gt;
     sign_up_topic.save&lt;br /&gt;
     # sign_up_topic&lt;br /&gt;
     sign_up_topic.save!&lt;br /&gt;
     sign_up_topic.id&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''controllers/import_file_controller.rb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Existing implementation for import have many flaws and design issues. Most of the code has been written with nested if else, which is not the practice to be followed. Also the names of the fields have been hardcoded. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
As we cannot change the complete import implementation. So i had to use the existing one the way it is and make changes to extend the functionality. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    if (params[:assigned_team] == 'true')&lt;br /&gt;
        @optional_count += 1&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
    elsif params[:optional_count] == '4'&lt;br /&gt;
          new_header = [params[:select1], params[:select2], params[:select3], params[:select4], params[:select5], params[:select6], params[:select7]]&lt;br /&gt;
          @header_integrated_body = hash_rows_with_headers(new_header,contents_hash[:body])&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''views/sign_up_sheet/_add_topics.html.erb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
This code has been used to display the columns in the footer.As we already have implementation for other columns, so another column name 'Assigned Team' is added here in this part of the code. &lt;br /&gt;
        &amp;lt;%= link_to 'Import topics',&lt;br /&gt;
                {&lt;br /&gt;
                    :controller =&amp;gt; 'import_file',&lt;br /&gt;
                    :action =&amp;gt; 'start',&lt;br /&gt;
                    :model =&amp;gt; 'SignUpTopic',&lt;br /&gt;
                    :id =&amp;gt; params[:id],&lt;br /&gt;
                    :expected_fields =&amp;gt; 'Topic Identifier' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Name' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Max Choosers' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Category &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Description &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Link &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Assigned Team &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
An option column checkbox (Teams Assigned) has been added to the UI&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Issue153SS8.jpg]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
A new column Assigned Team is added where the columns are being mapped. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File: Issue153SS7.jpg]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Test Plan''' ==&lt;br /&gt;
*'''RSpec:'''&lt;br /&gt;
&lt;br /&gt;
::We have added new testcases for the new pieces of code that were added by us.&lt;br /&gt;
&lt;br /&gt;
::'''[Problem 3 (329)]'''&lt;br /&gt;
::::A new testcase was added to test this functionality. We use it to check if the older team gets the new name and the new team gets the requested name. This testcase runs when we run bundle exec for the '''teams_spec.rb'''&lt;br /&gt;
      # New team name should remain the same, the old one gets updated&lt;br /&gt;
      context 'when handle_dups option is rename_existing' do&lt;br /&gt;
        it 'returns new team name' do&lt;br /&gt;
          allow(Course).to receive(:find).with(1).and_return(double('Course', name: 'course 1'))&lt;br /&gt;
          allow(Team).to receive(:generate_team_name).with('course 1').and_return('new name of team')&lt;br /&gt;
          expect(Team.handle_duplicate(team, 'no name', 1, 'rename_existing', CourseTeam)).to eq('no name')&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
*'''UI Testing:'''&lt;br /&gt;
&lt;br /&gt;
::'''[Problem 1 (918)]'''&lt;br /&gt;
::::1. Login to Expertiza using username: instructor6 &amp;amp; password: password.&lt;br /&gt;
::::2. Go to Assignments and click on edit for any of the listed assignments.&lt;br /&gt;
::::3. Click on Topics tab.&lt;br /&gt;
::::4. Scroll down to the bottom of the page and click on Import topics.&lt;br /&gt;
::::5. Click on Topic Description checkbox and import the following file. (sample.csv) [[File:918_sample.csv]]&lt;br /&gt;
::::[[File:918_p1.png]]&lt;br /&gt;
::::6. Click on next and make the header for 4th column as 'Description' from the dropdown.&lt;br /&gt;
::::[[File:918_p2.png]]&lt;br /&gt;
::::7. Import topics.&lt;br /&gt;
::::8. After this, a new topic should be imported which can be viewed from the aforementioned Topics tab. This newly imported topic will not have any non-ascii characters.&lt;br /&gt;
&lt;br /&gt;
::'''[Problem 3 (329)]'''&lt;br /&gt;
::::1. Login to Expertiza using username: instructor6 &amp;amp; password: password.&lt;br /&gt;
::::2. Select Manage &amp;gt; Courses or Assignments &amp;gt; Add Teams button &amp;gt; Import Team&lt;br /&gt;
::::3. In the screen that loads, select &amp;quot;rename the existing team and import&amp;quot; in the handle conflicts section.&lt;br /&gt;
::::4. Upload a file with the team details and select the appropriate delimiter.&lt;br /&gt;
::::5. Click on Create&lt;br /&gt;
::::6. Verify that the new team got created with the assigned name and the older team's name got changed.&lt;br /&gt;
&lt;br /&gt;
::'''[Problem 4 (328)]'''&lt;br /&gt;
::::1. Login to Expertiza using username: instructor6 &amp;amp; password: password.&lt;br /&gt;
::::2. Select Manage &amp;gt; Courses or Assignments &amp;gt; Add Teams button &amp;gt; Import Team&lt;br /&gt;
::::3. In the screen that loads, select &amp;quot;Insert any new members into existing team&amp;quot; in the handle conflicts section.&lt;br /&gt;
::::4. Upload a file with the team details and select the appropriate delimiter.&lt;br /&gt;
::::5. Click on Create&lt;br /&gt;
::::6. Verify that the existing team got updated with the new team members&lt;br /&gt;
&lt;br /&gt;
== '''Possible Enhancements''' ==&lt;br /&gt;
&lt;br /&gt;
====='''Import functionality'''=====&lt;br /&gt;
&lt;br /&gt;
The existing import implementation does not follow DRY principle, rails code practices and even basic design principles. Most of the code is written based with nested if else conditions. This implementation can be improved. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Exception Handling: Before starting to work on this requirement. I tried few imports and in many cases, import was not successful and i was not able to figure out what's going wrong. My suggestion would be to develop a screen to show which rows were successfully imported and the failure reason which didn't. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Also, if there's no team in the system and instructor has used it in the import file so a new pop up can be displayed where the new team can be created or the import can be extended to create teams while assigning the topic. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1. Expertiza on GITHUB: https://github.com/expertiza/expertiza&lt;br /&gt;
&lt;br /&gt;
2. GitHub Project Repository Fork: https://github.com/NisargC/expertiza&lt;br /&gt;
&lt;br /&gt;
3. Demo link: http://152.46.19.138:8080/&lt;br /&gt;
&lt;br /&gt;
4. Expertiza project documentation wiki: http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2019_-_E1938._OSS_project_Duke_Blue:_Fix_import_glitches&lt;/div&gt;</summary>
		<author><name>Nmchoks2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1938._OSS_project_Duke_Blue:_Fix_import_glitches&amp;diff=127511</id>
		<title>CSC/ECE 517 Fall 2019 - E1938. OSS project Duke Blue: Fix import glitches</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1938._OSS_project_Duke_Blue:_Fix_import_glitches&amp;diff=127511"/>
		<updated>2019-11-06T23:18:17Z</updated>

		<summary type="html">&lt;p&gt;Nmchoks2: /* Issue 328 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
== '''About Expertiza''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source project based on Ruby on Rails framework and the code is available on Github. Expertiza allows the instructor to create new assignments as well as edit new or existing assignments. Instructors can also create a list of topics the students can sign up for and specify deadlines for completion of various tasks. Students can form teams in Expertiza to work on various projects and assignments as well as peer review other students' submissions. Expertiza supports submission across various document types, including the URLs Wiki pages.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
The import feature is the most helpful feature for instructors to set up assignments. The instructors usually have a list of students, teams, etc from their learning management system. Being able to import these into expertiza saves a lot of time when setting up an assignment. Unfortunately this feature has some bugs that were identified as the following list. &lt;br /&gt;
&lt;br /&gt;
'''Issue 918''': It seems that non-ASCII characters in the description (e.g., a curly apostrophe, and perhaps also an en-dash) caused a SQL error in inserting the description string into the db. I had to edit the import file to remove non-ASCII characters. Any Unicode character ought to be allowed in a description. &lt;br /&gt;
&lt;br /&gt;
'''Issue 153''': There should be a way to import a list of who has signed up for which topic. When a signup sheet is used in Expertiza, users are expected to sign up for topics. But, the instructor might've taken signups offline, e.g., by passing around a signup sheet in class. There should be a way to import this list to Expertiza, rather than impersonate all the students one by one and sign them up for a topic. '''This issue is not a bug but an additional feature to the existing import topic functionality.'''&lt;br /&gt;
&lt;br /&gt;
'''Issue 329''': When importing teams there are different options to handle conflicting team names &lt;br /&gt;
&lt;br /&gt;
'''Issue 328''': When importing teams, and a conflict exists there is an option to merge the two teams by inserting the new members into an existing team. Unfortunately, this feature is broken. we tried to import a team and selected 'Insert any new members into existing team'. No new team members were in fact inserted into the team&lt;br /&gt;
&lt;br /&gt;
== '''Fixes''' ==&lt;br /&gt;
=====Issue 918=====&lt;br /&gt;
&lt;br /&gt;
'''Problem:''' The application is not able to import topics with non ascii characters in its description field. &amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' Before the topic object is persisted into the database, check for any non ascii characters in the description field and strip them. &amp;lt;br&amp;gt;&lt;br /&gt;
'''Code Changes'''&amp;lt;br&amp;gt;&lt;br /&gt;
New code introduced is as follows.&amp;lt;br&amp;gt;&lt;br /&gt;
File:app/helpers/import_topics_helper.rb &amp;lt;br&amp;gt;&lt;br /&gt;
Here, a new function 'trim_non_ascii' has been added which iterates a given string character by character, and replaces each non ascii character with a white space character. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  def self.define_attributes(row_hash)&lt;br /&gt;
    attributes = {}&lt;br /&gt;
    if !row_hash[:description].nil? and !row_hash[:description].ascii_only?&lt;br /&gt;
      row_hash[:description] = self.trim_non_ascii(row_hash[:description])&lt;br /&gt;
      puts row_hash[:description]&lt;br /&gt;
    end&lt;br /&gt;
    attributes[&amp;quot;topic_identifier&amp;quot;] = row_hash[:topic_identifier].strip&lt;br /&gt;
    attributes[&amp;quot;topic_name&amp;quot;] = row_hash[:topic_name].strip&lt;br /&gt;
    attributes[&amp;quot;max_choosers&amp;quot;] = row_hash[:max_choosers].strip&lt;br /&gt;
    attributes&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def self.trim_non_ascii(string)&lt;br /&gt;
    string.split('').each do |char|&lt;br /&gt;
      !char.ascii_only? ? string.tr!(char, ' ') : nil&lt;br /&gt;
    end&lt;br /&gt;
    string.gsub!(/\s+/, ' ')&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
=====Issue 328=====&lt;br /&gt;
&lt;br /&gt;
'''Problem''': When importing teams, and a conflict exists there is an option to merge the two teams by inserting the new members into an existing team.&lt;br /&gt;
&lt;br /&gt;
'''Solution''': This was an issue to fix the functionality of Insert any new members into existing team. This was due to faulty handling of the option handle_dups and incorrect checking of parameters.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Code was modified to ensure minimal impact to existing testcases and functionalities.&amp;lt;br&amp;gt;&lt;br /&gt;
The handling of handle_dups in options was done assuming that the parameter was a symbol. But when tested, it was found to be a string and hence the handling was updated accordingly.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
      name = handle_duplicate(team, name, id, options[&amp;quot;handle_dups&amp;quot;], teamtype)&lt;br /&gt;
Also, the if and else conditions for checking class type of used was wrong. This was updated based on how the variable was assigned in the '''import_file_controller.rb#import_from_hash'''&lt;br /&gt;
      if(teamtype.is_a?(CourseTeam.class))&lt;br /&gt;
          ...&lt;br /&gt;
      elsif  teamtype.is_a?(AssignmentTeam.class)&lt;br /&gt;
          ...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E1938_Before_D.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
After fixing changes&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Insert_new_in_old.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Issue 329=====&lt;br /&gt;
&lt;br /&gt;
This was a request to add an option to rename existing team if there was a conflict in the team name.&amp;lt;br&amp;gt;&lt;br /&gt;
New code introduced was as follows:&amp;lt;br&amp;gt;&lt;br /&gt;
In start.html.erb&amp;lt;br&amp;gt;&lt;br /&gt;
In this file, the new option as displayed to the user is added&amp;lt;br&amp;gt;&lt;br /&gt;
          &amp;lt;option value=&amp;quot;rename_existing&amp;quot;&amp;gt;rename the existing team and import&amp;lt;/option&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In '''team.rb'''&amp;lt;br&amp;gt;&lt;br /&gt;
In this file, the handling of the new tag &amp;quot;rename_existing&amp;quot; is added wherein, the old team is updated with a new name.&amp;lt;br&amp;gt;&lt;br /&gt;
    # E1938: Added handling for renaming old team when conflict arises&lt;br /&gt;
    if handle_dups == &amp;quot;rename_existing&amp;quot;&lt;br /&gt;
      if teamtype.is_a?(CourseTeam.class)&lt;br /&gt;
        team.update(name: self.generate_team_name(Course.find(id).name))&lt;br /&gt;
      elsif  teamtype.is_a?(AssignmentTeam.class)&lt;br /&gt;
        team.update(name: self.generate_team_name(Assignment.find(id).name))&lt;br /&gt;
      end&lt;br /&gt;
      return name&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The state of D before conflicting import:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E1938_Before_D_1.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
After fixing changes&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:After_D.PNG]]&lt;br /&gt;
[[File:After_old_team.PNG]]&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
As you can see the new team got the name D and the old file got renamed to Team_17.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Issue 153=====&lt;br /&gt;
'''Requirement''': There should be a way to import a list of who has signed up for which topic. When a signup sheet is used in Expertiza, users are expected to sign up for topics. But, the instructor might've taken signups offline, e.g., by passing around a signup sheet in class. There should be a way to import this list to Expertiza, rather than impersonate all the students one by one and sign them up for a topic. &lt;br /&gt;
&lt;br /&gt;
'''Solution''': We have modified the existing implementation for import topics to assign the teams to the topics. We have changed the files to handle another column where the teams have been assigned to topics. The column is optional because there might be topics that have not yet been assigned to any teams&lt;br /&gt;
&lt;br /&gt;
'''Expectations from the import file: &lt;br /&gt;
'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
* Assigned team name should exist in the system, otherwise the import will fail. Instructor has to make sure that the teams which are assigned in the import file should exist with same names in the system or database. &lt;br /&gt;
* Instructor also need to ensure that the topic for which the team is being assigned should not be full or can accommodate new team assignment to the respective topic. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''Code Changes:'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''import_file/_sign_up_topic.html.erb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
As there's already a screen with select options to map the columns with the fields for import. We are just adding another column so the best way is to extend the existing select tag with a new option for the teams assigned. All the select tags has been changed with an additional option &amp;quot;Assigned Team&amp;quot;. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
 &amp;lt;th&amp;gt;&lt;br /&gt;
            &amp;lt;select name=&amp;quot;select1&amp;quot; id=&amp;quot;select1&amp;quot; class=&amp;quot;form-control&amp;quot; style=&amp;quot;background-color:lightgrey&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;topic_identifier&amp;quot;&amp;gt;Topic Identifier (required)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;topic_name&amp;quot;&amp;gt;Topic Name (required)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;max_choosers&amp;quot;&amp;gt;Max Choosers (required)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;category&amp;quot;&amp;gt;Category (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;description&amp;quot;&amp;gt;Description (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;link&amp;quot;&amp;gt;Link (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;assigned_team&amp;quot;&amp;gt;Assigned Team (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
            &amp;lt;/select&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''model/sign_up_topic.rb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The existing import function in the model import the topics to the topic table. As per the requirement and validations, topic should be imported first and then only the team can be assigned to the topic. So the existing import method has been modified to assign the team once the topic is imported in the database table. As per the edge case mentioned in the requirement document that few topics may not have any team assigned to it, so we first check if topic has any team assigned, then only it tries to map the topic with the team. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
  def self.import(row_hash, session, _id = nil)&lt;br /&gt;
    if row_hash.length &amp;lt; 3&lt;br /&gt;
      raise ArgumentError, &amp;quot;The CSV File expects the format: Topic identifier, Topic name, Max choosers, Topic Category (optional), Topic Description (Optional), Topic Link (optional), Assigned Team Name (optional).&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
    topic = SignUpTopic.where(topic_name: row_hash[:topic_name], assignment_id: session[:assignment_id]).first&lt;br /&gt;
    if topic.nil?&lt;br /&gt;
      attributes = ImportTopicsHelper.define_attributes(row_hash)&lt;br /&gt;
      topic_new_id = ImportTopicsHelper.create_new_sign_up_topic(attributes, session)&lt;br /&gt;
      unless row_hash[:assigned_team].nil?&lt;br /&gt;
          team = Team.where(name: row_hash[:assigned_team]).first&lt;br /&gt;
          ImportTopicsHelper.assign_team_topic(topic_new_id, team.id)&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      topic.max_choosers = row_hash[:max_choosers]&lt;br /&gt;
      topic.topic_identifier = row_hash[:topic_identifier]&lt;br /&gt;
      topic.save&lt;br /&gt;
      unless row_hash[:assigned_team].nil?&lt;br /&gt;
        team = Team.where(name: row_hash[:assigned_team]).first&lt;br /&gt;
        newteam = SignedUpTeam.where(topic_id: topic.id, team_id: team.id).first&lt;br /&gt;
        if newteam.nil?&lt;br /&gt;
          ImportTopicsHelper.assign_team_topic(topic.id, team.id)&lt;br /&gt;
        else&lt;br /&gt;
          newteam.team_id = team.id&lt;br /&gt;
          newteam.save&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''helpers/import_topics_helper.rb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Having the assign_team_topic in the helper would organize the code but also in the unit testing. We can isolate the model logic and test this method separately by writing the test cases. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
  def self.assign_team_topic(topic_id, assigned_team)&lt;br /&gt;
    attributes = {}&lt;br /&gt;
    attributes[&amp;quot;topic_id&amp;quot;] = topic_id&lt;br /&gt;
    attributes[&amp;quot;team_id&amp;quot;] = assigned_team&lt;br /&gt;
    assign_team = SignedUpTeam.new(attributes)&lt;br /&gt;
    assign_team.save!&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
   def self.create_new_sign_up_topic(attributes, session)&lt;br /&gt;
     sign_up_topic = SignUpTopic.new(attributes)&lt;br /&gt;
     sign_up_topic.assignment_id = session[:assignment_id]&lt;br /&gt;
     sign_up_topic.save&lt;br /&gt;
     # sign_up_topic&lt;br /&gt;
     sign_up_topic.save!&lt;br /&gt;
     sign_up_topic.id&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''controllers/import_file_controller.rb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Existing implementation for import have many flaws and design issues. Most of the code has been written with nested if else, which is not the practice to be followed. Also the names of the fields have been hardcoded. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
As we cannot change the complete import implementation. So i had to use the existing one the way it is and make changes to extend the functionality. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    if (params[:assigned_team] == 'true')&lt;br /&gt;
        @optional_count += 1&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
    elsif params[:optional_count] == '4'&lt;br /&gt;
          new_header = [params[:select1], params[:select2], params[:select3], params[:select4], params[:select5], params[:select6], params[:select7]]&lt;br /&gt;
          @header_integrated_body = hash_rows_with_headers(new_header,contents_hash[:body])&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''views/sign_up_sheet/_add_topics.html.erb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
This code has been used to display the columns in the footer.As we already have implementation for other columns, so another column name 'Assigned Team' is added here in this part of the code. &lt;br /&gt;
        &amp;lt;%= link_to 'Import topics',&lt;br /&gt;
                {&lt;br /&gt;
                    :controller =&amp;gt; 'import_file',&lt;br /&gt;
                    :action =&amp;gt; 'start',&lt;br /&gt;
                    :model =&amp;gt; 'SignUpTopic',&lt;br /&gt;
                    :id =&amp;gt; params[:id],&lt;br /&gt;
                    :expected_fields =&amp;gt; 'Topic Identifier' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Name' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Max Choosers' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Category &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Description &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Link &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Assigned Team &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
An option column checkbox (Teams Assigned) has been added to the UI&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Issue153SS8.jpg]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
A new column Assigned Team is added where the columns are being mapped. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File: Issue153SS7.jpg]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Test Plan''' ==&lt;br /&gt;
*'''RSpec:'''&lt;br /&gt;
&lt;br /&gt;
::We have added new testcases for the new pieces of code that were added by us.&lt;br /&gt;
&lt;br /&gt;
::'''[Problem 3 (329)]'''&lt;br /&gt;
::::A new testcase was added to test this functionality. We use it to check if the older team gets the new name and the new team gets the requested name. This testcase runs when we run bundle exec for the '''teams_spec.rb'''&lt;br /&gt;
      # New team name should remain the same, the old one gets updated&lt;br /&gt;
      context 'when handle_dups option is rename_existing' do&lt;br /&gt;
        it 'returns new team name' do&lt;br /&gt;
          allow(Course).to receive(:find).with(1).and_return(double('Course', name: 'course 1'))&lt;br /&gt;
          allow(Team).to receive(:generate_team_name).with('course 1').and_return('new name of team')&lt;br /&gt;
          expect(Team.handle_duplicate(team, 'no name', 1, 'rename_existing', CourseTeam)).to eq('no name')&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
*'''UI Testing:'''&lt;br /&gt;
&lt;br /&gt;
::'''[Problem 1 (918)]'''&lt;br /&gt;
::::1. Login to Expertiza using username: instructor6 &amp;amp; password: password.&lt;br /&gt;
::::2. Go to Assignments and click on edit for any of the listed assignments.&lt;br /&gt;
::::3. Click on Topics tab.&lt;br /&gt;
::::4. Scroll down to the bottom of the page and click on Import topics.&lt;br /&gt;
::::5. Click on Topic Description checkbox and import the following file. (sample.csv) [[File:918_sample.csv]]&lt;br /&gt;
::::[[File:918_p1.png]]&lt;br /&gt;
::::6. Click on next and make the header for 4th column as 'Description' from the dropdown.&lt;br /&gt;
::::[[File:918_p2.png]]&lt;br /&gt;
::::7. Import topics.&lt;br /&gt;
::::8. After this, a new topic should be imported which can be viewed from the aforementioned Topics tab. This newly imported topic will not have any non-ascii characters.&lt;br /&gt;
&lt;br /&gt;
::'''[Problem 3 (329)]'''&lt;br /&gt;
::::1. Login to Expertiza using username: instructor6 &amp;amp; password: password.&lt;br /&gt;
::::2. Select Manage &amp;gt; Courses or Assignments &amp;gt; Add Teams button &amp;gt; Import Team&lt;br /&gt;
::::3. In the screen that loads, select &amp;quot;rename the existing team and import&amp;quot; in the handle conflicts section.&lt;br /&gt;
::::4. Upload a file with the team details and select the appropriate delimiter.&lt;br /&gt;
::::5. Click on Create&lt;br /&gt;
::::6. Verify that the new team got created with the assigned name and the older team's name got changed.&lt;br /&gt;
&lt;br /&gt;
::'''[Problem 4 (328)]'''&lt;br /&gt;
::::1. Login to Expertiza using username: instructor6 &amp;amp; password: password.&lt;br /&gt;
::::2. Select Manage &amp;gt; Courses or Assignments &amp;gt; Add Teams button &amp;gt; Import Team&lt;br /&gt;
::::3. In the screen that loads, select &amp;quot;Insert any new members into existing team&amp;quot; in the handle conflicts section.&lt;br /&gt;
::::4. Upload a file with the team details and select the appropriate delimiter.&lt;br /&gt;
::::5. Click on Create&lt;br /&gt;
::::6. Verify that the existing team got updated with the new team members&lt;br /&gt;
&lt;br /&gt;
== '''Possible Enhancements''' ==&lt;br /&gt;
&lt;br /&gt;
====='''Import functionality'''=====&lt;br /&gt;
&lt;br /&gt;
The existing import implementation does not follow DRY principle, rails code practices and even basic design principles. Most of the code is written based with nested if else conditions. This implementation can be improved. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Exception Handling: Before starting to work on this requirement. I tried few imports and in many cases, import was not successful and i was not able to figure out what's going wrong. My suggestion would be to develop a screen to show which rows were successfully imported and the failure reason which didn't. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Also, if there's no team in the system and instructor has used it in the import file so a new pop up can be displayed where the new team can be created or the import can be extended to create teams while assigning the topic. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1. Expertiza on GITHUB: https://github.com/expertiza/expertiza&lt;br /&gt;
&lt;br /&gt;
2. GitHub Project Repository Fork: https://github.com/NisargC/expertiza&lt;br /&gt;
&lt;br /&gt;
3. Demo link: http://152.46.19.138:8080/&lt;br /&gt;
&lt;br /&gt;
4. Expertiza project documentation wiki: http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2019_-_E1938._OSS_project_Duke_Blue:_Fix_import_glitches&lt;/div&gt;</summary>
		<author><name>Nmchoks2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1938._OSS_project_Duke_Blue:_Fix_import_glitches&amp;diff=127510</id>
		<title>CSC/ECE 517 Fall 2019 - E1938. OSS project Duke Blue: Fix import glitches</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1938._OSS_project_Duke_Blue:_Fix_import_glitches&amp;diff=127510"/>
		<updated>2019-11-06T23:18:03Z</updated>

		<summary type="html">&lt;p&gt;Nmchoks2: /* Issue 328 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
== '''About Expertiza''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source project based on Ruby on Rails framework and the code is available on Github. Expertiza allows the instructor to create new assignments as well as edit new or existing assignments. Instructors can also create a list of topics the students can sign up for and specify deadlines for completion of various tasks. Students can form teams in Expertiza to work on various projects and assignments as well as peer review other students' submissions. Expertiza supports submission across various document types, including the URLs Wiki pages.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
The import feature is the most helpful feature for instructors to set up assignments. The instructors usually have a list of students, teams, etc from their learning management system. Being able to import these into expertiza saves a lot of time when setting up an assignment. Unfortunately this feature has some bugs that were identified as the following list. &lt;br /&gt;
&lt;br /&gt;
'''Issue 918''': It seems that non-ASCII characters in the description (e.g., a curly apostrophe, and perhaps also an en-dash) caused a SQL error in inserting the description string into the db. I had to edit the import file to remove non-ASCII characters. Any Unicode character ought to be allowed in a description. &lt;br /&gt;
&lt;br /&gt;
'''Issue 153''': There should be a way to import a list of who has signed up for which topic. When a signup sheet is used in Expertiza, users are expected to sign up for topics. But, the instructor might've taken signups offline, e.g., by passing around a signup sheet in class. There should be a way to import this list to Expertiza, rather than impersonate all the students one by one and sign them up for a topic. '''This issue is not a bug but an additional feature to the existing import topic functionality.'''&lt;br /&gt;
&lt;br /&gt;
'''Issue 329''': When importing teams there are different options to handle conflicting team names &lt;br /&gt;
&lt;br /&gt;
'''Issue 328''': When importing teams, and a conflict exists there is an option to merge the two teams by inserting the new members into an existing team. Unfortunately, this feature is broken. we tried to import a team and selected 'Insert any new members into existing team'. No new team members were in fact inserted into the team&lt;br /&gt;
&lt;br /&gt;
== '''Fixes''' ==&lt;br /&gt;
=====Issue 918=====&lt;br /&gt;
&lt;br /&gt;
'''Problem:''' The application is not able to import topics with non ascii characters in its description field. &amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' Before the topic object is persisted into the database, check for any non ascii characters in the description field and strip them. &amp;lt;br&amp;gt;&lt;br /&gt;
'''Code Changes'''&amp;lt;br&amp;gt;&lt;br /&gt;
New code introduced is as follows.&amp;lt;br&amp;gt;&lt;br /&gt;
File:app/helpers/import_topics_helper.rb &amp;lt;br&amp;gt;&lt;br /&gt;
Here, a new function 'trim_non_ascii' has been added which iterates a given string character by character, and replaces each non ascii character with a white space character. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  def self.define_attributes(row_hash)&lt;br /&gt;
    attributes = {}&lt;br /&gt;
    if !row_hash[:description].nil? and !row_hash[:description].ascii_only?&lt;br /&gt;
      row_hash[:description] = self.trim_non_ascii(row_hash[:description])&lt;br /&gt;
      puts row_hash[:description]&lt;br /&gt;
    end&lt;br /&gt;
    attributes[&amp;quot;topic_identifier&amp;quot;] = row_hash[:topic_identifier].strip&lt;br /&gt;
    attributes[&amp;quot;topic_name&amp;quot;] = row_hash[:topic_name].strip&lt;br /&gt;
    attributes[&amp;quot;max_choosers&amp;quot;] = row_hash[:max_choosers].strip&lt;br /&gt;
    attributes&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def self.trim_non_ascii(string)&lt;br /&gt;
    string.split('').each do |char|&lt;br /&gt;
      !char.ascii_only? ? string.tr!(char, ' ') : nil&lt;br /&gt;
    end&lt;br /&gt;
    string.gsub!(/\s+/, ' ')&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
=====Issue 328=====&lt;br /&gt;
&lt;br /&gt;
'''Problem''': When importing teams, and a conflict exists there is an option to merge the two teams by inserting the new members into an existing team.&lt;br /&gt;
&lt;br /&gt;
'''Solution''': This was an issue to fix the functionality of Insert any new members into existing team. This was due to faulty handling of the option handle_dups and incorrect checking of parameters.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Code was modified to ensure minimal impact to existing testcases and functionalities.&amp;lt;br&amp;gt;&lt;br /&gt;
The handling of handle_dups in options was done assuming that the parameter was a symbol. But when tested, it was found to be a string and hence the handling was updated accordingly.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
      name = handle_duplicate(team, name, id, options[&amp;quot;handle_dups&amp;quot;], teamtype)&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Also, the if and else conditions for checking class type of used was wrong. This was updated based on how the variable was assigned in the '''import_file_controller.rb#import_from_hash'''&lt;br /&gt;
      if(teamtype.is_a?(CourseTeam.class))&lt;br /&gt;
          ...&lt;br /&gt;
      elsif  teamtype.is_a?(AssignmentTeam.class)&lt;br /&gt;
          ...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E1938_Before_D.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
After fixing changes&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Insert_new_in_old.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Issue 329=====&lt;br /&gt;
&lt;br /&gt;
This was a request to add an option to rename existing team if there was a conflict in the team name.&amp;lt;br&amp;gt;&lt;br /&gt;
New code introduced was as follows:&amp;lt;br&amp;gt;&lt;br /&gt;
In start.html.erb&amp;lt;br&amp;gt;&lt;br /&gt;
In this file, the new option as displayed to the user is added&amp;lt;br&amp;gt;&lt;br /&gt;
          &amp;lt;option value=&amp;quot;rename_existing&amp;quot;&amp;gt;rename the existing team and import&amp;lt;/option&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In '''team.rb'''&amp;lt;br&amp;gt;&lt;br /&gt;
In this file, the handling of the new tag &amp;quot;rename_existing&amp;quot; is added wherein, the old team is updated with a new name.&amp;lt;br&amp;gt;&lt;br /&gt;
    # E1938: Added handling for renaming old team when conflict arises&lt;br /&gt;
    if handle_dups == &amp;quot;rename_existing&amp;quot;&lt;br /&gt;
      if teamtype.is_a?(CourseTeam.class)&lt;br /&gt;
        team.update(name: self.generate_team_name(Course.find(id).name))&lt;br /&gt;
      elsif  teamtype.is_a?(AssignmentTeam.class)&lt;br /&gt;
        team.update(name: self.generate_team_name(Assignment.find(id).name))&lt;br /&gt;
      end&lt;br /&gt;
      return name&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The state of D before conflicting import:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E1938_Before_D_1.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
After fixing changes&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:After_D.PNG]]&lt;br /&gt;
[[File:After_old_team.PNG]]&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
As you can see the new team got the name D and the old file got renamed to Team_17.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Issue 153=====&lt;br /&gt;
'''Requirement''': There should be a way to import a list of who has signed up for which topic. When a signup sheet is used in Expertiza, users are expected to sign up for topics. But, the instructor might've taken signups offline, e.g., by passing around a signup sheet in class. There should be a way to import this list to Expertiza, rather than impersonate all the students one by one and sign them up for a topic. &lt;br /&gt;
&lt;br /&gt;
'''Solution''': We have modified the existing implementation for import topics to assign the teams to the topics. We have changed the files to handle another column where the teams have been assigned to topics. The column is optional because there might be topics that have not yet been assigned to any teams&lt;br /&gt;
&lt;br /&gt;
'''Expectations from the import file: &lt;br /&gt;
'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
* Assigned team name should exist in the system, otherwise the import will fail. Instructor has to make sure that the teams which are assigned in the import file should exist with same names in the system or database. &lt;br /&gt;
* Instructor also need to ensure that the topic for which the team is being assigned should not be full or can accommodate new team assignment to the respective topic. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''Code Changes:'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''import_file/_sign_up_topic.html.erb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
As there's already a screen with select options to map the columns with the fields for import. We are just adding another column so the best way is to extend the existing select tag with a new option for the teams assigned. All the select tags has been changed with an additional option &amp;quot;Assigned Team&amp;quot;. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
 &amp;lt;th&amp;gt;&lt;br /&gt;
            &amp;lt;select name=&amp;quot;select1&amp;quot; id=&amp;quot;select1&amp;quot; class=&amp;quot;form-control&amp;quot; style=&amp;quot;background-color:lightgrey&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;topic_identifier&amp;quot;&amp;gt;Topic Identifier (required)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;topic_name&amp;quot;&amp;gt;Topic Name (required)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;max_choosers&amp;quot;&amp;gt;Max Choosers (required)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;category&amp;quot;&amp;gt;Category (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;description&amp;quot;&amp;gt;Description (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;link&amp;quot;&amp;gt;Link (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;assigned_team&amp;quot;&amp;gt;Assigned Team (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
            &amp;lt;/select&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''model/sign_up_topic.rb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The existing import function in the model import the topics to the topic table. As per the requirement and validations, topic should be imported first and then only the team can be assigned to the topic. So the existing import method has been modified to assign the team once the topic is imported in the database table. As per the edge case mentioned in the requirement document that few topics may not have any team assigned to it, so we first check if topic has any team assigned, then only it tries to map the topic with the team. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
  def self.import(row_hash, session, _id = nil)&lt;br /&gt;
    if row_hash.length &amp;lt; 3&lt;br /&gt;
      raise ArgumentError, &amp;quot;The CSV File expects the format: Topic identifier, Topic name, Max choosers, Topic Category (optional), Topic Description (Optional), Topic Link (optional), Assigned Team Name (optional).&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
    topic = SignUpTopic.where(topic_name: row_hash[:topic_name], assignment_id: session[:assignment_id]).first&lt;br /&gt;
    if topic.nil?&lt;br /&gt;
      attributes = ImportTopicsHelper.define_attributes(row_hash)&lt;br /&gt;
      topic_new_id = ImportTopicsHelper.create_new_sign_up_topic(attributes, session)&lt;br /&gt;
      unless row_hash[:assigned_team].nil?&lt;br /&gt;
          team = Team.where(name: row_hash[:assigned_team]).first&lt;br /&gt;
          ImportTopicsHelper.assign_team_topic(topic_new_id, team.id)&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      topic.max_choosers = row_hash[:max_choosers]&lt;br /&gt;
      topic.topic_identifier = row_hash[:topic_identifier]&lt;br /&gt;
      topic.save&lt;br /&gt;
      unless row_hash[:assigned_team].nil?&lt;br /&gt;
        team = Team.where(name: row_hash[:assigned_team]).first&lt;br /&gt;
        newteam = SignedUpTeam.where(topic_id: topic.id, team_id: team.id).first&lt;br /&gt;
        if newteam.nil?&lt;br /&gt;
          ImportTopicsHelper.assign_team_topic(topic.id, team.id)&lt;br /&gt;
        else&lt;br /&gt;
          newteam.team_id = team.id&lt;br /&gt;
          newteam.save&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''helpers/import_topics_helper.rb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Having the assign_team_topic in the helper would organize the code but also in the unit testing. We can isolate the model logic and test this method separately by writing the test cases. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
  def self.assign_team_topic(topic_id, assigned_team)&lt;br /&gt;
    attributes = {}&lt;br /&gt;
    attributes[&amp;quot;topic_id&amp;quot;] = topic_id&lt;br /&gt;
    attributes[&amp;quot;team_id&amp;quot;] = assigned_team&lt;br /&gt;
    assign_team = SignedUpTeam.new(attributes)&lt;br /&gt;
    assign_team.save!&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
   def self.create_new_sign_up_topic(attributes, session)&lt;br /&gt;
     sign_up_topic = SignUpTopic.new(attributes)&lt;br /&gt;
     sign_up_topic.assignment_id = session[:assignment_id]&lt;br /&gt;
     sign_up_topic.save&lt;br /&gt;
     # sign_up_topic&lt;br /&gt;
     sign_up_topic.save!&lt;br /&gt;
     sign_up_topic.id&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''controllers/import_file_controller.rb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Existing implementation for import have many flaws and design issues. Most of the code has been written with nested if else, which is not the practice to be followed. Also the names of the fields have been hardcoded. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
As we cannot change the complete import implementation. So i had to use the existing one the way it is and make changes to extend the functionality. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    if (params[:assigned_team] == 'true')&lt;br /&gt;
        @optional_count += 1&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
    elsif params[:optional_count] == '4'&lt;br /&gt;
          new_header = [params[:select1], params[:select2], params[:select3], params[:select4], params[:select5], params[:select6], params[:select7]]&lt;br /&gt;
          @header_integrated_body = hash_rows_with_headers(new_header,contents_hash[:body])&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''views/sign_up_sheet/_add_topics.html.erb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
This code has been used to display the columns in the footer.As we already have implementation for other columns, so another column name 'Assigned Team' is added here in this part of the code. &lt;br /&gt;
        &amp;lt;%= link_to 'Import topics',&lt;br /&gt;
                {&lt;br /&gt;
                    :controller =&amp;gt; 'import_file',&lt;br /&gt;
                    :action =&amp;gt; 'start',&lt;br /&gt;
                    :model =&amp;gt; 'SignUpTopic',&lt;br /&gt;
                    :id =&amp;gt; params[:id],&lt;br /&gt;
                    :expected_fields =&amp;gt; 'Topic Identifier' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Name' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Max Choosers' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Category &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Description &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Link &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Assigned Team &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
An option column checkbox (Teams Assigned) has been added to the UI&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Issue153SS8.jpg]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
A new column Assigned Team is added where the columns are being mapped. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File: Issue153SS7.jpg]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Test Plan''' ==&lt;br /&gt;
*'''RSpec:'''&lt;br /&gt;
&lt;br /&gt;
::We have added new testcases for the new pieces of code that were added by us.&lt;br /&gt;
&lt;br /&gt;
::'''[Problem 3 (329)]'''&lt;br /&gt;
::::A new testcase was added to test this functionality. We use it to check if the older team gets the new name and the new team gets the requested name. This testcase runs when we run bundle exec for the '''teams_spec.rb'''&lt;br /&gt;
      # New team name should remain the same, the old one gets updated&lt;br /&gt;
      context 'when handle_dups option is rename_existing' do&lt;br /&gt;
        it 'returns new team name' do&lt;br /&gt;
          allow(Course).to receive(:find).with(1).and_return(double('Course', name: 'course 1'))&lt;br /&gt;
          allow(Team).to receive(:generate_team_name).with('course 1').and_return('new name of team')&lt;br /&gt;
          expect(Team.handle_duplicate(team, 'no name', 1, 'rename_existing', CourseTeam)).to eq('no name')&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
*'''UI Testing:'''&lt;br /&gt;
&lt;br /&gt;
::'''[Problem 1 (918)]'''&lt;br /&gt;
::::1. Login to Expertiza using username: instructor6 &amp;amp; password: password.&lt;br /&gt;
::::2. Go to Assignments and click on edit for any of the listed assignments.&lt;br /&gt;
::::3. Click on Topics tab.&lt;br /&gt;
::::4. Scroll down to the bottom of the page and click on Import topics.&lt;br /&gt;
::::5. Click on Topic Description checkbox and import the following file. (sample.csv) [[File:918_sample.csv]]&lt;br /&gt;
::::[[File:918_p1.png]]&lt;br /&gt;
::::6. Click on next and make the header for 4th column as 'Description' from the dropdown.&lt;br /&gt;
::::[[File:918_p2.png]]&lt;br /&gt;
::::7. Import topics.&lt;br /&gt;
::::8. After this, a new topic should be imported which can be viewed from the aforementioned Topics tab. This newly imported topic will not have any non-ascii characters.&lt;br /&gt;
&lt;br /&gt;
::'''[Problem 3 (329)]'''&lt;br /&gt;
::::1. Login to Expertiza using username: instructor6 &amp;amp; password: password.&lt;br /&gt;
::::2. Select Manage &amp;gt; Courses or Assignments &amp;gt; Add Teams button &amp;gt; Import Team&lt;br /&gt;
::::3. In the screen that loads, select &amp;quot;rename the existing team and import&amp;quot; in the handle conflicts section.&lt;br /&gt;
::::4. Upload a file with the team details and select the appropriate delimiter.&lt;br /&gt;
::::5. Click on Create&lt;br /&gt;
::::6. Verify that the new team got created with the assigned name and the older team's name got changed.&lt;br /&gt;
&lt;br /&gt;
::'''[Problem 4 (328)]'''&lt;br /&gt;
::::1. Login to Expertiza using username: instructor6 &amp;amp; password: password.&lt;br /&gt;
::::2. Select Manage &amp;gt; Courses or Assignments &amp;gt; Add Teams button &amp;gt; Import Team&lt;br /&gt;
::::3. In the screen that loads, select &amp;quot;Insert any new members into existing team&amp;quot; in the handle conflicts section.&lt;br /&gt;
::::4. Upload a file with the team details and select the appropriate delimiter.&lt;br /&gt;
::::5. Click on Create&lt;br /&gt;
::::6. Verify that the existing team got updated with the new team members&lt;br /&gt;
&lt;br /&gt;
== '''Possible Enhancements''' ==&lt;br /&gt;
&lt;br /&gt;
====='''Import functionality'''=====&lt;br /&gt;
&lt;br /&gt;
The existing import implementation does not follow DRY principle, rails code practices and even basic design principles. Most of the code is written based with nested if else conditions. This implementation can be improved. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Exception Handling: Before starting to work on this requirement. I tried few imports and in many cases, import was not successful and i was not able to figure out what's going wrong. My suggestion would be to develop a screen to show which rows were successfully imported and the failure reason which didn't. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Also, if there's no team in the system and instructor has used it in the import file so a new pop up can be displayed where the new team can be created or the import can be extended to create teams while assigning the topic. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1. Expertiza on GITHUB: https://github.com/expertiza/expertiza&lt;br /&gt;
&lt;br /&gt;
2. GitHub Project Repository Fork: https://github.com/NisargC/expertiza&lt;br /&gt;
&lt;br /&gt;
3. Demo link: http://152.46.19.138:8080/&lt;br /&gt;
&lt;br /&gt;
4. Expertiza project documentation wiki: http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2019_-_E1938._OSS_project_Duke_Blue:_Fix_import_glitches&lt;/div&gt;</summary>
		<author><name>Nmchoks2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1938._OSS_project_Duke_Blue:_Fix_import_glitches&amp;diff=127509</id>
		<title>CSC/ECE 517 Fall 2019 - E1938. OSS project Duke Blue: Fix import glitches</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1938._OSS_project_Duke_Blue:_Fix_import_glitches&amp;diff=127509"/>
		<updated>2019-11-06T23:17:48Z</updated>

		<summary type="html">&lt;p&gt;Nmchoks2: /* Issue 328 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
== '''About Expertiza''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source project based on Ruby on Rails framework and the code is available on Github. Expertiza allows the instructor to create new assignments as well as edit new or existing assignments. Instructors can also create a list of topics the students can sign up for and specify deadlines for completion of various tasks. Students can form teams in Expertiza to work on various projects and assignments as well as peer review other students' submissions. Expertiza supports submission across various document types, including the URLs Wiki pages.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
The import feature is the most helpful feature for instructors to set up assignments. The instructors usually have a list of students, teams, etc from their learning management system. Being able to import these into expertiza saves a lot of time when setting up an assignment. Unfortunately this feature has some bugs that were identified as the following list. &lt;br /&gt;
&lt;br /&gt;
'''Issue 918''': It seems that non-ASCII characters in the description (e.g., a curly apostrophe, and perhaps also an en-dash) caused a SQL error in inserting the description string into the db. I had to edit the import file to remove non-ASCII characters. Any Unicode character ought to be allowed in a description. &lt;br /&gt;
&lt;br /&gt;
'''Issue 153''': There should be a way to import a list of who has signed up for which topic. When a signup sheet is used in Expertiza, users are expected to sign up for topics. But, the instructor might've taken signups offline, e.g., by passing around a signup sheet in class. There should be a way to import this list to Expertiza, rather than impersonate all the students one by one and sign them up for a topic. '''This issue is not a bug but an additional feature to the existing import topic functionality.'''&lt;br /&gt;
&lt;br /&gt;
'''Issue 329''': When importing teams there are different options to handle conflicting team names &lt;br /&gt;
&lt;br /&gt;
'''Issue 328''': When importing teams, and a conflict exists there is an option to merge the two teams by inserting the new members into an existing team. Unfortunately, this feature is broken. we tried to import a team and selected 'Insert any new members into existing team'. No new team members were in fact inserted into the team&lt;br /&gt;
&lt;br /&gt;
== '''Fixes''' ==&lt;br /&gt;
=====Issue 918=====&lt;br /&gt;
&lt;br /&gt;
'''Problem:''' The application is not able to import topics with non ascii characters in its description field. &amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' Before the topic object is persisted into the database, check for any non ascii characters in the description field and strip them. &amp;lt;br&amp;gt;&lt;br /&gt;
'''Code Changes'''&amp;lt;br&amp;gt;&lt;br /&gt;
New code introduced is as follows.&amp;lt;br&amp;gt;&lt;br /&gt;
File:app/helpers/import_topics_helper.rb &amp;lt;br&amp;gt;&lt;br /&gt;
Here, a new function 'trim_non_ascii' has been added which iterates a given string character by character, and replaces each non ascii character with a white space character. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  def self.define_attributes(row_hash)&lt;br /&gt;
    attributes = {}&lt;br /&gt;
    if !row_hash[:description].nil? and !row_hash[:description].ascii_only?&lt;br /&gt;
      row_hash[:description] = self.trim_non_ascii(row_hash[:description])&lt;br /&gt;
      puts row_hash[:description]&lt;br /&gt;
    end&lt;br /&gt;
    attributes[&amp;quot;topic_identifier&amp;quot;] = row_hash[:topic_identifier].strip&lt;br /&gt;
    attributes[&amp;quot;topic_name&amp;quot;] = row_hash[:topic_name].strip&lt;br /&gt;
    attributes[&amp;quot;max_choosers&amp;quot;] = row_hash[:max_choosers].strip&lt;br /&gt;
    attributes&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def self.trim_non_ascii(string)&lt;br /&gt;
    string.split('').each do |char|&lt;br /&gt;
      !char.ascii_only? ? string.tr!(char, ' ') : nil&lt;br /&gt;
    end&lt;br /&gt;
    string.gsub!(/\s+/, ' ')&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
=====Issue 328=====&lt;br /&gt;
&lt;br /&gt;
'''Problem''': When importing teams, and a conflict exists there is an option to merge the two teams by inserting the new members into an existing team.&lt;br /&gt;
&lt;br /&gt;
'''Solution''': This was an issue to fix the functionality of Insert any new members into existing team. This was due to faulty handling of the option handle_dups and incorrect checking of parameters.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Code was modified to ensure minimal impact to existing testcases and functionalities.&amp;lt;br&amp;gt;&lt;br /&gt;
The handling of handle_dups in options was done assuming that the parameter was a symbol. But when tested, it was found to be a string and hence the handling was updated accordingly.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Code:&lt;br /&gt;
      name = handle_duplicate(team, name, id, options[&amp;quot;handle_dups&amp;quot;], teamtype)&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Also, the if and else conditions for checking class type of used was wrong. This was updated based on how the variable was assigned in the '''import_file_controller.rb#import_from_hash'''&lt;br /&gt;
Code:&lt;br /&gt;
      if(teamtype.is_a?(CourseTeam.class))&lt;br /&gt;
          ...&lt;br /&gt;
      elsif  teamtype.is_a?(AssignmentTeam.class)&lt;br /&gt;
          ...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E1938_Before_D.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
After fixing changes&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Insert_new_in_old.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Issue 329=====&lt;br /&gt;
&lt;br /&gt;
This was a request to add an option to rename existing team if there was a conflict in the team name.&amp;lt;br&amp;gt;&lt;br /&gt;
New code introduced was as follows:&amp;lt;br&amp;gt;&lt;br /&gt;
In start.html.erb&amp;lt;br&amp;gt;&lt;br /&gt;
In this file, the new option as displayed to the user is added&amp;lt;br&amp;gt;&lt;br /&gt;
          &amp;lt;option value=&amp;quot;rename_existing&amp;quot;&amp;gt;rename the existing team and import&amp;lt;/option&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In '''team.rb'''&amp;lt;br&amp;gt;&lt;br /&gt;
In this file, the handling of the new tag &amp;quot;rename_existing&amp;quot; is added wherein, the old team is updated with a new name.&amp;lt;br&amp;gt;&lt;br /&gt;
    # E1938: Added handling for renaming old team when conflict arises&lt;br /&gt;
    if handle_dups == &amp;quot;rename_existing&amp;quot;&lt;br /&gt;
      if teamtype.is_a?(CourseTeam.class)&lt;br /&gt;
        team.update(name: self.generate_team_name(Course.find(id).name))&lt;br /&gt;
      elsif  teamtype.is_a?(AssignmentTeam.class)&lt;br /&gt;
        team.update(name: self.generate_team_name(Assignment.find(id).name))&lt;br /&gt;
      end&lt;br /&gt;
      return name&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The state of D before conflicting import:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E1938_Before_D_1.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
After fixing changes&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:After_D.PNG]]&lt;br /&gt;
[[File:After_old_team.PNG]]&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
As you can see the new team got the name D and the old file got renamed to Team_17.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Issue 153=====&lt;br /&gt;
'''Requirement''': There should be a way to import a list of who has signed up for which topic. When a signup sheet is used in Expertiza, users are expected to sign up for topics. But, the instructor might've taken signups offline, e.g., by passing around a signup sheet in class. There should be a way to import this list to Expertiza, rather than impersonate all the students one by one and sign them up for a topic. &lt;br /&gt;
&lt;br /&gt;
'''Solution''': We have modified the existing implementation for import topics to assign the teams to the topics. We have changed the files to handle another column where the teams have been assigned to topics. The column is optional because there might be topics that have not yet been assigned to any teams&lt;br /&gt;
&lt;br /&gt;
'''Expectations from the import file: &lt;br /&gt;
'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
* Assigned team name should exist in the system, otherwise the import will fail. Instructor has to make sure that the teams which are assigned in the import file should exist with same names in the system or database. &lt;br /&gt;
* Instructor also need to ensure that the topic for which the team is being assigned should not be full or can accommodate new team assignment to the respective topic. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''Code Changes:'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''import_file/_sign_up_topic.html.erb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
As there's already a screen with select options to map the columns with the fields for import. We are just adding another column so the best way is to extend the existing select tag with a new option for the teams assigned. All the select tags has been changed with an additional option &amp;quot;Assigned Team&amp;quot;. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
 &amp;lt;th&amp;gt;&lt;br /&gt;
            &amp;lt;select name=&amp;quot;select1&amp;quot; id=&amp;quot;select1&amp;quot; class=&amp;quot;form-control&amp;quot; style=&amp;quot;background-color:lightgrey&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;topic_identifier&amp;quot;&amp;gt;Topic Identifier (required)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;topic_name&amp;quot;&amp;gt;Topic Name (required)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;max_choosers&amp;quot;&amp;gt;Max Choosers (required)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;category&amp;quot;&amp;gt;Category (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;description&amp;quot;&amp;gt;Description (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;link&amp;quot;&amp;gt;Link (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;assigned_team&amp;quot;&amp;gt;Assigned Team (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
            &amp;lt;/select&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''model/sign_up_topic.rb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The existing import function in the model import the topics to the topic table. As per the requirement and validations, topic should be imported first and then only the team can be assigned to the topic. So the existing import method has been modified to assign the team once the topic is imported in the database table. As per the edge case mentioned in the requirement document that few topics may not have any team assigned to it, so we first check if topic has any team assigned, then only it tries to map the topic with the team. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
  def self.import(row_hash, session, _id = nil)&lt;br /&gt;
    if row_hash.length &amp;lt; 3&lt;br /&gt;
      raise ArgumentError, &amp;quot;The CSV File expects the format: Topic identifier, Topic name, Max choosers, Topic Category (optional), Topic Description (Optional), Topic Link (optional), Assigned Team Name (optional).&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
    topic = SignUpTopic.where(topic_name: row_hash[:topic_name], assignment_id: session[:assignment_id]).first&lt;br /&gt;
    if topic.nil?&lt;br /&gt;
      attributes = ImportTopicsHelper.define_attributes(row_hash)&lt;br /&gt;
      topic_new_id = ImportTopicsHelper.create_new_sign_up_topic(attributes, session)&lt;br /&gt;
      unless row_hash[:assigned_team].nil?&lt;br /&gt;
          team = Team.where(name: row_hash[:assigned_team]).first&lt;br /&gt;
          ImportTopicsHelper.assign_team_topic(topic_new_id, team.id)&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      topic.max_choosers = row_hash[:max_choosers]&lt;br /&gt;
      topic.topic_identifier = row_hash[:topic_identifier]&lt;br /&gt;
      topic.save&lt;br /&gt;
      unless row_hash[:assigned_team].nil?&lt;br /&gt;
        team = Team.where(name: row_hash[:assigned_team]).first&lt;br /&gt;
        newteam = SignedUpTeam.where(topic_id: topic.id, team_id: team.id).first&lt;br /&gt;
        if newteam.nil?&lt;br /&gt;
          ImportTopicsHelper.assign_team_topic(topic.id, team.id)&lt;br /&gt;
        else&lt;br /&gt;
          newteam.team_id = team.id&lt;br /&gt;
          newteam.save&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''helpers/import_topics_helper.rb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Having the assign_team_topic in the helper would organize the code but also in the unit testing. We can isolate the model logic and test this method separately by writing the test cases. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
  def self.assign_team_topic(topic_id, assigned_team)&lt;br /&gt;
    attributes = {}&lt;br /&gt;
    attributes[&amp;quot;topic_id&amp;quot;] = topic_id&lt;br /&gt;
    attributes[&amp;quot;team_id&amp;quot;] = assigned_team&lt;br /&gt;
    assign_team = SignedUpTeam.new(attributes)&lt;br /&gt;
    assign_team.save!&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
   def self.create_new_sign_up_topic(attributes, session)&lt;br /&gt;
     sign_up_topic = SignUpTopic.new(attributes)&lt;br /&gt;
     sign_up_topic.assignment_id = session[:assignment_id]&lt;br /&gt;
     sign_up_topic.save&lt;br /&gt;
     # sign_up_topic&lt;br /&gt;
     sign_up_topic.save!&lt;br /&gt;
     sign_up_topic.id&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''controllers/import_file_controller.rb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Existing implementation for import have many flaws and design issues. Most of the code has been written with nested if else, which is not the practice to be followed. Also the names of the fields have been hardcoded. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
As we cannot change the complete import implementation. So i had to use the existing one the way it is and make changes to extend the functionality. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    if (params[:assigned_team] == 'true')&lt;br /&gt;
        @optional_count += 1&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
    elsif params[:optional_count] == '4'&lt;br /&gt;
          new_header = [params[:select1], params[:select2], params[:select3], params[:select4], params[:select5], params[:select6], params[:select7]]&lt;br /&gt;
          @header_integrated_body = hash_rows_with_headers(new_header,contents_hash[:body])&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''views/sign_up_sheet/_add_topics.html.erb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
This code has been used to display the columns in the footer.As we already have implementation for other columns, so another column name 'Assigned Team' is added here in this part of the code. &lt;br /&gt;
        &amp;lt;%= link_to 'Import topics',&lt;br /&gt;
                {&lt;br /&gt;
                    :controller =&amp;gt; 'import_file',&lt;br /&gt;
                    :action =&amp;gt; 'start',&lt;br /&gt;
                    :model =&amp;gt; 'SignUpTopic',&lt;br /&gt;
                    :id =&amp;gt; params[:id],&lt;br /&gt;
                    :expected_fields =&amp;gt; 'Topic Identifier' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Name' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Max Choosers' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Category &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Description &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Link &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Assigned Team &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
An option column checkbox (Teams Assigned) has been added to the UI&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Issue153SS8.jpg]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
A new column Assigned Team is added where the columns are being mapped. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File: Issue153SS7.jpg]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Test Plan''' ==&lt;br /&gt;
*'''RSpec:'''&lt;br /&gt;
&lt;br /&gt;
::We have added new testcases for the new pieces of code that were added by us.&lt;br /&gt;
&lt;br /&gt;
::'''[Problem 3 (329)]'''&lt;br /&gt;
::::A new testcase was added to test this functionality. We use it to check if the older team gets the new name and the new team gets the requested name. This testcase runs when we run bundle exec for the '''teams_spec.rb'''&lt;br /&gt;
      # New team name should remain the same, the old one gets updated&lt;br /&gt;
      context 'when handle_dups option is rename_existing' do&lt;br /&gt;
        it 'returns new team name' do&lt;br /&gt;
          allow(Course).to receive(:find).with(1).and_return(double('Course', name: 'course 1'))&lt;br /&gt;
          allow(Team).to receive(:generate_team_name).with('course 1').and_return('new name of team')&lt;br /&gt;
          expect(Team.handle_duplicate(team, 'no name', 1, 'rename_existing', CourseTeam)).to eq('no name')&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
*'''UI Testing:'''&lt;br /&gt;
&lt;br /&gt;
::'''[Problem 1 (918)]'''&lt;br /&gt;
::::1. Login to Expertiza using username: instructor6 &amp;amp; password: password.&lt;br /&gt;
::::2. Go to Assignments and click on edit for any of the listed assignments.&lt;br /&gt;
::::3. Click on Topics tab.&lt;br /&gt;
::::4. Scroll down to the bottom of the page and click on Import topics.&lt;br /&gt;
::::5. Click on Topic Description checkbox and import the following file. (sample.csv) [[File:918_sample.csv]]&lt;br /&gt;
::::[[File:918_p1.png]]&lt;br /&gt;
::::6. Click on next and make the header for 4th column as 'Description' from the dropdown.&lt;br /&gt;
::::[[File:918_p2.png]]&lt;br /&gt;
::::7. Import topics.&lt;br /&gt;
::::8. After this, a new topic should be imported which can be viewed from the aforementioned Topics tab. This newly imported topic will not have any non-ascii characters.&lt;br /&gt;
&lt;br /&gt;
::'''[Problem 3 (329)]'''&lt;br /&gt;
::::1. Login to Expertiza using username: instructor6 &amp;amp; password: password.&lt;br /&gt;
::::2. Select Manage &amp;gt; Courses or Assignments &amp;gt; Add Teams button &amp;gt; Import Team&lt;br /&gt;
::::3. In the screen that loads, select &amp;quot;rename the existing team and import&amp;quot; in the handle conflicts section.&lt;br /&gt;
::::4. Upload a file with the team details and select the appropriate delimiter.&lt;br /&gt;
::::5. Click on Create&lt;br /&gt;
::::6. Verify that the new team got created with the assigned name and the older team's name got changed.&lt;br /&gt;
&lt;br /&gt;
::'''[Problem 4 (328)]'''&lt;br /&gt;
::::1. Login to Expertiza using username: instructor6 &amp;amp; password: password.&lt;br /&gt;
::::2. Select Manage &amp;gt; Courses or Assignments &amp;gt; Add Teams button &amp;gt; Import Team&lt;br /&gt;
::::3. In the screen that loads, select &amp;quot;Insert any new members into existing team&amp;quot; in the handle conflicts section.&lt;br /&gt;
::::4. Upload a file with the team details and select the appropriate delimiter.&lt;br /&gt;
::::5. Click on Create&lt;br /&gt;
::::6. Verify that the existing team got updated with the new team members&lt;br /&gt;
&lt;br /&gt;
== '''Possible Enhancements''' ==&lt;br /&gt;
&lt;br /&gt;
====='''Import functionality'''=====&lt;br /&gt;
&lt;br /&gt;
The existing import implementation does not follow DRY principle, rails code practices and even basic design principles. Most of the code is written based with nested if else conditions. This implementation can be improved. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Exception Handling: Before starting to work on this requirement. I tried few imports and in many cases, import was not successful and i was not able to figure out what's going wrong. My suggestion would be to develop a screen to show which rows were successfully imported and the failure reason which didn't. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Also, if there's no team in the system and instructor has used it in the import file so a new pop up can be displayed where the new team can be created or the import can be extended to create teams while assigning the topic. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1. Expertiza on GITHUB: https://github.com/expertiza/expertiza&lt;br /&gt;
&lt;br /&gt;
2. GitHub Project Repository Fork: https://github.com/NisargC/expertiza&lt;br /&gt;
&lt;br /&gt;
3. Demo link: http://152.46.19.138:8080/&lt;br /&gt;
&lt;br /&gt;
4. Expertiza project documentation wiki: http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2019_-_E1938._OSS_project_Duke_Blue:_Fix_import_glitches&lt;/div&gt;</summary>
		<author><name>Nmchoks2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1938._OSS_project_Duke_Blue:_Fix_import_glitches&amp;diff=127507</id>
		<title>CSC/ECE 517 Fall 2019 - E1938. OSS project Duke Blue: Fix import glitches</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1938._OSS_project_Duke_Blue:_Fix_import_glitches&amp;diff=127507"/>
		<updated>2019-11-06T23:16:14Z</updated>

		<summary type="html">&lt;p&gt;Nmchoks2: /* Issue 328 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
== '''About Expertiza''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source project based on Ruby on Rails framework and the code is available on Github. Expertiza allows the instructor to create new assignments as well as edit new or existing assignments. Instructors can also create a list of topics the students can sign up for and specify deadlines for completion of various tasks. Students can form teams in Expertiza to work on various projects and assignments as well as peer review other students' submissions. Expertiza supports submission across various document types, including the URLs Wiki pages.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
The import feature is the most helpful feature for instructors to set up assignments. The instructors usually have a list of students, teams, etc from their learning management system. Being able to import these into expertiza saves a lot of time when setting up an assignment. Unfortunately this feature has some bugs that were identified as the following list. &lt;br /&gt;
&lt;br /&gt;
'''Issue 918''': It seems that non-ASCII characters in the description (e.g., a curly apostrophe, and perhaps also an en-dash) caused a SQL error in inserting the description string into the db. I had to edit the import file to remove non-ASCII characters. Any Unicode character ought to be allowed in a description. &lt;br /&gt;
&lt;br /&gt;
'''Issue 153''': There should be a way to import a list of who has signed up for which topic. When a signup sheet is used in Expertiza, users are expected to sign up for topics. But, the instructor might've taken signups offline, e.g., by passing around a signup sheet in class. There should be a way to import this list to Expertiza, rather than impersonate all the students one by one and sign them up for a topic. '''This issue is not a bug but an additional feature to the existing import topic functionality.'''&lt;br /&gt;
&lt;br /&gt;
'''Issue 329''': When importing teams there are different options to handle conflicting team names &lt;br /&gt;
&lt;br /&gt;
'''Issue 328''': When importing teams, and a conflict exists there is an option to merge the two teams by inserting the new members into an existing team. Unfortunately, this feature is broken. we tried to import a team and selected 'Insert any new members into existing team'. No new team members were in fact inserted into the team&lt;br /&gt;
&lt;br /&gt;
== '''Fixes''' ==&lt;br /&gt;
=====Issue 918=====&lt;br /&gt;
&lt;br /&gt;
'''Problem:''' The application is not able to import topics with non ascii characters in its description field. &amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' Before the topic object is persisted into the database, check for any non ascii characters in the description field and strip them. &amp;lt;br&amp;gt;&lt;br /&gt;
'''Code Changes'''&amp;lt;br&amp;gt;&lt;br /&gt;
New code introduced is as follows.&amp;lt;br&amp;gt;&lt;br /&gt;
File:app/helpers/import_topics_helper.rb &amp;lt;br&amp;gt;&lt;br /&gt;
Here, a new function 'trim_non_ascii' has been added which iterates a given string character by character, and replaces each non ascii character with a white space character. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  def self.define_attributes(row_hash)&lt;br /&gt;
    attributes = {}&lt;br /&gt;
    if !row_hash[:description].nil? and !row_hash[:description].ascii_only?&lt;br /&gt;
      row_hash[:description] = self.trim_non_ascii(row_hash[:description])&lt;br /&gt;
      puts row_hash[:description]&lt;br /&gt;
    end&lt;br /&gt;
    attributes[&amp;quot;topic_identifier&amp;quot;] = row_hash[:topic_identifier].strip&lt;br /&gt;
    attributes[&amp;quot;topic_name&amp;quot;] = row_hash[:topic_name].strip&lt;br /&gt;
    attributes[&amp;quot;max_choosers&amp;quot;] = row_hash[:max_choosers].strip&lt;br /&gt;
    attributes&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def self.trim_non_ascii(string)&lt;br /&gt;
    string.split('').each do |char|&lt;br /&gt;
      !char.ascii_only? ? string.tr!(char, ' ') : nil&lt;br /&gt;
    end&lt;br /&gt;
    string.gsub!(/\s+/, ' ')&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
=====Issue 328=====&lt;br /&gt;
&lt;br /&gt;
'''Problem''': When importing teams, and a conflict exists there is an option to merge the two teams by inserting the new members into an existing team.&lt;br /&gt;
&lt;br /&gt;
'''Solution''': This was an issue to fix the functionality of Insert any new members into existing team. This was due to faulty handling of the option handle_dups and incorrect checking of parameters.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Code was modified to ensure minimal impact to existing testcases and functionalities.&amp;lt;br&amp;gt;&lt;br /&gt;
The handling of handle_dups in options was done assuming that the parameter was a symbol. But when tested, it was found to be a string and hence the handling was updated accordingly.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Code:&lt;br /&gt;
      name = handle_duplicate(team, name, id, options[&amp;quot;handle_dups&amp;quot;], teamtype)&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Also, the if and else conditions for checking class type of used was wrong. This was updated based on how the variable was assigned in the '''import_file_controller.rb'''#import_from_hash&lt;br /&gt;
Code:&lt;br /&gt;
      if(teamtype.is_a?(CourseTeam.class))&lt;br /&gt;
          ...&lt;br /&gt;
      elsif  teamtype.is_a?(AssignmentTeam.class)&lt;br /&gt;
          ...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E1938_Before_D.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
After fixing changes&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Insert_new_in_old.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Issue 329=====&lt;br /&gt;
&lt;br /&gt;
This was a request to add an option to rename existing team if there was a conflict in the team name.&amp;lt;br&amp;gt;&lt;br /&gt;
New code introduced was as follows:&amp;lt;br&amp;gt;&lt;br /&gt;
In start.html.erb&amp;lt;br&amp;gt;&lt;br /&gt;
In this file, the new option as displayed to the user is added&amp;lt;br&amp;gt;&lt;br /&gt;
          &amp;lt;option value=&amp;quot;rename_existing&amp;quot;&amp;gt;rename the existing team and import&amp;lt;/option&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In '''team.rb'''&amp;lt;br&amp;gt;&lt;br /&gt;
In this file, the handling of the new tag &amp;quot;rename_existing&amp;quot; is added wherein, the old team is updated with a new name.&amp;lt;br&amp;gt;&lt;br /&gt;
    # E1938: Added handling for renaming old team when conflict arises&lt;br /&gt;
    if handle_dups == &amp;quot;rename_existing&amp;quot;&lt;br /&gt;
      if teamtype.is_a?(CourseTeam.class)&lt;br /&gt;
        team.update(name: self.generate_team_name(Course.find(id).name))&lt;br /&gt;
      elsif  teamtype.is_a?(AssignmentTeam.class)&lt;br /&gt;
        team.update(name: self.generate_team_name(Assignment.find(id).name))&lt;br /&gt;
      end&lt;br /&gt;
      return name&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The state of D before conflicting import:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E1938_Before_D_1.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
After fixing changes&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:After_D.PNG]]&lt;br /&gt;
[[File:After_old_team.PNG]]&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
As you can see the new team got the name D and the old file got renamed to Team_17.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Issue 153=====&lt;br /&gt;
'''Requirement''': There should be a way to import a list of who has signed up for which topic. When a signup sheet is used in Expertiza, users are expected to sign up for topics. But, the instructor might've taken signups offline, e.g., by passing around a signup sheet in class. There should be a way to import this list to Expertiza, rather than impersonate all the students one by one and sign them up for a topic. &lt;br /&gt;
&lt;br /&gt;
'''Solution''': We have modified the existing implementation for import topics to assign the teams to the topics. We have changed the files to handle another column where the teams have been assigned to topics. The column is optional because there might be topics that have not yet been assigned to any teams&lt;br /&gt;
&lt;br /&gt;
'''Expectations from the import file: &lt;br /&gt;
'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
* Assigned team name should exist in the system, otherwise the import will fail. Instructor has to make sure that the teams which are assigned in the import file should exist with same names in the system or database. &lt;br /&gt;
* Instructor also need to ensure that the topic for which the team is being assigned should not be full or can accommodate new team assignment to the respective topic. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''Code Changes:'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''import_file/_sign_up_topic.html.erb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
As there's already a screen with select options to map the columns with the fields for import. We are just adding another column so the best way is to extend the existing select tag with a new option for the teams assigned. All the select tags has been changed with an additional option &amp;quot;Assigned Team&amp;quot;. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
 &amp;lt;th&amp;gt;&lt;br /&gt;
            &amp;lt;select name=&amp;quot;select1&amp;quot; id=&amp;quot;select1&amp;quot; class=&amp;quot;form-control&amp;quot; style=&amp;quot;background-color:lightgrey&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;topic_identifier&amp;quot;&amp;gt;Topic Identifier (required)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;topic_name&amp;quot;&amp;gt;Topic Name (required)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;max_choosers&amp;quot;&amp;gt;Max Choosers (required)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;category&amp;quot;&amp;gt;Category (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;description&amp;quot;&amp;gt;Description (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;link&amp;quot;&amp;gt;Link (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;assigned_team&amp;quot;&amp;gt;Assigned Team (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
            &amp;lt;/select&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''model/sign_up_topic.rb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The existing import function in the model import the topics to the topic table. As per the requirement and validations, topic should be imported first and then only the team can be assigned to the topic. So the existing import method has been modified to assign the team once the topic is imported in the database table. As per the edge case mentioned in the requirement document that few topics may not have any team assigned to it, so we first check if topic has any team assigned, then only it tries to map the topic with the team. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
  def self.import(row_hash, session, _id = nil)&lt;br /&gt;
    if row_hash.length &amp;lt; 3&lt;br /&gt;
      raise ArgumentError, &amp;quot;The CSV File expects the format: Topic identifier, Topic name, Max choosers, Topic Category (optional), Topic Description (Optional), Topic Link (optional), Assigned Team Name (optional).&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
    topic = SignUpTopic.where(topic_name: row_hash[:topic_name], assignment_id: session[:assignment_id]).first&lt;br /&gt;
    if topic.nil?&lt;br /&gt;
      attributes = ImportTopicsHelper.define_attributes(row_hash)&lt;br /&gt;
      topic_new_id = ImportTopicsHelper.create_new_sign_up_topic(attributes, session)&lt;br /&gt;
      unless row_hash[:assigned_team].nil?&lt;br /&gt;
          team = Team.where(name: row_hash[:assigned_team]).first&lt;br /&gt;
          ImportTopicsHelper.assign_team_topic(topic_new_id, team.id)&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      topic.max_choosers = row_hash[:max_choosers]&lt;br /&gt;
      topic.topic_identifier = row_hash[:topic_identifier]&lt;br /&gt;
      topic.save&lt;br /&gt;
      unless row_hash[:assigned_team].nil?&lt;br /&gt;
        team = Team.where(name: row_hash[:assigned_team]).first&lt;br /&gt;
        newteam = SignedUpTeam.where(topic_id: topic.id, team_id: team.id).first&lt;br /&gt;
        if newteam.nil?&lt;br /&gt;
          ImportTopicsHelper.assign_team_topic(topic.id, team.id)&lt;br /&gt;
        else&lt;br /&gt;
          newteam.team_id = team.id&lt;br /&gt;
          newteam.save&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''helpers/import_topics_helper.rb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Having the assign_team_topic in the helper would organize the code but also in the unit testing. We can isolate the model logic and test this method separately by writing the test cases. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
  def self.assign_team_topic(topic_id, assigned_team)&lt;br /&gt;
    attributes = {}&lt;br /&gt;
    attributes[&amp;quot;topic_id&amp;quot;] = topic_id&lt;br /&gt;
    attributes[&amp;quot;team_id&amp;quot;] = assigned_team&lt;br /&gt;
    assign_team = SignedUpTeam.new(attributes)&lt;br /&gt;
    assign_team.save!&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
   def self.create_new_sign_up_topic(attributes, session)&lt;br /&gt;
     sign_up_topic = SignUpTopic.new(attributes)&lt;br /&gt;
     sign_up_topic.assignment_id = session[:assignment_id]&lt;br /&gt;
     sign_up_topic.save&lt;br /&gt;
     # sign_up_topic&lt;br /&gt;
     sign_up_topic.save!&lt;br /&gt;
     sign_up_topic.id&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''controllers/import_file_controller.rb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Existing implementation for import have many flaws and design issues. Most of the code has been written with nested if else, which is not the practice to be followed. Also the names of the fields have been hardcoded. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
As we cannot change the complete import implementation. So i had to use the existing one the way it is and make changes to extend the functionality. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    if (params[:assigned_team] == 'true')&lt;br /&gt;
        @optional_count += 1&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
    elsif params[:optional_count] == '4'&lt;br /&gt;
          new_header = [params[:select1], params[:select2], params[:select3], params[:select4], params[:select5], params[:select6], params[:select7]]&lt;br /&gt;
          @header_integrated_body = hash_rows_with_headers(new_header,contents_hash[:body])&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''views/sign_up_sheet/_add_topics.html.erb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
This code has been used to display the columns in the footer.As we already have implementation for other columns, so another column name 'Assigned Team' is added here in this part of the code. &lt;br /&gt;
        &amp;lt;%= link_to 'Import topics',&lt;br /&gt;
                {&lt;br /&gt;
                    :controller =&amp;gt; 'import_file',&lt;br /&gt;
                    :action =&amp;gt; 'start',&lt;br /&gt;
                    :model =&amp;gt; 'SignUpTopic',&lt;br /&gt;
                    :id =&amp;gt; params[:id],&lt;br /&gt;
                    :expected_fields =&amp;gt; 'Topic Identifier' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Name' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Max Choosers' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Category &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Description &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Link &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Assigned Team &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
An option column checkbox (Teams Assigned) has been added to the UI&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Issue153SS8.jpg]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
A new column Assigned Team is added where the columns are being mapped. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File: Issue153SS7.jpg]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Test Plan''' ==&lt;br /&gt;
*'''RSpec:'''&lt;br /&gt;
&lt;br /&gt;
::We have added new testcases for the new pieces of code that were added by us.&lt;br /&gt;
&lt;br /&gt;
::'''[Problem 3 (329)]'''&lt;br /&gt;
::::A new testcase was added to test this functionality. We use it to check if the older team gets the new name and the new team gets the requested name. This testcase runs when we run bundle exec for the '''teams_spec.rb'''&lt;br /&gt;
      # New team name should remain the same, the old one gets updated&lt;br /&gt;
      context 'when handle_dups option is rename_existing' do&lt;br /&gt;
        it 'returns new team name' do&lt;br /&gt;
          allow(Course).to receive(:find).with(1).and_return(double('Course', name: 'course 1'))&lt;br /&gt;
          allow(Team).to receive(:generate_team_name).with('course 1').and_return('new name of team')&lt;br /&gt;
          expect(Team.handle_duplicate(team, 'no name', 1, 'rename_existing', CourseTeam)).to eq('no name')&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
*'''UI Testing:'''&lt;br /&gt;
&lt;br /&gt;
::'''[Problem 1 (918)]'''&lt;br /&gt;
::::1. Login to Expertiza using username: instructor6 &amp;amp; password: password.&lt;br /&gt;
::::2. Go to Assignments and click on edit for any of the listed assignments.&lt;br /&gt;
::::3. Click on Topics tab.&lt;br /&gt;
::::4. Scroll down to the bottom of the page and click on Import topics.&lt;br /&gt;
::::5. Click on Topic Description checkbox and import the following file. (sample.csv) [[File:918_sample.csv]]&lt;br /&gt;
::::[[File:918_p1.png]]&lt;br /&gt;
::::6. Click on next and make the header for 4th column as 'Description' from the dropdown.&lt;br /&gt;
::::[[File:918_p2.png]]&lt;br /&gt;
::::7. Import topics.&lt;br /&gt;
::::8. After this, a new topic should be imported which can be viewed from the aforementioned Topics tab. This newly imported topic will not have any non-ascii characters.&lt;br /&gt;
&lt;br /&gt;
::'''[Problem 3 (329)]'''&lt;br /&gt;
::::1. Login to Expertiza using username: instructor6 &amp;amp; password: password.&lt;br /&gt;
::::2. Select Manage &amp;gt; Courses or Assignments &amp;gt; Add Teams button &amp;gt; Import Team&lt;br /&gt;
::::3. In the screen that loads, select &amp;quot;rename the existing team and import&amp;quot; in the handle conflicts section.&lt;br /&gt;
::::4. Upload a file with the team details and select the appropriate delimiter.&lt;br /&gt;
::::5. Click on Create&lt;br /&gt;
::::6. Verify that the new team got created with the assigned name and the older team's name got changed.&lt;br /&gt;
&lt;br /&gt;
::'''[Problem 4 (328)]'''&lt;br /&gt;
::::1. Login to Expertiza using username: instructor6 &amp;amp; password: password.&lt;br /&gt;
::::2. Select Manage &amp;gt; Courses or Assignments &amp;gt; Add Teams button &amp;gt; Import Team&lt;br /&gt;
::::3. In the screen that loads, select &amp;quot;Insert any new members into existing team&amp;quot; in the handle conflicts section.&lt;br /&gt;
::::4. Upload a file with the team details and select the appropriate delimiter.&lt;br /&gt;
::::5. Click on Create&lt;br /&gt;
::::6. Verify that the existing team got updated with the new team members&lt;br /&gt;
&lt;br /&gt;
== '''Possible Enhancements''' ==&lt;br /&gt;
&lt;br /&gt;
====='''Import functionality'''=====&lt;br /&gt;
&lt;br /&gt;
The existing import implementation does not follow DRY principle, rails code practices and even basic design principles. Most of the code is written based with nested if else conditions. This implementation can be improved. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Exception Handling: Before starting to work on this requirement. I tried few imports and in many cases, import was not successful and i was not able to figure out what's going wrong. My suggestion would be to develop a screen to show which rows were successfully imported and the failure reason which didn't. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Also, if there's no team in the system and instructor has used it in the import file so a new pop up can be displayed where the new team can be created or the import can be extended to create teams while assigning the topic. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1. Expertiza on GITHUB: https://github.com/expertiza/expertiza&lt;br /&gt;
&lt;br /&gt;
2. GitHub Project Repository Fork: https://github.com/NisargC/expertiza&lt;br /&gt;
&lt;br /&gt;
3. Demo link: http://152.46.19.138:8080/&lt;br /&gt;
&lt;br /&gt;
4. Expertiza project documentation wiki: http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2019_-_E1938._OSS_project_Duke_Blue:_Fix_import_glitches&lt;/div&gt;</summary>
		<author><name>Nmchoks2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1938._OSS_project_Duke_Blue:_Fix_import_glitches&amp;diff=127503</id>
		<title>CSC/ECE 517 Fall 2019 - E1938. OSS project Duke Blue: Fix import glitches</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1938._OSS_project_Duke_Blue:_Fix_import_glitches&amp;diff=127503"/>
		<updated>2019-11-06T23:15:10Z</updated>

		<summary type="html">&lt;p&gt;Nmchoks2: /* Issue 329 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
== '''About Expertiza''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source project based on Ruby on Rails framework and the code is available on Github. Expertiza allows the instructor to create new assignments as well as edit new or existing assignments. Instructors can also create a list of topics the students can sign up for and specify deadlines for completion of various tasks. Students can form teams in Expertiza to work on various projects and assignments as well as peer review other students' submissions. Expertiza supports submission across various document types, including the URLs Wiki pages.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
The import feature is the most helpful feature for instructors to set up assignments. The instructors usually have a list of students, teams, etc from their learning management system. Being able to import these into expertiza saves a lot of time when setting up an assignment. Unfortunately this feature has some bugs that were identified as the following list. &lt;br /&gt;
&lt;br /&gt;
'''Issue 918''': It seems that non-ASCII characters in the description (e.g., a curly apostrophe, and perhaps also an en-dash) caused a SQL error in inserting the description string into the db. I had to edit the import file to remove non-ASCII characters. Any Unicode character ought to be allowed in a description. &lt;br /&gt;
&lt;br /&gt;
'''Issue 153''': There should be a way to import a list of who has signed up for which topic. When a signup sheet is used in Expertiza, users are expected to sign up for topics. But, the instructor might've taken signups offline, e.g., by passing around a signup sheet in class. There should be a way to import this list to Expertiza, rather than impersonate all the students one by one and sign them up for a topic. '''This issue is not a bug but an additional feature to the existing import topic functionality.'''&lt;br /&gt;
&lt;br /&gt;
'''Issue 329''': When importing teams there are different options to handle conflicting team names &lt;br /&gt;
&lt;br /&gt;
'''Issue 328''': When importing teams, and a conflict exists there is an option to merge the two teams by inserting the new members into an existing team. Unfortunately, this feature is broken. we tried to import a team and selected 'Insert any new members into existing team'. No new team members were in fact inserted into the team&lt;br /&gt;
&lt;br /&gt;
== '''Fixes''' ==&lt;br /&gt;
=====Issue 918=====&lt;br /&gt;
&lt;br /&gt;
'''Problem:''' The application is not able to import topics with non ascii characters in its description field. &amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' Before the topic object is persisted into the database, check for any non ascii characters in the description field and strip them. &amp;lt;br&amp;gt;&lt;br /&gt;
'''Code Changes'''&amp;lt;br&amp;gt;&lt;br /&gt;
New code introduced is as follows.&amp;lt;br&amp;gt;&lt;br /&gt;
File:app/helpers/import_topics_helper.rb &amp;lt;br&amp;gt;&lt;br /&gt;
Here, a new function 'trim_non_ascii' has been added which iterates a given string character by character, and replaces each non ascii character with a white space character. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  def self.define_attributes(row_hash)&lt;br /&gt;
    attributes = {}&lt;br /&gt;
    if !row_hash[:description].nil? and !row_hash[:description].ascii_only?&lt;br /&gt;
      row_hash[:description] = self.trim_non_ascii(row_hash[:description])&lt;br /&gt;
      puts row_hash[:description]&lt;br /&gt;
    end&lt;br /&gt;
    attributes[&amp;quot;topic_identifier&amp;quot;] = row_hash[:topic_identifier].strip&lt;br /&gt;
    attributes[&amp;quot;topic_name&amp;quot;] = row_hash[:topic_name].strip&lt;br /&gt;
    attributes[&amp;quot;max_choosers&amp;quot;] = row_hash[:max_choosers].strip&lt;br /&gt;
    attributes&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def self.trim_non_ascii(string)&lt;br /&gt;
    string.split('').each do |char|&lt;br /&gt;
      !char.ascii_only? ? string.tr!(char, ' ') : nil&lt;br /&gt;
    end&lt;br /&gt;
    string.gsub!(/\s+/, ' ')&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
=====Issue 328=====&lt;br /&gt;
&lt;br /&gt;
'''Problem''': When importing teams, and a conflict exists there is an option to merge the two teams by inserting the new members into an existing team.&lt;br /&gt;
&lt;br /&gt;
'''Solution''': This was an issue to fix the functionality of Insert any new members into existing team. This was due to faulty handling of the option handle_dups and incorrect checking of parameters.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Code was modified to ensure minimal impact to existing testcases and functionalities.&amp;lt;br&amp;gt;&lt;br /&gt;
The handling of handle_dups in options was done assuming that the parameter was a symbol. But when tested, it was found to be a string and hence the handling was updated accordingly.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Code:&lt;br /&gt;
      name = handle_duplicate(team, name, id, options[&amp;quot;handle_dups&amp;quot;], teamtype)&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Also, the if and else conditions for checking class type of used was wrong. This was updated based on how the variable was assigned in the import_file_controller.rb#import_from_hash&lt;br /&gt;
Code:&lt;br /&gt;
      if(teamtype.is_a?(CourseTeam.class))&lt;br /&gt;
          ...&lt;br /&gt;
      elsif  teamtype.is_a?(AssignmentTeam.class)&lt;br /&gt;
          ...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E1938_Before_D.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
After fixing changes&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Insert_new_in_old.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Issue 329=====&lt;br /&gt;
&lt;br /&gt;
This was a request to add an option to rename existing team if there was a conflict in the team name.&amp;lt;br&amp;gt;&lt;br /&gt;
New code introduced was as follows:&amp;lt;br&amp;gt;&lt;br /&gt;
In start.html.erb&amp;lt;br&amp;gt;&lt;br /&gt;
In this file, the new option as displayed to the user is added&amp;lt;br&amp;gt;&lt;br /&gt;
          &amp;lt;option value=&amp;quot;rename_existing&amp;quot;&amp;gt;rename the existing team and import&amp;lt;/option&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In '''team.rb'''&amp;lt;br&amp;gt;&lt;br /&gt;
In this file, the handling of the new tag &amp;quot;rename_existing&amp;quot; is added wherein, the old team is updated with a new name.&amp;lt;br&amp;gt;&lt;br /&gt;
    # E1938: Added handling for renaming old team when conflict arises&lt;br /&gt;
    if handle_dups == &amp;quot;rename_existing&amp;quot;&lt;br /&gt;
      if teamtype.is_a?(CourseTeam.class)&lt;br /&gt;
        team.update(name: self.generate_team_name(Course.find(id).name))&lt;br /&gt;
      elsif  teamtype.is_a?(AssignmentTeam.class)&lt;br /&gt;
        team.update(name: self.generate_team_name(Assignment.find(id).name))&lt;br /&gt;
      end&lt;br /&gt;
      return name&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The state of D before conflicting import:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E1938_Before_D_1.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
After fixing changes&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:After_D.PNG]]&lt;br /&gt;
[[File:After_old_team.PNG]]&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
As you can see the new team got the name D and the old file got renamed to Team_17.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Issue 153=====&lt;br /&gt;
'''Requirement''': There should be a way to import a list of who has signed up for which topic. When a signup sheet is used in Expertiza, users are expected to sign up for topics. But, the instructor might've taken signups offline, e.g., by passing around a signup sheet in class. There should be a way to import this list to Expertiza, rather than impersonate all the students one by one and sign them up for a topic. &lt;br /&gt;
&lt;br /&gt;
'''Solution''': We have modified the existing implementation for import topics to assign the teams to the topics. We have changed the files to handle another column where the teams have been assigned to topics. The column is optional because there might be topics that have not yet been assigned to any teams&lt;br /&gt;
&lt;br /&gt;
'''Expectations from the import file: &lt;br /&gt;
'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
* Assigned team name should exist in the system, otherwise the import will fail. Instructor has to make sure that the teams which are assigned in the import file should exist with same names in the system or database. &lt;br /&gt;
* Instructor also need to ensure that the topic for which the team is being assigned should not be full or can accommodate new team assignment to the respective topic. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''Code Changes:'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''import_file/_sign_up_topic.html.erb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
As there's already a screen with select options to map the columns with the fields for import. We are just adding another column so the best way is to extend the existing select tag with a new option for the teams assigned. All the select tags has been changed with an additional option &amp;quot;Assigned Team&amp;quot;. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
 &amp;lt;th&amp;gt;&lt;br /&gt;
            &amp;lt;select name=&amp;quot;select1&amp;quot; id=&amp;quot;select1&amp;quot; class=&amp;quot;form-control&amp;quot; style=&amp;quot;background-color:lightgrey&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;topic_identifier&amp;quot;&amp;gt;Topic Identifier (required)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;topic_name&amp;quot;&amp;gt;Topic Name (required)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;max_choosers&amp;quot;&amp;gt;Max Choosers (required)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;category&amp;quot;&amp;gt;Category (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;description&amp;quot;&amp;gt;Description (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;link&amp;quot;&amp;gt;Link (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;assigned_team&amp;quot;&amp;gt;Assigned Team (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
            &amp;lt;/select&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''model/sign_up_topic.rb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The existing import function in the model import the topics to the topic table. As per the requirement and validations, topic should be imported first and then only the team can be assigned to the topic. So the existing import method has been modified to assign the team once the topic is imported in the database table. As per the edge case mentioned in the requirement document that few topics may not have any team assigned to it, so we first check if topic has any team assigned, then only it tries to map the topic with the team. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
  def self.import(row_hash, session, _id = nil)&lt;br /&gt;
    if row_hash.length &amp;lt; 3&lt;br /&gt;
      raise ArgumentError, &amp;quot;The CSV File expects the format: Topic identifier, Topic name, Max choosers, Topic Category (optional), Topic Description (Optional), Topic Link (optional), Assigned Team Name (optional).&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
    topic = SignUpTopic.where(topic_name: row_hash[:topic_name], assignment_id: session[:assignment_id]).first&lt;br /&gt;
    if topic.nil?&lt;br /&gt;
      attributes = ImportTopicsHelper.define_attributes(row_hash)&lt;br /&gt;
      topic_new_id = ImportTopicsHelper.create_new_sign_up_topic(attributes, session)&lt;br /&gt;
      unless row_hash[:assigned_team].nil?&lt;br /&gt;
          team = Team.where(name: row_hash[:assigned_team]).first&lt;br /&gt;
          ImportTopicsHelper.assign_team_topic(topic_new_id, team.id)&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      topic.max_choosers = row_hash[:max_choosers]&lt;br /&gt;
      topic.topic_identifier = row_hash[:topic_identifier]&lt;br /&gt;
      topic.save&lt;br /&gt;
      unless row_hash[:assigned_team].nil?&lt;br /&gt;
        team = Team.where(name: row_hash[:assigned_team]).first&lt;br /&gt;
        newteam = SignedUpTeam.where(topic_id: topic.id, team_id: team.id).first&lt;br /&gt;
        if newteam.nil?&lt;br /&gt;
          ImportTopicsHelper.assign_team_topic(topic.id, team.id)&lt;br /&gt;
        else&lt;br /&gt;
          newteam.team_id = team.id&lt;br /&gt;
          newteam.save&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''helpers/import_topics_helper.rb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Having the assign_team_topic in the helper would organize the code but also in the unit testing. We can isolate the model logic and test this method separately by writing the test cases. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
  def self.assign_team_topic(topic_id, assigned_team)&lt;br /&gt;
    attributes = {}&lt;br /&gt;
    attributes[&amp;quot;topic_id&amp;quot;] = topic_id&lt;br /&gt;
    attributes[&amp;quot;team_id&amp;quot;] = assigned_team&lt;br /&gt;
    assign_team = SignedUpTeam.new(attributes)&lt;br /&gt;
    assign_team.save!&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
   def self.create_new_sign_up_topic(attributes, session)&lt;br /&gt;
     sign_up_topic = SignUpTopic.new(attributes)&lt;br /&gt;
     sign_up_topic.assignment_id = session[:assignment_id]&lt;br /&gt;
     sign_up_topic.save&lt;br /&gt;
     # sign_up_topic&lt;br /&gt;
     sign_up_topic.save!&lt;br /&gt;
     sign_up_topic.id&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''controllers/import_file_controller.rb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Existing implementation for import have many flaws and design issues. Most of the code has been written with nested if else, which is not the practice to be followed. Also the names of the fields have been hardcoded. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
As we cannot change the complete import implementation. So i had to use the existing one the way it is and make changes to extend the functionality. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    if (params[:assigned_team] == 'true')&lt;br /&gt;
        @optional_count += 1&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
    elsif params[:optional_count] == '4'&lt;br /&gt;
          new_header = [params[:select1], params[:select2], params[:select3], params[:select4], params[:select5], params[:select6], params[:select7]]&lt;br /&gt;
          @header_integrated_body = hash_rows_with_headers(new_header,contents_hash[:body])&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''views/sign_up_sheet/_add_topics.html.erb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
This code has been used to display the columns in the footer.As we already have implementation for other columns, so another column name 'Assigned Team' is added here in this part of the code. &lt;br /&gt;
        &amp;lt;%= link_to 'Import topics',&lt;br /&gt;
                {&lt;br /&gt;
                    :controller =&amp;gt; 'import_file',&lt;br /&gt;
                    :action =&amp;gt; 'start',&lt;br /&gt;
                    :model =&amp;gt; 'SignUpTopic',&lt;br /&gt;
                    :id =&amp;gt; params[:id],&lt;br /&gt;
                    :expected_fields =&amp;gt; 'Topic Identifier' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Name' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Max Choosers' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Category &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Description &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Link &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Assigned Team &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
An option column checkbox (Teams Assigned) has been added to the UI&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Issue153SS8.jpg]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
A new column Assigned Team is added where the columns are being mapped. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File: Issue153SS7.jpg]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Test Plan''' ==&lt;br /&gt;
*'''RSpec:'''&lt;br /&gt;
&lt;br /&gt;
::We have added new testcases for the new pieces of code that were added by us.&lt;br /&gt;
&lt;br /&gt;
::'''[Problem 3 (329)]'''&lt;br /&gt;
::::A new testcase was added to test this functionality. We use it to check if the older team gets the new name and the new team gets the requested name. This testcase runs when we run bundle exec for the '''teams_spec.rb'''&lt;br /&gt;
      # New team name should remain the same, the old one gets updated&lt;br /&gt;
      context 'when handle_dups option is rename_existing' do&lt;br /&gt;
        it 'returns new team name' do&lt;br /&gt;
          allow(Course).to receive(:find).with(1).and_return(double('Course', name: 'course 1'))&lt;br /&gt;
          allow(Team).to receive(:generate_team_name).with('course 1').and_return('new name of team')&lt;br /&gt;
          expect(Team.handle_duplicate(team, 'no name', 1, 'rename_existing', CourseTeam)).to eq('no name')&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
*'''UI Testing:'''&lt;br /&gt;
&lt;br /&gt;
::'''[Problem 1 (918)]'''&lt;br /&gt;
::::1. Login to Expertiza using username: instructor6 &amp;amp; password: password.&lt;br /&gt;
::::2. Go to Assignments and click on edit for any of the listed assignments.&lt;br /&gt;
::::3. Click on Topics tab.&lt;br /&gt;
::::4. Scroll down to the bottom of the page and click on Import topics.&lt;br /&gt;
::::5. Click on Topic Description checkbox and import the following file. (sample.csv)&lt;br /&gt;
::::[[File:918_p1.png]]&lt;br /&gt;
::::6. Click on next and make the header for 4th column as 'Description' from the dropdown.&lt;br /&gt;
::::[[File:918_p2.png]]&lt;br /&gt;
::::7. Import topics.&lt;br /&gt;
::::8. After this, a new topic should be imported which can be viewed from the aforementioned Topics tab. This newly imported topic will not have any non-ascii characters.&lt;br /&gt;
&lt;br /&gt;
::'''[Problem 3 (329)]'''&lt;br /&gt;
::::1. Login to Expertiza using username: instructor6 &amp;amp; password: password.&lt;br /&gt;
::::2. Select Manage &amp;gt; Courses or Assignments &amp;gt; Add Teams button &amp;gt; Import Team&lt;br /&gt;
::::3. In the screen that loads, select &amp;quot;rename the existing team and import&amp;quot; in the handle conflicts section.&lt;br /&gt;
::::4. Upload a file with the team details and select the appropriate delimiter.&lt;br /&gt;
::::5. Click on Create&lt;br /&gt;
::::6. Verify that the new team got created with the assigned name and the older team's name got changed.&lt;br /&gt;
&lt;br /&gt;
::'''[Problem 4 (328)]'''&lt;br /&gt;
::::1. Login to Expertiza using username: instructor6 &amp;amp; password: password.&lt;br /&gt;
::::2. Select Manage &amp;gt; Courses or Assignments &amp;gt; Add Teams button &amp;gt; Import Team&lt;br /&gt;
::::3. In the screen that loads, select &amp;quot;Insert any new members into existing team&amp;quot; in the handle conflicts section.&lt;br /&gt;
::::4. Upload a file with the team details and select the appropriate delimiter.&lt;br /&gt;
::::5. Click on Create&lt;br /&gt;
::::6. Verify that the existing team got updated with the new team members&lt;br /&gt;
&lt;br /&gt;
== '''Possible Enhancements''' ==&lt;br /&gt;
&lt;br /&gt;
====='''Import functionality'''=====&lt;br /&gt;
&lt;br /&gt;
The existing import implementation does not follow DRY principle, rails code practices and even basic design principles. Most of the code is written based with nested if else conditions. This implementation can be improved. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Exception Handling: Before starting to work on this requirement. I tried few imports and in many cases, import was not successful and i was not able to figure out what's going wrong. My suggestion would be to develop a screen to show which rows were successfully imported and the failure reason which didn't. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Also, if there's no team in the system and instructor has used it in the import file so a new pop up can be displayed where the new team can be created or the import can be extended to create teams while assigning the topic. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1. Expertiza on GITHUB: https://github.com/expertiza/expertiza&lt;br /&gt;
&lt;br /&gt;
2. GitHub Project Repository Fork: https://github.com/NisargC/expertiza&lt;br /&gt;
&lt;br /&gt;
3. Demo link: http://152.46.19.138:8080/&lt;br /&gt;
&lt;br /&gt;
4. Expertiza project documentation wiki: http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2019_-_E1938._OSS_project_Duke_Blue:_Fix_import_glitches&lt;/div&gt;</summary>
		<author><name>Nmchoks2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1938._OSS_project_Duke_Blue:_Fix_import_glitches&amp;diff=127502</id>
		<title>CSC/ECE 517 Fall 2019 - E1938. OSS project Duke Blue: Fix import glitches</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1938._OSS_project_Duke_Blue:_Fix_import_glitches&amp;diff=127502"/>
		<updated>2019-11-06T23:14:00Z</updated>

		<summary type="html">&lt;p&gt;Nmchoks2: /* Test Plan */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
== '''About Expertiza''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source project based on Ruby on Rails framework and the code is available on Github. Expertiza allows the instructor to create new assignments as well as edit new or existing assignments. Instructors can also create a list of topics the students can sign up for and specify deadlines for completion of various tasks. Students can form teams in Expertiza to work on various projects and assignments as well as peer review other students' submissions. Expertiza supports submission across various document types, including the URLs Wiki pages.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
The import feature is the most helpful feature for instructors to set up assignments. The instructors usually have a list of students, teams, etc from their learning management system. Being able to import these into expertiza saves a lot of time when setting up an assignment. Unfortunately this feature has some bugs that were identified as the following list. &lt;br /&gt;
&lt;br /&gt;
'''Issue 918''': It seems that non-ASCII characters in the description (e.g., a curly apostrophe, and perhaps also an en-dash) caused a SQL error in inserting the description string into the db. I had to edit the import file to remove non-ASCII characters. Any Unicode character ought to be allowed in a description. &lt;br /&gt;
&lt;br /&gt;
'''Issue 153''': There should be a way to import a list of who has signed up for which topic. When a signup sheet is used in Expertiza, users are expected to sign up for topics. But, the instructor might've taken signups offline, e.g., by passing around a signup sheet in class. There should be a way to import this list to Expertiza, rather than impersonate all the students one by one and sign them up for a topic. '''This issue is not a bug but an additional feature to the existing import topic functionality.'''&lt;br /&gt;
&lt;br /&gt;
'''Issue 329''': When importing teams there are different options to handle conflicting team names &lt;br /&gt;
&lt;br /&gt;
'''Issue 328''': When importing teams, and a conflict exists there is an option to merge the two teams by inserting the new members into an existing team. Unfortunately, this feature is broken. we tried to import a team and selected 'Insert any new members into existing team'. No new team members were in fact inserted into the team&lt;br /&gt;
&lt;br /&gt;
== '''Fixes''' ==&lt;br /&gt;
=====Issue 918=====&lt;br /&gt;
&lt;br /&gt;
'''Problem:''' The application is not able to import topics with non ascii characters in its description field. &amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' Before the topic object is persisted into the database, check for any non ascii characters in the description field and strip them. &amp;lt;br&amp;gt;&lt;br /&gt;
'''Code Changes'''&amp;lt;br&amp;gt;&lt;br /&gt;
New code introduced is as follows.&amp;lt;br&amp;gt;&lt;br /&gt;
File:app/helpers/import_topics_helper.rb &amp;lt;br&amp;gt;&lt;br /&gt;
Here, a new function 'trim_non_ascii' has been added which iterates a given string character by character, and replaces each non ascii character with a white space character. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  def self.define_attributes(row_hash)&lt;br /&gt;
    attributes = {}&lt;br /&gt;
    if !row_hash[:description].nil? and !row_hash[:description].ascii_only?&lt;br /&gt;
      row_hash[:description] = self.trim_non_ascii(row_hash[:description])&lt;br /&gt;
      puts row_hash[:description]&lt;br /&gt;
    end&lt;br /&gt;
    attributes[&amp;quot;topic_identifier&amp;quot;] = row_hash[:topic_identifier].strip&lt;br /&gt;
    attributes[&amp;quot;topic_name&amp;quot;] = row_hash[:topic_name].strip&lt;br /&gt;
    attributes[&amp;quot;max_choosers&amp;quot;] = row_hash[:max_choosers].strip&lt;br /&gt;
    attributes&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def self.trim_non_ascii(string)&lt;br /&gt;
    string.split('').each do |char|&lt;br /&gt;
      !char.ascii_only? ? string.tr!(char, ' ') : nil&lt;br /&gt;
    end&lt;br /&gt;
    string.gsub!(/\s+/, ' ')&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
=====Issue 328=====&lt;br /&gt;
&lt;br /&gt;
'''Problem''': When importing teams, and a conflict exists there is an option to merge the two teams by inserting the new members into an existing team.&lt;br /&gt;
&lt;br /&gt;
'''Solution''': This was an issue to fix the functionality of Insert any new members into existing team. This was due to faulty handling of the option handle_dups and incorrect checking of parameters.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Code was modified to ensure minimal impact to existing testcases and functionalities.&amp;lt;br&amp;gt;&lt;br /&gt;
The handling of handle_dups in options was done assuming that the parameter was a symbol. But when tested, it was found to be a string and hence the handling was updated accordingly.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Code:&lt;br /&gt;
      name = handle_duplicate(team, name, id, options[&amp;quot;handle_dups&amp;quot;], teamtype)&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Also, the if and else conditions for checking class type of used was wrong. This was updated based on how the variable was assigned in the import_file_controller.rb#import_from_hash&lt;br /&gt;
Code:&lt;br /&gt;
      if(teamtype.is_a?(CourseTeam.class))&lt;br /&gt;
          ...&lt;br /&gt;
      elsif  teamtype.is_a?(AssignmentTeam.class)&lt;br /&gt;
          ...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E1938_Before_D.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
After fixing changes&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Insert_new_in_old.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Issue 329=====&lt;br /&gt;
&lt;br /&gt;
This was a request to add an option to rename existing team if there was a conflict in the team name.&amp;lt;br&amp;gt;&lt;br /&gt;
New code introduced was as follows:&amp;lt;br&amp;gt;&lt;br /&gt;
In start.html.erb&amp;lt;br&amp;gt;&lt;br /&gt;
In this file, the new option as displayed to the user is added&amp;lt;br&amp;gt;&lt;br /&gt;
          &amp;lt;option value=&amp;quot;rename_existing&amp;quot;&amp;gt;rename the existing team and import&amp;lt;/option&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In team.rb&amp;lt;br&amp;gt;&lt;br /&gt;
In this file, the handling of the new tag &amp;quot;rename_existing&amp;quot; is added wherein, the old team is updated with a new name.&amp;lt;br&amp;gt;&lt;br /&gt;
    # E1938: Added handling for renaming old team when conflict arises&lt;br /&gt;
    if handle_dups == &amp;quot;rename_existing&amp;quot;&lt;br /&gt;
      if teamtype.is_a?(CourseTeam.class)&lt;br /&gt;
        team.update(name: self.generate_team_name(Course.find(id).name))&lt;br /&gt;
      elsif  teamtype.is_a?(AssignmentTeam.class)&lt;br /&gt;
        team.update(name: self.generate_team_name(Assignment.find(id).name))&lt;br /&gt;
      end&lt;br /&gt;
      return name&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The state of D before conflicting import:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E1938_Before_D_1.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
After fixing changes&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:After_D.PNG]]&lt;br /&gt;
[[File:After_old_team.PNG]]&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
As you can see the new team got the name D and the old file got renamed to Team_17.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Issue 153=====&lt;br /&gt;
'''Requirement''': There should be a way to import a list of who has signed up for which topic. When a signup sheet is used in Expertiza, users are expected to sign up for topics. But, the instructor might've taken signups offline, e.g., by passing around a signup sheet in class. There should be a way to import this list to Expertiza, rather than impersonate all the students one by one and sign them up for a topic. &lt;br /&gt;
&lt;br /&gt;
'''Solution''': We have modified the existing implementation for import topics to assign the teams to the topics. We have changed the files to handle another column where the teams have been assigned to topics. The column is optional because there might be topics that have not yet been assigned to any teams&lt;br /&gt;
&lt;br /&gt;
'''Expectations from the import file: &lt;br /&gt;
'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
* Assigned team name should exist in the system, otherwise the import will fail. Instructor has to make sure that the teams which are assigned in the import file should exist with same names in the system or database. &lt;br /&gt;
* Instructor also need to ensure that the topic for which the team is being assigned should not be full or can accommodate new team assignment to the respective topic. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''Code Changes:'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''import_file/_sign_up_topic.html.erb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
As there's already a screen with select options to map the columns with the fields for import. We are just adding another column so the best way is to extend the existing select tag with a new option for the teams assigned. All the select tags has been changed with an additional option &amp;quot;Assigned Team&amp;quot;. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
 &amp;lt;th&amp;gt;&lt;br /&gt;
            &amp;lt;select name=&amp;quot;select1&amp;quot; id=&amp;quot;select1&amp;quot; class=&amp;quot;form-control&amp;quot; style=&amp;quot;background-color:lightgrey&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;topic_identifier&amp;quot;&amp;gt;Topic Identifier (required)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;topic_name&amp;quot;&amp;gt;Topic Name (required)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;max_choosers&amp;quot;&amp;gt;Max Choosers (required)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;category&amp;quot;&amp;gt;Category (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;description&amp;quot;&amp;gt;Description (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;link&amp;quot;&amp;gt;Link (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;assigned_team&amp;quot;&amp;gt;Assigned Team (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
            &amp;lt;/select&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''model/sign_up_topic.rb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The existing import function in the model import the topics to the topic table. As per the requirement and validations, topic should be imported first and then only the team can be assigned to the topic. So the existing import method has been modified to assign the team once the topic is imported in the database table. As per the edge case mentioned in the requirement document that few topics may not have any team assigned to it, so we first check if topic has any team assigned, then only it tries to map the topic with the team. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
  def self.import(row_hash, session, _id = nil)&lt;br /&gt;
    if row_hash.length &amp;lt; 3&lt;br /&gt;
      raise ArgumentError, &amp;quot;The CSV File expects the format: Topic identifier, Topic name, Max choosers, Topic Category (optional), Topic Description (Optional), Topic Link (optional), Assigned Team Name (optional).&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
    topic = SignUpTopic.where(topic_name: row_hash[:topic_name], assignment_id: session[:assignment_id]).first&lt;br /&gt;
    if topic.nil?&lt;br /&gt;
      attributes = ImportTopicsHelper.define_attributes(row_hash)&lt;br /&gt;
      topic_new_id = ImportTopicsHelper.create_new_sign_up_topic(attributes, session)&lt;br /&gt;
      unless row_hash[:assigned_team].nil?&lt;br /&gt;
          team = Team.where(name: row_hash[:assigned_team]).first&lt;br /&gt;
          ImportTopicsHelper.assign_team_topic(topic_new_id, team.id)&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      topic.max_choosers = row_hash[:max_choosers]&lt;br /&gt;
      topic.topic_identifier = row_hash[:topic_identifier]&lt;br /&gt;
      topic.save&lt;br /&gt;
      unless row_hash[:assigned_team].nil?&lt;br /&gt;
        team = Team.where(name: row_hash[:assigned_team]).first&lt;br /&gt;
        newteam = SignedUpTeam.where(topic_id: topic.id, team_id: team.id).first&lt;br /&gt;
        if newteam.nil?&lt;br /&gt;
          ImportTopicsHelper.assign_team_topic(topic.id, team.id)&lt;br /&gt;
        else&lt;br /&gt;
          newteam.team_id = team.id&lt;br /&gt;
          newteam.save&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''helpers/import_topics_helper.rb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Having the assign_team_topic in the helper would organize the code but also in the unit testing. We can isolate the model logic and test this method separately by writing the test cases. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
  def self.assign_team_topic(topic_id, assigned_team)&lt;br /&gt;
    attributes = {}&lt;br /&gt;
    attributes[&amp;quot;topic_id&amp;quot;] = topic_id&lt;br /&gt;
    attributes[&amp;quot;team_id&amp;quot;] = assigned_team&lt;br /&gt;
    assign_team = SignedUpTeam.new(attributes)&lt;br /&gt;
    assign_team.save!&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
   def self.create_new_sign_up_topic(attributes, session)&lt;br /&gt;
     sign_up_topic = SignUpTopic.new(attributes)&lt;br /&gt;
     sign_up_topic.assignment_id = session[:assignment_id]&lt;br /&gt;
     sign_up_topic.save&lt;br /&gt;
     # sign_up_topic&lt;br /&gt;
     sign_up_topic.save!&lt;br /&gt;
     sign_up_topic.id&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''controllers/import_file_controller.rb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Existing implementation for import have many flaws and design issues. Most of the code has been written with nested if else, which is not the practice to be followed. Also the names of the fields have been hardcoded. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
As we cannot change the complete import implementation. So i had to use the existing one the way it is and make changes to extend the functionality. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    if (params[:assigned_team] == 'true')&lt;br /&gt;
        @optional_count += 1&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
    elsif params[:optional_count] == '4'&lt;br /&gt;
          new_header = [params[:select1], params[:select2], params[:select3], params[:select4], params[:select5], params[:select6], params[:select7]]&lt;br /&gt;
          @header_integrated_body = hash_rows_with_headers(new_header,contents_hash[:body])&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''views/sign_up_sheet/_add_topics.html.erb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
This code has been used to display the columns in the footer.As we already have implementation for other columns, so another column name 'Assigned Team' is added here in this part of the code. &lt;br /&gt;
        &amp;lt;%= link_to 'Import topics',&lt;br /&gt;
                {&lt;br /&gt;
                    :controller =&amp;gt; 'import_file',&lt;br /&gt;
                    :action =&amp;gt; 'start',&lt;br /&gt;
                    :model =&amp;gt; 'SignUpTopic',&lt;br /&gt;
                    :id =&amp;gt; params[:id],&lt;br /&gt;
                    :expected_fields =&amp;gt; 'Topic Identifier' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Name' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Max Choosers' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Category &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Description &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Link &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Assigned Team &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
An option column checkbox (Teams Assigned) has been added to the UI&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Issue153SS8.jpg]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
A new column Assigned Team is added where the columns are being mapped. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File: Issue153SS7.jpg]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Test Plan''' ==&lt;br /&gt;
*'''RSpec:'''&lt;br /&gt;
&lt;br /&gt;
::We have added new testcases for the new pieces of code that were added by us.&lt;br /&gt;
&lt;br /&gt;
::'''[Problem 3 (329)]'''&lt;br /&gt;
::::A new testcase was added to test this functionality. We use it to check if the older team gets the new name and the new team gets the requested name. This testcase runs when we run bundle exec for the '''teams_spec.rb'''&lt;br /&gt;
      # New team name should remain the same, the old one gets updated&lt;br /&gt;
      context 'when handle_dups option is rename_existing' do&lt;br /&gt;
        it 'returns new team name' do&lt;br /&gt;
          allow(Course).to receive(:find).with(1).and_return(double('Course', name: 'course 1'))&lt;br /&gt;
          allow(Team).to receive(:generate_team_name).with('course 1').and_return('new name of team')&lt;br /&gt;
          expect(Team.handle_duplicate(team, 'no name', 1, 'rename_existing', CourseTeam)).to eq('no name')&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
*'''UI Testing:'''&lt;br /&gt;
&lt;br /&gt;
::'''[Problem 1 (918)]'''&lt;br /&gt;
::::1. Login to Expertiza using username: instructor6 &amp;amp; password: password.&lt;br /&gt;
::::2. Go to Assignments and click on edit for any of the listed assignments.&lt;br /&gt;
::::3. Click on Topics tab.&lt;br /&gt;
::::4. Scroll down to the bottom of the page and click on Import topics.&lt;br /&gt;
::::5. Click on Topic Description checkbox and import the following file. (sample.csv)&lt;br /&gt;
::::[[File:918_p1.png]]&lt;br /&gt;
::::6. Click on next and make the header for 4th column as 'Description' from the dropdown.&lt;br /&gt;
::::[[File:918_p2.png]]&lt;br /&gt;
::::7. Import topics.&lt;br /&gt;
::::8. After this, a new topic should be imported which can be viewed from the aforementioned Topics tab. This newly imported topic will not have any non-ascii characters.&lt;br /&gt;
&lt;br /&gt;
::'''[Problem 3 (329)]'''&lt;br /&gt;
::::1. Login to Expertiza using username: instructor6 &amp;amp; password: password.&lt;br /&gt;
::::2. Select Manage &amp;gt; Courses or Assignments &amp;gt; Add Teams button &amp;gt; Import Team&lt;br /&gt;
::::3. In the screen that loads, select &amp;quot;rename the existing team and import&amp;quot; in the handle conflicts section.&lt;br /&gt;
::::4. Upload a file with the team details and select the appropriate delimiter.&lt;br /&gt;
::::5. Click on Create&lt;br /&gt;
::::6. Verify that the new team got created with the assigned name and the older team's name got changed.&lt;br /&gt;
&lt;br /&gt;
::'''[Problem 4 (328)]'''&lt;br /&gt;
::::1. Login to Expertiza using username: instructor6 &amp;amp; password: password.&lt;br /&gt;
::::2. Select Manage &amp;gt; Courses or Assignments &amp;gt; Add Teams button &amp;gt; Import Team&lt;br /&gt;
::::3. In the screen that loads, select &amp;quot;Insert any new members into existing team&amp;quot; in the handle conflicts section.&lt;br /&gt;
::::4. Upload a file with the team details and select the appropriate delimiter.&lt;br /&gt;
::::5. Click on Create&lt;br /&gt;
::::6. Verify that the existing team got updated with the new team members&lt;br /&gt;
&lt;br /&gt;
== '''Possible Enhancements''' ==&lt;br /&gt;
&lt;br /&gt;
====='''Import functionality'''=====&lt;br /&gt;
&lt;br /&gt;
The existing import implementation does not follow DRY principle, rails code practices and even basic design principles. Most of the code is written based with nested if else conditions. This implementation can be improved. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Exception Handling: Before starting to work on this requirement. I tried few imports and in many cases, import was not successful and i was not able to figure out what's going wrong. My suggestion would be to develop a screen to show which rows were successfully imported and the failure reason which didn't. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Also, if there's no team in the system and instructor has used it in the import file so a new pop up can be displayed where the new team can be created or the import can be extended to create teams while assigning the topic. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1. Expertiza on GITHUB: https://github.com/expertiza/expertiza&lt;br /&gt;
&lt;br /&gt;
2. GitHub Project Repository Fork: https://github.com/NisargC/expertiza&lt;br /&gt;
&lt;br /&gt;
3. Demo link: http://152.46.19.138:8080/&lt;br /&gt;
&lt;br /&gt;
4. Expertiza project documentation wiki: http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2019_-_E1938._OSS_project_Duke_Blue:_Fix_import_glitches&lt;/div&gt;</summary>
		<author><name>Nmchoks2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1938._OSS_project_Duke_Blue:_Fix_import_glitches&amp;diff=127500</id>
		<title>CSC/ECE 517 Fall 2019 - E1938. OSS project Duke Blue: Fix import glitches</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1938._OSS_project_Duke_Blue:_Fix_import_glitches&amp;diff=127500"/>
		<updated>2019-11-06T23:12:09Z</updated>

		<summary type="html">&lt;p&gt;Nmchoks2: /* Test Plan */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
== '''About Expertiza''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source project based on Ruby on Rails framework and the code is available on Github. Expertiza allows the instructor to create new assignments as well as edit new or existing assignments. Instructors can also create a list of topics the students can sign up for and specify deadlines for completion of various tasks. Students can form teams in Expertiza to work on various projects and assignments as well as peer review other students' submissions. Expertiza supports submission across various document types, including the URLs Wiki pages.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
The import feature is the most helpful feature for instructors to set up assignments. The instructors usually have a list of students, teams, etc from their learning management system. Being able to import these into expertiza saves a lot of time when setting up an assignment. Unfortunately this feature has some bugs that were identified as the following list. &lt;br /&gt;
&lt;br /&gt;
'''Issue 918''': It seems that non-ASCII characters in the description (e.g., a curly apostrophe, and perhaps also an en-dash) caused a SQL error in inserting the description string into the db. I had to edit the import file to remove non-ASCII characters. Any Unicode character ought to be allowed in a description. &lt;br /&gt;
&lt;br /&gt;
'''Issue 153''': There should be a way to import a list of who has signed up for which topic. When a signup sheet is used in Expertiza, users are expected to sign up for topics. But, the instructor might've taken signups offline, e.g., by passing around a signup sheet in class. There should be a way to import this list to Expertiza, rather than impersonate all the students one by one and sign them up for a topic. '''This issue is not a bug but an additional feature to the existing import topic functionality.'''&lt;br /&gt;
&lt;br /&gt;
'''Issue 329''': When importing teams there are different options to handle conflicting team names &lt;br /&gt;
&lt;br /&gt;
'''Issue 328''': When importing teams, and a conflict exists there is an option to merge the two teams by inserting the new members into an existing team. Unfortunately, this feature is broken. we tried to import a team and selected 'Insert any new members into existing team'. No new team members were in fact inserted into the team&lt;br /&gt;
&lt;br /&gt;
== '''Fixes''' ==&lt;br /&gt;
=====Issue 918=====&lt;br /&gt;
&lt;br /&gt;
'''Problem:''' The application is not able to import topics with non ascii characters in its description field. &amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' Before the topic object is persisted into the database, check for any non ascii characters in the description field and strip them. &amp;lt;br&amp;gt;&lt;br /&gt;
'''Code Changes'''&amp;lt;br&amp;gt;&lt;br /&gt;
New code introduced is as follows.&amp;lt;br&amp;gt;&lt;br /&gt;
File:app/helpers/import_topics_helper.rb &amp;lt;br&amp;gt;&lt;br /&gt;
Here, a new function 'trim_non_ascii' has been added which iterates a given string character by character, and replaces each non ascii character with a white space character. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  def self.define_attributes(row_hash)&lt;br /&gt;
    attributes = {}&lt;br /&gt;
    if !row_hash[:description].nil? and !row_hash[:description].ascii_only?&lt;br /&gt;
      row_hash[:description] = self.trim_non_ascii(row_hash[:description])&lt;br /&gt;
      puts row_hash[:description]&lt;br /&gt;
    end&lt;br /&gt;
    attributes[&amp;quot;topic_identifier&amp;quot;] = row_hash[:topic_identifier].strip&lt;br /&gt;
    attributes[&amp;quot;topic_name&amp;quot;] = row_hash[:topic_name].strip&lt;br /&gt;
    attributes[&amp;quot;max_choosers&amp;quot;] = row_hash[:max_choosers].strip&lt;br /&gt;
    attributes&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def self.trim_non_ascii(string)&lt;br /&gt;
    string.split('').each do |char|&lt;br /&gt;
      !char.ascii_only? ? string.tr!(char, ' ') : nil&lt;br /&gt;
    end&lt;br /&gt;
    string.gsub!(/\s+/, ' ')&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
=====Issue 328=====&lt;br /&gt;
&lt;br /&gt;
'''Problem''': When importing teams, and a conflict exists there is an option to merge the two teams by inserting the new members into an existing team.&lt;br /&gt;
&lt;br /&gt;
'''Solution''': This was an issue to fix the functionality of Insert any new members into existing team. This was due to faulty handling of the option handle_dups and incorrect checking of parameters.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Code was modified to ensure minimal impact to existing testcases and functionalities.&amp;lt;br&amp;gt;&lt;br /&gt;
The handling of handle_dups in options was done assuming that the parameter was a symbol. But when tested, it was found to be a string and hence the handling was updated accordingly.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Code:&lt;br /&gt;
      name = handle_duplicate(team, name, id, options[&amp;quot;handle_dups&amp;quot;], teamtype)&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Also, the if and else conditions for checking class type of used was wrong. This was updated based on how the variable was assigned in the import_file_controller.rb#import_from_hash&lt;br /&gt;
Code:&lt;br /&gt;
      if(teamtype.is_a?(CourseTeam.class))&lt;br /&gt;
          ...&lt;br /&gt;
      elsif  teamtype.is_a?(AssignmentTeam.class)&lt;br /&gt;
          ...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E1938_Before_D.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
After fixing changes&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Insert_new_in_old.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Issue 329=====&lt;br /&gt;
&lt;br /&gt;
This was a request to add an option to rename existing team if there was a conflict in the team name.&amp;lt;br&amp;gt;&lt;br /&gt;
New code introduced was as follows:&amp;lt;br&amp;gt;&lt;br /&gt;
In start.html.erb&amp;lt;br&amp;gt;&lt;br /&gt;
In this file, the new option as displayed to the user is added&amp;lt;br&amp;gt;&lt;br /&gt;
          &amp;lt;option value=&amp;quot;rename_existing&amp;quot;&amp;gt;rename the existing team and import&amp;lt;/option&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In team.rb&amp;lt;br&amp;gt;&lt;br /&gt;
In this file, the handling of the new tag &amp;quot;rename_existing&amp;quot; is added wherein, the old team is updated with a new name.&amp;lt;br&amp;gt;&lt;br /&gt;
    # E1938: Added handling for renaming old team when conflict arises&lt;br /&gt;
    if handle_dups == &amp;quot;rename_existing&amp;quot;&lt;br /&gt;
      if teamtype.is_a?(CourseTeam.class)&lt;br /&gt;
        team.update(name: self.generate_team_name(Course.find(id).name))&lt;br /&gt;
      elsif  teamtype.is_a?(AssignmentTeam.class)&lt;br /&gt;
        team.update(name: self.generate_team_name(Assignment.find(id).name))&lt;br /&gt;
      end&lt;br /&gt;
      return name&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The state of D before conflicting import:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E1938_Before_D_1.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
After fixing changes&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:After_D.PNG]]&lt;br /&gt;
[[File:After_old_team.PNG]]&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
As you can see the new team got the name D and the old file got renamed to Team_17.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Issue 153=====&lt;br /&gt;
'''Requirement''': There should be a way to import a list of who has signed up for which topic. When a signup sheet is used in Expertiza, users are expected to sign up for topics. But, the instructor might've taken signups offline, e.g., by passing around a signup sheet in class. There should be a way to import this list to Expertiza, rather than impersonate all the students one by one and sign them up for a topic. &lt;br /&gt;
&lt;br /&gt;
'''Solution''': We have modified the existing implementation for import topics to assign the teams to the topics. We have changed the files to handle another column where the teams have been assigned to topics. The column is optional because there might be topics that have not yet been assigned to any teams&lt;br /&gt;
&lt;br /&gt;
'''Expectations from the import file: &lt;br /&gt;
'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
* Assigned team name should exist in the system, otherwise the import will fail. Instructor has to make sure that the teams which are assigned in the import file should exist with same names in the system or database. &lt;br /&gt;
* Instructor also need to ensure that the topic for which the team is being assigned should not be full or can accommodate new team assignment to the respective topic. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''Code Changes:'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''import_file/_sign_up_topic.html.erb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
As there's already a screen with select options to map the columns with the fields for import. We are just adding another column so the best way is to extend the existing select tag with a new option for the teams assigned. All the select tags has been changed with an additional option &amp;quot;Assigned Team&amp;quot;. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
 &amp;lt;th&amp;gt;&lt;br /&gt;
            &amp;lt;select name=&amp;quot;select1&amp;quot; id=&amp;quot;select1&amp;quot; class=&amp;quot;form-control&amp;quot; style=&amp;quot;background-color:lightgrey&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;topic_identifier&amp;quot;&amp;gt;Topic Identifier (required)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;topic_name&amp;quot;&amp;gt;Topic Name (required)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;max_choosers&amp;quot;&amp;gt;Max Choosers (required)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;category&amp;quot;&amp;gt;Category (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;description&amp;quot;&amp;gt;Description (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;link&amp;quot;&amp;gt;Link (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;assigned_team&amp;quot;&amp;gt;Assigned Team (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
            &amp;lt;/select&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''model/sign_up_topic.rb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The existing import function in the model import the topics to the topic table. As per the requirement and validations, topic should be imported first and then only the team can be assigned to the topic. So the existing import method has been modified to assign the team once the topic is imported in the database table. As per the edge case mentioned in the requirement document that few topics may not have any team assigned to it, so we first check if topic has any team assigned, then only it tries to map the topic with the team. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
  def self.import(row_hash, session, _id = nil)&lt;br /&gt;
    if row_hash.length &amp;lt; 3&lt;br /&gt;
      raise ArgumentError, &amp;quot;The CSV File expects the format: Topic identifier, Topic name, Max choosers, Topic Category (optional), Topic Description (Optional), Topic Link (optional), Assigned Team Name (optional).&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
    topic = SignUpTopic.where(topic_name: row_hash[:topic_name], assignment_id: session[:assignment_id]).first&lt;br /&gt;
    if topic.nil?&lt;br /&gt;
      attributes = ImportTopicsHelper.define_attributes(row_hash)&lt;br /&gt;
      topic_new_id = ImportTopicsHelper.create_new_sign_up_topic(attributes, session)&lt;br /&gt;
      unless row_hash[:assigned_team].nil?&lt;br /&gt;
          team = Team.where(name: row_hash[:assigned_team]).first&lt;br /&gt;
          ImportTopicsHelper.assign_team_topic(topic_new_id, team.id)&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      topic.max_choosers = row_hash[:max_choosers]&lt;br /&gt;
      topic.topic_identifier = row_hash[:topic_identifier]&lt;br /&gt;
      topic.save&lt;br /&gt;
      unless row_hash[:assigned_team].nil?&lt;br /&gt;
        team = Team.where(name: row_hash[:assigned_team]).first&lt;br /&gt;
        newteam = SignedUpTeam.where(topic_id: topic.id, team_id: team.id).first&lt;br /&gt;
        if newteam.nil?&lt;br /&gt;
          ImportTopicsHelper.assign_team_topic(topic.id, team.id)&lt;br /&gt;
        else&lt;br /&gt;
          newteam.team_id = team.id&lt;br /&gt;
          newteam.save&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''helpers/import_topics_helper.rb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Having the assign_team_topic in the helper would organize the code but also in the unit testing. We can isolate the model logic and test this method separately by writing the test cases. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
  def self.assign_team_topic(topic_id, assigned_team)&lt;br /&gt;
    attributes = {}&lt;br /&gt;
    attributes[&amp;quot;topic_id&amp;quot;] = topic_id&lt;br /&gt;
    attributes[&amp;quot;team_id&amp;quot;] = assigned_team&lt;br /&gt;
    assign_team = SignedUpTeam.new(attributes)&lt;br /&gt;
    assign_team.save!&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
   def self.create_new_sign_up_topic(attributes, session)&lt;br /&gt;
     sign_up_topic = SignUpTopic.new(attributes)&lt;br /&gt;
     sign_up_topic.assignment_id = session[:assignment_id]&lt;br /&gt;
     sign_up_topic.save&lt;br /&gt;
     # sign_up_topic&lt;br /&gt;
     sign_up_topic.save!&lt;br /&gt;
     sign_up_topic.id&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''controllers/import_file_controller.rb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Existing implementation for import have many flaws and design issues. Most of the code has been written with nested if else, which is not the practice to be followed. Also the names of the fields have been hardcoded. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
As we cannot change the complete import implementation. So i had to use the existing one the way it is and make changes to extend the functionality. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    if (params[:assigned_team] == 'true')&lt;br /&gt;
        @optional_count += 1&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
    elsif params[:optional_count] == '4'&lt;br /&gt;
          new_header = [params[:select1], params[:select2], params[:select3], params[:select4], params[:select5], params[:select6], params[:select7]]&lt;br /&gt;
          @header_integrated_body = hash_rows_with_headers(new_header,contents_hash[:body])&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''views/sign_up_sheet/_add_topics.html.erb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
This code has been used to display the columns in the footer.As we already have implementation for other columns, so another column name 'Assigned Team' is added here in this part of the code. &lt;br /&gt;
        &amp;lt;%= link_to 'Import topics',&lt;br /&gt;
                {&lt;br /&gt;
                    :controller =&amp;gt; 'import_file',&lt;br /&gt;
                    :action =&amp;gt; 'start',&lt;br /&gt;
                    :model =&amp;gt; 'SignUpTopic',&lt;br /&gt;
                    :id =&amp;gt; params[:id],&lt;br /&gt;
                    :expected_fields =&amp;gt; 'Topic Identifier' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Name' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Max Choosers' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Category &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Description &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Link &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Assigned Team &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
An option column checkbox (Teams Assigned) has been added to the UI&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Issue153SS8.jpg]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
A new column Assigned Team is added where the columns are being mapped. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File: Issue153SS7.jpg]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Test Plan''' ==&lt;br /&gt;
*'''RSpec:'''&lt;br /&gt;
&lt;br /&gt;
::We have added new testcases for the new pieces of code that were added by us.&lt;br /&gt;
&lt;br /&gt;
::'''[Problem 3 (329)]'''&lt;br /&gt;
::::A new testcase was added to test this functionality. We use it to check if the older team gets the new name and the new team gets the requested name.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
      # New team name should remain the same, the old one gets updated&lt;br /&gt;
      context 'when handle_dups option is rename_existing' do&lt;br /&gt;
        it 'returns new team name' do&lt;br /&gt;
          allow(Course).to receive(:find).with(1).and_return(double('Course', name: 'course 1'))&lt;br /&gt;
          allow(Team).to receive(:generate_team_name).with('course 1').and_return('new name of team')&lt;br /&gt;
          expect(Team.handle_duplicate(team, 'no name', 1, 'rename_existing', CourseTeam)).to eq('no name')&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
*'''UI Testing:'''&lt;br /&gt;
&lt;br /&gt;
::'''[Problem 1 (918)]'''&lt;br /&gt;
::::1. Login to Expertiza using username: instructor6 &amp;amp; password: password.&lt;br /&gt;
::::2. Go to Assignments and click on edit for any of the listed assignments.&lt;br /&gt;
::::3. Click on Topics tab.&lt;br /&gt;
::::4. Scroll down to the bottom of the page and click on Import topics.&lt;br /&gt;
::::5. Click on Topic Description checkbox and import the following file. (sample.csv)&lt;br /&gt;
::::[[File:918_p1.png]]&lt;br /&gt;
::::6. Click on next and make the header for 4th column as 'Description' from the dropdown.&lt;br /&gt;
::::[[File:918_p2.png]]&lt;br /&gt;
::::7. Import topics.&lt;br /&gt;
::::8. After this, a new topic should be imported which can be viewed from the aforementioned Topics tab. This newly imported topic will not have any non-ascii characters.&lt;br /&gt;
&lt;br /&gt;
::'''[Problem 3 (329)]'''&lt;br /&gt;
::::1. Login to Expertiza using username: instructor6 &amp;amp; password: password.&lt;br /&gt;
::::2. Select Manage &amp;gt; Courses or Assignments &amp;gt; Add Teams button &amp;gt; Import Team&lt;br /&gt;
::::3. In the screen that loads, select &amp;quot;rename the existing team and import&amp;quot; in the handle conflicts section.&lt;br /&gt;
::::4. Upload a file with the team details and select the appropriate delimiter.&lt;br /&gt;
::::5. Click on Create&lt;br /&gt;
::::6. Verify that the new team got created with the assigned name and the older team's name got changed.&lt;br /&gt;
&lt;br /&gt;
::'''[Problem 4 (328)]'''&lt;br /&gt;
::::1. Login to Expertiza using username: instructor6 &amp;amp; password: password.&lt;br /&gt;
::::2. Select Manage &amp;gt; Courses or Assignments &amp;gt; Add Teams button &amp;gt; Import Team&lt;br /&gt;
::::3. In the screen that loads, select &amp;quot;Insert any new members into existing team&amp;quot; in the handle conflicts section.&lt;br /&gt;
::::4. Upload a file with the team details and select the appropriate delimiter.&lt;br /&gt;
::::5. Click on Create&lt;br /&gt;
::::6. Verify that the existing team got updated with the new team members&lt;br /&gt;
&lt;br /&gt;
== '''Possible Enhancements''' ==&lt;br /&gt;
&lt;br /&gt;
====='''Import functionality'''=====&lt;br /&gt;
&lt;br /&gt;
The existing import implementation does not follow DRY principle, rails code practices and even basic design principles. Most of the code is written based with nested if else conditions. This implementation can be improved. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Exception Handling: Before starting to work on this requirement. I tried few imports and in many cases, import was not successful and i was not able to figure out what's going wrong. My suggestion would be to develop a screen to show which rows were successfully imported and the failure reason which didn't. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Also, if there's no team in the system and instructor has used it in the import file so a new pop up can be displayed where the new team can be created or the import can be extended to create teams while assigning the topic. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1. Expertiza on GITHUB: https://github.com/expertiza/expertiza&lt;br /&gt;
&lt;br /&gt;
2. GitHub Project Repository Fork: https://github.com/NisargC/expertiza&lt;br /&gt;
&lt;br /&gt;
3. Demo link: http://152.46.19.138:8080/&lt;br /&gt;
&lt;br /&gt;
4. Expertiza project documentation wiki: http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2019_-_E1938._OSS_project_Duke_Blue:_Fix_import_glitches&lt;/div&gt;</summary>
		<author><name>Nmchoks2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1938._OSS_project_Duke_Blue:_Fix_import_glitches&amp;diff=127499</id>
		<title>CSC/ECE 517 Fall 2019 - E1938. OSS project Duke Blue: Fix import glitches</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1938._OSS_project_Duke_Blue:_Fix_import_glitches&amp;diff=127499"/>
		<updated>2019-11-06T23:11:45Z</updated>

		<summary type="html">&lt;p&gt;Nmchoks2: /* Test Plan */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
== '''About Expertiza''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source project based on Ruby on Rails framework and the code is available on Github. Expertiza allows the instructor to create new assignments as well as edit new or existing assignments. Instructors can also create a list of topics the students can sign up for and specify deadlines for completion of various tasks. Students can form teams in Expertiza to work on various projects and assignments as well as peer review other students' submissions. Expertiza supports submission across various document types, including the URLs Wiki pages.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
The import feature is the most helpful feature for instructors to set up assignments. The instructors usually have a list of students, teams, etc from their learning management system. Being able to import these into expertiza saves a lot of time when setting up an assignment. Unfortunately this feature has some bugs that were identified as the following list. &lt;br /&gt;
&lt;br /&gt;
'''Issue 918''': It seems that non-ASCII characters in the description (e.g., a curly apostrophe, and perhaps also an en-dash) caused a SQL error in inserting the description string into the db. I had to edit the import file to remove non-ASCII characters. Any Unicode character ought to be allowed in a description. &lt;br /&gt;
&lt;br /&gt;
'''Issue 153''': There should be a way to import a list of who has signed up for which topic. When a signup sheet is used in Expertiza, users are expected to sign up for topics. But, the instructor might've taken signups offline, e.g., by passing around a signup sheet in class. There should be a way to import this list to Expertiza, rather than impersonate all the students one by one and sign them up for a topic. '''This issue is not a bug but an additional feature to the existing import topic functionality.'''&lt;br /&gt;
&lt;br /&gt;
'''Issue 329''': When importing teams there are different options to handle conflicting team names &lt;br /&gt;
&lt;br /&gt;
'''Issue 328''': When importing teams, and a conflict exists there is an option to merge the two teams by inserting the new members into an existing team. Unfortunately, this feature is broken. we tried to import a team and selected 'Insert any new members into existing team'. No new team members were in fact inserted into the team&lt;br /&gt;
&lt;br /&gt;
== '''Fixes''' ==&lt;br /&gt;
=====Issue 918=====&lt;br /&gt;
&lt;br /&gt;
'''Problem:''' The application is not able to import topics with non ascii characters in its description field. &amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' Before the topic object is persisted into the database, check for any non ascii characters in the description field and strip them. &amp;lt;br&amp;gt;&lt;br /&gt;
'''Code Changes'''&amp;lt;br&amp;gt;&lt;br /&gt;
New code introduced is as follows.&amp;lt;br&amp;gt;&lt;br /&gt;
File:app/helpers/import_topics_helper.rb &amp;lt;br&amp;gt;&lt;br /&gt;
Here, a new function 'trim_non_ascii' has been added which iterates a given string character by character, and replaces each non ascii character with a white space character. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  def self.define_attributes(row_hash)&lt;br /&gt;
    attributes = {}&lt;br /&gt;
    if !row_hash[:description].nil? and !row_hash[:description].ascii_only?&lt;br /&gt;
      row_hash[:description] = self.trim_non_ascii(row_hash[:description])&lt;br /&gt;
      puts row_hash[:description]&lt;br /&gt;
    end&lt;br /&gt;
    attributes[&amp;quot;topic_identifier&amp;quot;] = row_hash[:topic_identifier].strip&lt;br /&gt;
    attributes[&amp;quot;topic_name&amp;quot;] = row_hash[:topic_name].strip&lt;br /&gt;
    attributes[&amp;quot;max_choosers&amp;quot;] = row_hash[:max_choosers].strip&lt;br /&gt;
    attributes&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def self.trim_non_ascii(string)&lt;br /&gt;
    string.split('').each do |char|&lt;br /&gt;
      !char.ascii_only? ? string.tr!(char, ' ') : nil&lt;br /&gt;
    end&lt;br /&gt;
    string.gsub!(/\s+/, ' ')&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
=====Issue 328=====&lt;br /&gt;
&lt;br /&gt;
'''Problem''': When importing teams, and a conflict exists there is an option to merge the two teams by inserting the new members into an existing team.&lt;br /&gt;
&lt;br /&gt;
'''Solution''': This was an issue to fix the functionality of Insert any new members into existing team. This was due to faulty handling of the option handle_dups and incorrect checking of parameters.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Code was modified to ensure minimal impact to existing testcases and functionalities.&amp;lt;br&amp;gt;&lt;br /&gt;
The handling of handle_dups in options was done assuming that the parameter was a symbol. But when tested, it was found to be a string and hence the handling was updated accordingly.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Code:&lt;br /&gt;
      name = handle_duplicate(team, name, id, options[&amp;quot;handle_dups&amp;quot;], teamtype)&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Also, the if and else conditions for checking class type of used was wrong. This was updated based on how the variable was assigned in the import_file_controller.rb#import_from_hash&lt;br /&gt;
Code:&lt;br /&gt;
      if(teamtype.is_a?(CourseTeam.class))&lt;br /&gt;
          ...&lt;br /&gt;
      elsif  teamtype.is_a?(AssignmentTeam.class)&lt;br /&gt;
          ...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E1938_Before_D.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
After fixing changes&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Insert_new_in_old.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Issue 329=====&lt;br /&gt;
&lt;br /&gt;
This was a request to add an option to rename existing team if there was a conflict in the team name.&amp;lt;br&amp;gt;&lt;br /&gt;
New code introduced was as follows:&amp;lt;br&amp;gt;&lt;br /&gt;
In start.html.erb&amp;lt;br&amp;gt;&lt;br /&gt;
In this file, the new option as displayed to the user is added&amp;lt;br&amp;gt;&lt;br /&gt;
          &amp;lt;option value=&amp;quot;rename_existing&amp;quot;&amp;gt;rename the existing team and import&amp;lt;/option&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In team.rb&amp;lt;br&amp;gt;&lt;br /&gt;
In this file, the handling of the new tag &amp;quot;rename_existing&amp;quot; is added wherein, the old team is updated with a new name.&amp;lt;br&amp;gt;&lt;br /&gt;
    # E1938: Added handling for renaming old team when conflict arises&lt;br /&gt;
    if handle_dups == &amp;quot;rename_existing&amp;quot;&lt;br /&gt;
      if teamtype.is_a?(CourseTeam.class)&lt;br /&gt;
        team.update(name: self.generate_team_name(Course.find(id).name))&lt;br /&gt;
      elsif  teamtype.is_a?(AssignmentTeam.class)&lt;br /&gt;
        team.update(name: self.generate_team_name(Assignment.find(id).name))&lt;br /&gt;
      end&lt;br /&gt;
      return name&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The state of D before conflicting import:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E1938_Before_D_1.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
After fixing changes&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:After_D.PNG]]&lt;br /&gt;
[[File:After_old_team.PNG]]&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
As you can see the new team got the name D and the old file got renamed to Team_17.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Issue 153=====&lt;br /&gt;
'''Requirement''': There should be a way to import a list of who has signed up for which topic. When a signup sheet is used in Expertiza, users are expected to sign up for topics. But, the instructor might've taken signups offline, e.g., by passing around a signup sheet in class. There should be a way to import this list to Expertiza, rather than impersonate all the students one by one and sign them up for a topic. &lt;br /&gt;
&lt;br /&gt;
'''Solution''': We have modified the existing implementation for import topics to assign the teams to the topics. We have changed the files to handle another column where the teams have been assigned to topics. The column is optional because there might be topics that have not yet been assigned to any teams&lt;br /&gt;
&lt;br /&gt;
'''Expectations from the import file: &lt;br /&gt;
'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
* Assigned team name should exist in the system, otherwise the import will fail. Instructor has to make sure that the teams which are assigned in the import file should exist with same names in the system or database. &lt;br /&gt;
* Instructor also need to ensure that the topic for which the team is being assigned should not be full or can accommodate new team assignment to the respective topic. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''Code Changes:'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''import_file/_sign_up_topic.html.erb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
As there's already a screen with select options to map the columns with the fields for import. We are just adding another column so the best way is to extend the existing select tag with a new option for the teams assigned. All the select tags has been changed with an additional option &amp;quot;Assigned Team&amp;quot;. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
 &amp;lt;th&amp;gt;&lt;br /&gt;
            &amp;lt;select name=&amp;quot;select1&amp;quot; id=&amp;quot;select1&amp;quot; class=&amp;quot;form-control&amp;quot; style=&amp;quot;background-color:lightgrey&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;topic_identifier&amp;quot;&amp;gt;Topic Identifier (required)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;topic_name&amp;quot;&amp;gt;Topic Name (required)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;max_choosers&amp;quot;&amp;gt;Max Choosers (required)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;category&amp;quot;&amp;gt;Category (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;description&amp;quot;&amp;gt;Description (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;link&amp;quot;&amp;gt;Link (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;assigned_team&amp;quot;&amp;gt;Assigned Team (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
            &amp;lt;/select&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''model/sign_up_topic.rb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The existing import function in the model import the topics to the topic table. As per the requirement and validations, topic should be imported first and then only the team can be assigned to the topic. So the existing import method has been modified to assign the team once the topic is imported in the database table. As per the edge case mentioned in the requirement document that few topics may not have any team assigned to it, so we first check if topic has any team assigned, then only it tries to map the topic with the team. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
  def self.import(row_hash, session, _id = nil)&lt;br /&gt;
    if row_hash.length &amp;lt; 3&lt;br /&gt;
      raise ArgumentError, &amp;quot;The CSV File expects the format: Topic identifier, Topic name, Max choosers, Topic Category (optional), Topic Description (Optional), Topic Link (optional), Assigned Team Name (optional).&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
    topic = SignUpTopic.where(topic_name: row_hash[:topic_name], assignment_id: session[:assignment_id]).first&lt;br /&gt;
    if topic.nil?&lt;br /&gt;
      attributes = ImportTopicsHelper.define_attributes(row_hash)&lt;br /&gt;
      topic_new_id = ImportTopicsHelper.create_new_sign_up_topic(attributes, session)&lt;br /&gt;
      unless row_hash[:assigned_team].nil?&lt;br /&gt;
          team = Team.where(name: row_hash[:assigned_team]).first&lt;br /&gt;
          ImportTopicsHelper.assign_team_topic(topic_new_id, team.id)&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      topic.max_choosers = row_hash[:max_choosers]&lt;br /&gt;
      topic.topic_identifier = row_hash[:topic_identifier]&lt;br /&gt;
      topic.save&lt;br /&gt;
      unless row_hash[:assigned_team].nil?&lt;br /&gt;
        team = Team.where(name: row_hash[:assigned_team]).first&lt;br /&gt;
        newteam = SignedUpTeam.where(topic_id: topic.id, team_id: team.id).first&lt;br /&gt;
        if newteam.nil?&lt;br /&gt;
          ImportTopicsHelper.assign_team_topic(topic.id, team.id)&lt;br /&gt;
        else&lt;br /&gt;
          newteam.team_id = team.id&lt;br /&gt;
          newteam.save&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''helpers/import_topics_helper.rb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Having the assign_team_topic in the helper would organize the code but also in the unit testing. We can isolate the model logic and test this method separately by writing the test cases. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
  def self.assign_team_topic(topic_id, assigned_team)&lt;br /&gt;
    attributes = {}&lt;br /&gt;
    attributes[&amp;quot;topic_id&amp;quot;] = topic_id&lt;br /&gt;
    attributes[&amp;quot;team_id&amp;quot;] = assigned_team&lt;br /&gt;
    assign_team = SignedUpTeam.new(attributes)&lt;br /&gt;
    assign_team.save!&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
   def self.create_new_sign_up_topic(attributes, session)&lt;br /&gt;
     sign_up_topic = SignUpTopic.new(attributes)&lt;br /&gt;
     sign_up_topic.assignment_id = session[:assignment_id]&lt;br /&gt;
     sign_up_topic.save&lt;br /&gt;
     # sign_up_topic&lt;br /&gt;
     sign_up_topic.save!&lt;br /&gt;
     sign_up_topic.id&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''controllers/import_file_controller.rb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Existing implementation for import have many flaws and design issues. Most of the code has been written with nested if else, which is not the practice to be followed. Also the names of the fields have been hardcoded. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
As we cannot change the complete import implementation. So i had to use the existing one the way it is and make changes to extend the functionality. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    if (params[:assigned_team] == 'true')&lt;br /&gt;
        @optional_count += 1&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
    elsif params[:optional_count] == '4'&lt;br /&gt;
          new_header = [params[:select1], params[:select2], params[:select3], params[:select4], params[:select5], params[:select6], params[:select7]]&lt;br /&gt;
          @header_integrated_body = hash_rows_with_headers(new_header,contents_hash[:body])&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''views/sign_up_sheet/_add_topics.html.erb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
This code has been used to display the columns in the footer.As we already have implementation for other columns, so another column name 'Assigned Team' is added here in this part of the code. &lt;br /&gt;
        &amp;lt;%= link_to 'Import topics',&lt;br /&gt;
                {&lt;br /&gt;
                    :controller =&amp;gt; 'import_file',&lt;br /&gt;
                    :action =&amp;gt; 'start',&lt;br /&gt;
                    :model =&amp;gt; 'SignUpTopic',&lt;br /&gt;
                    :id =&amp;gt; params[:id],&lt;br /&gt;
                    :expected_fields =&amp;gt; 'Topic Identifier' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Name' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Max Choosers' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Category &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Description &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Link &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Assigned Team &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
An option column checkbox (Teams Assigned) has been added to the UI&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Issue153SS8.jpg]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
A new column Assigned Team is added where the columns are being mapped. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File: Issue153SS7.jpg]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Test Plan''' ==&lt;br /&gt;
*'''RSpec:'''&lt;br /&gt;
&lt;br /&gt;
::We have added new testcases for the new pieces of code that were added by us.&lt;br /&gt;
&lt;br /&gt;
::'''[Problem 3 (329)]'''&lt;br /&gt;
A new testcase was added to test this functionality. We use it to check if the older team gets the new name and the new team gets the requested name.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
      # New team name should remain the same, the old one gets updated&lt;br /&gt;
      context 'when handle_dups option is rename_existing' do&lt;br /&gt;
        it 'returns new team name' do&lt;br /&gt;
          allow(Course).to receive(:find).with(1).and_return(double('Course', name: 'course 1'))&lt;br /&gt;
          allow(Team).to receive(:generate_team_name).with('course 1').and_return('new name of team')&lt;br /&gt;
          expect(Team.handle_duplicate(team, 'no name', 1, 'rename_existing', CourseTeam)).to eq('no name')&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
*'''UI Testing:'''&lt;br /&gt;
&lt;br /&gt;
::'''[Problem 1 (918)]'''&lt;br /&gt;
::::1. Login to Expertiza using username: instructor6 &amp;amp; password: password.&lt;br /&gt;
::::2. Go to Assignments and click on edit for any of the listed assignments.&lt;br /&gt;
::::3. Click on Topics tab.&lt;br /&gt;
::::4. Scroll down to the bottom of the page and click on Import topics.&lt;br /&gt;
::::5. Click on Topic Description checkbox and import the following file. (sample.csv)&lt;br /&gt;
::::[[File:918_p1.png]]&lt;br /&gt;
::::6. Click on next and make the header for 4th column as 'Description' from the dropdown.&lt;br /&gt;
::::[[File:918_p2.png]]&lt;br /&gt;
::::7. Import topics.&lt;br /&gt;
::::8. After this, a new topic should be imported which can be viewed from the aforementioned Topics tab. This newly imported topic will not have any non-ascii characters.&lt;br /&gt;
&lt;br /&gt;
::'''[Problem 3 (329)]'''&lt;br /&gt;
::::1. Login to Expertiza using username: instructor6 &amp;amp; password: password.&lt;br /&gt;
::::2. Select Manage &amp;gt; Courses or Assignments &amp;gt; Add Teams button &amp;gt; Import Team&lt;br /&gt;
::::3. In the screen that loads, select &amp;quot;rename the existing team and import&amp;quot; in the handle conflicts section.&lt;br /&gt;
::::4. Upload a file with the team details and select the appropriate delimiter.&lt;br /&gt;
::::5. Click on Create&lt;br /&gt;
::::6. Verify that the new team got created with the assigned name and the older team's name got changed.&lt;br /&gt;
&lt;br /&gt;
::'''[Problem 4 (328)]'''&lt;br /&gt;
::::1. Login to Expertiza using username: instructor6 &amp;amp; password: password.&lt;br /&gt;
::::2. Select Manage &amp;gt; Courses or Assignments &amp;gt; Add Teams button &amp;gt; Import Team&lt;br /&gt;
::::3. In the screen that loads, select &amp;quot;Insert any new members into existing team&amp;quot; in the handle conflicts section.&lt;br /&gt;
::::4. Upload a file with the team details and select the appropriate delimiter.&lt;br /&gt;
::::5. Click on Create&lt;br /&gt;
::::6. Verify that the existing team got updated with the new team members&lt;br /&gt;
&lt;br /&gt;
== '''Possible Enhancements''' ==&lt;br /&gt;
&lt;br /&gt;
====='''Import functionality'''=====&lt;br /&gt;
&lt;br /&gt;
The existing import implementation does not follow DRY principle, rails code practices and even basic design principles. Most of the code is written based with nested if else conditions. This implementation can be improved. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Exception Handling: Before starting to work on this requirement. I tried few imports and in many cases, import was not successful and i was not able to figure out what's going wrong. My suggestion would be to develop a screen to show which rows were successfully imported and the failure reason which didn't. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Also, if there's no team in the system and instructor has used it in the import file so a new pop up can be displayed where the new team can be created or the import can be extended to create teams while assigning the topic. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1. Expertiza on GITHUB: https://github.com/expertiza/expertiza&lt;br /&gt;
&lt;br /&gt;
2. GitHub Project Repository Fork: https://github.com/NisargC/expertiza&lt;br /&gt;
&lt;br /&gt;
3. Demo link: http://152.46.19.138:8080/&lt;br /&gt;
&lt;br /&gt;
4. Expertiza project documentation wiki: http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2019_-_E1938._OSS_project_Duke_Blue:_Fix_import_glitches&lt;/div&gt;</summary>
		<author><name>Nmchoks2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1938._OSS_project_Duke_Blue:_Fix_import_glitches&amp;diff=127496</id>
		<title>CSC/ECE 517 Fall 2019 - E1938. OSS project Duke Blue: Fix import glitches</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1938._OSS_project_Duke_Blue:_Fix_import_glitches&amp;diff=127496"/>
		<updated>2019-11-06T23:08:31Z</updated>

		<summary type="html">&lt;p&gt;Nmchoks2: /* Issue 328 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
== '''About Expertiza''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source project based on Ruby on Rails framework and the code is available on Github. Expertiza allows the instructor to create new assignments as well as edit new or existing assignments. Instructors can also create a list of topics the students can sign up for and specify deadlines for completion of various tasks. Students can form teams in Expertiza to work on various projects and assignments as well as peer review other students' submissions. Expertiza supports submission across various document types, including the URLs Wiki pages.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
The import feature is the most helpful feature for instructors to set up assignments. The instructors usually have a list of students, teams, etc from their learning management system. Being able to import these into expertiza saves a lot of time when setting up an assignment. Unfortunately this feature has some bugs that were identified as the following list. &lt;br /&gt;
&lt;br /&gt;
'''Issue 918''': It seems that non-ASCII characters in the description (e.g., a curly apostrophe, and perhaps also an en-dash) caused a SQL error in inserting the description string into the db. I had to edit the import file to remove non-ASCII characters. Any Unicode character ought to be allowed in a description. &lt;br /&gt;
&lt;br /&gt;
'''Issue 153''': There should be a way to import a list of who has signed up for which topic. When a signup sheet is used in Expertiza, users are expected to sign up for topics. But, the instructor might've taken signups offline, e.g., by passing around a signup sheet in class. There should be a way to import this list to Expertiza, rather than impersonate all the students one by one and sign them up for a topic. '''This issue is not a bug but an additional feature to the existing import topic functionality.'''&lt;br /&gt;
&lt;br /&gt;
'''Issue 329''': When importing teams there are different options to handle conflicting team names &lt;br /&gt;
&lt;br /&gt;
'''Issue 328''': When importing teams, and a conflict exists there is an option to merge the two teams by inserting the new members into an existing team. Unfortunately, this feature is broken. we tried to import a team and selected 'Insert any new members into existing team'. No new team members were in fact inserted into the team&lt;br /&gt;
&lt;br /&gt;
== '''Fixes''' ==&lt;br /&gt;
=====Issue 918=====&lt;br /&gt;
&lt;br /&gt;
'''Problem:''' The application is not able to import topics with non ascii characters in its description field. &amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' Before the topic object is persisted into the database, check for any non ascii characters in the description field and strip them. &amp;lt;br&amp;gt;&lt;br /&gt;
'''Code Changes'''&amp;lt;br&amp;gt;&lt;br /&gt;
New code introduced is as follows.&amp;lt;br&amp;gt;&lt;br /&gt;
File:app/helpers/import_topics_helper.rb &amp;lt;br&amp;gt;&lt;br /&gt;
Here, a new function 'trim' has been added which iterates a given string character by character, and replaces each non ascii character with a white space character. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  def self.define_attributes(row_hash)&lt;br /&gt;
    attributes = {}&lt;br /&gt;
    if !row_hash[:description].nil? and !row_hash[:description].ascii_only?&lt;br /&gt;
      row_hash[:description] = self.trim_non_ascii(row_hash[:description])&lt;br /&gt;
      puts row_hash[:description]&lt;br /&gt;
    end&lt;br /&gt;
    attributes[&amp;quot;topic_identifier&amp;quot;] = row_hash[:topic_identifier].strip&lt;br /&gt;
    attributes[&amp;quot;topic_name&amp;quot;] = row_hash[:topic_name].strip&lt;br /&gt;
    attributes[&amp;quot;max_choosers&amp;quot;] = row_hash[:max_choosers].strip&lt;br /&gt;
    attributes&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def self.trim_non_ascii(string)&lt;br /&gt;
    string.split('').each do |char|&lt;br /&gt;
      !char.ascii_only? ? string.tr!(char, ' ') : nil&lt;br /&gt;
    end&lt;br /&gt;
    string.gsub!(/\s+/, ' ')&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
=====Issue 328=====&lt;br /&gt;
&lt;br /&gt;
'''Problem''': When importing teams, and a conflict exists there is an option to merge the two teams by inserting the new members into an existing team.&lt;br /&gt;
&lt;br /&gt;
'''Solution''': This was an issue to fix the functionality of Insert any new members into existing team. This was due to faulty handling of the option handle_dups and incorrect checking of parameters.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Code was modified to ensure minimal impact to existing testcases and functionalities.&amp;lt;br&amp;gt;&lt;br /&gt;
The handling of handle_dups in options was done assuming that the parameter was a symbol. But when tested, it was found to be a string and hence the handling was updated accordingly.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Code:&lt;br /&gt;
      name = handle_duplicate(team, name, id, options[&amp;quot;handle_dups&amp;quot;], teamtype)&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Also, the if and else conditions for checking class type of used was wrong. This was updated based on how the variable was assigned in the import_file_controller.rb#import_from_hash&lt;br /&gt;
Code:&lt;br /&gt;
      if(teamtype.is_a?(CourseTeam.class))&lt;br /&gt;
          ...&lt;br /&gt;
      elsif  teamtype.is_a?(AssignmentTeam.class)&lt;br /&gt;
          ...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E1938_Before_D.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
After fixing changes&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Insert_new_in_old.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Issue 329=====&lt;br /&gt;
&lt;br /&gt;
This was a request to add an option to rename existing team if there was a conflict in the team name.&amp;lt;br&amp;gt;&lt;br /&gt;
New code introduced was as follows:&amp;lt;br&amp;gt;&lt;br /&gt;
In start.html.erb&amp;lt;br&amp;gt;&lt;br /&gt;
In this file, the new option as displayed to the user is added&amp;lt;br&amp;gt;&lt;br /&gt;
          &amp;lt;option value=&amp;quot;rename_existing&amp;quot;&amp;gt;rename the existing team and import&amp;lt;/option&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In team.rb&amp;lt;br&amp;gt;&lt;br /&gt;
In this file, the handling of the new tag &amp;quot;rename_existing&amp;quot; is added wherein, the old team is updated with a new name.&amp;lt;br&amp;gt;&lt;br /&gt;
    # E1938: Added handling for renaming old team when conflict arises&lt;br /&gt;
    if handle_dups == &amp;quot;rename_existing&amp;quot;&lt;br /&gt;
      if teamtype.is_a?(CourseTeam.class)&lt;br /&gt;
        team.update(name: self.generate_team_name(Course.find(id).name))&lt;br /&gt;
      elsif  teamtype.is_a?(AssignmentTeam.class)&lt;br /&gt;
        team.update(name: self.generate_team_name(Assignment.find(id).name))&lt;br /&gt;
      end&lt;br /&gt;
      return name&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The state of D before conflicting import:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E1938_Before_D_1.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
After fixing changes&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:After_D.PNG]]&lt;br /&gt;
[[File:After_old_team.PNG]]&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
As you can see the new team got the name D and the old file got renamed to Team_17.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Issue 153=====&lt;br /&gt;
'''Requirement''': There should be a way to import a list of who has signed up for which topic. When a signup sheet is used in Expertiza, users are expected to sign up for topics. But, the instructor might've taken signups offline, e.g., by passing around a signup sheet in class. There should be a way to import this list to Expertiza, rather than impersonate all the students one by one and sign them up for a topic. &lt;br /&gt;
&lt;br /&gt;
'''Solution''': We have modified the existing implementation for import topics to assign the teams to the topics. We have changed the files to handle another column where the teams have been assigned to topics. The column is optional because there might be topics that have not yet been assigned to any teams&lt;br /&gt;
&lt;br /&gt;
'''Expectations from the import file: &lt;br /&gt;
'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
* Assigned team name should exist in the system, otherwise the import will fail. Instructor has to make sure that the teams which are assigned in the import file should exist with same names in the system or database. &lt;br /&gt;
* Instructor also need to ensure that the topic for which the team is being assigned should not be full or can accommodate new team assignment to the respective topic. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''Code Changes:'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''import_file/_sign_up_topic.html.erb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
As there's already a screen with select options to map the columns with the fields for import. We are just adding another column so the best way is to extend the existing select tag with a new option for the teams assigned. All the select tags has been changed with an additional option &amp;quot;Assigned Team&amp;quot;. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
 &amp;lt;th&amp;gt;&lt;br /&gt;
            &amp;lt;select name=&amp;quot;select1&amp;quot; id=&amp;quot;select1&amp;quot; class=&amp;quot;form-control&amp;quot; style=&amp;quot;background-color:lightgrey&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;topic_identifier&amp;quot;&amp;gt;Topic Identifier (required)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;topic_name&amp;quot;&amp;gt;Topic Name (required)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;max_choosers&amp;quot;&amp;gt;Max Choosers (required)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;category&amp;quot;&amp;gt;Category (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;description&amp;quot;&amp;gt;Description (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;link&amp;quot;&amp;gt;Link (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;assigned_team&amp;quot;&amp;gt;Assigned Team (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
            &amp;lt;/select&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''model/sign_up_topic.rb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The existing import function in the model import the topics to the topic table. As per the requirement and validations, topic should be imported first and then only the team can be assigned to the topic. So the existing import method has been modified to assign the team once the topic is imported in the database table. As per the edge case mentioned in the requirement document that few topics may not have any team assigned to it, so we first check if topic has any team assigned, then only it tries to map the topic with the team. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
  def self.import(row_hash, session, _id = nil)&lt;br /&gt;
    if row_hash.length &amp;lt; 3&lt;br /&gt;
      raise ArgumentError, &amp;quot;The CSV File expects the format: Topic identifier, Topic name, Max choosers, Topic Category (optional), Topic Description (Optional), Topic Link (optional), Assigned Team Name (optional).&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
    topic = SignUpTopic.where(topic_name: row_hash[:topic_name], assignment_id: session[:assignment_id]).first&lt;br /&gt;
    if topic.nil?&lt;br /&gt;
      attributes = ImportTopicsHelper.define_attributes(row_hash)&lt;br /&gt;
      topic_new_id = ImportTopicsHelper.create_new_sign_up_topic(attributes, session)&lt;br /&gt;
      unless row_hash[:assigned_team].nil?&lt;br /&gt;
          team = Team.where(name: row_hash[:assigned_team]).first&lt;br /&gt;
          ImportTopicsHelper.assign_team_topic(topic_new_id, team.id)&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      topic.max_choosers = row_hash[:max_choosers]&lt;br /&gt;
      topic.topic_identifier = row_hash[:topic_identifier]&lt;br /&gt;
      topic.save&lt;br /&gt;
      unless row_hash[:assigned_team].nil?&lt;br /&gt;
        team = Team.where(name: row_hash[:assigned_team]).first&lt;br /&gt;
        newteam = SignedUpTeam.where(topic_id: topic.id, team_id: team.id).first&lt;br /&gt;
        if newteam.nil?&lt;br /&gt;
          ImportTopicsHelper.assign_team_topic(topic.id, team.id)&lt;br /&gt;
        else&lt;br /&gt;
          newteam.team_id = team.id&lt;br /&gt;
          newteam.save&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''helpers/import_topics_helper.rb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Having the assign_team_topic in the helper would organize the code but also in the unit testing. We can isolate the model logic and test this method separately by writing the test cases. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
  def self.assign_team_topic(topic_id, assigned_team)&lt;br /&gt;
    attributes = {}&lt;br /&gt;
    attributes[&amp;quot;topic_id&amp;quot;] = topic_id&lt;br /&gt;
    attributes[&amp;quot;team_id&amp;quot;] = assigned_team&lt;br /&gt;
    assign_team = SignedUpTeam.new(attributes)&lt;br /&gt;
    assign_team.save!&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
   def self.create_new_sign_up_topic(attributes, session)&lt;br /&gt;
     sign_up_topic = SignUpTopic.new(attributes)&lt;br /&gt;
     sign_up_topic.assignment_id = session[:assignment_id]&lt;br /&gt;
     sign_up_topic.save&lt;br /&gt;
     # sign_up_topic&lt;br /&gt;
     sign_up_topic.save!&lt;br /&gt;
     sign_up_topic.id&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''controllers/import_file_controller.rb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Existing implementation for import have many flaws and design issues. Most of the code has been written with nested if else, which is not the practice to be followed. Also the names of the fields have been hardcoded. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
As we cannot change the complete import implementation. So i had to use the existing one the way it is and make changes to extend the functionality. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    if (params[:assigned_team] == 'true')&lt;br /&gt;
        @optional_count += 1&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
    elsif params[:optional_count] == '4'&lt;br /&gt;
          new_header = [params[:select1], params[:select2], params[:select3], params[:select4], params[:select5], params[:select6], params[:select7]]&lt;br /&gt;
          @header_integrated_body = hash_rows_with_headers(new_header,contents_hash[:body])&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''views/sign_up_sheet/_add_topics.html.erb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
This code has been used to display the columns in the footer.As we already have implementation for other columns, so another column name 'Assigned Team' is added here in this part of the code. &lt;br /&gt;
        &amp;lt;%= link_to 'Import topics',&lt;br /&gt;
                {&lt;br /&gt;
                    :controller =&amp;gt; 'import_file',&lt;br /&gt;
                    :action =&amp;gt; 'start',&lt;br /&gt;
                    :model =&amp;gt; 'SignUpTopic',&lt;br /&gt;
                    :id =&amp;gt; params[:id],&lt;br /&gt;
                    :expected_fields =&amp;gt; 'Topic Identifier' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Name' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Max Choosers' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Category &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Description &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Link &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Assigned Team &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
An option column checkbox (Teams Assigned) has been added to the UI&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Issue153SS8.jpg]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
A new column Assigned Team is added where the columns are being mapped. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File: Issue153SS7.jpg]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Test Plan''' ==&lt;br /&gt;
*'''RSpec:'''&lt;br /&gt;
&lt;br /&gt;
::We have added new testcases for the new pieces of code that were added by us.&lt;br /&gt;
&lt;br /&gt;
*'''UI Testing:'''&lt;br /&gt;
&lt;br /&gt;
::'''[Problem 1 (918)]'''&lt;br /&gt;
::::1. Login to Expertiza using username: instructor6 &amp;amp; password: password.&lt;br /&gt;
::::2. Go to Assignments and click on edit for any of the listed assignments.&lt;br /&gt;
::::3. Click on Topics tab.&lt;br /&gt;
::::4. Scroll down to the bottom of the page and click on Import topics.&lt;br /&gt;
::::5. Click on Topic Description checkbox and import the following file. (sample.csv)&lt;br /&gt;
::::[[File:918_p1.png]]&lt;br /&gt;
::::6. Click on next and make the header for 4th column as 'Description' from the dropdown.&lt;br /&gt;
::::[[File:918_p2.png]]&lt;br /&gt;
::::7. Import topics.&lt;br /&gt;
::::8. After this, a new topic should be imported which can be viewed from the aforementioned Topics tab. This newly imported topic will not have any non-ascii characters.&lt;br /&gt;
&lt;br /&gt;
::'''[Problem 3 (329)]'''&lt;br /&gt;
::::1. Login to Expertiza using username: instructor6 &amp;amp; password: password.&lt;br /&gt;
::::2. Select Manage &amp;gt; Courses or Assignments &amp;gt; Add Teams button &amp;gt; Import Team&lt;br /&gt;
::::3. In the screen that loads, select &amp;quot;rename the existing team and import&amp;quot; in the handle conflicts section.&lt;br /&gt;
::::4. Upload a file with the team details and select the appropriate delimiter.&lt;br /&gt;
::::5. Click on Create&lt;br /&gt;
::::6. Verify that the new team got created with the assigned name and the older team's name got changed.&lt;br /&gt;
&lt;br /&gt;
::'''[Problem 4 (328)]'''&lt;br /&gt;
::::1. Login to Expertiza using username: instructor6 &amp;amp; password: password.&lt;br /&gt;
::::2. Select Manage &amp;gt; Courses or Assignments &amp;gt; Add Teams button &amp;gt; Import Team&lt;br /&gt;
::::3. In the screen that loads, select &amp;quot;Insert any new members into existing team&amp;quot; in the handle conflicts section.&lt;br /&gt;
::::4. Upload a file with the team details and select the appropriate delimiter.&lt;br /&gt;
::::5. Click on Create&lt;br /&gt;
::::6. Verify that the existing team got updated with the new team members&lt;br /&gt;
&lt;br /&gt;
::::[[File:DB Snapshot.png]]&lt;br /&gt;
&lt;br /&gt;
== '''Possible Enhancements''' ==&lt;br /&gt;
&lt;br /&gt;
====='''Import functionality'''=====&lt;br /&gt;
&lt;br /&gt;
The existing import implementation does not follow DRY principle, rails code practices and even basic design principles. Most of the code is written based with nested if else conditions. This implementation can be improved. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Exception Handling: Before starting to work on this requirement. I tried few imports and in many cases, import was not successful and i was not able to figure out what's going wrong. My suggestion would be to develop a screen to show which rows were successfully imported and the failure reason which didn't. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Also, if there's no team in the system and instructor has used it in the import file so a new pop up can be displayed where the new team can be created or the import can be extended to create teams while assigning the topic. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1. Expertiza on GITHUB: https://github.com/expertiza/expertiza&lt;br /&gt;
&lt;br /&gt;
2. GitHub Project Repository Fork: https://github.com/NisargC/expertiza&lt;br /&gt;
&lt;br /&gt;
3. Demo link: http://152.46.19.138:8080/&lt;br /&gt;
&lt;br /&gt;
4. Expertiza project documentation wiki: http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2019_-_E1938._OSS_project_Duke_Blue:_Fix_import_glitches&lt;/div&gt;</summary>
		<author><name>Nmchoks2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1938._OSS_project_Duke_Blue:_Fix_import_glitches&amp;diff=127494</id>
		<title>CSC/ECE 517 Fall 2019 - E1938. OSS project Duke Blue: Fix import glitches</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1938._OSS_project_Duke_Blue:_Fix_import_glitches&amp;diff=127494"/>
		<updated>2019-11-06T23:07:40Z</updated>

		<summary type="html">&lt;p&gt;Nmchoks2: /* Issue 328 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
== '''About Expertiza''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source project based on Ruby on Rails framework and the code is available on Github. Expertiza allows the instructor to create new assignments as well as edit new or existing assignments. Instructors can also create a list of topics the students can sign up for and specify deadlines for completion of various tasks. Students can form teams in Expertiza to work on various projects and assignments as well as peer review other students' submissions. Expertiza supports submission across various document types, including the URLs Wiki pages.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
The import feature is the most helpful feature for instructors to set up assignments. The instructors usually have a list of students, teams, etc from their learning management system. Being able to import these into expertiza saves a lot of time when setting up an assignment. Unfortunately this feature has some bugs that were identified as the following list. &lt;br /&gt;
&lt;br /&gt;
'''Issue 918''': It seems that non-ASCII characters in the description (e.g., a curly apostrophe, and perhaps also an en-dash) caused a SQL error in inserting the description string into the db. I had to edit the import file to remove non-ASCII characters. Any Unicode character ought to be allowed in a description. &lt;br /&gt;
&lt;br /&gt;
'''Issue 153''': There should be a way to import a list of who has signed up for which topic. When a signup sheet is used in Expertiza, users are expected to sign up for topics. But, the instructor might've taken signups offline, e.g., by passing around a signup sheet in class. There should be a way to import this list to Expertiza, rather than impersonate all the students one by one and sign them up for a topic. '''This issue is not a bug but an additional feature to the existing import topic functionality.'''&lt;br /&gt;
&lt;br /&gt;
'''Issue 329''': When importing teams there are different options to handle conflicting team names &lt;br /&gt;
&lt;br /&gt;
'''Issue 328''': When importing teams, and a conflict exists there is an option to merge the two teams by inserting the new members into an existing team. Unfortunately, this feature is broken. we tried to import a team and selected 'Insert any new members into existing team'. No new team members were in fact inserted into the team&lt;br /&gt;
&lt;br /&gt;
== '''Fixes''' ==&lt;br /&gt;
=====Issue 918=====&lt;br /&gt;
&lt;br /&gt;
'''Problem:''' The application is not able to import topics with non ascii characters in its description field. &amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' Before the topic object is persisted into the database, check for any non ascii characters in the description field and strip them. &amp;lt;br&amp;gt;&lt;br /&gt;
'''Code Changes'''&amp;lt;br&amp;gt;&lt;br /&gt;
New code introduced is as follows.&amp;lt;br&amp;gt;&lt;br /&gt;
File:app/helpers/import_topics_helper.rb &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
def self.define_attributes(row_hash)&lt;br /&gt;
    attributes = {}&lt;br /&gt;
    if !row_hash[:description].nil? and !row_hash[:description].ascii_only?&lt;br /&gt;
      row_hash[:description] = self.trim_non_ascii(row_hash[:description])&lt;br /&gt;
      puts row_hash[:description]&lt;br /&gt;
    end&lt;br /&gt;
    attributes[&amp;quot;topic_identifier&amp;quot;] = row_hash[:topic_identifier].strip&lt;br /&gt;
    attributes[&amp;quot;topic_name&amp;quot;] = row_hash[:topic_name].strip&lt;br /&gt;
    attributes[&amp;quot;max_choosers&amp;quot;] = row_hash[:max_choosers].strip&lt;br /&gt;
    attributes&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def self.trim_non_ascii(string)&lt;br /&gt;
    string.split('').each do |char|&lt;br /&gt;
      !char.ascii_only? ? string.tr!(char, ' ') : nil&lt;br /&gt;
    end&lt;br /&gt;
    string.gsub!(/\s+/, ' ')&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
=====Issue 328=====&lt;br /&gt;
&lt;br /&gt;
'''Problem''': When importing teams, and a conflict exists there is an option to merge the two teams by inserting the new members into an existing team.&lt;br /&gt;
&lt;br /&gt;
'''Solution''': This was an issue to fix the functionality of Insert any new members into existing team. This was due to faulty handling of the option handle_dups and incorrect checking of parameters.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Code was modified to ensure minimal impact to existing testcases and functionalities.&amp;lt;br&amp;gt;&lt;br /&gt;
The handling of handle_dups in options was done assuming that the parameter was a symbol. But when tested, it was found to be a string and hence the handling was updated accordingly.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Code:&lt;br /&gt;
      name = handle_duplicate(team, name, id, options[&amp;quot;handle_dups&amp;quot;], teamtype)&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Also, the if and else conditions for checking class type of used was wrong. This was updated based on how the variable was assigned in the import_file_controller.rb#import_from_hash&lt;br /&gt;
Code:&lt;br /&gt;
      if(teamtype.is_a?(CourseTeam.class))&lt;br /&gt;
      elsif  teamtype.is_a?(AssignmentTeam.class)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E1938_Before_D.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
After fixing changes&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Insert_new_in_old.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Issue 329=====&lt;br /&gt;
&lt;br /&gt;
This was a request to add an option to rename existing team if there was a conflict in the team name.&amp;lt;br&amp;gt;&lt;br /&gt;
New code introduced was as follows:&amp;lt;br&amp;gt;&lt;br /&gt;
In start.html.erb&amp;lt;br&amp;gt;&lt;br /&gt;
In this file, the new option as displayed to the user is added&amp;lt;br&amp;gt;&lt;br /&gt;
          &amp;lt;option value=&amp;quot;rename_existing&amp;quot;&amp;gt;rename the existing team and import&amp;lt;/option&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In team.rb&amp;lt;br&amp;gt;&lt;br /&gt;
In this file, the handling of the new tag &amp;quot;rename_existing&amp;quot; is added wherein, the old team is updated with a new name.&amp;lt;br&amp;gt;&lt;br /&gt;
    # E1938: Added handling for renaming old team when conflict arises&lt;br /&gt;
    if handle_dups == &amp;quot;rename_existing&amp;quot;&lt;br /&gt;
      if teamtype.is_a?(CourseTeam.class)&lt;br /&gt;
        team.update(name: self.generate_team_name(Course.find(id).name))&lt;br /&gt;
      elsif  teamtype.is_a?(AssignmentTeam.class)&lt;br /&gt;
        team.update(name: self.generate_team_name(Assignment.find(id).name))&lt;br /&gt;
      end&lt;br /&gt;
      return name&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The state of D before conflicting import:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E1938_Before_D_1.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
After fixing changes&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:After_D.PNG]]&lt;br /&gt;
[[File:After_old_team.PNG]]&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
As you can see the new team got the name D and the old file got renamed to Team_17.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Issue 153=====&lt;br /&gt;
'''Requirement''': There should be a way to import a list of who has signed up for which topic. When a signup sheet is used in Expertiza, users are expected to sign up for topics. But, the instructor might've taken signups offline, e.g., by passing around a signup sheet in class. There should be a way to import this list to Expertiza, rather than impersonate all the students one by one and sign them up for a topic. &lt;br /&gt;
&lt;br /&gt;
'''Solution''': We have modified the existing implementation for import topics to assign the teams to the topics. We have changed the files to handle another column where the teams have been assigned to topics. The column is optional because there might be topics that have not yet been assigned to any teams&lt;br /&gt;
&lt;br /&gt;
'''Expectations from the import file: &lt;br /&gt;
'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
* Assigned team name should exist in the system, otherwise the import will fail. Instructor has to make sure that the teams which are assigned in the import file should exist with same names in the system or database. &lt;br /&gt;
* Instructor also need to ensure that the topic for which the team is being assigned should not be full or can accommodate new team assignment to the respective topic. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''Code Changes:'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''import_file/_sign_up_topic.html.erb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
As there's already a screen with select options to map the columns with the fields for import. We are just adding another column so the best way is to extend the existing select tag with a new option for the teams assigned. All the select tags has been changed with an additional option &amp;quot;Assigned Team&amp;quot;. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
 &amp;lt;th&amp;gt;&lt;br /&gt;
            &amp;lt;select name=&amp;quot;select1&amp;quot; id=&amp;quot;select1&amp;quot; class=&amp;quot;form-control&amp;quot; style=&amp;quot;background-color:lightgrey&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;topic_identifier&amp;quot;&amp;gt;Topic Identifier (required)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;topic_name&amp;quot;&amp;gt;Topic Name (required)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;max_choosers&amp;quot;&amp;gt;Max Choosers (required)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;category&amp;quot;&amp;gt;Category (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;description&amp;quot;&amp;gt;Description (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;link&amp;quot;&amp;gt;Link (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;assigned_team&amp;quot;&amp;gt;Assigned Team (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
            &amp;lt;/select&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''model/sign_up_topic.rb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The existing import function in the model import the topics to the topic table. As per the requirement and validations, topic should be imported first and then only the team can be assigned to the topic. So the existing import method has been modified to assign the team once the topic is imported in the database table. As per the edge case mentioned in the requirement document that few topics may not have any team assigned to it, so we first check if topic has any team assigned, then only it tries to map the topic with the team. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
  def self.import(row_hash, session, _id = nil)&lt;br /&gt;
    if row_hash.length &amp;lt; 3&lt;br /&gt;
      raise ArgumentError, &amp;quot;The CSV File expects the format: Topic identifier, Topic name, Max choosers, Topic Category (optional), Topic Description (Optional), Topic Link (optional), Assigned Team Name (optional).&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
    topic = SignUpTopic.where(topic_name: row_hash[:topic_name], assignment_id: session[:assignment_id]).first&lt;br /&gt;
    if topic.nil?&lt;br /&gt;
      attributes = ImportTopicsHelper.define_attributes(row_hash)&lt;br /&gt;
      topic_new_id = ImportTopicsHelper.create_new_sign_up_topic(attributes, session)&lt;br /&gt;
      unless row_hash[:assigned_team].nil?&lt;br /&gt;
          team = Team.where(name: row_hash[:assigned_team]).first&lt;br /&gt;
          ImportTopicsHelper.assign_team_topic(topic_new_id, team.id)&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      topic.max_choosers = row_hash[:max_choosers]&lt;br /&gt;
      topic.topic_identifier = row_hash[:topic_identifier]&lt;br /&gt;
      topic.save&lt;br /&gt;
      unless row_hash[:assigned_team].nil?&lt;br /&gt;
        team = Team.where(name: row_hash[:assigned_team]).first&lt;br /&gt;
        newteam = SignedUpTeam.where(topic_id: topic.id, team_id: team.id).first&lt;br /&gt;
        if newteam.nil?&lt;br /&gt;
          ImportTopicsHelper.assign_team_topic(topic.id, team.id)&lt;br /&gt;
        else&lt;br /&gt;
          newteam.team_id = team.id&lt;br /&gt;
          newteam.save&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''helpers/import_topics_helper.rb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Having the assign_team_topic in the helper would organize the code but also in the unit testing. We can isolate the model logic and test this method separately by writing the test cases. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
  def self.assign_team_topic(topic_id, assigned_team)&lt;br /&gt;
    attributes = {}&lt;br /&gt;
    attributes[&amp;quot;topic_id&amp;quot;] = topic_id&lt;br /&gt;
    attributes[&amp;quot;team_id&amp;quot;] = assigned_team&lt;br /&gt;
    assign_team = SignedUpTeam.new(attributes)&lt;br /&gt;
    assign_team.save!&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
   def self.create_new_sign_up_topic(attributes, session)&lt;br /&gt;
     sign_up_topic = SignUpTopic.new(attributes)&lt;br /&gt;
     sign_up_topic.assignment_id = session[:assignment_id]&lt;br /&gt;
     sign_up_topic.save&lt;br /&gt;
     # sign_up_topic&lt;br /&gt;
     sign_up_topic.save!&lt;br /&gt;
     sign_up_topic.id&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''controllers/import_file_controller.rb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Existing implementation for import have many flaws and design issues. Most of the code has been written with nested if else, which is not the practice to be followed. Also the names of the fields have been hardcoded. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
As we cannot change the complete import implementation. So i had to use the existing one the way it is and make changes to extend the functionality. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    if (params[:assigned_team] == 'true')&lt;br /&gt;
        @optional_count += 1&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
    elsif params[:optional_count] == '4'&lt;br /&gt;
          new_header = [params[:select1], params[:select2], params[:select3], params[:select4], params[:select5], params[:select6], params[:select7]]&lt;br /&gt;
          @header_integrated_body = hash_rows_with_headers(new_header,contents_hash[:body])&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''views/sign_up_sheet/_add_topics.html.erb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
This code has been used to display the columns in the footer.As we already have implementation for other columns, so another column name 'Assigned Team' is added here in this part of the code. &lt;br /&gt;
        &amp;lt;%= link_to 'Import topics',&lt;br /&gt;
                {&lt;br /&gt;
                    :controller =&amp;gt; 'import_file',&lt;br /&gt;
                    :action =&amp;gt; 'start',&lt;br /&gt;
                    :model =&amp;gt; 'SignUpTopic',&lt;br /&gt;
                    :id =&amp;gt; params[:id],&lt;br /&gt;
                    :expected_fields =&amp;gt; 'Topic Identifier' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Name' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Max Choosers' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Category &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Description &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Link &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Assigned Team &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
An option column checkbox (Teams Assigned) has been added to the UI&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Issue153SS8.jpg]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
A new column Assigned Team is added where the columns are being mapped. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File: Issue153SS7.jpg]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Test Plan''' ==&lt;br /&gt;
*'''RSpec:'''&lt;br /&gt;
&lt;br /&gt;
::We have added new testcases for the new pieces of code that were added by us.&lt;br /&gt;
&lt;br /&gt;
*'''UI Testing:'''&lt;br /&gt;
&lt;br /&gt;
::'''[Problem 1 (918)]'''&lt;br /&gt;
::::1. Login to Expertiza using username: instructor6 &amp;amp; password: password.&lt;br /&gt;
::::2. Go to Assignments and click on edit for any of the listed assignments.&lt;br /&gt;
::::3. Click on Topics tab.&lt;br /&gt;
::::4. Scroll down to the bottom of the page and click on Import topics.&lt;br /&gt;
::::5. Click on Topic Description checkbox and import the following file. (sample.csv)&lt;br /&gt;
::::[[File:918_p1.png]]&lt;br /&gt;
::::6. Click on next and make the header for 4th column as 'Description' from the dropdown.&lt;br /&gt;
::::[[File:918_p2.png]]&lt;br /&gt;
::::7. Import topics.&lt;br /&gt;
::::8. After this, a new topic should be imported which can be viewed from the aforementioned Topics tab. This newly imported topic will not have any non-ascii characters.&lt;br /&gt;
&lt;br /&gt;
::'''[Problem 3 (329)]'''&lt;br /&gt;
::::1. Login to Expertiza using username: instructor6 &amp;amp; password: password.&lt;br /&gt;
::::2. Select Manage &amp;gt; Courses or Assignments &amp;gt; Add Teams button &amp;gt; Import Team&lt;br /&gt;
::::3. In the screen that loads, select &amp;quot;rename the existing team and import&amp;quot; in the handle conflicts section.&lt;br /&gt;
::::4. Upload a file with the team details and select the appropriate delimiter.&lt;br /&gt;
::::5. Click on Create&lt;br /&gt;
::::6. Verify that the new team got created with the assigned name and the older team's name got changed.&lt;br /&gt;
&lt;br /&gt;
::'''[Problem 4 (328)]'''&lt;br /&gt;
::::1. Login to Expertiza using username: instructor6 &amp;amp; password: password.&lt;br /&gt;
::::2. Select Manage &amp;gt; Courses or Assignments &amp;gt; Add Teams button &amp;gt; Import Team&lt;br /&gt;
::::3. In the screen that loads, select &amp;quot;Insert any new members into existing team&amp;quot; in the handle conflicts section.&lt;br /&gt;
::::4. Upload a file with the team details and select the appropriate delimiter.&lt;br /&gt;
::::5. Click on Create&lt;br /&gt;
::::6. Verify that the existing team got updated with the new team members&lt;br /&gt;
&lt;br /&gt;
::::[[File:DB Snapshot.png]]&lt;br /&gt;
&lt;br /&gt;
== '''Possible Enhancements''' ==&lt;br /&gt;
&lt;br /&gt;
====='''Import functionality'''=====&lt;br /&gt;
&lt;br /&gt;
The existing import implementation does not follow DRY principle, rails code practices and even basic design principles. Most of the code is written based with nested if else conditions. This implementation can be improved. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Exception Handling: Before starting to work on this requirement. I tried few imports and in many cases, import was not successful and i was not able to figure out what's going wrong. My suggestion would be to develop a screen to show which rows were successfully imported and the failure reason which didn't. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Also, if there's no team in the system and instructor has used it in the import file so a new pop up can be displayed where the new team can be created or the import can be extended to create teams while assigning the topic. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1. Expertiza on GITHUB: https://github.com/expertiza/expertiza&lt;br /&gt;
&lt;br /&gt;
2. GitHub Project Repository Fork: https://github.com/NisargC/expertiza&lt;br /&gt;
&lt;br /&gt;
3. Demo link: http://152.46.19.138:8080/&lt;br /&gt;
&lt;br /&gt;
4. Expertiza project documentation wiki: http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2019_-_E1938._OSS_project_Duke_Blue:_Fix_import_glitches&lt;/div&gt;</summary>
		<author><name>Nmchoks2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1938._OSS_project_Duke_Blue:_Fix_import_glitches&amp;diff=127490</id>
		<title>CSC/ECE 517 Fall 2019 - E1938. OSS project Duke Blue: Fix import glitches</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1938._OSS_project_Duke_Blue:_Fix_import_glitches&amp;diff=127490"/>
		<updated>2019-11-06T23:02:27Z</updated>

		<summary type="html">&lt;p&gt;Nmchoks2: /* Issue 328 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
== '''About Expertiza''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source project based on Ruby on Rails framework and the code is available on Github. Expertiza allows the instructor to create new assignments as well as edit new or existing assignments. Instructors can also create a list of topics the students can sign up for and specify deadlines for completion of various tasks. Students can form teams in Expertiza to work on various projects and assignments as well as peer review other students' submissions. Expertiza supports submission across various document types, including the URLs Wiki pages.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
The import feature is the most helpful feature for instructors to set up assignments. The instructors usually have a list of students, teams, etc from their learning management system. Being able to import these into expertiza saves a lot of time when setting up an assignment. Unfortunately this feature has some bugs that were identified as the following list. &lt;br /&gt;
&lt;br /&gt;
'''Issue 918''': It seems that non-ASCII characters in the description (e.g., a curly apostrophe, and perhaps also an en-dash) caused a SQL error in inserting the description string into the db. I had to edit the import file to remove non-ASCII characters. Any Unicode character ought to be allowed in a description. &lt;br /&gt;
&lt;br /&gt;
'''Issue 153''': There should be a way to import a list of who has signed up for which topic. When a signup sheet is used in Expertiza, users are expected to sign up for topics. But, the instructor might've taken signups offline, e.g., by passing around a signup sheet in class. There should be a way to import this list to Expertiza, rather than impersonate all the students one by one and sign them up for a topic. '''This issue is not a bug but an additional feature to the existing import topic functionality.'''&lt;br /&gt;
&lt;br /&gt;
'''Issue 329''': When importing teams there are different options to handle conflicting team names &lt;br /&gt;
&lt;br /&gt;
'''Issue 328''': When importing teams, and a conflict exists there is an option to merge the two teams by inserting the new members into an existing team. Unfortunately, this feature is broken. we tried to import a team and selected 'Insert any new members into existing team'. No new team members were in fact inserted into the team&lt;br /&gt;
&lt;br /&gt;
== '''Fixes''' ==&lt;br /&gt;
=====Issue 918=====&lt;br /&gt;
&lt;br /&gt;
New code introduced is as follows.&amp;lt;br&amp;gt;&lt;br /&gt;
File:app/helpers/import_topics_helper.rb &amp;lt;br&amp;gt;&lt;br /&gt;
Code:&lt;br /&gt;
def self.define_attributes(row_hash)&lt;br /&gt;
    attributes = {}&lt;br /&gt;
    if !row_hash[:description].nil? and !row_hash[:description].ascii_only?&lt;br /&gt;
      row_hash[:description] = self.trim_non_ascii(row_hash[:description])&lt;br /&gt;
      puts row_hash[:description]&lt;br /&gt;
    end&lt;br /&gt;
    attributes[&amp;quot;topic_identifier&amp;quot;] = row_hash[:topic_identifier].strip&lt;br /&gt;
    attributes[&amp;quot;topic_name&amp;quot;] = row_hash[:topic_name].strip&lt;br /&gt;
    attributes[&amp;quot;max_choosers&amp;quot;] = row_hash[:max_choosers].strip&lt;br /&gt;
    attributes&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def self.trim_non_ascii(string)&lt;br /&gt;
    string.split('').each do |char|&lt;br /&gt;
      !char.ascii_only? ? string.tr!(char, ' ') : nil&lt;br /&gt;
    end&lt;br /&gt;
    string.gsub!(/\s+/, ' ')&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
=====Issue 328=====&lt;br /&gt;
&lt;br /&gt;
'''Problem''': When importing teams, and a conflict exists there is an option to merge the two teams by inserting the new members into an existing team.&lt;br /&gt;
&lt;br /&gt;
'''Solution''': This was an issue to fix the functionality of Insert any new members into existing team. This was due to faulty handling of the option handle_dups and incorrect checking of parameters.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Code was modified to ensure minimal impact to existing testcases and functionalities.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Code:&lt;br /&gt;
      name = handle_duplicate(team, name, id, options[&amp;quot;handle_dups&amp;quot;], teamtype)&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E1938_Before_D.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
After fixing changes&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Insert_new_in_old.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Issue 329=====&lt;br /&gt;
&lt;br /&gt;
This was a request to add an option to rename existing team if there was a conflict in the team name.&amp;lt;br&amp;gt;&lt;br /&gt;
New code introduced was as follows:&amp;lt;br&amp;gt;&lt;br /&gt;
In start.html.erb&amp;lt;br&amp;gt;&lt;br /&gt;
In this file, the new option as displayed to the user is added&amp;lt;br&amp;gt;&lt;br /&gt;
          &amp;lt;option value=&amp;quot;rename_existing&amp;quot;&amp;gt;rename the existing team and import&amp;lt;/option&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In team.rb&amp;lt;br&amp;gt;&lt;br /&gt;
In this file, the handling of the new tag &amp;quot;rename_existing&amp;quot; is added wherein, the old team is updated with a new name.&amp;lt;br&amp;gt;&lt;br /&gt;
    # E1938: Added handling for renaming old team when conflict arises&lt;br /&gt;
    if handle_dups == &amp;quot;rename_existing&amp;quot;&lt;br /&gt;
      if teamtype.is_a?(CourseTeam.class)&lt;br /&gt;
        team.update(name: self.generate_team_name(Course.find(id).name))&lt;br /&gt;
      elsif  teamtype.is_a?(AssignmentTeam.class)&lt;br /&gt;
        team.update(name: self.generate_team_name(Assignment.find(id).name))&lt;br /&gt;
      end&lt;br /&gt;
      return name&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The state of D before conflicting import:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E1938_Before_D_1.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
After fixing changes&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:After_D.PNG]]&lt;br /&gt;
[[File:After_old_team.PNG]]&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
As you can see the new team got the name D and the old file got renamed to Team_17.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Issue 153=====&lt;br /&gt;
'''Requirement''': There should be a way to import a list of who has signed up for which topic. When a signup sheet is used in Expertiza, users are expected to sign up for topics. But, the instructor might've taken signups offline, e.g., by passing around a signup sheet in class. There should be a way to import this list to Expertiza, rather than impersonate all the students one by one and sign them up for a topic. &lt;br /&gt;
&lt;br /&gt;
'''Solution''': We have modified the existing implementation for import topics to assign the teams to the topics. We have changed the files to handle another column where the teams have been assigned to topics. The column is optional because there might be topics that have not yet been assigned to any teams&lt;br /&gt;
&lt;br /&gt;
'''Expectations from the import file: &lt;br /&gt;
'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
* Assigned team name should exist in the system, otherwise the import will fail. Instructor has to make sure that the teams which are assigned in the import file should exist with same names in the system or database. &lt;br /&gt;
* Instructor also need to ensure that the topic for which the team is being assigned should not be full or can accommodate new team assignment to the respective topic. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''Code Changes:'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''import_file/_sign_up_topic.html.erb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
As there's already a screen with select options to map the columns with the fields for import. We are just adding another column so the best way is to extend the existing select tag with a new option for the teams assigned. All the select tags has been changed with an additional option &amp;quot;Assigned Team&amp;quot;. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
 &amp;lt;th&amp;gt;&lt;br /&gt;
            &amp;lt;select name=&amp;quot;select1&amp;quot; id=&amp;quot;select1&amp;quot; class=&amp;quot;form-control&amp;quot; style=&amp;quot;background-color:lightgrey&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;topic_identifier&amp;quot;&amp;gt;Topic Identifier (required)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;topic_name&amp;quot;&amp;gt;Topic Name (required)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;max_choosers&amp;quot;&amp;gt;Max Choosers (required)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;category&amp;quot;&amp;gt;Category (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;description&amp;quot;&amp;gt;Description (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;link&amp;quot;&amp;gt;Link (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;assigned_team&amp;quot;&amp;gt;Assigned Team (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
            &amp;lt;/select&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''model/sign_up_topic.rb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The existing import function in the model import the topics to the topic table. As per the requirement and validations, topic should be imported first and then only the team can be assigned to the topic. So the existing import method has been modified to assign the team once the topic is imported in the database table. As per the edge case mentioned in the requirement document that few topics may not have any team assigned to it, so we first check if topic has any team assigned, then only it tries to map the topic with the team. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
  def self.import(row_hash, session, _id = nil)&lt;br /&gt;
    if row_hash.length &amp;lt; 3&lt;br /&gt;
      raise ArgumentError, &amp;quot;The CSV File expects the format: Topic identifier, Topic name, Max choosers, Topic Category (optional), Topic Description (Optional), Topic Link (optional), Assigned Team Name (optional).&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
    topic = SignUpTopic.where(topic_name: row_hash[:topic_name], assignment_id: session[:assignment_id]).first&lt;br /&gt;
    if topic.nil?&lt;br /&gt;
      attributes = ImportTopicsHelper.define_attributes(row_hash)&lt;br /&gt;
      topic_new_id = ImportTopicsHelper.create_new_sign_up_topic(attributes, session)&lt;br /&gt;
      unless row_hash[:assigned_team].nil?&lt;br /&gt;
          team = Team.where(name: row_hash[:assigned_team]).first&lt;br /&gt;
          ImportTopicsHelper.assign_team_topic(topic_new_id, team.id)&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      topic.max_choosers = row_hash[:max_choosers]&lt;br /&gt;
      topic.topic_identifier = row_hash[:topic_identifier]&lt;br /&gt;
      topic.save&lt;br /&gt;
      unless row_hash[:assigned_team].nil?&lt;br /&gt;
        team = Team.where(name: row_hash[:assigned_team]).first&lt;br /&gt;
        newteam = SignedUpTeam.where(topic_id: topic.id, team_id: team.id).first&lt;br /&gt;
        if newteam.nil?&lt;br /&gt;
          ImportTopicsHelper.assign_team_topic(topic.id, team.id)&lt;br /&gt;
        else&lt;br /&gt;
          newteam.team_id = team.id&lt;br /&gt;
          newteam.save&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''helpers/import_topics_helper.rb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Having the assign_team_topic in the helper would organize the code but also in the unit testing. We can isolate the model logic and test this method separately by writing the test cases. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
  def self.assign_team_topic(topic_id, assigned_team)&lt;br /&gt;
    attributes = {}&lt;br /&gt;
    attributes[&amp;quot;topic_id&amp;quot;] = topic_id&lt;br /&gt;
    attributes[&amp;quot;team_id&amp;quot;] = assigned_team&lt;br /&gt;
    assign_team = SignedUpTeam.new(attributes)&lt;br /&gt;
    assign_team.save!&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
   def self.create_new_sign_up_topic(attributes, session)&lt;br /&gt;
     sign_up_topic = SignUpTopic.new(attributes)&lt;br /&gt;
     sign_up_topic.assignment_id = session[:assignment_id]&lt;br /&gt;
     sign_up_topic.save&lt;br /&gt;
     # sign_up_topic&lt;br /&gt;
     sign_up_topic.save!&lt;br /&gt;
     sign_up_topic.id&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''controllers/import_file_controller.rb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Existing implementation for import have many flaws and design issues. Most of the code has been written with nested if else, which is not the practice to be followed. Also the names of the fields have been hardcoded. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
As we cannot change the complete import implementation. So i had to use the existing one the way it is and make changes to extend the functionality. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    if (params[:assigned_team] == 'true')&lt;br /&gt;
        @optional_count += 1&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
    elsif params[:optional_count] == '4'&lt;br /&gt;
          new_header = [params[:select1], params[:select2], params[:select3], params[:select4], params[:select5], params[:select6], params[:select7]]&lt;br /&gt;
          @header_integrated_body = hash_rows_with_headers(new_header,contents_hash[:body])&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''views/sign_up_sheet/_add_topics.html.erb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
This code has been used to display the columns in the footer.As we already have implementation for other columns, so another column name 'Assigned Team' is added here in this part of the code. &lt;br /&gt;
        &amp;lt;%= link_to 'Import topics',&lt;br /&gt;
                {&lt;br /&gt;
                    :controller =&amp;gt; 'import_file',&lt;br /&gt;
                    :action =&amp;gt; 'start',&lt;br /&gt;
                    :model =&amp;gt; 'SignUpTopic',&lt;br /&gt;
                    :id =&amp;gt; params[:id],&lt;br /&gt;
                    :expected_fields =&amp;gt; 'Topic Identifier' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Name' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Max Choosers' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Category &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Description &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Link &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Assigned Team &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
An option column checkbox (Teams Assigned) has been added to the UI&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Issue153SS8.jpg]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
A new column Assigned Team is added where the columns are being mapped. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File: Issue153SS7.jpg]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Test Plan''' ==&lt;br /&gt;
*'''RSpec:'''&lt;br /&gt;
&lt;br /&gt;
::We have added new testcases for the new pieces of code that were added by us.&lt;br /&gt;
&lt;br /&gt;
*'''UI Testing:'''&lt;br /&gt;
&lt;br /&gt;
::'''[Problem 1 (918)]'''&lt;br /&gt;
::::1. Login to Expertiza using username: instructor6 &amp;amp; password: password.&lt;br /&gt;
::::2. Go to Assignments and click on edit for any of the listed assignments.&lt;br /&gt;
::::3. Click on Topics tab.&lt;br /&gt;
::::4. Scroll down to the bottom of the page and click on Import topics.&lt;br /&gt;
::::5. Click on Topic Description checkbox and import the following file. (sample.csv)&lt;br /&gt;
::::[[File:918_p1.png]]&lt;br /&gt;
::::6. Click on next and make the header for 4th column as 'Description' from the dropdown.&lt;br /&gt;
::::[[File:918_p2.png]]&lt;br /&gt;
::::7. Import topics.&lt;br /&gt;
::::8. After this, a new topic should be imported which can be viewed from the aforementioned Topics tab. This newly imported topic will not have any non-ascii characters.&lt;br /&gt;
&lt;br /&gt;
::'''[Problem 3 (329)]'''&lt;br /&gt;
::::1. Login to Expertiza using username: instructor6 &amp;amp; password: password.&lt;br /&gt;
::::2. Select Manage &amp;gt; Courses or Assignments &amp;gt; Add Teams button &amp;gt; Import Team&lt;br /&gt;
::::3. In the screen that loads, select &amp;quot;rename the existing team and import&amp;quot; in the handle conflicts section.&lt;br /&gt;
::::4. Upload a file with the team details and select the appropriate delimiter.&lt;br /&gt;
::::5. Click on Create&lt;br /&gt;
::::6. Verify that the new team got created with the assigned name and the older team's name got changed.&lt;br /&gt;
&lt;br /&gt;
::'''[Problem 4 (328)]'''&lt;br /&gt;
::::1. Login to Expertiza using username: instructor6 &amp;amp; password: password.&lt;br /&gt;
::::2. Select Manage &amp;gt; Courses or Assignments &amp;gt; Add Teams button &amp;gt; Import Team&lt;br /&gt;
::::3. In the screen that loads, select &amp;quot;Insert any new members into existing team&amp;quot; in the handle conflicts section.&lt;br /&gt;
::::4. Upload a file with the team details and select the appropriate delimiter.&lt;br /&gt;
::::5. Click on Create&lt;br /&gt;
::::6. Verify that the existing team got updated with the new team members&lt;br /&gt;
&lt;br /&gt;
::::[[File:DB Snapshot.png]]&lt;br /&gt;
&lt;br /&gt;
== '''Possible Enhancements''' ==&lt;br /&gt;
&lt;br /&gt;
====='''Import functionality'''=====&lt;br /&gt;
&lt;br /&gt;
The existing import implementation does not follow DRY principle, rails code practices and even basic design principles. Most of the code is written based with nested if else conditions. This implementation can be improved. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Exception Handling: Before starting to work on this requirement. I tried few imports and in many cases, import was not successful and i was not able to figure out what's going wrong. My suggestion would be to develop a screen to show which rows were successfully imported and the failure reason which didn't. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Also, if there's no team in the system and instructor has used it in the import file so a new pop up can be displayed where the new team can be created or the import can be extended to create teams while assigning the topic. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1. Expertiza on GITHUB: https://github.com/expertiza/expertiza&lt;br /&gt;
&lt;br /&gt;
2. GitHub Project Repository Fork: https://github.com/NisargC/expertiza&lt;br /&gt;
&lt;br /&gt;
3. Demo link: http://152.46.19.138:8080/&lt;br /&gt;
&lt;br /&gt;
4. Expertiza project documentation wiki: http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2019_-_E1938._OSS_project_Duke_Blue:_Fix_import_glitches&lt;/div&gt;</summary>
		<author><name>Nmchoks2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1938._OSS_project_Duke_Blue:_Fix_import_glitches&amp;diff=127473</id>
		<title>CSC/ECE 517 Fall 2019 - E1938. OSS project Duke Blue: Fix import glitches</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1938._OSS_project_Duke_Blue:_Fix_import_glitches&amp;diff=127473"/>
		<updated>2019-11-06T22:52:28Z</updated>

		<summary type="html">&lt;p&gt;Nmchoks2: /* Test Plan */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
== '''About Expertiza''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source project based on Ruby on Rails framework and the code is available on Github. Expertiza allows the instructor to create new assignments as well as edit new or existing assignments. Instructors can also create a list of topics the students can sign up for and specify deadlines for completion of various tasks. Students can form teams in Expertiza to work on various projects and assignments as well as peer review other students' submissions. Expertiza supports submission across various document types, including the URLs Wiki pages.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
The import feature is the most helpful feature for instructors to set up assignments. The instructors usually have a list of students, teams, etc from their learning management system. Being able to import these into expertiza saves a lot of time when setting up an assignment. Unfortunately this feature has some bugs that were identified as the following list. &lt;br /&gt;
&lt;br /&gt;
'''Issue 918''': It seems that non-ASCII characters in the description (e.g., a curly apostrophe, and perhaps also an en-dash) caused a SQL error in inserting the description string into the db. I had to edit the import file to remove non-ASCII characters. Any Unicode character ought to be allowed in a description. &lt;br /&gt;
&lt;br /&gt;
'''Issue 153''': There should be a way to import a list of who has signed up for which topic. When a signup sheet is used in Expertiza, users are expected to sign up for topics. But, the instructor might've taken signups offline, e.g., by passing around a signup sheet in class. There should be a way to import this list to Expertiza, rather than impersonate all the students one by one and sign them up for a topic. '''This issue is not a bug but an additional feature to the existing import topic functionality.'''&lt;br /&gt;
&lt;br /&gt;
'''Issue 329''': When importing teams there are different options to handle conflicting team names &lt;br /&gt;
&lt;br /&gt;
'''Issue 328''': When importing teams, and a conflict exists there is an option to merge the two teams by inserting the new members into an existing team. Unfortunately, this feature is broken. we tried to import a team and selected 'Insert any new members into existing team'. No new team members were in fact inserted into the team&lt;br /&gt;
&lt;br /&gt;
== '''Fixes''' ==&lt;br /&gt;
=====Issue 918=====&lt;br /&gt;
&lt;br /&gt;
New code introduced is as follows.&amp;lt;br&amp;gt;&lt;br /&gt;
File:app/helpers/import_topics_helper.rb &amp;lt;br&amp;gt;&lt;br /&gt;
Code:&lt;br /&gt;
def self.define_attributes(row_hash)&lt;br /&gt;
    attributes = {}&lt;br /&gt;
    if !row_hash[:description].nil? and !row_hash[:description].ascii_only?&lt;br /&gt;
      row_hash[:description] = self.trim_non_ascii(row_hash[:description])&lt;br /&gt;
      puts row_hash[:description]&lt;br /&gt;
    end&lt;br /&gt;
    attributes[&amp;quot;topic_identifier&amp;quot;] = row_hash[:topic_identifier].strip&lt;br /&gt;
    attributes[&amp;quot;topic_name&amp;quot;] = row_hash[:topic_name].strip&lt;br /&gt;
    attributes[&amp;quot;max_choosers&amp;quot;] = row_hash[:max_choosers].strip&lt;br /&gt;
    attributes&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def self.trim_non_ascii(string)&lt;br /&gt;
    string.split('').each do |char|&lt;br /&gt;
      !char.ascii_only? ? string.tr!(char, ' ') : nil&lt;br /&gt;
    end&lt;br /&gt;
    string.gsub!(/\s+/, ' ')&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
=====Issue 328=====&lt;br /&gt;
&lt;br /&gt;
This was an issue to fix the functionality of Insert any new members into existing team. This was due to faulty handling of the option handle_dups and incorrect checking of parameters.&amp;lt;br&amp;gt;&lt;br /&gt;
Code was modified to ensure minimal impact to existing testcases and functionalities.&amp;lt;br&amp;gt;&lt;br /&gt;
Code:&lt;br /&gt;
      name = handle_duplicate(team, name, id, options[&amp;quot;handle_dups&amp;quot;], teamtype)&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E1938_Before_D.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
After fixing changes&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Insert_new_in_old.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
=====Issue 329=====&lt;br /&gt;
&lt;br /&gt;
This was a request to add an option to rename existing team if there was a conflict in the team name.&amp;lt;br&amp;gt;&lt;br /&gt;
New code introduced was as follows:&amp;lt;br&amp;gt;&lt;br /&gt;
In start.html.erb&amp;lt;br&amp;gt;&lt;br /&gt;
In this file, the new option as displayed to the user is added&amp;lt;br&amp;gt;&lt;br /&gt;
          &amp;lt;option value=&amp;quot;rename_existing&amp;quot;&amp;gt;rename the existing team and import&amp;lt;/option&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In team.rb&amp;lt;br&amp;gt;&lt;br /&gt;
In this file, the handling of the new tag &amp;quot;rename_existing&amp;quot; is added wherein, the old team is updated with a new name.&amp;lt;br&amp;gt;&lt;br /&gt;
    # E1938: Added handling for renaming old team when conflict arises&lt;br /&gt;
    if handle_dups == &amp;quot;rename_existing&amp;quot;&lt;br /&gt;
      if teamtype.is_a?(CourseTeam.class)&lt;br /&gt;
        team.update(name: self.generate_team_name(Course.find(id).name))&lt;br /&gt;
      elsif  teamtype.is_a?(AssignmentTeam.class)&lt;br /&gt;
        team.update(name: self.generate_team_name(Assignment.find(id).name))&lt;br /&gt;
      end&lt;br /&gt;
      return name&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The state of D before conflicting import:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E1938_Before_D_1.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
After fixing changes&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:After_D.PNG]]&lt;br /&gt;
[[File:After_old_team.PNG]]&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
As you can see the new team got the name D and the old file got renamed to Team_17.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Issue 153=====&lt;br /&gt;
'''Requirement''': There should be a way to import a list of who has signed up for which topic. When a signup sheet is used in Expertiza, users are expected to sign up for topics. But, the instructor might've taken signups offline, e.g., by passing around a signup sheet in class. There should be a way to import this list to Expertiza, rather than impersonate all the students one by one and sign them up for a topic. &lt;br /&gt;
&lt;br /&gt;
'''Solution''': We have modified the existing implementation for import topics to assign the teams to the topics. We have changed the files to handle another column where the teams have been assigned to topics. The column is optional because there might be topics that have not yet been assigned to any teams&lt;br /&gt;
&lt;br /&gt;
'''Expectations from the import file: &lt;br /&gt;
'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
* Assigned team name should exist in the system, otherwise the import will fail. Instructor has to make sure that the teams which are assigned in the import file should exist with same names in the system or database. &lt;br /&gt;
* Instructor also need to ensure that the topic for which the team is being assigned should not be full or can accommodate new team assignment to the respective topic. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''Code Changes:'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''import_file/_sign_up_topic.html.erb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
As there's already a screen with select options to map the columns with the fields for import. We are just adding another column so the best way is to extend the existing select tag with a new option for the teams assigned. All the select tags has been changed with an additional option &amp;quot;Assigned Team&amp;quot;. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
 &amp;lt;th&amp;gt;&lt;br /&gt;
            &amp;lt;select name=&amp;quot;select1&amp;quot; id=&amp;quot;select1&amp;quot; class=&amp;quot;form-control&amp;quot; style=&amp;quot;background-color:lightgrey&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;topic_identifier&amp;quot;&amp;gt;Topic Identifier (required)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;topic_name&amp;quot;&amp;gt;Topic Name (required)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;max_choosers&amp;quot;&amp;gt;Max Choosers (required)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;category&amp;quot;&amp;gt;Category (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;description&amp;quot;&amp;gt;Description (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;link&amp;quot;&amp;gt;Link (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;assigned_team&amp;quot;&amp;gt;Assigned Team (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
            &amp;lt;/select&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''model/sign_up_topic.rb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The existing import function in the model import the topics to the topic table. As per the requirement and validations, topic should be imported first and then only the team can be assigned to the topic. So the existing import method has been modified to assign the team once the topic is imported in the database table. As per the edge case mentioned in the requirement document that few topics may not have any team assigned to it, so we first check if topic has any team assigned, then only it tries to map the topic with the team. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
  def self.import(row_hash, session, _id = nil)&lt;br /&gt;
    if row_hash.length &amp;lt; 3&lt;br /&gt;
      raise ArgumentError, &amp;quot;The CSV File expects the format: Topic identifier, Topic name, Max choosers, Topic Category (optional), Topic Description (Optional), Topic Link (optional), Assigned Team Name (optional).&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
    topic = SignUpTopic.where(topic_name: row_hash[:topic_name], assignment_id: session[:assignment_id]).first&lt;br /&gt;
    if topic.nil?&lt;br /&gt;
      attributes = ImportTopicsHelper.define_attributes(row_hash)&lt;br /&gt;
      topic_new_id = ImportTopicsHelper.create_new_sign_up_topic(attributes, session)&lt;br /&gt;
      unless row_hash[:assigned_team].nil?&lt;br /&gt;
          team = Team.where(name: row_hash[:assigned_team]).first&lt;br /&gt;
          ImportTopicsHelper.assign_team_topic(topic_new_id, team.id)&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      topic.max_choosers = row_hash[:max_choosers]&lt;br /&gt;
      topic.topic_identifier = row_hash[:topic_identifier]&lt;br /&gt;
      topic.save&lt;br /&gt;
      unless row_hash[:assigned_team].nil?&lt;br /&gt;
        team = Team.where(name: row_hash[:assigned_team]).first&lt;br /&gt;
        newteam = SignedUpTeam.where(topic_id: topic.id, team_id: team.id).first&lt;br /&gt;
        if newteam.nil?&lt;br /&gt;
          ImportTopicsHelper.assign_team_topic(topic.id, team.id)&lt;br /&gt;
        else&lt;br /&gt;
          newteam.team_id = team.id&lt;br /&gt;
          newteam.save&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''helpers/import_topics_helper.rb'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Having the assign_team_topic in the helper would organize the code but also in the unit testing. We can isolate the model logic and test this method separately by writing the test cases. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
  def self.assign_team_topic(topic_id, assigned_team)&lt;br /&gt;
    attributes = {}&lt;br /&gt;
    attributes[&amp;quot;topic_id&amp;quot;] = topic_id&lt;br /&gt;
    attributes[&amp;quot;team_id&amp;quot;] = assigned_team&lt;br /&gt;
    assign_team = SignedUpTeam.new(attributes)&lt;br /&gt;
    assign_team.save!&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
   def self.create_new_sign_up_topic(attributes, session)&lt;br /&gt;
     sign_up_topic = SignUpTopic.new(attributes)&lt;br /&gt;
     sign_up_topic.assignment_id = session[:assignment_id]&lt;br /&gt;
     sign_up_topic.save&lt;br /&gt;
     # sign_up_topic&lt;br /&gt;
     sign_up_topic.save!&lt;br /&gt;
     sign_up_topic.id&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
controllers/import_file_controller.rb&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Existing implementation for import have many flaws and design issues. Most of the code has been written with nested if else, which is not the practice to be followed. Also the names of the fields have been hardcoded. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
As we cannot change the complete import implementation. So i had to use the existing one the way it is and make changes to extend the functionality. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    if (params[:assigned_team] == 'true')&lt;br /&gt;
        @optional_count += 1&lt;br /&gt;
    end&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
controllers/import_file_controller.rb (import_from_hash)&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    elsif params[:optional_count] == '4'&lt;br /&gt;
          new_header = [params[:select1], params[:select2], params[:select3], params[:select4], params[:select5], params[:select6], params[:select7]]&lt;br /&gt;
          @header_integrated_body = hash_rows_with_headers(new_header,contents_hash[:body])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
views/sign_up_sheet/_add_topics.html.erb&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
This code has been used to display the columns in the footer.As we already have implementation for other columns, so another column name 'Assigned Team' is added here in this part of the code. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
        &amp;lt;%= link_to 'Import topics',&lt;br /&gt;
                {&lt;br /&gt;
                    :controller =&amp;gt; 'import_file',&lt;br /&gt;
                    :action =&amp;gt; 'start',&lt;br /&gt;
                    :model =&amp;gt; 'SignUpTopic',&lt;br /&gt;
                    :id =&amp;gt; params[:id],&lt;br /&gt;
                    :expected_fields =&amp;gt; 'Topic Identifier' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Name' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Max Choosers' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Category &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Description &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Link &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Assigned Team &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
An option column checkbox (Teams Assigned) has been added to the UI&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Issue153SS8.jpg]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
A new column Assigned Team is added where the columns are being mapped. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File: Issue153SS7.jpg]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Test Plan''' ==&lt;br /&gt;
*'''RSpec:'''&lt;br /&gt;
&lt;br /&gt;
::We have added new testcases for the new pieces of code that were added by us.&lt;br /&gt;
&lt;br /&gt;
*'''UI Testing:'''&lt;br /&gt;
&lt;br /&gt;
::'''[Problem 3 (329)]'''&lt;br /&gt;
::::1. Login to Expertiza using username: instructor6 &amp;amp; password: password.&lt;br /&gt;
::::2. Select Manage &amp;gt; Courses or Assignments &amp;gt; Add Teams button &amp;gt; Import Team&lt;br /&gt;
::::3. In the screen that loads, select &amp;quot;rename the existing team and import&amp;quot; in the handle conflicts section.&lt;br /&gt;
::::4. Upload a file with the team details and select the appropriate delimiter.&lt;br /&gt;
::::5. Click on Create&lt;br /&gt;
::::6. Verify that the new team got created with the assigned name and the older team's name got changed.&lt;br /&gt;
&lt;br /&gt;
::'''[Problem 4 (328)]'''&lt;br /&gt;
::::1. Login to Expertiza using username: instructor6 &amp;amp; password: password.&lt;br /&gt;
::::2. Select Manage &amp;gt; Courses or Assignments &amp;gt; Add Teams button &amp;gt; Import Team&lt;br /&gt;
::::3. In the screen that loads, select &amp;quot;Insert any new members into existing team&amp;quot; in the handle conflicts section.&lt;br /&gt;
::::4. Upload a file with the team details and select the appropriate delimiter.&lt;br /&gt;
::::5. Click on Create&lt;br /&gt;
::::6. Verify that the existing team got updated with the new team members&lt;br /&gt;
&lt;br /&gt;
::::[[File:DB Snapshot.png]]&lt;br /&gt;
&lt;br /&gt;
== '''Possible Enhancements''' ==&lt;br /&gt;
&lt;br /&gt;
====='''Import functionality'''=====&lt;br /&gt;
&lt;br /&gt;
The existing import implementation does not follow DRY principle, rails code practices and even basic design principles. Most of the code is written based with nested if else conditions. This implementation can be improved. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Exception Handling: Before starting to work on this requirement. I tried few imports and in many cases, import was not successful and i was not able to figure out what's going wrong. My suggestion would be to develop a screen to show which rows were successfully imported and the failure reason which didn't. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Also, if there's no team in the system and instructor has used it in the import file so a new pop up can be displayed where the new team can be created or the import can be extended to create teams while assigning the topic. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1. Expertiza on GITHUB: https://github.com/expertiza/expertiza&lt;br /&gt;
&lt;br /&gt;
2. GitHub Project Repository Fork: https://github.com/NisargC/expertiza&lt;br /&gt;
&lt;br /&gt;
3. Demo link: http://152.46.19.138:8080/&lt;br /&gt;
&lt;br /&gt;
4. Expertiza project documentation wiki: http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2019_-_E1938._OSS_project_Duke_Blue:_Fix_import_glitches&lt;/div&gt;</summary>
		<author><name>Nmchoks2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1938._OSS_project_Duke_Blue:_Fix_import_glitches&amp;diff=127460</id>
		<title>CSC/ECE 517 Fall 2019 - E1938. OSS project Duke Blue: Fix import glitches</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1938._OSS_project_Duke_Blue:_Fix_import_glitches&amp;diff=127460"/>
		<updated>2019-11-06T22:47:25Z</updated>

		<summary type="html">&lt;p&gt;Nmchoks2: /* Test Plan */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
== '''About Expertiza''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source project based on Ruby on Rails framework and the code is available on Github. Expertiza allows the instructor to create new assignments as well as edit new or existing assignments. Instructors can also create a list of topics the students can sign up for and specify deadlines for completion of various tasks. Students can form teams in Expertiza to work on various projects and assignments as well as peer review other students' submissions. Expertiza supports submission across various document types, including the URLs Wiki pages.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
The import feature is the most helpful feature for instructors to set up assignments. The instructors usually have a list of students, teams, etc from their learning management system. Being able to import these into expertiza saves a lot of time when setting up an assignment. Unfortunately this feature has some bugs that were identified as the following list. &lt;br /&gt;
&lt;br /&gt;
'''Issue 918''': It seems that non-ASCII characters in the description (e.g., a curly apostrophe, and perhaps also an en-dash) caused a SQL error in inserting the description string into the db. I had to edit the import file to remove non-ASCII characters. Any Unicode character ought to be allowed in a description. &lt;br /&gt;
&lt;br /&gt;
'''Issue 153''': There should be a way to import a list of who has signed up for which topic. When a signup sheet is used in Expertiza, users are expected to sign up for topics. But, the instructor might've taken signups offline, e.g., by passing around a signup sheet in class. There should be a way to import this list to Expertiza, rather than impersonate all the students one by one and sign them up for a topic. '''This issue is not a bug but an additional feature to the existing import topic functionality.'''&lt;br /&gt;
&lt;br /&gt;
'''Issue 329''': When importing teams there are different options to handle conflicting team names &lt;br /&gt;
&lt;br /&gt;
'''Issue 328''': When importing teams, and a conflict exists there is an option to merge the two teams by inserting the new members into an existing team. Unfortunately, this feature is broken. we tried to import a team and selected 'Insert any new members into existing team'. No new team members were in fact inserted into the team&lt;br /&gt;
&lt;br /&gt;
== '''Fixes''' ==&lt;br /&gt;
=====Issue 918=====&lt;br /&gt;
&lt;br /&gt;
New code introduced is as follows.&amp;lt;br&amp;gt;&lt;br /&gt;
File:app/helpers/import_topics_helper.rb &amp;lt;br&amp;gt;&lt;br /&gt;
Code:&lt;br /&gt;
def self.define_attributes(row_hash)&lt;br /&gt;
    attributes = {}&lt;br /&gt;
    if !row_hash[:description].nil? and !row_hash[:description].ascii_only?&lt;br /&gt;
      row_hash[:description] = self.trim_non_ascii(row_hash[:description])&lt;br /&gt;
      puts row_hash[:description]&lt;br /&gt;
    end&lt;br /&gt;
    attributes[&amp;quot;topic_identifier&amp;quot;] = row_hash[:topic_identifier].strip&lt;br /&gt;
    attributes[&amp;quot;topic_name&amp;quot;] = row_hash[:topic_name].strip&lt;br /&gt;
    attributes[&amp;quot;max_choosers&amp;quot;] = row_hash[:max_choosers].strip&lt;br /&gt;
    attributes&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def self.trim_non_ascii(string)&lt;br /&gt;
    string.split('').each do |char|&lt;br /&gt;
      !char.ascii_only? ? string.tr!(char, ' ') : nil&lt;br /&gt;
    end&lt;br /&gt;
    string.gsub!(/\s+/, ' ')&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
=====Issue 328=====&lt;br /&gt;
&lt;br /&gt;
This was an issue to fix the functionality of Insert any new members into existing team. This was due to faulty handling of the option handle_dups and incorrect checking of parameters.&amp;lt;br&amp;gt;&lt;br /&gt;
Code was modified to ensure minimal impact to existing testcases and functionalities.&amp;lt;br&amp;gt;&lt;br /&gt;
Code:&lt;br /&gt;
      name = handle_duplicate(team, name, id, options[&amp;quot;handle_dups&amp;quot;], teamtype)&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E1938_Before_D.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
After fixing changes&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Insert_new_in_old.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
=====Issue 329=====&lt;br /&gt;
&lt;br /&gt;
This was a request to add an option to rename existing team if there was a conflict in the team name.&amp;lt;br&amp;gt;&lt;br /&gt;
New code introduced was as follows:&amp;lt;br&amp;gt;&lt;br /&gt;
In start.html.erb&amp;lt;br&amp;gt;&lt;br /&gt;
In this file, the new option as displayed to the user is added&amp;lt;br&amp;gt;&lt;br /&gt;
          &amp;lt;option value=&amp;quot;rename_existing&amp;quot;&amp;gt;rename the existing team and import&amp;lt;/option&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In team.rb&amp;lt;br&amp;gt;&lt;br /&gt;
In this file, the handling of the new tag &amp;quot;rename_existing&amp;quot; is added wherein, the old team is updated with a new name.&amp;lt;br&amp;gt;&lt;br /&gt;
    # E1938: Added handling for renaming old team when conflict arises&lt;br /&gt;
    if handle_dups == &amp;quot;rename_existing&amp;quot;&lt;br /&gt;
      if teamtype.is_a?(CourseTeam.class)&lt;br /&gt;
        team.update(name: self.generate_team_name(Course.find(id).name))&lt;br /&gt;
      elsif  teamtype.is_a?(AssignmentTeam.class)&lt;br /&gt;
        team.update(name: self.generate_team_name(Assignment.find(id).name))&lt;br /&gt;
      end&lt;br /&gt;
      return name&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The state of D before conflicting import:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E1938_Before_D_1.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
After fixing changes&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:After_D.PNG]]&lt;br /&gt;
[[File:After_old_team.PNG]]&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
As you can see the new team got the name D and the old file got renamed to Team_17.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Issue 153=====&lt;br /&gt;
'''Requirement''': There should be a way to import a list of who has signed up for which topic. When a signup sheet is used in Expertiza, users are expected to sign up for topics. But, the instructor might've taken signups offline, e.g., by passing around a signup sheet in class. There should be a way to import this list to Expertiza, rather than impersonate all the students one by one and sign them up for a topic. &lt;br /&gt;
&lt;br /&gt;
'''Solution''': We have modified the existing implementation for import topics to assign the teams to the topics. We have changed the files to handle another column where the teams have been assigned to topics. The column is optional because there might be topics that have not yet been assigned to any teams&lt;br /&gt;
&lt;br /&gt;
'''Expectations from the import file: &lt;br /&gt;
'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Assigned team name should exist in the system, otherwise the import will fail. Instructor has to make sure that the teams which are assigned in the import file should exist with same names in the system or database. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Instructor also need to ensure that the topic for which the team is being assigned should not be full or can accommodate new team assignment to the respective topic. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''Code Changes:'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
import_file/_sign_up_topic.html.erb (All the select tags has been changed)&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
As there's already a screen with select options to map the columns with the fields for import. We are just adding another column so the best to extend the existing select tag with a new option for the teams assigned. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
 &amp;lt;th&amp;gt;&lt;br /&gt;
            &amp;lt;select name=&amp;quot;select1&amp;quot; id=&amp;quot;select1&amp;quot; class=&amp;quot;form-control&amp;quot; style=&amp;quot;background-color:lightgrey&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;topic_identifier&amp;quot;&amp;gt;Topic Identifier (required)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;topic_name&amp;quot;&amp;gt;Topic Name (required)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;max_choosers&amp;quot;&amp;gt;Max Choosers (required)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;category&amp;quot;&amp;gt;Category (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;description&amp;quot;&amp;gt;Description (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;link&amp;quot;&amp;gt;Link (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;assigned_team&amp;quot;&amp;gt;Assigned Team (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
            &amp;lt;/select&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
model/sign_up_topic.rb&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The existing import function in the model import the topics to the topic table. As per the requirement and validations, topic should be imported first and then only the team can be assigned to the topic. So the existing import method has been modified to assign the team once the topic is imported in the database table. As per the edge case mentioned in the requirement document that few topics may not have any team assigned to it, so we first check if topic has any team assigned, then only it tries to map the topic with the team. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
  def self.import(row_hash, session, _id = nil)&lt;br /&gt;
    if row_hash.length &amp;lt; 3&lt;br /&gt;
      raise ArgumentError, &amp;quot;The CSV File expects the format: Topic identifier, Topic name, Max choosers, Topic Category (optional), Topic Description (Optional), Topic Link (optional), Assigned Team Name (optional).&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
    topic = SignUpTopic.where(topic_name: row_hash[:topic_name], assignment_id: session[:assignment_id]).first&lt;br /&gt;
    if topic.nil?&lt;br /&gt;
      attributes = ImportTopicsHelper.define_attributes(row_hash)&lt;br /&gt;
      topic_new_id = ImportTopicsHelper.create_new_sign_up_topic(attributes, session)&lt;br /&gt;
      unless row_hash[:assigned_team].nil?&lt;br /&gt;
          team = Team.where(name: row_hash[:assigned_team]).first&lt;br /&gt;
          ImportTopicsHelper.assign_team_topic(topic_new_id, team.id)&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      topic.max_choosers = row_hash[:max_choosers]&lt;br /&gt;
      topic.topic_identifier = row_hash[:topic_identifier]&lt;br /&gt;
      topic.save&lt;br /&gt;
      unless row_hash[:assigned_team].nil?&lt;br /&gt;
        team = Team.where(name: row_hash[:assigned_team]).first&lt;br /&gt;
        newteam = SignedUpTeam.where(topic_id: topic.id, team_id: team.id).first&lt;br /&gt;
        if newteam.nil?&lt;br /&gt;
          ImportTopicsHelper.assign_team_topic(topic.id, team.id)&lt;br /&gt;
        else&lt;br /&gt;
          newteam.team_id = team.id&lt;br /&gt;
          newteam.save&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
helpers/import_topics_helper.rb&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Having the assign_team_topic in the helper would organize the code but also in the unit testing. We can isolate the model logic and test this method separately by writing the test cases. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
  def self.assign_team_topic(topic_id, assigned_team)&lt;br /&gt;
    attributes = {}&lt;br /&gt;
    attributes[&amp;quot;topic_id&amp;quot;] = topic_id&lt;br /&gt;
    attributes[&amp;quot;team_id&amp;quot;] = assigned_team&lt;br /&gt;
    assign_team = SignedUpTeam.new(attributes)&lt;br /&gt;
    assign_team.save!&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
   def self.create_new_sign_up_topic(attributes, session)&lt;br /&gt;
     sign_up_topic = SignUpTopic.new(attributes)&lt;br /&gt;
     sign_up_topic.assignment_id = session[:assignment_id]&lt;br /&gt;
     sign_up_topic.save&lt;br /&gt;
     # sign_up_topic&lt;br /&gt;
     sign_up_topic.save!&lt;br /&gt;
     sign_up_topic.id&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
controllers/import_file_controller.rb&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Existing implementation for import have many flaws and design issues. Most of the code has been written with nested if else, which is not the practice to be followed. Also the names of the fields have been hardcoded. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
As we cannot change the complete import implementation. So i had to use the existing one the way it is and make changes to extend the functionality. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    if (params[:assigned_team] == 'true')&lt;br /&gt;
        @optional_count += 1&lt;br /&gt;
    end&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
controllers/import_file_controller.rb (import_from_hash)&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    elsif params[:optional_count] == '4'&lt;br /&gt;
          new_header = [params[:select1], params[:select2], params[:select3], params[:select4], params[:select5], params[:select6], params[:select7]]&lt;br /&gt;
          @header_integrated_body = hash_rows_with_headers(new_header,contents_hash[:body])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
views/sign_up_sheet/_add_topics.html.erb&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
This code has been used to display the columns in the footer.As we already have implementation for other columns, so another column name 'Assigned Team' is added here in this part of the code. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
        &amp;lt;%= link_to 'Import topics',&lt;br /&gt;
                {&lt;br /&gt;
                    :controller =&amp;gt; 'import_file',&lt;br /&gt;
                    :action =&amp;gt; 'start',&lt;br /&gt;
                    :model =&amp;gt; 'SignUpTopic',&lt;br /&gt;
                    :id =&amp;gt; params[:id],&lt;br /&gt;
                    :expected_fields =&amp;gt; 'Topic Identifier' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Name' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Max Choosers' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Category &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Description &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Link &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Assigned Team &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
An option column checkbox (Teams Assigned) has been added to the UI&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Issue153SS8.jpg]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
A new column Assigned Team is added where the columns are being mapped. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File: Issue153SS7.jpg]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Test Plan''' ==&lt;br /&gt;
*'''RSpec:'''&lt;br /&gt;
&lt;br /&gt;
::We have added new testcases for the new pieces of code that were added by us.&lt;br /&gt;
&lt;br /&gt;
*'''UI Testing:'''&lt;br /&gt;
::'''[Problem 1]'''&lt;br /&gt;
::::1. Login to Expertiza using username: instructor6 &amp;amp; password: password.&lt;br /&gt;
::::2. Select Manage &amp;gt; Courses or Assignments &amp;gt; Add Teams button &amp;gt; Import Team&lt;br /&gt;
::::3. In the screen that loads, select &amp;quot;rename the existing team and import&amp;quot; in the handle conflicts section.&lt;br /&gt;
::::4. Upload a file with the team details and select the appropriate delimiter.&lt;br /&gt;
::::5. Click on create&lt;br /&gt;
::::6. Verify that the new team got created with the assigned name and the older team's name got changed.&lt;br /&gt;
&lt;br /&gt;
::Caveat:&lt;br /&gt;
&lt;br /&gt;
::'''[Problem 2]'''&lt;br /&gt;
::::When a deadline is assigned for a topic, we create a job (identified with delayed_job_id) to be executed on the deadline date. The module for job and queue set-up on expertiza is not fully functional, and hence this cannot be tested directly. However, we have written the code for job scheduling, here's a snapshot of the due_dates table with the delayed_job_id populated:&lt;br /&gt;
&lt;br /&gt;
::::[[File:DB Snapshot.png]]&lt;br /&gt;
&lt;br /&gt;
== '''Possible Enhancements''' ==&lt;br /&gt;
&lt;br /&gt;
====='''Import functionality'''=====&lt;br /&gt;
&lt;br /&gt;
The existing import implementation does not follow DRY principle, rails code practices and even basic design principles. Most of the code is written based with nested if else conditions. This implementation can be improved. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Exception Handling: Before starting to work on this requirement. I tried few imports and in many cases, import was not successful and i was not able to figure out what's going wrong. My suggestion would be to develop a screen to show which rows were successfully imported and the failure reason which didn't. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Also, if there's no team in the system and instructor has used it in the import file so a new pop up can be displayed where the new team can be created or the import can be extended to create teams while assigning the topic. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1. Expertiza on GITHUB: https://github.com/expertiza/expertiza&lt;br /&gt;
&lt;br /&gt;
2. GitHub Project Repository Fork: https://github.com/NisargC/expertiza&lt;br /&gt;
&lt;br /&gt;
3. Demo link: http://152.46.19.138:8080/&lt;br /&gt;
&lt;br /&gt;
4. Expertiza project documentation wiki: http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2019_-_E1938._OSS_project_Duke_Blue:_Fix_import_glitches&lt;/div&gt;</summary>
		<author><name>Nmchoks2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1938._OSS_project_Duke_Blue:_Fix_import_glitches&amp;diff=127453</id>
		<title>CSC/ECE 517 Fall 2019 - E1938. OSS project Duke Blue: Fix import glitches</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1938._OSS_project_Duke_Blue:_Fix_import_glitches&amp;diff=127453"/>
		<updated>2019-11-06T22:34:44Z</updated>

		<summary type="html">&lt;p&gt;Nmchoks2: /* Test Plan */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
== '''About Expertiza''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source project based on Ruby on Rails framework and the code is available on Github. Expertiza allows the instructor to create new assignments as well as edit new or existing assignments. Instructors can also create a list of topics the students can sign up for and specify deadlines for completion of various tasks. Students can form teams in Expertiza to work on various projects and assignments as well as peer review other students' submissions. Expertiza supports submission across various document types, including the URLs Wiki pages.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
The import feature is the most helpful feature for instructors to set up assignments. The instructors usually have a list of students, teams, etc from their learning management system. Being able to import these into expertiza saves a lot of time when setting up an assignment. Unfortunately this feature has some bugs that were identified as the following list. &lt;br /&gt;
&lt;br /&gt;
'''Issue 918''': It seems that non-ASCII characters in the description (e.g., a curly apostrophe, and perhaps also an en-dash) caused a SQL error in inserting the description string into the db. I had to edit the import file to remove non-ASCII characters. Any Unicode character ought to be allowed in a description. &lt;br /&gt;
&lt;br /&gt;
'''Issue 153''': There should be a way to import a list of who has signed up for which topic. When a signup sheet is used in Expertiza, users are expected to sign up for topics. But, the instructor might've taken signups offline, e.g., by passing around a signup sheet in class. There should be a way to import this list to Expertiza, rather than impersonate all the students one by one and sign them up for a topic.&lt;br /&gt;
&lt;br /&gt;
'''Issue 153 is not a bug but an additional feature to the existing import topic functionality.'''&lt;br /&gt;
&lt;br /&gt;
'''Issue 329''': When importing teams there are different options to handle conflicting team names &lt;br /&gt;
&lt;br /&gt;
'''Issue 328''': When importing teams, and a conflict exists there is an option to merge the two teams by inserting the new members into an existing team. Unfortunately, this feature is broken. we tried to import a team and selected 'Insert any new members into existing team'. No new team members were in fact inserted into the team&lt;br /&gt;
&lt;br /&gt;
== '''Fixes''' ==&lt;br /&gt;
=====Issue 918=====&lt;br /&gt;
&lt;br /&gt;
New code introduced is as follows.&amp;lt;br&amp;gt;&lt;br /&gt;
File:app/helpers/import_topics_helper.rb &amp;lt;br&amp;gt;&lt;br /&gt;
Code:&lt;br /&gt;
def self.define_attributes(row_hash)&lt;br /&gt;
    attributes = {}&lt;br /&gt;
    if !row_hash[:description].nil? and !row_hash[:description].ascii_only?&lt;br /&gt;
      row_hash[:description] = self.trim_non_ascii(row_hash[:description])&lt;br /&gt;
      puts row_hash[:description]&lt;br /&gt;
    end&lt;br /&gt;
    attributes[&amp;quot;topic_identifier&amp;quot;] = row_hash[:topic_identifier].strip&lt;br /&gt;
    attributes[&amp;quot;topic_name&amp;quot;] = row_hash[:topic_name].strip&lt;br /&gt;
    attributes[&amp;quot;max_choosers&amp;quot;] = row_hash[:max_choosers].strip&lt;br /&gt;
    attributes&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def self.trim_non_ascii(string)&lt;br /&gt;
    string.split('').each do |char|&lt;br /&gt;
      !char.ascii_only? ? string.tr!(char, ' ') : nil&lt;br /&gt;
    end&lt;br /&gt;
    string.gsub!(/\s+/, ' ')&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
=====Issue 328=====&lt;br /&gt;
&lt;br /&gt;
This was an issue to fix the functionality of Insert any new members into existing team. This was due to faulty handling of the option handle_dups and incorrect checking of parameters.&amp;lt;br&amp;gt;&lt;br /&gt;
Code was modified to ensure minimal impact to existing testcases and functionalities.&amp;lt;br&amp;gt;&lt;br /&gt;
Code:&lt;br /&gt;
      name = handle_duplicate(team, name, id, options[&amp;quot;handle_dups&amp;quot;], teamtype)&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E1938_Before_D.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
After fixing changes&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Insert_new_in_old.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
=====Issue 329=====&lt;br /&gt;
&lt;br /&gt;
This was a request to add an option to rename existing team if there was a conflict in the team name.&amp;lt;br&amp;gt;&lt;br /&gt;
New code introduced was as follows:&amp;lt;br&amp;gt;&lt;br /&gt;
In start.html.erb&amp;lt;br&amp;gt;&lt;br /&gt;
In this file, the new option as displayed to the user is added&amp;lt;br&amp;gt;&lt;br /&gt;
          &amp;lt;option value=&amp;quot;rename_existing&amp;quot;&amp;gt;rename the existing team and import&amp;lt;/option&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In team.rb&amp;lt;br&amp;gt;&lt;br /&gt;
In this file, the handling of the new tag &amp;quot;rename_existing&amp;quot; is added wherein, the old team is updated with a new name.&amp;lt;br&amp;gt;&lt;br /&gt;
    # E1938: Added handling for renaming old team when conflict arises&lt;br /&gt;
    if handle_dups == &amp;quot;rename_existing&amp;quot;&lt;br /&gt;
      if teamtype.is_a?(CourseTeam.class)&lt;br /&gt;
        team.update(name: self.generate_team_name(Course.find(id).name))&lt;br /&gt;
      elsif  teamtype.is_a?(AssignmentTeam.class)&lt;br /&gt;
        team.update(name: self.generate_team_name(Assignment.find(id).name))&lt;br /&gt;
      end&lt;br /&gt;
      return name&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The state of D before conflicting import:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E1938_Before_D_1.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
After fixing changes&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:After_D.PNG]]&lt;br /&gt;
[[File:After_old_team.PNG]]&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
As you can see the new team got the name D and the old file got renamed to Team_17.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Issue 153=====&lt;br /&gt;
This was a new requirement to add an option to upload topics along with the teams assigned. &lt;br /&gt;
&lt;br /&gt;
'''Expectations from the import file: &lt;br /&gt;
'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Assigned team name should exist in the system, otherwise the import will fail. Instructor has to make sure that the teams which are assigned in the import file should exist with same names in the system or database. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Instructor also need to ensure that the topic for which the team is being assigned should not be full or can accommodate new team assignment to the respective topic. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''Code Changes:'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
import_file/_sign_up_topic.html.erb (All the select tags has been changed)&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
As there's already a screen with select options to map the columns with the fields for import. We are just adding another column so the best to extend the existing select tag with a new option for the teams assigned. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
 &amp;lt;th&amp;gt;&lt;br /&gt;
            &amp;lt;select name=&amp;quot;select1&amp;quot; id=&amp;quot;select1&amp;quot; class=&amp;quot;form-control&amp;quot; style=&amp;quot;background-color:lightgrey&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;topic_identifier&amp;quot;&amp;gt;Topic Identifier (required)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;topic_name&amp;quot;&amp;gt;Topic Name (required)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;max_choosers&amp;quot;&amp;gt;Max Choosers (required)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;category&amp;quot;&amp;gt;Category (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;description&amp;quot;&amp;gt;Description (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;link&amp;quot;&amp;gt;Link (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;assigned_team&amp;quot;&amp;gt;Assigned Team (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
            &amp;lt;/select&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
model/sign_up_topic.rb&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The existing import function in the model import the topics to the topic table. As per the requirement and validations, topic should be imported first and then only the team can be assigned to the topic. So the existing import method has been modified to assign the team once the topic is imported in the database table. As per the edge case mentioned in the requirement document that few topics may not have any team assigned to it, so we first check if topic has any team assigned, then only it tries to map the topic with the team. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
  def self.import(row_hash, session, _id = nil)&lt;br /&gt;
    if row_hash.length &amp;lt; 3&lt;br /&gt;
      raise ArgumentError, &amp;quot;The CSV File expects the format: Topic identifier, Topic name, Max choosers, Topic Category (optional), Topic Description (Optional), Topic Link (optional), Assigned Team Name (optional).&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
    topic = SignUpTopic.where(topic_name: row_hash[:topic_name], assignment_id: session[:assignment_id]).first&lt;br /&gt;
    if topic.nil?&lt;br /&gt;
      attributes = ImportTopicsHelper.define_attributes(row_hash)&lt;br /&gt;
      topic_new_id = ImportTopicsHelper.create_new_sign_up_topic(attributes, session)&lt;br /&gt;
      unless row_hash[:assigned_team].nil?&lt;br /&gt;
          team = Team.where(name: row_hash[:assigned_team]).first&lt;br /&gt;
          ImportTopicsHelper.assign_team_topic(topic_new_id, team.id)&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      topic.max_choosers = row_hash[:max_choosers]&lt;br /&gt;
      topic.topic_identifier = row_hash[:topic_identifier]&lt;br /&gt;
      topic.save&lt;br /&gt;
      unless row_hash[:assigned_team].nil?&lt;br /&gt;
        team = Team.where(name: row_hash[:assigned_team]).first&lt;br /&gt;
        newteam = SignedUpTeam.where(topic_id: topic.id, team_id: team.id).first&lt;br /&gt;
        if newteam.nil?&lt;br /&gt;
          ImportTopicsHelper.assign_team_topic(topic.id, team.id)&lt;br /&gt;
        else&lt;br /&gt;
          newteam.team_id = team.id&lt;br /&gt;
          newteam.save&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
helpers/import_topics_helper.rb&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Having the assign_team_topic in the helper would organize the code but also in the unit testing. We can isolate the model logic and test this method separately by writing the test cases. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
  def self.assign_team_topic(topic_id, assigned_team)&lt;br /&gt;
    attributes = {}&lt;br /&gt;
    attributes[&amp;quot;topic_id&amp;quot;] = topic_id&lt;br /&gt;
    attributes[&amp;quot;team_id&amp;quot;] = assigned_team&lt;br /&gt;
    assign_team = SignedUpTeam.new(attributes)&lt;br /&gt;
    assign_team.save!&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
   def self.create_new_sign_up_topic(attributes, session)&lt;br /&gt;
     sign_up_topic = SignUpTopic.new(attributes)&lt;br /&gt;
     sign_up_topic.assignment_id = session[:assignment_id]&lt;br /&gt;
     sign_up_topic.save&lt;br /&gt;
     # sign_up_topic&lt;br /&gt;
     sign_up_topic.save!&lt;br /&gt;
     sign_up_topic.id&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
controllers/import_file_controller.rb&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Existing implementation for import have many flaws and design issues. Most of the code has been written with nested if else, which is not the practice to be followed. Also the names of the fields have been hardcoded. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
As we cannot change the complete import implementation. So i had to use the existing one the way it is and make changes to extend the functionality. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    if (params[:assigned_team] == 'true')&lt;br /&gt;
        @optional_count += 1&lt;br /&gt;
    end&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
controllers/import_file_controller.rb (import_from_hash)&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    elsif params[:optional_count] == '4'&lt;br /&gt;
          new_header = [params[:select1], params[:select2], params[:select3], params[:select4], params[:select5], params[:select6], params[:select7]]&lt;br /&gt;
          @header_integrated_body = hash_rows_with_headers(new_header,contents_hash[:body])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
views/sign_up_sheet/_add_topics.html.erb&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
This code has been used to display the columns in the footer.As we already have implementation for other columns, so another column name 'Assigned Team' is added here in this part of the code. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
        &amp;lt;%= link_to 'Import topics',&lt;br /&gt;
                {&lt;br /&gt;
                    :controller =&amp;gt; 'import_file',&lt;br /&gt;
                    :action =&amp;gt; 'start',&lt;br /&gt;
                    :model =&amp;gt; 'SignUpTopic',&lt;br /&gt;
                    :id =&amp;gt; params[:id],&lt;br /&gt;
                    :expected_fields =&amp;gt; 'Topic Identifier' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Name' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Max Choosers' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Category &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Description &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Link &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Assigned Team &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
An option column checkbox (Teams Assigned) has been added to the UI&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Issue153SS8.jpg]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
A new column Assigned Team is added where the columns are being mapped. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File: Issue153SS7.jpg]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Test Plan''' ==&lt;br /&gt;
*'''RSpec:'''&lt;br /&gt;
&lt;br /&gt;
::We have added new testcases for the new pieces of code that were added by us.&lt;br /&gt;
&lt;br /&gt;
*'''UI Testing:'''&lt;br /&gt;
::'''[Problem 1]'''&lt;br /&gt;
::::1. Login to Expertiza using username: instructor6 &amp;amp; password: password.&lt;br /&gt;
::::2. Select an existing course/Create a course and an assignment under that course. Check 'Staggered deadline assignment?' for the assignment.&lt;br /&gt;
::::3. Create topics under the assignment.&lt;br /&gt;
::::4. Go to Assignment -&amp;gt; Topics. Click 'Show start/due date' at the bottom of the screen.&lt;br /&gt;
::::5. Enter 'Drop Topic Deadline' and hit 'Save start/due date'.&lt;br /&gt;
::::6. Reopen the assignment topic to cross verify if the deadline has been saved.&lt;br /&gt;
&lt;br /&gt;
::Caveat: While creating an assignment the page would error out, but the assignment does get created, which is not related to any of the changes we have done. In case unable to do so, use 'MadeUp Problem' with Creation Date of 'Aug 30, 2017 - 9:03 AM'&lt;br /&gt;
&lt;br /&gt;
::'''[Problem 2]'''&lt;br /&gt;
::::When a deadline is assigned for a topic, we create a job (identified with delayed_job_id) to be executed on the deadline date. The module for job and queue set-up on expertiza is not fully functional, and hence this cannot be tested directly. However, we have written the code for job scheduling, here's a snapshot of the due_dates table with the delayed_job_id populated:&lt;br /&gt;
&lt;br /&gt;
::::[[File:DB Snapshot.png]]&lt;br /&gt;
&lt;br /&gt;
== '''Possible Enhancements''' ==&lt;br /&gt;
&lt;br /&gt;
====='''Import functionality'''=====&lt;br /&gt;
&lt;br /&gt;
The existing import implementation does not follow DRY principle, rails code practices and even basic design principles. Most of the code is written based with nested if else conditions. This implementation can be improved. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Exception Handling: Before starting to work on this requirement. I tried few imports and in many cases, import was not successful and i was not able to figure out what's going wrong. My suggestion would be to develop a screen to show which rows were successfully imported and the failure reason which didn't. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Also, if there's no team in the system and instructor has used it in the import file so a new pop up can be displayed where the new team can be created or the import can be extended to create teams while assigning the topic. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1. Expertiza on GITHUB: https://github.com/expertiza/expertiza&lt;br /&gt;
&lt;br /&gt;
2. GitHub Project Repository Fork: https://github.com/NisargC/expertiza&lt;br /&gt;
&lt;br /&gt;
3. Demo link: http://152.46.19.138:8080/&lt;br /&gt;
&lt;br /&gt;
4. Expertiza project documentation wiki: http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2019_-_E1938._OSS_project_Duke_Blue:_Fix_import_glitches&lt;/div&gt;</summary>
		<author><name>Nmchoks2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1938._OSS_project_Duke_Blue:_Fix_import_glitches&amp;diff=127450</id>
		<title>CSC/ECE 517 Fall 2019 - E1938. OSS project Duke Blue: Fix import glitches</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1938._OSS_project_Duke_Blue:_Fix_import_glitches&amp;diff=127450"/>
		<updated>2019-11-06T22:31:28Z</updated>

		<summary type="html">&lt;p&gt;Nmchoks2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
== '''About Expertiza''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source project based on Ruby on Rails framework and the code is available on Github. Expertiza allows the instructor to create new assignments as well as edit new or existing assignments. Instructors can also create a list of topics the students can sign up for and specify deadlines for completion of various tasks. Students can form teams in Expertiza to work on various projects and assignments as well as peer review other students' submissions. Expertiza supports submission across various document types, including the URLs Wiki pages.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
The import feature is the most helpful feature for instructors to set up assignments. The instructors usually have a list of students, teams, etc from their learning management system. Being able to import these into expertiza saves a lot of time when setting up an assignment. Unfortunately this feature has some bugs that were identified as the following list. &lt;br /&gt;
&lt;br /&gt;
'''Issue #918''': It seems that non-ASCII characters in the description (e.g., a curly apostrophe, and perhaps also an en-dash) caused a SQL error in inserting the description string into the db. I had to edit the import file to remove non-ASCII characters. Any Unicode character ought to be allowed in a description. &lt;br /&gt;
&lt;br /&gt;
'''Issue #153''': There should be a way to import a list of who has signed up for which topic. When a signup sheet is used in Expertiza, users are expected to sign up for topics. But, the instructor might've taken signups offline, e.g., by passing around a signup sheet in class. There should be a way to import this list to Expertiza, rather than impersonate all the students one by one and sign them up for a topic.&lt;br /&gt;
&lt;br /&gt;
'''Issue #329''': When importing teams there are different options to handle conflicting team names &lt;br /&gt;
&lt;br /&gt;
'''Issue #328''': When importing teams, and a conflict exists there is an option to merge the two teams by inserting the new members into an existing team. Unfortunately, this feature is broken. we tried to import a team and selected 'Insert any new members into existing team'. No new team members were in fact inserted into the team&lt;br /&gt;
&lt;br /&gt;
== '''Fixes''' ==&lt;br /&gt;
=====Issue 918=====&lt;br /&gt;
&lt;br /&gt;
New code introduced is as follows.&amp;lt;br&amp;gt;&lt;br /&gt;
File:app/helpers/import_topics_helper.rb &amp;lt;br&amp;gt;&lt;br /&gt;
Code:&lt;br /&gt;
def self.define_attributes(row_hash)&lt;br /&gt;
    attributes = {}&lt;br /&gt;
    if !row_hash[:description].nil? and !row_hash[:description].ascii_only?&lt;br /&gt;
      row_hash[:description] = self.trim_non_ascii(row_hash[:description])&lt;br /&gt;
      puts row_hash[:description]&lt;br /&gt;
    end&lt;br /&gt;
    attributes[&amp;quot;topic_identifier&amp;quot;] = row_hash[:topic_identifier].strip&lt;br /&gt;
    attributes[&amp;quot;topic_name&amp;quot;] = row_hash[:topic_name].strip&lt;br /&gt;
    attributes[&amp;quot;max_choosers&amp;quot;] = row_hash[:max_choosers].strip&lt;br /&gt;
    attributes&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def self.trim_non_ascii(string)&lt;br /&gt;
    string.split('').each do |char|&lt;br /&gt;
      !char.ascii_only? ? string.tr!(char, ' ') : nil&lt;br /&gt;
    end&lt;br /&gt;
    string.gsub!(/\s+/, ' ')&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
=====Issue 328=====&lt;br /&gt;
&lt;br /&gt;
This was an issue to fix the functionality of Insert any new members into existing team. This was due to faulty handling of the option handle_dups and incorrect checking of parameters.&amp;lt;br&amp;gt;&lt;br /&gt;
Code was modified to ensure minimal impact to existing testcases and functionalities.&amp;lt;br&amp;gt;&lt;br /&gt;
Code:&lt;br /&gt;
      name = handle_duplicate(team, name, id, options[&amp;quot;handle_dups&amp;quot;], teamtype)&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E1938_Before_D.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
After fixing changes&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Insert_new_in_old.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
=====Issue 329=====&lt;br /&gt;
&lt;br /&gt;
This was a request to add an option to rename existing team if there was a conflict in the team name.&amp;lt;br&amp;gt;&lt;br /&gt;
New code introduced was as follows:&amp;lt;br&amp;gt;&lt;br /&gt;
In start.html.erb&amp;lt;br&amp;gt;&lt;br /&gt;
In this file, the new option as displayed to the user is added&amp;lt;br&amp;gt;&lt;br /&gt;
          &amp;lt;option value=&amp;quot;rename_existing&amp;quot;&amp;gt;rename the existing team and import&amp;lt;/option&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In team.rb&amp;lt;br&amp;gt;&lt;br /&gt;
In this file, the handling of the new tag &amp;quot;rename_existing&amp;quot; is added wherein, the old team is updated with a new name.&amp;lt;br&amp;gt;&lt;br /&gt;
    # E1938: Added handling for renaming old team when conflict arises&lt;br /&gt;
    if handle_dups == &amp;quot;rename_existing&amp;quot;&lt;br /&gt;
      if teamtype.is_a?(CourseTeam.class)&lt;br /&gt;
        team.update(name: self.generate_team_name(Course.find(id).name))&lt;br /&gt;
      elsif  teamtype.is_a?(AssignmentTeam.class)&lt;br /&gt;
        team.update(name: self.generate_team_name(Assignment.find(id).name))&lt;br /&gt;
      end&lt;br /&gt;
      return name&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The state of D before conflicting import:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E1938_Before_D_1.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
After fixing changes&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:After_D.PNG]]&lt;br /&gt;
[[File:After_old_team.PNG]]&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
As you can see the new team got the name D and the old file got renamed to Team_17.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Issue 153=====&lt;br /&gt;
This was a new requirement to add an option to upload topics along with the teams assigned. &lt;br /&gt;
&lt;br /&gt;
'''Expectations from the import file: &lt;br /&gt;
'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Assigned team name should exist in the system, otherwise the import will fail. Instructor has to make sure that the teams which are assigned in the import file should exist with same names in the system or database. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Instructor also need to ensure that the topic for which the team is being assigned should not be full or can accommodate new team assignment to the respective topic. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''Code Changes:'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
import_file/_sign_up_topic.html.erb (All the select tags has been changed)&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
As there's already a screen with select options to map the columns with the fields for import. We are just adding another column so the best to extend the existing select tag with a new option for the teams assigned. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
 &amp;lt;th&amp;gt;&lt;br /&gt;
            &amp;lt;select name=&amp;quot;select1&amp;quot; id=&amp;quot;select1&amp;quot; class=&amp;quot;form-control&amp;quot; style=&amp;quot;background-color:lightgrey&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;topic_identifier&amp;quot;&amp;gt;Topic Identifier (required)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;topic_name&amp;quot;&amp;gt;Topic Name (required)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;max_choosers&amp;quot;&amp;gt;Max Choosers (required)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;category&amp;quot;&amp;gt;Category (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;description&amp;quot;&amp;gt;Description (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;link&amp;quot;&amp;gt;Link (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;assigned_team&amp;quot;&amp;gt;Assigned Team (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
            &amp;lt;/select&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
model/sign_up_topic.rb&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The existing import function in the model import the topics to the topic table. As per the requirement and validations, topic should be imported first and then only the team can be assigned to the topic. So the existing import method has been modified to assign the team once the topic is imported in the database table. As per the edge case mentioned in the requirement document that few topics may not have any team assigned to it, so we first check if topic has any team assigned, then only it tries to map the topic with the team. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
  def self.import(row_hash, session, _id = nil)&lt;br /&gt;
    if row_hash.length &amp;lt; 3&lt;br /&gt;
      raise ArgumentError, &amp;quot;The CSV File expects the format: Topic identifier, Topic name, Max choosers, Topic Category (optional), Topic Description (Optional), Topic Link (optional), Assigned Team Name (optional).&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
    topic = SignUpTopic.where(topic_name: row_hash[:topic_name], assignment_id: session[:assignment_id]).first&lt;br /&gt;
    if topic.nil?&lt;br /&gt;
      attributes = ImportTopicsHelper.define_attributes(row_hash)&lt;br /&gt;
      topic_new_id = ImportTopicsHelper.create_new_sign_up_topic(attributes, session)&lt;br /&gt;
      unless row_hash[:assigned_team].nil?&lt;br /&gt;
          team = Team.where(name: row_hash[:assigned_team]).first&lt;br /&gt;
          ImportTopicsHelper.assign_team_topic(topic_new_id, team.id)&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      topic.max_choosers = row_hash[:max_choosers]&lt;br /&gt;
      topic.topic_identifier = row_hash[:topic_identifier]&lt;br /&gt;
      topic.save&lt;br /&gt;
      unless row_hash[:assigned_team].nil?&lt;br /&gt;
        team = Team.where(name: row_hash[:assigned_team]).first&lt;br /&gt;
        newteam = SignedUpTeam.where(topic_id: topic.id, team_id: team.id).first&lt;br /&gt;
        if newteam.nil?&lt;br /&gt;
          ImportTopicsHelper.assign_team_topic(topic.id, team.id)&lt;br /&gt;
        else&lt;br /&gt;
          newteam.team_id = team.id&lt;br /&gt;
          newteam.save&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
helpers/import_topics_helper.rb&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Having the assign_team_topic in the helper would organize the code but also in the unit testing. We can isolate the model logic and test this method separately by writing the test cases. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
  def self.assign_team_topic(topic_id, assigned_team)&lt;br /&gt;
    attributes = {}&lt;br /&gt;
    attributes[&amp;quot;topic_id&amp;quot;] = topic_id&lt;br /&gt;
    attributes[&amp;quot;team_id&amp;quot;] = assigned_team&lt;br /&gt;
    assign_team = SignedUpTeam.new(attributes)&lt;br /&gt;
    assign_team.save!&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
   def self.create_new_sign_up_topic(attributes, session)&lt;br /&gt;
     sign_up_topic = SignUpTopic.new(attributes)&lt;br /&gt;
     sign_up_topic.assignment_id = session[:assignment_id]&lt;br /&gt;
     sign_up_topic.save&lt;br /&gt;
     # sign_up_topic&lt;br /&gt;
     sign_up_topic.save!&lt;br /&gt;
     sign_up_topic.id&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
controllers/import_file_controller.rb&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Existing implementation for import have many flaws and design issues. Most of the code has been written with nested if else, which is not the practice to be followed. Also the names of the fields have been hardcoded. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
As we cannot change the complete import implementation. So i had to use the existing one the way it is and make changes to extend the functionality. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    if (params[:assigned_team] == 'true')&lt;br /&gt;
        @optional_count += 1&lt;br /&gt;
    end&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
controllers/import_file_controller.rb (import_from_hash)&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    elsif params[:optional_count] == '4'&lt;br /&gt;
          new_header = [params[:select1], params[:select2], params[:select3], params[:select4], params[:select5], params[:select6], params[:select7]]&lt;br /&gt;
          @header_integrated_body = hash_rows_with_headers(new_header,contents_hash[:body])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
views/sign_up_sheet/_add_topics.html.erb&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
This code has been used to display the columns in the footer.As we already have implementation for other columns, so another column name 'Assigned Team' is added here in this part of the code. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
        &amp;lt;%= link_to 'Import topics',&lt;br /&gt;
                {&lt;br /&gt;
                    :controller =&amp;gt; 'import_file',&lt;br /&gt;
                    :action =&amp;gt; 'start',&lt;br /&gt;
                    :model =&amp;gt; 'SignUpTopic',&lt;br /&gt;
                    :id =&amp;gt; params[:id],&lt;br /&gt;
                    :expected_fields =&amp;gt; 'Topic Identifier' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Name' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Max Choosers' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Category &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Description &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Link &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Assigned Team &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
An option column checkbox (Teams Assigned) has been added to the UI&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Issue153SS8.jpg]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
A new column Assigned Team is added where the columns are being mapped. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File: Issue153SS7.jpg]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Test Plan''' ==&lt;br /&gt;
== '''Possible Enhancements''' ==&lt;br /&gt;
&lt;br /&gt;
====='''Import functionality'''=====&lt;br /&gt;
&lt;br /&gt;
The existing import implementation does not follow DRY principle, rails code practices and even basic design principles. Most of the code is written based with nested if else conditions. This implementation can be improved. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Exception Handling: Before starting to work on this requirement. I tried few imports and in many cases, import was not successful and i was not able to figure out what's going wrong. My suggestion would be to develop a screen to show which rows were successfully imported and the failure reason which didn't. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Also, if there's no team in the system and instructor has used it in the import file so a new pop up can be displayed where the new team can be created or the import can be extended to create teams while assigning the topic. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1. Expertiza on GITHUB: https://github.com/expertiza/expertiza&lt;br /&gt;
&lt;br /&gt;
2. GitHub Project Repository Fork: https://github.com/NisargC/expertiza&lt;br /&gt;
&lt;br /&gt;
3. Demo link: http://152.46.19.138:8080/&lt;br /&gt;
&lt;br /&gt;
4. Expertiza project documentation wiki: http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2019_-_E1938._OSS_project_Duke_Blue:_Fix_import_glitches&lt;/div&gt;</summary>
		<author><name>Nmchoks2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1938._OSS_project_Duke_Blue:_Fix_import_glitches&amp;diff=126784</id>
		<title>CSC/ECE 517 Fall 2019 - E1938. OSS project Duke Blue: Fix import glitches</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1938._OSS_project_Duke_Blue:_Fix_import_glitches&amp;diff=126784"/>
		<updated>2019-10-31T23:29:37Z</updated>

		<summary type="html">&lt;p&gt;Nmchoks2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
== '''About Expertiza''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source project based on Ruby on Rails framework and the code is available on Github. Expertiza allows the instructor to create new assignments as well as edit new or existing assignments. Instructors can also create a list of topics the students can sign up for and specify deadlines for completion of various tasks. Students can form teams in Expertiza to work on various projects and assignments as well as peer review other students' submissions. Expertiza supports submission across various document types, including the URLs Wiki pages.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Introduction''' ==&lt;br /&gt;
The import feature is the most helpful feature for instructors to set up assignments. The instructors usually have a list of students, teams, etc from their learning management system. Being able to import these into expertiza saves a lot of time when setting up an assignment. Unfortunately this feature has some bugs that were identified as the following list. &lt;br /&gt;
&lt;br /&gt;
'''Issue #918''': It seems that non-ASCII characters in the description (e.g., a curly apostrophe, and perhaps also an en-dash) caused a SQL error in inserting the description string into the db. I had to edit the import file to remove non-ASCII characters. Any Unicode character ought to be allowed in a description. &lt;br /&gt;
&lt;br /&gt;
'''Issue #153''': There should be a way to import a list of who has signed up for which topic. When a signup sheet is used in Expertiza, users are expected to sign up for topics. But, the instructor might've taken signups offline, e.g., by passing around a signup sheet in class. There should be a way to import this list to Expertiza, rather than impersonate all the students one by one and sign them up for a topic.&lt;br /&gt;
&lt;br /&gt;
'''Issue #329''': When importing teams there are different options to handle conflicting team names &lt;br /&gt;
&lt;br /&gt;
'''Issue #328''': When importing teams, and a conflict exists there is an option to merge the two teams by inserting the new members into an existing team. Unfortunately, this feature is broken. we tried to import a team and selected 'Insert any new members into existing team'. No new team members were in fact inserted into the team&lt;br /&gt;
&lt;br /&gt;
== '''Fixes''' ==&lt;br /&gt;
=====Issue 918=====&lt;br /&gt;
&lt;br /&gt;
New code introduced is as follows.&amp;lt;br&amp;gt;&lt;br /&gt;
File:app/helpers/import_topics_helper.rb &amp;lt;br&amp;gt;&lt;br /&gt;
Code:&lt;br /&gt;
def self.define_attributes(row_hash)&lt;br /&gt;
    attributes = {}&lt;br /&gt;
    if !row_hash[:description].nil? and !row_hash[:description].ascii_only?&lt;br /&gt;
      row_hash[:description] = self.trim_non_ascii(row_hash[:description])&lt;br /&gt;
      puts row_hash[:description]&lt;br /&gt;
    end&lt;br /&gt;
    attributes[&amp;quot;topic_identifier&amp;quot;] = row_hash[:topic_identifier].strip&lt;br /&gt;
    attributes[&amp;quot;topic_name&amp;quot;] = row_hash[:topic_name].strip&lt;br /&gt;
    attributes[&amp;quot;max_choosers&amp;quot;] = row_hash[:max_choosers].strip&lt;br /&gt;
    attributes&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def self.trim_non_ascii(string)&lt;br /&gt;
    string.split('').each do |char|&lt;br /&gt;
      !char.ascii_only? ? string.tr!(char, ' ') : nil&lt;br /&gt;
    end&lt;br /&gt;
    string.gsub!(/\s+/, ' ')&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
=====Issue 328=====&lt;br /&gt;
&lt;br /&gt;
This was an issue to fix the functionality of Insert any new members into existing team. This was due to faulty handling of the option handle_dups and incorrect checking of parameters.&amp;lt;br&amp;gt;&lt;br /&gt;
Code was modified to ensure minimal impact to existing testcases and functionalities.&amp;lt;br&amp;gt;&lt;br /&gt;
Code:&lt;br /&gt;
      name = handle_duplicate(team, name, id, options[&amp;quot;handle_dups&amp;quot;], teamtype)&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E1938_Before_D.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
After fixing changes&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Insert_new_in_old.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
=====Issue 329=====&lt;br /&gt;
&lt;br /&gt;
This was a request to add an option to rename existing team if there was a conflict in the team name.&amp;lt;br&amp;gt;&lt;br /&gt;
New code introduced was as follows:&amp;lt;br&amp;gt;&lt;br /&gt;
In start.html.erb&amp;lt;br&amp;gt;&lt;br /&gt;
In this file, the new option as displayed to the user is added&amp;lt;br&amp;gt;&lt;br /&gt;
          &amp;lt;option value=&amp;quot;rename_existing&amp;quot;&amp;gt;rename the existing team and import&amp;lt;/option&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In team.rb&amp;lt;br&amp;gt;&lt;br /&gt;
In this file, the handling of the new tag &amp;quot;rename_existing&amp;quot; is added wherein, the old team is updated with a new name.&amp;lt;br&amp;gt;&lt;br /&gt;
    # E1938: Added handling for renaming old team when conflict arises&lt;br /&gt;
    if handle_dups == &amp;quot;rename_existing&amp;quot;&lt;br /&gt;
      if teamtype.is_a?(CourseTeam.class)&lt;br /&gt;
        team.update(name: self.generate_team_name(Course.find(id).name))&lt;br /&gt;
      elsif  teamtype.is_a?(AssignmentTeam.class)&lt;br /&gt;
        team.update(name: self.generate_team_name(Assignment.find(id).name))&lt;br /&gt;
      end&lt;br /&gt;
      return name&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The state of D before conflicting import:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E1938_Before_D_1.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
After fixing changes&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:After_D.PNG]]&lt;br /&gt;
[[File:After_old_team.PNG]]&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
As you can see the new team got the name D and the old file got renamed to Team_17.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Issue 153=====&lt;br /&gt;
This was a new requirement to add an option to upload topics along with the teams assigned. &lt;br /&gt;
&lt;br /&gt;
'''Expectations from the import file: &lt;br /&gt;
'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Assigned team name should exist in the system, otherwise the import will fail. Instructor has to make sure that the teams which are assigned in the import file should exist with same names in the system or database. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Instructor also need to ensure that the topic for which the team is being assigned should not be full or can accommodate new team assignment to the respective topic. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''Code Changes:'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
import_file/_sign_up_topic.html.erb (All the select tags has been changed)&lt;br /&gt;
 &amp;lt;th&amp;gt;&lt;br /&gt;
            &amp;lt;select name=&amp;quot;select1&amp;quot; id=&amp;quot;select1&amp;quot; class=&amp;quot;form-control&amp;quot; style=&amp;quot;background-color:lightgrey&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;topic_identifier&amp;quot;&amp;gt;Topic Identifier (required)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;topic_name&amp;quot;&amp;gt;Topic Name (required)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;max_choosers&amp;quot;&amp;gt;Max Choosers (required)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;category&amp;quot;&amp;gt;Category (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;description&amp;quot;&amp;gt;Description (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;link&amp;quot;&amp;gt;Link (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
              &amp;lt;option value=&amp;quot;assigned_team&amp;quot;&amp;gt;Assigned Team (optional)&amp;lt;/option&amp;gt;&lt;br /&gt;
            &amp;lt;/select&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
model/sign_up_topic.rb&lt;br /&gt;
&lt;br /&gt;
  def self.import(row_hash, session, _id = nil)&lt;br /&gt;
    if row_hash.length &amp;lt; 3&lt;br /&gt;
      raise ArgumentError, &amp;quot;The CSV File expects the format: Topic identifier, Topic name, Max choosers, Topic Category (optional), Topic Description (Optional), Topic Link (optional), Assigned Team Name (optional).&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
    topic = SignUpTopic.where(topic_name: row_hash[:topic_name], assignment_id: session[:assignment_id]).first&lt;br /&gt;
    if topic.nil?&lt;br /&gt;
      attributes = ImportTopicsHelper.define_attributes(row_hash)&lt;br /&gt;
      topic_new_id = ImportTopicsHelper.create_new_sign_up_topic(attributes, session)&lt;br /&gt;
      unless row_hash[:assigned_team].nil?&lt;br /&gt;
          team = Team.where(name: row_hash[:assigned_team]).first&lt;br /&gt;
          ImportTopicsHelper.assign_team_topic(topic_new_id, team.id)&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      topic.max_choosers = row_hash[:max_choosers]&lt;br /&gt;
      topic.topic_identifier = row_hash[:topic_identifier]&lt;br /&gt;
      topic.save&lt;br /&gt;
      unless row_hash[:assigned_team].nil?&lt;br /&gt;
        team = Team.where(name: row_hash[:assigned_team]).first&lt;br /&gt;
        newteam = SignedUpTeam.where(topic_id: topic.id, team_id: team.id).first&lt;br /&gt;
        if newteam.nil?&lt;br /&gt;
          ImportTopicsHelper.assign_team_topic(topic.id, team.id)&lt;br /&gt;
        else&lt;br /&gt;
          newteam.team_id = team.id&lt;br /&gt;
          newteam.save&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
helpers/import_topics_helper.rb&lt;br /&gt;
&lt;br /&gt;
  def self.assign_team_topic(topic_id, assigned_team)&lt;br /&gt;
    attributes = {}&lt;br /&gt;
    attributes[&amp;quot;topic_id&amp;quot;] = topic_id&lt;br /&gt;
    attributes[&amp;quot;team_id&amp;quot;] = assigned_team&lt;br /&gt;
    assign_team = SignedUpTeam.new(attributes)&lt;br /&gt;
    assign_team.save!&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
   def self.create_new_sign_up_topic(attributes, session)&lt;br /&gt;
     sign_up_topic = SignUpTopic.new(attributes)&lt;br /&gt;
     sign_up_topic.assignment_id = session[:assignment_id]&lt;br /&gt;
     sign_up_topic.save&lt;br /&gt;
     # sign_up_topic&lt;br /&gt;
     sign_up_topic.save!&lt;br /&gt;
     sign_up_topic.id&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
controllers/import_file_controller.rb (Optional Count)&lt;br /&gt;
&lt;br /&gt;
    if (params[:assigned_team] == 'true')&lt;br /&gt;
        @optional_count += 1&lt;br /&gt;
    end&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
controllers/import_file_controller.rb (import_from_hash)&lt;br /&gt;
&lt;br /&gt;
    elsif params[:optional_count] == '4'&lt;br /&gt;
          new_header = [params[:select1], params[:select2], params[:select3], params[:select4], params[:select5], params[:select6], params[:select7]]&lt;br /&gt;
          @header_integrated_body = hash_rows_with_headers(new_header,contents_hash[:body])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
views/sign_up_sheet/_add_topics.html.erb&lt;br /&gt;
        &amp;lt;%= link_to 'Import topics',&lt;br /&gt;
                {&lt;br /&gt;
                    :controller =&amp;gt; 'import_file',&lt;br /&gt;
                    :action =&amp;gt; 'start',&lt;br /&gt;
                    :model =&amp;gt; 'SignUpTopic',&lt;br /&gt;
                    :id =&amp;gt; params[:id],&lt;br /&gt;
                    :expected_fields =&amp;gt; 'Topic Identifier' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Name' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Max Choosers' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Category &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Description &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Topic Link &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;' +&lt;br /&gt;
                        '&amp;amp;nbsp&amp;amp;nbsp|&amp;amp;nbsp&amp;amp;nbsp' +&lt;br /&gt;
                        'Assigned Team &amp;lt;em&amp;gt;(optional)&amp;lt;/em&amp;gt;'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
An option column checkbox (Teams Assigned) has been added to the UI&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Issue153SS8.jpg]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
A new column Assigned Team is added where the columns are being mapped. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File: Issue153SS7.jpg]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1. Expertiza on GITHUB: https://github.com/expertiza/expertiza&lt;br /&gt;
&lt;br /&gt;
2. GitHub Project Repository Fork: https://github.com/NisargC/expertiza&lt;br /&gt;
&lt;br /&gt;
3. Demo link: http://152.46.19.138:8080/&lt;br /&gt;
&lt;br /&gt;
4. Expertiza project documentation wiki: http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2019_-_E1938._OSS_project_Duke_Blue:_Fix_import_glitches&lt;/div&gt;</summary>
		<author><name>Nmchoks2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1938._OSS_project_Duke_Blue:_Fix_import_glitches&amp;diff=125980</id>
		<title>CSC/ECE 517 Fall 2019 - E1938. OSS project Duke Blue: Fix import glitches</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1938._OSS_project_Duke_Blue:_Fix_import_glitches&amp;diff=125980"/>
		<updated>2019-10-28T20:38:02Z</updated>

		<summary type="html">&lt;p&gt;Nmchoks2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;strong&amp;gt;Issue #918&amp;lt;br&amp;gt;&amp;lt;/strong&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code introduced is as follows.&amp;lt;br&amp;gt;&lt;br /&gt;
File:app/helpers/import_topics_helper.rb &amp;lt;br&amp;gt;&lt;br /&gt;
Code:&lt;br /&gt;
def self.define_attributes(row_hash)&lt;br /&gt;
    attributes = {}&lt;br /&gt;
    if !row_hash[:description].nil? and !row_hash[:description].ascii_only?&lt;br /&gt;
      row_hash[:description] = self.trim_non_ascii(row_hash[:description])&lt;br /&gt;
      puts row_hash[:description]&lt;br /&gt;
    end&lt;br /&gt;
    attributes[&amp;quot;topic_identifier&amp;quot;] = row_hash[:topic_identifier].strip&lt;br /&gt;
    attributes[&amp;quot;topic_name&amp;quot;] = row_hash[:topic_name].strip&lt;br /&gt;
    attributes[&amp;quot;max_choosers&amp;quot;] = row_hash[:max_choosers].strip&lt;br /&gt;
    attributes&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def self.trim_non_ascii(string)&lt;br /&gt;
    string.split('').each do |char|&lt;br /&gt;
      !char.ascii_only? ? string.tr!(char, ' ') : nil&lt;br /&gt;
    end&lt;br /&gt;
    string.gsub!(/\s+/, ' ')&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Issue #328&amp;lt;br&amp;gt;&amp;lt;/strong&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This was an issue to fix the functionality of Insert any new members into existing team. This was due to faulty handling of the option handle_dups and incorrect checking of parameters.&amp;lt;br&amp;gt;&lt;br /&gt;
Code was modified to ensure minimal impact to existing testcases and functionalities.&lt;br /&gt;
Code:&lt;br /&gt;
      name = handle_duplicate(team, name, id, options[&amp;quot;handle_dups&amp;quot;], teamtype)&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E1938_Before_D.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
After fixing changes&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Insert_new_in_old.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;Issue #329&amp;lt;br&amp;gt;&amp;lt;/strong&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This was a request to add an option to rename existing team if there was a conflict in the team name.&amp;lt;br&amp;gt;&lt;br /&gt;
New code introduced was as follows:&amp;lt;br&amp;gt;&lt;br /&gt;
In start.html.erb&amp;lt;br&amp;gt;&lt;br /&gt;
          &amp;lt;option value=&amp;quot;rename_existing&amp;quot;&amp;gt;rename the existing team and import&amp;lt;/option&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In team.rb&amp;lt;br&amp;gt;&lt;br /&gt;
    # E1938: Added handling for renaming old team when conflict arises&lt;br /&gt;
    if handle_dups == &amp;quot;rename_existing&amp;quot;&lt;br /&gt;
      if teamtype.is_a?(CourseTeam.class)&lt;br /&gt;
        team.update(name: self.generate_team_name(Course.find(id).name))&lt;br /&gt;
      elsif  teamtype.is_a?(AssignmentTeam.class)&lt;br /&gt;
        team.update(name: self.generate_team_name(Assignment.find(id).name))&lt;br /&gt;
      end&lt;br /&gt;
      return name&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The state of D before conflicting import:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E1938_Before_D_1.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
After fixing changes&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:After_D.PNG]]&lt;br /&gt;
[[File:After_old_team.PNG]]&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
As you can see the new team got the name D and the old file got renamed to Team_17.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Nmchoks2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:After_D.PNG&amp;diff=125979</id>
		<title>File:After D.PNG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:After_D.PNG&amp;diff=125979"/>
		<updated>2019-10-28T20:36:50Z</updated>

		<summary type="html">&lt;p&gt;Nmchoks2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Nmchoks2</name></author>
	</entry>
</feed>