<?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=Onkashid</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=Onkashid"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Onkashid"/>
	<updated>2026-08-11T03:42:07Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1987._Improving_search_facility_in_Expertiza&amp;diff=128410</id>
		<title>CSC/ECE 517 Fall 2019 - E1987. Improving search facility in Expertiza</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1987._Improving_search_facility_in_Expertiza&amp;diff=128410"/>
		<updated>2019-11-11T02:05:11Z</updated>

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

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

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

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

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

		<summary type="html">&lt;p&gt;Onkashid: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction:==&lt;br /&gt;
&lt;br /&gt;
The Expertiza application running on Ruby on Rails is used for a variety of purposes by students and faculty members. There are many pages that display information about students, assignments, rubrics and reviews. The information is displayed with attributes like name, ID, due date etc. This project works on improving the search facility by adding search criteria in existing search bars, making it look elegant and adding search bars if not present.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Problem Definition:==&lt;br /&gt;
&lt;br /&gt;
# An instructor or administrator can search for a user by name, user-ID, or other characteristics.&lt;br /&gt;
# An instructor should be able to search for assignments by name, due date, or other characteristics.&lt;br /&gt;
# An instructor should be able to search for rubrics (or other questionnaires) by name, or by the courses or assignments they have been used in.&lt;br /&gt;
## For the instructor, there also needs to be a way to quickly find rubrics (and other questionnaires) that have been used in a single course.  It should be possible to search or click somewhere to bring up a list of questionnaires used in the course, expanding only the applicable questionnaires in the list of questionnaires.&lt;br /&gt;
## One should also be able to search for questionnaires by words used in questions that belong to the questionnaires.&lt;br /&gt;
#There should be a way to search all reviews of a particular team’s work for particular scores or text strings.  Reviews should be able to be filtered by score, text comment length, reviewer and reviewee.&lt;br /&gt;
#An instructor or administrator should be able to search for all the assignments that a particular user has participated in.&lt;br /&gt;
#If more than one criteria needs to be specified, there should be an 'Advanced Search' button.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Proposed Solution:==&lt;br /&gt;
&lt;br /&gt;
===Search for User:===&lt;br /&gt;
&lt;br /&gt;
In the current system workflow the user is able to search for a particular user by entering a partial or a complete text that matches with the user name. In the proposed workflow searching by name, searching by User ID will also be supported. The user will be able to apply multiple filters at a time and the output of the query will match all filter applied. If no results are found an empty list will be returned.&lt;br /&gt;
&lt;br /&gt;
Steps to reproduce the proposed workflow:&lt;br /&gt;
:#Log in to expertiza to view the home page&lt;br /&gt;
:#Go to Manage &amp;gt; Users&lt;br /&gt;
:#Type the name of the user in the search box available below the ‘Users’ tab&lt;br /&gt;
:#In the dropdown list that opens up, click on the ‘Advanced Search’ button if you                                                                                                                                                         wish to apply more filters. &lt;br /&gt;
:#All the entries that match the given criteria will be returned.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Search for Assignments:===&lt;br /&gt;
&lt;br /&gt;
In the current system implementation, searching via the name of the assignment is    supported. In the proposed system, the user will be able to search for an assignment using additional filters such as date created, date updated. The user will be able to apply multiple filters at a time and the output of the query will match all filter applied. If no results are found an empty list will be returned.&lt;br /&gt;
&lt;br /&gt;
To search for an assignment by creation date, the user can enter a time duration within which the assignment was created. All assignments that were created within this date range and which match other filters will be returned. The procedure is same for searching by date of update.&lt;br /&gt;
&lt;br /&gt;
Steps to reproduce the proposed workflow:&lt;br /&gt;
:#Log in to expertiza to view the home page&lt;br /&gt;
:#Go to Manage &amp;gt; Assignments&lt;br /&gt;
:#Type the name of the assignment in the search box available below the ‘Assignments’ tab&lt;br /&gt;
:#In the dropdown list that opens up, click on the ‘Advanced Search’ button if you                                                                                                                                                         wish to apply more filters ( date of creation, date updated).&lt;br /&gt;
:#All the entries that match the given criteria will be returned.&lt;br /&gt;
&lt;br /&gt;
===Search for Questionnaires:===&lt;br /&gt;
&lt;br /&gt;
The existing system does not have a search functionality under Questionnaires. The proposed system will implement a search functionality for searching via the name of the questionnaire, the text in the question within a questionnaire, date of creation, date updated.  The user will be able to apply multiple filters at a time and the output of the query will match all filter applied. If no results are found an empty list will be returned.&lt;br /&gt;
&lt;br /&gt;
To search for a course by creation date, the user can enter a time duration within which the course was created. All courses that were created within this date range and which match other filters will be returned. The procedure is same for searching by date of update. The questionnaires will be grouped on the basis of their courses and will be expanded when clicked.&lt;br /&gt;
&lt;br /&gt;
All the above will be available under Manage &amp;gt; Questionnaires.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Search for Reviews:===&lt;br /&gt;
&lt;br /&gt;
The existing system does not have a search functionality under Reviews. The proposed system will implement a search functionality for searching using the attributes like team name, score, reviewer, comment etc.&lt;br /&gt;
&lt;br /&gt;
==Use Case Diagram==&lt;br /&gt;
[[File:Usecase search.png|center]]&lt;br /&gt;
&lt;br /&gt;
== Proposed Code Changes ==&lt;br /&gt;
We though about 2 ways of adding the search functionality in the system &lt;br /&gt;
:# Adding a search controller to the system  &lt;br /&gt;
:# Adding search functionality to individual models &lt;br /&gt;
&lt;br /&gt;
===Adding a search controller ===&lt;br /&gt;
If we followed this approach the search query would be like &lt;br /&gt;
*localhost:port/search/user?name=&amp;lt;&amp;gt;&lt;br /&gt;
*localhost:port/search/assignment?name=&amp;lt;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This would mean that we are thinking of search as a resource on the system which to us looked as a wrong approach&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Adding search functionality to individual models===&lt;br /&gt;
&lt;br /&gt;
If we followed this approach the search query would be like &lt;br /&gt;
:#localhost:port/user/search?name=&amp;lt;&amp;gt;&lt;br /&gt;
:#localhost:port/assignment/search?name=&amp;lt;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On discussions we concluded that that the latter was a more RESTFul design &lt;br /&gt;
For most of the cases we have tried to minimize the changes required in the respective model by  reuse&lt;br /&gt;
We propose to add search methods in each model for corresponding changes. &lt;br /&gt;
&lt;br /&gt;
Therefore in order to perform search every entity required changes in all the three layers &lt;br /&gt;
*View : Changes in view are changes added to UI, and it is used to pass search parameters to controller &lt;br /&gt;
*Controller : Parses the changes from UI, essentially takes params[] hash.&lt;br /&gt;
*Model : Bulk of search logic is implemented here, once the model gets the parameters for the search ( hash ), the query is incrementally built using all the params and then executed to get the list of objects. &lt;br /&gt;
&lt;br /&gt;
User changes have been handled differently than for Questionnaire, Assignments and Review because Users follows the traditional RoR scheme, where as others user React for UI. &lt;br /&gt;
React based View changes are in app/assets/javascripts/tree_display.jsx.   &lt;br /&gt;
&lt;br /&gt;
====User====&lt;br /&gt;
* Search fields&lt;br /&gt;
** username&lt;br /&gt;
** name&lt;br /&gt;
** email&lt;br /&gt;
&lt;br /&gt;
* Modified files:&lt;br /&gt;
** app/views/users/list.html.erb&lt;br /&gt;
** app/controllers/users_controller.rb&lt;br /&gt;
** app/models/user.rb&lt;br /&gt;
&lt;br /&gt;
* Modified functions&lt;br /&gt;
** UsersController#list : Parses the username, name and email from the params hash. &lt;br /&gt;
** User#get_user_list : Model returns list of users to the view, changes in this function uses regex to filter out the entries that do not match search params.&lt;br /&gt;
&lt;br /&gt;
====Assignment====&lt;br /&gt;
* Search fields &lt;br /&gt;
** name&lt;br /&gt;
** assignee_username&lt;br /&gt;
** assignee_name&lt;br /&gt;
** due_date_before&lt;br /&gt;
** due_date_after&lt;br /&gt;
** created_before&lt;br /&gt;
** created_after&lt;br /&gt;
&lt;br /&gt;
* Modified files&lt;br /&gt;
** app/assets/javascripts/tree_display.jsx&lt;br /&gt;
** app/controllers/tree_display_controller.rb&lt;br /&gt;
** app/models/assignment_node.rb&lt;br /&gt;
&lt;br /&gt;
* Modified functions&lt;br /&gt;
** TreeDisplayController#initialize_fnode_update_children&lt;br /&gt;
** TreeDisplayController#update_fnode_children&lt;br /&gt;
** AssignmentNode.get&lt;br /&gt;
&lt;br /&gt;
====Questionnaire====&lt;br /&gt;
* Search fields&lt;br /&gt;
** name&lt;br /&gt;
** text&lt;br /&gt;
** course&lt;br /&gt;
** assignment&lt;br /&gt;
&lt;br /&gt;
* Modified files&lt;br /&gt;
** app/assets/javascripts/tree_display.jsx&lt;br /&gt;
** app/controllers/tree_display_controller.rb&lt;br /&gt;
** app/models/questionnaire_node.rb&lt;br /&gt;
&lt;br /&gt;
* Modified functions&lt;br /&gt;
** TreeDisplayController#get_tmp_res&lt;br /&gt;
** QuestionnaireNode.get&lt;br /&gt;
&lt;br /&gt;
====Review====&lt;br /&gt;
* Search fields&lt;br /&gt;
** team&lt;br /&gt;
** text&lt;br /&gt;
** min_score&lt;br /&gt;
** max_score&lt;br /&gt;
&lt;br /&gt;
* Modified files&lt;br /&gt;
** app/views/review_mapping/_searchbox.html.erb&lt;br /&gt;
** app/controllers/review_mapping_controller.rb&lt;br /&gt;
** app/helpers/summary_helper.rb&lt;br /&gt;
&lt;br /&gt;
* Modified functions&lt;br /&gt;
** ReviewMappingController#response_report&lt;br /&gt;
** SummaryHelper#summarize_reviews_by_reviewees&lt;br /&gt;
&lt;br /&gt;
==Database Design==&lt;br /&gt;
&lt;br /&gt;
===ER Diagram:===&lt;br /&gt;
The simplified version of ER Diagram depicts relationships between the entity sets that are used in the system. Many-to-many relationships are identified by named-diamonds - teams_users, assignment_questionnaires, which are implemented as tables.&lt;br /&gt;
[[File:ER diagram.png|center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Relevant Tables===&lt;br /&gt;
[[File:User table.png|center]]&lt;br /&gt;
&lt;br /&gt;
[[File:Screen Shot 2018-11-20 at 11.42.06 PM.png|center]]&lt;br /&gt;
&lt;br /&gt;
==Test Plan: ==&lt;br /&gt;
We plan to two types of testing &lt;br /&gt;
=== UI Tests ===&lt;br /&gt;
====Search for User====&lt;br /&gt;
Setup: create a user with name=&amp;quot;student&amp;quot; and userId=&amp;quot;5000&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Action: Instructor clicks on manage - &amp;gt; users -&amp;gt; in textbox enters name=&amp;quot;student&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
Response: Relevant details of student, name=&amp;quot;student&amp;quot; is displayed&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Action: Instructor clicks on manage - &amp;gt; users -&amp;gt; advanced search-&amp;gt;clicks on checkbox student id and enters &amp;quot;5000&amp;quot; and click &amp;quot;ok&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
Response: Relevant details of student, name=&amp;quot;student&amp;quot; is displayed&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Search for Assignments====&lt;br /&gt;
Setup create an assignment with name=&amp;quot;assignment&amp;quot; and set a due date&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Action : Instructor clicks on Manage -&amp;gt; Assignments, in textbox enter &amp;quot;assignment&amp;quot; in relevant tab&amp;lt;br&amp;gt; &lt;br /&gt;
Response : Relevant assignment should be displayed&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Action : Instructor clicks on Manage -&amp;gt; Assignments-&amp;gt; drop down and apply filters for due date and enter date and click &amp;quot;ok&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
Response : Relevant assignments should be displayed&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Search for Questionnaires====&lt;br /&gt;
Setup : Create a Questionnaire, add questions to it&amp;lt;br&amp;gt;&lt;br /&gt;
Action : Log in as instructor,  Manage -&amp;gt; Questionnaires, in text box enter text&amp;lt;br&amp;gt;&lt;br /&gt;
Response : Questionnaires matching text are shown&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Action : Log in as instructor,  Manage -&amp;gt; Questionnaires, click advanced search and check creation date and enter value&amp;lt;br&amp;gt;&lt;br /&gt;
Response : Questionnaires matching text are shown&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Search for Reviews====&lt;br /&gt;
Setup : Setup review for an assignment, login as student and then add review &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Action : Log in as instructor, Manage -&amp;gt; Assignments, Click on Review Report icon on corresponding assignment&amp;lt;br&amp;gt;&lt;br /&gt;
Result : Review should be seen&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Action : Click Advanced search, check review by text  and enter text&amp;lt;br&amp;gt;  &lt;br /&gt;
Result : Matching review should be visible&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Automated Tests ===&lt;br /&gt;
Automated tests in RSpec will be added as we implement the search functionality for each Model &amp;lt;br&amp;gt;&lt;br /&gt;
Most tests added will be unit tests that cover the test cases for each flow and changes in the model.&amp;lt;br&amp;gt;&lt;br /&gt;
Test Details &lt;br /&gt;
* User Model ( spec/models/user_spec.rb )&lt;br /&gt;
# Search by user name&lt;br /&gt;
# Search by user name that does not exist&lt;br /&gt;
# Search by user email&lt;br /&gt;
# Search by user email that does not exist&lt;br /&gt;
# Search by user email containing a substring&lt;br /&gt;
# Search by user full name&lt;br /&gt;
# Search by user full name is empty&lt;br /&gt;
# Search by user name and email&lt;/div&gt;</summary>
		<author><name>Onkashid</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018-_Project_E1861._Improving_search_facility_in_Expertiza&amp;diff=128356</id>
		<title>CSC/ECE 517 Fall 2018- Project E1861. Improving search facility in Expertiza</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018-_Project_E1861._Improving_search_facility_in_Expertiza&amp;diff=128356"/>
		<updated>2019-11-11T01:24:43Z</updated>

		<summary type="html">&lt;p&gt;Onkashid: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction:==&lt;br /&gt;
&lt;br /&gt;
The Expertiza application running on Ruby on Rails is used for a variety of purposes by students and faculty members. There are many pages that display information about students, assignments, rubrics and reviews. The information is displayed with attributes like name, ID, due date etc. This project works on improving the search facility by adding search criteria in existing search bars, making it look elegant and adding search bars if not present.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Problem Definition:==&lt;br /&gt;
&lt;br /&gt;
# An instructor or administrator can search for a user by name, user-ID, or other characteristics.&lt;br /&gt;
# An instructor should be able to search for assignments by name, due date, or other characteristics.&lt;br /&gt;
# An instructor should be able to search for rubrics (or other questionnaires) by name, or by the courses or assignments they have been used in.&lt;br /&gt;
## For the instructor, there also needs to be a way to quickly find rubrics (and other questionnaires) that have been used in a single course.  It should be possible to search or click somewhere to bring up a list of questionnaires used in the course, expanding only the applicable questionnaires in the list of questionnaires.&lt;br /&gt;
## One should also be able to search for questionnaires by words used in questions that belong to the questionnaires.&lt;br /&gt;
#There should be a way to search all reviews of a particular team’s work for particular scores or text strings.  Reviews should be able to be filtered by score, text comment length, reviewer and reviewee.&lt;br /&gt;
#An instructor or administrator should be able to search for all the assignments that a particular user has participated in.&lt;br /&gt;
#If more than one criteria needs to be specified, there should be an 'Advanced Search' button.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Proposed Solution:==&lt;br /&gt;
&lt;br /&gt;
===Search for User:===&lt;br /&gt;
&lt;br /&gt;
In the current system workflow the user is able to search for a particular user by entering a partial or a complete text that matches with the user name. In the proposed workflow searching by name, searching by User ID will also be supported. The user will be able to apply multiple filters at a time and the output of the query will match all filter applied. If no results are found an empty list will be returned.&lt;br /&gt;
&lt;br /&gt;
Steps to reproduce the proposed workflow:&lt;br /&gt;
:#Log in to expertiza to view the home page&lt;br /&gt;
:#Go to Manage &amp;gt; Users&lt;br /&gt;
:#Type the name of the user in the search box available below the ‘Users’ tab&lt;br /&gt;
:#In the dropdown list that opens up, click on the ‘Advanced Search’ button if you                                                                                                                                                         wish to apply more filters. &lt;br /&gt;
:#All the entries that match the given criteria will be returned.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Search for Assignments:===&lt;br /&gt;
&lt;br /&gt;
In the current system implementation, searching via the name of the assignment is    supported. In the proposed system, the user will be able to search for an assignment using additional filters such as date created, date updated. The user will be able to apply multiple filters at a time and the output of the query will match all filter applied. If no results are found an empty list will be returned.&lt;br /&gt;
&lt;br /&gt;
To search for an assignment by creation date, the user can enter a time duration within which the assignment was created. All assignments that were created within this date range and which match other filters will be returned. The procedure is same for searching by date of update.&lt;br /&gt;
&lt;br /&gt;
Steps to reproduce the proposed workflow:&lt;br /&gt;
:#Log in to expertiza to view the home page&lt;br /&gt;
:#Go to Manage &amp;gt; Assignments&lt;br /&gt;
:#Type the name of the assignment in the search box available below the ‘Assignments’ tab&lt;br /&gt;
:#In the dropdown list that opens up, click on the ‘Advanced Search’ button if you                                                                                                                                                         wish to apply more filters ( date of creation, date updated).&lt;br /&gt;
:#All the entries that match the given criteria will be returned.&lt;br /&gt;
&lt;br /&gt;
===Search for Questionnaires:===&lt;br /&gt;
&lt;br /&gt;
The existing system does not have a search functionality under Questionnaires. The proposed system will implement a search functionality for searching via the name of the questionnaire, the text in the question within a questionnaire, date of creation, date updated.  The user will be able to apply multiple filters at a time and the output of the query will match all filter applied. If no results are found an empty list will be returned.&lt;br /&gt;
&lt;br /&gt;
To search for a course by creation date, the user can enter a time duration within which the course was created. All courses that were created within this date range and which match other filters will be returned. The procedure is same for searching by date of update. The questionnaires will be grouped on the basis of their courses and will be expanded when clicked.&lt;br /&gt;
&lt;br /&gt;
All the above will be available under Manage &amp;gt; Questionnaires.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Search for Reviews:===&lt;br /&gt;
&lt;br /&gt;
The existing system does not have a search functionality under Reviews. The proposed system will implement a search functionality for searching using the attributes like team name, score, reviewer, comment etc.&lt;br /&gt;
&lt;br /&gt;
==Use Case Diagram==&lt;br /&gt;
[[File:Usecase search.png|center]]&lt;br /&gt;
&lt;br /&gt;
== Proposed Code Changes ==&lt;br /&gt;
We though about 2 ways of adding the search functionality in the system &lt;br /&gt;
:# Adding a search controller to the system  &lt;br /&gt;
:# Adding search functionality to individual models &lt;br /&gt;
&lt;br /&gt;
===Adding a search controller ===&lt;br /&gt;
If we followed this approach the search query would be like &lt;br /&gt;
*localhost:port/search/user?name=&amp;lt;&amp;gt;&lt;br /&gt;
*localhost:port/search/assignment?name=&amp;lt;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This would mean that we are thinking of search as a resource on the system which to us looked as a wrong approach&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Adding search functionality to individual models===&lt;br /&gt;
&lt;br /&gt;
If we followed this approach the search query would be like &lt;br /&gt;
:#localhost:port/user/search?name=&amp;lt;&amp;gt;&lt;br /&gt;
:#localhost:port/assignment/search?name=&amp;lt;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On discussions we concluded that that the latter was a more RESTFul design &lt;br /&gt;
For most of the cases we have tried to minimize the changes required in the respective model by  reuse&lt;br /&gt;
We propose to add search methods in each model for corresponding changes. &lt;br /&gt;
&lt;br /&gt;
Therefore in order to perform search every entity required changes in all the three layers &lt;br /&gt;
*View : Changes in view are changes added to UI, and it is used to pass search parameters to controller &lt;br /&gt;
*Controller : Parses the changes from UI, essentially takes params[] hash.&lt;br /&gt;
*Model : Bulk of search logic is implemented here, once the model gets the parameters for the search ( hash ), the query is incrementally built using all the params and then executed to get the list of objects. &lt;br /&gt;
&lt;br /&gt;
User changes have been handled differently than for Questionnaire, Assignments and Review because Users follows the traditional RoR scheme, where as others user React for UI. &lt;br /&gt;
React based View changes are in app/assets/javascripts/tree_display.jsx.   &lt;br /&gt;
&lt;br /&gt;
====User====&lt;br /&gt;
* Search fields&lt;br /&gt;
** username&lt;br /&gt;
** name&lt;br /&gt;
** email&lt;br /&gt;
&lt;br /&gt;
* Modified files:&lt;br /&gt;
** app/views/users/list.html.erb&lt;br /&gt;
** app/controllers/users_controller.rb&lt;br /&gt;
** app/models/user.rb&lt;br /&gt;
&lt;br /&gt;
* Modified functions&lt;br /&gt;
** UsersController#list : Parses the username, name and email from the params hash. &lt;br /&gt;
** User#get_user_list : Model returns list of users to the view, changes in this function uses regex to filter out the entries that do not match search params.&lt;br /&gt;
&lt;br /&gt;
====Assignment====&lt;br /&gt;
* Search fields &lt;br /&gt;
** name&lt;br /&gt;
** assignee_username&lt;br /&gt;
** assignee_name&lt;br /&gt;
** due_date_before&lt;br /&gt;
** due_date_after&lt;br /&gt;
** created_before&lt;br /&gt;
** created_after&lt;br /&gt;
&lt;br /&gt;
* Modified files&lt;br /&gt;
** app/assets/javascripts/tree_display.jsx&lt;br /&gt;
** app/controllers/tree_display_controller.rb&lt;br /&gt;
** app/models/assignment_node.rb&lt;br /&gt;
&lt;br /&gt;
* Modified functions&lt;br /&gt;
** TreeDisplayController#initialize_fnode_update_children&lt;br /&gt;
** TreeDisplayController#update_fnode_children&lt;br /&gt;
** AssignmentNode.get&lt;br /&gt;
&lt;br /&gt;
====Questionnaire====&lt;br /&gt;
* Search fields&lt;br /&gt;
** name&lt;br /&gt;
** text&lt;br /&gt;
** course&lt;br /&gt;
** assignment&lt;br /&gt;
&lt;br /&gt;
* Modified files&lt;br /&gt;
** app/assets/javascripts/tree_display.jsx&lt;br /&gt;
** app/controllers/tree_display_controller.rb&lt;br /&gt;
** app/models/questionnaire_node.rb&lt;br /&gt;
&lt;br /&gt;
* Modified functions&lt;br /&gt;
** TreeDisplayController#get_tmp_res&lt;br /&gt;
** QuestionnaireNode.get&lt;br /&gt;
&lt;br /&gt;
====Review====&lt;br /&gt;
* Search fields&lt;br /&gt;
** team&lt;br /&gt;
** text&lt;br /&gt;
** min_score&lt;br /&gt;
** max_score&lt;br /&gt;
&lt;br /&gt;
* Modified files&lt;br /&gt;
** app/views/review_mapping/_searchbox.html.erb&lt;br /&gt;
** app/controllers/review_mapping_controller.rb&lt;br /&gt;
** app/helpers/summary_helper.rb&lt;br /&gt;
&lt;br /&gt;
* Modified functions&lt;br /&gt;
** ReviewMappingController#response_report&lt;br /&gt;
** SummaryHelper#summarize_reviews_by_reviewees&lt;br /&gt;
&lt;br /&gt;
==Database Design==&lt;br /&gt;
&lt;br /&gt;
===ER Diagram:===&lt;br /&gt;
Below is the simplified version of the ER diagram which displays the relationships between the entity sets. Team_users and assignment_questionnaires are many to many relationships which are implemented in table format as show below.&lt;br /&gt;
[[File:ER diagram.png|center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Relevant Tables===&lt;br /&gt;
[[File:User table.png|center]]&lt;br /&gt;
&lt;br /&gt;
[[File:Screen Shot 2018-11-20 at 11.42.06 PM.png|center]]&lt;br /&gt;
&lt;br /&gt;
==Test Plan: ==&lt;br /&gt;
We plan to two types of testing &lt;br /&gt;
=== UI Tests ===&lt;br /&gt;
====Search for User====&lt;br /&gt;
Setup: create a user with name=&amp;quot;student&amp;quot; and userId=&amp;quot;5000&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Action: Instructor clicks on manage - &amp;gt; users -&amp;gt; in textbox enters name=&amp;quot;student&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
Response: Relevant details of student, name=&amp;quot;student&amp;quot; is displayed&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Action: Instructor clicks on manage - &amp;gt; users -&amp;gt; advanced search-&amp;gt;clicks on checkbox student id and enters &amp;quot;5000&amp;quot; and click &amp;quot;ok&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
Response: Relevant details of student, name=&amp;quot;student&amp;quot; is displayed&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Search for Assignments====&lt;br /&gt;
Setup create an assignment with name=&amp;quot;assignment&amp;quot; and set a due date&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Action : Instructor clicks on Manage -&amp;gt; Assignments, in textbox enter &amp;quot;assignment&amp;quot; in relevant tab&amp;lt;br&amp;gt; &lt;br /&gt;
Response : Relevant assignment should be displayed&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Action : Instructor clicks on Manage -&amp;gt; Assignments-&amp;gt; drop down and apply filters for due date and enter date and click &amp;quot;ok&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
Response : Relevant assignments should be displayed&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Search for Questionnaires====&lt;br /&gt;
Setup : Create a Questionnaire, add questions to it&amp;lt;br&amp;gt;&lt;br /&gt;
Action : Log in as instructor,  Manage -&amp;gt; Questionnaires, in text box enter text&amp;lt;br&amp;gt;&lt;br /&gt;
Response : Questionnaires matching text are shown&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Action : Log in as instructor,  Manage -&amp;gt; Questionnaires, click advanced search and check creation date and enter value&amp;lt;br&amp;gt;&lt;br /&gt;
Response : Questionnaires matching text are shown&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Search for Reviews====&lt;br /&gt;
Setup : Setup review for an assignment, login as student and then add review &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Action : Log in as instructor, Manage -&amp;gt; Assignments, Click on Review Report icon on corresponding assignment&amp;lt;br&amp;gt;&lt;br /&gt;
Result : Review should be seen&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Action : Click Advanced search, check review by text  and enter text&amp;lt;br&amp;gt;  &lt;br /&gt;
Result : Matching review should be visible&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Automated Tests ===&lt;br /&gt;
Automated tests in RSpec will be added as we implement the search functionality for each Model &amp;lt;br&amp;gt;&lt;br /&gt;
Most tests added will be unit tests that cover the test cases for each flow and changes in the model.&amp;lt;br&amp;gt;&lt;br /&gt;
Test Details &lt;br /&gt;
* User Model ( spec/models/user_spec.rb )&lt;br /&gt;
# Search by user name&lt;br /&gt;
# Search by user name that does not exist&lt;br /&gt;
# Search by user email&lt;br /&gt;
# Search by user email that does not exist&lt;br /&gt;
# Search by user email containing a substring&lt;br /&gt;
# Search by user full name&lt;br /&gt;
# Search by user full name is empty&lt;br /&gt;
# Search by user name and email&lt;/div&gt;</summary>
		<author><name>Onkashid</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1987._Improving_search_facility_in_Expertiza&amp;diff=128350</id>
		<title>CSC/ECE 517 Fall 2019 - E1987. Improving search facility in Expertiza</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1987._Improving_search_facility_in_Expertiza&amp;diff=128350"/>
		<updated>2019-11-11T01:11:52Z</updated>

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

		<summary type="html">&lt;p&gt;Onkashid: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Onkashid</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Downlo6564a.png&amp;diff=127806</id>
		<title>File:Downlo6564a.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Downlo6564a.png&amp;diff=127806"/>
		<updated>2019-11-07T02:29:19Z</updated>

		<summary type="html">&lt;p&gt;Onkashid: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Onkashid</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1942._Refactor_stage_deadlines_in_assignment.rb&amp;diff=127491</id>
		<title>CSC/ECE 517 Fall 2019 - E1942. Refactor stage deadlines in assignment.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1942._Refactor_stage_deadlines_in_assignment.rb&amp;diff=127491"/>
		<updated>2019-11-06T23:04:34Z</updated>

		<summary type="html">&lt;p&gt;Onkashid: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Expertiza Background''' ==&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an assignment portal developed by faculties and students at NCSU. It provides a platform for the faculties to create assignments for the students. Faculties can assign assignments with staged deadlines. Expertiza supports creation of teams for the students, tracking the team members and  reviewing the work done by the other team members. Students can also review their peer team's assignment submission. Expertiza has been developed on Ruby on Rails and is available on github.&lt;br /&gt;
&lt;br /&gt;
== '''Project Description''' ==&lt;br /&gt;
Following is an OSS project which deals with refactoring of stage deadlines in the assignment.rb file. An assignment can have incremental deadlines for different topics in a single assignment. This project involves refactoring the functions in the assignment.rb file related to stage deadlines. There existed five functions to check the kind of stage an assignment is in. However, the names of these functions were ambiguous and functionalities implemented in some of them overlapped with each other. By the end of this project we have refactored these deadline functions.&lt;br /&gt;
&lt;br /&gt;
== '''Important Links''' ==&lt;br /&gt;
1. [https://152.46.19.152:8080\ VCL Link for expertiza deployed with changes] &amp;lt;br&amp;gt;&lt;br /&gt;
2. [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2019_-_E1942._Refactor_stage_deadlines_in_assignment.rb\ OSS documentation] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Current Scenario''' ==&lt;br /&gt;
The assignment.rb file has the following functions implemented :&amp;lt;br&amp;gt;&lt;br /&gt;
1. current_stage_name(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
2. find_current_stage(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
3. get_current_stage(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
4. link_for_current_stage(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
5. stage_deadline(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Refractors implemented''' ==&lt;br /&gt;
The following is the list of refractors done in the code. It discusses the issues we found in the code with respect to Ruby conventions and the solutions that we provided for the same.&lt;br /&gt;
&lt;br /&gt;
==='''1.To avoid multiple calls to DueDate.get_next_due_date()'''===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h4&amp;gt;Problem with Existing code&amp;lt;/h4&amp;gt;&lt;br /&gt;
	In the existing code, DueDate.get_next_due_date(self.id, topic_id) has been called at numerous places. This does not follow the ruby coding standards.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h4&amp;gt;Solution&amp;lt;/h4&amp;gt;&lt;br /&gt;
	New private method next_due_date(topic_id) has been added. This function returns the next_due_date by calling the get_next_due_date method on DueDate.&lt;br /&gt;
&lt;br /&gt;
File: app/models/assignment.rb &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;h4&amp;gt;Code snippet&amp;lt;/h4&amp;gt;&lt;br /&gt;
 def next_due_date(topic_id = nil)&lt;br /&gt;
  DueDate.get_next_due_date(self.id, topic_id)&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Following places have been refactored.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h4&amp;gt;Screenshots&amp;lt;/h4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''2.To not have finished status checked with static string “Finished”'''===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h4&amp;gt;Problem with Existing code&amp;lt;/h4&amp;gt;&lt;br /&gt;
	The above methods have been used at various places to check finish status of assignment by comparing with “Finished”. This does not follow ruby coding standards, as we should never compare with static things. Otherwise it becomes difficult to refactor the code later.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h4&amp;gt;Solution&amp;lt;/h4&amp;gt;&lt;br /&gt;
	Assignment is said to be finished if the next due is nil. A new private method finished? has been added. It calls the above next_due_date method and returns true if the next_due_date is nil.&lt;br /&gt;
&lt;br /&gt;
File: app/models/assignment.rb&lt;br /&gt;
&amp;lt;h4&amp;gt;Code&amp;lt;/h4&amp;gt;&lt;br /&gt;
 def finished?( topic_id = nil )&lt;br /&gt;
  next_due_date(topic_id).nil?&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
The check with “Finished” has been replaces with a call to finished? . The code has been refactored at following places.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h4&amp;gt;Screenshots&amp;lt;/h4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''3.Return “Unknown” when topic_id is missing'''===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h4&amp;gt;Problem with existing code:&amp;lt;/h4&amp;gt;&lt;br /&gt;
	When it is staggered deadline and the topic_id is nil, “Unknown” is returned. This does not follow the DRY Principle. Never should we compare with static strings.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h4&amp;gt;Solution&amp;lt;/h4&amp;gt;&lt;br /&gt;
	To make the code more readable and understandable, and to DRY out the code we have added a new private method topic_missing? to check if the topic is missing in case of staggered deadline.  &lt;br /&gt;
&lt;br /&gt;
File:app/models/assignment.rb &lt;br /&gt;
&amp;lt;h4&amp;gt;Code snippet&amp;lt;/h4&amp;gt;&lt;br /&gt;
 def topic_missing?( topic_id = nil)&lt;br /&gt;
  topic_id.nil? and self.staggered_deadline?&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
The code has been refactored at following places:&lt;br /&gt;
&amp;lt;h4&amp;gt;Screenshots&amp;lt;/h4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''4.find_current_stage method removed'''===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h4&amp;gt;Problem with the existing code:&amp;lt;/h4&amp;gt;&lt;br /&gt;
	The method find_current_stage has been used locally in assignment.rb and once in students controller. However internally, this method calls the next_due_date method for the assignment which has already been separated out.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h4&amp;gt;Solution&amp;lt;/h4&amp;gt;&lt;br /&gt;
	The method find_current_stage has been removed. The places where it was called has been replaced by a call to next_due_date method. &lt;br /&gt;
&lt;br /&gt;
File: app/models/assignment.rb , app/controllers/student_controller.rb&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h4&amp;gt;Code snippet&amp;lt;/h4&amp;gt;&lt;br /&gt;
 Before:&lt;br /&gt;
  due_date = find_current_stage(topic_id)&lt;br /&gt;
 &lt;br /&gt;
 After:&lt;br /&gt;
  due_date = DueDate.get_next_due_date(self.id.topic_id)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The code has been refactored in assignments.rb and the students controller at following places:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h4&amp;gt;Screenshots&amp;lt;/h4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''5.link_for_current_stage method removed'''===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h4&amp;gt;Problem with existing code&amp;lt;/h4&amp;gt;&lt;br /&gt;
	The method link_for_current_stage was called once in list.html.erb. This method checks if the current assignment has any URL specified with it and would return it if present. However, the database has no such value. As a result, the if condition where the function was called always evaluated to false. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;h4&amp;gt;Solution&amp;lt;/h4&amp;gt;&lt;br /&gt;
	The function link_for_current_stage has been removed. The call to this function has also been removed and the code has been refactored accordingly.&lt;br /&gt;
&lt;br /&gt;
File: app/models/assignment.rb , app/views/list.html.erb&lt;br /&gt;
&lt;br /&gt;
The code in list.html.erb has been refactored as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h4&amp;gt;Screenshots&amp;lt;/h4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Automated Testing using RSPEC''' ==&lt;br /&gt;
&lt;br /&gt;
==='''Tests for get_current_stage()'''===&lt;br /&gt;
&lt;br /&gt;
The current stage of expertiza did not have any tests for get_current_stage. We have added the test for the same as follows:&lt;br /&gt;
&lt;br /&gt;
File: spec/models/assignment_spec.rb&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;h4&amp;gt;Code snippet&amp;lt;/h4&amp;gt;&lt;br /&gt;
 describe '#get_current_stage ' do&lt;br /&gt;
    context 'when topic id is nil and current assignment has staggered deadline' do&lt;br /&gt;
      it 'returns Unknown' do&lt;br /&gt;
        allow(assignment).to receive(:topic_missing?).and_return(true)&lt;br /&gt;
        expect(assignment.get_current_stage).to eq('Unknown')&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    context 'when current assignment does not have staggered deadline' do&lt;br /&gt;
      context 'when due date is nil' do&lt;br /&gt;
        it 'returns Finished' do&lt;br /&gt;
          allow(assignment).to receive(:finished?).with(123).and_return(true)&lt;br /&gt;
          expect(assignment.get_current_stage (123)).to eq('Finished')&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      context 'when due date is not nil and due date is not equal to Finished' do&lt;br /&gt;
        it 'returns current stage name' do&lt;br /&gt;
          allow(assignment).to receive(:finished?).with(123).and_return(false)&lt;br /&gt;
          allow(assignment).to receive(:topic_missing?).with(123).and_return(false)&lt;br /&gt;
          allow(assignment).to receive(:next_due_date).with(123).and_return(assignment_due_date)&lt;br /&gt;
          deadline = create(:deadline_type, id: 1, name:&amp;quot;Review&amp;quot;)&lt;br /&gt;
          allow(DeadlineType).to receive(:find).with(1).and_return(deadline)&lt;br /&gt;
          expect(assignment.get_current_stage(123)).to eq('Review')&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''Tests for finished?'''===&lt;br /&gt;
&lt;br /&gt;
Tests for new finished? function have been added.&amp;lt;br&amp;gt;&lt;br /&gt;
File: spec/models/assignment_spec.rb&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;h4&amp;gt;Code snippet&amp;lt;/h4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 describe '#finished?' do&lt;br /&gt;
    context 'when assignment next due date is nil' do&lt;br /&gt;
      it 'returns True' do&lt;br /&gt;
        allow(DueDate).to receive(:get_next_due_date).with(1, 123).and_return(nil)&lt;br /&gt;
        expect(assignment.finished?(123)).to eq(true)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#finished?' do&lt;br /&gt;
    context 'when there is a next due date' do&lt;br /&gt;
      it 'returns False' do&lt;br /&gt;
        allow(DueDate).to receive(:get_next_due_date).with(1,123).and_return('2021-11-11 11:11:11')&lt;br /&gt;
        expect(assignment.finished?(123)).to eq(false)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
topic_missing method is a private method and hence no tests have been added for the same.&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
[mailto:onkashid@ncsu.edu Omkar Kashid]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:drao@ncsu.edu Deeksha Rao]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:sdinaka@ncsu.edu Swathi Dinakar]&lt;/div&gt;</summary>
		<author><name>Onkashid</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1942._Refactor_stage_deadlines_in_assignment.rb&amp;diff=127476</id>
		<title>CSC/ECE 517 Fall 2019 - E1942. Refactor stage deadlines in assignment.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1942._Refactor_stage_deadlines_in_assignment.rb&amp;diff=127476"/>
		<updated>2019-11-06T22:54:25Z</updated>

		<summary type="html">&lt;p&gt;Onkashid: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Expertiza Background''' ==&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an assignment portal developed by faculties and students at NCSU. It provides a platform for the faculties to create assignments for the students. Faculties can assign assignments with staged deadlines. Expertiza supports creation of teams for the students, tracking the team members and  reviewing the work done by the other team members. Students can also review their peer team's assignment submission. Expertiza has been developed on Ruby on Rails and is available on github.&lt;br /&gt;
&lt;br /&gt;
== '''Project Description''' ==&lt;br /&gt;
Following is an OSS project which deals with refactoring of stage deadlines in the assignment.rb file. An assignment can have incremental deadlines for different topics in a single assignment. This project involves refactoring the functions in the assignment.rb file related to stage deadlines. There existed five functions to check the kind of stage an assignment is in. However, the names of these functions were ambiguous and functionalities implemented in some of them overlapped with each other. By the end of this project we have refactored these deadline functions.&lt;br /&gt;
&lt;br /&gt;
== '''Important Links''' ==&lt;br /&gt;
1. [https://152.46.19.152:8080\ VCL Link for expertiza deployed with changes] &amp;lt;br&amp;gt;&lt;br /&gt;
2. [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2019_-_E1942._Refactor_stage_deadlines_in_assignment.rb\ OSS documentation] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Current Scenario''' ==&lt;br /&gt;
The assignment.rb file has the following functions implemented :&amp;lt;br&amp;gt;&lt;br /&gt;
1. current_stage_name(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
2. find_current_stage(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
3. get_current_stage(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
4. link_for_current_stage(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
5. stage_deadline(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Refractors implemented''' ==&lt;br /&gt;
We found the following issues with the code with respect to Ruby conventions :&lt;br /&gt;
&lt;br /&gt;
===''' To avoid multiple calls to DueDate.get_next_due_date()'''===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h4&amp;gt;Problem with Existing code&amp;lt;/h4&amp;gt;&lt;br /&gt;
	In the existing code, DueDate.get_next_due_date(self.id, topic_id) has been called at numerous places. This does not follow the ruby coding standards.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h4&amp;gt;Solution&amp;lt;/h4&amp;gt;&lt;br /&gt;
	New private method next_due_date(topic_id) has been added. This function returns the next_due_date by calling the get_next_due_date method on DueDate.&lt;br /&gt;
&lt;br /&gt;
File: app/models/assignment.rb &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;h4&amp;gt;Code snippet&amp;lt;/h4&amp;gt;&lt;br /&gt;
 def next_due_date(topic_id = nil)&lt;br /&gt;
  DueDate.get_next_due_date(self.id, topic_id)&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Following places have been refactored.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h4&amp;gt;Screenshots&amp;lt;/h4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''To not have finished status checked with static string “Finished”'''===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h4&amp;gt;Problem with Existing code&amp;lt;/h4&amp;gt;&lt;br /&gt;
	The above methods have been used at various places to check finish status of assignment by comparing with “Finished”. This does not follow ruby coding standards, as we should never compare with static things. Otherwise it becomes difficult to refactor the code later.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h4&amp;gt;Solution&amp;lt;/h4&amp;gt;&lt;br /&gt;
	Assignment is said to be finished if the next due is nil. A new private method finished? has been added. It calls the above next_due_date method and returns true if the next_due_date is nil.&lt;br /&gt;
&lt;br /&gt;
File: app/models/assignment.rb&lt;br /&gt;
&amp;lt;h4&amp;gt;Code&amp;lt;/h4&amp;gt;&lt;br /&gt;
 def finished?( topic_id = nil )&lt;br /&gt;
  next_due_date(topic_id).nil?&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
The check with “Finished” has been replaces with a call to finished? . The code has been refactored at following places.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h4&amp;gt;Screenshots&amp;lt;/h4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''Return “Unknown” when topic_id is missing'''===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h4&amp;gt;Problem with existing code:&amp;lt;/h4&amp;gt;&lt;br /&gt;
	When it is staggered deadline and the topic_id is nil, “Unknown” is returned. This does not follow the DRY Principle. Never should we compare with static strings.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h4&amp;gt;Solution&amp;lt;/h4&amp;gt;&lt;br /&gt;
	To make the code more readable and understandable, and to DRY out the code we have added a new private method topic_missing? to check if the topic is missing in case of staggered deadline.  &lt;br /&gt;
&lt;br /&gt;
File:app/models/assignment.rb &lt;br /&gt;
&amp;lt;h4&amp;gt;Code snippet&amp;lt;/h4&amp;gt;&lt;br /&gt;
 def topic_missing?( topic_id = nil)&lt;br /&gt;
  topic_id.nil? and self.staggered_deadline?&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
The code has been refactored at following places:&lt;br /&gt;
&amp;lt;h4&amp;gt;Screenshots&amp;lt;/h4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''find_current_stage method removed'''===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h4&amp;gt;Problem with the existing code:&amp;lt;/h4&amp;gt;&lt;br /&gt;
	The method find_current_stage has been used locally in assignment.rb and once in students controller. However internally, this method calls the next_due_date method for the assignment which has already been separated out.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h4&amp;gt;Solution&amp;lt;/h4&amp;gt;&lt;br /&gt;
	The method find_current_stage has been removed. The places where it was called has been replaced by a call to next_due_date method. &lt;br /&gt;
&lt;br /&gt;
File: app/models/assignment.rb , app/controllers/student_controller.rb&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h4&amp;gt;Code snippet&amp;lt;/h4&amp;gt;&lt;br /&gt;
 Before:&lt;br /&gt;
  due_date = find_current_stage(topic_id)&lt;br /&gt;
 &lt;br /&gt;
 After:&lt;br /&gt;
  due_date = DueDate.get_next_due_date(self.id.topic_id)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The code has been refactored in assignments.rb and the students controller at following places:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h4&amp;gt;Screenshots&amp;lt;/h4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''link_for_current_stage method removed'''===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h4&amp;gt;Problem with existing code&amp;lt;/h4&amp;gt;&lt;br /&gt;
	The method link_for_current_stage was called once in list.html.erb. This method checks if the current assignment has any URL specified with it and would return it if present. However, the database has no such value. As a result, the if condition where the function was called always evaluated to false. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;h4&amp;gt;Solution&amp;lt;/h4&amp;gt;&lt;br /&gt;
	The function link_for_current_stage has been removed. The call to this function has also been removed and the code has been refactored accordingly.&lt;br /&gt;
&lt;br /&gt;
File: app/models/assignment.rb , app/views/list.html.erb&lt;br /&gt;
&lt;br /&gt;
The code in list.html.erb has been refactored as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h4&amp;gt;Screenshots&amp;lt;/h4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Automated Testing using RSPEC''' ==&lt;br /&gt;
&lt;br /&gt;
==='''Tests for get_current_stage()'''===&lt;br /&gt;
&lt;br /&gt;
The current stage of expertiza did not have any tests for get_current_stage. We have added the test for the same as follows:&lt;br /&gt;
&lt;br /&gt;
File: spec/models/assignment_spec.rb&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;h4&amp;gt;Code snippet&amp;lt;/h4&amp;gt;&lt;br /&gt;
 describe '#get_current_stage ' do&lt;br /&gt;
    context 'when topic id is nil and current assignment has staggered deadline' do&lt;br /&gt;
      it 'returns Unknown' do&lt;br /&gt;
        allow(assignment).to receive(:topic_missing?).and_return(true)&lt;br /&gt;
        expect(assignment.get_current_stage).to eq('Unknown')&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    context 'when current assignment does not have staggered deadline' do&lt;br /&gt;
      context 'when due date is nil' do&lt;br /&gt;
        it 'returns Finished' do&lt;br /&gt;
          allow(assignment).to receive(:finished?).with(123).and_return(true)&lt;br /&gt;
          expect(assignment.get_current_stage (123)).to eq('Finished')&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      context 'when due date is not nil and due date is not equal to Finished' do&lt;br /&gt;
        it 'returns current stage name' do&lt;br /&gt;
          allow(assignment).to receive(:finished?).with(123).and_return(false)&lt;br /&gt;
          allow(assignment).to receive(:topic_missing?).with(123).and_return(false)&lt;br /&gt;
          allow(assignment).to receive(:next_due_date).with(123).and_return(assignment_due_date)&lt;br /&gt;
          deadline = create(:deadline_type, id: 1, name:&amp;quot;Review&amp;quot;)&lt;br /&gt;
          allow(DeadlineType).to receive(:find).with(1).and_return(deadline)&lt;br /&gt;
          expect(assignment.get_current_stage(123)).to eq('Review')&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''Tests for finished?'''===&lt;br /&gt;
&lt;br /&gt;
Tests for new finished? function have been added.&amp;lt;br&amp;gt;&lt;br /&gt;
File: spec/models/assignment_spec.rb&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;h4&amp;gt;Code snippet&amp;lt;/h4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 describe '#finished?' do&lt;br /&gt;
    context 'when assignment next due date is nil' do&lt;br /&gt;
      it 'returns True' do&lt;br /&gt;
        allow(DueDate).to receive(:get_next_due_date).with(1, 123).and_return(nil)&lt;br /&gt;
        expect(assignment.finished?(123)).to eq(true)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#finished?' do&lt;br /&gt;
    context 'when there is a next due date' do&lt;br /&gt;
      it 'returns False' do&lt;br /&gt;
        allow(DueDate).to receive(:get_next_due_date).with(1,123).and_return('2021-11-11 11:11:11')&lt;br /&gt;
        expect(assignment.finished?(123)).to eq(false)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
topic_missing method is a private method and hence no tests have been added for the same.&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
[mailto:onkashid@ncsu.edu Omkar Kashid]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:drao@ncsu.edu Deeksha Rao]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:sdinaka@ncsu.edu Swathi Dinakar]&lt;/div&gt;</summary>
		<author><name>Onkashid</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1942._Refactor_stage_deadlines_in_assignment.rb&amp;diff=127426</id>
		<title>CSC/ECE 517 Fall 2019 - E1942. Refactor stage deadlines in assignment.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1942._Refactor_stage_deadlines_in_assignment.rb&amp;diff=127426"/>
		<updated>2019-11-06T21:53:03Z</updated>

		<summary type="html">&lt;p&gt;Onkashid: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Expertiza Background''' ==&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an assignment portal developed by faculties and students at NCSU. It provides a platform for the faculties to create assignments for students. Faculties can have assignments with staged deadlines. Expertiza has support to create teams for students, track the team members and provide review for the work done by team members. Students can also provide reviews for peer team's assignment submission. Expertiza has been developed on Ruby on Rails and is available on github.&lt;br /&gt;
&lt;br /&gt;
== '''Problem Description''' ==&lt;br /&gt;
Following is an OSS project which deals with refactoring of stage deadlines in assignment.rb file. An assignment can have incremental deadlines for different topics in a single assignment. This project involves refactoring the functions in assignment.rb file related to stage deadlines. There were five functions to check what kind of stage an assignment is in. However, the names of these functions were ambiguous and functionalities implemented in some of them overlapped with each other. By the end of this project we have refactored these deadline functions.&lt;br /&gt;
&lt;br /&gt;
== '''Important Links''' ==&lt;br /&gt;
1. [https://152.46.19.152:8080\ VCL Link for expertiza deployed with changes] &amp;lt;br&amp;gt;&lt;br /&gt;
2. [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2019_-_E1942._Refactor_stage_deadlines_in_assignment.rb\ OSS documentation] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Current Scenario''' ==&lt;br /&gt;
The assignment.rb file has the following functions implemented :&amp;lt;br&amp;gt;&lt;br /&gt;
1. current_stage_name(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
2. find_current_stage(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
3. get_current_stage(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
4. link_for_current_stage(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
5. stage_deadline(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Solution Provided''' ==&lt;br /&gt;
We have found the following issues with the code with respect to Ruby conventions :&lt;br /&gt;
&lt;br /&gt;
==='''Multiple calls to DueDate.get_next_due_date()'''===&lt;br /&gt;
&lt;br /&gt;
Problem with Existing code:&amp;lt;br&amp;gt;&lt;br /&gt;
	In the existing code, DueDate.get_next_due_date(self.id, topic_id) has been called at numerous places. This does not follow the ruby coding standards.&lt;br /&gt;
&lt;br /&gt;
Solution:&amp;lt;br&amp;gt;&lt;br /&gt;
	New private method next_due_date(topic_id) has been added. This function returns the next_due_date by calling the get_next_due_date method on DueDate.&lt;br /&gt;
&lt;br /&gt;
File: app/models/assignment.rb &amp;lt;br&amp;gt;&lt;br /&gt;
Code:&lt;br /&gt;
 def next_due_date(topic_id = nil)&lt;br /&gt;
  DueDate.get_next_due_date(self.id, topic_id)&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Following places have been refactored.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Screenshots.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''Checking finished status with static string “Finished”'''===&lt;br /&gt;
&lt;br /&gt;
Problem with Existing code:&amp;lt;br&amp;gt;&lt;br /&gt;
	The above methods have been used at various places to check finish status of assignment by comparing with “Finished”. This does not follow ruby coding standards, as we should never compare with static things. Otherwise it becomes difficult to refactor the code later.&lt;br /&gt;
&lt;br /&gt;
Solution:&amp;lt;br&amp;gt;&lt;br /&gt;
	Assignment is said to be finished if the next due is nil. A new private method finished? has been added. It calls the above next_due_date method and returns true if the next_due_date is nil.&lt;br /&gt;
&lt;br /&gt;
File: app/models/assignment.rb&lt;br /&gt;
Code:&lt;br /&gt;
 def finished?( topic_id = nil )&lt;br /&gt;
  next_due_date(topic_id).nil?&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
The check with “Finished” has been replaces with a call to finished? . The code has been refactored at following places.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Screenshots.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''Return “Unknown” when topic_id is missing'''===&lt;br /&gt;
&lt;br /&gt;
Problem with existing code:&amp;lt;br&amp;gt;&lt;br /&gt;
	When it is staggered deadline and the topic_id is nil, “Unknown” is returned. This does not follow the DRY Principle. Never should we compare with static strings.&lt;br /&gt;
&lt;br /&gt;
Solution:&amp;lt;br&amp;gt;&lt;br /&gt;
	To make the code more readable and understandable, and to DRY out the code we have added a new private method topic_missing? to check if the topic is missing in case of staggered deadline.  &lt;br /&gt;
&lt;br /&gt;
File:app/models/assignment.rb &amp;lt;br&amp;gt;&lt;br /&gt;
Code:&lt;br /&gt;
 def topic_missing?( topic_id = nil)&lt;br /&gt;
  topic_id.nil? and self.staggered_deadline?&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
The code has been refactored at following places:&amp;lt;br&amp;gt;&lt;br /&gt;
#TODO&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''find_current_stage method removed'''===&lt;br /&gt;
&lt;br /&gt;
Problem with the existing code:&amp;lt;br&amp;gt;&lt;br /&gt;
	The method find_current_stage has been used locally in assignment.rb and once in students controller. However internally, this method calls the next_due_date method for the assignment which has already been separated out.&lt;br /&gt;
&lt;br /&gt;
Solution:&amp;lt;br&amp;gt;&lt;br /&gt;
	The method find_current_stage has been removed. The places where it was called has been replaced by a call to next_due_date method. &lt;br /&gt;
&lt;br /&gt;
File: app/models/assignment.rb , app/controllers/student_controller.rb&lt;br /&gt;
&lt;br /&gt;
Code:&lt;br /&gt;
 Before:&lt;br /&gt;
  due_date = find_current_stage(topic_id)&lt;br /&gt;
 &lt;br /&gt;
 After:&lt;br /&gt;
  due_date = DueDate.get_next_due_date(self.id.topic_id)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The code has been refactored in assignments.rb and the students controller at following places:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#TODO&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''link_for_current_stage method removed'''===&lt;br /&gt;
&lt;br /&gt;
Problem with existing code:&amp;lt;br&amp;gt;&lt;br /&gt;
	The method link_for_current_stage was called once in list.html.erb. This method checks if the current assignment has any URL specified with it and would return it if present. However, the database has no such value. As a result, the if condition where the function was called always evaluated to false. &lt;br /&gt;
&lt;br /&gt;
Solution:&amp;lt;br&amp;gt;&lt;br /&gt;
	The function link_for_current_stage has been removed. The call to this function has also been removed and the code has been refactored accordingly.&lt;br /&gt;
&lt;br /&gt;
File: app/models/assignment.rb , app/views/list.html.erb&lt;br /&gt;
&lt;br /&gt;
The code in list.html.erb has been refactored as follows:&lt;br /&gt;
&lt;br /&gt;
#TODO&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Automated Testing using RSPEC''' ==&lt;br /&gt;
&lt;br /&gt;
==='''Tests for get_current_stage()'''===&lt;br /&gt;
&lt;br /&gt;
The current stage of expertiza did not have any tests for get_current_stage. We have added the test for the same as follows:&lt;br /&gt;
&lt;br /&gt;
File: spec/models/assignment_spec.rb&amp;lt;br&amp;gt;&lt;br /&gt;
Code:&lt;br /&gt;
 describe '#get_current_stage ' do&lt;br /&gt;
    context 'when topic id is nil and current assignment has staggered deadline' do&lt;br /&gt;
      it 'returns Unknown' do&lt;br /&gt;
        allow(assignment).to receive(:topic_missing?).and_return(true)&lt;br /&gt;
        expect(assignment.get_current_stage).to eq('Unknown')&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    context 'when current assignment does not have staggered deadline' do&lt;br /&gt;
      context 'when due date is nil' do&lt;br /&gt;
        it 'returns Finished' do&lt;br /&gt;
          allow(assignment).to receive(:finished?).with(123).and_return(true)&lt;br /&gt;
          expect(assignment.get_current_stage (123)).to eq('Finished')&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      context 'when due date is not nil and due date is not equal to Finished' do&lt;br /&gt;
        it 'returns current stage name' do&lt;br /&gt;
          allow(assignment).to receive(:finished?).with(123).and_return(false)&lt;br /&gt;
          allow(assignment).to receive(:topic_missing?).with(123).and_return(false)&lt;br /&gt;
          allow(assignment).to receive(:next_due_date).with(123).and_return(assignment_due_date)&lt;br /&gt;
          deadline = create(:deadline_type, id: 1, name:&amp;quot;Review&amp;quot;)&lt;br /&gt;
          allow(DeadlineType).to receive(:find).with(1).and_return(deadline)&lt;br /&gt;
          expect(assignment.get_current_stage(123)).to eq('Review')&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''Tests for finished?'''===&lt;br /&gt;
&lt;br /&gt;
Tests for new finished? function have been added.&amp;lt;br&amp;gt;&lt;br /&gt;
File: spec/models/assignment_spec.rb&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 describe '#finished?' do&lt;br /&gt;
    context 'when assignment next due date is nil' do&lt;br /&gt;
      it 'returns True' do&lt;br /&gt;
        allow(DueDate).to receive(:get_next_due_date).with(1, 123).and_return(nil)&lt;br /&gt;
        expect(assignment.finished?(123)).to eq(true)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#finished?' do&lt;br /&gt;
    context 'when there is a next due date' do&lt;br /&gt;
      it 'returns False' do&lt;br /&gt;
        allow(DueDate).to receive(:get_next_due_date).with(1,123).and_return('2021-11-11 11:11:11')&lt;br /&gt;
        expect(assignment.finished?(123)).to eq(false)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
topic_missing method is a private method and hence no tests have been added for the same.&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
[mailto:onkashid@ncsu.edu Omkar Kashid]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:drao@ncsu.edu Deeksha Rao]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:sdinaka@ncsu.edu Swathi Dinakar]&lt;/div&gt;</summary>
		<author><name>Onkashid</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1942._Refactor_stage_deadlines_in_assignment.rb&amp;diff=127425</id>
		<title>CSC/ECE 517 Fall 2019 - E1942. Refactor stage deadlines in assignment.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1942._Refactor_stage_deadlines_in_assignment.rb&amp;diff=127425"/>
		<updated>2019-11-06T21:52:31Z</updated>

		<summary type="html">&lt;p&gt;Onkashid: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Expertiza Background''' ==&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an assignment portal developed by faculties and students at NCSU. It provides a platform for the faculties to create assignments for students. Faculties can have assignments with staged deadlines. Expertiza has support to create teams for students, track the team members and provide review for the work done by team members. Students can also provide reviews for peer team's assignment submission. Expertiza has been developed on Ruby on Rails and is available on github.&lt;br /&gt;
&lt;br /&gt;
== '''Problem Description''' ==&lt;br /&gt;
Following is an OSS project which deals with refactoring of stage deadlines in assignment.rb file. An assignment can have incremental deadlines for different topics in a single assignment. This project involves refactoring the functions in assignment.rb file related to stage deadlines. There were five functions to check what kind of stage an assignment is in. However, the names of these functions were ambiguous and functionalities implemented in some of them overlapped with each other. By the end of this project we have refactored these deadline functions.&lt;br /&gt;
&lt;br /&gt;
== '''Important Links''' ==&lt;br /&gt;
1. [https://152.46.19.152:8080\ VCL Link for expertiza deployed with changes] &amp;lt;br&amp;gt;&lt;br /&gt;
2. [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2019_-_E1942._Refactor_stage_deadlines_in_assignment.rb\ OSS documentation] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Current Scenario''' ==&lt;br /&gt;
The assignment.rb file has the following functions implemented :&amp;lt;br&amp;gt;&lt;br /&gt;
1. current_stage_name(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
2. find_current_stage(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
3. get_current_stage(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
4. link_for_current_stage(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
5. stage_deadline(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Solution Provided''' ==&lt;br /&gt;
We have found the following issues with the code with respect to Ruby conventions :&lt;br /&gt;
&lt;br /&gt;
==='''Multiple calls to DueDate.get_next_due_date()'''===&lt;br /&gt;
&lt;br /&gt;
Problem with Existing code:&amp;lt;br&amp;gt;&lt;br /&gt;
	In the existing code, DueDate.get_next_due_date(self.id, topic_id) has been called at numerous places. This does not follow the ruby coding standards.&lt;br /&gt;
&lt;br /&gt;
Solution:&amp;lt;br&amp;gt;&lt;br /&gt;
	New private method next_due_date(topic_id) has been added. This function returns the next_due_date by calling the get_next_due_date method on DueDate.&lt;br /&gt;
&lt;br /&gt;
File: app/models/assignment.rb &amp;lt;br&amp;gt;&lt;br /&gt;
Code:&lt;br /&gt;
 def next_due_date(topic_id = nil)&lt;br /&gt;
  DueDate.get_next_due_date(self.id, topic_id)&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Following places have been refactored.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Screenshots.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''Checking finished status with static string “Finished”'''===&lt;br /&gt;
&lt;br /&gt;
Problem with Existing code:&amp;lt;br&amp;gt;&lt;br /&gt;
	The above methods have been used at various places to check finish status of assignment by comparing with “Finished”. This does not follow ruby coding standards, as we should never compare with static things. Otherwise it becomes difficult to refactor the code later.&lt;br /&gt;
&lt;br /&gt;
Solution:&amp;lt;br&amp;gt;&lt;br /&gt;
	Assignment is said to be finished if the next due is nil. A new private method finished? has been added. It calls the above next_due_date method and returns true if the next_due_date is nil.&lt;br /&gt;
&lt;br /&gt;
File: app/models/assignment.rb&lt;br /&gt;
Code:&lt;br /&gt;
 def finished?( topic_id = nil )&lt;br /&gt;
  next_due_date(topic_id).nil?&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
The check with “Finished” has been replaces with a call to finished? . The code has been refactored at following places.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Screenshots.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''Return “Unknown” when topic_id is missing'''===&lt;br /&gt;
&lt;br /&gt;
Problem with existing code:&amp;lt;br&amp;gt;&lt;br /&gt;
	When it is staggered deadline and the topic_id is nil, “Unknown” is returned. This does not follow the DRY Principle. Never should we compare with static strings.&lt;br /&gt;
&lt;br /&gt;
Solution:&amp;lt;br&amp;gt;&lt;br /&gt;
	To make the code more readable and understandable, and to DRY out the code we have added a new private method topic_missing? to check if the topic is missing in case of staggered deadline.  &lt;br /&gt;
&lt;br /&gt;
File:app/models/assignment.rb &amp;lt;br&amp;gt;&lt;br /&gt;
Code:&lt;br /&gt;
 def topic_missing?( topic_id = nil)&lt;br /&gt;
  topic_id.nil? and self.staggered_deadline?&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
The code has been refactored at following places:&amp;lt;br&amp;gt;&lt;br /&gt;
#TODO&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''find_current_stage method removed'''===&lt;br /&gt;
&lt;br /&gt;
Problem with the existing code:&amp;lt;br&amp;gt;&lt;br /&gt;
	The method find_current_stage has been used locally in assignment.rb and once in students controller. However internally, this method calls the next_due_date method for the assignment which has already been separated out.&lt;br /&gt;
&lt;br /&gt;
Solution:&amp;lt;br&amp;gt;&lt;br /&gt;
	The method find_current_stage has been removed. The places where it was called has been replaced by a call to next_due_date method. &lt;br /&gt;
&lt;br /&gt;
File: app/models/assignment.rb , app/controllers/student_controller.rb&lt;br /&gt;
&lt;br /&gt;
Code:&lt;br /&gt;
 Before:&lt;br /&gt;
  due_date = find_current_stage(topic_id)&lt;br /&gt;
 &lt;br /&gt;
 After:&lt;br /&gt;
  due_date = DueDate.get_next_due_date(self.id.topic_id)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The code has been refactored in assignments.rb and the students controller at following places:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#TODO&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''link_for_current_stage method removed'''===&lt;br /&gt;
&lt;br /&gt;
Problem with existing code:&amp;lt;br&amp;gt;&lt;br /&gt;
	The method link_for_current_stage was called once in list.html.erb. This method checks if the current assignment has any URL specified with it and would return it if present. However, the database has no such value. As a result, the if condition where the function was called always evaluated to false. &lt;br /&gt;
&lt;br /&gt;
Solution:&amp;lt;br&amp;gt;&lt;br /&gt;
	The function link_for_current_stage has been removed. The call to this function has also been removed and the code has been refactored accordingly.&lt;br /&gt;
&lt;br /&gt;
File: app/models/assignment.rb , app/views/list.html.erb&lt;br /&gt;
&lt;br /&gt;
The code in list.html.erb has been refactored as follows:&lt;br /&gt;
&lt;br /&gt;
#TODO&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Automated Testing using RSPEC''' ==&lt;br /&gt;
&lt;br /&gt;
==='''Tests for get_current_stage()'''===&lt;br /&gt;
&lt;br /&gt;
The current stage of expertiza did not have any tests for get_current_stage. We have added the test for the same as follows:&lt;br /&gt;
&lt;br /&gt;
File: spec/models/assignment_spec.rb&amp;lt;br&amp;gt;&lt;br /&gt;
Code:&lt;br /&gt;
 describe '#get_current_stage ' do&lt;br /&gt;
    context 'when topic id is nil and current assignment has staggered deadline' do&lt;br /&gt;
      it 'returns Unknown' do&lt;br /&gt;
        allow(assignment).to receive(:topic_missing?).and_return(true)&lt;br /&gt;
        expect(assignment.get_current_stage).to eq('Unknown')&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    context 'when current assignment does not have staggered deadline' do&lt;br /&gt;
      context 'when due date is nil' do&lt;br /&gt;
        it 'returns Finished' do&lt;br /&gt;
          allow(assignment).to receive(:finished?).with(123).and_return(true)&lt;br /&gt;
          expect(assignment.get_current_stage (123)).to eq('Finished')&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      context 'when due date is not nil and due date is not equal to Finished' do&lt;br /&gt;
        it 'returns current stage name' do&lt;br /&gt;
          allow(assignment).to receive(:finished?).with(123).and_return(false)&lt;br /&gt;
          allow(assignment).to receive(:topic_missing?).with(123).and_return(false)&lt;br /&gt;
          allow(assignment).to receive(:next_due_date).with(123).and_return(assignment_due_date)&lt;br /&gt;
          deadline = create(:deadline_type, id: 1, name:&amp;quot;Review&amp;quot;)&lt;br /&gt;
          allow(DeadlineType).to receive(:find).with(1).and_return(deadline)&lt;br /&gt;
          expect(assignment.get_current_stage(123)).to eq('Review')&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''Tests for finished?'''====&lt;br /&gt;
&lt;br /&gt;
Tests for new finished? function have been added.&amp;lt;br&amp;gt;&lt;br /&gt;
File: spec/models/assignment_spec.rb&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 describe '#finished?' do&lt;br /&gt;
    context 'when assignment next due date is nil' do&lt;br /&gt;
      it 'returns True' do&lt;br /&gt;
        allow(DueDate).to receive(:get_next_due_date).with(1, 123).and_return(nil)&lt;br /&gt;
        expect(assignment.finished?(123)).to eq(true)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#finished?' do&lt;br /&gt;
    context 'when there is a next due date' do&lt;br /&gt;
      it 'returns False' do&lt;br /&gt;
        allow(DueDate).to receive(:get_next_due_date).with(1,123).and_return('2021-11-11 11:11:11')&lt;br /&gt;
        expect(assignment.finished?(123)).to eq(false)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
topic_missing method is a private method and hence no tests have been added for the same.&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
[mailto:onkashid@ncsu.edu Omkar Kashid]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:drao@ncsu.edu Deeksha Rao]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:sdinaka@ncsu.edu Swathi Dinakar]&lt;/div&gt;</summary>
		<author><name>Onkashid</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1942._Refactor_stage_deadlines_in_assignment.rb&amp;diff=127423</id>
		<title>CSC/ECE 517 Fall 2019 - E1942. Refactor stage deadlines in assignment.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1942._Refactor_stage_deadlines_in_assignment.rb&amp;diff=127423"/>
		<updated>2019-11-06T21:49:11Z</updated>

		<summary type="html">&lt;p&gt;Onkashid: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Expertiza Background''' ==&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an assignment portal developed by faculties and students at NCSU. It provides a platform for the faculties to create assignments for students. Faculties can have assignments with staged deadlines. Expertiza has support to create teams for students, track the team members and provide review for the work done by team members. Students can also provide reviews for peer team's assignment submission. Expertiza has been developed on Ruby on Rails and is available on github.&lt;br /&gt;
&lt;br /&gt;
== '''Problem Description''' ==&lt;br /&gt;
Following is an OSS project which deals with refactoring of stage deadlines in assignment.rb file. An assignment can have incremental deadlines for different topics in a single assignment. This project involves refactoring the functions in assignment.rb file related to stage deadlines. There were five functions to check what kind of stage an assignment is in. However, the names of these functions were ambiguous and functionalities implemented in some of them overlapped with each other. By the end of this project we have refactored these deadline functions.&lt;br /&gt;
&lt;br /&gt;
== '''Important Links''' ==&lt;br /&gt;
1. [https://152.46.19.152:8080\ VCL Link for expertiza deployed with changes] &amp;lt;br&amp;gt;&lt;br /&gt;
2. [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2019_-_E1942._Refactor_stage_deadlines_in_assignment.rb\ OSS documentation] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Current Scenario''' ==&lt;br /&gt;
The assignment.rb file has the following functions implemented :&amp;lt;br&amp;gt;&lt;br /&gt;
1. current_stage_name(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
2. find_current_stage(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
3. get_current_stage(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
4. link_for_current_stage(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
5. stage_deadline(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Solution Provided''' ==&lt;br /&gt;
We have found the following issues with the code with respect to Ruby conventions :&lt;br /&gt;
&lt;br /&gt;
==='''Multiple calls to DueDate.get_next_due_date()'''===&lt;br /&gt;
&lt;br /&gt;
Problem with Existing code:&amp;lt;br&amp;gt;&lt;br /&gt;
	In the existing code, DueDate.get_next_due_date(self.id, topic_id) has been called at numerous places. This does not follow the ruby coding standards.&lt;br /&gt;
&lt;br /&gt;
Solution:&amp;lt;br&amp;gt;&lt;br /&gt;
	New private method next_due_date(topic_id) has been added. This function returns the next_due_date by calling the get_next_due_date method on DueDate.&lt;br /&gt;
&lt;br /&gt;
File: app/models/assignment.rb &amp;lt;br&amp;gt;&lt;br /&gt;
Code:&lt;br /&gt;
 def next_due_date(topic_id = nil)&lt;br /&gt;
  DueDate.get_next_due_date(self.id, topic_id)&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Following places have been refactored.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Screenshots.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''Checking finished status with static string “Finished”'''===&lt;br /&gt;
&lt;br /&gt;
Problem with Existing code:&amp;lt;br&amp;gt;&lt;br /&gt;
	The above methods have been used at various places to check finish status of assignment by comparing with “Finished”. This does not follow ruby coding standards, as we should never compare with static things. Otherwise it becomes difficult to refactor the code later.&lt;br /&gt;
&lt;br /&gt;
Solution:&amp;lt;br&amp;gt;&lt;br /&gt;
	Assignment is said to be finished if the next due is nil. A new private method finished? has been added. It calls the above next_due_date method and returns true if the next_due_date is nil.&lt;br /&gt;
&lt;br /&gt;
File: app/models/assignment.rb&lt;br /&gt;
Code:&lt;br /&gt;
 def finished?( topic_id = nil )&lt;br /&gt;
  next_due_date(topic_id).nil?&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
The check with “Finished” has been replaces with a call to finished? . The code has been refactored at following places.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Screenshots.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''Return “Unknown” when topic_id is missing'''===&lt;br /&gt;
&lt;br /&gt;
Problem with existing code:&amp;lt;br&amp;gt;&lt;br /&gt;
	When it is staggered deadline and the topic_id is nil, “Unknown” is returned. This does not follow the DRY Principle. Never should we compare with static strings.&lt;br /&gt;
&lt;br /&gt;
Solution:&amp;lt;br&amp;gt;&lt;br /&gt;
	To make the code more readable and understandable, and to DRY out the code we have added a new private method topic_missing? to check if the topic is missing in case of staggered deadline.  &lt;br /&gt;
&lt;br /&gt;
File:app/models/assignment.rb &amp;lt;br&amp;gt;&lt;br /&gt;
Code:&lt;br /&gt;
 def topic_missing?( topic_id = nil)&lt;br /&gt;
  topic_id.nil? and self.staggered_deadline?&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
The code has been refactored at following places:&amp;lt;br&amp;gt;&lt;br /&gt;
#TODO&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''find_current_stage method removed'''===&lt;br /&gt;
&lt;br /&gt;
Problem with the existing code:&amp;lt;br&amp;gt;&lt;br /&gt;
	The method find_current_stage has been used locally in assignment.rb and once in students controller. However internally, this method calls the next_due_date method for the assignment which has already been separated out.&lt;br /&gt;
&lt;br /&gt;
Solution:&amp;lt;br&amp;gt;&lt;br /&gt;
	The method find_current_stage has been removed. The places where it was called has been replaced by a call to next_due_date method. &lt;br /&gt;
&lt;br /&gt;
File: app/models/assignment.rb , app/controllers/student_controller.rb&lt;br /&gt;
&lt;br /&gt;
Code:&lt;br /&gt;
 Before:&lt;br /&gt;
  due_date = find_current_stage(topic_id)&lt;br /&gt;
 &lt;br /&gt;
 After:&lt;br /&gt;
  due_date = DueDate.get_next_due_date(self.id.topic_id)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The code has been refactored in assignments.rb and the students controller at following places:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#TODO&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''link_for_current_stage method removed'''===&lt;br /&gt;
&lt;br /&gt;
Problem with existing code:&amp;lt;br&amp;gt;&lt;br /&gt;
	The method link_for_current_stage was called once in list.html.erb. This method checks if the current assignment has any URL specified with it and would return it if present. However, the database has no such value. As a result, the if condition where the function was called always evaluated to false. &lt;br /&gt;
&lt;br /&gt;
Solution:&amp;lt;br&amp;gt;&lt;br /&gt;
	The function link_for_current_stage has been removed. The call to this function has also been removed and the code has been refactored accordingly.&lt;br /&gt;
&lt;br /&gt;
File: app/models/assignment.rb , app/views/list.html.erb&lt;br /&gt;
&lt;br /&gt;
The code in list.html.erb has been refactored as follows:&lt;br /&gt;
&lt;br /&gt;
#TODO&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Automated Testing using RSPEC''' ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Tests for get_current_stage()&amp;lt;/strong&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The current stage of expertiza did not have any tests for get_current_stage. We have added the test for the same as follows:&lt;br /&gt;
&lt;br /&gt;
File: spec/models/assignment_spec.rb&amp;lt;br&amp;gt;&lt;br /&gt;
Code:&lt;br /&gt;
 describe '#get_current_stage ' do&lt;br /&gt;
    context 'when topic id is nil and current assignment has staggered deadline' do&lt;br /&gt;
      it 'returns Unknown' do&lt;br /&gt;
        allow(assignment).to receive(:topic_missing?).and_return(true)&lt;br /&gt;
        expect(assignment.get_current_stage).to eq('Unknown')&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    context 'when current assignment does not have staggered deadline' do&lt;br /&gt;
      context 'when due date is nil' do&lt;br /&gt;
        it 'returns Finished' do&lt;br /&gt;
          allow(assignment).to receive(:finished?).with(123).and_return(true)&lt;br /&gt;
          expect(assignment.get_current_stage (123)).to eq('Finished')&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      context 'when due date is not nil and due date is not equal to Finished' do&lt;br /&gt;
        it 'returns current stage name' do&lt;br /&gt;
          allow(assignment).to receive(:finished?).with(123).and_return(false)&lt;br /&gt;
          allow(assignment).to receive(:topic_missing?).with(123).and_return(false)&lt;br /&gt;
          allow(assignment).to receive(:next_due_date).with(123).and_return(assignment_due_date)&lt;br /&gt;
          deadline = create(:deadline_type, id: 1, name:&amp;quot;Review&amp;quot;)&lt;br /&gt;
          allow(DeadlineType).to receive(:find).with(1).and_return(deadline)&lt;br /&gt;
          expect(assignment.get_current_stage(123)).to eq('Review')&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Tests for finished?&amp;lt;/strong&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Tests for new finished? function have been added.&amp;lt;br&amp;gt;&lt;br /&gt;
File: spec/models/assignment_spec.rb&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 describe '#finished?' do&lt;br /&gt;
    context 'when assignment next due date is nil' do&lt;br /&gt;
      it 'returns True' do&lt;br /&gt;
        allow(DueDate).to receive(:get_next_due_date).with(1, 123).and_return(nil)&lt;br /&gt;
        expect(assignment.finished?(123)).to eq(true)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#finished?' do&lt;br /&gt;
    context 'when there is a next due date' do&lt;br /&gt;
      it 'returns False' do&lt;br /&gt;
        allow(DueDate).to receive(:get_next_due_date).with(1,123).and_return('2021-11-11 11:11:11')&lt;br /&gt;
        expect(assignment.finished?(123)).to eq(false)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
topic_missing method is a private method and hence no tests have been added for the same.&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
[mailto:onkashid@ncsu.edu Omkar Kashid]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:drao@ncsu.edu Deeksha Rao]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:sdinaka@ncsu.edu Swathi Dinakar]&lt;/div&gt;</summary>
		<author><name>Onkashid</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1942._Refactor_stage_deadlines_in_assignment.rb&amp;diff=127420</id>
		<title>CSC/ECE 517 Fall 2019 - E1942. Refactor stage deadlines in assignment.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1942._Refactor_stage_deadlines_in_assignment.rb&amp;diff=127420"/>
		<updated>2019-11-06T21:43:02Z</updated>

		<summary type="html">&lt;p&gt;Onkashid: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Expertiza Background''' ==&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an assignment portal developed by faculties and students at NCSU. It provides a platform for the faculties to create assignments for students. Faculties can have assignments with staged deadlines. Expertiza has support to create teams for students, track the team members and provide review for the work done by team members. Students can also provide reviews for peer team's assignment submission. Expertiza has been developed on Ruby on Rails and is available on github.&lt;br /&gt;
&lt;br /&gt;
== '''Problem Description''' ==&lt;br /&gt;
Following is an OSS project which deals with refactoring of stage deadlines in assignment.rb file. An assignment can have incremental deadlines for different topics in a single assignment. This project involves refactoring the functions in assignment.rb file related to stage deadlines. There were five functions to check what kind of stage an assignment is in. However, the names of these functions were ambiguous and functionalities implemented in some of them overlapped with each other. By the end of this project we have refactored these deadline functions.&lt;br /&gt;
&lt;br /&gt;
== '''Important Links''' ==&lt;br /&gt;
1. [https://152.46.19.152:8080\ VCL Link for expertiza deployed with changes] &amp;lt;br&amp;gt;&lt;br /&gt;
2. [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2019_-_E1942._Refactor_stage_deadlines_in_assignment.rb\ OSS documentation] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Current Scenario''' ==&lt;br /&gt;
The assignment.rb file has the following functions implemented :&amp;lt;br&amp;gt;&lt;br /&gt;
1. current_stage_name(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
2. find_current_stage(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
3. get_current_stage(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
4. link_for_current_stage(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
5. stage_deadline(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Solution Provided''' ==&lt;br /&gt;
We have found the following issues with the code with respect to Ruby conventions :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Multiple calls to DueDate.get_next_due_date()&amp;lt;/strong&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Problem with Existing code:&amp;lt;br&amp;gt;&lt;br /&gt;
	In the existing code, DueDate.get_next_due_date(self.id, topic_id) has been called at numerous places. This does not follow the ruby coding standards.&lt;br /&gt;
&lt;br /&gt;
Solution:&amp;lt;br&amp;gt;&lt;br /&gt;
	New private method next_due_date(topic_id) has been added. This function returns the next_due_date by calling the get_next_due_date method on DueDate.&lt;br /&gt;
&lt;br /&gt;
File: app/models/assignment.rb &amp;lt;br&amp;gt;&lt;br /&gt;
Code:&lt;br /&gt;
 def next_due_date(topic_id = nil)&lt;br /&gt;
  DueDate.get_next_due_date(self.id, topic_id)&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Following places have been refactored.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Screenshots.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Checking finished status with static string “Finished”&amp;lt;/strong&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Problem with Existing code:&amp;lt;br&amp;gt;&lt;br /&gt;
	The above methods have been used at various places to check finish status of assignment by comparing with “Finished”. This does not follow ruby coding standards, as we should never compare with static things. Otherwise it becomes difficult to refactor the code later.&lt;br /&gt;
&lt;br /&gt;
Solution:&amp;lt;br&amp;gt;&lt;br /&gt;
	Assignment is said to be finished if the next due is nil. A new private method finished? has been added. It calls the above next_due_date method and returns true if the next_due_date is nil.&lt;br /&gt;
&lt;br /&gt;
File: app/models/assignment.rb&lt;br /&gt;
Code:&lt;br /&gt;
 def finished?( topic_id = nil )&lt;br /&gt;
  next_due_date(topic_id).nil?&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
The check with “Finished” has been replaces with a call to finished? . The code has been refactored at following places.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Screenshots.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Return “Unknown” when topic_id is missing&amp;lt;/strong&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Problem with existing code:&amp;lt;br&amp;gt;&lt;br /&gt;
	When it is staggered deadline and the topic_id is nil, “Unknown” is returned. This does not follow the DRY Principle. Never should we compare with static strings.&lt;br /&gt;
&lt;br /&gt;
Solution:&amp;lt;br&amp;gt;&lt;br /&gt;
	To make the code more readable and understandable, and to DRY out the code we have added a new private method topic_missing? to check if the topic is missing in case of staggered deadline.  &lt;br /&gt;
&lt;br /&gt;
File:app/models/assignment.rb &amp;lt;br&amp;gt;&lt;br /&gt;
Code:&lt;br /&gt;
 def topic_missing?( topic_id = nil)&lt;br /&gt;
  topic_id.nil? and self.staggered_deadline?&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
The code has been refactored at following places:&amp;lt;br&amp;gt;&lt;br /&gt;
#TODO&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;find_current_stage method removed&amp;lt;/strong&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Problem with the existing code:&amp;lt;br&amp;gt;&lt;br /&gt;
	The method find_current_stage has been used locally in assignment.rb and once in students controller. However internally, this method calls the next_due_date method for the assignment which has already been separated out.&lt;br /&gt;
&lt;br /&gt;
Solution:&amp;lt;br&amp;gt;&lt;br /&gt;
	The method find_current_stage has been removed. The places where it was called has been replaced by a call to next_due_date method. &lt;br /&gt;
&lt;br /&gt;
File: app/models/assignment.rb , app/controllers/student_controller.rb&lt;br /&gt;
&lt;br /&gt;
Code:&lt;br /&gt;
 Before:&lt;br /&gt;
  due_date = find_current_stage(topic_id)&lt;br /&gt;
 &lt;br /&gt;
 After:&lt;br /&gt;
  due_date = DueDate.get_next_due_date(self.id.topic_id)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The code has been refactored in assignments.rb and the students controller at following places:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#TODO&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;link_for_current_stage method removed&amp;lt;/strong&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Problem with existing code:&amp;lt;br&amp;gt;&lt;br /&gt;
	The method link_for_current_stage was called once in list.html.erb. This method checks if the current assignment has any URL specified with it and would return it if present. However, the database has no such value. As a result, the if condition where the function was called always evaluated to false. &lt;br /&gt;
&lt;br /&gt;
Solution:&amp;lt;br&amp;gt;&lt;br /&gt;
	The function link_for_current_stage has been removed. The call to this function has also been removed and the code has been refactored accordingly.&lt;br /&gt;
&lt;br /&gt;
File: app/models/assignment.rb , app/views/list.html.erb&lt;br /&gt;
&lt;br /&gt;
The code in list.html.erb has been refactored as follows:&lt;br /&gt;
&lt;br /&gt;
#TODO&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Automated Testing using RSPEC''' ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Tests for get_current_stage()&amp;lt;/strong&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The current stage of expertiza did not have any tests for get_current_stage. We have added the test for the same as follows:&lt;br /&gt;
&lt;br /&gt;
File: spec/models/assignment_spec.rb&amp;lt;br&amp;gt;&lt;br /&gt;
Code:&lt;br /&gt;
 describe '#get_current_stage ' do&lt;br /&gt;
    context 'when topic id is nil and current assignment has staggered deadline' do&lt;br /&gt;
      it 'returns Unknown' do&lt;br /&gt;
        allow(assignment).to receive(:topic_missing?).and_return(true)&lt;br /&gt;
        expect(assignment.get_current_stage).to eq('Unknown')&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    context 'when current assignment does not have staggered deadline' do&lt;br /&gt;
      context 'when due date is nil' do&lt;br /&gt;
        it 'returns Finished' do&lt;br /&gt;
          allow(assignment).to receive(:finished?).with(123).and_return(true)&lt;br /&gt;
          expect(assignment.get_current_stage (123)).to eq('Finished')&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      context 'when due date is not nil and due date is not equal to Finished' do&lt;br /&gt;
        it 'returns current stage name' do&lt;br /&gt;
          allow(assignment).to receive(:finished?).with(123).and_return(false)&lt;br /&gt;
          allow(assignment).to receive(:topic_missing?).with(123).and_return(false)&lt;br /&gt;
          allow(assignment).to receive(:next_due_date).with(123).and_return(assignment_due_date)&lt;br /&gt;
          deadline = create(:deadline_type, id: 1, name:&amp;quot;Review&amp;quot;)&lt;br /&gt;
          allow(DeadlineType).to receive(:find).with(1).and_return(deadline)&lt;br /&gt;
          expect(assignment.get_current_stage(123)).to eq('Review')&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Tests for finished?&amp;lt;/strong&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Tests for new finished? function have been added.&amp;lt;br&amp;gt;&lt;br /&gt;
File: spec/models/assignment_spec.rb&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 describe '#finished?' do&lt;br /&gt;
    context 'when assignment next due date is nil' do&lt;br /&gt;
      it 'returns True' do&lt;br /&gt;
        allow(DueDate).to receive(:get_next_due_date).with(1, 123).and_return(nil)&lt;br /&gt;
        expect(assignment.finished?(123)).to eq(true)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#finished?' do&lt;br /&gt;
    context 'when there is a next due date' do&lt;br /&gt;
      it 'returns False' do&lt;br /&gt;
        allow(DueDate).to receive(:get_next_due_date).with(1,123).and_return('2021-11-11 11:11:11')&lt;br /&gt;
        expect(assignment.finished?(123)).to eq(false)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
topic_missing method is a private method and hence no tests have been added for the same.&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
[mailto:onkashid@ncsu.edu Omkar Kashid]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:drao@ncsu.edu Deeksha Rao]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:sdinaka@ncsu.edu Swathi Dinakar]&lt;/div&gt;</summary>
		<author><name>Onkashid</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1942._Refactor_stage_deadlines_in_assignment.rb&amp;diff=127417</id>
		<title>CSC/ECE 517 Fall 2019 - E1942. Refactor stage deadlines in assignment.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1942._Refactor_stage_deadlines_in_assignment.rb&amp;diff=127417"/>
		<updated>2019-11-06T21:39:17Z</updated>

		<summary type="html">&lt;p&gt;Onkashid: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Expertiza Background''' ==&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an assignment portal developed by faculties and students at NCSU. It provides a platform for the faculties to create assignments for students. Faculties can have assignments with staged deadlines. Expertiza has support to create teams for students, track the team members and provide review for the work done by team members. Students can also provide reviews for peer team's assignment submission. Expertiza has been developed on Ruby on Rails and is available on github.&lt;br /&gt;
&lt;br /&gt;
== '''Problem Description''' ==&lt;br /&gt;
Following is an OSS project which deals with refactoring of stage deadlines in assignment.rb file. An assignment can have incremental deadlines for different topics in a single assignment. This project involves refactoring the functions in assignment.rb file related to stage deadlines. There were five functions to check what kind of stage an assignment is in. However, the names of these functions were ambiguous and functionalities implemented in some of them overlapped with each other. By the end of this project we have refactored these deadline functions.&lt;br /&gt;
&lt;br /&gt;
== '''Important Links''' ==&lt;br /&gt;
1. [https://152.46.19.152:8080\ VCL Link for expertiza deployed with changes] &amp;lt;br&amp;gt;&lt;br /&gt;
2. [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2019_-_E1942._Refactor_stage_deadlines_in_assignment.rb\ OSS documentation] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Current Scenario''' ==&lt;br /&gt;
The assignment.rb file has the following functions implemented :&amp;lt;br&amp;gt;&lt;br /&gt;
1. current_stage_name(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
2. find_current_stage(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
3. get_current_stage(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
4. link_for_current_stage(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
5. stage_deadline(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Solution Provided''' ==&lt;br /&gt;
We have found the following issues with the code with respect to Ruby conventions :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Multiple calls to DueDate.get_next_due_date()&amp;lt;/strong&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Problem with Existing code:&amp;lt;br&amp;gt;&lt;br /&gt;
	In the existing code, DueDate.get_next_due_date(self.id, topic_id) has been called at numerous places. This does not follow the ruby coding standards.&lt;br /&gt;
&lt;br /&gt;
Solution:&amp;lt;br&amp;gt;&lt;br /&gt;
	New private method next_due_date(topic_id) has been added. This function returns the next_due_date by calling the get_next_due_date method on DueDate.&lt;br /&gt;
&lt;br /&gt;
File: app/models/assignment.rb &amp;lt;br&amp;gt;&lt;br /&gt;
Code:&lt;br /&gt;
 def next_due_date(topic_id = nil)&lt;br /&gt;
  DueDate.get_next_due_date(self.id, topic_id)&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Following places have been refactored.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Screenshots.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Checking finished status with static string “Finished”&amp;lt;/strong&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Problem with Existing code:&amp;lt;br&amp;gt;&lt;br /&gt;
	The above methods have been used at various places to check finish status of assignment by comparing with “Finished”. This does not follow ruby coding standards, as we should never compare with static things. Otherwise it becomes difficult to refactor the code later.&lt;br /&gt;
&lt;br /&gt;
Solution:&amp;lt;br&amp;gt;&lt;br /&gt;
	Assignment is said to be finished if the next due is nil. A new private method finished? has been added. It calls the above next_due_date method and returns true if the next_due_date is nil.&lt;br /&gt;
&lt;br /&gt;
File: app/models/assignment.rb&lt;br /&gt;
Code:&lt;br /&gt;
 def finished?( topic_id = nil )&lt;br /&gt;
  next_due_date(topic_id).nil?&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
The check with “Finished” has been replaces with a call to finished? . The code has been refactored at following places.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Screenshots.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Return “Unknown” when topic_id is missing&amp;lt;/strong&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Problem with existing code:&amp;lt;br&amp;gt;&lt;br /&gt;
	When it is staggered deadline and the topic_id is nil, “Unknown” is returned. This does not follow the DRY Principle. Never should we compare with static strings.&lt;br /&gt;
&lt;br /&gt;
Solution:&amp;lt;br&amp;gt;&lt;br /&gt;
	To make the code more readable and understandable, and to DRY out the code we have added a new private method topic_missing? to check if the topic is missing in case of staggered deadline.  &lt;br /&gt;
&lt;br /&gt;
File:app/models/assignment.rb &amp;lt;br&amp;gt;&lt;br /&gt;
Code:&lt;br /&gt;
 def topic_missing?( topic_id = nil)&lt;br /&gt;
  topic_id.nil? and self.staggered_deadline?&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
The code has been refactored at following places:&amp;lt;br&amp;gt;&lt;br /&gt;
#TODO&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;find_current_stage method removed&amp;lt;/strong&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Problem with the existing code:&amp;lt;br&amp;gt;&lt;br /&gt;
	The method find_current_stage has been used locally in assignment.rb and once in students controller. However internally, this method calls the next_due_date method for the assignment which has already been separated out.&lt;br /&gt;
&lt;br /&gt;
Solution:&amp;lt;br&amp;gt;&lt;br /&gt;
	The method find_current_stage has been removed. The places where it was called has been replaced by a call to next_due_date method. &lt;br /&gt;
&lt;br /&gt;
File: app/models/assignment.rb , app/controllers/student_controller.rb&lt;br /&gt;
&lt;br /&gt;
Code:&lt;br /&gt;
 Before:&lt;br /&gt;
  due_date = find_current_stage(topic_id)&lt;br /&gt;
 &lt;br /&gt;
 After:&lt;br /&gt;
  due_date = DueDate.get_next_due_date(self.id.topic_id)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The code has been refactored in assignments.rb and the students controller at following places:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#TODO&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;link_for_current_stage method removed&amp;lt;/strong&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Problem with existing code:&amp;lt;br&amp;gt;&lt;br /&gt;
	The method link_for_current_stage was called once in list.html.erb. This method checks if the current assignment has any URL specified with it and would return it if present. However, the database has no such value. As a result, the if condition where the function was called always evaluated to false. &lt;br /&gt;
&lt;br /&gt;
Solution:&amp;lt;br&amp;gt;&lt;br /&gt;
	The function link_for_current_stage has been removed. The call to this function has also been removed and the code has been refactored accordingly.&lt;br /&gt;
&lt;br /&gt;
File: app/models/assignment.rb , app/views/list.html.erb&lt;br /&gt;
&lt;br /&gt;
The code in list.html.erb has been refactored as follows:&lt;br /&gt;
&lt;br /&gt;
#TODO&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Automated Testing using RSPEC ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Tests for get_current_stage()&amp;lt;/strong&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The current stage of expertiza did not have any tests for get_current_stage. We have added the test for the same as follows:&lt;br /&gt;
&lt;br /&gt;
File: spec/models/assignment_spec.rb&amp;lt;br&amp;gt;&lt;br /&gt;
Code:&lt;br /&gt;
 describe '#get_current_stage ' do&lt;br /&gt;
    context 'when topic id is nil and current assignment has staggered deadline' do&lt;br /&gt;
      it 'returns Unknown' do&lt;br /&gt;
        allow(assignment).to receive(:topic_missing?).and_return(true)&lt;br /&gt;
        expect(assignment.get_current_stage).to eq('Unknown')&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    context 'when current assignment does not have staggered deadline' do&lt;br /&gt;
      context 'when due date is nil' do&lt;br /&gt;
        it 'returns Finished' do&lt;br /&gt;
          allow(assignment).to receive(:finished?).with(123).and_return(true)&lt;br /&gt;
          expect(assignment.get_current_stage (123)).to eq('Finished')&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      context 'when due date is not nil and due date is not equal to Finished' do&lt;br /&gt;
        it 'returns current stage name' do&lt;br /&gt;
          allow(assignment).to receive(:finished?).with(123).and_return(false)&lt;br /&gt;
          allow(assignment).to receive(:topic_missing?).with(123).and_return(false)&lt;br /&gt;
          allow(assignment).to receive(:next_due_date).with(123).and_return(assignment_due_date)&lt;br /&gt;
          deadline = create(:deadline_type, id: 1, name:&amp;quot;Review&amp;quot;)&lt;br /&gt;
          allow(DeadlineType).to receive(:find).with(1).and_return(deadline)&lt;br /&gt;
          expect(assignment.get_current_stage(123)).to eq('Review')&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Tests for finished?&amp;lt;/strong&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Tests for new finished? function have been added.&amp;lt;br&amp;gt;&lt;br /&gt;
File: spec/models/assignment_spec.rb&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 describe '#finished?' do&lt;br /&gt;
    context 'when assignment next due date is nil' do&lt;br /&gt;
      it 'returns True' do&lt;br /&gt;
        allow(DueDate).to receive(:get_next_due_date).with(1, 123).and_return(nil)&lt;br /&gt;
        expect(assignment.finished?(123)).to eq(true)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#finished?' do&lt;br /&gt;
    context 'when there is a next due date' do&lt;br /&gt;
      it 'returns False' do&lt;br /&gt;
        allow(DueDate).to receive(:get_next_due_date).with(1,123).and_return('2021-11-11 11:11:11')&lt;br /&gt;
        expect(assignment.finished?(123)).to eq(false)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
topic_missing method is a private method and hence no tests have been added for the same.&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
[mailto:onkashid@ncsu.edu Omkar Kashid]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:drao@ncsu.edu Deeksha Rao]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:sdinaka@ncsu.edu Swathi Dinakar]&lt;/div&gt;</summary>
		<author><name>Onkashid</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1942._Refactor_stage_deadlines_in_assignment.rb&amp;diff=127415</id>
		<title>CSC/ECE 517 Fall 2019 - E1942. Refactor stage deadlines in assignment.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1942._Refactor_stage_deadlines_in_assignment.rb&amp;diff=127415"/>
		<updated>2019-11-06T21:37:33Z</updated>

		<summary type="html">&lt;p&gt;Onkashid: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Expertiza Background ==&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an assignment portal developed by faculties and students at NCSU. It provides a platform for the faculties to create assignments for students. Faculties can have assignments with staged deadlines. Expertiza has support to create teams for students, track the team members and provide review for the work done by team members. Students can also provide reviews for peer team's assignment submission. Expertiza has been developed on Ruby on Rails and is available on github.&lt;br /&gt;
&lt;br /&gt;
== Problem Description ==&lt;br /&gt;
Following is an OSS project which deals with refactoring of stage deadlines in assignment.rb file. An assignment can have incremental deadlines for different topics in a single assignment. This project involves refactoring the functions in assignment.rb file related to stage deadlines. There were five functions to check what kind of stage an assignment is in. However, the names of these functions were ambiguous and functionalities implemented in some of them overlapped with each other. By the end of this project we have refactored these deadline functions.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Current Scenario ==&lt;br /&gt;
The assignment.rb file has the following functions implemented :&amp;lt;br&amp;gt;&lt;br /&gt;
1. current_stage_name(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
2. find_current_stage(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
3. get_current_stage(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
4. link_for_current_stage(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
5. stage_deadline(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We have found the following issues with the code with respect to Ruby conventions :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Multiple calls to DueDate.get_next_due_date()&amp;lt;/strong&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Problem with Existing code:&amp;lt;br&amp;gt;&lt;br /&gt;
	In the existing code, DueDate.get_next_due_date(self.id, topic_id) has been called at numerous places. This does not follow the ruby coding standards.&lt;br /&gt;
&lt;br /&gt;
Solution:&amp;lt;br&amp;gt;&lt;br /&gt;
	New private method next_due_date(topic_id) has been added. This function returns the next_due_date by calling the get_next_due_date method on DueDate.&lt;br /&gt;
&lt;br /&gt;
File: app/models/assignment.rb &amp;lt;br&amp;gt;&lt;br /&gt;
Code:&lt;br /&gt;
 def next_due_date(topic_id = nil)&lt;br /&gt;
  DueDate.get_next_due_date(self.id, topic_id)&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Following places have been refactored.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Screenshots.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Checking finished status with static string “Finished”&amp;lt;/strong&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Problem with Existing code:&amp;lt;br&amp;gt;&lt;br /&gt;
	The above methods have been used at various places to check finish status of assignment by comparing with “Finished”. This does not follow ruby coding standards, as we should never compare with static things. Otherwise it becomes difficult to refactor the code later.&lt;br /&gt;
&lt;br /&gt;
Solution:&amp;lt;br&amp;gt;&lt;br /&gt;
	Assignment is said to be finished if the next due is nil. A new private method finished? has been added. It calls the above next_due_date method and returns true if the next_due_date is nil.&lt;br /&gt;
&lt;br /&gt;
File: app/models/assignment.rb&lt;br /&gt;
Code:&lt;br /&gt;
 def finished?( topic_id = nil )&lt;br /&gt;
  next_due_date(topic_id).nil?&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
The check with “Finished” has been replaces with a call to finished? . The code has been refactored at following places.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Screenshots.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Return “Unknown” when topic_id is missing&amp;lt;/strong&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Problem with existing code:&amp;lt;br&amp;gt;&lt;br /&gt;
	When it is staggered deadline and the topic_id is nil, “Unknown” is returned. This does not follow the DRY Principle. Never should we compare with static strings.&lt;br /&gt;
&lt;br /&gt;
Solution:&amp;lt;br&amp;gt;&lt;br /&gt;
	To make the code more readable and understandable, and to DRY out the code we have added a new private method topic_missing? to check if the topic is missing in case of staggered deadline.  &lt;br /&gt;
&lt;br /&gt;
File:app/models/assignment.rb &amp;lt;br&amp;gt;&lt;br /&gt;
Code:&lt;br /&gt;
 def topic_missing?( topic_id = nil)&lt;br /&gt;
  topic_id.nil? and self.staggered_deadline?&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
The code has been refactored at following places:&amp;lt;br&amp;gt;&lt;br /&gt;
#TODO&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;find_current_stage method removed&amp;lt;/strong&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Problem with the existing code:&amp;lt;br&amp;gt;&lt;br /&gt;
	The method find_current_stage has been used locally in assignment.rb and once in students controller. However internally, this method calls the next_due_date method for the assignment which has already been separated out.&lt;br /&gt;
&lt;br /&gt;
Solution:&amp;lt;br&amp;gt;&lt;br /&gt;
	The method find_current_stage has been removed. The places where it was called has been replaced by a call to next_due_date method. &lt;br /&gt;
&lt;br /&gt;
File: app/models/assignment.rb , app/controllers/student_controller.rb&lt;br /&gt;
&lt;br /&gt;
Code:&lt;br /&gt;
 Before:&lt;br /&gt;
  due_date = find_current_stage(topic_id)&lt;br /&gt;
 &lt;br /&gt;
 After:&lt;br /&gt;
  due_date = DueDate.get_next_due_date(self.id.topic_id)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The code has been refactored in assignments.rb and the students controller at following places:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#TODO&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;link_for_current_stage method removed&amp;lt;/strong&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Problem with existing code:&amp;lt;br&amp;gt;&lt;br /&gt;
	The method link_for_current_stage was called once in list.html.erb. This method checks if the current assignment has any URL specified with it and would return it if present. However, the database has no such value. As a result, the if condition where the function was called always evaluated to false. &lt;br /&gt;
&lt;br /&gt;
Solution:&amp;lt;br&amp;gt;&lt;br /&gt;
	The function link_for_current_stage has been removed. The call to this function has also been removed and the code has been refactored accordingly.&lt;br /&gt;
&lt;br /&gt;
File: app/models/assignment.rb , app/views/list.html.erb&lt;br /&gt;
&lt;br /&gt;
The code in list.html.erb has been refactored as follows:&lt;br /&gt;
&lt;br /&gt;
#TODO&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Automated Testing using RSPEC ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Tests for get_current_stage()&amp;lt;/strong&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The current stage of expertiza did not have any tests for get_current_stage. We have added the test for the same as follows:&lt;br /&gt;
&lt;br /&gt;
File: spec/models/assignment_spec.rb&amp;lt;br&amp;gt;&lt;br /&gt;
Code:&lt;br /&gt;
 describe '#get_current_stage ' do&lt;br /&gt;
    context 'when topic id is nil and current assignment has staggered deadline' do&lt;br /&gt;
      it 'returns Unknown' do&lt;br /&gt;
        allow(assignment).to receive(:topic_missing?).and_return(true)&lt;br /&gt;
        expect(assignment.get_current_stage).to eq('Unknown')&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    context 'when current assignment does not have staggered deadline' do&lt;br /&gt;
      context 'when due date is nil' do&lt;br /&gt;
        it 'returns Finished' do&lt;br /&gt;
          allow(assignment).to receive(:finished?).with(123).and_return(true)&lt;br /&gt;
          expect(assignment.get_current_stage (123)).to eq('Finished')&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      context 'when due date is not nil and due date is not equal to Finished' do&lt;br /&gt;
        it 'returns current stage name' do&lt;br /&gt;
          allow(assignment).to receive(:finished?).with(123).and_return(false)&lt;br /&gt;
          allow(assignment).to receive(:topic_missing?).with(123).and_return(false)&lt;br /&gt;
          allow(assignment).to receive(:next_due_date).with(123).and_return(assignment_due_date)&lt;br /&gt;
          deadline = create(:deadline_type, id: 1, name:&amp;quot;Review&amp;quot;)&lt;br /&gt;
          allow(DeadlineType).to receive(:find).with(1).and_return(deadline)&lt;br /&gt;
          expect(assignment.get_current_stage(123)).to eq('Review')&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Tests for finished?&amp;lt;/strong&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Tests for new finished? function have been added.&amp;lt;br&amp;gt;&lt;br /&gt;
File: spec/models/assignment_spec.rb&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 describe '#finished?' do&lt;br /&gt;
    context 'when assignment next due date is nil' do&lt;br /&gt;
      it 'returns True' do&lt;br /&gt;
        allow(DueDate).to receive(:get_next_due_date).with(1, 123).and_return(nil)&lt;br /&gt;
        expect(assignment.finished?(123)).to eq(true)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#finished?' do&lt;br /&gt;
    context 'when there is a next due date' do&lt;br /&gt;
      it 'returns False' do&lt;br /&gt;
        allow(DueDate).to receive(:get_next_due_date).with(1,123).and_return('2021-11-11 11:11:11')&lt;br /&gt;
        expect(assignment.finished?(123)).to eq(false)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
topic_missing method is a private method and hence no tests have been added for the same.&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
[mailto:onkashid@ncsu.edu Omkar Kashid]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:drao@ncsu.edu Deeksha Rao]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:sdinaka@ncsu.edu Swathi Dinakar]&lt;/div&gt;</summary>
		<author><name>Onkashid</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1942._Refactor_stage_deadlines_in_assignment.rb&amp;diff=127413</id>
		<title>CSC/ECE 517 Fall 2019 - E1942. Refactor stage deadlines in assignment.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1942._Refactor_stage_deadlines_in_assignment.rb&amp;diff=127413"/>
		<updated>2019-11-06T21:35:11Z</updated>

		<summary type="html">&lt;p&gt;Onkashid: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Expertiza Background ==&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an assignment portal developed by faculties and students at NCSU. It provides a platform for the faculties to create assignments for students. Faculties can have assignments with staged deadlines. Expertiza has support to create teams for students, track the team members and provide review for the work done by team members. Students can also provide reviews for peer team's assignment submission. Expertiza has been developed on Ruby on Rails and is available on github.&lt;br /&gt;
&lt;br /&gt;
== Problem Description ==&lt;br /&gt;
Following is an OSS project which deals with refactoring of stage deadlines in assignment.rb file. An assignment can have incremental deadlines for different topics in a single assignment. This project involves refactoring the functions in assignment.rb file related to stage deadlines. There were five functions to check what kind of stage an assignment is in. However, the names of these functions were ambiguous and functionalities implemented in some of them overlapped with each other. By the end of this project we have refactored these deadline functions.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Current Scenario ==&lt;br /&gt;
The assignment.rb file has the following functions implemented :&amp;lt;br&amp;gt;&lt;br /&gt;
1. current_stage_name(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
2. find_current_stage(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
3. get_current_stage(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
4. link_for_current_stage(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
5. stage_deadline(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We have found the following issues with the code with respect to Ruby conventions :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Multiple calls to DueDate.get_next_due_date()&amp;lt;/strong&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Problem with Existing code:&amp;lt;br&amp;gt;&lt;br /&gt;
	In the existing code, DueDate.get_next_due_date(self.id, topic_id) has been called at numerous places. This does not follow the ruby coding standards.&lt;br /&gt;
&lt;br /&gt;
Solution:&amp;lt;br&amp;gt;&lt;br /&gt;
	New private method next_due_date(topic_id) has been added. This function returns the next_due_date by calling the get_next_due_date method on DueDate.&lt;br /&gt;
&lt;br /&gt;
File: app/models/assignment.rb &amp;lt;br&amp;gt;&lt;br /&gt;
Code:&lt;br /&gt;
 def next_due_date(topic_id = nil)&lt;br /&gt;
  DueDate.get_next_due_date(self.id, topic_id)&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Following places have been refactored.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Screenshots.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Checking finished status with static string “Finished”&amp;lt;/strong&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Problem with Existing code:&amp;lt;br&amp;gt;&lt;br /&gt;
	The above methods have been used at various places to check finish status of assignment by comparing with “Finished”. This does not follow ruby coding standards, as we should never compare with static things. Otherwise it becomes difficult to refactor the code later.&lt;br /&gt;
&lt;br /&gt;
Solution:&amp;lt;br&amp;gt;&lt;br /&gt;
	Assignment is said to be finished if the next due is nil. A new private method finished? has been added. It calls the above next_due_date method and returns true if the next_due_date is nil.&lt;br /&gt;
&lt;br /&gt;
File: app/models/assignment.rb&lt;br /&gt;
Code:&lt;br /&gt;
 def finished?( topic_id = nil )&lt;br /&gt;
  next_due_date(topic_id).nil?&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
The check with “Finished” has been replaces with a call to finished? . The code has been refactored at following places.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Screenshots.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Return “Unknown” when topic_id is missing&amp;lt;/strong&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Problem with existing code:&amp;lt;br&amp;gt;&lt;br /&gt;
	When it is staggered deadline and the topic_id is nil, “Unknown” is returned. This does not follow the DRY Principle. Never should we compare with static strings.&lt;br /&gt;
&lt;br /&gt;
Solution:&amp;lt;br&amp;gt;&lt;br /&gt;
	To make the code more readable and understandable, and to DRY out the code we have added a new private method topic_missing? to check if the topic is missing in case of staggered deadline.  &lt;br /&gt;
&lt;br /&gt;
File:app/models/assignment.rb &amp;lt;br&amp;gt;&lt;br /&gt;
Code:&lt;br /&gt;
 def topic_missing?( topic_id = nil)&lt;br /&gt;
  topic_id.nil? and self.staggered_deadline?&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
The code has been refactored at following places:&amp;lt;br&amp;gt;&lt;br /&gt;
#TODO&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;find_current_stage method removed&amp;lt;/strong&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Problem with the existing code:&amp;lt;br&amp;gt;&lt;br /&gt;
	The method find_current_stage has been used locally in assignment.rb and once in students controller. However internally, this method calls the next_due_date method for the assignment which has already been separated out.&lt;br /&gt;
&lt;br /&gt;
Solution:&amp;lt;br&amp;gt;&lt;br /&gt;
	The method find_current_stage has been removed. The places where it was called has been replaced by a call to next_due_date method. &lt;br /&gt;
&lt;br /&gt;
File: app/models/assignment.rb , app/controllers/student_controller.rb&lt;br /&gt;
&lt;br /&gt;
Code:&lt;br /&gt;
 Before:&lt;br /&gt;
  due_date = find_current_stage(topic_id)&lt;br /&gt;
 &lt;br /&gt;
 After:&lt;br /&gt;
  due_date = DueDate.get_next_due_date(self.id.topic_id)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The code has been refactored in assignments.rb and the students controller at following places:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#TODO&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;link_for_current_stage method removed&amp;lt;/strong&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Problem with existing code:&amp;lt;br&amp;gt;&lt;br /&gt;
	The method link_for_current_stage was called once in list.html.erb. This method checks if the current assignment has any URL specified with it and would return it if present. However, the database has no such value. As a result, the if condition where the function was called always evaluated to false. &lt;br /&gt;
&lt;br /&gt;
Solution:&amp;lt;br&amp;gt;&lt;br /&gt;
	The function link_for_current_stage has been removed. The call to this function has also been removed and the code has been refactored accordingly.&lt;br /&gt;
&lt;br /&gt;
File: app/models/assignment.rb , app/views/list.html.erb&lt;br /&gt;
&lt;br /&gt;
The code in list.html.erb has been refactored as follows:&lt;br /&gt;
&lt;br /&gt;
#TODO&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Automated Testing using RSPEC ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Tests for get_current_stage()&amp;lt;/strong&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The current stage of expertiza did not have any tests for get_current_stage. We have added the test for the same as follows:&lt;br /&gt;
&lt;br /&gt;
File: spec/models/assignment_spec.rb&amp;lt;br&amp;gt;&lt;br /&gt;
Code:&lt;br /&gt;
 describe '#get_current_stage ' do&lt;br /&gt;
    context 'when topic id is nil and current assignment has staggered deadline' do&lt;br /&gt;
      it 'returns Unknown' do&lt;br /&gt;
        allow(assignment).to receive(:topic_missing?).and_return(true)&lt;br /&gt;
        expect(assignment.get_current_stage).to eq('Unknown')&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    context 'when current assignment does not have staggered deadline' do&lt;br /&gt;
      context 'when due date is nil' do&lt;br /&gt;
        it 'returns Finished' do&lt;br /&gt;
          allow(assignment).to receive(:finished?).with(123).and_return(true)&lt;br /&gt;
          expect(assignment.get_current_stage (123)).to eq('Finished')&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      context 'when due date is not nil and due date is not equal to Finished' do&lt;br /&gt;
        it 'returns current stage name' do&lt;br /&gt;
          allow(assignment).to receive(:finished?).with(123).and_return(false)&lt;br /&gt;
          allow(assignment).to receive(:topic_missing?).with(123).and_return(false)&lt;br /&gt;
          allow(assignment).to receive(:next_due_date).with(123).and_return(assignment_due_date)&lt;br /&gt;
          deadline = create(:deadline_type, id: 1, name:&amp;quot;Review&amp;quot;)&lt;br /&gt;
          allow(DeadlineType).to receive(:find).with(1).and_return(deadline)&lt;br /&gt;
          expect(assignment.get_current_stage(123)).to eq('Review')&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Tests for finished?&amp;lt;/strong&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Tests for new finished? function have been added.&amp;lt;br&amp;gt;&lt;br /&gt;
File: spec/models/assignment_spec.rb&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 describe '#finished?' do&lt;br /&gt;
    context 'when assignment next due date is nil' do&lt;br /&gt;
      it 'returns True' do&lt;br /&gt;
        allow(DueDate).to receive(:get_next_due_date).with(1, 123).and_return(nil)&lt;br /&gt;
        expect(assignment.finished?(123)).to eq(true)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#finished?' do&lt;br /&gt;
    context 'when there is a next due date' do&lt;br /&gt;
      it 'returns False' do&lt;br /&gt;
        allow(DueDate).to receive(:get_next_due_date).with(1,123).and_return('2021-11-11 11:11:11')&lt;br /&gt;
        expect(assignment.finished?(123)).to eq(false)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
topic_missing method is a private method and hence no tests have been added for the same.&lt;/div&gt;</summary>
		<author><name>Onkashid</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1942._Refactor_stage_deadlines_in_assignment.rb&amp;diff=127411</id>
		<title>CSC/ECE 517 Fall 2019 - E1942. Refactor stage deadlines in assignment.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1942._Refactor_stage_deadlines_in_assignment.rb&amp;diff=127411"/>
		<updated>2019-11-06T21:33:28Z</updated>

		<summary type="html">&lt;p&gt;Onkashid: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Expertiza Background ==&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an assignment portal developed by faculties and students at NCSU. It provides a platform for the faculties to create assignments for students. Faculties can have assignments with staged deadlines. Expertiza has support to create teams for students, track the team members and provide review for the work done by team members. Students can also provide reviews for peer team's assignment submission. Expertiza has been developed on Ruby on Rails and is available on github.&lt;br /&gt;
&lt;br /&gt;
== Problem Description ==&lt;br /&gt;
Following is an OSS project which deals with refactoring of stage deadlines in assignment.rb file. An assignment can have incremental deadlines for different topics in a single assignment. This project involves refactoring the functions in assignment.rb file related to stage deadlines. There were five functions to check what kind of stage an assignment is in. However, the names of these functions were ambiguous and functionalities implemented in some of them overlapped with each other. By the end of this project we have refactored these deadline functions.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Current Scenario ==&lt;br /&gt;
The assignment.rb file has the following functions implemented :&amp;lt;br&amp;gt;&lt;br /&gt;
1. current_stage_name(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
2. find_current_stage(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
3. get_current_stage(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
4. link_for_current_stage(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
5. stage_deadline(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We have found the following issues with the code with respect to Ruby conventions :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Multiple calls to DueDate.get_next_due_date()&amp;lt;/strong&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Problem with Existing code:&amp;lt;br&amp;gt;&lt;br /&gt;
	In the existing code, DueDate.get_next_due_date(self.id, topic_id) has been called at numerous places. This does not follow the ruby coding standards.&lt;br /&gt;
&lt;br /&gt;
Solution:&amp;lt;br&amp;gt;&lt;br /&gt;
	New private method next_due_date(topic_id) has been added. This function returns the next_due_date by calling the get_next_due_date method on DueDate.&lt;br /&gt;
&lt;br /&gt;
File: app/models/assignment.rb &amp;lt;br&amp;gt;&lt;br /&gt;
Code:&lt;br /&gt;
 def next_due_date(topic_id = nil)&lt;br /&gt;
  DueDate.get_next_due_date(self.id, topic_id)&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Following places have been refactored.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Screenshots.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Checking finished status with static string “Finished”&amp;lt;/strong&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Problem with Existing code:&amp;lt;br&amp;gt;&lt;br /&gt;
	The above methods have been used at various places to check finish status of assignment by comparing with “Finished”. This does not follow ruby coding standards, as we should never compare with static things. Otherwise it becomes difficult to refactor the code later.&lt;br /&gt;
&lt;br /&gt;
Solution:&amp;lt;br&amp;gt;&lt;br /&gt;
	Assignment is said to be finished if the next due is nil. A new private method finished? has been added. It calls the above next_due_date method and returns true if the next_due_date is nil.&lt;br /&gt;
&lt;br /&gt;
File: app/models/assignment.rb&lt;br /&gt;
Code:&lt;br /&gt;
 def finished?( topic_id = nil )&lt;br /&gt;
  next_due_date(topic_id).nil?&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
The check with “Finished” has been replaces with a call to finished? . The code has been refactored at following places.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Screenshots.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Return “Unknown” when topic_id is missing&amp;lt;/strong&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Problem with existing code:&amp;lt;br&amp;gt;&lt;br /&gt;
	When it is staggered deadline and the topic_id is nil, “Unknown” is returned. This does not follow the DRY Principle. Never should we compare with static strings.&lt;br /&gt;
&lt;br /&gt;
Solution:&amp;lt;br&amp;gt;&lt;br /&gt;
	To make the code more readable and understandable, and to DRY out the code we have added a new private method topic_missing? to check if the topic is missing in case of staggered deadline.  &lt;br /&gt;
&lt;br /&gt;
File:app/models/assignment.rb &amp;lt;br&amp;gt;&lt;br /&gt;
Code:&lt;br /&gt;
 def topic_missing?( topic_id = nil)&lt;br /&gt;
  topic_id.nil? and self.staggered_deadline?&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
The code has been refactored at following places:&amp;lt;br&amp;gt;&lt;br /&gt;
#TODO&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;find_current_stage method removed&amp;lt;/strong&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Problem with the existing code:&amp;lt;br&amp;gt;&lt;br /&gt;
	The method find_current_stage has been used locally in assignment.rb and once in students controller. However internally, this method calls the next_due_date method for the assignment which has already been separated out.&lt;br /&gt;
&lt;br /&gt;
Solution:&amp;lt;br&amp;gt;&lt;br /&gt;
	The method find_current_stage has been removed. The places where it was called has been replaced by a call to next_due_date method. &lt;br /&gt;
&lt;br /&gt;
File: app/models/assignment.rb , app/controllers/student_controller.rb&lt;br /&gt;
&lt;br /&gt;
Code:&lt;br /&gt;
 Before:&lt;br /&gt;
  due_date = find_current_stage(topic_id)&lt;br /&gt;
 &lt;br /&gt;
 After:&lt;br /&gt;
  due_date = DueDate.get_next_due_date(self.id.topic_id)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The code has been refactored in assignments.rb and the students controller at following places:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#TODO&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;link_for_current_stage method removed&amp;lt;/strong&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Problem with existing code:&amp;lt;br&amp;gt;&lt;br /&gt;
	The method link_for_current_stage was called once in list.html.erb. This method checks if the current assignment has any URL specified with it and would return it if present. However, the database has no such value. As a result, the if condition where the function was called always evaluated to false. &lt;br /&gt;
&lt;br /&gt;
Solution:&amp;lt;br&amp;gt;&lt;br /&gt;
	The function link_for_current_stage has been removed. The call to this function has also been removed and the code has been refactored accordingly.&lt;br /&gt;
&lt;br /&gt;
File: app/models/assignment.rb , app/views/list.html.erb&lt;br /&gt;
&lt;br /&gt;
The code in list.html.erb has been refactored as follows:&lt;br /&gt;
&lt;br /&gt;
#TODO&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Automated Testing using RSPEC ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Tests for get_current_stage()&amp;lt;/strong&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The current stage of expertiza did not have any tests for get_current_stage. We have added the test for the same as follows:&lt;br /&gt;
&lt;br /&gt;
File: spec/models/assignment_spec.rb&amp;lt;br&amp;gt;&lt;br /&gt;
Code:&lt;br /&gt;
 describe '#get_current_stage ' do&lt;br /&gt;
    context 'when topic id is nil and current assignment has staggered deadline' do&lt;br /&gt;
      it 'returns Unknown' do&lt;br /&gt;
        allow(assignment).to receive(:topic_missing?).and_return(true)&lt;br /&gt;
        expect(assignment.get_current_stage).to eq('Unknown')&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    context 'when current assignment does not have staggered deadline' do&lt;br /&gt;
      context 'when due date is nil' do&lt;br /&gt;
        it 'returns Finished' do&lt;br /&gt;
          allow(assignment).to receive(:finished?).with(123).and_return(true)&lt;br /&gt;
          expect(assignment.get_current_stage (123)).to eq('Finished')&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      context 'when due date is not nil and due date is not equal to Finished' do&lt;br /&gt;
        it 'returns current stage name' do&lt;br /&gt;
          allow(assignment).to receive(:finished?).with(123).and_return(false)&lt;br /&gt;
          allow(assignment).to receive(:topic_missing?).with(123).and_return(false)&lt;br /&gt;
          allow(assignment).to receive(:next_due_date).with(123).and_return(assignment_due_date)&lt;br /&gt;
          deadline = create(:deadline_type, id: 1, name:&amp;quot;Review&amp;quot;)&lt;br /&gt;
          allow(DeadlineType).to receive(:find).with(1).and_return(deadline)&lt;br /&gt;
          expect(assignment.get_current_stage(123)).to eq('Review')&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;/div&gt;</summary>
		<author><name>Onkashid</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1942._Refactor_stage_deadlines_in_assignment.rb&amp;diff=127409</id>
		<title>CSC/ECE 517 Fall 2019 - E1942. Refactor stage deadlines in assignment.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1942._Refactor_stage_deadlines_in_assignment.rb&amp;diff=127409"/>
		<updated>2019-11-06T21:33:03Z</updated>

		<summary type="html">&lt;p&gt;Onkashid: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Expertiza Background ==&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an assignment portal developed by faculties and students at NCSU. It provides a platform for the faculties to create assignments for students. Faculties can have assignments with staged deadlines. Expertiza has support to create teams for students, track the team members and provide review for the work done by team members. Students can also provide reviews for peer team's assignment submission. Expertiza has been developed on Ruby on Rails and is available on github.&lt;br /&gt;
&lt;br /&gt;
== Problem Description ==&lt;br /&gt;
Following is an OSS project which deals with refactoring of stage deadlines in assignment.rb file. An assignment can have incremental deadlines for different topics in a single assignment. This project involves refactoring the functions in assignment.rb file related to stage deadlines. There were five functions to check what kind of stage an assignment is in. However, the names of these functions were ambiguous and functionalities implemented in some of them overlapped with each other. By the end of this project we have refactored these deadline functions.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Current Scenario ==&lt;br /&gt;
The assignment.rb file has the following functions implemented :&amp;lt;br&amp;gt;&lt;br /&gt;
1. current_stage_name(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
2. find_current_stage(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
3. get_current_stage(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
4. link_for_current_stage(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
5. stage_deadline(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We have found the following issues with the code with respect to Ruby conventions :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Multiple calls to DueDate.get_next_due_date()&amp;lt;/strong&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Problem with Existing code:&amp;lt;br&amp;gt;&lt;br /&gt;
	In the existing code, DueDate.get_next_due_date(self.id, topic_id) has been called at numerous places. This does not follow the ruby coding standards.&lt;br /&gt;
&lt;br /&gt;
Solution:&amp;lt;br&amp;gt;&lt;br /&gt;
	New private method next_due_date(topic_id) has been added. This function returns the next_due_date by calling the get_next_due_date method on DueDate.&lt;br /&gt;
&lt;br /&gt;
File: app/models/assignment.rb &amp;lt;br&amp;gt;&lt;br /&gt;
Code:&lt;br /&gt;
 def next_due_date(topic_id = nil)&lt;br /&gt;
  DueDate.get_next_due_date(self.id, topic_id)&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Following places have been refactored.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Screenshots.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Checking finished status with static string “Finished”&amp;lt;/strong&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Problem with Existing code:&amp;lt;br&amp;gt;&lt;br /&gt;
	The above methods have been used at various places to check finish status of assignment by comparing with “Finished”. This does not follow ruby coding standards, as we should never compare with static things. Otherwise it becomes difficult to refactor the code later.&lt;br /&gt;
&lt;br /&gt;
Solution:&amp;lt;br&amp;gt;&lt;br /&gt;
	Assignment is said to be finished if the next due is nil. A new private method finished? has been added. It calls the above next_due_date method and returns true if the next_due_date is nil.&lt;br /&gt;
&lt;br /&gt;
File: app/models/assignment.rb&lt;br /&gt;
Code:&lt;br /&gt;
 def finished?( topic_id = nil )&lt;br /&gt;
  next_due_date(topic_id).nil?&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
The check with “Finished” has been replaces with a call to finished? . The code has been refactored at following places.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Screenshots.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Return “Unknown” when topic_id is missing&amp;lt;/strong&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Problem with existing code:&amp;lt;br&amp;gt;&lt;br /&gt;
	When it is staggered deadline and the topic_id is nil, “Unknown” is returned. This does not follow the DRY Principle. Never should we compare with static strings.&lt;br /&gt;
&lt;br /&gt;
Solution:&amp;lt;br&amp;gt;&lt;br /&gt;
	To make the code more readable and understandable, and to DRY out the code we have added a new private method topic_missing? to check if the topic is missing in case of staggered deadline.  &lt;br /&gt;
&lt;br /&gt;
File:app/models/assignment.rb &amp;lt;br&amp;gt;&lt;br /&gt;
Code:&lt;br /&gt;
 def topic_missing?( topic_id = nil)&lt;br /&gt;
  topic_id.nil? and self.staggered_deadline?&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
The code has been refactored at following places:&amp;lt;br&amp;gt;&lt;br /&gt;
#TODO&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;find_current_stage method removed&amp;lt;/strong&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Problem with the existing code:&amp;lt;br&amp;gt;&lt;br /&gt;
	The method find_current_stage has been used locally in assignment.rb and once in students controller. However internally, this method calls the next_due_date method for the assignment which has already been separated out.&lt;br /&gt;
&lt;br /&gt;
Solution:&amp;lt;br&amp;gt;&lt;br /&gt;
	The method find_current_stage has been removed. The places where it was called has been replaced by a call to next_due_date method. &lt;br /&gt;
&lt;br /&gt;
File: app/models/assignment.rb , app/controllers/student_controller.rb&lt;br /&gt;
&lt;br /&gt;
Code:&lt;br /&gt;
 Before:&lt;br /&gt;
  due_date = find_current_stage(topic_id)&lt;br /&gt;
 &lt;br /&gt;
 After:&lt;br /&gt;
  due_date = DueDate.get_next_due_date(self.id.topic_id)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The code has been refactored in assignments.rb and the students controller at following places:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#TODO&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;link_for_current_stage method removed&amp;lt;/strong&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Problem with existing code:&amp;lt;br&amp;gt;&lt;br /&gt;
	The method link_for_current_stage was called once in list.html.erb. This method checks if the current assignment has any URL specified with it and would return it if present. However, the database has no such value. As a result, the if condition where the function was called always evaluated to false. &lt;br /&gt;
&lt;br /&gt;
Solution:&amp;lt;br&amp;gt;&lt;br /&gt;
	The function link_for_current_stage has been removed. The call to this function has also been removed and the code has been refactored accordingly.&lt;br /&gt;
&lt;br /&gt;
File: app/models/assignment.rb , app/views/list.html.erb&lt;br /&gt;
&lt;br /&gt;
The code in list.html.erb has been refactored as follows:&lt;br /&gt;
&lt;br /&gt;
#TODO&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Automated Testing using RSPEC ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Tests for get_current_stage()&amp;lt;/strong&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The current stage of expertiza did not have any tests for get_current_stage. We have added the test for the same as follows:&lt;br /&gt;
&lt;br /&gt;
File: spec/models/assignment_spec.rb&amp;lt;br&amp;gt;&lt;br /&gt;
Code:&lt;br /&gt;
 describe '#get_current_stage ' do&lt;br /&gt;
    context 'when topic id is nil and current assignment has staggered deadline' do&lt;br /&gt;
      it 'returns Unknown' do&lt;br /&gt;
        allow(assignment).to receive(:topic_missing?).and_return(true)&lt;br /&gt;
        expect(assignment.get_current_stage).to eq('Unknown')&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    context 'when current assignment does not have staggered deadline' do&lt;br /&gt;
      context 'when due date is nil' do&lt;br /&gt;
        it 'returns Finished' do&lt;br /&gt;
          allow(assignment).to receive(:finished?).with(123).and_return(true)&lt;br /&gt;
          expect(assignment.get_current_stage (123)).to eq('Finished')&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when due date is not nil and due date is not equal to Finished' do&lt;br /&gt;
        it 'returns current stage name' do&lt;br /&gt;
          allow(assignment).to receive(:finished?).with(123).and_return(false)&lt;br /&gt;
          allow(assignment).to receive(:topic_missing?).with(123).and_return(false)&lt;br /&gt;
          allow(assignment).to receive(:next_due_date).with(123).and_return(assignment_due_date)&lt;br /&gt;
          deadline = create(:deadline_type, id: 1, name:&amp;quot;Review&amp;quot;)&lt;br /&gt;
          allow(DeadlineType).to receive(:find).with(1).and_return(deadline)&lt;br /&gt;
          expect(assignment.get_current_stage(123)).to eq('Review')&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;/div&gt;</summary>
		<author><name>Onkashid</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1942._Refactor_stage_deadlines_in_assignment.rb&amp;diff=127408</id>
		<title>CSC/ECE 517 Fall 2019 - E1942. Refactor stage deadlines in assignment.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1942._Refactor_stage_deadlines_in_assignment.rb&amp;diff=127408"/>
		<updated>2019-11-06T21:30:43Z</updated>

		<summary type="html">&lt;p&gt;Onkashid: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Expertiza Background ==&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an assignment portal developed by faculties and students at NCSU. It provides a platform for the faculties to create assignments for students. Faculties can have assignments with staged deadlines. Expertiza has support to create teams for students, track the team members and provide review for the work done by team members. Students can also provide reviews for peer team's assignment submission. Expertiza has been developed on Ruby on Rails and is available on github.&lt;br /&gt;
&lt;br /&gt;
== Problem Description ==&lt;br /&gt;
Following is an OSS project which deals with refactoring of stage deadlines in assignment.rb file. An assignment can have incremental deadlines for different topics in a single assignment. This project involves refactoring the functions in assignment.rb file related to stage deadlines. There were five functions to check what kind of stage an assignment is in. However, the names of these functions were ambiguous and functionalities implemented in some of them overlapped with each other. By the end of this project we have refactored these deadline functions.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Current Scenario ==&lt;br /&gt;
The assignment.rb file has the following functions implemented :&amp;lt;br&amp;gt;&lt;br /&gt;
1. current_stage_name(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
2. find_current_stage(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
3. get_current_stage(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
4. link_for_current_stage(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
5. stage_deadline(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We have found the following issues with the code with respect to Ruby conventions :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Multiple calls to DueDate.get_next_due_date()&amp;lt;/strong&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Problem with Existing code:&amp;lt;br&amp;gt;&lt;br /&gt;
	In the existing code, DueDate.get_next_due_date(self.id, topic_id) has been called at numerous places. This does not follow the ruby coding standards.&lt;br /&gt;
&lt;br /&gt;
Solution:&amp;lt;br&amp;gt;&lt;br /&gt;
	New private method next_due_date(topic_id) has been added. This function returns the next_due_date by calling the get_next_due_date method on DueDate.&lt;br /&gt;
&lt;br /&gt;
File: app/models/assignment.rb &amp;lt;br&amp;gt;&lt;br /&gt;
Code:&lt;br /&gt;
 def next_due_date(topic_id = nil)&lt;br /&gt;
  DueDate.get_next_due_date(self.id, topic_id)&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Following places have been refactored.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Screenshots.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Checking finished status with static string “Finished”&amp;lt;/strong&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Problem with Existing code:&amp;lt;br&amp;gt;&lt;br /&gt;
	The above methods have been used at various places to check finish status of assignment by comparing with “Finished”. This does not follow ruby coding standards, as we should never compare with static things. Otherwise it becomes difficult to refactor the code later.&lt;br /&gt;
&lt;br /&gt;
Solution:&amp;lt;br&amp;gt;&lt;br /&gt;
	Assignment is said to be finished if the next due is nil. A new private method finished? has been added. It calls the above next_due_date method and returns true if the next_due_date is nil.&lt;br /&gt;
&lt;br /&gt;
File: app/models/assignment.rb&lt;br /&gt;
Code:&lt;br /&gt;
 def finished?( topic_id = nil )&lt;br /&gt;
  next_due_date(topic_id).nil?&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
The check with “Finished” has been replaces with a call to finished? . The code has been refactored at following places.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Screenshots.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Return “Unknown” when topic_id is missing&amp;lt;/strong&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Problem with existing code:&amp;lt;br&amp;gt;&lt;br /&gt;
	When it is staggered deadline and the topic_id is nil, “Unknown” is returned. This does not follow the DRY Principle. Never should we compare with static strings.&lt;br /&gt;
&lt;br /&gt;
Solution:&amp;lt;br&amp;gt;&lt;br /&gt;
	To make the code more readable and understandable, and to DRY out the code we have added a new private method topic_missing? to check if the topic is missing in case of staggered deadline.  &lt;br /&gt;
&lt;br /&gt;
File:app/models/assignment.rb &amp;lt;br&amp;gt;&lt;br /&gt;
Code:&lt;br /&gt;
 def topic_missing?( topic_id = nil)&lt;br /&gt;
  topic_id.nil? and self.staggered_deadline?&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
The code has been refactored at following places:&amp;lt;br&amp;gt;&lt;br /&gt;
#TODO&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;find_current_stage method removed&amp;lt;/strong&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Problem with the existing code:&amp;lt;br&amp;gt;&lt;br /&gt;
	The method find_current_stage has been used locally in assignment.rb and once in students controller. However internally, this method calls the next_due_date method for the assignment which has already been separated out.&lt;br /&gt;
&lt;br /&gt;
Solution:&amp;lt;br&amp;gt;&lt;br /&gt;
	The method find_current_stage has been removed. The places where it was called has been replaced by a call to next_due_date method. &lt;br /&gt;
&lt;br /&gt;
File: app/models/assignment.rb , app/controllers/student_controller.rb&lt;br /&gt;
&lt;br /&gt;
Code:&lt;br /&gt;
 Before:&lt;br /&gt;
  due_date = find_current_stage(topic_id)&lt;br /&gt;
 &lt;br /&gt;
 After:&lt;br /&gt;
  due_date = DueDate.get_next_due_date(self.id.topic_id)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The code has been refactored in assignments.rb and the students controller at following places:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#TODO&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;link_for_current_stage method removed&amp;lt;/strong&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Problem with existing code:&amp;lt;br&amp;gt;&lt;br /&gt;
	The method link_for_current_stage was called once in list.html.erb. This method checks if the current assignment has any URL specified with it and would return it if present. However, the database has no such value. As a result, the if condition where the function was called always evaluated to false. &lt;br /&gt;
&lt;br /&gt;
Solution:&amp;lt;br&amp;gt;&lt;br /&gt;
	The function link_for_current_stage has been removed. The call to this function has also been removed and the code has been refactored accordingly.&lt;br /&gt;
&lt;br /&gt;
File: app/models/assignment.rb , app/views/list.html.erb&lt;br /&gt;
&lt;br /&gt;
The code in list.html.erb has been refactored as follows:&lt;br /&gt;
&lt;br /&gt;
#TODO&lt;/div&gt;</summary>
		<author><name>Onkashid</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1942._Refactor_stage_deadlines_in_assignment.rb&amp;diff=127407</id>
		<title>CSC/ECE 517 Fall 2019 - E1942. Refactor stage deadlines in assignment.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1942._Refactor_stage_deadlines_in_assignment.rb&amp;diff=127407"/>
		<updated>2019-11-06T21:29:27Z</updated>

		<summary type="html">&lt;p&gt;Onkashid: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Expertiza Background ==&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an assignment portal developed by faculties and students at NCSU. It provides a platform for the faculties to create assignments for students. Faculties can have assignments with staged deadlines. Expertiza has support to create teams for students, track the team members and provide review for the work done by team members. Students can also provide reviews for peer team's assignment submission. Expertiza has been developed on Ruby on Rails and is available on github.&lt;br /&gt;
&lt;br /&gt;
== Problem Description ==&lt;br /&gt;
Following is an OSS project which deals with refactoring of stage deadlines in assignment.rb file. An assignment can have incremental deadlines for different topics in a single assignment. This project involves refactoring the functions in assignment.rb file related to stage deadlines. There were five functions to check what kind of stage an assignment is in. However, the names of these functions were ambiguous and functionalities implemented in some of them overlapped with each other. By the end of this project we have refactored these deadline functions.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Current Scenario ==&lt;br /&gt;
The assignment.rb file has the following functions implemented :&amp;lt;br&amp;gt;&lt;br /&gt;
1. current_stage_name(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
2. find_current_stage(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
3. get_current_stage(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
4. link_for_current_stage(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
5. stage_deadline(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We have found the following issues with the code with respect to Ruby conventions :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Multiple calls to DueDate.get_next_due_date()&amp;lt;/strong&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Problem with Existing code:&amp;lt;br&amp;gt;&lt;br /&gt;
	In the existing code, DueDate.get_next_due_date(self.id, topic_id) has been called at numerous places. This does not follow the ruby coding standards.&lt;br /&gt;
&lt;br /&gt;
Solution:&amp;lt;br&amp;gt;&lt;br /&gt;
	New private method next_due_date(topic_id) has been added. This function returns the next_due_date by calling the get_next_due_date method on DueDate.&lt;br /&gt;
&lt;br /&gt;
File: app/models/assignment.rb &amp;lt;br&amp;gt;&lt;br /&gt;
Code:&lt;br /&gt;
 def next_due_date(topic_id = nil)&lt;br /&gt;
  DueDate.get_next_due_date(self.id, topic_id)&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Following places have been refactored.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Screenshots.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Checking finished status with static string “Finished”&amp;lt;/strong&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Problem with Existing code:&amp;lt;br&amp;gt;&lt;br /&gt;
	The above methods have been used at various places to check finish status of assignment by comparing with “Finished”. This does not follow ruby coding standards, as we should never compare with static things. Otherwise it becomes difficult to refactor the code later.&lt;br /&gt;
&lt;br /&gt;
Solution:&amp;lt;br&amp;gt;&lt;br /&gt;
	Assignment is said to be finished if the next due is nil. A new private method finished? has been added. It calls the above next_due_date method and returns true if the next_due_date is nil.&lt;br /&gt;
&lt;br /&gt;
File: app/models/assignment.rb&lt;br /&gt;
Code:&lt;br /&gt;
 def finished?( topic_id = nil )&lt;br /&gt;
  next_due_date(topic_id).nil?&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
The check with “Finished” has been replaces with a call to finished? . The code has been refactored at following places.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Screenshots.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Return “Unknown” when topic_id is missing&amp;lt;/strong&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Problem with existing code:&amp;lt;br&amp;gt;&lt;br /&gt;
	When it is staggered deadline and the topic_id is nil, “Unknown” is returned. This does not follow the DRY Principle. Never should we compare with static strings.&lt;br /&gt;
&lt;br /&gt;
Solution:&amp;lt;br&amp;gt;&lt;br /&gt;
	To make the code more readable and understandable, and to DRY out the code we have added a new private method topic_missing? to check if the topic is missing in case of staggered deadline.  &lt;br /&gt;
&lt;br /&gt;
File:app/models/assignment.rb &amp;lt;br&amp;gt;&lt;br /&gt;
Code:&lt;br /&gt;
 def topic_missing?( topic_id = nil)&lt;br /&gt;
  topic_id.nil? and self.staggered_deadline?&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
The code has been refactored at following places:&amp;lt;br&amp;gt;&lt;br /&gt;
#TODO&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;find_current_stage method removed&amp;lt;/strong&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Problem with the existing code:&amp;lt;br&amp;gt;&lt;br /&gt;
	The method find_current_stage has been used locally in assignment.rb and once in students controller. However internally, this method calls the next_due_date method for the assignment which has already been separated out.&lt;br /&gt;
&lt;br /&gt;
Solution:&amp;lt;br&amp;gt;&lt;br /&gt;
	The method find_current_stage has been removed. The places where it was called has been replaced by a call to next_due_date method. &lt;br /&gt;
&lt;br /&gt;
File: app/models/assignment.rb , app/controllers/student_controller.rb&lt;br /&gt;
&lt;br /&gt;
Code:&lt;br /&gt;
 Before:&lt;br /&gt;
  due_date = find_current_stage(topic_id)&lt;br /&gt;
 &lt;br /&gt;
 After:&lt;br /&gt;
  due_date = DueDate.get_next_due_date(self.id.topic_id)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The code has been refactored in assignments.rb and the students controller at following places:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#TODO&lt;/div&gt;</summary>
		<author><name>Onkashid</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1942._Refactor_stage_deadlines_in_assignment.rb&amp;diff=127406</id>
		<title>CSC/ECE 517 Fall 2019 - E1942. Refactor stage deadlines in assignment.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1942._Refactor_stage_deadlines_in_assignment.rb&amp;diff=127406"/>
		<updated>2019-11-06T21:27:44Z</updated>

		<summary type="html">&lt;p&gt;Onkashid: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Expertiza Background ==&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an assignment portal developed by faculties and students at NCSU. It provides a platform for the faculties to create assignments for students. Faculties can have assignments with staged deadlines. Expertiza has support to create teams for students, track the team members and provide review for the work done by team members. Students can also provide reviews for peer team's assignment submission. Expertiza has been developed on Ruby on Rails and is available on github.&lt;br /&gt;
&lt;br /&gt;
== Problem Description ==&lt;br /&gt;
Following is an OSS project which deals with refactoring of stage deadlines in assignment.rb file. An assignment can have incremental deadlines for different topics in a single assignment. This project involves refactoring the functions in assignment.rb file related to stage deadlines. There were five functions to check what kind of stage an assignment is in. However, the names of these functions were ambiguous and functionalities implemented in some of them overlapped with each other. By the end of this project we have refactored these deadline functions.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Current Scenario ==&lt;br /&gt;
The assignment.rb file has the following functions implemented :&amp;lt;br&amp;gt;&lt;br /&gt;
1. current_stage_name(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
2. find_current_stage(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
3. get_current_stage(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
4. link_for_current_stage(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
5. stage_deadline(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We have found the following issues with the code with respect to Ruby conventions :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Multiple calls to DueDate.get_next_due_date()&amp;lt;/strong&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Problem with Existing code:&amp;lt;br&amp;gt;&lt;br /&gt;
	In the existing code, DueDate.get_next_due_date(self.id, topic_id) has been called at numerous places. This does not follow the ruby coding standards.&lt;br /&gt;
&lt;br /&gt;
Solution:&amp;lt;br&amp;gt;&lt;br /&gt;
	New private method next_due_date(topic_id) has been added. This function returns the next_due_date by calling the get_next_due_date method on DueDate.&lt;br /&gt;
&lt;br /&gt;
File: app/models/assignment.rb &amp;lt;br&amp;gt;&lt;br /&gt;
Code:&lt;br /&gt;
 def next_due_date(topic_id = nil)&lt;br /&gt;
  DueDate.get_next_due_date(self.id, topic_id)&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Following places have been refactored.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Screenshots.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Checking finished status with static string “Finished”&amp;lt;/strong&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Problem with Existing code:&amp;lt;br&amp;gt;&lt;br /&gt;
	The above methods have been used at various places to check finish status of assignment by comparing with “Finished”. This does not follow ruby coding standards, as we should never compare with static things. Otherwise it becomes difficult to refactor the code later.&lt;br /&gt;
&lt;br /&gt;
Solution:&amp;lt;br&amp;gt;&lt;br /&gt;
	Assignment is said to be finished if the next due is nil. A new private method finished? has been added. It calls the above next_due_date method and returns true if the next_due_date is nil.&lt;br /&gt;
&lt;br /&gt;
File: app/models/assignment.rb&lt;br /&gt;
Code:&lt;br /&gt;
 def finished?( topic_id = nil )&lt;br /&gt;
  next_due_date(topic_id).nil?&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
The check with “Finished” has been replaces with a call to finished? . The code has been refactored at following places.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Screenshots.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Return “Unknown” when topic_id is missing&amp;lt;/strong&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Problem with existing code:&amp;lt;br&amp;gt;&lt;br /&gt;
	When it is staggered deadline and the topic_id is nil, “Unknown” is returned. This does not follow the DRY Principle. Never should we compare with static strings.&lt;br /&gt;
&lt;br /&gt;
Solution:&amp;lt;br&amp;gt;&lt;br /&gt;
	To make the code more readable and understandable, and to DRY out the code we have added a new private method topic_missing? to check if the topic is missing in case of staggered deadline.  &lt;br /&gt;
&lt;br /&gt;
File:app/models/assignment.rb &amp;lt;br&amp;gt;&lt;br /&gt;
Code:&lt;br /&gt;
 def topic_missing?( topic_id = nil)&lt;br /&gt;
  topic_id.nil? and self.staggered_deadline?&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
The code has been refactored at following places:&amp;lt;br&amp;gt;&lt;br /&gt;
#TODO&lt;/div&gt;</summary>
		<author><name>Onkashid</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1942._Refactor_stage_deadlines_in_assignment.rb&amp;diff=127380</id>
		<title>CSC/ECE 517 Fall 2019 - E1942. Refactor stage deadlines in assignment.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1942._Refactor_stage_deadlines_in_assignment.rb&amp;diff=127380"/>
		<updated>2019-11-06T21:01:07Z</updated>

		<summary type="html">&lt;p&gt;Onkashid: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Expertiza Background ==&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an assignment portal developed by faculties and students at NCSU. It provides a platform for the faculties to create assignments for students. Faculties can have assignments with staged deadlines. Expertiza has support to create teams for students, track the team members and provide review for the work done by team members. Students can also provide reviews for peer team's assignment submission. Expertiza has been developed on Ruby on Rails and is available on github.&lt;br /&gt;
&lt;br /&gt;
== Problem Description ==&lt;br /&gt;
Following is an OSS project which deals with refactoring of stage deadlines in assignment.rb file. An assignment can have incremental deadlines for different topics in a single assignment. This project involves refactoring the functions in assignment.rb file related to stage deadlines. There were five functions to check what kind of stage an assignment is in. However, the names of these functions were ambiguous and functionalities implemented in some of them overlapped with each other. By the end of this project we have refactored these deadline functions.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Current Scenario ==&lt;br /&gt;
The assignment.rb file has the following functions implemented :&amp;lt;br&amp;gt;&lt;br /&gt;
1. current_stage_name(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
2. find_current_stage(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
3. get_current_stage(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
4. link_for_current_stage(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
5. stage_deadline(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We have found the following issues with the code with respect to Ruby conventions :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Multiple calls to DueDate.get_next_due_date()&amp;lt;/strong&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Problem with Existing code:&amp;lt;br&amp;gt;&lt;br /&gt;
	In the existing code, DueDate.get_next_due_date(self.id, topic_id) has been called at numerous places. This does not follow the ruby coding standards.&lt;br /&gt;
&lt;br /&gt;
Solution:&amp;lt;br&amp;gt;&lt;br /&gt;
	New private method next_due_date(topic_id) has been added. This function returns the next_due_date by calling the get_next_due_date method on DueDate.&lt;br /&gt;
&lt;br /&gt;
File: app/models/assignment.rb &amp;lt;br&amp;gt;&lt;br /&gt;
Code:&lt;br /&gt;
 def next_due_date(topic_id = nil)&lt;br /&gt;
  DueDate.get_next_due_date(self.id, topic_id)&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Following places have been refactored.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Screenshots.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Checking finished status with static string “Finished”&amp;lt;/strong&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Problem with Existing code:&amp;lt;br&amp;gt;&lt;br /&gt;
	The above methods have been used at various places to check finish status of assignment by comparing with “Finished”. This does not follow ruby coding standards, as we should never compare with static things. Otherwise it becomes difficult to refactor the code later.&lt;br /&gt;
&lt;br /&gt;
Solution:&amp;lt;br&amp;gt;&lt;br /&gt;
	Assignment is said to be finished if the next due is nil. A new private method finished? has been added. It calls the above next_due_date method and returns true if the next_due_date is nil.&lt;br /&gt;
&lt;br /&gt;
File: app/models/assignment.rb&lt;br /&gt;
Code:&lt;br /&gt;
 def finished?( topic_id = nil )&lt;br /&gt;
  next_due_date(topic_id).nil?&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
The check with “Finished” has been replaces with a call to finished? . The code has been refactored at following places.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Screenshots.&lt;/div&gt;</summary>
		<author><name>Onkashid</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1942._Refactor_stage_deadlines_in_assignment.rb&amp;diff=126432</id>
		<title>CSC/ECE 517 Fall 2019 - E1942. Refactor stage deadlines in assignment.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1942._Refactor_stage_deadlines_in_assignment.rb&amp;diff=126432"/>
		<updated>2019-10-29T02:59:45Z</updated>

		<summary type="html">&lt;p&gt;Onkashid: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Expertiza Background ==&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an assignment portal developed by faculties and students at NCSU. It provides a platform for the faculties to create assignments for students. Faculties can have assignments with staged deadlines. Expertiza has support to create teams for students, track the team members and provide review for the work done by team members. Students can also provide reviews for peer team's assignment submission. Expertiza has been developed on Ruby on Rails and is available on github.&lt;br /&gt;
&lt;br /&gt;
== Problem Description ==&lt;br /&gt;
Following is an OSS project which deals with refactoring of stage deadlines in assignment.rb file. An assignment can have incremental deadlines for different topics in a single assignment. This project involves refactoring the functions in assignment.rb file related to stage deadlines. There were five functions to check what kind of stage an assignment is in. However, the names of these functions were ambiguous and functionalities implemented in some of them overlapped with each other. By the end of this project we have refactored these deadline functions.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Current Scenario ==&lt;br /&gt;
The assignment.rb file has the following functions implemented :&amp;lt;br&amp;gt;&lt;br /&gt;
1. current_stage_name(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
2. find_current_stage(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
3. get_current_stage(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
4. link_for_current_stage(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
5. stage_deadline(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We have found the following issues with the code with respect to Ruby conventions :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Added new function next_due_date(topic_id = nil)&amp;lt;/strong&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Function get_next_due_date was called on DueDate model, numerous times in the file assignment.rb. A new private function next_due_date has been added which returns the next due date of the current assignment (if any), or else return null. The function call DueDate.get_next_due_date(self.id, topic_id) was replaced by a call to private method next_due_date(topic_id). The following function has been added : &lt;br /&gt;
New code introduced is as follows.&amp;lt;br&amp;gt;&lt;br /&gt;
File:app/models/assignment.rb &amp;lt;br&amp;gt;&lt;br /&gt;
Code:&lt;br /&gt;
  def next_due_date(topic_id = nil)&lt;br /&gt;
    DueDate.get_next_due_date(self.id, topic_id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Added new function finished?(topic_id)&amp;lt;/strong&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
In many parts of the code, whether the assignment is finished or not is checked by comparing the return value with 'Finished'. A new private function has been added which returns true if the next_due_date is not nil. Otherwise, it returns false.&lt;br /&gt;
File:app/models/assignment.rb &amp;lt;br&amp;gt;&lt;br /&gt;
Code:&lt;br /&gt;
 def finished?( topic_id = nil )&lt;br /&gt;
    next_due_date(topic_id).nil?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Added new function topic_missing?(topic_id)&amp;lt;/strong&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The topic_id for a staggered assignment has been checked with nil and 'Unknown' is returned. This does not follow the DRY principle. A new method to check whether the topic is missing, was added.&lt;br /&gt;
File:app/models/assignment.rb &amp;lt;br&amp;gt;&lt;br /&gt;
Code:&lt;br /&gt;
  def topic_missing?( topic_id = nil)&lt;br /&gt;
    topic_id.nil? and self.staggered_deadline?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
== Important Links ==&lt;br /&gt;
1. [https://152.46.19.152:8080\ VCL Link for expertiza deployed with changes] &amp;lt;br&amp;gt;&lt;br /&gt;
2. [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2019_-_E1942._Refactor_stage_deadlines_in_assignment.rb\ OSS documentation] &amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Onkashid</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1942._Refactor_stage_deadlines_in_assignment.rb&amp;diff=126431</id>
		<title>CSC/ECE 517 Fall 2019 - E1942. Refactor stage deadlines in assignment.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1942._Refactor_stage_deadlines_in_assignment.rb&amp;diff=126431"/>
		<updated>2019-10-29T02:59:23Z</updated>

		<summary type="html">&lt;p&gt;Onkashid: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Expertiza Background ==&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an assignment portal developed by faculties and students at NCSU. It provides a platform for the faculties to create assignments for students. Faculties can have assignments with staged deadlines. Expertiza has support to create teams for students, track the team members and provide review for the work done by team members. Students can also provide reviews for peer team's assignment submission. Expertiza has been developed on Ruby on Rails and is available on github.&lt;br /&gt;
&lt;br /&gt;
== Problem Description ==&lt;br /&gt;
Following is an OSS project which deals with refactoring of stage deadlines in assignment.rb file. An assignment can have incremental deadlines for different topics in a single assignment. This project involves refactoring the functions in assignment.rb file related to stage deadlines. There were five functions to check what kind of stage an assignment is in. However, the names of these functions were ambiguous and functionalities implemented in some of them overlapped with each other. By the end of this project we have refactored these deadline functions.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Current Scenario ==&lt;br /&gt;
The assignment.rb file has the following functions implemented :&amp;lt;br&amp;gt;&lt;br /&gt;
1. current_stage_name(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
2. find_current_stage(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
3. get_current_stage(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
4. link_for_current_stage(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
5. stage_deadline(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We have found the following issues with the code with respect to Ruby conventions :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Added new function next_due_date(topic_id = nil)&amp;lt;/strong&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Function get_next_due_date was called on DueDate model, numerous times in the file assignment.rb. A new private function next_due_date has been added which returns the next due date of the current assignment (if any), or else return null. The function call DueDate.get_next_due_date(self.id, topic_id) was replaced by a call to private method next_due_date(topic_id). The following function has been added : &lt;br /&gt;
New code introduced is as follows.&amp;lt;br&amp;gt;&lt;br /&gt;
File:app/models/assignment.rb &amp;lt;br&amp;gt;&lt;br /&gt;
Code:&lt;br /&gt;
  def next_due_date(topic_id = nil)&lt;br /&gt;
    DueDate.get_next_due_date(self.id, topic_id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Added new function finished?(topic_id)&amp;lt;/strong&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
In many parts of the code, whether the assignment is finished or not is checked by comparing the return value with 'Finished'. A new private function has been added which returns true if the next_due_date is not nil. Otherwise, it returns false.&lt;br /&gt;
File:app/models/assignment.rb &amp;lt;br&amp;gt;&lt;br /&gt;
Code:&lt;br /&gt;
 def finished?( topic_id = nil )&lt;br /&gt;
    next_due_date(topic_id).nil?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Added new function topic_missing?(topic_id)&amp;lt;/strong&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The topic_id for a staggered assignment has been checked with nil and 'Unknown' is returned. This does not follow the DRY principle. A new method to check whether the topic is missing, was added.&lt;br /&gt;
File:app/models/assignment.rb &amp;lt;br&amp;gt;&lt;br /&gt;
Code:&lt;br /&gt;
  def topic_missing?( topic_id = nil)&lt;br /&gt;
    topic_id.nil? and self.staggered_deadline?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
== Important Links ==&lt;br /&gt;
1. [152.46.19.152:8080\ VCL Link for expertiza deployed with changes] &amp;lt;br&amp;gt;&lt;br /&gt;
2. [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2019_-_E1942._Refactor_stage_deadlines_in_assignment.rb\ OSS documentation] &amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Onkashid</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1942._Refactor_stage_deadlines_in_assignment.rb&amp;diff=126429</id>
		<title>CSC/ECE 517 Fall 2019 - E1942. Refactor stage deadlines in assignment.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1942._Refactor_stage_deadlines_in_assignment.rb&amp;diff=126429"/>
		<updated>2019-10-29T02:59:07Z</updated>

		<summary type="html">&lt;p&gt;Onkashid: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Expertiza Background ==&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an assignment portal developed by faculties and students at NCSU. It provides a platform for the faculties to create assignments for students. Faculties can have assignments with staged deadlines. Expertiza has support to create teams for students, track the team members and provide review for the work done by team members. Students can also provide reviews for peer team's assignment submission. Expertiza has been developed on Ruby on Rails and is available on github.&lt;br /&gt;
&lt;br /&gt;
== Problem Description ==&lt;br /&gt;
Following is an OSS project which deals with refactoring of stage deadlines in assignment.rb file. An assignment can have incremental deadlines for different topics in a single assignment. This project involves refactoring the functions in assignment.rb file related to stage deadlines. There were five functions to check what kind of stage an assignment is in. However, the names of these functions were ambiguous and functionalities implemented in some of them overlapped with each other. By the end of this project we have refactored these deadline functions.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Current Scenario ==&lt;br /&gt;
The assignment.rb file has the following functions implemented :&amp;lt;br&amp;gt;&lt;br /&gt;
1. current_stage_name(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
2. find_current_stage(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
3. get_current_stage(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
4. link_for_current_stage(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
5. stage_deadline(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We have found the following issues with the code with respect to Ruby conventions :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Added new function next_due_date(topic_id = nil)&amp;lt;/strong&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Function get_next_due_date was called on DueDate model, numerous times in the file assignment.rb. A new private function next_due_date has been added which returns the next due date of the current assignment (if any), or else return null. The function call DueDate.get_next_due_date(self.id, topic_id) was replaced by a call to private method next_due_date(topic_id). The following function has been added : &lt;br /&gt;
New code introduced is as follows.&amp;lt;br&amp;gt;&lt;br /&gt;
File:app/models/assignment.rb &amp;lt;br&amp;gt;&lt;br /&gt;
Code:&lt;br /&gt;
  def next_due_date(topic_id = nil)&lt;br /&gt;
    DueDate.get_next_due_date(self.id, topic_id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Added new function finished?(topic_id)&amp;lt;/strong&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
In many parts of the code, whether the assignment is finished or not is checked by comparing the return value with 'Finished'. A new private function has been added which returns true if the next_due_date is not nil. Otherwise, it returns false.&lt;br /&gt;
File:app/models/assignment.rb &amp;lt;br&amp;gt;&lt;br /&gt;
Code:&lt;br /&gt;
 def finished?( topic_id = nil )&lt;br /&gt;
    next_due_date(topic_id).nil?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Added new function topic_missing?(topic_id)&amp;lt;/strong&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The topic_id for a staggered assignment has been checked with nil and 'Unknown' is returned. This does not follow the DRY principle. A new method to check whether the topic is missing, was added.&lt;br /&gt;
File:app/models/assignment.rb &amp;lt;br&amp;gt;&lt;br /&gt;
Code:&lt;br /&gt;
  def topic_missing?( topic_id = nil)&lt;br /&gt;
    topic_id.nil? and self.staggered_deadline?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
== Important Links ==&lt;br /&gt;
1. [152.46.19.152:8080 VCL Link for expertiza deployed with changes] &amp;lt;br&amp;gt;&lt;br /&gt;
2. [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2019_-_E1942._Refactor_stage_deadlines_in_assignment.rb\ OSS documentation] &amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Onkashid</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1942._Refactor_stage_deadlines_in_assignment.rb&amp;diff=126413</id>
		<title>CSC/ECE 517 Fall 2019 - E1942. Refactor stage deadlines in assignment.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1942._Refactor_stage_deadlines_in_assignment.rb&amp;diff=126413"/>
		<updated>2019-10-29T02:52:47Z</updated>

		<summary type="html">&lt;p&gt;Onkashid: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Expertiza Background ==&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an assignment portal developed by faculties and students at NCSU. It provides a platform for the faculties to create assignments for students. Faculties can have assignments with staged deadlines. Expertiza has support to create teams for students, track the team members and provide review for the work done by team members. Students can also provide reviews for peer team's assignment submission. Expertiza has been developed on Ruby on Rails and is available on github.&lt;br /&gt;
&lt;br /&gt;
== Problem Description ==&lt;br /&gt;
Following is an OSS project which deals with refactoring of stage deadlines in assignment.rb file. An assignment can have incremental deadlines for different topics in a single assignment. This project involves refactoring the functions in assignment.rb file related to stage deadlines. There were five functions to check what kind of stage an assignment is in. However, the names of these functions were ambiguous and functionalities implemented in some of them overlapped with each other. By the end of this project we have refactored these deadline functions.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Current Scenario ==&lt;br /&gt;
The assignment.rb file has the following functions implemented :&amp;lt;br&amp;gt;&lt;br /&gt;
1. current_stage_name(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
2. find_current_stage(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
3. get_current_stage(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
4. link_for_current_stage(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
5. stage_deadline(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We have found the following issues with the code with respect to Ruby conventions :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Added new function next_due_date(topic_id = nil)&amp;lt;/strong&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Function get_next_due_date was called on DueDate model, numerous times in the file assignment.rb. A new private function next_due_date has been added which returns the next due date of the current assignment (if any), or else return null. The function call DueDate.get_next_due_date(self.id, topic_id) was replaced by a call to private method next_due_date(topic_id). The following function has been added : &lt;br /&gt;
New code introduced is as follows.&amp;lt;br&amp;gt;&lt;br /&gt;
File:app/models/assignment.rb &amp;lt;br&amp;gt;&lt;br /&gt;
Code:&lt;br /&gt;
  def next_due_date(topic_id = nil)&lt;br /&gt;
    DueDate.get_next_due_date(self.id, topic_id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Added new function finished?(topic_id)&amp;lt;/strong&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
In many parts of the code, whether the assignment is finished or not is checked by comparing the return value with 'Finished'. A new private function has been added which returns true if the next_due_date is not nil. Otherwise, it returns false.&lt;br /&gt;
File:app/models/assignment.rb &amp;lt;br&amp;gt;&lt;br /&gt;
Code:&lt;br /&gt;
 def finished?( topic_id = nil )&lt;br /&gt;
    next_due_date(topic_id).nil?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Added new function topic_missing?(topic_id)&amp;lt;/strong&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The topic_id for a staggered assignment has been checked with nil and 'Unknown' is returned. This does not follow the DRY principle. A new method to check whether the topic is missing, was added.&lt;br /&gt;
File:app/models/assignment.rb &amp;lt;br&amp;gt;&lt;br /&gt;
Code:&lt;br /&gt;
  def topic_missing?( topic_id = nil)&lt;br /&gt;
    topic_id.nil? and self.staggered_deadline?&lt;br /&gt;
  end&lt;/div&gt;</summary>
		<author><name>Onkashid</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1942._Refactor_stage_deadlines_in_assignment.rb&amp;diff=126138</id>
		<title>CSC/ECE 517 Fall 2019 - E1942. Refactor stage deadlines in assignment.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1942._Refactor_stage_deadlines_in_assignment.rb&amp;diff=126138"/>
		<updated>2019-10-28T23:55:39Z</updated>

		<summary type="html">&lt;p&gt;Onkashid: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Expertiza Background ==&lt;/div&gt;</summary>
		<author><name>Onkashid</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1942._Refactor_stage_deadlines_in_assignment.rb&amp;diff=126113</id>
		<title>CSC/ECE 517 Fall 2019 - E1942. Refactor stage deadlines in assignment.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1942._Refactor_stage_deadlines_in_assignment.rb&amp;diff=126113"/>
		<updated>2019-10-28T23:36:12Z</updated>

		<summary type="html">&lt;p&gt;Onkashid: Created page with &amp;quot;hi&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;hi&lt;/div&gt;</summary>
		<author><name>Onkashid</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019&amp;diff=126106</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=126106"/>
		<updated>2019-10-28T23:29:14Z</updated>

		<summary type="html">&lt;p&gt;Onkashid: &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;br /&gt;
* [[CSC/ECE 517 Fall 2019 - M1951. Implement missing OffscreenCanvas APIs]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1940. Improving email notification]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1956. There is no shortcut to get free review points: Review Assignment Bug]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1942. Refactor stage deadlines in assignment.rb]]&lt;/div&gt;</summary>
		<author><name>Onkashid</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019&amp;diff=126101</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=126101"/>
		<updated>2019-10-28T23:26:49Z</updated>

		<summary type="html">&lt;p&gt;Onkashid: &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;br /&gt;
* [[CSC/ECE 517 Fall 2019 - M1951. Implement missing OffscreenCanvas APIs]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1940. Improving email notification]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1956. There is no shortcut to get free review points: Review Assignment Bug]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1942. There is no shortcut to get free review points: Review Assignment Bug]]&lt;/div&gt;</summary>
		<author><name>Onkashid</name></author>
	</entry>
</feed>