<?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=Psdravid</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=Psdravid"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Psdravid"/>
	<updated>2026-05-17T10:09:54Z</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_-_E1975._Generalize_Review_Versioning&amp;diff=129248</id>
		<title>CSC/ECE 517 Fall 2019 - E1975. Generalize Review Versioning</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1975._Generalize_Review_Versioning&amp;diff=129248"/>
		<updated>2019-11-12T04:50:15Z</updated>

		<summary type="html">&lt;p&gt;Psdravid: /* Rspec */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
== '''About Expertiza''' ==&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;
Expertiza is a peer-review based learning platform in which work-products by students are evaluated and scored by peer-review of other students. Review process occurs in stages. After submission of initial feedback for a work-product by the peer-group, students are allowed time to incorporate the comments and improve their work. This second version of the work product is reviewed again and scores are given. This process might be repeated again and the average score from the last review stage is considered as the final score for that work-product. This incremental development of work-products and progressive learning is the fundamental concept underlying the Expertiza system.&lt;br /&gt;
&lt;br /&gt;
=====Purpose=====&lt;br /&gt;
The system currently is designed to give a reviewer a new form for each round of review (rather than requiring the reviewer to edit an existing file) and automatically remove scores of reviews that are not redone. The system also triggers an email to reviewer when there is a change in the submission. The scores are calculated on the fly based on the rubrics.&lt;br /&gt;
&lt;br /&gt;
=====Scope=====&lt;br /&gt;
This project will enhance the existing scoring and peer review functionality and the underlying implementation along with the testing of the existing implementation. Testing of the score calculation, display for the weighted and non-weighted scores based on the combination of the rubrics are part of this project. This project also includes an additional feature for the author to notify the reviewers for the change in the submission.&lt;br /&gt;
&lt;br /&gt;
=====Background=====&lt;br /&gt;
The system currently is designed to give a reviewer a new form for each round of review (rather than requiring the reviewer to edit an existing file) and automatically remove scores of reviews that are not redone. The scores are calculated based on the rubrics defined in the system. There’s already an existing implementation for the computation of score but it doesn’t work for multipart rubric&lt;br /&gt;
&lt;br /&gt;
=====Documentation=====&lt;br /&gt;
The documents that will be generated for this project are the design document, the actual files that we edit or create, and a ReadMe that explains what we did and how to use the modified product.&lt;br /&gt;
&lt;br /&gt;
=====Standards=====&lt;br /&gt;
The new standards that will be adhered to in this system are those given for the rails framework, and the code should follow rails and object oriented design principles. Any newly added code will adhere to the guidelines mentioned below:&lt;br /&gt;
&lt;br /&gt;
● https://github.com/rubocop-hq/rails-style-guide &amp;lt;br&amp;gt;&lt;br /&gt;
● http://wiki.expertiza.ncsu.edu/index.php/Object-Oriented_Design_and_Programming​.&lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
=====Problem=====&lt;br /&gt;
The system currently is designed to give a reviewer a new form for each round of review (rather than requiring the reviewer to edit an existing file) and automatically remove scores of reviews that are not redone. The functionality needs to be tested. It works in some cases, but we are suspicious that it is not entirely correct.&lt;br /&gt;
&lt;br /&gt;
'''Profile Email Preference''':&lt;br /&gt;
User in expertiza has liberty to control what kind of emails they should receive. As the reviewers will receive an email for the change in submission. This can be controlled by selecting an option (When someone else submits work I am assigned to review) on the profile page of the user. As the checkboxes are far away on the right corner of the screen, the position of checkboxes need to be changed to make it more user friendly. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Scores for students in Expertiza can be based on a combination of rubrics: review rubrics for each round of review, author feedback, and teammate review. In CSC/ECE 517, we don’t really use the student-assigned scores to grade projects, but the peer-review score shown to the student is based entirely on the second round of review&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is how scores are calculated:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. If only zero-weighted scores are available (here, in the first round of review), the average of all zero-weighted scores should be shown in grey font. An information button should explain why the scores are shown in grey (“The reviews submitted so far do not count toward the author’s final grade.”):&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. If any non-zero weighted scores are available, then the score shown for the assignment should be the weighted average of the scores. For example, if Round 2 reviews are weighted 90% and author feedback is weighted 10%, and two Round 2 reviews each gave the work a score of 80%, and the only author-feedback score was 100%, then the overall score is::&amp;lt;br&amp;gt;&lt;br /&gt;
    80%⨉90% + 100%⨉10% = 82%&lt;br /&gt;
&lt;br /&gt;
3. If a review is submitted, and then the author(s) update the submission ​before the end of the current round​, it will reopen the review, and then the reviewer can go in and update the submitted review. ​'''However, the previous review score that was given in the current round will count until the reviewer updates the submitted review'''. '''This functionality doesn’t work for multipart rubrics.''' &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The system also doesn’t generate emails to reviewers in case a new submission is made by the author without changing submission parameters like submission URL. Eg: A new submission is made by making a new deployment. But the deployment URL doesn’t change. In this case as well, without changing the current flow the author should have an option to notify all the reviewers to revisit the submission.&lt;br /&gt;
&lt;br /&gt;
=====Interface Requirement=====&lt;br /&gt;
The overall user interface would remain the same as of the current system. Since this is a modification to the current submission page, there will be a new addition to the submission page. On the submission page, there will be a new button to notify reviewers when there is a submission which doesn’t contain a change to submission parameters like submission URL, but the deployment has been updated on the same URL. Other than that the interface remains the same for the score page, only functionalities will be tested for multi-part rubrics.&lt;br /&gt;
&lt;br /&gt;
=====Quality Requirements=====&lt;br /&gt;
The interface changes are minimal and very easy to adapt. The new button will be clearly visible and is supposed to have a clear text to interpret its functionality. The proposed changes should not affect the current system functionality in any way. The solution is only intended to enrich the project features.&lt;br /&gt;
&lt;br /&gt;
=====Portability Requirements=====&lt;br /&gt;
All of the changes for this enhancement to Expertiza should not interfere with the platform portability in any way.&lt;br /&gt;
&lt;br /&gt;
=====Performance Requirements=====&lt;br /&gt;
Adding test for multi-part rubric functionality should not cause any overhead in the performance of the system. Sending emails through “Notify All Reviewers” button should affect the system minimally in terms of performance. The only overhead is a database query to get all the reviewers. A good database design should incorporate such a query smoothly.&lt;br /&gt;
&lt;br /&gt;
=====Assumptions=====&lt;br /&gt;
The functionality should work in case the assignment rubric is not multi-part.&lt;br /&gt;
&lt;br /&gt;
== '''Proposed Solution''' ==&lt;br /&gt;
=====Zero-weighted scores=====&lt;br /&gt;
If only zero-weighted scores are available in the first round of review, the average of all zero-weighted scores will be shown in a gray font. An information button will explain why the scores are shown in gray (“The reviews submitted so far do not count toward the author’s final grade”)&lt;br /&gt;
&lt;br /&gt;
Inside compute_total_score method in on_the_fly_calc.rb module, we'll check if the weighted score exists, if not then we'll calculate the non weighted score. We'll also have to add a method in the questionnaire model to get non weighted score. Few changes are required for the UI to display non-weighted score in grey with information icon and non weighted score in black. &lt;br /&gt;
&lt;br /&gt;
Possible files to be modified. &lt;br /&gt;
&lt;br /&gt;
models/on_the_fly_calc.rb&amp;lt;br&amp;gt;&lt;br /&gt;
models/questionnaire.rb&amp;lt;br&amp;gt;&lt;br /&gt;
models/view_team.html.erb&lt;br /&gt;
&lt;br /&gt;
===== Non-zero weighted scores=====&lt;br /&gt;
If any non-zero weighted scores are available, then the score shown for the assignment should be the weighted average of the scores. For example, if Round 2 reviews are weighted 90% and author feedback is weighted 10%, and two Round 2 reviews each gave the work a score of 80%, and the only author-feedback score was 100%, then the overall score is 80%⨉90% + 100%⨉10% = 82%&lt;br /&gt;
&lt;br /&gt;
We'll first write the test cases by adding test cases to the '''spec/models/on_the_fly_calc_spec.rb''' &lt;br /&gt;
&lt;br /&gt;
Also, we'll test this manually by computing the score and if there's a bug then below are the possible files to be modified. &lt;br /&gt;
&lt;br /&gt;
models/on_the_fly_calc.rb&amp;lt;br&amp;gt;&lt;br /&gt;
models/questionnarie.rb&lt;br /&gt;
&lt;br /&gt;
=====Review Update=====&lt;br /&gt;
If a review is submitted, and then the author(s) update the submission ​before the end of the current round​, it will reopen the review, and then the reviewer can go in and update the submitted review. However, the previous review score that was given in the current round will count until the reviewer updates the submitted review. This functionality already exists in the existing system. However, In some submissions, there’s no change in the submitted URL’s so there’s no way to let the reviewers know that the author has made some changes in the project. We’ll add a notify button for the Author in the UI which will trigger an email to the reviewers. This will reopen the review, and then the reviewer can go in and update the submitted review. However, the previous review score that was given in the current round will count until the reviewer updates the submitted review&lt;br /&gt;
&lt;br /&gt;
'''Sending an email when the submission parameters don’t change​:'''&lt;br /&gt;
&lt;br /&gt;
A new button will be added on the submission page. The button will enable the author to notify all the reviewers to revisit the submission. The email will be sent to all the assigned reviewers only if their email preference (When someone else submits work I am assigned to review) in the profile is set to receive the email.&lt;br /&gt;
&lt;br /&gt;
=====Profile Email Preference=====&lt;br /&gt;
The checkboxes are moved to the left corner. As the layout of the options have used table layout. So, we'll increase the width of the the column which includes checkboxes. We'll be using the percentage instead of fixed value to give the width, as this would adjust the column size based on the screen size. The CSS can be applied to the '''layout.scss''' file to using the appropriate class given to the column&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:E1975_CHECKBOX_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Use Case 1.png]]&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
=====Rspec=====&lt;br /&gt;
&lt;br /&gt;
New test cases will be added to test and validate the functionalities which are not working as expected. Also the test cases for features that will be newly added to the system, will also be written. Test cases will be added to these files:&lt;br /&gt;
spec/models/on_the_fly_calc_spec.rb&amp;lt;br&amp;gt;&lt;br /&gt;
spec/models/questionnaire_spec.rb&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The scenarios covered by the newly introduced test cases are as follows: &amp;lt;br&amp;gt;&lt;br /&gt;
1. Zero weighted scores &amp;lt;br&amp;gt;&lt;br /&gt;
2. Non-zero weighted scores &amp;lt;br&amp;gt;&lt;br /&gt;
3. Review update &amp;lt;br&amp;gt;&lt;br /&gt;
4. Sending an email when the submission parameters don’t change​ &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Email Preferences UI Changes=====&lt;br /&gt;
&lt;br /&gt;
The email preferences checkboxes at present appear sticking to the rightmost border of the page. By following the requirements the checkboxes will be made available closer to the text fields to make them look more user-friendly.&lt;br /&gt;
The changes can be tested by logging into the system and on the user profile page.&lt;br /&gt;
&lt;br /&gt;
=====Manual Testing=====&lt;br /&gt;
&lt;br /&gt;
'''Step 1'''. The instructor will create an assignment and assign the zero and non-zero weights to the rubrics.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Step 2'''. The author submits the work done in expertiza.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Step 3'''. Peers check the submitted work and give reviews for it.&amp;lt;br&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
'''Test 1: Zero weighted scores shown in gray.'''&amp;lt;br&amp;gt;&lt;br /&gt;
Login as an author in expertiza and go to scores page to view the feedback.&lt;br /&gt;
Zero weighted scores should be displayed in gray to the logged in user.&lt;br /&gt;
 &lt;br /&gt;
'''Test 2: Information button.'''&amp;lt;br&amp;gt;&lt;br /&gt;
Login as an author in expertiza and go to scores page to view the feedback.&lt;br /&gt;
The information button should explain why the scores are shown in gray (“The reviews submitted so far do not count toward the author’s final grade.”)&lt;br /&gt;
 &lt;br /&gt;
'''Step 4'''. The mentor evaluates the final submission and give grades.&lt;br /&gt;
 &lt;br /&gt;
'''Test 3: Display non-zero weighted scores'''&amp;lt;br&amp;gt;&lt;br /&gt;
Login as an author in expertiza and go to scores page to view the feedback.&lt;br /&gt;
The scores shown for the assignment should be the weighted average of the scores.&lt;br /&gt;
The zero weighted scores have to be replaced with non-zero weighted scores.&lt;br /&gt;
 &lt;br /&gt;
'''Step 5''': The author updates the work and re-submits it again.&lt;br /&gt;
 &lt;br /&gt;
'''Test 4: Review Update'''&amp;lt;br&amp;gt;&lt;br /&gt;
The Review should be reopened. The reviewer should be able to go and update the submitted review.&lt;br /&gt;
If the review is not updated the previous review score has to be retained.&lt;br /&gt;
 &lt;br /&gt;
'''Test 5: Notify reviewers'''&amp;lt;br&amp;gt;&lt;br /&gt;
The notify button on submission page should send a notification to all the corresponding reviewers to revisit the submission and update the reviews.&lt;/div&gt;</summary>
		<author><name>Psdravid</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1975._Generalize_Review_Versioning&amp;diff=129247</id>
		<title>CSC/ECE 517 Fall 2019 - E1975. Generalize Review Versioning</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1975._Generalize_Review_Versioning&amp;diff=129247"/>
		<updated>2019-11-12T04:47:06Z</updated>

		<summary type="html">&lt;p&gt;Psdravid: /* Rspec */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
== '''About Expertiza''' ==&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;
Expertiza is a peer-review based learning platform in which work-products by students are evaluated and scored by peer-review of other students. Review process occurs in stages. After submission of initial feedback for a work-product by the peer-group, students are allowed time to incorporate the comments and improve their work. This second version of the work product is reviewed again and scores are given. This process might be repeated again and the average score from the last review stage is considered as the final score for that work-product. This incremental development of work-products and progressive learning is the fundamental concept underlying the Expertiza system.&lt;br /&gt;
&lt;br /&gt;
=====Purpose=====&lt;br /&gt;
The system currently is designed to give a reviewer a new form for each round of review (rather than requiring the reviewer to edit an existing file) and automatically remove scores of reviews that are not redone. The system also triggers an email to reviewer when there is a change in the submission. The scores are calculated on the fly based on the rubrics.&lt;br /&gt;
&lt;br /&gt;
=====Scope=====&lt;br /&gt;
This project will enhance the existing scoring and peer review functionality and the underlying implementation along with the testing of the existing implementation. Testing of the score calculation, display for the weighted and non-weighted scores based on the combination of the rubrics are part of this project. This project also includes an additional feature for the author to notify the reviewers for the change in the submission.&lt;br /&gt;
&lt;br /&gt;
=====Background=====&lt;br /&gt;
The system currently is designed to give a reviewer a new form for each round of review (rather than requiring the reviewer to edit an existing file) and automatically remove scores of reviews that are not redone. The scores are calculated based on the rubrics defined in the system. There’s already an existing implementation for the computation of score but it doesn’t work for multipart rubric&lt;br /&gt;
&lt;br /&gt;
=====Documentation=====&lt;br /&gt;
The documents that will be generated for this project are the design document, the actual files that we edit or create, and a ReadMe that explains what we did and how to use the modified product.&lt;br /&gt;
&lt;br /&gt;
=====Standards=====&lt;br /&gt;
The new standards that will be adhered to in this system are those given for the rails framework, and the code should follow rails and object oriented design principles. Any newly added code will adhere to the guidelines mentioned below:&lt;br /&gt;
&lt;br /&gt;
● https://github.com/rubocop-hq/rails-style-guide &amp;lt;br&amp;gt;&lt;br /&gt;
● http://wiki.expertiza.ncsu.edu/index.php/Object-Oriented_Design_and_Programming​.&lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
=====Problem=====&lt;br /&gt;
The system currently is designed to give a reviewer a new form for each round of review (rather than requiring the reviewer to edit an existing file) and automatically remove scores of reviews that are not redone. The functionality needs to be tested. It works in some cases, but we are suspicious that it is not entirely correct.&lt;br /&gt;
&lt;br /&gt;
'''Profile Email Preference''':&lt;br /&gt;
User in expertiza has liberty to control what kind of emails they should receive. As the reviewers will receive an email for the change in submission. This can be controlled by selecting an option (When someone else submits work I am assigned to review) on the profile page of the user. As the checkboxes are far away on the right corner of the screen, the position of checkboxes need to be changed to make it more user friendly. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Scores for students in Expertiza can be based on a combination of rubrics: review rubrics for each round of review, author feedback, and teammate review. In CSC/ECE 517, we don’t really use the student-assigned scores to grade projects, but the peer-review score shown to the student is based entirely on the second round of review&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is how scores are calculated:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. If only zero-weighted scores are available (here, in the first round of review), the average of all zero-weighted scores should be shown in grey font. An information button should explain why the scores are shown in grey (“The reviews submitted so far do not count toward the author’s final grade.”):&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. If any non-zero weighted scores are available, then the score shown for the assignment should be the weighted average of the scores. For example, if Round 2 reviews are weighted 90% and author feedback is weighted 10%, and two Round 2 reviews each gave the work a score of 80%, and the only author-feedback score was 100%, then the overall score is::&amp;lt;br&amp;gt;&lt;br /&gt;
    80%⨉90% + 100%⨉10% = 82%&lt;br /&gt;
&lt;br /&gt;
3. If a review is submitted, and then the author(s) update the submission ​before the end of the current round​, it will reopen the review, and then the reviewer can go in and update the submitted review. ​'''However, the previous review score that was given in the current round will count until the reviewer updates the submitted review'''. '''This functionality doesn’t work for multipart rubrics.''' &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The system also doesn’t generate emails to reviewers in case a new submission is made by the author without changing submission parameters like submission URL. Eg: A new submission is made by making a new deployment. But the deployment URL doesn’t change. In this case as well, without changing the current flow the author should have an option to notify all the reviewers to revisit the submission.&lt;br /&gt;
&lt;br /&gt;
=====Interface Requirement=====&lt;br /&gt;
The overall user interface would remain the same as of the current system. Since this is a modification to the current submission page, there will be a new addition to the submission page. On the submission page, there will be a new button to notify reviewers when there is a submission which doesn’t contain a change to submission parameters like submission URL, but the deployment has been updated on the same URL. Other than that the interface remains the same for the score page, only functionalities will be tested for multi-part rubrics.&lt;br /&gt;
&lt;br /&gt;
=====Quality Requirements=====&lt;br /&gt;
The interface changes are minimal and very easy to adapt. The new button will be clearly visible and is supposed to have a clear text to interpret its functionality. The proposed changes should not affect the current system functionality in any way. The solution is only intended to enrich the project features.&lt;br /&gt;
&lt;br /&gt;
=====Portability Requirements=====&lt;br /&gt;
All of the changes for this enhancement to Expertiza should not interfere with the platform portability in any way.&lt;br /&gt;
&lt;br /&gt;
=====Performance Requirements=====&lt;br /&gt;
Adding test for multi-part rubric functionality should not cause any overhead in the performance of the system. Sending emails through “Notify All Reviewers” button should affect the system minimally in terms of performance. The only overhead is a database query to get all the reviewers. A good database design should incorporate such a query smoothly.&lt;br /&gt;
&lt;br /&gt;
=====Assumptions=====&lt;br /&gt;
The functionality should work in case the assignment rubric is not multi-part.&lt;br /&gt;
&lt;br /&gt;
== '''Proposed Solution''' ==&lt;br /&gt;
=====Zero-weighted scores=====&lt;br /&gt;
If only zero-weighted scores are available in the first round of review, the average of all zero-weighted scores will be shown in a gray font. An information button will explain why the scores are shown in gray (“The reviews submitted so far do not count toward the author’s final grade”)&lt;br /&gt;
&lt;br /&gt;
Inside compute_total_score method in on_the_fly_calc.rb module, we'll check if the weighted score exists, if not then we'll calculate the non weighted score. We'll also have to add a method in the questionnaire model to get non weighted score. Few changes are required for the UI to display non-weighted score in grey with information icon and non weighted score in black. &lt;br /&gt;
&lt;br /&gt;
Possible files to be modified. &lt;br /&gt;
&lt;br /&gt;
models/on_the_fly_calc.rb&amp;lt;br&amp;gt;&lt;br /&gt;
models/questionnaire.rb&amp;lt;br&amp;gt;&lt;br /&gt;
models/view_team.html.erb&lt;br /&gt;
&lt;br /&gt;
===== Non-zero weighted scores=====&lt;br /&gt;
If any non-zero weighted scores are available, then the score shown for the assignment should be the weighted average of the scores. For example, if Round 2 reviews are weighted 90% and author feedback is weighted 10%, and two Round 2 reviews each gave the work a score of 80%, and the only author-feedback score was 100%, then the overall score is 80%⨉90% + 100%⨉10% = 82%&lt;br /&gt;
&lt;br /&gt;
We'll first write the test cases by adding test cases to the '''spec/models/on_the_fly_calc_spec.rb''' &lt;br /&gt;
&lt;br /&gt;
Also, we'll test this manually by computing the score and if there's a bug then below are the possible files to be modified. &lt;br /&gt;
&lt;br /&gt;
models/on_the_fly_calc.rb&amp;lt;br&amp;gt;&lt;br /&gt;
models/questionnarie.rb&lt;br /&gt;
&lt;br /&gt;
=====Review Update=====&lt;br /&gt;
If a review is submitted, and then the author(s) update the submission ​before the end of the current round​, it will reopen the review, and then the reviewer can go in and update the submitted review. However, the previous review score that was given in the current round will count until the reviewer updates the submitted review. This functionality already exists in the existing system. However, In some submissions, there’s no change in the submitted URL’s so there’s no way to let the reviewers know that the author has made some changes in the project. We’ll add a notify button for the Author in the UI which will trigger an email to the reviewers. This will reopen the review, and then the reviewer can go in and update the submitted review. However, the previous review score that was given in the current round will count until the reviewer updates the submitted review&lt;br /&gt;
&lt;br /&gt;
'''Sending an email when the submission parameters don’t change​:'''&lt;br /&gt;
&lt;br /&gt;
A new button will be added on the submission page. The button will enable the author to notify all the reviewers to revisit the submission. The email will be sent to all the assigned reviewers only if their email preference (When someone else submits work I am assigned to review) in the profile is set to receive the email.&lt;br /&gt;
&lt;br /&gt;
=====Profile Email Preference=====&lt;br /&gt;
The checkboxes are moved to the left corner. As the layout of the options have used table layout. So, we'll increase the width of the the column which includes checkboxes. We'll be using the percentage instead of fixed value to give the width, as this would adjust the column size based on the screen size. The CSS can be applied to the '''layout.scss''' file to using the appropriate class given to the column&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:E1975_CHECKBOX_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Use Case 1.png]]&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
=====Rspec=====&lt;br /&gt;
&lt;br /&gt;
New test cases will be added to test and validate the functionalities which are not working as expected. Also the test cases for features that will be newly added to the system, will also be written. Test cases will be added to these files:&lt;br /&gt;
spec/models/on_the_fly_calc_spec.rb&amp;lt;br&amp;gt;&lt;br /&gt;
spec/models/questionnaire_spec.rb&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The scenarios covered by the newly introduced test cases are as follows:&lt;br /&gt;
1.&lt;br /&gt;
&lt;br /&gt;
=====Email Preferences UI Changes=====&lt;br /&gt;
&lt;br /&gt;
The email preferences checkboxes at present appear sticking to the rightmost border of the page. By following the requirements the checkboxes will be made available closer to the text fields to make them look more user-friendly.&lt;br /&gt;
The changes can be tested by logging into the system and on the user profile page.&lt;br /&gt;
&lt;br /&gt;
=====Manual Testing=====&lt;br /&gt;
&lt;br /&gt;
'''Step 1'''. The instructor will create an assignment and assign the zero and non-zero weights to the rubrics.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Step 2'''. The author submits the work done in expertiza.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Step 3'''. Peers check the submitted work and give reviews for it.&amp;lt;br&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
'''Test 1: Zero weighted scores shown in gray.'''&amp;lt;br&amp;gt;&lt;br /&gt;
Login as an author in expertiza and go to scores page to view the feedback.&lt;br /&gt;
Zero weighted scores should be displayed in gray to the logged in user.&lt;br /&gt;
 &lt;br /&gt;
'''Test 2: Information button.'''&amp;lt;br&amp;gt;&lt;br /&gt;
Login as an author in expertiza and go to scores page to view the feedback.&lt;br /&gt;
The information button should explain why the scores are shown in gray (“The reviews submitted so far do not count toward the author’s final grade.”)&lt;br /&gt;
 &lt;br /&gt;
'''Step 4'''. The mentor evaluates the final submission and give grades.&lt;br /&gt;
 &lt;br /&gt;
'''Test 3: Display non-zero weighted scores'''&amp;lt;br&amp;gt;&lt;br /&gt;
Login as an author in expertiza and go to scores page to view the feedback.&lt;br /&gt;
The scores shown for the assignment should be the weighted average of the scores.&lt;br /&gt;
The zero weighted scores have to be replaced with non-zero weighted scores.&lt;br /&gt;
 &lt;br /&gt;
'''Step 5''': The author updates the work and re-submits it again.&lt;br /&gt;
 &lt;br /&gt;
'''Test 4: Review Update'''&amp;lt;br&amp;gt;&lt;br /&gt;
The Review should be reopened. The reviewer should be able to go and update the submitted review.&lt;br /&gt;
If the review is not updated the previous review score has to be retained.&lt;br /&gt;
 &lt;br /&gt;
'''Test 5: Notify reviewers'''&amp;lt;br&amp;gt;&lt;br /&gt;
The notify button on submission page should send a notification to all the corresponding reviewers to revisit the submission and update the reviews.&lt;/div&gt;</summary>
		<author><name>Psdravid</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=127517</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=127517"/>
		<updated>2019-11-06T23:21:53Z</updated>

		<summary type="html">&lt;p&gt;Psdravid: /* 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;
&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>Psdravid</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=127515</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=127515"/>
		<updated>2019-11-06T23:21:35Z</updated>

		<summary type="html">&lt;p&gt;Psdravid: /* 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, 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)&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>Psdravid</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=127514</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=127514"/>
		<updated>2019-11-06T23:21:07Z</updated>

		<summary type="html">&lt;p&gt;Psdravid: /* 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, 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.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>Psdravid</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:918_sample.png&amp;diff=127513</id>
		<title>File:918 sample.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:918_sample.png&amp;diff=127513"/>
		<updated>2019-11-06T23:20:36Z</updated>

		<summary type="html">&lt;p&gt;Psdravid: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Psdravid</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=127504</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=127504"/>
		<updated>2019-11-06T23:15:13Z</updated>

		<summary type="html">&lt;p&gt;Psdravid: /* 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) [[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>Psdravid</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=127497</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=127497"/>
		<updated>2019-11-06T23:10:22Z</updated>

		<summary type="html">&lt;p&gt;Psdravid: /* Issue 918 */&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;
*'''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>Psdravid</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=127495</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=127495"/>
		<updated>2019-11-06T23:08:04Z</updated>

		<summary type="html">&lt;p&gt;Psdravid: /* Issue 918 */&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;
      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>Psdravid</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=127492</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=127492"/>
		<updated>2019-11-06T23:04:53Z</updated>

		<summary type="html">&lt;p&gt;Psdravid: /* Issue 918 */&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;
&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>Psdravid</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:918_p2.png&amp;diff=127489</id>
		<title>File:918 p2.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:918_p2.png&amp;diff=127489"/>
		<updated>2019-11-06T23:01:35Z</updated>

		<summary type="html">&lt;p&gt;Psdravid: uploaded a new version of &amp;amp;quot;File:918 p2.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Psdravid</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:918_p2.png&amp;diff=127488</id>
		<title>File:918 p2.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:918_p2.png&amp;diff=127488"/>
		<updated>2019-11-06T23:01:32Z</updated>

		<summary type="html">&lt;p&gt;Psdravid: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Psdravid</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:918_p1.png&amp;diff=127487</id>
		<title>File:918 p1.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:918_p1.png&amp;diff=127487"/>
		<updated>2019-11-06T23:00:18Z</updated>

		<summary type="html">&lt;p&gt;Psdravid: uploaded a new version of &amp;amp;quot;File:918 p1.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Psdravid</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:918_p1.png&amp;diff=127485</id>
		<title>File:918 p1.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:918_p1.png&amp;diff=127485"/>
		<updated>2019-11-06T22:58:08Z</updated>

		<summary type="html">&lt;p&gt;Psdravid: uploaded a new version of &amp;amp;quot;File:918 p1.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Psdravid</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:918_p1.png&amp;diff=127483</id>
		<title>File:918 p1.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:918_p1.png&amp;diff=127483"/>
		<updated>2019-11-06T22:57:36Z</updated>

		<summary type="html">&lt;p&gt;Psdravid: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Psdravid</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=127482</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=127482"/>
		<updated>2019-11-06T22:57:24Z</updated>

		<summary type="html">&lt;p&gt;Psdravid: /* 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;
'''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>Psdravid</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=127481</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=127481"/>
		<updated>2019-11-06T22:56:53Z</updated>

		<summary type="html">&lt;p&gt;Psdravid: /* 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;
'''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: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: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>Psdravid</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=127479</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=127479"/>
		<updated>2019-11-06T22:55:15Z</updated>

		<summary type="html">&lt;p&gt;Psdravid: /* 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;
'''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;
::::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 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>Psdravid</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=125942</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=125942"/>
		<updated>2019-10-28T19:44:04Z</updated>

		<summary type="html">&lt;p&gt;Psdravid: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Issue #918&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;
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;/div&gt;</summary>
		<author><name>Psdravid</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=125941</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=125941"/>
		<updated>2019-10-28T19:42:43Z</updated>

		<summary type="html">&lt;p&gt;Psdravid: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Issue #918&lt;br /&gt;
New code introduced is as follows.&lt;br /&gt;
File:app/helpers/import_topics_helper.rb&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;/div&gt;</summary>
		<author><name>Psdravid</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=125939</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=125939"/>
		<updated>2019-10-28T19:42:09Z</updated>

		<summary type="html">&lt;p&gt;Psdravid: Created page with &amp;quot;Issue #918 New code introduced is as follows. File:app/helpers/import_topics_helper.rb Code: def self.define_attributes(row_hash)     attributes = {}     if !row_hash[:descriptio...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Issue #918&lt;br /&gt;
New code introduced is as follows.&lt;br /&gt;
File:app/helpers/import_topics_helper.rb&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;
@@ -13,6 +17,13 @@ def self.define_attributes(row_hash)&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;/div&gt;</summary>
		<author><name>Psdravid</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019&amp;diff=125933</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=125933"/>
		<updated>2019-10-28T19:38:28Z</updated>

		<summary type="html">&lt;p&gt;Psdravid: &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 - 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;/div&gt;</summary>
		<author><name>Psdravid</name></author>
	</entry>
</feed>