<?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=Bjain</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=Bjain"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Bjain"/>
	<updated>2026-07-15T21:51:45Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2018-_Project_E1818:_Role-based_reviewing&amp;diff=117432</id>
		<title>CSC/ECE 517 Spring 2018- Project E1818: Role-based reviewing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2018-_Project_E1818:_Role-based_reviewing&amp;diff=117432"/>
		<updated>2018-05-04T15:46:30Z</updated>

		<summary type="html">&lt;p&gt;Bjain: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
&lt;br /&gt;
The project is created to enable role-based team-mate reviews. These roles can be better named as duties, corresponding to the duty of a team member in a particular project. Borrowing from different Agile methodologies like SCRUM, each team member has a particular role for example: architect,facilitator and implementer.A much more meaningful review can be done if the review rubric was duty-specific. Currently, there is a generic teammate review rubric for all assignments. This means that some review questions are not applicable for all team members. For instance, if there is a question “What percentage of the code was written by this member?” This may not be applicable for the team member who wrote tests or documentation.Similarly, design document specific questions may not be applicable to other members.The instructor should be able to use a different team-mate review rubrics for evaluating the contribution of students depending on their duty.&lt;br /&gt;
&lt;br /&gt;
==UML Diagram==&lt;br /&gt;
&lt;br /&gt;
[[File:Uml 1818.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a UML Class diagram, The relationships depicted above are as follows: &lt;br /&gt;
&lt;br /&gt;
* Between the User and Duty class, there is a bidirectional association. The user table is used for both the instructor and the student. &lt;br /&gt;
** Each instructor can have multiple roles that he can choose from for a particular assignment/questionnaire.&lt;br /&gt;
** Each student can have 0 or 1 role for a particular project. The value of the duty for that project team is stored in TeamUsers.&lt;br /&gt;
* AssignmentsDutyMapping stores the value for all duties applicable to a particular assignment, hence it is an aggregation of the duties for an assignment.&lt;br /&gt;
* AssignmentDutyQuestionnaireMapping adds the questionnaire_id for a particular AssignmentDutyMapping thus has a direct dependency to AssignmentDutyMapping and has an association with the Questionnaire table.&lt;br /&gt;
* StudentTeams uses the AssignmentDutyMapping to table to find available duties for a particular assignment to allow teammates to select. It then uses the Duty table to fetch the respective name of the found duty_id.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
The project introduces changes from the instructor view and the student view. The changes are as follow:&lt;br /&gt;
&lt;br /&gt;
===Migration changes===&lt;br /&gt;
*     Create Duties table: This table stores all the duties created by any instructor.&lt;br /&gt;
               * id - The duty ID will be used by other tables like the questionnaire table and hence will be the primary key.&lt;br /&gt;
               * assignment_id - An assignment has particular duties. Thus, the assignment number will be the foreign key for the Duties table. &lt;br /&gt;
               * instructor_id - The Duties created by one Instructor should be visible and reusable by that instructor only. Thus, the instructor id will also be a foreign key in the Duties table.&lt;br /&gt;
&lt;br /&gt;
*       Create assignments_duty_mappings table: If an instructor wants to add multiple duties for an assignment, storing it in the duty table will cause the duty to be overwritten. Thus we have created a table which maps an assignment and all its duties.&lt;br /&gt;
               * id &lt;br /&gt;
               * assignment_id &lt;br /&gt;
               * duty_id&lt;br /&gt;
&lt;br /&gt;
*       Create assignment_duty_questionnaire_mappings table : This table is created to store the questionnaire for team-mate review rubrics and the corresponding duty id. &lt;br /&gt;
               * id &lt;br /&gt;
               * assignment_id &lt;br /&gt;
               * duty_id&lt;br /&gt;
               * questionnaire_id&lt;br /&gt;
&lt;br /&gt;
*       Added a column entry named &amp;quot;role_based_assignment&amp;quot; in the assignments table which would be of type boolean. This field saves the status of the role based review check box.&lt;br /&gt;
*       Added a column entry named &amp;quot;allow_multiple_duties&amp;quot; in the assignments table which would be of type boolean. This field saves the status of the check box for allowing multiple students with the same role. &lt;br /&gt;
*       Added a column entry named &amp;quot;Duties&amp;quot; to the Users table of type string. This field saves the duty that a student would select if role based reviews are enabled.&lt;br /&gt;
&lt;br /&gt;
===Instructor view changes===&lt;br /&gt;
*	For a particular assignment, in the 'Review Strategy' tab of edit assignment, a check box called &amp;quot;Allow role based review?&amp;quot; is created. This allows an instructor to enable a role based team-mate review for a particular assignment. &lt;br /&gt;
[[File:Instructor_1_1818.png]]&lt;br /&gt;
*      When the check box is ticked, the hidden fields become visible. This includes the duties that have been already added, displayed in a drop-down. Also, a button &amp;quot;Add Duty&amp;quot; pops up. This takes us to the create method of Duties controller where an instructor can add new duties. &lt;br /&gt;
[[File:Instructor_2_1818.png]]&lt;br /&gt;
&lt;br /&gt;
*      In order to display the hidden fields, We call the java script function ''dutiesAssign()'' using the ''ischecked'' listener. The function queries the checkbox variable for ''role_based_review'' and depending its value(true or false), the hidden attributes i.e. ''duties_dropdown'' are displayed or kept hidden.&lt;br /&gt;
[[File:Instructor_3_1818.png]]&lt;br /&gt;
*      The instructor can select from the dropdown of duties. We have allowed multiple duties to be selected at once.The duties created by an instructor are unique for that instructor and are not displayed for any other instructor.&lt;br /&gt;
[[File:Instructor_4_1818.png]]&lt;br /&gt;
*      An instructor can decide the number of duties for a particular assignment. &lt;br /&gt;
*      When the assignment is saved, the duty_id is saved to the assignment_duty_mappings table and thus it is associated with that assignment. &lt;br /&gt;
*      The instructor can create Team-mate review Questionnaires for the different duties he created or can use any from the existing list of questionnaires.&lt;br /&gt;
[[File:Instructor_5_1818.png]] &lt;br /&gt;
*      In order to do this, the instructor has to go to the Rubrics tab of edit assignment. There, if the assignment is role-based, a drop down menu displays the list of all the duties selected for an assignment.&lt;br /&gt;
*      When the assignment is saved, the questionnaire_id is stored in the assignment_duty_questionnaire_mappings table. This is later used while displaying team-mate review questionnaire to students.&lt;br /&gt;
&lt;br /&gt;
===Student view changes=== &lt;br /&gt;
*       When a student goes to “Your team”,  they can see the team members, their selected duties and the option to review if these are enabled. Students will either see &amp;quot;Review&amp;quot; link to start the teammate review or a message that says that &amp;quot;Teammate has not selected a duty.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[File:student_1_1818.jpg]]&lt;br /&gt;
&lt;br /&gt;
*	The student can select their duty from a particular set of duties created by the instructor for that particular assignment. Upon clicking &amp;quot;Select&amp;quot; option in the Duty column, they are redirected to a new page where all the duties appear as radio-buttons and the student can select one of these. This occurs only if role based reviewing is permitted for that particular assignment. If not, the existing view will be displayed which does not give any such option.&lt;br /&gt;
&lt;br /&gt;
[[File:student_2_1818.jpg]]&lt;br /&gt;
&lt;br /&gt;
*  The logic for this is implemented in the 'student_teams' controller and view. This is enclosed in a conditional which only appears if role based reviewing is permitted. &lt;br /&gt;
&lt;br /&gt;
[[File:student_3_1818.jpg]]&lt;br /&gt;
&lt;br /&gt;
*	A student can only select one duty.&lt;br /&gt;
*	A team member cannot change their role after the assignment submission deadline.&lt;br /&gt;
*      When a student selects a particular duty , it is stored in the database table of that user. Thus when a team-mate reviews that student , they will see a questionnaire corresponding to the duty of that student. This would enable reviews of the teammates to be accurate and specific to their role in a project.&lt;br /&gt;
*      After the teammate review questionnaire is opened once, 'View' and 'Edit' links are shown which redirect the user to view/edit the appropriate last saved response.&lt;br /&gt;
&lt;br /&gt;
==Files changes==&lt;br /&gt;
&lt;br /&gt;
===New files===&lt;br /&gt;
Some of the new migration files we have created are&lt;br /&gt;
&lt;br /&gt;
*      db/migrate/add_duties_table.rb&lt;br /&gt;
 '''In this file, a ''duties'' table is created with a name field&lt;br /&gt;
'''&lt;br /&gt;
*      db/migrate/add_reference_of_instructor_and_assignment_to_duties.rb&lt;br /&gt;
  '''In this file, we have adding foreign key reference of ''assignment id'' into ''duties table''.'''&lt;br /&gt;
&lt;br /&gt;
*      db/migrate/add_duties_to_users.rb&lt;br /&gt;
  '''In this file, a column named ''duties'' is added to the ''Users'' table'''&lt;br /&gt;
&lt;br /&gt;
*      db/migrate/add_multiple_duties_to_assignments.rb&lt;br /&gt;
  '''In this file, we have added a column ''allow_multiple_duties'' to ''assignments'' table'''&lt;br /&gt;
&lt;br /&gt;
*      db/migrate/create_assignment_duty_questionnaire_mapping.rb&lt;br /&gt;
  '''In this file, we have created ''assignment_duty_questionnaire_mappings'' table and added columns for ''questionnaire_id'', ''assignment_id'' and ''duty_id''&lt;br /&gt;
'''&lt;br /&gt;
&lt;br /&gt;
===Files that have to be modified===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*	app/views/assignments/edit/review_strategy.html.erb&lt;br /&gt;
 '''In this file, a checkbox is added to permit role based review.&amp;lt;br&amp;gt;A hidden checkbox is added to allow multiple students to have the same role and hidden fields for adding duties along with a dropdown box for selecting from existing duties.'''&lt;br /&gt;
 &lt;br /&gt;
[[File:review_strat_1818.png]]&lt;br /&gt;
&lt;br /&gt;
 '''A java script function is added which removes the hidden attributes from for the above stated entries once the checkbox is selected.'''&lt;br /&gt;
 &lt;br /&gt;
[[File:hidden2_1818.png]]&lt;br /&gt;
&lt;br /&gt;
*      app/views/assignments/edit/rubrics.html.erb&lt;br /&gt;
 '''In this file , a conditional statement is added, which displays the dropdown for selecting duties for teammate review from the duties for an assignment &amp;lt;br&amp;gt;if role based reviewing is permitted or else the standard view is displayed.'''&lt;br /&gt;
&lt;br /&gt;
[[File:rubrics_1818.png]]&lt;br /&gt;
&lt;br /&gt;
*	app/controllers/student_teams/student_teams_controller.rb&lt;br /&gt;
 '''In this file, a variable is set that extracts from Assignments table if the role based reviewing is enabled or not. &amp;lt;br&amp;gt;This variable is then used as a condition to display the various duties available for selection and also to display the particular duty chosen by the student.'''&lt;br /&gt;
        &lt;br /&gt;
*	app/views/student_teams/view.html.erb&lt;br /&gt;
 ''' In this file, a conditional statement is added which redirects to a new page and displays the radio buttons of all the available duties if role based reviewing is allowed.&amp;lt;br&amp;gt; If not, the standard view is displayed.''' &lt;br /&gt;
[[File:Student_view_1_1818.png]]&lt;br /&gt;
&lt;br /&gt;
*      app/controllers/response_controller.rb&lt;br /&gt;
 '''In this file, the new_feedback function will be edited to map the team-mate review questionnaires according to the duties created.'''&lt;br /&gt;
&lt;br /&gt;
*	app/questionnaire/new.html.erb&lt;br /&gt;
 '''A new questionnaire will be created for each new duty created or the same questionnaire can be used.'''&lt;br /&gt;
&lt;br /&gt;
*	app/questionnaire/edit.html.erb&lt;br /&gt;
 '''A newly created questionnaire for a particular duty can be edited.'''&lt;br /&gt;
&lt;br /&gt;
*       app/views/duties/_form.html.erb&lt;br /&gt;
 '''In this file we are creating a new duty and saving the assignment id and instructor id to the Duty table''' &lt;br /&gt;
    [[File:duties_1818_1.png]]&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
*	Instructor tests&lt;br /&gt;
**	While creating an assignment, in the Review Strategy tab, check the box for role based reviewing and expect the 'role_based_review' column of Assignments table to be true.&lt;br /&gt;
**      Ability to add new duties from the Review Strategy tab. Click on 'Add Duty' and get redirected to a new page where there is the option of adding a name for duty in the text-box and click 'Create Duty'. This new added duty will now be displayed in the Review Strategy tab if the role-based-review option is selected.&lt;br /&gt;
**	Select from already existing and newly added duties for a particular assignment. After saving, the changes should be reflected in the database 'AssignmentsDutyMapping' table.&lt;br /&gt;
&lt;br /&gt;
*	Student(team member) tests&lt;br /&gt;
**	When a student visits 'Your Team' link, if the option of role based review is selected while creating the assignment, a link 'Select' should appear which enables the student to select the duty.&lt;br /&gt;
**	In the 'Your Team' tab, after clicking the 'Select' link, the student should be able to select one duty (radio button). This selected duty should now be visible on the 'Your Team' page.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
*       [http://wiki.expertiza.ncsu.edu/index.php/Main_Page Main Page Expertiza] &lt;br /&gt;
*       [https://github.com/expertiza/expertiza/pull/1181 Github Pull Request] &lt;br /&gt;
*       [https://youtu.be/jMQCJUeqA1Q Youtube Screencast]&lt;/div&gt;</summary>
		<author><name>Bjain</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2018-_Project_E1818:_Role-based_reviewing&amp;diff=117427</id>
		<title>CSC/ECE 517 Spring 2018- Project E1818: Role-based reviewing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2018-_Project_E1818:_Role-based_reviewing&amp;diff=117427"/>
		<updated>2018-05-04T15:32:15Z</updated>

		<summary type="html">&lt;p&gt;Bjain: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
&lt;br /&gt;
The project is created to enable role-based team-mate reviews. These roles can be better named as duties, corresponding to the duty of a team member in a particular project. Borrowing from different Agile methodologies like SCRUM, each team member has a particular role for example: architect,facilitator and implementer.A much more meaningful review can be done if the review rubric was duty-specific. Currently, there is a generic teammate review rubric for all assignments. This means that some review questions are not applicable for all team members. For instance, if there is a question “What percentage of the code was written by this member?” This may not be applicable for the team member who wrote tests or documentation.Similarly, design document specific questions may not be applicable to other members.The instructor should be able to use a different team-mate review rubrics for evaluating the contribution of students depending on their duty.&lt;br /&gt;
&lt;br /&gt;
==UML Diagram==&lt;br /&gt;
&lt;br /&gt;
[[File:Uml 1818.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a UML Class diagram, The relationships depicted above are as follows: &lt;br /&gt;
&lt;br /&gt;
* Between the User and Duty class, there is a bidirectional association. The user table is used for both the instructor and the student. &lt;br /&gt;
** Each instructor can have multiple roles that he can choose from for a particular assignment/questionnaire.&lt;br /&gt;
** Each student can have 0 or 1 role for a particular project. The value of the duty for that project team is stored in TeamUsers.&lt;br /&gt;
* AssignmentsDutyMapping stores the value for all duties applicable to a particular assignment, hence it is an aggregation of the duties for an assignment.&lt;br /&gt;
* AssignmentDutyQuestionnaireMapping adds the questionnaire_id for a particular AssignmentDutyMapping thus has a direct dependency to AssignmentDutyMapping and has an association with the Questionnaire table.&lt;br /&gt;
* StudentTeams uses the AssignmentDutyMapping to table to find available duties for a particular assignment to allow teammates to select. It then uses the Duty table to fetch the respective name of the found duty_id.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
The project introduces changes from the instructor view and the student view. The changes are as follow:&lt;br /&gt;
&lt;br /&gt;
===Migration changes===&lt;br /&gt;
*     Create Duties table: This table stores all the duties created by any instructor.&lt;br /&gt;
               * id - The duty ID will be used by other tables like the questionnaire table and hence will be the primary key.&lt;br /&gt;
               * assignment_id - An assignment has particular duties. Thus, the assignment number will be the foreign key for the Duties table. &lt;br /&gt;
               * instructor_id - The Duties created by one Instructor should be visible and reusable by that instructor only. Thus, the instructor id will also be a foreign key in the Duties table.&lt;br /&gt;
&lt;br /&gt;
*       Create assignments_duty_mappings table: If an instructor wants to add multiple duties for an assignment, storing it in the duty table will cause the duty to be overwritten. Thus we have created a table which maps an assignment and all its duties.&lt;br /&gt;
               * id &lt;br /&gt;
               * assignment_id &lt;br /&gt;
               * duty_id&lt;br /&gt;
&lt;br /&gt;
*       Create assignment_duty_questionnaire_mappings table : This table is created to store the questionnaire for team-mate review rubrics and the corresponding duty id. &lt;br /&gt;
               * id &lt;br /&gt;
               * assignment_id &lt;br /&gt;
               * duty_id&lt;br /&gt;
               * questionnaire_id&lt;br /&gt;
&lt;br /&gt;
*       Added a column entry named &amp;quot;role_based_assignment&amp;quot; in the assignments table which would be of type boolean. This field saves the status of the role based review check box.&lt;br /&gt;
*       Added a column entry named &amp;quot;allow_multiple_duties&amp;quot; in the assignments table which would be of type boolean. This field saves the status of the check box for allowing multiple students with the same role. &lt;br /&gt;
*       Added a column entry named &amp;quot;Duties&amp;quot; to the Users table of type string. This field saves the duty that a student would select if role based reviews are enabled.&lt;br /&gt;
&lt;br /&gt;
===Instructor view changes===&lt;br /&gt;
*	For a particular assignment, in the 'Review Strategy' tab of edit assignment, a check box called &amp;quot;Allow role based review?&amp;quot; is created. This allows an instructor to enable a role based team-mate review for a particular assignment. &lt;br /&gt;
[[File:Instructor_1_1818.png]]&lt;br /&gt;
*      When the check box is ticked, the hidden fields become visible. This includes the duties that have been already added, displayed in a drop-down. Also, a button &amp;quot;New duty&amp;quot; pops up. This takes us to the create method of Duties controller where an instructor can add new duties. &lt;br /&gt;
[[File:Instructor_2_1818.png]]&lt;br /&gt;
&lt;br /&gt;
*      In order to display the hidden fields, We call the java script function ''dutiesAssign()'' using the ''ischecked'' listener. The function queries the checkbox variable for ''role_based_review'' and depending its value(true or false), the hidden attributes i.e. ''duties_dropdown'' are displayed or kept hidden.&lt;br /&gt;
[[File:Instructor_3_1818.png]]&lt;br /&gt;
*      The instructor can select from the dropdown of duties. We have allowed multiple duties to be selected at once.The duties created by an instructor are unique for that instructor and are not displayed for any other instructor.&lt;br /&gt;
[[File:Instructor_4_1818.png]]&lt;br /&gt;
*      An instructor can decide the number of duties for a particular assignment. &lt;br /&gt;
*      When the assignment is saved, the duty_id is saved to the assignment_duty_mappings table and thus it is associated with that assignment. &lt;br /&gt;
*      The instructor can create Team-mate review Questionnaires for the different duties he created or can use any from the existing list of questionnaires.&lt;br /&gt;
[[File:Instructor_5_1818.png]] &lt;br /&gt;
*      In order to do this, the instructor has to go to the Rubrics tab of edit assignment. There, if the assignment is role-based, a drop down menu displays the list of all the duties selected for an assignment.&lt;br /&gt;
[[File:Instructor_6_1818.png]]&lt;br /&gt;
*      When the assignment is saved, the questionnaire_id is stored in the assignment_duty_questionnaire_mappings table. This is later used while displaying team-mate review questionnaire to students.&lt;br /&gt;
&lt;br /&gt;
===Student view changes=== &lt;br /&gt;
*       When a student goes to “Your team”,  they can see the team members, their selected duties and the option to review if these are enabled. Students will either see &amp;quot;Review&amp;quot; link to start the teammate review or a message that says that &amp;quot;Teammate has not selected a duty.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[File:student_1_1818.jpg]]&lt;br /&gt;
&lt;br /&gt;
*	The student can select their duty from a particular set of duties created by the instructor for that particular assignment. Upon clicking &amp;quot;Select&amp;quot; option in the Duty column, they are redirected to a new page where all the duties appear as radio-buttons and the student can select one of these. This occurs only if role based reviewing is permitted for that particular assignment. If not, the existing view will be displayed which does not give any such option.&lt;br /&gt;
&lt;br /&gt;
[[File:student_2_1818.jpg]]&lt;br /&gt;
&lt;br /&gt;
*  The logic for this is implemented in the 'student_teams' controller and view. This is enclosed in a conditional which only appears if role based reviewing is permitted. &lt;br /&gt;
&lt;br /&gt;
[[File:student_3_1818.jpg]]&lt;br /&gt;
&lt;br /&gt;
*	A student can only select one duty.&lt;br /&gt;
*	A team member cannot change their role after the assignment submission deadline.&lt;br /&gt;
*      When a student selects a particular duty , it is stored in the database table of that user. Thus when a team-mate reviews that student , they will see a questionnaire corresponding to the duty of that student. This would enable reviews of the teammates to be accurate and specific to their role in a project.&lt;br /&gt;
*      After the teammate review questionnaire is opened once, 'View' and 'Edit' links are shown which redirect the user to view/edit the appropriate last saved response.&lt;br /&gt;
&lt;br /&gt;
==Files changes==&lt;br /&gt;
&lt;br /&gt;
===New files===&lt;br /&gt;
Some of the new migration files we have created are&lt;br /&gt;
&lt;br /&gt;
*      db/migrate/add_duties_table.rb&lt;br /&gt;
 '''In this file, a ''duties'' table is created with a name field&lt;br /&gt;
'''&lt;br /&gt;
*      db/migrate/add_reference_of_instructor_and_assignment_to_duties.rb&lt;br /&gt;
  '''In this file, we have adding foreign key reference of ''assignment id'' into ''duties table''.'''&lt;br /&gt;
&lt;br /&gt;
*      db/migrate/add_duties_to_users.rb&lt;br /&gt;
  '''In this file, a column named ''duties'' is added to the ''Users'' table'''&lt;br /&gt;
&lt;br /&gt;
*      db/migrate/add_multiple_duties_to_assignments.rb&lt;br /&gt;
  '''In this file, we have added a column ''allow_multiple_duties'' to ''assignments'' table'''&lt;br /&gt;
&lt;br /&gt;
*      db/migrate/create_assignment_duty_questionnaire_mapping.rb&lt;br /&gt;
  '''In this file, we have created ''assignment_duty_questionnaire_mappings'' table and added columns for ''questionnaire_id'', ''assignment_id'' and ''duty_id''&lt;br /&gt;
'''&lt;br /&gt;
&lt;br /&gt;
===Files that have to be modified===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*	app/views/assignments/edit/review_strategy.html.erb&lt;br /&gt;
 '''In this file, a checkbox is added to permit role based review.&amp;lt;br&amp;gt;A hidden checkbox is added to allow multiple students to have the same role and hidden fields for adding duties along with a dropdown box for selecting from existing duties.'''&lt;br /&gt;
 &lt;br /&gt;
[[File:review_strat_1818.png]]&lt;br /&gt;
&lt;br /&gt;
 '''A java script function is added which removes the hidden attributes from for the above stated entries once the checkbox is selected.'''&lt;br /&gt;
 &lt;br /&gt;
[[File:hidden2_1818.png]]&lt;br /&gt;
&lt;br /&gt;
*      app/views/assignments/edit/rubrics.html.erb&lt;br /&gt;
 '''In this file , a conditional statement is added, which displays the dropdown for selecting duties for teammate review from the duties for an assignment &amp;lt;br&amp;gt;if role based reviewing is permitted or else the standard view is displayed.'''&lt;br /&gt;
&lt;br /&gt;
[[File:rubrics_1818.png]]&lt;br /&gt;
&lt;br /&gt;
*	app/controllers/student_teams/student_teams_controller.rb&lt;br /&gt;
 '''In this file, a variable is set that extracts from Assignments table if the role based reviewing is enabled or not. &amp;lt;br&amp;gt;This variable is then used as a condition to display the various duties available for selection and also to display the particular duty chosen by the student.'''&lt;br /&gt;
        &lt;br /&gt;
*	app/views/student_teams/view.html.erb&lt;br /&gt;
 ''' In this file, a conditional statement is added which redirects to a new page and displays the radio buttons of all the available duties if role based reviewing is allowed.&amp;lt;br&amp;gt; If not, the standard view is displayed.''' &lt;br /&gt;
[[File:Student_view_1_1818.png]]&lt;br /&gt;
&lt;br /&gt;
*      app/controllers/response_controller.rb&lt;br /&gt;
 '''In this file, the new_feedback function will be edited to map the team-mate review questionnaires according to the duties created.'''&lt;br /&gt;
&lt;br /&gt;
*	app/questionnaire/new.html.erb&lt;br /&gt;
 '''A new questionnaire will be created for each new duty created or the same questionnaire can be used.'''&lt;br /&gt;
&lt;br /&gt;
*	app/questionnaire/edit.html.erb&lt;br /&gt;
 '''A newly created questionnaire for a particular duty can be edited.'''&lt;br /&gt;
&lt;br /&gt;
*       app/views/duties/_form.html.erb&lt;br /&gt;
 '''In this file we are creating a new duty and saving the assignment id and instructor id to the Duty table''' &lt;br /&gt;
    [[File:duties_1818_1.png]]&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
*	Instructor tests&lt;br /&gt;
**	While creating an assignment, in the Review Strategy tab, check the box for role based reviewing and expect the 'role_based_review' column of Assignments table to be true.&lt;br /&gt;
**      Ability to add new duties from the Review Strategy tab. Click on 'Add Duty' and get redirected to a new page where there is the option of adding a name for duty in the text-box and click 'Create Duty'. This new added duty will now be displayed in the Review Strategy tab if the role-based-review option is selected.&lt;br /&gt;
**	Select from already existing and newly added duties for a particular assignment. After saving, the changes should be reflected in the database 'AssignmentsDutyMapping' table.&lt;br /&gt;
&lt;br /&gt;
*	Student(team member) tests&lt;br /&gt;
**	When a student visits 'Your Team' link, if the option of role based review is selected while creating the assignment, a link 'Select' should appear which enables the student to select the duty.&lt;br /&gt;
**	In the 'Your Team' tab, after clicking the 'Select' link, the student should be able to select one duty (radio button). This selected duty should now be visible on the 'Your Team' page.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
*       [http://wiki.expertiza.ncsu.edu/index.php/Main_Page Main Page Expertiza] &lt;br /&gt;
*       [https://github.com/expertiza/expertiza/pull/1181 Github Pull Request] &lt;br /&gt;
*       [http://www.example.com Youtube Screencast]&lt;/div&gt;</summary>
		<author><name>Bjain</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2018-_Project_E1818:_Role-based_reviewing&amp;diff=117426</id>
		<title>CSC/ECE 517 Spring 2018- Project E1818: Role-based reviewing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2018-_Project_E1818:_Role-based_reviewing&amp;diff=117426"/>
		<updated>2018-05-04T15:31:50Z</updated>

		<summary type="html">&lt;p&gt;Bjain: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
&lt;br /&gt;
The project is created to enable role-based team-mate reviews. These roles can be better named as duties, corresponding to the duty of a team member in a particular project. Borrowing from different Agile methodologies like SCRUM, each team member has a particular role for example: architect,facilitator and implementer.A much more meaningful review can be done if the review rubric was duty-specific. Currently, there is a generic teammate review rubric for all assignments. This means that some review questions are not applicable for all team members. For instance, if there is a question “What percentage of the code was written by this member?” This may not be applicable for the team member who wrote tests or documentation.Similarly, design document specific questions may not be applicable to other members.The instructor should be able to use a different team-mate review rubrics for evaluating the contribution of students depending on their duty.&lt;br /&gt;
&lt;br /&gt;
==UML Diagram==&lt;br /&gt;
&lt;br /&gt;
[[File:Uml 1818.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a UML Class diagram, The relationships depicted above are as follows: &lt;br /&gt;
&lt;br /&gt;
* Between the User and Duty class, there is a bidirectional association. The user table is used for both the instructor and the student. &lt;br /&gt;
** Each instructor can have multiple roles that he can choose from for a particular assignment/questionnaire.&lt;br /&gt;
** Each student can have 0 or 1 role for a particular project. The value of the duty for that project team is stored in TeamUsers.&lt;br /&gt;
* AssignmentsDutyMapping stores the value for all duties applicable to a particular assignment, hence it is an aggregation of the duties for an assignment.&lt;br /&gt;
* AssignmentDutyQuestionnaireMapping adds the questionnaire_id for a particular AssignmentDutyMapping thus has a direct dependency to AssignmentDutyMapping and has an association with the Questionnaire table.&lt;br /&gt;
* StudentTeams uses the AssignmentDutyMapping to table to find available duties for a particular assignment to allow teammates to select. It then uses the Duty table to fetch the respective name of the found duty_id.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
The project introduces changes from the instructor view and the student view. The changes are as follow:&lt;br /&gt;
&lt;br /&gt;
===Migration changes===&lt;br /&gt;
*     Create Duties table: This table stores all the duties created by any instructor.&lt;br /&gt;
               * id - The duty ID will be used by other tables like the questionnaire table and hence will be the primary key.&lt;br /&gt;
               * assignment_id - An assignment has particular duties. Thus, the assignment number will be the foreign key for the Duties table. &lt;br /&gt;
               * instructor_id - The Duties created by one Instructor should be visible and reusable by that instructor only. Thus, the instructor id will also be a foreign key in the Duties table.&lt;br /&gt;
&lt;br /&gt;
*       Create assignments_duty_mappings table: If an instructor wants to add multiple duties for an assignment, storing it in the duty table will cause the duty to be overwritten. Thus we have created a table which maps an assignment and all its duties.&lt;br /&gt;
               * id &lt;br /&gt;
               * assignment_id &lt;br /&gt;
               * duty_id&lt;br /&gt;
&lt;br /&gt;
*       Create assignment_duty_questionnaire_mappings table : This table is created to store the questionnaire for team-mate review rubrics and the corresponding duty id. &lt;br /&gt;
               * id &lt;br /&gt;
               * assignment_id &lt;br /&gt;
               * duty_id&lt;br /&gt;
               * questionnaire_id&lt;br /&gt;
&lt;br /&gt;
*       Added a column entry named &amp;quot;role_based_assignment&amp;quot; in the assignments table which would be of type boolean. This field saves the status of the role based review check box.&lt;br /&gt;
*       Added a column entry named &amp;quot;allow_multiple_duties&amp;quot; in the assignments table which would be of type boolean. This field saves the status of the check box for allowing multiple students with the same role. &lt;br /&gt;
*       Added a column entry named &amp;quot;Duties&amp;quot; to the Users table of type string. This field saves the duty that a student would select if role based reviews are enabled.&lt;br /&gt;
&lt;br /&gt;
===Instructor view changes===&lt;br /&gt;
*	For a particular assignment, in the 'Review Strategy' tab of edit assignment, a check box called &amp;quot;Allow role based review?&amp;quot; is created. This allows an instructor to enable a role based team-mate review for a particular assignment. &lt;br /&gt;
[[File:Instructor_1_1818.png]]&lt;br /&gt;
*      When the check box is ticked, the hidden fields become visible. This includes the duties that have been already added, displayed in a drop-down. Also, a button &amp;quot;New duty&amp;quot; pops up. This takes us to the create method of Duties controller where an instructor can add new duties. &lt;br /&gt;
[[File:Instructor_2_1818.png]]&lt;br /&gt;
&lt;br /&gt;
*      In order to display the hidden fields, We call the java script function ''dutiesAssign()'' using the ''ischecked'' listener. The function queries the checkbox variable for ''role_based_review'' and depending its value(true or false), the hidden attributes i.e. ''duties_dropdown'' are displayed or kept hidden.&lt;br /&gt;
[[File:Instructor_3_1818.png]]&lt;br /&gt;
*      The instructor can select from the dropdown of duties. We have allowed multiple duties to be selected at once.The duties created by an instructor are unique for that instructor and are not displayed for any other instructor.&lt;br /&gt;
[[File:Instructor_4_1818.png]]&lt;br /&gt;
*      An instructor can decide the number of duties for a particular assignment. &lt;br /&gt;
*      When the assignment is saved, the duty_id is saved to the assignment_duty_mappings table and thus it is associated with that assignment. &lt;br /&gt;
*      The instructor can create Team-mate review Questionnaires for the different duties he created or can use any from the existing list of questionnaires.&lt;br /&gt;
[[File:Instructor_5_1818.png]] &lt;br /&gt;
*      In order to do this, the instructor has to go to the Rubrics tab of edit assignment. There, if the assignment is role-based, a drop down menu displays the list of all the duties selected for an assignment.&lt;br /&gt;
[[File:Instructor_6_1818.png]]&lt;br /&gt;
*      When the assignment is saved, the questionnaire_id is stored in the assignment_duty_questionnaire_mappings table. This is later used while displaying team-mate review questionnaire to students.&lt;br /&gt;
&lt;br /&gt;
===Student view changes=== &lt;br /&gt;
*       When a student goes to “Your team”,  they can see the team members, their selected duties and the option to review if these are enabled. Students will either see &amp;quot;Review&amp;quot; link to start the teammate review or a message that says that &amp;quot;Teammate has not selected a duty.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[File:student_1_1818.jpg]]&lt;br /&gt;
&lt;br /&gt;
*	The student can select their duty from a particular set of duties created by the instructor for that particular assignment. Upon clicking &amp;quot;Select&amp;quot; option in the Duty column, they are redirected to a new page where all the duties appear as radio-buttons and the student can select one of these. This occurs only if role based reviewing is permitted for that particular assignment. If not, the existing view will be displayed which does not give any such option.&lt;br /&gt;
&lt;br /&gt;
[[File:student_2_1818.jpg]]&lt;br /&gt;
&lt;br /&gt;
*  The logic for this is implemented in the 'student_teams' controller and view. This is enclosed in a conditional which only appears if role based reviewing is permitted. &lt;br /&gt;
&lt;br /&gt;
[[File:student_3_1818.jpg]]&lt;br /&gt;
&lt;br /&gt;
*	A student can only select one duty.&lt;br /&gt;
*	A team member cannot change their role after the assignment submission deadline.&lt;br /&gt;
*      When a student selects a particular duty , it is stored in the database table of that user. Thus when a team-mate reviews that student , they will see a questionnaire corresponding to the duty of that student. This would enable reviews of the teammates to be accurate and specific to their role in a project.&lt;br /&gt;
*      After the teammate review questionnaire is opened once, 'View' and 'Edit' links are shown which redirect the user to view/edit the appropriate last saved response.&lt;br /&gt;
&lt;br /&gt;
==Files changes==&lt;br /&gt;
&lt;br /&gt;
===New files===&lt;br /&gt;
Some of the new migration files we have created are&lt;br /&gt;
&lt;br /&gt;
*      db/migrate/add_duties_table.rb&lt;br /&gt;
 '''In this file, a ''duties'' table is created with a name field&lt;br /&gt;
'''&lt;br /&gt;
*      db/migrate/add_reference_of_instructor_and_assignment_to_duties.rb&lt;br /&gt;
  '''In this file, we have adding foreign key reference of ''assignment id'' into ''duties table''.'''&lt;br /&gt;
&lt;br /&gt;
*      db/migrate/add_duties_to_users.rb&lt;br /&gt;
  '''In this file, a column named ''duties'' is added to the ''Users'' table'''&lt;br /&gt;
&lt;br /&gt;
*      db/migrate/add_multiple_duties_to_assignments.rb&lt;br /&gt;
  '''In this file, we have added a column ''allow_multiple_duties'' to ''assignments'' table'''&lt;br /&gt;
&lt;br /&gt;
*      db/migrate/create_assignment_duty_questionnaire_mapping.rb&lt;br /&gt;
  '''In this file, we have created ''assignment_duty_questionnaire_mappings'' table and added columns for ''questionnaire_id'', ''assignment_id'' and ''duty_id''&lt;br /&gt;
'''&lt;br /&gt;
&lt;br /&gt;
===Files that have to be modified===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*	app/views/assignments/edit/review_strategy.html.erb&lt;br /&gt;
 '''In this file, a checkbox is added to permit role based review.&amp;lt;br&amp;gt;A hidden checkbox is added to allow multiple students to have the same role and hidden fields for adding duties along with a dropdown box for selecting from existing duties.'''&lt;br /&gt;
 &lt;br /&gt;
[[File:review_strat_1818.png]]&lt;br /&gt;
&lt;br /&gt;
 '''A java script function is added which removes the hidden attributes from for the above stated entries once the checkbox is selected.'''&lt;br /&gt;
 &lt;br /&gt;
[[File:hidden2_1818.png]]&lt;br /&gt;
&lt;br /&gt;
*      app/views/assignments/edit/rubrics.html.erb&lt;br /&gt;
 '''In this file , a conditional statement is added, which displays the dropdown for selecting duties for teammate review from the duties for an assignment &amp;lt;br&amp;gt;if role based reviewing is permitted or else the standard view is displayed.'''&lt;br /&gt;
&lt;br /&gt;
[[File:rubrics_1818.png]]&lt;br /&gt;
&lt;br /&gt;
*	app/controllers/student_teams/student_teams_controller.rb&lt;br /&gt;
 '''In this file, a variable is set that extracts from Assignments table if the role based reviewing is enabled or not. &amp;lt;br&amp;gt;This variable is then used as a condition to display the various duties available for selection and also to display the particular duty chosen by the student.'''&lt;br /&gt;
        &lt;br /&gt;
*	app/views/student_teams/view.html.erb&lt;br /&gt;
 ''' In this file, a conditional statement is added which redirects to a new page and displays the radio buttons of all the available duties if role based reviewing is allowed.&amp;lt;br&amp;gt; If not, the standard view is displayed.''' &lt;br /&gt;
[[File:Student_view_1_1818.png]]&lt;br /&gt;
&lt;br /&gt;
*      app/controllers/response_controller.rb&lt;br /&gt;
 '''In this file, the new_feedback function will be edited to map the team-mate review questionnaires according to the duties created.'''&lt;br /&gt;
&lt;br /&gt;
*	app/questionnaire/new.html.erb&lt;br /&gt;
 '''A new questionnaire will be created for each new duty created or the same questionnaire can be used.'''&lt;br /&gt;
&lt;br /&gt;
*	app/questionnaire/edit.html.erb&lt;br /&gt;
 '''A newly created questionnaire for a particular duty can be edited.'''&lt;br /&gt;
&lt;br /&gt;
*       app/views/duties/_form.html.erb&lt;br /&gt;
 '''In this file we are creating a new duty and saving the assignment id and instructor id to the Duty table''' &lt;br /&gt;
    [[File:duties_1818_1.png]]&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
*	Instructor tests&lt;br /&gt;
**	While creating an assignment, in the Review Strategy tab, check the box for role based reviewing and expect the 'role_based_review' column of Assignments table to be true.&lt;br /&gt;
&lt;br /&gt;
**      Ability to add new duties from the Review Strategy tab. Click on 'Add Duty' and get redirected to a new page where there is the option of adding a name for duty in the text-box and click 'Create Duty'. This new added duty will now be displayed in the Review Strategy tab if the role-based-review option is selected.&lt;br /&gt;
&lt;br /&gt;
**	Select from already existing and newly added duties for a particular assignment. After saving, the changes should be reflected in the database 'AssignmentsDutyMapping' table.&lt;br /&gt;
&lt;br /&gt;
*	Student(team member) tests&lt;br /&gt;
**	When a student visits 'Your Team' link, if the option of role based review is selected while creating the assignment, a link 'Select' should appear which enables the student to select the duty.&lt;br /&gt;
**	In the 'Your Team' tab, after clicking the 'Select' link, the student should be able to select one duty (radio button). This selected duty should now be visible on the 'Your Team' page.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
*       [http://wiki.expertiza.ncsu.edu/index.php/Main_Page Main Page Expertiza] &lt;br /&gt;
*       [https://github.com/expertiza/expertiza/pull/1181 Github Pull Request] &lt;br /&gt;
*       [http://www.example.com Youtube Screencast]&lt;/div&gt;</summary>
		<author><name>Bjain</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2018-_Project_E1818:_Role-based_reviewing&amp;diff=117423</id>
		<title>CSC/ECE 517 Spring 2018- Project E1818: Role-based reviewing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2018-_Project_E1818:_Role-based_reviewing&amp;diff=117423"/>
		<updated>2018-05-04T15:23:35Z</updated>

		<summary type="html">&lt;p&gt;Bjain: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
&lt;br /&gt;
The project is created to enable role-based team-mate reviews. These roles can be better named as duties, corresponding to the duty of a team member in a particular project. Borrowing from different Agile methodologies like SCRUM, each team member has a particular role for example: architect,facilitator and implementer.A much more meaningful review can be done if the review rubric was duty-specific. Currently, there is a generic teammate review rubric for all assignments. This means that some review questions are not applicable for all team members. For instance, if there is a question “What percentage of the code was written by this member?” This may not be applicable for the team member who wrote tests or documentation.Similarly, design document specific questions may not be applicable to other members.The instructor should be able to use a different team-mate review rubrics for evaluating the contribution of students depending on their duty.&lt;br /&gt;
&lt;br /&gt;
==UML Diagram==&lt;br /&gt;
&lt;br /&gt;
[[File:Uml 1818.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a UML Class diagram, The relationships depicted above are as follows: &lt;br /&gt;
&lt;br /&gt;
* Between the User and Duty class, there is a bidirectional association. The user table is used for both the instructor and the student. &lt;br /&gt;
** Each instructor can have multiple roles that he can choose from for a particular assignment/questionnaire.&lt;br /&gt;
** Each student can have 0 or 1 role for a particular project.&lt;br /&gt;
* For each Questionnaire instance, there are one or more Questions that can be stored, hence there is an aggregation relationship from Question to Questionnaire. This is for the grading rubric based on the role.&lt;br /&gt;
* The Question table and the Questionnaire table each will be using the the duty ID to sort out questions for a particular assignment.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
The project introduces changes from the instructor view and the student view. The changes are as follow:&lt;br /&gt;
&lt;br /&gt;
===Migration changes===&lt;br /&gt;
*     Create Duties table: This table stores all the duties created by any instructor.&lt;br /&gt;
               * id - The duty ID will be used by other tables like the questionnaire table and hence will be the primary key.&lt;br /&gt;
               * assignment_id - An assignment has particular duties. Thus, the assignment number will be the foreign key for the Duties table. &lt;br /&gt;
               * instructor_id - The Duties created by one Instructor should be visible and reusable by that instructor only. Thus, the instructor id will also be a foreign key in the Duties table.&lt;br /&gt;
&lt;br /&gt;
*       Create assignments_duty_mappings table: If an instructor wants to add multiple duties for an assignment, storing it in the duty table will cause the duty to be overwritten. Thus we have created a table which maps an assignment and all its duties.&lt;br /&gt;
               * id &lt;br /&gt;
               * assignment_id &lt;br /&gt;
               * duty_id&lt;br /&gt;
&lt;br /&gt;
*       Create assignment_duty_questionnaire_mappings table : This table is created to store the questionnaire for team-mate review rubrics and the corresponding duty id. &lt;br /&gt;
               * id &lt;br /&gt;
               * assignment_id &lt;br /&gt;
               * duty_id&lt;br /&gt;
               * questionnaire_id&lt;br /&gt;
&lt;br /&gt;
*       Added a column entry named &amp;quot;role_based_assignment&amp;quot; in the assignments table which would be of type boolean. This field saves the status of the role based review check box.&lt;br /&gt;
*       Added a column entry named &amp;quot;allow_multiple_duties&amp;quot; in the assignments table which would be of type boolean. This field saves the status of the check box for allowing multiple students with the same role. &lt;br /&gt;
*       Added a column entry named &amp;quot;Duties&amp;quot; to the Users table of type string. This field saves the duty that a student would select if role based reviews are enabled.&lt;br /&gt;
&lt;br /&gt;
===Instructor view changes===&lt;br /&gt;
*	For a particular assignment, in the 'Review Strategy' tab of edit assignment, a check box called &amp;quot;Allow role based review?&amp;quot; is created. This allows an instructor to enable a role based team-mate review for a particular assignment. &lt;br /&gt;
[[File:Instructor_1_1818.png]]&lt;br /&gt;
*      When the check box is ticked, the hidden fields become visible. This includes the duties that have been already added, displayed in a drop-down. Also, a button &amp;quot;New duty&amp;quot; pops up. This takes us to the create method of Duties controller where an instructor can add new duties. &lt;br /&gt;
[[File:Instructor_2_1818.png]]&lt;br /&gt;
&lt;br /&gt;
*      In order to display the hidden fields, We call the java script function ''dutiesAssign()'' using the ''ischecked'' listener. The function queries the checkbox variable for ''role_based_review'' and depending its value(true or false), the hidden attributes i.e. ''duties_dropdown'' are displayed or kept hidden.&lt;br /&gt;
[[File:Instructor_3_1818.png]]&lt;br /&gt;
*      The instructor can select from the dropdown of duties. We have allowed multiple duties to be selected at once.The duties created by an instructor are unique for that instructor and are not displayed for any other instructor.&lt;br /&gt;
[[File:Instructor_4_1818.png]]&lt;br /&gt;
*      An instructor can decide the number of duties for a particular assignment. &lt;br /&gt;
*      When the assignment is saved, the duty_id is saved to the assignment_duty_mappings table and thus it is associated with that assignment. &lt;br /&gt;
*      The instructor can create Team-mate review Questionnaires for the different duties he created or can use any from the existing list of questionnaires.&lt;br /&gt;
[[File:Instructor_5_1818.png]] &lt;br /&gt;
*      In order to do this, the instructor has to go to the Rubrics tab of edit assignment. There, if the assignment is role-based, a drop down menu displays the list of all the duties selected for an assignment.&lt;br /&gt;
[[File:Instructor_6_1818.png]]&lt;br /&gt;
*      When the assignment is saved, the questionnaire_id is stored in the assignment_duty_questionnaire_mappings table. This is later used while displaying team-mate review questionnaire to students.&lt;br /&gt;
&lt;br /&gt;
===Student view changes=== &lt;br /&gt;
*       When a student goes to “Your team”,  they can see the team members, their selected duties and the option to review if these are enabled. Students will either see &amp;quot;Review&amp;quot; link to start the teammate review or a message that says that &amp;quot;Teammate has not selected a duty.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[File:student_1_1818.jpg]]&lt;br /&gt;
&lt;br /&gt;
*	The student can select their duty from a particular set of duties created by the instructor for that particular assignment. Upon clicking &amp;quot;Select&amp;quot; option in the Duty column, they are redirected to a new page where all the duties appear as radio-buttons and the student can select one of these. This occurs only if role based reviewing is permitted for that particular assignment. If not, the existing view will be displayed which does not give any such option.&lt;br /&gt;
&lt;br /&gt;
[[File:student_2_1818.jpg]]&lt;br /&gt;
&lt;br /&gt;
*  The logic for this is implemented in the 'student_teams' controller and view. This is enclosed in a conditional which only appears if role based reviewing is permitted. &lt;br /&gt;
&lt;br /&gt;
[[File:student_3_1818.jpg]]&lt;br /&gt;
&lt;br /&gt;
*	A student can only select one duty.&lt;br /&gt;
*	A team member cannot change their role after the assignment submission deadline.&lt;br /&gt;
*      When a student selects a particular duty , it is stored in the database table of that user. Thus when a team-mate reviews that student , they will see a questionnaire corresponding to the duty of that student. This would enable reviews of the teammates to be accurate and specific to their role in a project.&lt;br /&gt;
*      After the teammate review questionnaire is opened once, 'View' and 'Edit' links are shown which redirect the user to view/edit the appropriate last saved response.&lt;br /&gt;
&lt;br /&gt;
==Files changes==&lt;br /&gt;
&lt;br /&gt;
===New files===&lt;br /&gt;
Some of the new migration files we have created are&lt;br /&gt;
&lt;br /&gt;
*      db/migrate/add_duties_table.rb&lt;br /&gt;
 '''In this file, a ''duties'' table is created with a name field&lt;br /&gt;
'''&lt;br /&gt;
*      db/migrate/add_reference_of_instructor_and_assignment_to_duties.rb&lt;br /&gt;
  '''In this file, we have adding foreign key reference of ''assignment id'' into ''duties table''.'''&lt;br /&gt;
&lt;br /&gt;
*      db/migrate/add_duties_to_users.rb&lt;br /&gt;
  '''In this file, a column named ''duties'' is added to the ''Users'' table'''&lt;br /&gt;
&lt;br /&gt;
*      db/migrate/add_multiple_duties_to_assignments.rb&lt;br /&gt;
  '''In this file, we have added a column ''allow_multiple_duties'' to ''assignments'' table'''&lt;br /&gt;
&lt;br /&gt;
*      db/migrate/create_assignment_duty_questionnaire_mapping.rb&lt;br /&gt;
  '''In this file, we have created ''assignment_duty_questionnaire_mappings'' table and added columns for ''questionnaire_id'', ''assignment_id'' and ''duty_id''&lt;br /&gt;
'''&lt;br /&gt;
&lt;br /&gt;
===Files that have to be modified===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*	app/views/assignments/edit/review_strategy.html.erb&lt;br /&gt;
 '''In this file, a checkbox is added to permit role based review.&amp;lt;br&amp;gt;A hidden checkbox is added to allow multiple students to have the same role and hidden fields for adding duties along with a dropdown box for selecting from existing duties.'''&lt;br /&gt;
 &lt;br /&gt;
[[File:review_strat_1818.png]]&lt;br /&gt;
&lt;br /&gt;
 '''A java script function is added which removes the hidden attributes from for the above stated entries once the checkbox is selected.'''&lt;br /&gt;
 &lt;br /&gt;
[[File:hidden2_1818.png]]&lt;br /&gt;
&lt;br /&gt;
*      app/views/assignments/edit/rubrics.html.erb&lt;br /&gt;
 '''In this file , a conditional statement is added, which displays the dropdown for selecting duties for teammate review from the duties for an assignment &amp;lt;br&amp;gt;if role based reviewing is permitted or else the standard view is displayed.'''&lt;br /&gt;
&lt;br /&gt;
[[File:rubrics_1818.png]]&lt;br /&gt;
&lt;br /&gt;
*	app/controllers/student_teams/student_teams_controller.rb&lt;br /&gt;
 '''In this file, a variable is set that extracts from Assignments table if the role based reviewing is enabled or not. &amp;lt;br&amp;gt;This variable is then used as a condition to display the various duties available for selection and also to display the particular duty chosen by the student.'''&lt;br /&gt;
        &lt;br /&gt;
*	app/views/student_teams/view.html.erb&lt;br /&gt;
 ''' In this file, a conditional statement is added which redirects to a new page and displays the radio buttons of all the available duties if role based reviewing is allowed.&amp;lt;br&amp;gt; If not, the standard view is displayed.''' &lt;br /&gt;
[[File:Student_view_1_1818.png]]&lt;br /&gt;
&lt;br /&gt;
*      app/controllers/response_controller.rb&lt;br /&gt;
 '''In this file, the new_feedback function will be edited to map the team-mate review questionnaires according to the duties created.'''&lt;br /&gt;
&lt;br /&gt;
*	app/questionnaire/new.html.erb&lt;br /&gt;
 '''A new questionnaire will be created for each new duty created or the same questionnaire can be used.'''&lt;br /&gt;
&lt;br /&gt;
*	app/questionnaire/edit.html.erb&lt;br /&gt;
 '''A newly created questionnaire for a particular duty can be edited.'''&lt;br /&gt;
&lt;br /&gt;
*       app/views/duties/_form.html.erb&lt;br /&gt;
 '''In this file we are creating a new duty and saving the assignment id and instructor id to the Duty table''' &lt;br /&gt;
    [[File:duties_1818_1.png]]&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
*	Instructor tests&lt;br /&gt;
**	While creating an assignment, in the Review Strategy tab, check the box for role based reviewing and expect the 'role_based_review' column of Assignments table to be true.&lt;br /&gt;
  [[File:Test1_1818.jpg]]&lt;br /&gt;
**      Ability to add new duties from the Review Strategy tab. Click on 'Add Duty' and get redirected to a new page where there is the option of adding a name for duty in the text-box and click 'Create Duty'. This new added duty will now be displayed in the Review Strategy tab if the role-based-review option is selected.&lt;br /&gt;
  [[File:Test2_1818.jpg]]&lt;br /&gt;
**	Select from already existing and newly added duties for a particular assignment. After saving, the changes should be reflected in the database 'AssignmentsDutyMapping' table.&lt;br /&gt;
  [[File:Test3_1818.jpg]]&lt;br /&gt;
*	Student(team member) tests&lt;br /&gt;
**	When a student visits 'Your Team' link, if the option of role based review is selected while creating the assignment, a link 'Select' should appear which enables the student to select the duty.&lt;br /&gt;
  [[File:Test4_1818.jpg]]&lt;br /&gt;
**	In the 'Your Team' tab, after clicking the 'Select' link, the student should be able to select one duty (radio button). This selected duty should now be visible on the 'Your Team' page.&lt;br /&gt;
  [[File:Test5_1818.jpg]]&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
*       [http://wiki.expertiza.ncsu.edu/index.php/Main_Page Main Page Expertiza] &lt;br /&gt;
*       [https://github.com/expertiza/expertiza/pull/1181 Github Pull Request] &lt;br /&gt;
*       [http://www.example.com Youtube Screencast]&lt;/div&gt;</summary>
		<author><name>Bjain</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2018-_Project_E1818:_Role-based_reviewing&amp;diff=117422</id>
		<title>CSC/ECE 517 Spring 2018- Project E1818: Role-based reviewing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2018-_Project_E1818:_Role-based_reviewing&amp;diff=117422"/>
		<updated>2018-05-04T15:22:49Z</updated>

		<summary type="html">&lt;p&gt;Bjain: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
&lt;br /&gt;
The project is created to enable role-based team-mate reviews. These roles can be better named as duties, corresponding to the duty of a team member in a particular project. Borrowing from different Agile methodologies like SCRUM, each team member has a particular role for example: architect,facilitator and implementer.A much more meaningful review can be done if the review rubric was duty-specific. Currently, there is a generic teammate review rubric for all assignments. This means that some review questions are not applicable for all team members. For instance, if there is a question “What percentage of the code was written by this member?” This may not be applicable for the team member who wrote tests or documentation.Similarly, design document specific questions may not be applicable to other members.The instructor should be able to use a different team-mate review rubrics for evaluating the contribution of students depending on their duty.&lt;br /&gt;
&lt;br /&gt;
==UML Diagram==&lt;br /&gt;
&lt;br /&gt;
[[File:Uml 1818.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a UML Class diagram, The relationships depicted above are as follows: &lt;br /&gt;
&lt;br /&gt;
* Between the User and Duty class, there is a bidirectional association. The user table is used for both the instructor and the student. &lt;br /&gt;
** Each instructor can have multiple roles that he can choose from for a particular assignment/questionnaire.&lt;br /&gt;
** Each student can have 0 or 1 role for a particular project.&lt;br /&gt;
* For each Questionnaire instance, there are one or more Questions that can be stored, hence there is an aggregation relationship from Question to Questionnaire. This is for the grading rubric based on the role.&lt;br /&gt;
* The Question table and the Questionnaire table each will be using the the duty ID to sort out questions for a particular assignment.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
The project introduces changes from the instructor view and the student view. The changes are as follow:&lt;br /&gt;
&lt;br /&gt;
===Migration changes===&lt;br /&gt;
*     Create Duties table: This table stores all the duties created by any instructor.&lt;br /&gt;
               * id - The duty ID will be used by other tables like the questionnaire table and hence will be the primary key.&lt;br /&gt;
               * assignment_id - An assignment has particular duties. Thus, the assignment number will be the foreign key for the Duties table. &lt;br /&gt;
               * instructor_id - The Duties created by one Instructor should be visible and reusable by that instructor only. Thus, the instructor id will also be a foreign key in the Duties table.&lt;br /&gt;
&lt;br /&gt;
*       Create assignments_duty_mappings table: If an instructor wants to add multiple duties for an assignment, storing it in the duty table will cause the duty to be overwritten. Thus we have created a table which maps an assignment and all its duties.&lt;br /&gt;
               * id &lt;br /&gt;
               * assignment_id &lt;br /&gt;
               * duty_id&lt;br /&gt;
&lt;br /&gt;
*       Create assignment_duty_questionnaire_mappings table : This table is created to store the questionnaire for team-mate review rubrics and the corresponding duty id. &lt;br /&gt;
               * id &lt;br /&gt;
               * assignment_id &lt;br /&gt;
               * duty_id&lt;br /&gt;
               * questionnaire_id&lt;br /&gt;
&lt;br /&gt;
*       Added a column entry named &amp;quot;role_based_assignment&amp;quot; in the assignments table which would be of type boolean. This field saves the status of the role based review check box.&lt;br /&gt;
*       Added a column entry named &amp;quot;allow_multiple_duties&amp;quot; in the assignments table which would be of type boolean. This field saves the status of the check box for allowing multiple students with the same role. &lt;br /&gt;
*       Added a column entry named &amp;quot;Duties&amp;quot; to the Users table of type string. This field saves the duty that a student would select if role based reviews are enabled.&lt;br /&gt;
&lt;br /&gt;
===Instructor view changes===&lt;br /&gt;
*	For a particular assignment, in the 'Review Strategy' tab of edit assignment, a check box called &amp;quot;Allow role based review?&amp;quot; is created. This allows an instructor to enable a role based team-mate review for a particular assignment. &lt;br /&gt;
[[File:Instructor_1_1818.png]]&lt;br /&gt;
*      When the check box is ticked, the hidden fields become visible. This includes the duties that have been already added, displayed in a drop-down. Also, a button &amp;quot;New duty&amp;quot; pops up. This takes us to the create method of Duties controller where an instructor can add new duties. &lt;br /&gt;
[[File:Instructor_2_1818.png]]&lt;br /&gt;
&lt;br /&gt;
*      In order to display the hidden fields, We call the java script function ''dutiesAssign()'' using the ''ischecked'' listener. The function queries the checkbox variable for ''role_based_review'' and depending its value(true or false), the hidden attributes i.e. ''duties_dropdown'' are displayed or kept hidden.&lt;br /&gt;
[[File:Instructor_3_1818.png]]&lt;br /&gt;
*      The instructor can select from the dropdown of duties. We have allowed multiple duties to be selected at once.The duties created by an instructor are unique for that instructor and are not displayed for any other instructor.&lt;br /&gt;
[[File:Instructor_4_1818.png]]&lt;br /&gt;
*      An instructor can decide the number of duties for a particular assignment. &lt;br /&gt;
*      When the assignment is saved, the duty_id is saved to the assignment_duty_mappings table and thus it is associated with that assignment. &lt;br /&gt;
*      The instructor can create Team-mate review Questionnaires for the different duties he created or can use any from the existing list of questionnaires.&lt;br /&gt;
[[File:Instructor_5_1818.png]] &lt;br /&gt;
*      In order to do this, the instructor has to go to the Rubrics tab of edit assignment. There, if the assignment is role-based, a drop down menu displays the list of all the duties selected for an assignment.&lt;br /&gt;
[[File:Instructor_6_1818.png]]&lt;br /&gt;
*      When the assignment is saved, the questionnaire_id is stored in the assignment_duty_questionnaire_mappings table. This is later used while displaying team-mate review questionnaire to students.&lt;br /&gt;
&lt;br /&gt;
===Student view changes=== &lt;br /&gt;
*       When a student goes to “Your team”,  they can see the team members, their selected duties and the option to review if these are enabled. Students will either see &amp;quot;Review&amp;quot; link to start the teammate review or a message that says that &amp;quot;Teammate has not selected a duty.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[File:student_1_1818.jpg]]&lt;br /&gt;
&lt;br /&gt;
*	The student can select their duty from a particular set of duties created by the instructor for that particular assignment. Upon clicking &amp;quot;Select&amp;quot; option in the Duty column, they are redirected to a new page where all the duties appear as radio-buttons and the student can select one of these. This occurs only if role based reviewing is permitted for that particular assignment. If not, the existing view will be displayed which does not give any such option.&lt;br /&gt;
&lt;br /&gt;
[[File:student_2_1818.jpg]]&lt;br /&gt;
&lt;br /&gt;
*  The logic for this is implemented in the 'student_teams' controller and view. This is enclosed in a conditional which only appears if role based reviewing is permitted. &lt;br /&gt;
&lt;br /&gt;
[[File:student_3_1818.jpg]]&lt;br /&gt;
&lt;br /&gt;
*	A student can only select one duty.&lt;br /&gt;
*	A team member cannot change their role after the assignment submission deadline.&lt;br /&gt;
*      When a student selects a particular duty , it is stored in the database table of that user. Thus when a team-mate reviews that student , they will see a questionnaire corresponding to the duty of that student. This would enable reviews of the teammates to be accurate and specific to their role in a project.&lt;br /&gt;
*      After the teammate review questionnaire is opened once, 'View' and 'Edit' links are shown which redirect the user to view/edit the appropriate last saved response.&lt;br /&gt;
&lt;br /&gt;
==Files changes==&lt;br /&gt;
&lt;br /&gt;
===New files===&lt;br /&gt;
Some of the new migration files we have created are&lt;br /&gt;
&lt;br /&gt;
*      db/migrate/add_duties_table.rb&lt;br /&gt;
 '''In this file, a ''duties'' table is created with a name field&lt;br /&gt;
'''&lt;br /&gt;
*      db/migrate/add_reference_of_instructor_and_assignment_to_duties.rb&lt;br /&gt;
  '''In this file, we have adding foreign key reference of ''assignment id'' into ''duties table''.'''&lt;br /&gt;
&lt;br /&gt;
*      db/migrate/add_duties_to_users.rb&lt;br /&gt;
  '''In this file, a column named ''duties'' is added to the ''Users'' table'''&lt;br /&gt;
&lt;br /&gt;
*      db/migrate/add_multiple_duties_to_assignments.rb&lt;br /&gt;
  '''In this file, we have added a column ''allow_multiple_duties'' to ''assignments'' table'''&lt;br /&gt;
&lt;br /&gt;
*      db/migrate/create_assignment_duty_questionnaire_mapping.rb&lt;br /&gt;
  '''In this file, we have created ''assignment_duty_questionnaire_mappings'' table and added columns for ''questionnaire_id'', ''assignment_id'' and ''duty_id''&lt;br /&gt;
'''&lt;br /&gt;
&lt;br /&gt;
===Files that have to be modified===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*	app/views/assignments/edit/review_strategy.html.erb&lt;br /&gt;
 '''In this file, a checkbox is added to permit role based review.&amp;lt;br&amp;gt;A hidden checkbox is added to allow multiple students to have the same role and hidden fields for adding duties along with a dropdown box for selecting from existing duties.'''&lt;br /&gt;
 &lt;br /&gt;
[[File:review_strat_1818.png]]&lt;br /&gt;
&lt;br /&gt;
 '''A java script function is added which removes the hidden attributes from for the above stated entries once the checkbox is selected.'''&lt;br /&gt;
 &lt;br /&gt;
[[File:hidden2_1818.png]]&lt;br /&gt;
&lt;br /&gt;
*      app/views/assignments/edit/rubrics.html.erb&lt;br /&gt;
 '''In this file , a conditional statement is added, which displays the dropdown for selecting duties for teammate review from the duties for an assignment &amp;lt;br&amp;gt;if role based reviewing is permitted or else the standard view is displayed.'''&lt;br /&gt;
&lt;br /&gt;
[[File:rubrics_1818.png]]&lt;br /&gt;
&lt;br /&gt;
*	app/controllers/student_teams/student_teams_controller.rb&lt;br /&gt;
 '''In this file, a variable is set that extracts from Assignments table if the role based reviewing is enabled or not. &amp;lt;br&amp;gt;This variable is then used as a condition to display the various duties available for selection and also to display the particular duty chosen by the student.'''&lt;br /&gt;
        &lt;br /&gt;
*	app/views/student_teams/view.html.erb&lt;br /&gt;
 ''' In this file, a conditional statement is added which redirects to a new page and displays the radio buttons of all the available duties if role based reviewing is allowed.&amp;lt;br&amp;gt; If not, the standard view is displayed.''' &lt;br /&gt;
[[File:Student_view_1_1818.png]]&lt;br /&gt;
&lt;br /&gt;
*      app/controllers/response_controller.rb&lt;br /&gt;
 '''In this file, the new_feedback function will be edited to map the team-mate review questionnaires according to the duties created.'''&lt;br /&gt;
&lt;br /&gt;
*	app/questionnaire/new.html.erb&lt;br /&gt;
 '''A new questionnaire will be created for each new duty created or the same questionnaire can be used.'''&lt;br /&gt;
&lt;br /&gt;
*	app/questionnaire/edit.html.erb&lt;br /&gt;
 '''A newly created questionnaire for a particular duty can be edited.'''&lt;br /&gt;
&lt;br /&gt;
*       app/views/duties/_form.html.erb&lt;br /&gt;
 '''In this file we are creating a new duty and saving the assignment id and instructor id to the Duty table''' &lt;br /&gt;
    [[File:duties_1818_1.png]]&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
*	Instructor tests&lt;br /&gt;
**	While creating an assignment, in the Review Strategy tab, check the box for role based reviewing and expect the 'role_based_review' column of Assignments table to be true.&lt;br /&gt;
[[File:Test1_1818.jpg]]&lt;br /&gt;
**      Ability to add new duties from the Review Strategy tab. Click on 'Add Duty' and get redirected to a new page where there is the option of adding a name for duty in the text-box and click 'Create Duty'. This new added duty will now be displayed in the Review Strategy tab if the role-based-review option is selected.&lt;br /&gt;
[[File:Test2_1818.jpg]]&lt;br /&gt;
**	Select from already existing and newly added duties for a particular assignment. After saving, the changes should be reflected in the database 'AssignmentsDutyMapping' table.&lt;br /&gt;
[[File:Test3_1818.jpg]]&lt;br /&gt;
*	Student(team member) tests&lt;br /&gt;
**	When a student visits 'Your Team' link, if the option of role based review is selected while creating the assignment, a link 'Select' should appear which enables the student to select the duty.&lt;br /&gt;
[[File:Test4_1818.jpg]]&lt;br /&gt;
**	In the 'Your Team' tab, after clicking the 'Select' link, the student should be able to select one duty (radio button). This selected duty should now be visible on the 'Your Team' page.&lt;br /&gt;
[[File:Test5_1818.jpg]]&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
*       [http://wiki.expertiza.ncsu.edu/index.php/Main_Page Main Page Expertiza] &lt;br /&gt;
*       [https://github.com/expertiza/expertiza/pull/1181 Github Pull Request] &lt;br /&gt;
*       [http://www.example.com Youtube Screencast]&lt;/div&gt;</summary>
		<author><name>Bjain</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Test5_1818.jpg&amp;diff=117420</id>
		<title>File:Test5 1818.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Test5_1818.jpg&amp;diff=117420"/>
		<updated>2018-05-04T15:21:41Z</updated>

		<summary type="html">&lt;p&gt;Bjain: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Bjain</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Test4_1818.jpg&amp;diff=117419</id>
		<title>File:Test4 1818.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Test4_1818.jpg&amp;diff=117419"/>
		<updated>2018-05-04T15:21:07Z</updated>

		<summary type="html">&lt;p&gt;Bjain: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Bjain</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Test3_1818.jpg&amp;diff=117418</id>
		<title>File:Test3 1818.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Test3_1818.jpg&amp;diff=117418"/>
		<updated>2018-05-04T15:20:47Z</updated>

		<summary type="html">&lt;p&gt;Bjain: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Bjain</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Test2_1818.jpg&amp;diff=117417</id>
		<title>File:Test2 1818.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Test2_1818.jpg&amp;diff=117417"/>
		<updated>2018-05-04T15:20:30Z</updated>

		<summary type="html">&lt;p&gt;Bjain: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Bjain</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Test1_1818.jpg&amp;diff=117416</id>
		<title>File:Test1 1818.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Test1_1818.jpg&amp;diff=117416"/>
		<updated>2018-05-04T15:19:53Z</updated>

		<summary type="html">&lt;p&gt;Bjain: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Bjain</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2018-_Project_E1818:_Role-based_reviewing&amp;diff=117410</id>
		<title>CSC/ECE 517 Spring 2018- Project E1818: Role-based reviewing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2018-_Project_E1818:_Role-based_reviewing&amp;diff=117410"/>
		<updated>2018-05-04T15:11:21Z</updated>

		<summary type="html">&lt;p&gt;Bjain: /* Test Plan */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
&lt;br /&gt;
The project is created to enable role-based team-mate reviews. These roles can be better named as duties, corresponding to the duty of a team member in a particular project. Borrowing from different Agile methodologies like SCRUM, each team member has a particular role for example: architect,facilitator and implementer.A much more meaningful review can be done if the review rubric was duty-specific. Currently, there is a generic teammate review rubric for all assignments. This means that some review questions are not applicable for all team members. For instance, if there is a question “What percentage of the code was written by this member?” This may not be applicable for the team member who wrote tests or documentation.Similarly, design document specific questions may not be applicable to other members.The instructor should be able to use a different team-mate review rubrics for evaluating the contribution of students depending on their duty.&lt;br /&gt;
&lt;br /&gt;
==UML Diagram==&lt;br /&gt;
&lt;br /&gt;
[[File:Uml2.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a UML Class diagram, The relationships depicted above are as follows: &lt;br /&gt;
&lt;br /&gt;
* Between the User and Duty class, there is a bidirectional association. The user table is used for both the instructor and the student. &lt;br /&gt;
** Each instructor can have multiple roles that he can choose from for a particular assignment/questionnaire.&lt;br /&gt;
** Each student can have 0 or 1 role for a particular project.&lt;br /&gt;
* For each Questionnaire instance, there are one or more Questions that can be stored, hence there is an aggregation relationship from Question to Questionnaire. This is for the grading rubric based on the role.&lt;br /&gt;
* The Question table and the Questionnaire table each will be using the the duty ID to sort out questions for a particular assignment.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
The project introduces changes from the instructor view and the student view. The changes are as follow:&lt;br /&gt;
&lt;br /&gt;
===Migration changes===&lt;br /&gt;
*     Create Duties table: This table stores all the duties created by any instructor.&lt;br /&gt;
               * id - The duty ID will be used by other tables like the questionnaire table and hence will be the primary key.&lt;br /&gt;
               * assignment_id - An assignment has particular duties. Thus, the assignment number will be the foreign key for the Duties table. &lt;br /&gt;
               * instructor_id - The Duties created by one Instructor should be visible and reusable by that instructor only. Thus, the instructor id will also be a foreign key in the Duties table.&lt;br /&gt;
&lt;br /&gt;
*       Create assignments_duty_mappings table: If an instructor wants to add multiple duties for an assignment, storing it in the duty table will cause the duty to be overwritten. Thus we have created a table which maps an assignment and all its duties.&lt;br /&gt;
               * id &lt;br /&gt;
               * assignment_id &lt;br /&gt;
               * duty_id&lt;br /&gt;
&lt;br /&gt;
*       Create assignment_duty_questionnaire_mappings table : This table is created to store the questionnaire for team-mate review rubrics and the corresponding duty id. &lt;br /&gt;
               * id &lt;br /&gt;
               * assignment_id &lt;br /&gt;
               * duty_id&lt;br /&gt;
               * questionnaire_id&lt;br /&gt;
&lt;br /&gt;
*       Added a column entry named &amp;quot;role_based_assignment&amp;quot; in the assignments table which would be of type boolean. This field saves the status of the role based review check box.&lt;br /&gt;
*       Added a column entry named &amp;quot;allow_multiple_duties&amp;quot; in the assignments table which would be of type boolean. This field saves the status of the check box for allowing multiple students with the same role. &lt;br /&gt;
*       Added a column entry named &amp;quot;Duties&amp;quot; to the Users table of type string. This field saves the duty that a student would select if role based reviews are enabled.&lt;br /&gt;
&lt;br /&gt;
===Instructor view changes===&lt;br /&gt;
*	For a particular assignment, in the 'Review Strategy' tab of edit assignment, a check box called &amp;quot;Allow role based review?&amp;quot; is created. This allows an instructor to enable a role based team-mate review for a particular assignment. &lt;br /&gt;
[[File:Instructor_1_1818.png]]&lt;br /&gt;
*      When the check box is ticked, the hidden fields become visible. This includes the duties that have been already added, displayed in a drop-down. Also, a button &amp;quot;New duty&amp;quot; pops up. This takes us to the create method of Duties controller where an instructor can add new duties. &lt;br /&gt;
[[File:Instructor_2_1818.png]]&lt;br /&gt;
&lt;br /&gt;
*      In order to display the hidden fields, We call the java script function ''dutiesAssign()'' using the ''ischecked'' listener. The function queries the checkbox variable for ''role_based_review'' and depending its value(true or false), the hidden attributes i.e. ''allow_multiple_duties'' and ''duties_dropdown'' are displayed or kept hidden.&lt;br /&gt;
[[File:Instructor_3_1818.png]]&lt;br /&gt;
*      The instructor can select from the dropdown of duties. We have allowed multiple duties to be selected at once.The duties created by an instructor are unique for that instructor and are not displayed for any other instructor.&lt;br /&gt;
[[File:Instructor_4_1818.png]]&lt;br /&gt;
*      An instructor can decide the number of duties for a particular assignment. We have included a field for ''Allow multiple duties'' but not used it as we have the default case that one duty can be taken by multiple students. Work can be done in the future to allow the instructor to choose if students can take multiple duties.&lt;br /&gt;
*      When the assignment is saved, the duty_id is saved to the assignment_duty_mappings table and thus it is associated with that assignment. &lt;br /&gt;
*      The instructor can create Team-mate review Questionnaires for the different duties he created or can use any from the existing list of questionnaires.&lt;br /&gt;
[[File:Instructor_5_1818.png]] &lt;br /&gt;
*      In order to do this, the instructor has to go to the Rubrics tab of edit assignment. There, if the assignment is role-based, a drop down menu displays the list of all the duties selected for an assignment.&lt;br /&gt;
[[File:Instructor_6_1818.png]]&lt;br /&gt;
*      When the assignment is saved, the questionnaire_id is stored in the assignment_duty_questionnaire_mappings table. This is later used while displaying team-mate review questionnaire to students.&lt;br /&gt;
&lt;br /&gt;
===Student view changes=== &lt;br /&gt;
*       When a student goes to “Your team”,  they can see the team members, their selected duties and the option to review if these are enabled. Students will either see &amp;quot;Review&amp;quot; link to start the teammate review or a message that says that &amp;quot;Teammate has not selected a duty.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[File:student_1_1818.jpg]]&lt;br /&gt;
&lt;br /&gt;
*	The student can select their duty from a particular set of duties created by the instructor for that particular assignment. Upon clicking &amp;quot;Select&amp;quot; option in the Duty column, they are redirected to a new page where all the duties appear as radio-buttons and the student can select one of these. This occurs only if role based reviewing is permitted for that particular assignment. If not, the existing view will be displayed which does not give any such option.&lt;br /&gt;
&lt;br /&gt;
[[File:student_2_1818.jpg]]&lt;br /&gt;
&lt;br /&gt;
*  The logic for this is implemented in the 'student_teams' controller and view. This is enclosed in a conditional which only appears if role based reviewing is permitted. &lt;br /&gt;
&lt;br /&gt;
[[File:student_3_1818.jpg]]&lt;br /&gt;
&lt;br /&gt;
*	A student can only select one duty.&lt;br /&gt;
*	A team member cannot change their role after the assignment submission deadline.&lt;br /&gt;
*      When a student selects a particular duty , it is stored in the database table of that user. Thus when a team-mate reviews that student , they will see a questionnaire corresponding to the duty of that student. This would enable reviews of the teammates to be accurate and specific to their role in a project.&lt;br /&gt;
*      After the teammate review questionnaire is opened once, 'View' and 'Edit' links are shown which redirect the user to view/edit the appropriate last saved response.&lt;br /&gt;
&lt;br /&gt;
==Files changes==&lt;br /&gt;
&lt;br /&gt;
===New files===&lt;br /&gt;
Some of the new migration files we have created are&lt;br /&gt;
&lt;br /&gt;
*      '''db/migrate/add_duties_table.rb&lt;br /&gt;
 In this file, a ''duties'' table is created with a name field'''&lt;br /&gt;
&lt;br /&gt;
*      '''db/migrate/add_reference_of_instructor_and_assignment_to_duties.rb&lt;br /&gt;
  In this file, we have adding foreign key reference of ''assignment id'' into ''duties table''.'''&lt;br /&gt;
&lt;br /&gt;
*      '''db/migrate/add_duties_to_users.rb&lt;br /&gt;
  In this file, a column named ''duties'' is added to the ''Users'' table'''&lt;br /&gt;
&lt;br /&gt;
*     ''' db/migrate/add_multiple_duties_to_assignments.rb&lt;br /&gt;
  In this file, we have added a column ''allow_multiple_duties'' to ''assignments'' table'''&lt;br /&gt;
&lt;br /&gt;
*      '''db/migrate/create_assignment_duty_questionnaire_mapping.rb&lt;br /&gt;
  In this file, we have created ''assignment_duty_questionnaire_mappings'' table and added columns for ''questionnaire_id'', ''assignment_id'' and ''duty_id''&lt;br /&gt;
'''&lt;br /&gt;
&lt;br /&gt;
===Files that have to be modified===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*	app/views/assignments/edit/review_strategy.html.erb&lt;br /&gt;
 '''In this file, a checkbox is added to permit role based review.&amp;lt;br&amp;gt;A hidden checkbox is added to allow multiple students to have the same role and hidden fields for adding duties along with a dropdown box for selecting from existing duties.'''&lt;br /&gt;
 &lt;br /&gt;
[[File:review_strat_1818.png]]&lt;br /&gt;
&lt;br /&gt;
 '''A java script function is added which removes the hidden attributes from for the above stated entries once the checkbox is selected.'''&lt;br /&gt;
 &lt;br /&gt;
[[File:hidden2_1818.png]]&lt;br /&gt;
&lt;br /&gt;
*      app/views/assignments/edit/rubrics.html.erb&lt;br /&gt;
 '''In this file , a conditional statement is added, which displays the dropdown for selecting duties for teammate review from the duties for an assignment &amp;lt;br&amp;gt;if role based reviewing is permitted or else the standard view is displayed.'''&lt;br /&gt;
&lt;br /&gt;
[[File:rubrics_1818.png]]&lt;br /&gt;
&lt;br /&gt;
*	app/controllers/student_teams/student_teams_controller.rb&lt;br /&gt;
 '''In this file, a variable is set that extracts from Assignments table if the role based reviewing is enabled or not. &amp;lt;br&amp;gt;This variable is then used as a condition to display the various duties available for selection and also to display the particular duty chosen by the student.'''&lt;br /&gt;
        &lt;br /&gt;
*	app/views/student_teams/view.html.erb&lt;br /&gt;
 ''' In this file, a conditional statement is added which redirects to a new page and displays the radio buttons of all the available duties if role based reviewing is allowed.&amp;lt;br&amp;gt; If not, the standard view is displayed.''' &lt;br /&gt;
[[File:Student_view_1_1818.png]]&lt;br /&gt;
&lt;br /&gt;
*      app/controllers/response_controller.rb&lt;br /&gt;
 '''In this file, the new_feedback function will be edited to map the team-mate review questionnaires according to the duties created.'''&lt;br /&gt;
&lt;br /&gt;
*	app/questionnaire/new.html.erb&lt;br /&gt;
 '''A new questionnaire will be created for each new duty created or the same questionnaire can be used.'''&lt;br /&gt;
&lt;br /&gt;
*	app/questionnaire/edit.html.erb&lt;br /&gt;
 '''A newly created questionnaire for a particular duty can be edited.'''&lt;br /&gt;
&lt;br /&gt;
*       app/views/duties/_form.html.erb&lt;br /&gt;
 '''In this file we are creating a new duty and saving the assignment id and instructor id to the Duty table''' &lt;br /&gt;
    [[File:duties_1818_1.png]]&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
*	Instructor tests&lt;br /&gt;
**	While creating an assignment, in the Review Strategy tab, check the box for role based reviewing and expect the 'role_based_review' column of Assignments table to be true.&lt;br /&gt;
**      Ability to add new duties from the Review Strategy tab. Click on 'Add Duty' and get redirected to a new page where there is the option of adding a name for duty in the text-box and click 'Create Duty'. This new added duty will now be displayed in the Review Strategy tab if the role-based-review option is selected.&lt;br /&gt;
**	Select from already existing and newly added duties for a particular assignment. After saving, the changes should be reflected in the database 'AssignmentsDutyMapping' table.&lt;br /&gt;
&lt;br /&gt;
*	Student(team member) tests&lt;br /&gt;
**	When a student visits 'Your Team' link, if the option of role based review is selected while creating the assignment, a link 'Select' should appear which enables the student to select the duty.&lt;br /&gt;
**	In the 'Your Team' tab, after clicking the 'Select' link, the student should be able to select one duty (radio button). This selected duty should now be visible on the 'Your Team' page.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
*       [http://wiki.expertiza.ncsu.edu/index.php/Main_Page Main Page Expertiza] &lt;br /&gt;
*       [https://github.com/expertiza/expertiza/pull/1181 Github Pull Request] &lt;br /&gt;
*       [http://www.example.com Youtube Screencast]&lt;/div&gt;</summary>
		<author><name>Bjain</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2018-_Project_E1818:_Role-based_reviewing&amp;diff=117334</id>
		<title>CSC/ECE 517 Spring 2018- Project E1818: Role-based reviewing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2018-_Project_E1818:_Role-based_reviewing&amp;diff=117334"/>
		<updated>2018-05-03T07:26:29Z</updated>

		<summary type="html">&lt;p&gt;Bjain: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
&lt;br /&gt;
The project is to enable role-based team-mate reviews. These roles can be better named as duties, corresponding to the duty of a team member in a particular project. The instructor should be able to use a different rubric for evaluating the contribution of team mates with different roles.&lt;br /&gt;
Borrowing from different Agile methodologies like SCRUM, each team member has a particular role. For example,architect,facilitator and implementer. Although one member can contribute to other duties, a much more meaningful review can be done if the review rubric was role-specific. Currently, there is a single teammate review rubric for each assignment. This means that some review questions are not applicable for all team members. For instance, if there is a question which says “What percentage of the code was written by this member?” This may not be applicable for the team member who wrote tests or documentation.&lt;br /&gt;
&lt;br /&gt;
==UML Diagram==&lt;br /&gt;
&lt;br /&gt;
[[File:Uml2.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a UML Class diagram, The relationships depicted above are as follows: &lt;br /&gt;
&lt;br /&gt;
* Between the User and Duty class, there is a bidirectional association. The user table is used for both the instructor and the student. &lt;br /&gt;
** Each instructor can have multiple roles that he can choose from for a particular assignment/questionnaire.&lt;br /&gt;
** Each student can have 0 or 1 role for a particular project.&lt;br /&gt;
* For each Questionnaire instance, there are one or more Questions that can be stored, hence there is an aggregation relationship from Question to Questionnaire. This is for the grading rubric based on the role.&lt;br /&gt;
* The Question table and the Questionnaire table each will be using the the duty ID to sort out questions for a particular assignment.&lt;br /&gt;
&lt;br /&gt;
==Proposed Implementation==&lt;br /&gt;
&lt;br /&gt;
The project introduces changes from the instructor view and the student view. The steps for implementation are as follow:&lt;br /&gt;
&lt;br /&gt;
===Migration changes===&lt;br /&gt;
* .    Create Duties table: This table stores all the duties created by any instructor.&lt;br /&gt;
               * id - The duty ID will be used by other tables like the questionnaire table and hence will be the primary key.&lt;br /&gt;
               * assignment_id - An assignment has particular duties. Thus, the assignment number will be the foreign key for the Duties table. &lt;br /&gt;
               * instructor_id - The Duties created by one Instructor should be visible and reusable by that instructor only. Thus, the instructor id will also be a foreign key in the Duties table.&lt;br /&gt;
&lt;br /&gt;
*      Create assignments_duty_mappings table: If an instructor wants to add multiple duties for an assignment, storing it in the duty table will cause the duty to be overwritten. Thus we have created a table which maps an assignment and all its duties.&lt;br /&gt;
               * id &lt;br /&gt;
               * assignment_id &lt;br /&gt;
               * duty_id&lt;br /&gt;
&lt;br /&gt;
*      Create assignment_duty_questionnaire_mappings table : This table is created to store the questionnaire for team-mate review rubrics and the corresponding duty id. &lt;br /&gt;
               * id &lt;br /&gt;
               * assignment_id &lt;br /&gt;
               * duty_id&lt;br /&gt;
               * questionnaire_id&lt;br /&gt;
&lt;br /&gt;
*      Add a column entry named &amp;quot;role_based_assignment&amp;quot; in the assignments table which would be of type boolean. This field would save the status of the role based review check box.&lt;br /&gt;
*      Add a column entry named &amp;quot;allow_multiple_duties&amp;quot; in the assignments table which would be of type boolean. This field would save the status of the check box for allowing multiple students with the same role.&lt;br /&gt;
*      Add a column entry named &amp;quot;Duties&amp;quot; to the Users table which would be of type string. This field would save the duty that a student would select if role based reviews are permitted.&lt;br /&gt;
&lt;br /&gt;
===Instructor view changes===&lt;br /&gt;
*	For a particular assignment, in the 'Review Strategy' tab edit assignment,create a check box called &amp;quot;Is role based review allowed?&amp;quot; that allows an instructor to add a role based review for a particular assignment or not. This can be done by adding a check box tag in the review strategy sub page of the edit assignments page.&lt;br /&gt;
[[File:e18181_3.png]]&lt;br /&gt;
*      When the check box is ticked, the duties that have been already added and a button to &amp;quot;New duty&amp;quot; pops up. &lt;br /&gt;
[[File:Example_e18181.png]]&lt;br /&gt;
&lt;br /&gt;
*      We call the java script function ''dutiesAssign()'' using the ''ischecked'' listener. The function queries the value of the checkbox for ''role_based_review'' and depending on if the value is true or false, the hidden attributes i.e. ''allow_multiple_duties'' and ''duties_dropdown'' are displayed or kept hidden.&lt;br /&gt;
[[File:e18181_2.png]]&lt;br /&gt;
*      The instructor can select from the dropdown of duties. We have allowed multiple duties to be selected at once.The duties created by an instructor are unique for that instructor and are not displayed for any other instructor.&lt;br /&gt;
[[File:Picture1_e1818.png]]&lt;br /&gt;
*      An instructor can decide the number of duties for a particular assignment, the number of team members who can undertake a particular duty and if any of the duties are optional.  &lt;br /&gt;
*      When the assignment is saved, the duty_id is saved to the assignment_duty_mappings table. &lt;br /&gt;
*      The instructor can create Team-mate review Questionnaires for the different duties he created or can use any from the existing list of questionnaires.&lt;br /&gt;
[[File:Example2_1818.png]] &lt;br /&gt;
*      In order to do this, the instructor has to go to the Rubrics tab of edit assignment. There, if the assignment is role-based, a drop down menu displays the list of all the duties selected for an assignment.&lt;br /&gt;
[[File:Example23_1818.png]]&lt;br /&gt;
*      When the assignment is saved, the questionnaire_id is stored in the assignment_duty_questionnaire_mappings table&lt;br /&gt;
&lt;br /&gt;
===Student view changes=== &lt;br /&gt;
*       When a student goes to “Your team”,  they can see the team members, their selected duties and the option to review if these are enabled. Students will either see &amp;quot;Review&amp;quot; link to start the teammate review or a message that says that &amp;quot;Teammate has not selected a duty.&amp;quot;.&lt;br /&gt;
[[File:rsz_111.jpg]]&lt;br /&gt;
*	The student can select their duty from a particular set of duties created by the instructor for that particular assignment. Upon clicking &amp;quot;Select&amp;quot; option, view is redirected to a new page where all the available duties appear as radio-buttons and the student can select one of these. This occurs only if role based reviewing is permitted for that particular assignment. If not, the standard existing view will be displayed which does not give any such option.&lt;br /&gt;
[[File:E1818_1.jpg]]&lt;br /&gt;
[[File:E1818_3.jpg]]&lt;br /&gt;
*  The logic for this is implemented in the 'student_teams' controller and view. This would be enclosed in a conditional which would only appear if role based reviewing is permitted. &lt;br /&gt;
[[File:E1818_4.jpg]]&lt;br /&gt;
[[File:E1818_5.jpg]]&lt;br /&gt;
*	A student can only select one duty.&lt;br /&gt;
*	A team member cannot change their role after the assignment submission deadline.&lt;br /&gt;
*      When a student selects a particular duty , it is stored in the database table of that user. Thus when a team-mate reviews that student , they will see a questionnaire corresponding to the duty of that student. This would enable reviews of the teammates to be accurate and specific to their role in a project.&lt;br /&gt;
*      After the teammate review questionnaire is opened once, 'View' and 'Edit' links are shown which redirect the user to the appropriate last saved response.&lt;br /&gt;
==Files to be modified==&lt;br /&gt;
&lt;br /&gt;
===New files===&lt;br /&gt;
Some of the new migration files we have created are&lt;br /&gt;
&lt;br /&gt;
*      db/migrate/add_duties_table.rb&lt;br /&gt;
 In this file, a ''duties'' table is created with a name field&lt;br /&gt;
&lt;br /&gt;
*      db/migrate/add_reference_of_instructor_and_assignment_to_duties.rb&lt;br /&gt;
  In this file, we have adding foreign key reference of ''assignment id'' into ''duties table''.&lt;br /&gt;
&lt;br /&gt;
*      db/migrate/add_duties_to_users.rb&lt;br /&gt;
  In this file, a column named ''duties'' is added to the ''Users'' table&lt;br /&gt;
&lt;br /&gt;
*      db/migrate/add_multiple_duties_to_assignments.rb&lt;br /&gt;
  In this file, we have added a column ''allow_multiple_duties'' to ''assignments'' table&lt;br /&gt;
&lt;br /&gt;
*      db/migrate/create_assignment_duty_questionnaire_mapping.rb&lt;br /&gt;
  In this file, we have created ''assignment_duty_questionnaire_mappings'' table and added columns for ''questionnaire_id'', ''assignment_id'' and ''duty_id''&lt;br /&gt;
&lt;br /&gt;
===Files that have to be modified===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*	app/views/assignments/edit/review_strategy.html.erb&lt;br /&gt;
 In this file, a checkbox is added to permit role based review. A hidden checkbox is added to allow multiple students to have the same role and hidden fields for adding duties along with a dropdown box for selecting from existing duties.&lt;br /&gt;
 A javascript function is added which removes the hidden attributes from for the above stated entries once the checkbox is selected.&lt;br /&gt;
 &lt;br /&gt;
*      app/views/assignments/edit/rubrics.html.erb&lt;br /&gt;
 In this file , a conditional statement is added, which displays the dropdown for selecting duties and a dropdown for selecting a teammate review for the selected duties if role based reviewing is permitted or else display the standard view.&lt;br /&gt;
*	app/controllers/student_teams/student_teams_controller.rb&lt;br /&gt;
 In this file, a variable is set that extracts from Assignments table if the role based reviewing is enabled or not. This variable is then used as a condition to display the various duties available for selection and also to display the particular duty chosen by the student.&lt;br /&gt;
        &lt;br /&gt;
*	app/views/student_teams/view.html.erb&lt;br /&gt;
 In this file, a conditional statement is added which redirects to a new page and displays the radio buttons of all the available duties if role based reviewing is allowed. If not, the standard view is displayed. &lt;br /&gt;
*      app/controllers/response_controller.rb&lt;br /&gt;
 In this file, the new_feedback function will be edited to map the team-mate review questionnaires according to the duties created.&lt;br /&gt;
*	app/questionnaire/new.html.erb&lt;br /&gt;
 A new questionnaire will be created for each new duty created or the same questionnaire can be used.&lt;br /&gt;
*	app/questionnaire/edit.html.erb&lt;br /&gt;
 A newly created questionnaire for a particular duty can be edited.&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
*	Instructor tests&lt;br /&gt;
**	Check the box for role based reviewing. &lt;br /&gt;
***	Display and select from already existing roles(duties) with option to create new roles(duties).&lt;br /&gt;
***	Should not be able to see roles(duties) from other instructors.&lt;br /&gt;
***	Select corresponding rubrics for a particular role(duty). &lt;br /&gt;
**      If not, proceed with the default questions for the rubric for the assignment.&lt;br /&gt;
&lt;br /&gt;
*	Student(team member) tests&lt;br /&gt;
**	Before submitting the project, all team members should select a role(duty) for themselves from the roles(duties) set by the instructor.&lt;br /&gt;
**	Multiple students may have the role(duty) but 1 student cannot have multiple roles(duties).&lt;br /&gt;
&lt;br /&gt;
*	Reviewer tests&lt;br /&gt;
**	For the teammate review, only the questions related to the role(duty) selected by the student should appear in the rubric.&lt;/div&gt;</summary>
		<author><name>Bjain</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2018-_Project_E1818:_Role-based_reviewing&amp;diff=117333</id>
		<title>CSC/ECE 517 Spring 2018- Project E1818: Role-based reviewing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2018-_Project_E1818:_Role-based_reviewing&amp;diff=117333"/>
		<updated>2018-05-03T07:19:12Z</updated>

		<summary type="html">&lt;p&gt;Bjain: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
&lt;br /&gt;
The project is to enable role-based team-mate reviews. These roles can be better named as duties, corresponding to the duty of a team member in a particular project. The instructor should be able to use a different rubric for evaluating the contribution of team mates with different roles.&lt;br /&gt;
Borrowing from different Agile methodologies like SCRUM, each team member has a particular role. For example,architect,facilitator and implementer. Although one member can contribute to other duties, a much more meaningful review can be done if the review rubric was role-specific. Currently, there is a single teammate review rubric for each assignment. This means that some review questions are not applicable for all team members. For instance, if there is a question which says “What percentage of the code was written by this member?” This may not be applicable for the team member who wrote tests or documentation.&lt;br /&gt;
&lt;br /&gt;
==UML Diagram==&lt;br /&gt;
&lt;br /&gt;
[[File:Uml2.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a UML Class diagram, The relationships depicted above are as follows: &lt;br /&gt;
&lt;br /&gt;
* Between the User and Duty class, there is a bidirectional association. The user table is used for both the instructor and the student. &lt;br /&gt;
** Each instructor can have multiple roles that he can choose from for a particular assignment/questionnaire.&lt;br /&gt;
** Each student can have 0 or 1 role for a particular project.&lt;br /&gt;
* For each Questionnaire instance, there are one or more Questions that can be stored, hence there is an aggregation relationship from Question to Questionnaire. This is for the grading rubric based on the role.&lt;br /&gt;
* The Question table and the Questionnaire table each will be using the the duty ID to sort out questions for a particular assignment.&lt;br /&gt;
&lt;br /&gt;
==Proposed Implementation==&lt;br /&gt;
&lt;br /&gt;
The project introduces changes from the instructor view and the student view. The steps for implementation are as follow:&lt;br /&gt;
&lt;br /&gt;
===Migration changes===&lt;br /&gt;
* .    Create Duties table: This table stores all the duties created by any instructor.&lt;br /&gt;
               * id - The duty ID will be used by other tables like the questionnaire table and hence will be the primary key.&lt;br /&gt;
               * assignment_id - An assignment has particular duties. Thus, the assignment number will be the foreign key for the Duties table. &lt;br /&gt;
               * instructor_id - The Duties created by one Instructor should be visible and reusable by that instructor only. Thus, the instructor id will also be a foreign key in the Duties table.&lt;br /&gt;
&lt;br /&gt;
*      Create assignments_duty_mappings table: If an instructor wants to add multiple duties for an assignment, storing it in the duty table will cause the duty to be overwritten. Thus we have created a table which maps an assignment and all its duties.&lt;br /&gt;
               * id &lt;br /&gt;
               * assignment_id &lt;br /&gt;
               * duty_id&lt;br /&gt;
&lt;br /&gt;
*      Create assignment_duty_questionnaire_mappings table : This table is created to store the questionnaire for team-mate review rubrics and the corresponding duty id. &lt;br /&gt;
               * id &lt;br /&gt;
               * assignment_id &lt;br /&gt;
               * duty_id&lt;br /&gt;
               * questionnaire_id&lt;br /&gt;
&lt;br /&gt;
*      Add a column entry named &amp;quot;role_based_assignment&amp;quot; in the assignments table which would be of type boolean. This field would save the status of the role based review check box.&lt;br /&gt;
*      Add a column entry named &amp;quot;allow_multiple_duties&amp;quot; in the assignments table which would be of type boolean. This field would save the status of the check box for allowing multiple students with the same role.&lt;br /&gt;
*      Add a column entry named &amp;quot;Duties&amp;quot; to the Users table which would be of type string. This field would save the duty that a student would select if role based reviews are permitted.&lt;br /&gt;
&lt;br /&gt;
===Instructor view changes===&lt;br /&gt;
*	For a particular assignment, in the 'Review Strategy' tab edit assignment,create a check box called &amp;quot;Is role based review allowed?&amp;quot; that allows an instructor to add a role based review for a particular assignment or not. This can be done by adding a check box tag in the review strategy sub page of the edit assignments page.&lt;br /&gt;
[[File:e18181_3.png]]&lt;br /&gt;
*      When the check box is ticked, the duties that have been already added and a button to &amp;quot;New duty&amp;quot; pops up. &lt;br /&gt;
[[File:Example_e18181.png]]&lt;br /&gt;
&lt;br /&gt;
*      We call the java script function ''dutiesAssign()'' using the ''ischecked'' listener. The function queries the value of the checkbox for ''role_based_review'' and depending on if the value is true or false, the hidden attributes i.e. ''allow_multiple_duties'' and ''duties_dropdown'' are displayed or kept hidden.&lt;br /&gt;
[[File:e18181_2.png]]&lt;br /&gt;
*      The instructor can select from the dropdown of duties. We have allowed multiple duties to be selected at once.The duties created by an instructor are unique for that instructor and are not displayed for any other instructor.&lt;br /&gt;
[[File:Picture1_e1818.png]]&lt;br /&gt;
*      An instructor can decide the number of duties for a particular assignment, the number of team members who can undertake a particular duty and if any of the duties are optional.  &lt;br /&gt;
*      When the assignment is saved, the duty_id is saved to the assignment_duty_mappings table. &lt;br /&gt;
*      The instructor can create Team-mate review Questionnaires for the different duties he created or can use any from the existing list of questionnaires.&lt;br /&gt;
[[File:Example2_1818.png]] &lt;br /&gt;
*      In order to do this, the instructor has to go to the Rubrics tab of edit assignment. There, if the assignment is role-based, a drop down menu displays the list of all the duties selected for an assignment.&lt;br /&gt;
[[File:Example23_1818.png]]&lt;br /&gt;
*      When the assignment is saved, the questionnaire_id is stored in the assignment_duty_questionnaire_mappings table&lt;br /&gt;
&lt;br /&gt;
===Student view changes=== &lt;br /&gt;
*       When a student goes to “Your team”,  they can see the team members, their selected duties and the option to review if these are enabled. Students will either see &amp;quot;Review&amp;quot; link to start the teammate review or a message that says that &amp;quot;Teammate has not selected a duty.&amp;quot;.&lt;br /&gt;
[[File:rsz_111.jpg]]&lt;br /&gt;
*	The student can select their duty from a particular set of duties created by the instructor for that particular assignment. Upon clicking &amp;quot;Select&amp;quot; option, view is redirected to a new page where all the available duties appear as radio-buttons and the student can select one of these. This occurs only if role based reviewing is permitted for that particular assignment. If not, the standard existing view will be displayed which does not give any such option.&lt;br /&gt;
[[File:E1818_1.jpg]]&lt;br /&gt;
[[File:E1818_3.jpg]]&lt;br /&gt;
*  The logic for this is implemented in the 'student_teams' controller and view. This would be enclosed in a conditional which would only appear if role based reviewing is permitted. &lt;br /&gt;
[[File:E1818_4.jpg]]&lt;br /&gt;
[[File:E1818_5.jpg]]&lt;br /&gt;
*	A student can only select one duty.&lt;br /&gt;
*	A team member cannot change their role after the assignment submission deadline.&lt;br /&gt;
*      When a student selects a particular duty , it is stored in the database table of that user. Thus when a team-mate reviews that student , they will see a questionnaire corresponding to the duty of that student. This would enable reviews of the teammates to be accurate and specific to their role in a project.&lt;br /&gt;
==Files to be modified==&lt;br /&gt;
&lt;br /&gt;
===New files===&lt;br /&gt;
Some of the new migration files we have created are&lt;br /&gt;
&lt;br /&gt;
*      db/migrate/add_duties_table.rb&lt;br /&gt;
 In this file, a ''duties'' table is created with a name field&lt;br /&gt;
&lt;br /&gt;
*      db/migrate/add_reference_of_instructor_and_assignment_to_duties.rb&lt;br /&gt;
  In this file, we have adding foreign key reference of ''assignment id'' into ''duties table''.&lt;br /&gt;
&lt;br /&gt;
*      db/migrate/add_duties_to_users.rb&lt;br /&gt;
  In this file, a column named ''duties'' is added to the ''Users'' table&lt;br /&gt;
&lt;br /&gt;
*      db/migrate/add_multiple_duties_to_assignments.rb&lt;br /&gt;
  In this file, we have added a column ''allow_multiple_duties'' to ''assignments'' table&lt;br /&gt;
&lt;br /&gt;
*      db/migrate/create_assignment_duty_questionnaire_mapping.rb&lt;br /&gt;
  In this file, we have created ''assignment_duty_questionnaire_mappings'' table and added columns for ''questionnaire_id'', ''assignment_id'' and ''duty_id''&lt;br /&gt;
&lt;br /&gt;
===Files that have to be modified===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*	app/views/assignments/edit/review_strategy.html.erb&lt;br /&gt;
 In this file, a checkbox is added to permit role based review. A hidden checkbox is added to allow multiple students to have the same role and hidden fields for adding duties along with a dropdown box for selecting from existing duties.&lt;br /&gt;
 A javascript function is added which removes the hidden attributes from for the above stated entries once the checkbox is selected.&lt;br /&gt;
 &lt;br /&gt;
*      app/views/assignments/edit/rubrics.html.erb&lt;br /&gt;
 In this file , a conditional statement is added, which displays the dropdown for selecting duties and a dropdown for selecting a teammate review for the selected duties if role based reviewing is permitted or else display the standard view.&lt;br /&gt;
        &lt;br /&gt;
*	app/views/student_teams/view.html.erb&lt;br /&gt;
 In this file, a conditional statement is added which displays the select duties dropdown box is role based reviewing is allowed or else displays the standard view. &lt;br /&gt;
*      app/controllers/response_controller.rb&lt;br /&gt;
 In this file, the new_feedback function will be edited to map the team-mate review questionnaires according to the duties created.&lt;br /&gt;
*	app/questionnaire/new.html.erb&lt;br /&gt;
 A new questionnaire will be created for each new duty created or the same questionnaire can be used.&lt;br /&gt;
*	app/questionnaire/edit.html.erb&lt;br /&gt;
 A newly created questionnaire for a particular duty can be edited.&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
*	Instructor tests&lt;br /&gt;
**	Check the box for role based reviewing. &lt;br /&gt;
***	Display and select from already existing roles(duties) with option to create new roles(duties).&lt;br /&gt;
***	Should not be able to see roles(duties) from other instructors.&lt;br /&gt;
***	Select corresponding rubrics for a particular role(duty). &lt;br /&gt;
**      If not, proceed with the default questions for the rubric for the assignment.&lt;br /&gt;
&lt;br /&gt;
*	Student(team member) tests&lt;br /&gt;
**	Before submitting the project, all team members should select a role(duty) for themselves from the roles(duties) set by the instructor.&lt;br /&gt;
**	Multiple students may have the role(duty) but 1 student cannot have multiple roles(duties).&lt;br /&gt;
&lt;br /&gt;
*	Reviewer tests&lt;br /&gt;
**	For the teammate review, only the questions related to the role(duty) selected by the student should appear in the rubric.&lt;/div&gt;</summary>
		<author><name>Bjain</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2018-_Project_E1818:_Role-based_reviewing&amp;diff=117332</id>
		<title>CSC/ECE 517 Spring 2018- Project E1818: Role-based reviewing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2018-_Project_E1818:_Role-based_reviewing&amp;diff=117332"/>
		<updated>2018-05-03T07:18:14Z</updated>

		<summary type="html">&lt;p&gt;Bjain: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
&lt;br /&gt;
The project is to enable role-based team-mate reviews. These roles can be better named as duties, corresponding to the duty of a team member in a particular project. The instructor should be able to use a different rubric for evaluating the contribution of team mates with different roles.&lt;br /&gt;
Borrowing from different Agile methodologies like SCRUM, each team member has a particular role. For example,architect,facilitator and implementer. Although one member can contribute to other duties, a much more meaningful review can be done if the review rubric was role-specific. Currently, there is a single teammate review rubric for each assignment. This means that some review questions are not applicable for all team members. For instance, if there is a question which says “What percentage of the code was written by this member?” This may not be applicable for the team member who wrote tests or documentation.&lt;br /&gt;
&lt;br /&gt;
==UML Diagram==&lt;br /&gt;
&lt;br /&gt;
[[File:Uml2.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a UML Class diagram, The relationships depicted above are as follows: &lt;br /&gt;
&lt;br /&gt;
* Between the User and Duty class, there is a bidirectional association. The user table is used for both the instructor and the student. &lt;br /&gt;
** Each instructor can have multiple roles that he can choose from for a particular assignment/questionnaire.&lt;br /&gt;
** Each student can have 0 or 1 role for a particular project.&lt;br /&gt;
* For each Questionnaire instance, there are one or more Questions that can be stored, hence there is an aggregation relationship from Question to Questionnaire. This is for the grading rubric based on the role.&lt;br /&gt;
* The Question table and the Questionnaire table each will be using the the duty ID to sort out questions for a particular assignment.&lt;br /&gt;
&lt;br /&gt;
==Proposed Implementation==&lt;br /&gt;
&lt;br /&gt;
The project introduces changes from the instructor view and the student view. The steps for implementation are as follow:&lt;br /&gt;
&lt;br /&gt;
===Migration changes===&lt;br /&gt;
* .    Create Duties table: This table stores all the duties created by any instructor.&lt;br /&gt;
               * id - The duty ID will be used by other tables like the questionnaire table and hence will be the primary key.&lt;br /&gt;
               * assignment_id - An assignment has particular duties. Thus, the assignment number will be the foreign key for the Duties table. &lt;br /&gt;
               * instructor_id - The Duties created by one Instructor should be visible and reusable by that instructor only. Thus, the instructor id will also be a foreign key in the Duties table.&lt;br /&gt;
&lt;br /&gt;
*      Create assignments_duty_mappings table: If an instructor wants to add multiple duties for an assignment, storing it in the duty table will cause the duty to be overwritten. Thus we have created a table which maps an assignment and all its duties.&lt;br /&gt;
               * id &lt;br /&gt;
               * assignment_id &lt;br /&gt;
               * duty_id&lt;br /&gt;
&lt;br /&gt;
*      Create assignment_duty_questionnaire_mappings table : This table is created to store the questionnaire for team-mate review rubrics and the corresponding duty id. &lt;br /&gt;
               * id &lt;br /&gt;
               * assignment_id &lt;br /&gt;
               * duty_id&lt;br /&gt;
               * questionnaire_id&lt;br /&gt;
&lt;br /&gt;
*      Add a column entry named &amp;quot;role_based_assignment&amp;quot; in the assignments table which would be of type boolean. This field would save the status of the role based review check box.&lt;br /&gt;
*      Add a column entry named &amp;quot;allow_multiple_duties&amp;quot; in the assignments table which would be of type boolean. This field would save the status of the check box for allowing multiple students with the same role.&lt;br /&gt;
*      Add a column entry named &amp;quot;Duties&amp;quot; to the Users table which would be of type string. This field would save the duty that a student would select if role based reviews are permitted.&lt;br /&gt;
&lt;br /&gt;
===Instructor view changes===&lt;br /&gt;
*	For a particular assignment, in the 'Review Strategy' tab edit assignment,create a check box called &amp;quot;Is role based review allowed?&amp;quot; that allows an instructor to add a role based review for a particular assignment or not. This can be done by adding a check box tag in the review strategy sub page of the edit assignments page.&lt;br /&gt;
[[File:e18181_3.png]]&lt;br /&gt;
*      When the check box is ticked, the duties that have been already added and a button to &amp;quot;New duty&amp;quot; pops up. &lt;br /&gt;
[[File:Example_e18181.png]]&lt;br /&gt;
&lt;br /&gt;
*      We call the java script function ''dutiesAssign()'' using the ''ischecked'' listener. The function queries the value of the checkbox for ''role_based_review'' and depending on if the value is true or false, the hidden attributes i.e. ''allow_multiple_duties'' and ''duties_dropdown'' are displayed or kept hidden.&lt;br /&gt;
[[File:e18181_2.png]]&lt;br /&gt;
*      The instructor can select from the dropdown of duties. We have allowed multiple duties to be selected at once.The duties created by an instructor are unique for that instructor and are not displayed for any other instructor.&lt;br /&gt;
[[File:Picture1_e1818.png]]&lt;br /&gt;
*      An instructor can decide the number of duties for a particular assignment, the number of team members who can undertake a particular duty and if any of the duties are optional.  &lt;br /&gt;
*      When the assignment is saved, the duty_id is saved to the assignment_duty_mappings table. &lt;br /&gt;
*      The instructor can create Team-mate review Questionnaires for the different duties he created or can use any from the existing list of questionnaires.&lt;br /&gt;
[[File:Example2_1818.png]] &lt;br /&gt;
*      In order to do this, the instructor has to go to the Rubrics tab of edit assignment. There, if the assignment is role-based, a drop down menu displays the list of all the duties selected for an assignment.&lt;br /&gt;
[[File:Example23_1818.png]]&lt;br /&gt;
*      When the assignment is saved, the questionnaire_id is stored in the assignment_duty_questionnaire_mappings table&lt;br /&gt;
&lt;br /&gt;
===Student view changes=== &lt;br /&gt;
*       When a student goes to “Your team”,  they can see the team members, their selected duties and the option to review if these are enabled. Students will either see &amp;quot;Review&amp;quot; link to start the teammate review or a message that says that &amp;quot;Teammate has not selected a duty.&amp;quot;.&lt;br /&gt;
[[File:rsz_111.jpg]]&lt;br /&gt;
*	The student can select their duty from a particular set of duties created by the instructor for that particular assignment. Upon clicking &amp;quot;Select&amp;quot; option, view is redirected to a new page where all the available duties appear as radio-buttons and the student can select one of these. This occurs only if role based reviewing is permitted for that particular assignment. If not, the standard existing view will be displayed which does not give any such option.&lt;br /&gt;
[[File:E1818_1.jpg]]&lt;br /&gt;
[[File:E1818_3.jpg]]&lt;br /&gt;
*  The logic for this is implemented in the 'student_teams' controller and view. This would be enclosed in a conditional which would only appear if role based reviewing is permitted. &lt;br /&gt;
*	A student can only select one duty.&lt;br /&gt;
*	A team member cannot change their role after the assignment submission deadline.&lt;br /&gt;
*      When a student selects a particular duty , it is stored in the database table of that user. Thus when a team-mate reviews that student , they will see a questionnaire corresponding to the duty of that student. This would enable reviews of the teammates to be accurate and specific to their role in a project.&lt;br /&gt;
[[File:E1818_4.jpg]]&lt;br /&gt;
[[File:E1818_5.jpg]]&lt;br /&gt;
==Files to be modified==&lt;br /&gt;
&lt;br /&gt;
===New files===&lt;br /&gt;
Some of the new migration files we have created are&lt;br /&gt;
&lt;br /&gt;
*      db/migrate/add_duties_table.rb&lt;br /&gt;
 In this file, a ''duties'' table is created with a name field&lt;br /&gt;
&lt;br /&gt;
*      db/migrate/add_reference_of_instructor_and_assignment_to_duties.rb&lt;br /&gt;
  In this file, we have adding foreign key reference of ''assignment id'' into ''duties table''.&lt;br /&gt;
&lt;br /&gt;
*      db/migrate/add_duties_to_users.rb&lt;br /&gt;
  In this file, a column named ''duties'' is added to the ''Users'' table&lt;br /&gt;
&lt;br /&gt;
*      db/migrate/add_multiple_duties_to_assignments.rb&lt;br /&gt;
  In this file, we have added a column ''allow_multiple_duties'' to ''assignments'' table&lt;br /&gt;
&lt;br /&gt;
*      db/migrate/create_assignment_duty_questionnaire_mapping.rb&lt;br /&gt;
  In this file, we have created ''assignment_duty_questionnaire_mappings'' table and added columns for ''questionnaire_id'', ''assignment_id'' and ''duty_id''&lt;br /&gt;
&lt;br /&gt;
===Files that have to be modified===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*	app/views/assignments/edit/review_strategy.html.erb&lt;br /&gt;
 In this file, a checkbox is added to permit role based review. A hidden checkbox is added to allow multiple students to have the same role and hidden fields for adding duties along with a dropdown box for selecting from existing duties.&lt;br /&gt;
 A javascript function is added which removes the hidden attributes from for the above stated entries once the checkbox is selected.&lt;br /&gt;
 &lt;br /&gt;
*      app/views/assignments/edit/rubrics.html.erb&lt;br /&gt;
 In this file , a conditional statement is added, which displays the dropdown for selecting duties and a dropdown for selecting a teammate review for the selected duties if role based reviewing is permitted or else display the standard view.&lt;br /&gt;
        &lt;br /&gt;
*	app/views/student_teams/view.html.erb&lt;br /&gt;
 In this file, a conditional statement is added which displays the select duties dropdown box is role based reviewing is allowed or else displays the standard view. &lt;br /&gt;
*      app/controllers/response_controller.rb&lt;br /&gt;
 In this file, the new_feedback function will be edited to map the team-mate review questionnaires according to the duties created.&lt;br /&gt;
*	app/questionnaire/new.html.erb&lt;br /&gt;
 A new questionnaire will be created for each new duty created or the same questionnaire can be used.&lt;br /&gt;
*	app/questionnaire/edit.html.erb&lt;br /&gt;
 A newly created questionnaire for a particular duty can be edited.&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
*	Instructor tests&lt;br /&gt;
**	Check the box for role based reviewing. &lt;br /&gt;
***	Display and select from already existing roles(duties) with option to create new roles(duties).&lt;br /&gt;
***	Should not be able to see roles(duties) from other instructors.&lt;br /&gt;
***	Select corresponding rubrics for a particular role(duty). &lt;br /&gt;
**      If not, proceed with the default questions for the rubric for the assignment.&lt;br /&gt;
&lt;br /&gt;
*	Student(team member) tests&lt;br /&gt;
**	Before submitting the project, all team members should select a role(duty) for themselves from the roles(duties) set by the instructor.&lt;br /&gt;
**	Multiple students may have the role(duty) but 1 student cannot have multiple roles(duties).&lt;br /&gt;
&lt;br /&gt;
*	Reviewer tests&lt;br /&gt;
**	For the teammate review, only the questions related to the role(duty) selected by the student should appear in the rubric.&lt;/div&gt;</summary>
		<author><name>Bjain</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:E1818_5.jpg&amp;diff=117331</id>
		<title>File:E1818 5.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:E1818_5.jpg&amp;diff=117331"/>
		<updated>2018-05-03T07:18:10Z</updated>

		<summary type="html">&lt;p&gt;Bjain: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Bjain</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:E1818_4.jpg&amp;diff=117330</id>
		<title>File:E1818 4.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:E1818_4.jpg&amp;diff=117330"/>
		<updated>2018-05-03T07:17:08Z</updated>

		<summary type="html">&lt;p&gt;Bjain: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Bjain</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:E1818_3.jpg&amp;diff=117329</id>
		<title>File:E1818 3.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:E1818_3.jpg&amp;diff=117329"/>
		<updated>2018-05-03T07:14:19Z</updated>

		<summary type="html">&lt;p&gt;Bjain: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Bjain</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2018-_Project_E1818:_Role-based_reviewing&amp;diff=117328</id>
		<title>CSC/ECE 517 Spring 2018- Project E1818: Role-based reviewing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2018-_Project_E1818:_Role-based_reviewing&amp;diff=117328"/>
		<updated>2018-05-03T07:13:49Z</updated>

		<summary type="html">&lt;p&gt;Bjain: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
&lt;br /&gt;
The project is to enable role-based team-mate reviews. These roles can be better named as duties, corresponding to the duty of a team member in a particular project. The instructor should be able to use a different rubric for evaluating the contribution of team mates with different roles.&lt;br /&gt;
Borrowing from different Agile methodologies like SCRUM, each team member has a particular role. For example,architect,facilitator and implementer. Although one member can contribute to other duties, a much more meaningful review can be done if the review rubric was role-specific. Currently, there is a single teammate review rubric for each assignment. This means that some review questions are not applicable for all team members. For instance, if there is a question which says “What percentage of the code was written by this member?” This may not be applicable for the team member who wrote tests or documentation.&lt;br /&gt;
&lt;br /&gt;
==UML Diagram==&lt;br /&gt;
&lt;br /&gt;
[[File:Uml2.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a UML Class diagram, The relationships depicted above are as follows: &lt;br /&gt;
&lt;br /&gt;
* Between the User and Duty class, there is a bidirectional association. The user table is used for both the instructor and the student. &lt;br /&gt;
** Each instructor can have multiple roles that he can choose from for a particular assignment/questionnaire.&lt;br /&gt;
** Each student can have 0 or 1 role for a particular project.&lt;br /&gt;
* For each Questionnaire instance, there are one or more Questions that can be stored, hence there is an aggregation relationship from Question to Questionnaire. This is for the grading rubric based on the role.&lt;br /&gt;
* The Question table and the Questionnaire table each will be using the the duty ID to sort out questions for a particular assignment.&lt;br /&gt;
&lt;br /&gt;
==Proposed Implementation==&lt;br /&gt;
&lt;br /&gt;
The project introduces changes from the instructor view and the student view. The steps for implementation are as follow:&lt;br /&gt;
&lt;br /&gt;
===Migration changes===&lt;br /&gt;
* .    Create Duties table: This table stores all the duties created by any instructor.&lt;br /&gt;
               * id - The duty ID will be used by other tables like the questionnaire table and hence will be the primary key.&lt;br /&gt;
               * assignment_id - An assignment has particular duties. Thus, the assignment number will be the foreign key for the Duties table. &lt;br /&gt;
               * instructor_id - The Duties created by one Instructor should be visible and reusable by that instructor only. Thus, the instructor id will also be a foreign key in the Duties table.&lt;br /&gt;
&lt;br /&gt;
*      Create assignments_duty_mappings table: If an instructor wants to add multiple duties for an assignment, storing it in the duty table will cause the duty to be overwritten. Thus we have created a table which maps an assignment and all its duties.&lt;br /&gt;
               * id &lt;br /&gt;
               * assignment_id &lt;br /&gt;
               * duty_id&lt;br /&gt;
&lt;br /&gt;
*      Create assignment_duty_questionnaire_mappings table : This table is created to store the questionnaire for team-mate review rubrics and the corresponding duty id. &lt;br /&gt;
               * id &lt;br /&gt;
               * assignment_id &lt;br /&gt;
               * duty_id&lt;br /&gt;
               * questionnaire_id&lt;br /&gt;
&lt;br /&gt;
*      Add a column entry named &amp;quot;role_based_assignment&amp;quot; in the assignments table which would be of type boolean. This field would save the status of the role based review check box.&lt;br /&gt;
*      Add a column entry named &amp;quot;allow_multiple_duties&amp;quot; in the assignments table which would be of type boolean. This field would save the status of the check box for allowing multiple students with the same role.&lt;br /&gt;
*      Add a column entry named &amp;quot;Duties&amp;quot; to the Users table which would be of type string. This field would save the duty that a student would select if role based reviews are permitted.&lt;br /&gt;
&lt;br /&gt;
===Instructor view changes===&lt;br /&gt;
*	For a particular assignment, in the 'Review Strategy' tab edit assignment,create a check box called &amp;quot;Is role based review allowed?&amp;quot; that allows an instructor to add a role based review for a particular assignment or not. This can be done by adding a check box tag in the review strategy sub page of the edit assignments page.&lt;br /&gt;
[[File:e18181_3.png]]&lt;br /&gt;
*      When the check box is ticked, the duties that have been already added and a button to &amp;quot;New duty&amp;quot; pops up. &lt;br /&gt;
[[File:Example_e18181.png]]&lt;br /&gt;
&lt;br /&gt;
*      We call the java script function ''dutiesAssign()'' using the ''ischecked'' listener. The function queries the value of the checkbox for ''role_based_review'' and depending on if the value is true or false, the hidden attributes i.e. ''allow_multiple_duties'' and ''duties_dropdown'' are displayed or kept hidden.&lt;br /&gt;
[[File:e18181_2.png]]&lt;br /&gt;
*      The instructor can select from the dropdown of duties. We have allowed multiple duties to be selected at once.The duties created by an instructor are unique for that instructor and are not displayed for any other instructor.&lt;br /&gt;
[[File:Picture1_e1818.png]]&lt;br /&gt;
*      An instructor can decide the number of duties for a particular assignment, the number of team members who can undertake a particular duty and if any of the duties are optional.  &lt;br /&gt;
*      When the assignment is saved, the duty_id is saved to the assignment_duty_mappings table. &lt;br /&gt;
*      The instructor can create Team-mate review Questionnaires for the different duties he created or can use any from the existing list of questionnaires.&lt;br /&gt;
[[File:Example2_1818.png]] &lt;br /&gt;
*      In order to do this, the instructor has to go to the Rubrics tab of edit assignment. There, if the assignment is role-based, a drop down menu displays the list of all the duties selected for an assignment.&lt;br /&gt;
[[File:Example23_1818.png]]&lt;br /&gt;
*      When the assignment is saved, the questionnaire_id is stored in the assignment_duty_questionnaire_mappings table&lt;br /&gt;
&lt;br /&gt;
===Student view changes=== &lt;br /&gt;
*       When a student goes to “Your team”,  they can see the team members, their selected duties and the option to review if these are enabled. Students will either see &amp;quot;Review&amp;quot; link to start the teammate review or a message that says that &amp;quot;Teammate has not selected a duty.&amp;quot;.&lt;br /&gt;
[[File:rsz_111.jpg]]&lt;br /&gt;
*	The student can select their duty from a particular set of duties created by the instructor for that particular assignment. Upon clicking &amp;quot;Select&amp;quot; option, view is redirected to a new page where all the available duties appear as radio-buttons and the student can select one of these. This occurs only if role based reviewing is permitted for that particular assignment. If not, the standard existing view will be displayed which does not give any such option.&lt;br /&gt;
[[File:E1818_1.jpg]]&lt;br /&gt;
*  The logic for this is implemented in the 'student_teams' controller and view. This would be enclosed in a conditional which would only appear if role based reviewing is permitted. &lt;br /&gt;
*	A student can only select one duty.&lt;br /&gt;
[[File:Example_student_18.png]]&lt;br /&gt;
*	A team member cannot change their role after the assignment submission deadline.&lt;br /&gt;
[[File:s2_18.png]]&lt;br /&gt;
*      When a student selects a particular duty , it is stored in the database table of that user. Thus when a team-mate reviews that student , he will see a questionnaire corresponding to the duty of that student.This would enable reviews of the teammates to be accurate and specific to their role in a project.&lt;br /&gt;
&lt;br /&gt;
==Files to be modified==&lt;br /&gt;
&lt;br /&gt;
===New files===&lt;br /&gt;
Some of the new migration files we have created are&lt;br /&gt;
&lt;br /&gt;
*      db/migrate/add_duties_table.rb&lt;br /&gt;
 In this file, a ''duties'' table is created with a name field&lt;br /&gt;
&lt;br /&gt;
*      db/migrate/add_reference_of_instructor_and_assignment_to_duties.rb&lt;br /&gt;
  In this file, we have adding foreign key reference of ''assignment id'' into ''duties table''.&lt;br /&gt;
&lt;br /&gt;
*      db/migrate/add_duties_to_users.rb&lt;br /&gt;
  In this file, a column named ''duties'' is added to the ''Users'' table&lt;br /&gt;
&lt;br /&gt;
*      db/migrate/add_multiple_duties_to_assignments.rb&lt;br /&gt;
  In this file, we have added a column ''allow_multiple_duties'' to ''assignments'' table&lt;br /&gt;
&lt;br /&gt;
*      db/migrate/create_assignment_duty_questionnaire_mapping.rb&lt;br /&gt;
  In this file, we have created ''assignment_duty_questionnaire_mappings'' table and added columns for ''questionnaire_id'', ''assignment_id'' and ''duty_id''&lt;br /&gt;
&lt;br /&gt;
===Files that have to be modified===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*	app/views/assignments/edit/review_strategy.html.erb&lt;br /&gt;
 In this file, a checkbox is added to permit role based review. A hidden checkbox is added to allow multiple students to have the same role and hidden fields for adding duties along with a dropdown box for selecting from existing duties.&lt;br /&gt;
 A javascript function is added which removes the hidden attributes from for the above stated entries once the checkbox is selected.&lt;br /&gt;
 &lt;br /&gt;
*      app/views/assignments/edit/rubrics.html.erb&lt;br /&gt;
 In this file , a conditional statement is added, which displays the dropdown for selecting duties and a dropdown for selecting a teammate review for the selected duties if role based reviewing is permitted or else display the standard view.&lt;br /&gt;
        &lt;br /&gt;
*	app/views/student_teams/view.html.erb&lt;br /&gt;
 In this file, a conditional statement is added which displays the select duties dropdown box is role based reviewing is allowed or else displays the standard view. &lt;br /&gt;
*      app/controllers/response_controller.rb&lt;br /&gt;
 In this file, the new_feedback function will be edited to map the team-mate review questionnaires according to the duties created.&lt;br /&gt;
*	app/questionnaire/new.html.erb&lt;br /&gt;
 A new questionnaire will be created for each new duty created or the same questionnaire can be used.&lt;br /&gt;
*	app/questionnaire/edit.html.erb&lt;br /&gt;
 A newly created questionnaire for a particular duty can be edited.&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
*	Instructor tests&lt;br /&gt;
**	Check the box for role based reviewing. &lt;br /&gt;
***	Display and select from already existing roles(duties) with option to create new roles(duties).&lt;br /&gt;
***	Should not be able to see roles(duties) from other instructors.&lt;br /&gt;
***	Select corresponding rubrics for a particular role(duty). &lt;br /&gt;
**      If not, proceed with the default questions for the rubric for the assignment.&lt;br /&gt;
&lt;br /&gt;
*	Student(team member) tests&lt;br /&gt;
**	Before submitting the project, all team members should select a role(duty) for themselves from the roles(duties) set by the instructor.&lt;br /&gt;
**	Multiple students may have the role(duty) but 1 student cannot have multiple roles(duties).&lt;br /&gt;
&lt;br /&gt;
*	Reviewer tests&lt;br /&gt;
**	For the teammate review, only the questions related to the role(duty) selected by the student should appear in the rubric.&lt;/div&gt;</summary>
		<author><name>Bjain</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2018-_Project_E1818:_Role-based_reviewing&amp;diff=117327</id>
		<title>CSC/ECE 517 Spring 2018- Project E1818: Role-based reviewing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2018-_Project_E1818:_Role-based_reviewing&amp;diff=117327"/>
		<updated>2018-05-03T07:08:51Z</updated>

		<summary type="html">&lt;p&gt;Bjain: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
&lt;br /&gt;
The project is to enable role-based team-mate reviews. These roles can be better named as duties, corresponding to the duty of a team member in a particular project. The instructor should be able to use a different rubric for evaluating the contribution of team mates with different roles.&lt;br /&gt;
Borrowing from different Agile methodologies like SCRUM, each team member has a particular role. For example,architect,facilitator and implementer. Although one member can contribute to other duties, a much more meaningful review can be done if the review rubric was role-specific. Currently, there is a single teammate review rubric for each assignment. This means that some review questions are not applicable for all team members. For instance, if there is a question which says “What percentage of the code was written by this member?” This may not be applicable for the team member who wrote tests or documentation.&lt;br /&gt;
&lt;br /&gt;
==UML Diagram==&lt;br /&gt;
&lt;br /&gt;
[[File:Uml2.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a UML Class diagram, The relationships depicted above are as follows: &lt;br /&gt;
&lt;br /&gt;
* Between the User and Duty class, there is a bidirectional association. The user table is used for both the instructor and the student. &lt;br /&gt;
** Each instructor can have multiple roles that he can choose from for a particular assignment/questionnaire.&lt;br /&gt;
** Each student can have 0 or 1 role for a particular project.&lt;br /&gt;
* For each Questionnaire instance, there are one or more Questions that can be stored, hence there is an aggregation relationship from Question to Questionnaire. This is for the grading rubric based on the role.&lt;br /&gt;
* The Question table and the Questionnaire table each will be using the the duty ID to sort out questions for a particular assignment.&lt;br /&gt;
&lt;br /&gt;
==Proposed Implementation==&lt;br /&gt;
&lt;br /&gt;
The project introduces changes from the instructor view and the student view. The steps for implementation are as follow:&lt;br /&gt;
&lt;br /&gt;
===Migration changes===&lt;br /&gt;
* .    Create Duties table: This table stores all the duties created by any instructor.&lt;br /&gt;
               * id - The duty ID will be used by other tables like the questionnaire table and hence will be the primary key.&lt;br /&gt;
               * assignment_id - An assignment has particular duties. Thus, the assignment number will be the foreign key for the Duties table. &lt;br /&gt;
               * instructor_id - The Duties created by one Instructor should be visible and reusable by that instructor only. Thus, the instructor id will also be a foreign key in the Duties table.&lt;br /&gt;
&lt;br /&gt;
*      Create assignments_duty_mappings table: If an instructor wants to add multiple duties for an assignment, storing it in the duty table will cause the duty to be overwritten. Thus we have created a table which maps an assignment and all its duties.&lt;br /&gt;
               * id &lt;br /&gt;
               * assignment_id &lt;br /&gt;
               * duty_id&lt;br /&gt;
&lt;br /&gt;
*      Create assignment_duty_questionnaire_mappings table : This table is created to store the questionnaire for team-mate review rubrics and the corresponding duty id. &lt;br /&gt;
               * id &lt;br /&gt;
               * assignment_id &lt;br /&gt;
               * duty_id&lt;br /&gt;
               * questionnaire_id&lt;br /&gt;
&lt;br /&gt;
*      Add a column entry named &amp;quot;role_based_assignment&amp;quot; in the assignments table which would be of type boolean. This field would save the status of the role based review check box.&lt;br /&gt;
*      Add a column entry named &amp;quot;allow_multiple_duties&amp;quot; in the assignments table which would be of type boolean. This field would save the status of the check box for allowing multiple students with the same role.&lt;br /&gt;
*      Add a column entry named &amp;quot;Duties&amp;quot; to the Users table which would be of type string. This field would save the duty that a student would select if role based reviews are permitted.&lt;br /&gt;
&lt;br /&gt;
===Instructor view changes===&lt;br /&gt;
*	For a particular assignment, in the 'Review Strategy' tab edit assignment,create a check box called &amp;quot;Is role based review allowed?&amp;quot; that allows an instructor to add a role based review for a particular assignment or not. This can be done by adding a check box tag in the review strategy sub page of the edit assignments page.&lt;br /&gt;
[[File:e18181_3.png]]&lt;br /&gt;
*      When the check box is ticked, the duties that have been already added and a button to &amp;quot;New duty&amp;quot; pops up. &lt;br /&gt;
[[File:Example_e18181.png]]&lt;br /&gt;
&lt;br /&gt;
*      We call the java script function ''dutiesAssign()'' using the ''ischecked'' listener. The function queries the value of the checkbox for ''role_based_review'' and depending on if the value is true or false, the hidden attributes i.e. ''allow_multiple_duties'' and ''duties_dropdown'' are displayed or kept hidden.&lt;br /&gt;
[[File:e18181_2.png]]&lt;br /&gt;
*      The instructor can select from the dropdown of duties. We have allowed multiple duties to be selected at once.The duties created by an instructor are unique for that instructor and are not displayed for any other instructor.&lt;br /&gt;
[[File:Picture1_e1818.png]]&lt;br /&gt;
*      An instructor can decide the number of duties for a particular assignment, the number of team members who can undertake a particular duty and if any of the duties are optional.  &lt;br /&gt;
*      When the assignment is saved, the duty_id is saved to the assignment_duty_mappings table. &lt;br /&gt;
*      The instructor can create Team-mate review Questionnaires for the different duties he created or can use any from the existing list of questionnaires.&lt;br /&gt;
[[File:Example2_1818.png]] &lt;br /&gt;
*      In order to do this, the instructor has to go to the Rubrics tab of edit assignment. There, if the assignment is role-based, a drop down menu displays the list of all the duties selected for an assignment.&lt;br /&gt;
[[File:Example23_1818.png]]&lt;br /&gt;
*      When the assignment is saved, the questionnaire_id is stored in the assignment_duty_questionnaire_mappings table&lt;br /&gt;
&lt;br /&gt;
===Student view changes=== &lt;br /&gt;
*       When a student goes to “Your team”,  they can see the team members, their selected duties and the option to review if these are enabled. Students will either see &amp;quot;Review&amp;quot; link to start the teammate review or a message that says that &amp;quot;Teammate has not selected a duty.&amp;quot;.&lt;br /&gt;
[[File:rsz_111.jpg]]&lt;br /&gt;
*	The student can select their duty from a particular set of duties created by the instructor for that particular assignment. Upon clicking &amp;quot;Select&amp;quot; option, view is redirected to a new page where all the available duties appear as radio-buttons and the student can select one of these. This occurs only if role based reviewing is permitted for that particular assignment. If not, the standard existing view will be displayed which does not give any such option.&lt;br /&gt;
[[File:E1818_1.jpg]]&lt;br /&gt;
*  This is implemented by adding a drop down box in the student_teams view file. This would be enclosed in a conditional which would only appear if role based reviewing is permitted. &lt;br /&gt;
*	A student can only select one duty.&lt;br /&gt;
*      If the instructor has permitted multiple students to have the same role, each student will get all the duties as an option in the dropdown box. However, if the instructor has not provided permission for multiple students to have the same role, when a particular duty is selected by a student , any other student will not see that duty in the drop down box.&lt;br /&gt;
[[File:Example_student_18.png]]&lt;br /&gt;
*   This has been implemented by making a separate copy of the list of all the duties available. If multiple roles are not permitted, once a duty is selected , it is eliminated from the separate list maintained and that list is displayed to the student. There is a conditional in the student teams view file that displays the separate list in the drop down if multiple students can have the same role or else display the original list of duties.&lt;br /&gt;
*	A team member cannot change their role after the assignment submission deadline.&lt;br /&gt;
[[File:s2_18.png]]&lt;br /&gt;
*   This is implemented by taking the time and date information from the server and showing the select duties option only if the current time and date is prior to the deadline time and date. A conditional statement is included in the student teams view file for this purpose.&lt;br /&gt;
*      When a student selects a particular duty , it is stored in the database table of that user. Thus when a team-mate reviews that student , he will see a questionnaire corresponding to the duty of that student.This would enable reviews of the teammates to be accurate and specific to their role in a project.&lt;br /&gt;
&lt;br /&gt;
==Files to be modified==&lt;br /&gt;
&lt;br /&gt;
===New files===&lt;br /&gt;
Some of the new migration files we have created are&lt;br /&gt;
&lt;br /&gt;
*      db/migrate/add_duties_table.rb&lt;br /&gt;
 In this file, a ''duties'' table is created with a name field&lt;br /&gt;
&lt;br /&gt;
*      db/migrate/add_reference_of_instructor_and_assignment_to_duties.rb&lt;br /&gt;
  In this file, we have adding foreign key reference of ''assignment id'' into ''duties table''.&lt;br /&gt;
&lt;br /&gt;
*      db/migrate/add_duties_to_users.rb&lt;br /&gt;
  In this file, a column named ''duties'' is added to the ''Users'' table&lt;br /&gt;
&lt;br /&gt;
*      db/migrate/add_multiple_duties_to_assignments.rb&lt;br /&gt;
  In this file, we have added a column ''allow_multiple_duties'' to ''assignments'' table&lt;br /&gt;
&lt;br /&gt;
*      db/migrate/create_assignment_duty_questionnaire_mapping.rb&lt;br /&gt;
  In this file, we have created ''assignment_duty_questionnaire_mappings'' table and added columns for ''questionnaire_id'', ''assignment_id'' and ''duty_id''&lt;br /&gt;
&lt;br /&gt;
===Files that have to be modified===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*	app/views/assignments/edit/review_strategy.html.erb&lt;br /&gt;
 In this file, a checkbox is added to permit role based review. A hidden checkbox is added to allow multiple students to have the same role and hidden fields for adding duties along with a dropdown box for selecting from existing duties.&lt;br /&gt;
 A javascript function is added which removes the hidden attributes from for the above stated entries once the checkbox is selected.&lt;br /&gt;
 &lt;br /&gt;
*      app/views/assignments/edit/rubrics.html.erb&lt;br /&gt;
 In this file , a conditional statement is added, which displays the dropdown for selecting duties and a dropdown for selecting a teammate review for the selected duties if role based reviewing is permitted or else display the standard view.&lt;br /&gt;
        &lt;br /&gt;
*	app/views/student_teams/view.html.erb&lt;br /&gt;
 In this file, a conditional statement is added which displays the select duties dropdown box is role based reviewing is allowed or else displays the standard view. &lt;br /&gt;
*      app/controllers/response_controller.rb&lt;br /&gt;
 In this file, the new_feedback function will be edited to map the team-mate review questionnaires according to the duties created.&lt;br /&gt;
*	app/questionnaire/new.html.erb&lt;br /&gt;
 A new questionnaire will be created for each new duty created or the same questionnaire can be used.&lt;br /&gt;
*	app/questionnaire/edit.html.erb&lt;br /&gt;
 A newly created questionnaire for a particular duty can be edited.&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
*	Instructor tests&lt;br /&gt;
**	Check the box for role based reviewing. &lt;br /&gt;
***	Display and select from already existing roles(duties) with option to create new roles(duties).&lt;br /&gt;
***	Should not be able to see roles(duties) from other instructors.&lt;br /&gt;
***	Select corresponding rubrics for a particular role(duty). &lt;br /&gt;
**      If not, proceed with the default questions for the rubric for the assignment.&lt;br /&gt;
&lt;br /&gt;
*	Student(team member) tests&lt;br /&gt;
**	Before submitting the project, all team members should select a role(duty) for themselves from the roles(duties) set by the instructor.&lt;br /&gt;
**	Multiple students may have the role(duty) but 1 student cannot have multiple roles(duties).&lt;br /&gt;
&lt;br /&gt;
*	Reviewer tests&lt;br /&gt;
**	For the teammate review, only the questions related to the role(duty) selected by the student should appear in the rubric.&lt;/div&gt;</summary>
		<author><name>Bjain</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2018-_Project_E1818:_Role-based_reviewing&amp;diff=117326</id>
		<title>CSC/ECE 517 Spring 2018- Project E1818: Role-based reviewing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2018-_Project_E1818:_Role-based_reviewing&amp;diff=117326"/>
		<updated>2018-05-03T07:07:57Z</updated>

		<summary type="html">&lt;p&gt;Bjain: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
&lt;br /&gt;
The project is to enable role-based team-mate reviews. These roles can be better named as duties, corresponding to the duty of a team member in a particular project. The instructor should be able to use a different rubric for evaluating the contribution of team mates with different roles.&lt;br /&gt;
Borrowing from different Agile methodologies like SCRUM, each team member has a particular role. For example,architect,facilitator and implementer. Although one member can contribute to other duties, a much more meaningful review can be done if the review rubric was role-specific. Currently, there is a single teammate review rubric for each assignment. This means that some review questions are not applicable for all team members. For instance, if there is a question which says “What percentage of the code was written by this member?” This may not be applicable for the team member who wrote tests or documentation.&lt;br /&gt;
&lt;br /&gt;
==UML Diagram==&lt;br /&gt;
&lt;br /&gt;
[[File:Uml2.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a UML Class diagram, The relationships depicted above are as follows: &lt;br /&gt;
&lt;br /&gt;
* Between the User and Duty class, there is a bidirectional association. The user table is used for both the instructor and the student. &lt;br /&gt;
** Each instructor can have multiple roles that he can choose from for a particular assignment/questionnaire.&lt;br /&gt;
** Each student can have 0 or 1 role for a particular project.&lt;br /&gt;
* For each Questionnaire instance, there are one or more Questions that can be stored, hence there is an aggregation relationship from Question to Questionnaire. This is for the grading rubric based on the role.&lt;br /&gt;
* The Question table and the Questionnaire table each will be using the the duty ID to sort out questions for a particular assignment.&lt;br /&gt;
&lt;br /&gt;
==Proposed Implementation==&lt;br /&gt;
&lt;br /&gt;
The project introduces changes from the instructor view and the student view. The steps for implementation are as follow:&lt;br /&gt;
&lt;br /&gt;
===Migration changes===&lt;br /&gt;
* .    Create Duties table: This table stores all the duties created by any instructor.&lt;br /&gt;
               * id - The duty ID will be used by other tables like the questionnaire table and hence will be the primary key.&lt;br /&gt;
               * assignment_id - An assignment has particular duties. Thus, the assignment number will be the foreign key for the Duties table. &lt;br /&gt;
               * instructor_id - The Duties created by one Instructor should be visible and reusable by that instructor only. Thus, the instructor id will also be a foreign key in the Duties table.&lt;br /&gt;
&lt;br /&gt;
*      Create assignments_duty_mappings table: If an instructor wants to add multiple duties for an assignment, storing it in the duty table will cause the duty to be overwritten. Thus we have created a table which maps an assignment and all its duties.&lt;br /&gt;
               * id &lt;br /&gt;
               * assignment_id &lt;br /&gt;
               * duty_id&lt;br /&gt;
&lt;br /&gt;
*      Create assignment_duty_questionnaire_mappings table : This table is created to store the questionnaire for team-mate review rubrics and the corresponding duty id. &lt;br /&gt;
               * id &lt;br /&gt;
               * assignment_id &lt;br /&gt;
               * duty_id&lt;br /&gt;
               * questionnaire_id&lt;br /&gt;
&lt;br /&gt;
*      Add a column entry named &amp;quot;role_based_assignment&amp;quot; in the assignments table which would be of type boolean. This field would save the status of the role based review check box.&lt;br /&gt;
*      Add a column entry named &amp;quot;allow_multiple_duties&amp;quot; in the assignments table which would be of type boolean. This field would save the status of the check box for allowing multiple students with the same role.&lt;br /&gt;
*      Add a column entry named &amp;quot;Duties&amp;quot; to the Users table which would be of type string. This field would save the duty that a student would select if role based reviews are permitted.&lt;br /&gt;
&lt;br /&gt;
===Instructor view changes===&lt;br /&gt;
*	For a particular assignment, in the 'Review Strategy' tab edit assignment,create a check box called &amp;quot;Is role based review allowed?&amp;quot; that allows an instructor to add a role based review for a particular assignment or not. This can be done by adding a check box tag in the review strategy sub page of the edit assignments page.&lt;br /&gt;
[[File:e18181_3.png]]&lt;br /&gt;
*      When the check box is ticked, the duties that have been already added and a button to &amp;quot;New duty&amp;quot; pops up. &lt;br /&gt;
[[File:Example_e18181.png]]&lt;br /&gt;
&lt;br /&gt;
*      We call the java script function ''dutiesAssign()'' using the ''ischecked'' listener. The function queries the value of the checkbox for ''role_based_review'' and depending on if the value is true or false, the hidden attributes i.e. ''allow_multiple_duties'' and ''duties_dropdown'' are displayed or kept hidden.&lt;br /&gt;
[[File:e18181_2.png]]&lt;br /&gt;
*      The instructor can select from the dropdown of duties. We have allowed multiple duties to be selected at once.The duties created by an instructor are unique for that instructor and are not displayed for any other instructor.&lt;br /&gt;
[[File:Picture1_e1818.png]]&lt;br /&gt;
*      An instructor can decide the number of duties for a particular assignment, the number of team members who can undertake a particular duty and if any of the duties are optional.  &lt;br /&gt;
*      When the assignment is saved, the duty_id is saved to the assignment_duty_mappings table. &lt;br /&gt;
*      The instructor can create Team-mate review Questionnaires for the different duties he created or can use any from the existing list of questionnaires.&lt;br /&gt;
[[File:Example2_1818.png]] &lt;br /&gt;
*      In order to do this, the instructor has to go to the Rubrics tab of edit assignment. There, if the assignment is role-based, a drop down menu displays the list of all the duties selected for an assignment.&lt;br /&gt;
[[File:Example23_1818.png]]&lt;br /&gt;
*      When the assignment is saved, the questionnaire_id is stored in the assignment_duty_questionnaire_mappings table&lt;br /&gt;
&lt;br /&gt;
===Student view changes=== &lt;br /&gt;
*       When a student goes to “Your team”,  they can see the team members, their selected duties and the option to review if these are enabled. Students will either see &amp;quot;Review&amp;quot; link to start the teammate review or a message that says that &amp;quot;Teammate has not selected a duty.&amp;quot;.&lt;br /&gt;
[[File:E1818_1.jpg]]&lt;br /&gt;
*	The student can select their duty from a particular set of duties created by the instructor for that particular assignment. Upon clicking &amp;quot;Select&amp;quot; option, view is redirected to a new page where all the available duties appear as radio-buttons and the student can select one of these. This occurs only if role based reviewing is permitted for that particular assignment. If not, the standard existing view will be displayed which does not give any such option.&lt;br /&gt;
[[File:E1818_1.jpg]]&lt;br /&gt;
*  This is implemented by adding a drop down box in the student_teams view file. This would be enclosed in a conditional which would only appear if role based reviewing is permitted. &lt;br /&gt;
*	A student can only select one duty.&lt;br /&gt;
*      If the instructor has permitted multiple students to have the same role, each student will get all the duties as an option in the dropdown box. However, if the instructor has not provided permission for multiple students to have the same role, when a particular duty is selected by a student , any other student will not see that duty in the drop down box.&lt;br /&gt;
[[File:Example_student_18.png]]&lt;br /&gt;
*   This has been implemented by making a separate copy of the list of all the duties available. If multiple roles are not permitted, once a duty is selected , it is eliminated from the separate list maintained and that list is displayed to the student. There is a conditional in the student teams view file that displays the separate list in the drop down if multiple students can have the same role or else display the original list of duties.&lt;br /&gt;
*	A team member cannot change their role after the assignment submission deadline.&lt;br /&gt;
[[File:s2_18.png]]&lt;br /&gt;
*   This is implemented by taking the time and date information from the server and showing the select duties option only if the current time and date is prior to the deadline time and date. A conditional statement is included in the student teams view file for this purpose.&lt;br /&gt;
*      When a student selects a particular duty , it is stored in the database table of that user. Thus when a team-mate reviews that student , he will see a questionnaire corresponding to the duty of that student.This would enable reviews of the teammates to be accurate and specific to their role in a project.&lt;br /&gt;
&lt;br /&gt;
==Files to be modified==&lt;br /&gt;
&lt;br /&gt;
===New files===&lt;br /&gt;
Some of the new migration files we have created are&lt;br /&gt;
&lt;br /&gt;
*      db/migrate/add_duties_table.rb&lt;br /&gt;
 In this file, a ''duties'' table is created with a name field&lt;br /&gt;
&lt;br /&gt;
*      db/migrate/add_reference_of_instructor_and_assignment_to_duties.rb&lt;br /&gt;
  In this file, we have adding foreign key reference of ''assignment id'' into ''duties table''.&lt;br /&gt;
&lt;br /&gt;
*      db/migrate/add_duties_to_users.rb&lt;br /&gt;
  In this file, a column named ''duties'' is added to the ''Users'' table&lt;br /&gt;
&lt;br /&gt;
*      db/migrate/add_multiple_duties_to_assignments.rb&lt;br /&gt;
  In this file, we have added a column ''allow_multiple_duties'' to ''assignments'' table&lt;br /&gt;
&lt;br /&gt;
*      db/migrate/create_assignment_duty_questionnaire_mapping.rb&lt;br /&gt;
  In this file, we have created ''assignment_duty_questionnaire_mappings'' table and added columns for ''questionnaire_id'', ''assignment_id'' and ''duty_id''&lt;br /&gt;
&lt;br /&gt;
===Files that have to be modified===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*	app/views/assignments/edit/review_strategy.html.erb&lt;br /&gt;
 In this file, a checkbox is added to permit role based review. A hidden checkbox is added to allow multiple students to have the same role and hidden fields for adding duties along with a dropdown box for selecting from existing duties.&lt;br /&gt;
 A javascript function is added which removes the hidden attributes from for the above stated entries once the checkbox is selected.&lt;br /&gt;
 &lt;br /&gt;
*      app/views/assignments/edit/rubrics.html.erb&lt;br /&gt;
 In this file , a conditional statement is added, which displays the dropdown for selecting duties and a dropdown for selecting a teammate review for the selected duties if role based reviewing is permitted or else display the standard view.&lt;br /&gt;
        &lt;br /&gt;
*	app/views/student_teams/view.html.erb&lt;br /&gt;
 In this file, a conditional statement is added which displays the select duties dropdown box is role based reviewing is allowed or else displays the standard view. &lt;br /&gt;
*      app/controllers/response_controller.rb&lt;br /&gt;
 In this file, the new_feedback function will be edited to map the team-mate review questionnaires according to the duties created.&lt;br /&gt;
*	app/questionnaire/new.html.erb&lt;br /&gt;
 A new questionnaire will be created for each new duty created or the same questionnaire can be used.&lt;br /&gt;
*	app/questionnaire/edit.html.erb&lt;br /&gt;
 A newly created questionnaire for a particular duty can be edited.&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
*	Instructor tests&lt;br /&gt;
**	Check the box for role based reviewing. &lt;br /&gt;
***	Display and select from already existing roles(duties) with option to create new roles(duties).&lt;br /&gt;
***	Should not be able to see roles(duties) from other instructors.&lt;br /&gt;
***	Select corresponding rubrics for a particular role(duty). &lt;br /&gt;
**      If not, proceed with the default questions for the rubric for the assignment.&lt;br /&gt;
&lt;br /&gt;
*	Student(team member) tests&lt;br /&gt;
**	Before submitting the project, all team members should select a role(duty) for themselves from the roles(duties) set by the instructor.&lt;br /&gt;
**	Multiple students may have the role(duty) but 1 student cannot have multiple roles(duties).&lt;br /&gt;
&lt;br /&gt;
*	Reviewer tests&lt;br /&gt;
**	For the teammate review, only the questions related to the role(duty) selected by the student should appear in the rubric.&lt;/div&gt;</summary>
		<author><name>Bjain</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:E1818_1.jpg&amp;diff=117325</id>
		<title>File:E1818 1.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:E1818_1.jpg&amp;diff=117325"/>
		<updated>2018-05-03T07:05:16Z</updated>

		<summary type="html">&lt;p&gt;Bjain: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Bjain</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2018-_Project_E1818:_Role-based_reviewing&amp;diff=117324</id>
		<title>CSC/ECE 517 Spring 2018- Project E1818: Role-based reviewing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2018-_Project_E1818:_Role-based_reviewing&amp;diff=117324"/>
		<updated>2018-05-03T07:01:57Z</updated>

		<summary type="html">&lt;p&gt;Bjain: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
&lt;br /&gt;
The project is to enable role-based team-mate reviews. These roles can be better named as duties, corresponding to the duty of a team member in a particular project. The instructor should be able to use a different rubric for evaluating the contribution of team mates with different roles.&lt;br /&gt;
Borrowing from different Agile methodologies like SCRUM, each team member has a particular role. For example,architect,facilitator and implementer. Although one member can contribute to other duties, a much more meaningful review can be done if the review rubric was role-specific. Currently, there is a single teammate review rubric for each assignment. This means that some review questions are not applicable for all team members. For instance, if there is a question which says “What percentage of the code was written by this member?” This may not be applicable for the team member who wrote tests or documentation.&lt;br /&gt;
&lt;br /&gt;
==UML Diagram==&lt;br /&gt;
&lt;br /&gt;
[[File:Uml2.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a UML Class diagram, The relationships depicted above are as follows: &lt;br /&gt;
&lt;br /&gt;
* Between the User and Duty class, there is a bidirectional association. The user table is used for both the instructor and the student. &lt;br /&gt;
** Each instructor can have multiple roles that he can choose from for a particular assignment/questionnaire.&lt;br /&gt;
** Each student can have 0 or 1 role for a particular project.&lt;br /&gt;
* For each Questionnaire instance, there are one or more Questions that can be stored, hence there is an aggregation relationship from Question to Questionnaire. This is for the grading rubric based on the role.&lt;br /&gt;
* The Question table and the Questionnaire table each will be using the the duty ID to sort out questions for a particular assignment.&lt;br /&gt;
&lt;br /&gt;
==Proposed Implementation==&lt;br /&gt;
&lt;br /&gt;
The project introduces changes from the instructor view and the student view. The steps for implementation are as follow:&lt;br /&gt;
&lt;br /&gt;
===Migration changes===&lt;br /&gt;
* .    Create Duties table: This table stores all the duties created by any instructor.&lt;br /&gt;
               * id - The duty ID will be used by other tables like the questionnaire table and hence will be the primary key.&lt;br /&gt;
               * assignment_id - An assignment has particular duties. Thus, the assignment number will be the foreign key for the Duties table. &lt;br /&gt;
               * instructor_id - The Duties created by one Instructor should be visible and reusable by that instructor only. Thus, the instructor id will also be a foreign key in the Duties table.&lt;br /&gt;
&lt;br /&gt;
*      Create assignments_duty_mappings table: If an instructor wants to add multiple duties for an assignment, storing it in the duty table will cause the duty to be overwritten. Thus we have created a table which maps an assignment and all its duties.&lt;br /&gt;
               * id &lt;br /&gt;
               * assignment_id &lt;br /&gt;
               * duty_id&lt;br /&gt;
&lt;br /&gt;
*      Create assignment_duty_questionnaire_mappings table : This table is created to store the questionnaire for team-mate review rubrics and the corresponding duty id. &lt;br /&gt;
               * id &lt;br /&gt;
               * assignment_id &lt;br /&gt;
               * duty_id&lt;br /&gt;
               * questionnaire_id&lt;br /&gt;
&lt;br /&gt;
*      Add a column entry named &amp;quot;role_based_assignment&amp;quot; in the assignments table which would be of type boolean. This field would save the status of the role based review check box.&lt;br /&gt;
*      Add a column entry named &amp;quot;allow_multiple_duties&amp;quot; in the assignments table which would be of type boolean. This field would save the status of the check box for allowing multiple students with the same role.&lt;br /&gt;
*      Add a column entry named &amp;quot;Duties&amp;quot; to the Users table which would be of type string. This field would save the duty that a student would select if role based reviews are permitted.&lt;br /&gt;
&lt;br /&gt;
===Instructor view changes===&lt;br /&gt;
*	For a particular assignment, in the 'Review Strategy' tab edit assignment,create a check box called &amp;quot;Is role based review allowed?&amp;quot; that allows an instructor to add a role based review for a particular assignment or not. This can be done by adding a check box tag in the review strategy sub page of the edit assignments page.&lt;br /&gt;
[[File:e18181_3.png]]&lt;br /&gt;
*      When the check box is ticked, the duties that have been already added and a button to &amp;quot;New duty&amp;quot; pops up. &lt;br /&gt;
[[File:Example_e18181.png]]&lt;br /&gt;
&lt;br /&gt;
*      We call the java script function ''dutiesAssign()'' using the ''ischecked'' listener. The function queries the value of the checkbox for ''role_based_review'' and depending on if the value is true or false, the hidden attributes i.e. ''allow_multiple_duties'' and ''duties_dropdown'' are displayed or kept hidden.&lt;br /&gt;
[[File:e18181_2.png]]&lt;br /&gt;
*      The instructor can select from the dropdown of duties. We have allowed multiple duties to be selected at once.The duties created by an instructor are unique for that instructor and are not displayed for any other instructor.&lt;br /&gt;
[[File:Picture1_e1818.png]]&lt;br /&gt;
*      An instructor can decide the number of duties for a particular assignment, the number of team members who can undertake a particular duty and if any of the duties are optional.  &lt;br /&gt;
*      When the assignment is saved, the duty_id is saved to the assignment_duty_mappings table. &lt;br /&gt;
*      The instructor can create Team-mate review Questionnaires for the different duties he created or can use any from the existing list of questionnaires.&lt;br /&gt;
[[File:Example2_1818.png]] &lt;br /&gt;
*      In order to do this, the instructor has to go to the Rubrics tab of edit assignment. There, if the assignment is role-based, a drop down menu displays the list of all the duties selected for an assignment.&lt;br /&gt;
[[File:Example23_1818.png]]&lt;br /&gt;
*      When the assignment is saved, the questionnaire_id is stored in the assignment_duty_questionnaire_mappings table&lt;br /&gt;
&lt;br /&gt;
===Student view changes=== &lt;br /&gt;
*	When a student goes to “Your team”,  they can see the team members, their selected duties and the option to review if these are enabled. The student can select their duty from a particular set of duties created by the instructor for that particular assignment. Upon clicking &amp;quot;Select&amp;quot; option, view is redirected to a new page where all the available duties appear as radio-buttons and the student can select one of these. This occurs only if role based reviewing is permitted for that particular assignment. If not, the standard existing view will be displayed which does not give any such option.&lt;br /&gt;
[[File:Rsz_111.jpg]]&lt;br /&gt;
[[File:Rsz_42.jpg]]&lt;br /&gt;
*  This is implemented by adding a drop down box in the student_teams view file. This would be enclosed in a conditional which would only appear if role based reviewing is permitted. &lt;br /&gt;
*	A student can only select one duty.&lt;br /&gt;
*      If the instructor has permitted multiple students to have the same role, each student will get all the duties as an option in the dropdown box. However, if the instructor has not provided permission for multiple students to have the same role, when a particular duty is selected by a student , any other student will not see that duty in the drop down box.&lt;br /&gt;
[[File:Example_student_18.png]]&lt;br /&gt;
*   This has been implemented by making a separate copy of the list of all the duties available. If multiple roles are not permitted, once a duty is selected , it is eliminated from the separate list maintained and that list is displayed to the student. There is a conditional in the student teams view file that displays the separate list in the drop down if multiple students can have the same role or else display the original list of duties.&lt;br /&gt;
*	A team member cannot change their role after the assignment submission deadline.&lt;br /&gt;
[[File:s2_18.png]]&lt;br /&gt;
*   This is implemented by taking the time and date information from the server and showing the select duties option only if the current time and date is prior to the deadline time and date. A conditional statement is included in the student teams view file for this purpose.&lt;br /&gt;
*      When a student selects a particular duty , it is stored in the database table of that user. Thus when a team-mate reviews that student , he will see a questionnaire corresponding to the duty of that student.This would enable reviews of the teammates to be accurate and specific to their role in a project.&lt;br /&gt;
&lt;br /&gt;
==Files to be modified==&lt;br /&gt;
&lt;br /&gt;
===New files===&lt;br /&gt;
Some of the new migration files we have created are&lt;br /&gt;
&lt;br /&gt;
*      db/migrate/add_duties_table.rb&lt;br /&gt;
 In this file, a ''duties'' table is created with a name field&lt;br /&gt;
&lt;br /&gt;
*      db/migrate/add_reference_of_instructor_and_assignment_to_duties.rb&lt;br /&gt;
  In this file, we have adding foreign key reference of ''assignment id'' into ''duties table''.&lt;br /&gt;
&lt;br /&gt;
*      db/migrate/add_duties_to_users.rb&lt;br /&gt;
  In this file, a column named ''duties'' is added to the ''Users'' table&lt;br /&gt;
&lt;br /&gt;
*      db/migrate/add_multiple_duties_to_assignments.rb&lt;br /&gt;
  In this file, we have added a column ''allow_multiple_duties'' to ''assignments'' table&lt;br /&gt;
&lt;br /&gt;
*      db/migrate/create_assignment_duty_questionnaire_mapping.rb&lt;br /&gt;
  In this file, we have created ''assignment_duty_questionnaire_mappings'' table and added columns for ''questionnaire_id'', ''assignment_id'' and ''duty_id''&lt;br /&gt;
&lt;br /&gt;
===Files that have to be modified===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*	app/views/assignments/edit/review_strategy.html.erb&lt;br /&gt;
 In this file, a checkbox is added to permit role based review. A hidden checkbox is added to allow multiple students to have the same role and hidden fields for adding duties along with a dropdown box for selecting from existing duties.&lt;br /&gt;
 A javascript function is added which removes the hidden attributes from for the above stated entries once the checkbox is selected.&lt;br /&gt;
 &lt;br /&gt;
*      app/views/assignments/edit/rubrics.html.erb&lt;br /&gt;
 In this file , a conditional statement is added, which displays the dropdown for selecting duties and a dropdown for selecting a teammate review for the selected duties if role based reviewing is permitted or else display the standard view.&lt;br /&gt;
        &lt;br /&gt;
*	app/views/student_teams/view.html.erb&lt;br /&gt;
 In this file, a conditional statement is added which displays the select duties dropdown box is role based reviewing is allowed or else displays the standard view. &lt;br /&gt;
*      app/controllers/response_controller.rb&lt;br /&gt;
 In this file, the new_feedback function will be edited to map the team-mate review questionnaires according to the duties created.&lt;br /&gt;
*	app/questionnaire/new.html.erb&lt;br /&gt;
 A new questionnaire will be created for each new duty created or the same questionnaire can be used.&lt;br /&gt;
*	app/questionnaire/edit.html.erb&lt;br /&gt;
 A newly created questionnaire for a particular duty can be edited.&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
*	Instructor tests&lt;br /&gt;
**	Check the box for role based reviewing. &lt;br /&gt;
***	Display and select from already existing roles(duties) with option to create new roles(duties).&lt;br /&gt;
***	Should not be able to see roles(duties) from other instructors.&lt;br /&gt;
***	Select corresponding rubrics for a particular role(duty). &lt;br /&gt;
**      If not, proceed with the default questions for the rubric for the assignment.&lt;br /&gt;
&lt;br /&gt;
*	Student(team member) tests&lt;br /&gt;
**	Before submitting the project, all team members should select a role(duty) for themselves from the roles(duties) set by the instructor.&lt;br /&gt;
**	Multiple students may have the role(duty) but 1 student cannot have multiple roles(duties).&lt;br /&gt;
&lt;br /&gt;
*	Reviewer tests&lt;br /&gt;
**	For the teammate review, only the questions related to the role(duty) selected by the student should appear in the rubric.&lt;/div&gt;</summary>
		<author><name>Bjain</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Rsz_42.jpg&amp;diff=117323</id>
		<title>File:Rsz 42.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Rsz_42.jpg&amp;diff=117323"/>
		<updated>2018-05-03T07:01:20Z</updated>

		<summary type="html">&lt;p&gt;Bjain: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Bjain</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2018-_Project_E1818:_Role-based_reviewing&amp;diff=117322</id>
		<title>CSC/ECE 517 Spring 2018- Project E1818: Role-based reviewing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2018-_Project_E1818:_Role-based_reviewing&amp;diff=117322"/>
		<updated>2018-05-03T06:52:57Z</updated>

		<summary type="html">&lt;p&gt;Bjain: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
&lt;br /&gt;
The project is to enable role-based team-mate reviews. These roles can be better named as duties, corresponding to the duty of a team member in a particular project. The instructor should be able to use a different rubric for evaluating the contribution of team mates with different roles.&lt;br /&gt;
Borrowing from different Agile methodologies like SCRUM, each team member has a particular role. For example,architect,facilitator and implementer. Although one member can contribute to other duties, a much more meaningful review can be done if the review rubric was role-specific. Currently, there is a single teammate review rubric for each assignment. This means that some review questions are not applicable for all team members. For instance, if there is a question which says “What percentage of the code was written by this member?” This may not be applicable for the team member who wrote tests or documentation.&lt;br /&gt;
&lt;br /&gt;
==UML Diagram==&lt;br /&gt;
&lt;br /&gt;
[[File:Uml2.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a UML Class diagram, The relationships depicted above are as follows: &lt;br /&gt;
&lt;br /&gt;
* Between the User and Duty class, there is a bidirectional association. The user table is used for both the instructor and the student. &lt;br /&gt;
** Each instructor can have multiple roles that he can choose from for a particular assignment/questionnaire.&lt;br /&gt;
** Each student can have 0 or 1 role for a particular project.&lt;br /&gt;
* For each Questionnaire instance, there are one or more Questions that can be stored, hence there is an aggregation relationship from Question to Questionnaire. This is for the grading rubric based on the role.&lt;br /&gt;
* The Question table and the Questionnaire table each will be using the the duty ID to sort out questions for a particular assignment.&lt;br /&gt;
&lt;br /&gt;
==Proposed Implementation==&lt;br /&gt;
&lt;br /&gt;
The project introduces changes from the instructor view and the student view. The steps for implementation are as follow:&lt;br /&gt;
&lt;br /&gt;
===Migration changes===&lt;br /&gt;
* .    Create Duties table: This table stores all the duties created by any instructor.&lt;br /&gt;
               * id - The duty ID will be used by other tables like the questionnaire table and hence will be the primary key.&lt;br /&gt;
               * assignment_id - An assignment has particular duties. Thus, the assignment number will be the foreign key for the Duties table. &lt;br /&gt;
               * instructor_id - The Duties created by one Instructor should be visible and reusable by that instructor only. Thus, the instructor id will also be a foreign key in the Duties table.&lt;br /&gt;
&lt;br /&gt;
*      Create assignments_duty_mappings table: If an instructor wants to add multiple duties for an assignment, storing it in the duty table will cause the duty to be overwritten. Thus we have created a table which maps an assignment and all its duties.&lt;br /&gt;
               * id &lt;br /&gt;
               * assignment_id &lt;br /&gt;
               * duty_id&lt;br /&gt;
&lt;br /&gt;
*      Create assignment_duty_questionnaire_mappings table : This table is created to store the questionnaire for team-mate review rubrics and the corresponding duty id. &lt;br /&gt;
               * id &lt;br /&gt;
               * assignment_id &lt;br /&gt;
               * duty_id&lt;br /&gt;
               * questionnaire_id&lt;br /&gt;
&lt;br /&gt;
*      Add a column entry named &amp;quot;role_based_assignment&amp;quot; in the assignments table which would be of type boolean. This field would save the status of the role based review check box.&lt;br /&gt;
*      Add a column entry named &amp;quot;allow_multiple_duties&amp;quot; in the assignments table which would be of type boolean. This field would save the status of the check box for allowing multiple students with the same role.&lt;br /&gt;
*      Add a column entry named &amp;quot;Duties&amp;quot; to the Users table which would be of type string. This field would save the duty that a student would select if role based reviews are permitted.&lt;br /&gt;
&lt;br /&gt;
===Instructor view changes===&lt;br /&gt;
*	For a particular assignment, in the 'Review Strategy' tab edit assignment,create a check box called &amp;quot;Is role based review allowed?&amp;quot; that allows an instructor to add a role based review for a particular assignment or not. This can be done by adding a check box tag in the review strategy sub page of the edit assignments page.&lt;br /&gt;
[[File:e18181_3.png]]&lt;br /&gt;
*      When the check box is ticked, the duties that have been already added and a button to &amp;quot;New duty&amp;quot; pops up. &lt;br /&gt;
[[File:Example_e18181.png]]&lt;br /&gt;
&lt;br /&gt;
*      We call the java script function ''dutiesAssign()'' using the ''ischecked'' listener. The function queries the value of the checkbox for ''role_based_review'' and depending on if the value is true or false, the hidden attributes i.e. ''allow_multiple_duties'' and ''duties_dropdown'' are displayed or kept hidden.&lt;br /&gt;
[[File:e18181_2.png]]&lt;br /&gt;
*      The instructor can select from the dropdown of duties. We have allowed multiple duties to be selected at once.The duties created by an instructor are unique for that instructor and are not displayed for any other instructor.&lt;br /&gt;
[[File:Picture1_e1818.png]]&lt;br /&gt;
*      An instructor can decide the number of duties for a particular assignment, the number of team members who can undertake a particular duty and if any of the duties are optional.  &lt;br /&gt;
*      When the assignment is saved, the duty_id is saved to the assignment_duty_mappings table. &lt;br /&gt;
*      The instructor can create Team-mate review Questionnaires for the different duties he created or can use any from the existing list of questionnaires.&lt;br /&gt;
[[File:Example2_1818.png]] &lt;br /&gt;
*      In order to do this, the instructor has to go to the Rubrics tab of edit assignment. There, if the assignment is role-based, a drop down menu displays the list of all the duties selected for an assignment.&lt;br /&gt;
[[File:Example23_1818.png]]&lt;br /&gt;
*      When the assignment is saved, the questionnaire_id is stored in the assignment_duty_questionnaire_mappings table&lt;br /&gt;
&lt;br /&gt;
===Student view changes=== &lt;br /&gt;
*	When a student goes to “Your team”,  they can see the team members, their selected duties and the option to review if these are enabled. The student can select their duty from a particular set of duties created by the instructor for that particular assignment. Upon clicking &amp;quot;Select&amp;quot; option, view is redirected to a new page where all the available duties appear as radio-buttons and the student can select one of these. This occurs only if role based reviewing is permitted for that particular assignment. If not, the standard existing view will be displayed which does not give any such option.&lt;br /&gt;
[[File:Rsz_111.jpg]]&lt;br /&gt;
*  This is implemented by adding a drop down box in the student_teams view file. This would be enclosed in a conditional which would only appear if role based reviewing is permitted. &lt;br /&gt;
*	A student can only select one duty.&lt;br /&gt;
*      If the instructor has permitted multiple students to have the same role, each student will get all the duties as an option in the dropdown box. However, if the instructor has not provided permission for multiple students to have the same role, when a particular duty is selected by a student , any other student will not see that duty in the drop down box.&lt;br /&gt;
[[File:Example_student_18.png]]&lt;br /&gt;
*   This has been implemented by making a separate copy of the list of all the duties available. If multiple roles are not permitted, once a duty is selected , it is eliminated from the separate list maintained and that list is displayed to the student. There is a conditional in the student teams view file that displays the separate list in the drop down if multiple students can have the same role or else display the original list of duties.&lt;br /&gt;
*	A team member cannot change their role after the assignment submission deadline.&lt;br /&gt;
[[File:s2_18.png]]&lt;br /&gt;
*   This is implemented by taking the time and date information from the server and showing the select duties option only if the current time and date is prior to the deadline time and date. A conditional statement is included in the student teams view file for this purpose.&lt;br /&gt;
*      When a student selects a particular duty , it is stored in the database table of that user. Thus when a team-mate reviews that student , he will see a questionnaire corresponding to the duty of that student.This would enable reviews of the teammates to be accurate and specific to their role in a project.&lt;br /&gt;
&lt;br /&gt;
==Files to be modified==&lt;br /&gt;
&lt;br /&gt;
===New files===&lt;br /&gt;
Some of the new migration files we have created are&lt;br /&gt;
&lt;br /&gt;
*      db/migrate/add_duties_table.rb&lt;br /&gt;
 In this file, a ''duties'' table is created with a name field&lt;br /&gt;
&lt;br /&gt;
*      db/migrate/add_reference_of_instructor_and_assignment_to_duties.rb&lt;br /&gt;
  In this file, we have adding foreign key reference of ''assignment id'' into ''duties table''.&lt;br /&gt;
&lt;br /&gt;
*      db/migrate/add_duties_to_users.rb&lt;br /&gt;
  In this file, a column named ''duties'' is added to the ''Users'' table&lt;br /&gt;
&lt;br /&gt;
*      db/migrate/add_multiple_duties_to_assignments.rb&lt;br /&gt;
  In this file, we have added a column ''allow_multiple_duties'' to ''assignments'' table&lt;br /&gt;
&lt;br /&gt;
*      db/migrate/create_assignment_duty_questionnaire_mapping.rb&lt;br /&gt;
  In this file, we have created ''assignment_duty_questionnaire_mappings'' table and added columns for ''questionnaire_id'', ''assignment_id'' and ''duty_id''&lt;br /&gt;
&lt;br /&gt;
===Files that have to be modified===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*	app/views/assignments/edit/review_strategy.html.erb&lt;br /&gt;
 In this file, a checkbox is added to permit role based review. A hidden checkbox is added to allow multiple students to have the same role and hidden fields for adding duties along with a dropdown box for selecting from existing duties.&lt;br /&gt;
 A javascript function is added which removes the hidden attributes from for the above stated entries once the checkbox is selected.&lt;br /&gt;
 &lt;br /&gt;
*      app/views/assignments/edit/rubrics.html.erb&lt;br /&gt;
 In this file , a conditional statement is added, which displays the dropdown for selecting duties and a dropdown for selecting a teammate review for the selected duties if role based reviewing is permitted or else display the standard view.&lt;br /&gt;
        &lt;br /&gt;
*	app/views/student_teams/view.html.erb&lt;br /&gt;
 In this file, a conditional statement is added which displays the select duties dropdown box is role based reviewing is allowed or else displays the standard view. &lt;br /&gt;
*      app/controllers/response_controller.rb&lt;br /&gt;
 In this file, the new_feedback function will be edited to map the team-mate review questionnaires according to the duties created.&lt;br /&gt;
*	app/questionnaire/new.html.erb&lt;br /&gt;
 A new questionnaire will be created for each new duty created or the same questionnaire can be used.&lt;br /&gt;
*	app/questionnaire/edit.html.erb&lt;br /&gt;
 A newly created questionnaire for a particular duty can be edited.&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
*	Instructor tests&lt;br /&gt;
**	Check the box for role based reviewing. &lt;br /&gt;
***	Display and select from already existing roles(duties) with option to create new roles(duties).&lt;br /&gt;
***	Should not be able to see roles(duties) from other instructors.&lt;br /&gt;
***	Select corresponding rubrics for a particular role(duty). &lt;br /&gt;
**      If not, proceed with the default questions for the rubric for the assignment.&lt;br /&gt;
&lt;br /&gt;
*	Student(team member) tests&lt;br /&gt;
**	Before submitting the project, all team members should select a role(duty) for themselves from the roles(duties) set by the instructor.&lt;br /&gt;
**	Multiple students may have the role(duty) but 1 student cannot have multiple roles(duties).&lt;br /&gt;
&lt;br /&gt;
*	Reviewer tests&lt;br /&gt;
**	For the teammate review, only the questions related to the role(duty) selected by the student should appear in the rubric.&lt;/div&gt;</summary>
		<author><name>Bjain</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Rsz_111.jpg&amp;diff=117321</id>
		<title>File:Rsz 111.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Rsz_111.jpg&amp;diff=117321"/>
		<updated>2018-05-03T06:52:23Z</updated>

		<summary type="html">&lt;p&gt;Bjain: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Bjain</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2018-_Project_E1818:_Role-based_reviewing&amp;diff=117320</id>
		<title>CSC/ECE 517 Spring 2018- Project E1818: Role-based reviewing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2018-_Project_E1818:_Role-based_reviewing&amp;diff=117320"/>
		<updated>2018-05-03T06:48:19Z</updated>

		<summary type="html">&lt;p&gt;Bjain: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
&lt;br /&gt;
The project is to enable role-based team-mate reviews. These roles can be better named as duties, corresponding to the duty of a team member in a particular project. The instructor should be able to use a different rubric for evaluating the contribution of team mates with different roles.&lt;br /&gt;
Borrowing from different Agile methodologies like SCRUM, each team member has a particular role. For example,architect,facilitator and implementer. Although one member can contribute to other duties, a much more meaningful review can be done if the review rubric was role-specific. Currently, there is a single teammate review rubric for each assignment. This means that some review questions are not applicable for all team members. For instance, if there is a question which says “What percentage of the code was written by this member?” This may not be applicable for the team member who wrote tests or documentation.&lt;br /&gt;
&lt;br /&gt;
==UML Diagram==&lt;br /&gt;
&lt;br /&gt;
[[File:Uml2.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a UML Class diagram, The relationships depicted above are as follows: &lt;br /&gt;
&lt;br /&gt;
* Between the User and Duty class, there is a bidirectional association. The user table is used for both the instructor and the student. &lt;br /&gt;
** Each instructor can have multiple roles that he can choose from for a particular assignment/questionnaire.&lt;br /&gt;
** Each student can have 0 or 1 role for a particular project.&lt;br /&gt;
* For each Questionnaire instance, there are one or more Questions that can be stored, hence there is an aggregation relationship from Question to Questionnaire. This is for the grading rubric based on the role.&lt;br /&gt;
* The Question table and the Questionnaire table each will be using the the duty ID to sort out questions for a particular assignment.&lt;br /&gt;
&lt;br /&gt;
==Proposed Implementation==&lt;br /&gt;
&lt;br /&gt;
The project introduces changes from the instructor view and the student view. The steps for implementation are as follow:&lt;br /&gt;
&lt;br /&gt;
===Migration changes===&lt;br /&gt;
* .    Create Duties table: This table stores all the duties created by any instructor.&lt;br /&gt;
               * id - The duty ID will be used by other tables like the questionnaire table and hence will be the primary key.&lt;br /&gt;
               * assignment_id - An assignment has particular duties. Thus, the assignment number will be the foreign key for the Duties table. &lt;br /&gt;
               * instructor_id - The Duties created by one Instructor should be visible and reusable by that instructor only. Thus, the instructor id will also be a foreign key in the Duties table.&lt;br /&gt;
&lt;br /&gt;
*      Create assignments_duty_mappings table: If an instructor wants to add multiple duties for an assignment, storing it in the duty table will cause the duty to be overwritten. Thus we have created a table which maps an assignment and all its duties.&lt;br /&gt;
               * id &lt;br /&gt;
               * assignment_id &lt;br /&gt;
               * duty_id&lt;br /&gt;
&lt;br /&gt;
*      Create assignment_duty_questionnaire_mappings table : This table is created to store the questionnaire for team-mate review rubrics and the corresponding duty id. &lt;br /&gt;
               * id &lt;br /&gt;
               * assignment_id &lt;br /&gt;
               * duty_id&lt;br /&gt;
               * questionnaire_id&lt;br /&gt;
&lt;br /&gt;
*      Add a column entry named &amp;quot;role_based_assignment&amp;quot; in the assignments table which would be of type boolean. This field would save the status of the role based review check box.&lt;br /&gt;
*      Add a column entry named &amp;quot;allow_multiple_duties&amp;quot; in the assignments table which would be of type boolean. This field would save the status of the check box for allowing multiple students with the same role.&lt;br /&gt;
*      Add a column entry named &amp;quot;Duties&amp;quot; to the Users table which would be of type string. This field would save the duty that a student would select if role based reviews are permitted.&lt;br /&gt;
&lt;br /&gt;
===Instructor view changes===&lt;br /&gt;
*	For a particular assignment, in the 'Review Strategy' tab edit assignment,create a check box called &amp;quot;Is role based review allowed?&amp;quot; that allows an instructor to add a role based review for a particular assignment or not. This can be done by adding a check box tag in the review strategy sub page of the edit assignments page.&lt;br /&gt;
[[File:e18181_3.png]]&lt;br /&gt;
*      When the check box is ticked, the duties that have been already added and a button to &amp;quot;New duty&amp;quot; pops up. &lt;br /&gt;
[[File:Example_e18181.png]]&lt;br /&gt;
&lt;br /&gt;
*      We call the java script function ''dutiesAssign()'' using the ''ischecked'' listener. The function queries the value of the checkbox for ''role_based_review'' and depending on if the value is true or false, the hidden attributes i.e. ''allow_multiple_duties'' and ''duties_dropdown'' are displayed or kept hidden.&lt;br /&gt;
[[File:e18181_2.png]]&lt;br /&gt;
*      The instructor can select from the dropdown of duties. We have allowed multiple duties to be selected at once.The duties created by an instructor are unique for that instructor and are not displayed for any other instructor.&lt;br /&gt;
[[File:Picture1_e1818.png]]&lt;br /&gt;
*      An instructor can decide the number of duties for a particular assignment, the number of team members who can undertake a particular duty and if any of the duties are optional.  &lt;br /&gt;
*      When the assignment is saved, the duty_id is saved to the assignment_duty_mappings table. &lt;br /&gt;
*      The instructor can create Team-mate review Questionnaires for the different duties he created or can use any from the existing list of questionnaires.&lt;br /&gt;
[[File:Example2_1818.png]] &lt;br /&gt;
*      In order to do this, the instructor has to go to the Rubrics tab of edit assignment. There, if the assignment is role-based, a drop down menu displays the list of all the duties selected for an assignment.&lt;br /&gt;
[[File:Example23_1818.png]]&lt;br /&gt;
*      When the assignment is saved, the questionnaire_id is stored in the assignment_duty_questionnaire_mappings table&lt;br /&gt;
&lt;br /&gt;
===Student view changes=== &lt;br /&gt;
*	When a student goes to “Your team”,  they can see the team members, their selected duties and the option to review if these are enabled. The student can select their duty from a particular set of duties created by the instructor for that particular assignment. Upon clicking &amp;quot;Select&amp;quot; option, view is redirected to a new page where all the available duties appear as radio-buttons and the student can select one of these. This occurs only if role based reviewing is permitted for that particular assignment. If not, the standard existing view will be displayed which does not give any such option.&lt;br /&gt;
[[File:YourTeam_view1.JPG]]&lt;br /&gt;
*  This is implemented by adding a drop down box in the student_teams view file. This would be enclosed in a conditional which would only appear if role based reviewing is permitted. &lt;br /&gt;
*	A student can only select one duty.&lt;br /&gt;
*      If the instructor has permitted multiple students to have the same role, each student will get all the duties as an option in the dropdown box. However, if the instructor has not provided permission for multiple students to have the same role, when a particular duty is selected by a student , any other student will not see that duty in the drop down box.&lt;br /&gt;
[[File:Example_student_18.png]]&lt;br /&gt;
*   This has been implemented by making a separate copy of the list of all the duties available. If multiple roles are not permitted, once a duty is selected , it is eliminated from the separate list maintained and that list is displayed to the student. There is a conditional in the student teams view file that displays the separate list in the drop down if multiple students can have the same role or else display the original list of duties.&lt;br /&gt;
*	A team member cannot change their role after the assignment submission deadline.&lt;br /&gt;
[[File:s2_18.png]]&lt;br /&gt;
*   This is implemented by taking the time and date information from the server and showing the select duties option only if the current time and date is prior to the deadline time and date. A conditional statement is included in the student teams view file for this purpose.&lt;br /&gt;
*      When a student selects a particular duty , it is stored in the database table of that user. Thus when a team-mate reviews that student , he will see a questionnaire corresponding to the duty of that student.This would enable reviews of the teammates to be accurate and specific to their role in a project.&lt;br /&gt;
&lt;br /&gt;
==Files to be modified==&lt;br /&gt;
&lt;br /&gt;
===New files===&lt;br /&gt;
Some of the new migration files we have created are&lt;br /&gt;
&lt;br /&gt;
*      db/migrate/add_duties_table.rb&lt;br /&gt;
 In this file, a ''duties'' table is created with a name field&lt;br /&gt;
&lt;br /&gt;
*      db/migrate/add_reference_of_instructor_and_assignment_to_duties.rb&lt;br /&gt;
  In this file, we have adding foreign key reference of ''assignment id'' into ''duties table''.&lt;br /&gt;
&lt;br /&gt;
*      db/migrate/add_duties_to_users.rb&lt;br /&gt;
  In this file, a column named ''duties'' is added to the ''Users'' table&lt;br /&gt;
&lt;br /&gt;
*      db/migrate/add_multiple_duties_to_assignments.rb&lt;br /&gt;
  In this file, we have added a column ''allow_multiple_duties'' to ''assignments'' table&lt;br /&gt;
&lt;br /&gt;
*      db/migrate/create_assignment_duty_questionnaire_mapping.rb&lt;br /&gt;
  In this file, we have created ''assignment_duty_questionnaire_mappings'' table and added columns for ''questionnaire_id'', ''assignment_id'' and ''duty_id''&lt;br /&gt;
&lt;br /&gt;
===Files that have to be modified===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*	app/views/assignments/edit/review_strategy.html.erb&lt;br /&gt;
 In this file, a checkbox is added to permit role based review. A hidden checkbox is added to allow multiple students to have the same role and hidden fields for adding duties along with a dropdown box for selecting from existing duties.&lt;br /&gt;
 A javascript function is added which removes the hidden attributes from for the above stated entries once the checkbox is selected.&lt;br /&gt;
 &lt;br /&gt;
*      app/views/assignments/edit/rubrics.html.erb&lt;br /&gt;
 In this file , a conditional statement is added, which displays the dropdown for selecting duties and a dropdown for selecting a teammate review for the selected duties if role based reviewing is permitted or else display the standard view.&lt;br /&gt;
        &lt;br /&gt;
*	app/views/student_teams/view.html.erb&lt;br /&gt;
 In this file, a conditional statement is added which displays the select duties dropdown box is role based reviewing is allowed or else displays the standard view. &lt;br /&gt;
*      app/controllers/response_controller.rb&lt;br /&gt;
 In this file, the new_feedback function will be edited to map the team-mate review questionnaires according to the duties created.&lt;br /&gt;
*	app/questionnaire/new.html.erb&lt;br /&gt;
 A new questionnaire will be created for each new duty created or the same questionnaire can be used.&lt;br /&gt;
*	app/questionnaire/edit.html.erb&lt;br /&gt;
 A newly created questionnaire for a particular duty can be edited.&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
*	Instructor tests&lt;br /&gt;
**	Check the box for role based reviewing. &lt;br /&gt;
***	Display and select from already existing roles(duties) with option to create new roles(duties).&lt;br /&gt;
***	Should not be able to see roles(duties) from other instructors.&lt;br /&gt;
***	Select corresponding rubrics for a particular role(duty). &lt;br /&gt;
**      If not, proceed with the default questions for the rubric for the assignment.&lt;br /&gt;
&lt;br /&gt;
*	Student(team member) tests&lt;br /&gt;
**	Before submitting the project, all team members should select a role(duty) for themselves from the roles(duties) set by the instructor.&lt;br /&gt;
**	Multiple students may have the role(duty) but 1 student cannot have multiple roles(duties).&lt;br /&gt;
&lt;br /&gt;
*	Reviewer tests&lt;br /&gt;
**	For the teammate review, only the questions related to the role(duty) selected by the student should appear in the rubric.&lt;/div&gt;</summary>
		<author><name>Bjain</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2018-_Project_E1818:_Role-based_reviewing&amp;diff=117319</id>
		<title>CSC/ECE 517 Spring 2018- Project E1818: Role-based reviewing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2018-_Project_E1818:_Role-based_reviewing&amp;diff=117319"/>
		<updated>2018-05-03T06:46:59Z</updated>

		<summary type="html">&lt;p&gt;Bjain: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
&lt;br /&gt;
The project is to enable role-based team-mate reviews. These roles can be better named as duties, corresponding to the duty of a team member in a particular project. The instructor should be able to use a different rubric for evaluating the contribution of team mates with different roles.&lt;br /&gt;
Borrowing from different Agile methodologies like SCRUM, each team member has a particular role. For example,architect,facilitator and implementer. Although one member can contribute to other duties, a much more meaningful review can be done if the review rubric was role-specific. Currently, there is a single teammate review rubric for each assignment. This means that some review questions are not applicable for all team members. For instance, if there is a question which says “What percentage of the code was written by this member?” This may not be applicable for the team member who wrote tests or documentation.&lt;br /&gt;
&lt;br /&gt;
==UML Diagram==&lt;br /&gt;
&lt;br /&gt;
[[File:Uml2.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a UML Class diagram, The relationships depicted above are as follows: &lt;br /&gt;
&lt;br /&gt;
* Between the User and Duty class, there is a bidirectional association. The user table is used for both the instructor and the student. &lt;br /&gt;
** Each instructor can have multiple roles that he can choose from for a particular assignment/questionnaire.&lt;br /&gt;
** Each student can have 0 or 1 role for a particular project.&lt;br /&gt;
* For each Questionnaire instance, there are one or more Questions that can be stored, hence there is an aggregation relationship from Question to Questionnaire. This is for the grading rubric based on the role.&lt;br /&gt;
* The Question table and the Questionnaire table each will be using the the duty ID to sort out questions for a particular assignment.&lt;br /&gt;
&lt;br /&gt;
==Proposed Implementation==&lt;br /&gt;
&lt;br /&gt;
The project introduces changes from the instructor view and the student view. The steps for implementation are as follow:&lt;br /&gt;
&lt;br /&gt;
===Migration changes===&lt;br /&gt;
* .    Create Duties table: This table stores all the duties created by any instructor.&lt;br /&gt;
               * id - The duty ID will be used by other tables like the questionnaire table and hence will be the primary key.&lt;br /&gt;
               * assignment_id - An assignment has particular duties. Thus, the assignment number will be the foreign key for the Duties table. &lt;br /&gt;
               * instructor_id - The Duties created by one Instructor should be visible and reusable by that instructor only. Thus, the instructor id will also be a foreign key in the Duties table.&lt;br /&gt;
&lt;br /&gt;
*      Create assignments_duty_mappings table: If an instructor wants to add multiple duties for an assignment, storing it in the duty table will cause the duty to be overwritten. Thus we have created a table which maps an assignment and all its duties.&lt;br /&gt;
               * id &lt;br /&gt;
               * assignment_id &lt;br /&gt;
               * duty_id&lt;br /&gt;
&lt;br /&gt;
*      Create assignment_duty_questionnaire_mappings table : This table is created to store the questionnaire for team-mate review rubrics and the corresponding duty id. &lt;br /&gt;
               * id &lt;br /&gt;
               * assignment_id &lt;br /&gt;
               * duty_id&lt;br /&gt;
               * questionnaire_id&lt;br /&gt;
&lt;br /&gt;
*      Add a column entry named &amp;quot;role_based_assignment&amp;quot; in the assignments table which would be of type boolean. This field would save the status of the role based review check box.&lt;br /&gt;
*      Add a column entry named &amp;quot;allow_multiple_duties&amp;quot; in the assignments table which would be of type boolean. This field would save the status of the check box for allowing multiple students with the same role.&lt;br /&gt;
*      Add a column entry named &amp;quot;Duties&amp;quot; to the Users table which would be of type string. This field would save the duty that a student would select if role based reviews are permitted.&lt;br /&gt;
&lt;br /&gt;
===Instructor view changes===&lt;br /&gt;
*	For a particular assignment, in the 'Review Strategy' tab edit assignment,create a check box called &amp;quot;Is role based review allowed?&amp;quot; that allows an instructor to add a role based review for a particular assignment or not. This can be done by adding a check box tag in the review strategy sub page of the edit assignments page.&lt;br /&gt;
[[File:e18181_3.png]]&lt;br /&gt;
*      When the check box is ticked, the duties that have been already added and a button to &amp;quot;New duty&amp;quot; pops up. &lt;br /&gt;
[[File:Example_e18181.png]]&lt;br /&gt;
&lt;br /&gt;
*      We call the java script function ''dutiesAssign()'' using the ''ischecked'' listener. The function queries the value of the checkbox for ''role_based_review'' and depending on if the value is true or false, the hidden attributes i.e. ''allow_multiple_duties'' and ''duties_dropdown'' are displayed or kept hidden.&lt;br /&gt;
[[File:e18181_2.png]]&lt;br /&gt;
*      The instructor can select from the dropdown of duties. We have allowed multiple duties to be selected at once.The duties created by an instructor are unique for that instructor and are not displayed for any other instructor.&lt;br /&gt;
[[File:Picture1_e1818.png]]&lt;br /&gt;
*      An instructor can decide the number of duties for a particular assignment, the number of team members who can undertake a particular duty and if any of the duties are optional.  &lt;br /&gt;
*      When the assignment is saved, the duty_id is saved to the assignment_duty_mappings table. &lt;br /&gt;
*      The instructor can create Team-mate review Questionnaires for the different duties he created or can use any from the existing list of questionnaires.&lt;br /&gt;
[[File:Example2_1818.png]] &lt;br /&gt;
*      In order to do this, the instructor has to go to the Rubrics tab of edit assignment. There, if the assignment is role-based, a drop down menu displays the list of all the duties selected for an assignment.&lt;br /&gt;
[[File:Example23_1818.png]]&lt;br /&gt;
*      When the assignment is saved, the questionnaire_id is stored in the assignment_duty_questionnaire_mappings table&lt;br /&gt;
&lt;br /&gt;
===Student view changes=== &lt;br /&gt;
*	When a student goes to “Your team”,  they can see the team members, their selected duties and the option to review if these are enabled. The student can select their duty from a particular set of duties created by the instructor for that particular assignment. Upon clicking &amp;quot;Select&amp;quot; option, view is redirected to a new page where all the available duties appear as radio-buttons and the student can select one of these. This occurs only if role based reviewing is permitted for that particular assignment. If not, the standard existing view will be displayed which does not give any such option.&lt;br /&gt;
[[File:YourTeam.jpg]]&lt;br /&gt;
*  This is implemented by adding a drop down box in the student_teams view file. This would be enclosed in a conditional which would only appear if role based reviewing is permitted. &lt;br /&gt;
*	A student can only select one duty.&lt;br /&gt;
*      If the instructor has permitted multiple students to have the same role, each student will get all the duties as an option in the dropdown box. However, if the instructor has not provided permission for multiple students to have the same role, when a particular duty is selected by a student , any other student will not see that duty in the drop down box.&lt;br /&gt;
[[File:Example_student_18.png]]&lt;br /&gt;
*   This has been implemented by making a separate copy of the list of all the duties available. If multiple roles are not permitted, once a duty is selected , it is eliminated from the separate list maintained and that list is displayed to the student. There is a conditional in the student teams view file that displays the separate list in the drop down if multiple students can have the same role or else display the original list of duties.&lt;br /&gt;
*	A team member cannot change their role after the assignment submission deadline.&lt;br /&gt;
[[File:s2_18.png]]&lt;br /&gt;
*   This is implemented by taking the time and date information from the server and showing the select duties option only if the current time and date is prior to the deadline time and date. A conditional statement is included in the student teams view file for this purpose.&lt;br /&gt;
*      When a student selects a particular duty , it is stored in the database table of that user. Thus when a team-mate reviews that student , he will see a questionnaire corresponding to the duty of that student.This would enable reviews of the teammates to be accurate and specific to their role in a project.&lt;br /&gt;
&lt;br /&gt;
==Files to be modified==&lt;br /&gt;
&lt;br /&gt;
===New files===&lt;br /&gt;
Some of the new migration files we have created are&lt;br /&gt;
&lt;br /&gt;
*      db/migrate/add_duties_table.rb&lt;br /&gt;
 In this file, a ''duties'' table is created with a name field&lt;br /&gt;
&lt;br /&gt;
*      db/migrate/add_reference_of_instructor_and_assignment_to_duties.rb&lt;br /&gt;
  In this file, we have adding foreign key reference of ''assignment id'' into ''duties table''.&lt;br /&gt;
&lt;br /&gt;
*      db/migrate/add_duties_to_users.rb&lt;br /&gt;
  In this file, a column named ''duties'' is added to the ''Users'' table&lt;br /&gt;
&lt;br /&gt;
*      db/migrate/add_multiple_duties_to_assignments.rb&lt;br /&gt;
  In this file, we have added a column ''allow_multiple_duties'' to ''assignments'' table&lt;br /&gt;
&lt;br /&gt;
*      db/migrate/create_assignment_duty_questionnaire_mapping.rb&lt;br /&gt;
  In this file, we have created ''assignment_duty_questionnaire_mappings'' table and added columns for ''questionnaire_id'', ''assignment_id'' and ''duty_id''&lt;br /&gt;
&lt;br /&gt;
===Files that have to be modified===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*	app/views/assignments/edit/review_strategy.html.erb&lt;br /&gt;
 In this file, a checkbox is added to permit role based review. A hidden checkbox is added to allow multiple students to have the same role and hidden fields for adding duties along with a dropdown box for selecting from existing duties.&lt;br /&gt;
 A javascript function is added which removes the hidden attributes from for the above stated entries once the checkbox is selected.&lt;br /&gt;
 &lt;br /&gt;
*      app/views/assignments/edit/rubrics.html.erb&lt;br /&gt;
 In this file , a conditional statement is added, which displays the dropdown for selecting duties and a dropdown for selecting a teammate review for the selected duties if role based reviewing is permitted or else display the standard view.&lt;br /&gt;
        &lt;br /&gt;
*	app/views/student_teams/view.html.erb&lt;br /&gt;
 In this file, a conditional statement is added which displays the select duties dropdown box is role based reviewing is allowed or else displays the standard view. &lt;br /&gt;
*      app/controllers/response_controller.rb&lt;br /&gt;
 In this file, the new_feedback function will be edited to map the team-mate review questionnaires according to the duties created.&lt;br /&gt;
*	app/questionnaire/new.html.erb&lt;br /&gt;
 A new questionnaire will be created for each new duty created or the same questionnaire can be used.&lt;br /&gt;
*	app/questionnaire/edit.html.erb&lt;br /&gt;
 A newly created questionnaire for a particular duty can be edited.&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
*	Instructor tests&lt;br /&gt;
**	Check the box for role based reviewing. &lt;br /&gt;
***	Display and select from already existing roles(duties) with option to create new roles(duties).&lt;br /&gt;
***	Should not be able to see roles(duties) from other instructors.&lt;br /&gt;
***	Select corresponding rubrics for a particular role(duty). &lt;br /&gt;
**      If not, proceed with the default questions for the rubric for the assignment.&lt;br /&gt;
&lt;br /&gt;
*	Student(team member) tests&lt;br /&gt;
**	Before submitting the project, all team members should select a role(duty) for themselves from the roles(duties) set by the instructor.&lt;br /&gt;
**	Multiple students may have the role(duty) but 1 student cannot have multiple roles(duties).&lt;br /&gt;
&lt;br /&gt;
*	Reviewer tests&lt;br /&gt;
**	For the teammate review, only the questions related to the role(duty) selected by the student should appear in the rubric.&lt;/div&gt;</summary>
		<author><name>Bjain</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:YourTeam_view1.JPG&amp;diff=117318</id>
		<title>File:YourTeam view1.JPG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:YourTeam_view1.JPG&amp;diff=117318"/>
		<updated>2018-05-03T06:46:03Z</updated>

		<summary type="html">&lt;p&gt;Bjain: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Bjain</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2018-_Project_E1818:_Role-based_reviewing&amp;diff=117317</id>
		<title>CSC/ECE 517 Spring 2018- Project E1818: Role-based reviewing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2018-_Project_E1818:_Role-based_reviewing&amp;diff=117317"/>
		<updated>2018-05-03T06:45:24Z</updated>

		<summary type="html">&lt;p&gt;Bjain: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
&lt;br /&gt;
The project is to enable role-based team-mate reviews. These roles can be better named as duties, corresponding to the duty of a team member in a particular project. The instructor should be able to use a different rubric for evaluating the contribution of team mates with different roles.&lt;br /&gt;
Borrowing from different Agile methodologies like SCRUM, each team member has a particular role. For example,architect,facilitator and implementer. Although one member can contribute to other duties, a much more meaningful review can be done if the review rubric was role-specific. Currently, there is a single teammate review rubric for each assignment. This means that some review questions are not applicable for all team members. For instance, if there is a question which says “What percentage of the code was written by this member?” This may not be applicable for the team member who wrote tests or documentation.&lt;br /&gt;
&lt;br /&gt;
==UML Diagram==&lt;br /&gt;
&lt;br /&gt;
[[File:Uml2.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a UML Class diagram, The relationships depicted above are as follows: &lt;br /&gt;
&lt;br /&gt;
* Between the User and Duty class, there is a bidirectional association. The user table is used for both the instructor and the student. &lt;br /&gt;
** Each instructor can have multiple roles that he can choose from for a particular assignment/questionnaire.&lt;br /&gt;
** Each student can have 0 or 1 role for a particular project.&lt;br /&gt;
* For each Questionnaire instance, there are one or more Questions that can be stored, hence there is an aggregation relationship from Question to Questionnaire. This is for the grading rubric based on the role.&lt;br /&gt;
* The Question table and the Questionnaire table each will be using the the duty ID to sort out questions for a particular assignment.&lt;br /&gt;
&lt;br /&gt;
==Proposed Implementation==&lt;br /&gt;
&lt;br /&gt;
The project introduces changes from the instructor view and the student view. The steps for implementation are as follow:&lt;br /&gt;
&lt;br /&gt;
===Migration changes===&lt;br /&gt;
* .    Create Duties table: This table stores all the duties created by any instructor.&lt;br /&gt;
               * id - The duty ID will be used by other tables like the questionnaire table and hence will be the primary key.&lt;br /&gt;
               * assignment_id - An assignment has particular duties. Thus, the assignment number will be the foreign key for the Duties table. &lt;br /&gt;
               * instructor_id - The Duties created by one Instructor should be visible and reusable by that instructor only. Thus, the instructor id will also be a foreign key in the Duties table.&lt;br /&gt;
&lt;br /&gt;
*      Create assignments_duty_mappings table: If an instructor wants to add multiple duties for an assignment, storing it in the duty table will cause the duty to be overwritten. Thus we have created a table which maps an assignment and all its duties.&lt;br /&gt;
               * id &lt;br /&gt;
               * assignment_id &lt;br /&gt;
               * duty_id&lt;br /&gt;
&lt;br /&gt;
*      Create assignment_duty_questionnaire_mappings table : This table is created to store the questionnaire for team-mate review rubrics and the corresponding duty id. &lt;br /&gt;
               * id &lt;br /&gt;
               * assignment_id &lt;br /&gt;
               * duty_id&lt;br /&gt;
               * questionnaire_id&lt;br /&gt;
&lt;br /&gt;
*      Add a column entry named &amp;quot;role_based_assignment&amp;quot; in the assignments table which would be of type boolean. This field would save the status of the role based review check box.&lt;br /&gt;
*      Add a column entry named &amp;quot;allow_multiple_duties&amp;quot; in the assignments table which would be of type boolean. This field would save the status of the check box for allowing multiple students with the same role.&lt;br /&gt;
*      Add a column entry named &amp;quot;Duties&amp;quot; to the Users table which would be of type string. This field would save the duty that a student would select if role based reviews are permitted.&lt;br /&gt;
&lt;br /&gt;
===Instructor view changes===&lt;br /&gt;
*	For a particular assignment, in the 'Review Strategy' tab edit assignment,create a check box called &amp;quot;Is role based review allowed?&amp;quot; that allows an instructor to add a role based review for a particular assignment or not. This can be done by adding a check box tag in the review strategy sub page of the edit assignments page.&lt;br /&gt;
[[File:e18181_3.png]]&lt;br /&gt;
*      When the check box is ticked, the duties that have been already added and a button to &amp;quot;New duty&amp;quot; pops up. &lt;br /&gt;
[[File:Example_e18181.png]]&lt;br /&gt;
&lt;br /&gt;
*      We call the java script function ''dutiesAssign()'' using the ''ischecked'' listener. The function queries the value of the checkbox for ''role_based_review'' and depending on if the value is true or false, the hidden attributes i.e. ''allow_multiple_duties'' and ''duties_dropdown'' are displayed or kept hidden.&lt;br /&gt;
[[File:e18181_2.png]]&lt;br /&gt;
*      The instructor can select from the dropdown of duties. We have allowed multiple duties to be selected at once.The duties created by an instructor are unique for that instructor and are not displayed for any other instructor.&lt;br /&gt;
[[File:Picture1_e1818.png]]&lt;br /&gt;
*      An instructor can decide the number of duties for a particular assignment, the number of team members who can undertake a particular duty and if any of the duties are optional.  &lt;br /&gt;
*      When the assignment is saved, the duty_id is saved to the assignment_duty_mappings table. &lt;br /&gt;
*      The instructor can create Team-mate review Questionnaires for the different duties he created or can use any from the existing list of questionnaires.&lt;br /&gt;
[[File:Example2_1818.png]] &lt;br /&gt;
*      In order to do this, the instructor has to go to the Rubrics tab of edit assignment. There, if the assignment is role-based, a drop down menu displays the list of all the duties selected for an assignment.&lt;br /&gt;
[[File:Example23_1818.png]]&lt;br /&gt;
*      When the assignment is saved, the questionnaire_id is stored in the assignment_duty_questionnaire_mappings table&lt;br /&gt;
&lt;br /&gt;
===Student view changes=== &lt;br /&gt;
*	When a student goes to “Your team”,  they can see the team members, their selected duties and the option to review if these are enabled. The student can select their duty from a particular set of duties created by the instructor for that particular assignment. Upon clicking &amp;quot;Select&amp;quot; option, view is redirected to a new page where all the available duties appear as radio-buttons and the student can select one of these. This occurs only if role based reviewing is permitted for that particular assignment. If not, the standard existing view will be displayed which does not give any such option.&lt;br /&gt;
*  This is implemented by adding a drop down box in the student_teams view file. This would be enclosed in a conditional which would only appear if role based reviewing is permitted. &lt;br /&gt;
*	A student can only select one duty.&lt;br /&gt;
*      If the instructor has permitted multiple students to have the same role, each student will get all the duties as an option in the dropdown box. However, if the instructor has not provided permission for multiple students to have the same role, when a particular duty is selected by a student , any other student will not see that duty in the drop down box.&lt;br /&gt;
[[File:Example_student_18.png]]&lt;br /&gt;
*   This has been implemented by making a separate copy of the list of all the duties available. If multiple roles are not permitted, once a duty is selected , it is eliminated from the separate list maintained and that list is displayed to the student. There is a conditional in the student teams view file that displays the separate list in the drop down if multiple students can have the same role or else display the original list of duties.&lt;br /&gt;
*	A team member cannot change their role after the assignment submission deadline.&lt;br /&gt;
[[File:s2_18.png]]&lt;br /&gt;
*   This is implemented by taking the time and date information from the server and showing the select duties option only if the current time and date is prior to the deadline time and date. A conditional statement is included in the student teams view file for this purpose.&lt;br /&gt;
*      When a student selects a particular duty , it is stored in the database table of that user. Thus when a team-mate reviews that student , he will see a questionnaire corresponding to the duty of that student.This would enable reviews of the teammates to be accurate and specific to their role in a project.&lt;br /&gt;
&lt;br /&gt;
==Files to be modified==&lt;br /&gt;
&lt;br /&gt;
===New files===&lt;br /&gt;
Some of the new migration files we have created are&lt;br /&gt;
&lt;br /&gt;
*      db/migrate/add_duties_table.rb&lt;br /&gt;
 In this file, a ''duties'' table is created with a name field&lt;br /&gt;
&lt;br /&gt;
*      db/migrate/add_reference_of_instructor_and_assignment_to_duties.rb&lt;br /&gt;
  In this file, we have adding foreign key reference of ''assignment id'' into ''duties table''.&lt;br /&gt;
&lt;br /&gt;
*      db/migrate/add_duties_to_users.rb&lt;br /&gt;
  In this file, a column named ''duties'' is added to the ''Users'' table&lt;br /&gt;
&lt;br /&gt;
*      db/migrate/add_multiple_duties_to_assignments.rb&lt;br /&gt;
  In this file, we have added a column ''allow_multiple_duties'' to ''assignments'' table&lt;br /&gt;
&lt;br /&gt;
*      db/migrate/create_assignment_duty_questionnaire_mapping.rb&lt;br /&gt;
  In this file, we have created ''assignment_duty_questionnaire_mappings'' table and added columns for ''questionnaire_id'', ''assignment_id'' and ''duty_id''&lt;br /&gt;
&lt;br /&gt;
===Files that have to be modified===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*	app/views/assignments/edit/review_strategy.html.erb&lt;br /&gt;
 In this file, a checkbox is added to permit role based review. A hidden checkbox is added to allow multiple students to have the same role and hidden fields for adding duties along with a dropdown box for selecting from existing duties.&lt;br /&gt;
 A javascript function is added which removes the hidden attributes from for the above stated entries once the checkbox is selected.&lt;br /&gt;
 &lt;br /&gt;
*      app/views/assignments/edit/rubrics.html.erb&lt;br /&gt;
 In this file , a conditional statement is added, which displays the dropdown for selecting duties and a dropdown for selecting a teammate review for the selected duties if role based reviewing is permitted or else display the standard view.&lt;br /&gt;
        &lt;br /&gt;
*	app/views/student_teams/view.html.erb&lt;br /&gt;
 In this file, a conditional statement is added which displays the select duties dropdown box is role based reviewing is allowed or else displays the standard view. &lt;br /&gt;
*      app/controllers/response_controller.rb&lt;br /&gt;
 In this file, the new_feedback function will be edited to map the team-mate review questionnaires according to the duties created.&lt;br /&gt;
*	app/questionnaire/new.html.erb&lt;br /&gt;
 A new questionnaire will be created for each new duty created or the same questionnaire can be used.&lt;br /&gt;
*	app/questionnaire/edit.html.erb&lt;br /&gt;
 A newly created questionnaire for a particular duty can be edited.&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
*	Instructor tests&lt;br /&gt;
**	Check the box for role based reviewing. &lt;br /&gt;
***	Display and select from already existing roles(duties) with option to create new roles(duties).&lt;br /&gt;
***	Should not be able to see roles(duties) from other instructors.&lt;br /&gt;
***	Select corresponding rubrics for a particular role(duty). &lt;br /&gt;
**      If not, proceed with the default questions for the rubric for the assignment.&lt;br /&gt;
&lt;br /&gt;
*	Student(team member) tests&lt;br /&gt;
**	Before submitting the project, all team members should select a role(duty) for themselves from the roles(duties) set by the instructor.&lt;br /&gt;
**	Multiple students may have the role(duty) but 1 student cannot have multiple roles(duties).&lt;br /&gt;
&lt;br /&gt;
*	Reviewer tests&lt;br /&gt;
**	For the teammate review, only the questions related to the role(duty) selected by the student should appear in the rubric.&lt;/div&gt;</summary>
		<author><name>Bjain</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2018-_Project_E1818:_Role-based_reviewing&amp;diff=116614</id>
		<title>CSC/ECE 517 Spring 2018- Project E1818: Role-based reviewing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2018-_Project_E1818:_Role-based_reviewing&amp;diff=116614"/>
		<updated>2018-04-14T02:16:16Z</updated>

		<summary type="html">&lt;p&gt;Bjain: /* Test Plan */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Overview===&lt;br /&gt;
&lt;br /&gt;
The project is a role-based reviewing project. These roles can be better named as duties, corresponding to the duty of a team member in a particular project/assignment. Borrowing from different Agile methodologies like SCRUM, each team member has a particular role. For example, one team member may work mainly on the documentation, another on writing tests and another member may write most of the code. Although there is no clear distinction in the duties as each team member still contributes to other duties, a much more meaningful review can be done if the review questionnaire was role specific rather than being assignment specific. Currently, there is a single teammate review rubric for each assignment. This means that some review rubrics are not applicable for all the projects and also for all team members. For instance, if there is a question which says “What percentage of the code was written by this member?” This may not be applicable for the team member who wrote tests and it is definitely not applicable for the member who wrote the documentation. The project aims at creating different review rubrics for different duties, which an instructor can create for an assignment. Students can select a particular duty they want to perform in that project.&lt;br /&gt;
&lt;br /&gt;
==UML Diagram==&lt;br /&gt;
&lt;br /&gt;
[[File:Uml2.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a UML Class diagram, The relationships depicted above are as follows: &lt;br /&gt;
&lt;br /&gt;
* Between the User and Duty class, there is a bidirectional association. The user table is used for both the instructor and the student. &lt;br /&gt;
** Each instructor can have multiple roles that he can choose from for a particular assignment/questionnaire.&lt;br /&gt;
** Each student can have 0 or 1 role for a particular project.&lt;br /&gt;
* For each Questionnaire instance, there are one or more Questions that can be stored, hence there is an aggregation relationship from Question to Questionnaire. This is for the grading rubric based on the role.&lt;br /&gt;
* The Question table and the Questionnaire table each will be using the the duty ID to sort out questions for a particular assignment.&lt;br /&gt;
&lt;br /&gt;
==Proposed Implementation==&lt;br /&gt;
&lt;br /&gt;
The project introduces changes from the instructor view and the student view. The steps for implementation are as follow:&lt;br /&gt;
===Migration changes===&lt;br /&gt;
* .    Create a migration for adding the duties table having the following fields:&lt;br /&gt;
               * id&lt;br /&gt;
               * assignment_id&lt;br /&gt;
               * instructor_id&lt;br /&gt;
               * course_id&lt;br /&gt;
*	The duty ID will be used by other tables like the questionnaire table and hence will be the primary key.&lt;br /&gt;
*	An assignment has particular duties. Thus, the assignment number will be the foreign key for the Duties table. &lt;br /&gt;
*	The Duties created by one Instructor should be visible and reusable by that instructor only. Thus, the instructor id will also be a foreign key in the Duties table.&lt;br /&gt;
*      Add a column entry named &amp;quot;is role based review enabled&amp;quot; in the assignments table which would be of type boolean. This field would save the status of the role based review checkbox.&lt;br /&gt;
*      Add a column entry named &amp;quot;Can multiple students select the same role ?&amp;quot;  in the assignments table which would be of type boolean. This field would save the status of the checkbox for multiple students with the same role.&lt;br /&gt;
*      Add a column entry named &amp;quot;Duties&amp;quot; to the Users table which would be of type string. This field would save the duty that a student would select if role based reviews are permitted.&lt;br /&gt;
&lt;br /&gt;
===Instructor view changes===&lt;br /&gt;
*	For a particular assignment, create a check box called &amp;quot;Is role based review allowed.? &amp;quot;that allows an instructor to add a role based review for a particular assignment or not. This can be done by adding a checkbox tag in the review strategy subpage of the edit assignments page.&lt;br /&gt;
*	If the instructor selects the checkbox for role-based reviewing, then a button should appear for adding roles called “Add Duties” along with a dropdown to select from the previously added duties by the same instructor. &lt;br /&gt;
* .    The duties appearing in the dropdown would consist of duties added by the instructor for any of his courses.    &lt;br /&gt;
*      This can be achieved by including a subform tag in the same table entry as the checkbox which should have a hidden attribute.&lt;br /&gt;
* .    A javascript function would be created which is invoked when the status of the checkbox changes. This function should remove the hidden attribute of the subform tag if the checkbox is checked. This would enable the add duties field and the select duties dropdown to appear only on checking the box.&lt;br /&gt;
*	An instructor can decide the number of duties for a particular assignment, the number of team members who can undertake a particular duty and if any of the duties are optional. &lt;br /&gt;
*      To implement this , another checkbox called &amp;quot;Can multiple students select the same role ? &amp;quot;is added in the review strategy subpage of the edit assignments page. This will be visible only if the role based reviewing checkbox is selected.  &lt;br /&gt;
*	The instructor can create Team-mate review Questionnaires for the different duties he created or can use any from the existing list of questionnaires.&lt;br /&gt;
* .    The instructor would have to create questionnaires for the newly created duties in the standard way by going to manage questionnaires and creating a new public or private item.&lt;br /&gt;
*      If the role based review checkbox is selected, the instructor would get a dropbox box to select the duty and another dropdown box to select the team-mate review questionnaire applicable for this duty. In this way , the instructor can select different questionnaires for different duties. If role based reviewing is not permitted on an assignment, the existing view with a single dropdown box for selecting the team-mate review would be displayed.&lt;br /&gt;
*     This can be implemented by making changes in the rubrics subpage of the edit assignments page. A conditional statement would be included in the view which would show the modified view if role based review is permitted or else it would show the existing view.&lt;br /&gt;
&lt;br /&gt;
===Student view changes=== &lt;br /&gt;
*	When a student goes to “Your team”, he should be able to select a duty from a drop down menu which would display all the duties added by an instructor for that particular assignment. This should only occur if role based reviewing is permitted for that particular assignment. If not, the standard existing view will be displayed which does not give any such option.&lt;br /&gt;
* .    This can be implemented by adding a dropdown box in the student_teams view file. This would be enclosed in a conditional which would only appear if role based reviewing is permitted. &lt;br /&gt;
*	A student can only select one duty.&lt;br /&gt;
*      If the instructor has permitted multiple students to have the same role, each student will get all the duties as an option in the dropdown box.However, if the instructor has not provided permission for multiple students to have the same role, when a particular duty is selected by a student , any other student will not see that duty in the drop down box.&lt;br /&gt;
* .   This can be implemented by making a separate copy of the list of all the duties available. If multiple roles are not permitted, once a duty is selected , it can be eliminated from the separate list maintained and that list can be displayed to the student. Thus , there will be a conditional in the student teams view file that displays the separate list in the dropdown if multiple students can have the same role or else display the original list of duties.&lt;br /&gt;
*	A team member cannot change their role after the assignment submission deadline.&lt;br /&gt;
* .    This can be implemented by taking the time and date information from the server and showing the select duties option only if the current time and date is prior to the deadline time and date. A conditional statement will be included in the student teams view file for this purpose.&lt;br /&gt;
*      When a student selects a particular duty , it is stored in the database table of that user. Thus when a team-mate reviews that student , he will see a questionnaire corresponding to the duty of that student.This would enable reviews of the teammates to be accurate and specific to their role in a project.&lt;br /&gt;
&lt;br /&gt;
==Files to be modified==&lt;br /&gt;
&lt;br /&gt;
===New files===&lt;br /&gt;
&lt;br /&gt;
*      db/migrate/add_duties_table.rb           -      In this file, a duties table is created with a name field and foreign key references.&lt;br /&gt;
*      db/migrate/add_is_role_based_review_enabled_to_assignments.eb     -      In this file, a column named is_role_based_review_enabled is added to the Assignments table &lt;br /&gt;
*      db/migrate/add_can_multiple_students_have_the _same_duty_to_assignments.rb    -     In this file, a column named is can_multiple_students_have_the_same_role is added to the Assignments table &lt;br /&gt;
*      db/migrate/add_duties_to_users.rb .   -      In this file, a column named duties is added to the Users table &lt;br /&gt;
&lt;br /&gt;
===Files that have to be modified===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*	app/views/assignments/edit/review_strategy.html.erb .  -   In this file, a checkbox is added to permit role based review. A hidden checkbox is added to allow multiple students to have the same role and hidden fields for adding duties along with a dropdown box for selecting from existing duties. A javascript function should be added which removes the hidden attributes from for the above stated entries once the checkbox is selected.&lt;br /&gt;
 &lt;br /&gt;
*      app/views/assignments/edit/rubrics.html.erb  -  In this file , a conditional statement is added, which displays the dropdown for selecting duties and a dropdown for selecting a teammate review for the selected duties if role based reviewing is permitted or else display the standard view.&lt;br /&gt;
        &lt;br /&gt;
*	app/views/student_teams/view     -       In this file, a conditional statement is added which displays the select duties dropdown box is role based reviewing is allowed or else displays the standard view. Another conditional statement should be added which does not display the select duties option if the deadline has passed or else it displays it.&lt;br /&gt;
*	app/tree_display/views/list&lt;br /&gt;
*	app/questionnaire/new&lt;br /&gt;
*	app/questionnaire/edit&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
*	Instructor tests&lt;br /&gt;
**	Check the box for role based reviewing. &lt;br /&gt;
***	Display and select from already existing roles(duties) with option to create new roles(duties).&lt;br /&gt;
***	Should not be able to see roles(duties) from other instructors.&lt;br /&gt;
***	Select corresponding rubrics for a particular role(duty). &lt;br /&gt;
**      If not, proceed with the default questions for the rubric for the assignment.&lt;br /&gt;
&lt;br /&gt;
*	Student(team member) tests&lt;br /&gt;
**	Before submitting the project, all team members should select a role(duty) for themselves from the roles(duties) set by the instructor.&lt;br /&gt;
**	Multiple students may have the role(duty) but 1 student cannot have multiple roles(duties).&lt;br /&gt;
&lt;br /&gt;
*	Reviewer tests&lt;br /&gt;
**	For the teammate review, only the questions related to the role(duty) selected by the student should appear in the rubric.&lt;/div&gt;</summary>
		<author><name>Bjain</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2018-_Project_E1818:_Role-based_reviewing&amp;diff=116602</id>
		<title>CSC/ECE 517 Spring 2018- Project E1818: Role-based reviewing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2018-_Project_E1818:_Role-based_reviewing&amp;diff=116602"/>
		<updated>2018-04-14T01:53:57Z</updated>

		<summary type="html">&lt;p&gt;Bjain: /* Test Plan */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Overview===&lt;br /&gt;
&lt;br /&gt;
The project is a role-based reviewing project. These roles can be better named as duties, corresponding to the duty of a team member in a particular project/assignment. Borrowing from different Agile methodologies like SCRUM, each team member has a particular role. For example, one team member may work mainly on the documentation, another on writing tests and another member may write most of the code. Although there is no clear distinction in the duties as each team member still contributes to other duties, a much more meaningful review can be done if the review questionnaire was role specific rather than being assignment specific. Currently, there is a single teammate review rubric for each assignment. This means that some review rubrics are not applicable for all the projects and also for all team members. For instance, if there is a question which says “What percentage of the code was written by this member?” This may not be applicable for the team member who wrote tests and it is definitely not applicable for the member who wrote the documentation. The project aims at creating different review rubrics for different duties, which an instructor can create for an assignment. Students can select a particular duty they want to perform in that project.&lt;br /&gt;
&lt;br /&gt;
==UML Diagram==&lt;br /&gt;
&lt;br /&gt;
[[File:Uml2.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a UML Class diagram, The relationships depicted above are as follows: &lt;br /&gt;
&lt;br /&gt;
* Between the User and Duty class, there is a bidirectional association. The user table is used for both the instructor and the student. &lt;br /&gt;
** Each instructor can have multiple roles that he can choose from for a particular assignment/questionnaire.&lt;br /&gt;
** Each student can have 0 or 1 role for a particular project.&lt;br /&gt;
* For each Questionnaire instance, there are one or more Questions that can be stored, hence there is an aggregation relationship from Question to Questionnaire. This is for the grading rubric based on the role.&lt;br /&gt;
* The Question table and the Questionnaire table each will be using the the duty ID to sort out questions for a particular assignment.&lt;br /&gt;
&lt;br /&gt;
==Proposed Implementation==&lt;br /&gt;
&lt;br /&gt;
The project introduces changes from the instructor view and the student view. The steps for implementation are as follow:&lt;br /&gt;
===Migration changes===&lt;br /&gt;
* .    Create a migration for adding the duties table having the following fields:&lt;br /&gt;
               * id&lt;br /&gt;
               * assignment_id&lt;br /&gt;
               * instructor_id&lt;br /&gt;
               * course_id&lt;br /&gt;
*	The duty ID will be used by other tables like the questionnaire table and hence will be the primary key.&lt;br /&gt;
*	An assignment has particular duties. Thus, the assignment number will be the foreign key for the Duties table. &lt;br /&gt;
*	The Duties created by one Instructor should be visible and reusable by that instructor only. Thus, the instructor id will also be a foreign key in the Duties table.&lt;br /&gt;
*      Add a column entry named &amp;quot;is role based review enabled&amp;quot; in the assignments table which would be of type boolean. This field would save the status of the role based review checkbox.&lt;br /&gt;
*      Add a column entry named &amp;quot;Can multiple students select the same role ?&amp;quot;  in the assignments table which would be of type boolean. This field would save the status of the checkbox for multiple students with the same role.&lt;br /&gt;
*      Add a column entry named &amp;quot;Duties&amp;quot; to the Users table which would be of type string. This field would save the duty that a student would select if role based reviews are permitted.&lt;br /&gt;
&lt;br /&gt;
===Instructor view changes===&lt;br /&gt;
*	For a particular assignment, create a check box called &amp;quot;Is role based review allowed.? &amp;quot;that allows an instructor to add a role based review for a particular assignment or not. This can be done by adding a checkbox tag in the review strategy subpage of the edit assignments page.&lt;br /&gt;
*	If the instructor selects the checkbox for role-based reviewing, then a button should appear for adding roles called “Add Duties” along with a dropdown to select from the previously added duties by the same instructor. &lt;br /&gt;
* .    The duties appearing in the dropdown would consist of duties added by the instructor for any of his courses.    &lt;br /&gt;
*      This can be achieved by including a subform tag in the same table entry as the checkbox which should have a hidden attribute.&lt;br /&gt;
* .    A javascript function would be created which is invoked when the status of the checkbox changes. This function should remove the hidden attribute of the subform tag if the checkbox is checked. This would enable the add duties field and the select duties dropdown to appear only on checking the box.&lt;br /&gt;
*	An instructor can decide the number of duties for a particular assignment, the number of team members who can undertake a particular duty and if any of the duties are optional. &lt;br /&gt;
*      To implement this , another checkbox called &amp;quot;Can multiple students select the same role ? &amp;quot;is added in the review strategy subpage of the edit assignments page. This will be visible only if the role based reviewing checkbox is selected.  &lt;br /&gt;
*	The instructor can create Team-mate review Questionnaires for the different duties he created or can use any from the existing list of questionnaires.&lt;br /&gt;
* .    The instructor would have to create questionnaires for the newly created duties in the standard way by going to manage questionnaires and creating a new public or private item.&lt;br /&gt;
*      If the role based review checkbox is selected, the instructor would get a dropbox box to select the duty and another dropdown box to select the team-mate review questionnaire applicable for this duty. In this way , the instructor can select different questionnaires for different duties. If role based reviewing is not permitted on an assignment, the existing view with a single dropdown box for selecting the team-mate review would be displayed.&lt;br /&gt;
*     This can be implemented by making changes in the rubrics subpage of the edit assignments page. A conditional statement would be included in the view which would show the modified view if role based review is permitted or else it would show the existing view.&lt;br /&gt;
&lt;br /&gt;
===Student view changes=== &lt;br /&gt;
*	When a student goes to “Your team”, he should be able to select a duty from a drop down menu which would display all the duties added by an instructor for that particular assignment. This should only occur if role based reviewing is permitted for that particular assignment. If not, the standard existing view will be displayed which does not give any such option.&lt;br /&gt;
* .    This can be implemented by adding a dropdown box in the student_teams view file. This would be enclosed in a conditional which would only appear if role based reviewing is permitted. &lt;br /&gt;
*	A student can only select one duty.&lt;br /&gt;
*      If the instructor has permitted multiple students to have the same role, each student will get all the duties as an option in the dropdown box.However, if the instructor has not provided permission for multiple students to have the same role, when a particular duty is selected by a student , any other student will not see that duty in the drop down box.&lt;br /&gt;
* .   This can be implemented by making a separate copy of the list of all the duties available. If multiple roles are not permitted, once a duty is selected , it can be eliminated from the separate list maintained and that list can be displayed to the student. Thus , there will be a conditional in the student teams view file that displays the separate list in the dropdown if multiple students can have the same role or else display the original list of duties.&lt;br /&gt;
*	A team member cannot change their role after the assignment submission deadline.&lt;br /&gt;
* .    This can be implemented by taking the time and date information from the server and showing the select duties option only if the current time and date is prior to the deadline time and date. A conditional statement will be included in the student teams view file for this purpose.&lt;br /&gt;
*      When a student selects a particular duty , it is stored in the database table of that user. Thus when a team-mate reviews that student , he will see a questionnaire corresponding to the duty of that student.This would enable reviews of the teammates to be accurate and specific to their role in a project.&lt;br /&gt;
&lt;br /&gt;
==Files to be modified==&lt;br /&gt;
&lt;br /&gt;
===New files===&lt;br /&gt;
&lt;br /&gt;
*	Duties Table&lt;br /&gt;
**	Duty ID&lt;br /&gt;
**	Name of duty&lt;br /&gt;
**	Instructor user id&lt;br /&gt;
&lt;br /&gt;
===Files that have to be modified===&lt;br /&gt;
&lt;br /&gt;
*	app/views/assignment/edit&lt;br /&gt;
        &lt;br /&gt;
*	app/views/student_teams/view&lt;br /&gt;
*	app/tree_display/views/list&lt;br /&gt;
*	app/questionnaire/new&lt;br /&gt;
*	app/questionnaire/edit&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
*	Instructor tests&lt;br /&gt;
**	Check the box for role based reviewing. &lt;br /&gt;
***	Display and select from already existing roles(duties) with option to create new roles(duties).&lt;br /&gt;
***	Should not be able to see roles(duties) from other instructors.&lt;br /&gt;
***	Select corresponding rubrics for a particular role(duty). &lt;br /&gt;
**      If not, proceed with the default questions for the rubric for the assignment./&lt;br /&gt;
&lt;br /&gt;
*	Student(team member) tests&lt;br /&gt;
**	Before submitting the project, the team members should be able to add a role(duty) for themselves from the roles(duties) set by the instructor.&lt;br /&gt;
**	Multiple students may have the role(duty) but 1 student cannot have multiple roles(duties).&lt;br /&gt;
&lt;br /&gt;
*	Reviewer tests&lt;br /&gt;
**	For the teammate review, students with different roles(duties) should have different questions because of the different rubrics.&lt;/div&gt;</summary>
		<author><name>Bjain</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2018-_Project_E1818:_Role-based_reviewing&amp;diff=116601</id>
		<title>CSC/ECE 517 Spring 2018- Project E1818: Role-based reviewing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2018-_Project_E1818:_Role-based_reviewing&amp;diff=116601"/>
		<updated>2018-04-14T01:53:20Z</updated>

		<summary type="html">&lt;p&gt;Bjain: /* Test Plan */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Overview===&lt;br /&gt;
&lt;br /&gt;
The project is a role-based reviewing project. These roles can be better named as duties, corresponding to the duty of a team member in a particular project/assignment. Borrowing from different Agile methodologies like SCRUM, each team member has a particular role. For example, one team member may work mainly on the documentation, another on writing tests and another member may write most of the code. Although there is no clear distinction in the duties as each team member still contributes to other duties, a much more meaningful review can be done if the review questionnaire was role specific rather than being assignment specific. Currently, there is a single teammate review rubric for each assignment. This means that some review rubrics are not applicable for all the projects and also for all team members. For instance, if there is a question which says “What percentage of the code was written by this member?” This may not be applicable for the team member who wrote tests and it is definitely not applicable for the member who wrote the documentation. The project aims at creating different review rubrics for different duties, which an instructor can create for an assignment. Students can select a particular duty they want to perform in that project.&lt;br /&gt;
&lt;br /&gt;
==UML Diagram==&lt;br /&gt;
&lt;br /&gt;
[[File:Uml2.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a UML Class diagram, The relationships depicted above are as follows: &lt;br /&gt;
&lt;br /&gt;
* Between the User and Duty class, there is a bidirectional association. The user table is used for both the instructor and the student. &lt;br /&gt;
** Each instructor can have multiple roles that he can choose from for a particular assignment/questionnaire.&lt;br /&gt;
** Each student can have 0 or 1 role for a particular project.&lt;br /&gt;
* For each Questionnaire instance, there are one or more Questions that can be stored, hence there is an aggregation relationship from Question to Questionnaire. This is for the grading rubric based on the role.&lt;br /&gt;
* The Question table and the Questionnaire table each will be using the the duty ID to sort out questions for a particular assignment.&lt;br /&gt;
&lt;br /&gt;
==Proposed Implementation==&lt;br /&gt;
&lt;br /&gt;
The project introduces changes from the instructor view and the student view. The steps for implementation are as follow:&lt;br /&gt;
===Migration changes===&lt;br /&gt;
* .    Create a migration for adding the duties table having the following fields:&lt;br /&gt;
               * id&lt;br /&gt;
               * assignment_id&lt;br /&gt;
               * instructor_id&lt;br /&gt;
               * course_id&lt;br /&gt;
*	The duty ID will be used by other tables like the questionnaire table and hence will be the primary key.&lt;br /&gt;
*	An assignment has particular duties. Thus, the assignment number will be the foreign key for the Duties table. &lt;br /&gt;
*	The Duties created by one Instructor should be visible and reusable by that instructor only. Thus, the instructor id will also be a foreign key in the Duties table.&lt;br /&gt;
*      Add a column entry named &amp;quot;is role based review enabled&amp;quot; in the assignments table which would be of type boolean. This field would save the status of the role based review checkbox.&lt;br /&gt;
*      Add a column entry named &amp;quot;Can multiple students select the same role ?&amp;quot;  in the assignments table which would be of type boolean. This field would save the status of the checkbox for multiple students with the same role.&lt;br /&gt;
*      Add a column entry named &amp;quot;Duties&amp;quot; to the Users table which would be of type string. This field would save the duty that a student would select if role based reviews are permitted.&lt;br /&gt;
&lt;br /&gt;
===Instructor view changes===&lt;br /&gt;
*	For a particular assignment, create a check box called &amp;quot;Is role based review allowed.? &amp;quot;that allows an instructor to add a role based review for a particular assignment or not. This can be done by adding a checkbox tag in the review strategy subpage of the edit assignments page.&lt;br /&gt;
*	If the instructor selects the checkbox for role-based reviewing, then a button should appear for adding roles called “Add Duties” along with a dropdown to select from the previously added duties by the same instructor. &lt;br /&gt;
* .    The duties appearing in the dropdown would consist of duties added by the instructor for any of his courses.    &lt;br /&gt;
*      This can be achieved by including a subform tag in the same table entry as the checkbox which should have a hidden attribute.&lt;br /&gt;
* .    A javascript function would be created which is invoked when the status of the checkbox changes. This function should remove the hidden attribute of the subform tag if the checkbox is checked. This would enable the add duties field and the select duties dropdown to appear only on checking the box.&lt;br /&gt;
*	An instructor can decide the number of duties for a particular assignment, the number of team members who can undertake a particular duty and if any of the duties are optional. &lt;br /&gt;
*      To implement this , another checkbox called &amp;quot;Can multiple students select the same role ? &amp;quot;is added in the review strategy subpage of the edit assignments page. This will be visible only if the role based reviewing checkbox is selected.  &lt;br /&gt;
*	The instructor can create Team-mate review Questionnaires for the different duties he created or can use any from the existing list of questionnaires.&lt;br /&gt;
* .    The instructor would have to create questionnaires for the newly created duties in the standard way by going to manage questionnaires and creating a new public or private item.&lt;br /&gt;
*      If the role based review checkbox is selected, the instructor would get a dropbox box to select the duty and another dropdown box to select the team-mate review questionnaire applicable for this duty. In this way , the instructor can select different questionnaires for different duties. If role based reviewing is not permitted on an assignment, the existing view with a single dropdown box for selecting the team-mate review would be displayed.&lt;br /&gt;
*     This can be implemented by making changes in the rubrics subpage of the edit assignments page. A conditional statement would be included in the view which would show the modified view if role based review is permitted or else it would show the existing view.&lt;br /&gt;
&lt;br /&gt;
===Student view changes=== &lt;br /&gt;
*	When a student goes to “Your team”, he should be able to select a duty from a drop down menu which would display all the duties added by an instructor for that particular assignment. This should only occur if role based reviewing is permitted for that particular assignment. If not, the standard existing view will be displayed which does not give any such option.&lt;br /&gt;
* .    This can be implemented by adding a dropdown box in the student_teams view file. This would be enclosed in a conditional which would only appear if role based reviewing is permitted. &lt;br /&gt;
*	A student can only select one duty.&lt;br /&gt;
*      If the instructor has permitted multiple students to have the same role, each student will get all the duties as an option in the dropdown box.However, if the instructor has not provided permission for multiple students to have the same role, when a particular duty is selected by a student , any other student will not see that duty in the drop down box.&lt;br /&gt;
* .   This can be implemented by making a separate copy of the list of all the duties available. If multiple roles are not permitted, once a duty is selected , it can be eliminated from the separate list maintained and that list can be displayed to the student. Thus , there will be a conditional in the student teams view file that displays the separate list in the dropdown if multiple students can have the same role or else display the original list of duties.&lt;br /&gt;
*	A team member cannot change their role after the assignment submission deadline.&lt;br /&gt;
* .    This can be implemented by taking the time and date information from the server and showing the select duties option only if the current time and date is prior to the deadline time and date. A conditional statement will be included in the student teams view file for this purpose.&lt;br /&gt;
*      When a student selects a particular duty , it is stored in the database table of that user. Thus when a team-mate reviews that student , he will see a questionnaire corresponding to the duty of that student.This would enable reviews of the teammates to be accurate and specific to their role in a project.&lt;br /&gt;
&lt;br /&gt;
==Files to be modified==&lt;br /&gt;
&lt;br /&gt;
===New files===&lt;br /&gt;
&lt;br /&gt;
*	Duties Table&lt;br /&gt;
**	Duty ID&lt;br /&gt;
**	Name of duty&lt;br /&gt;
**	Instructor user id&lt;br /&gt;
&lt;br /&gt;
===Files that have to be modified===&lt;br /&gt;
&lt;br /&gt;
*	app/views/assignment/edit&lt;br /&gt;
        &lt;br /&gt;
*	app/views/student_teams/view&lt;br /&gt;
*	app/tree_display/views/list&lt;br /&gt;
*	app/questionnaire/new&lt;br /&gt;
*	app/questionnaire/edit&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
*	Instructor tests&lt;br /&gt;
**	Check the box for role based reviewing. &lt;br /&gt;
***	Display and select from already existing roles(duties) and able to create new roles(duties).&lt;br /&gt;
***	Should not be able to see roles(duties) from other instructors.&lt;br /&gt;
***	Select corresponding rubrics for a particular role(duty). &lt;br /&gt;
**      If not, proceed with the default questions for the rubric for the assignment./&lt;br /&gt;
&lt;br /&gt;
*	Student(team member) tests&lt;br /&gt;
**	Before submitting the project, the team members should be able to add a role(duty) for themselves from the roles(duties) set by the instructor.&lt;br /&gt;
**	Multiple students may have the role(duty) but 1 student cannot have multiple roles(duties).&lt;br /&gt;
&lt;br /&gt;
*	Reviewer tests&lt;br /&gt;
**	For the teammate review, students with different roles(duties) should have different questions because of the different rubrics.&lt;/div&gt;</summary>
		<author><name>Bjain</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2018-_Project_E1818:_Role-based_reviewing&amp;diff=116599</id>
		<title>CSC/ECE 517 Spring 2018- Project E1818: Role-based reviewing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2018-_Project_E1818:_Role-based_reviewing&amp;diff=116599"/>
		<updated>2018-04-14T01:51:26Z</updated>

		<summary type="html">&lt;p&gt;Bjain: /* Test Plan */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Overview===&lt;br /&gt;
&lt;br /&gt;
The project is a role-based reviewing project. These roles can be better named as duties, corresponding to the duty of a team member in a particular project/assignment. Borrowing from different Agile methodologies like SCRUM, each team member has a particular role. For example, one team member may work mainly on the documentation, another on writing tests and another member may write most of the code. Although there is no clear distinction in the duties as each team member still contributes to other duties, a much more meaningful review can be done if the review questionnaire was role specific rather than being assignment specific. Currently, there is a single teammate review rubric for each assignment. This means that some review rubrics are not applicable for all the projects and also for all team members. For instance, if there is a question which says “What percentage of the code was written by this member?” This may not be applicable for the team member who wrote tests and it is definitely not applicable for the member who wrote the documentation. The project aims at creating different review rubrics for different duties, which an instructor can create for an assignment. Students can select a particular duty they want to perform in that project.&lt;br /&gt;
&lt;br /&gt;
==UML Diagram==&lt;br /&gt;
&lt;br /&gt;
[[File:Uml2.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a UML Class diagram, The relationships depicted above are as follows: &lt;br /&gt;
&lt;br /&gt;
* Between the User and Duty class, there is a bidirectional association. The user table is used for both the instructor and the student. &lt;br /&gt;
** Each instructor can have multiple roles that he can choose from for a particular assignment/questionnaire.&lt;br /&gt;
** Each student can have 0 or 1 role for a particular project.&lt;br /&gt;
* For each Questionnaire instance, there are one or more Questions that can be stored, hence there is an aggregation relationship from Question to Questionnaire. This is for the grading rubric based on the role.&lt;br /&gt;
* The Question table and the Questionnaire table each will be using the the duty ID to sort out questions for a particular assignment.&lt;br /&gt;
&lt;br /&gt;
==Proposed Implementation==&lt;br /&gt;
&lt;br /&gt;
The project introduces changes from the instructor view and the student view. The steps for implementation are as follow:&lt;br /&gt;
===Migration changes===&lt;br /&gt;
* .    Create a migration for adding the duties table having the following fields:&lt;br /&gt;
               * id&lt;br /&gt;
               * assignment_id&lt;br /&gt;
               * instructor_id&lt;br /&gt;
               * course_id&lt;br /&gt;
*	The duty ID will be used by other tables like the questionnaire table and hence will be the primary key.&lt;br /&gt;
*	An assignment has particular duties. Thus, the assignment number will be the foreign key for the Duties table. &lt;br /&gt;
*	The Duties created by one Instructor should be visible and reusable by that instructor only. Thus, the instructor id will also be a foreign key in the Duties table.&lt;br /&gt;
*      Add a column entry named &amp;quot;is role based review enabled&amp;quot; in the assignments table which would be of type boolean. This field would save the status of the role based review checkbox.&lt;br /&gt;
*      Add a column entry named &amp;quot;Can multiple students select the same role ?&amp;quot;  in the assignments table which would be of type boolean. This field would save the status of the checkbox for multiple students with the same role.&lt;br /&gt;
*      Add a column entry named &amp;quot;Duties&amp;quot; to the Users table which would be of type string. This field would save the duty that a student would select if role based reviews are permitted.&lt;br /&gt;
&lt;br /&gt;
===Instructor view changes===&lt;br /&gt;
*	For a particular assignment, create a check box called &amp;quot;Is role based review allowed.? &amp;quot;that allows an instructor to add a role based review for a particular assignment or not. This can be done by adding a checkbox tag in the review strategy subpage of the edit assignments page.&lt;br /&gt;
*	If the instructor selects the checkbox for role-based reviewing, then a button should appear for adding roles called “Add Duties” along with a dropdown to select from the previously added duties by the same instructor. &lt;br /&gt;
* .    The duties appearing in the dropdown would consist of duties added by the instructor for any of his courses.    &lt;br /&gt;
*      This can be achieved by including a subform tag in the same table entry as the checkbox which should have a hidden attribute.&lt;br /&gt;
* .    A javascript function would be created which is invoked when the status of the checkbox changes. This function should remove the hidden attribute of the subform tag if the checkbox is checked. This would enable the add duties field and the select duties dropdown to appear only on checking the box.&lt;br /&gt;
*	An instructor can decide the number of duties for a particular assignment, the number of team members who can undertake a particular duty and if any of the duties are optional. &lt;br /&gt;
*      To implement this , another checkbox called &amp;quot;Can multiple students select the same role ? &amp;quot;is added in the review strategy subpage of the edit assignments page. This will be visible only if the role based reviewing checkbox is selected.  &lt;br /&gt;
*	The instructor can create Team-mate review Questionnaires for the different duties he created or can use any from the existing list of questionnaires.&lt;br /&gt;
* .    The instructor would have to create questionnaires for the newly created duties in the standard way by going to manage questionnaires and creating a new public or private item.&lt;br /&gt;
*      If the role based review checkbox is selected, the instructor would get a dropbox box to select the duty and another dropdown box to select the team-mate review questionnaire applicable for this duty. In this way , the instructor can select different questionnaires for different duties. If role based reviewing is not permitted on an assignment, the existing view with a single dropdown box for selecting the team-mate review would be displayed.&lt;br /&gt;
*     This can be implemented by making changes in the rubrics subpage of the edit assignments page. A conditional statement would be included in the view which would show the modified view if role based review is permitted or else it would show the existing view.&lt;br /&gt;
&lt;br /&gt;
===Student view changes=== &lt;br /&gt;
*	When a student goes to “Your team”, he should be able to select a duty from a drop down menu which would display all the duties added by an instructor for that particular assignment. This should only occur if role based reviewing is permitted for that particular assignment. If not, the standard existing view will be displayed which does not give any such option.&lt;br /&gt;
* .    This can be implemented by adding a dropdown box in the student_teams view file. This would be enclosed in a conditional which would only appear if role based reviewing is permitted. &lt;br /&gt;
*	A student can only select one duty.&lt;br /&gt;
*      If the instructor has permitted multiple students to have the same role, each student will get all the duties as an option in the dropdown box.However, if the instructor has not provided permission for multiple students to have the same role, when a particular duty is selected by a student , any other student will not see that duty in the drop down box.&lt;br /&gt;
* .   This can be implemented by making a separate copy of the list of all the duties available. If multiple roles are not permitted, once a duty is selected , it can be eliminated from the separate list maintained and that list can be displayed to the student. Thus , there will be a conditional in the student teams view file that displays the separate list in the dropdown if multiple students can have the same role or else display the original list of duties.&lt;br /&gt;
*	A team member cannot change their role after the assignment submission deadline.&lt;br /&gt;
* .    This can be implemented by taking the time and date information from the server and showing the select duties option only if the current time and date is prior to the deadline time and date. A conditional statement will be included in the student teams view file for this purpose.&lt;br /&gt;
*      When a student selects a particular duty , it is stored in the database table of that user. Thus when a team-mate reviews that student , he will see a questionnaire corresponding to the duty of that student.This would enable reviews of the teammates to be accurate and specific to their role in a project.&lt;br /&gt;
&lt;br /&gt;
==Files to be modified==&lt;br /&gt;
&lt;br /&gt;
===New files===&lt;br /&gt;
&lt;br /&gt;
*	Duties Table&lt;br /&gt;
**	Duty ID&lt;br /&gt;
**	Name of duty&lt;br /&gt;
**	Instructor user id&lt;br /&gt;
&lt;br /&gt;
===Files that have to be modified===&lt;br /&gt;
&lt;br /&gt;
*	app/views/assignment/edit&lt;br /&gt;
        &lt;br /&gt;
*	app/views/student_teams/view&lt;br /&gt;
*	app/tree_display/views/list&lt;br /&gt;
*	app/questionnaire/new&lt;br /&gt;
*	app/questionnaire/edit&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
*	Instructor tests&lt;br /&gt;
**	Check the box for role based reviewing. &lt;br /&gt;
***	Able to create new roles(duties) and select from already existing roles(duties).&lt;br /&gt;
***	Should not be able to see roles(duties) from other instructors.&lt;br /&gt;
***	Select corresponding rubrics for a particular role(duty). &lt;br /&gt;
**      If not, proceed with the default questions for the rubric for the assignment./&lt;br /&gt;
&lt;br /&gt;
*	Student(team member) tests&lt;br /&gt;
**	Before submitting the project, the team members should be able to add a role(duty) for themselves from the roles(duties) set by the instructor.&lt;br /&gt;
**	Multiple students may have the role(duty) but 1 student cannot have multiple roles(duties).&lt;br /&gt;
&lt;br /&gt;
*	Reviewer tests&lt;br /&gt;
**	For the teammate review, students with different roles(duties) should have different questions because of the different rubrics.&lt;/div&gt;</summary>
		<author><name>Bjain</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2018-_Project_E1818:_Role-based_reviewing&amp;diff=116598</id>
		<title>CSC/ECE 517 Spring 2018- Project E1818: Role-based reviewing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2018-_Project_E1818:_Role-based_reviewing&amp;diff=116598"/>
		<updated>2018-04-14T01:50:07Z</updated>

		<summary type="html">&lt;p&gt;Bjain: /* Test Plan */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Overview===&lt;br /&gt;
&lt;br /&gt;
The project is a role-based reviewing project. These roles can be better named as duties, corresponding to the duty of a team member in a particular project/assignment. Borrowing from different Agile methodologies like SCRUM, each team member has a particular role. For example, one team member may work mainly on the documentation, another on writing tests and another member may write most of the code. Although there is no clear distinction in the duties as each team member still contributes to other duties, a much more meaningful review can be done if the review questionnaire was role specific rather than being assignment specific. Currently, there is a single teammate review rubric for each assignment. This means that some review rubrics are not applicable for all the projects and also for all team members. For instance, if there is a question which says “What percentage of the code was written by this member?” This may not be applicable for the team member who wrote tests and it is definitely not applicable for the member who wrote the documentation. The project aims at creating different review rubrics for different duties, which an instructor can create for an assignment. Students can select a particular duty they want to perform in that project.&lt;br /&gt;
&lt;br /&gt;
==UML Diagram==&lt;br /&gt;
&lt;br /&gt;
[[File:Uml2.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a UML Class diagram, The relationships depicted above are as follows: &lt;br /&gt;
&lt;br /&gt;
* Between the User and Duty class, there is a bidirectional association. The user table is used for both the instructor and the student. &lt;br /&gt;
** Each instructor can have multiple roles that he can choose from for a particular assignment/questionnaire.&lt;br /&gt;
** Each student can have 0 or 1 role for a particular project.&lt;br /&gt;
* For each Questionnaire instance, there are one or more Questions that can be stored, hence there is an aggregation relationship from Question to Questionnaire. This is for the grading rubric based on the role.&lt;br /&gt;
* The Question table and the Questionnaire table each will be using the the duty ID to sort out questions for a particular assignment.&lt;br /&gt;
&lt;br /&gt;
==Proposed Implementation==&lt;br /&gt;
&lt;br /&gt;
The project introduces changes from the instructor view and the student view. The steps for implementation are as follow:&lt;br /&gt;
===Migration changes===&lt;br /&gt;
* .    Create a migration for adding the duties table having the following fields:&lt;br /&gt;
               * id&lt;br /&gt;
               * assignment_id&lt;br /&gt;
               * instructor_id&lt;br /&gt;
               * course_id&lt;br /&gt;
*	The duty ID will be used by other tables like the questionnaire table and hence will be the primary key.&lt;br /&gt;
*	An assignment has particular duties. Thus, the assignment number will be the foreign key for the Duties table. &lt;br /&gt;
*	The Duties created by one Instructor should be visible and reusable by that instructor only. Thus, the instructor id will also be a foreign key in the Duties table.&lt;br /&gt;
*      Add a column entry named &amp;quot;is role based review enabled&amp;quot; in the assignments table which would be of type boolean. This field would save the status of the role based review checkbox.&lt;br /&gt;
*      Add a column entry named &amp;quot;Can multiple students select the same role ?&amp;quot;  in the assignments table which would be of type boolean. This field would save the status of the checkbox for multiple students with the same role.&lt;br /&gt;
*      Add a column entry named &amp;quot;Duties&amp;quot; to the Users table which would be of type string. This field would save the duty that a student would select if role based reviews are permitted.&lt;br /&gt;
&lt;br /&gt;
===Instructor view changes===&lt;br /&gt;
*	For a particular assignment, create a check box called &amp;quot;Is role based review allowed.? &amp;quot;that allows an instructor to add a role based review for a particular assignment or not. This can be done by adding a checkbox tag in the review strategy subpage of the edit assignments page.&lt;br /&gt;
*	If the instructor selects the checkbox for role-based reviewing, then a button should appear for adding roles called “Add Duties” along with a dropdown to select from the previously added duties by the same instructor. &lt;br /&gt;
* .    The duties appearing in the dropdown would consist of duties added by the instructor for any of his courses.    &lt;br /&gt;
*      This can be achieved by including a subform tag in the same table entry as the checkbox which should have a hidden attribute.&lt;br /&gt;
* .    A javascript function would be created which is invoked when the status of the checkbox changes. This function should remove the hidden attribute of the subform tag if the checkbox is checked. This would enable the add duties field and the select duties dropdown to appear only on checking the box.&lt;br /&gt;
*	An instructor can decide the number of duties for a particular assignment, the number of team members who can undertake a particular duty and if any of the duties are optional. &lt;br /&gt;
*      To implement this , another checkbox called &amp;quot;Can multiple students select the same role ? &amp;quot;is added in the review strategy subpage of the edit assignments page. This will be visible only if the role based reviewing checkbox is selected.  &lt;br /&gt;
*	The instructor can create Team-mate review Questionnaires for the different duties he created or can use any from the existing list of questionnaires.&lt;br /&gt;
* .    The instructor would have to create questionnaires for the newly created duties in the standard way by going to manage questionnaires and creating a new public or private item.&lt;br /&gt;
*      If the role based review checkbox is selected, the instructor would get a dropbox box to select the duty and another dropdown box to select the team-mate review questionnaire applicable for this duty. In this way , the instructor can select different questionnaires for different duties. If role based reviewing is not permitted on an assignment, the existing view with a single dropdown box for selecting the team-mate review would be displayed.&lt;br /&gt;
*     This can be implemented by making changes in the rubrics subpage of the edit assignments page. A conditional statement would be included in the view which would show the modified view if role based review is permitted or else it would show the existing view.&lt;br /&gt;
&lt;br /&gt;
===Student view changes=== &lt;br /&gt;
*	When a student goes to “Your team”, he should be able to select a duty from a drop down menu which would display all the duties added by an instructor for that particular assignment. This should only occur if role based reviewing is permitted for that particular assignment. If not, the standard existing view will be displayed which does not give any such option.&lt;br /&gt;
* .    This can be implemented by adding a dropdown box in the student_teams view file. This would be enclosed in a conditional which would only appear if role based reviewing is permitted. &lt;br /&gt;
*	A student can only select one duty.&lt;br /&gt;
*      If the instructor has permitted multiple students to have the same role, each student will get all the duties as an option in the dropdown box.However, if the instructor has not provided permission for multiple students to have the same role, when a particular duty is selected by a student , any other student will not see that duty in the drop down box.&lt;br /&gt;
* .   This can be implemented by making a separate copy of the list of all the duties available. If multiple roles are not permitted, once a duty is selected , it can be eliminated from the separate list maintained and that list can be displayed to the student. Thus , there will be a conditional in the student teams view file that displays the separate list in the dropdown if multiple students can have the same role or else display the original list of duties.&lt;br /&gt;
*	A team member cannot change their role after the assignment submission deadline.&lt;br /&gt;
* .    This can be implemented by taking the time and date information from the server and showing the select duties option only if the current time and date is prior to the deadline time and date. A conditional statement will be included in the student teams view file for this purpose.&lt;br /&gt;
*      When a student selects a particular duty , it is stored in the database table of that user. Thus when a team-mate reviews that student , he will see a questionnaire corresponding to the duty of that student.This would enable reviews of the teammates to be accurate and specific to their role in a project.&lt;br /&gt;
&lt;br /&gt;
==Files to be modified==&lt;br /&gt;
&lt;br /&gt;
===New files===&lt;br /&gt;
&lt;br /&gt;
*	Duties Table&lt;br /&gt;
**	Duty ID&lt;br /&gt;
**	Name of duty&lt;br /&gt;
**	Instructor user id&lt;br /&gt;
&lt;br /&gt;
===Files that have to be modified===&lt;br /&gt;
&lt;br /&gt;
*	app/views/assignment/edit&lt;br /&gt;
        &lt;br /&gt;
*	app/views/student_teams/view&lt;br /&gt;
*	app/tree_display/views/list&lt;br /&gt;
*	app/questionnaire/new&lt;br /&gt;
*	app/questionnaire/edit&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
*	Instructor tests&lt;br /&gt;
**	Check the box for role based reviewing. If not, proceed with the default default questions for the rubric for the assignment.&lt;br /&gt;
**	Able to create new roles(duties) and select from already existing roles(duties).&lt;br /&gt;
**	Should not be able to see roles(duties) from other instructors.&lt;br /&gt;
**	Select corresponding rubrics for a particular role(duty). &lt;br /&gt;
&lt;br /&gt;
*	Student(team member) tests&lt;br /&gt;
**	Before submitting the project, the team members should be able to add a role(duty) for themselves from the roles(duties) set by the instructor.&lt;br /&gt;
**	Multiple students may have the role(duty) but 1 student cannot have multiple roles(duties).&lt;br /&gt;
&lt;br /&gt;
*	Reviewer tests&lt;br /&gt;
**	For the teammate review, students with different roles(duties) should have different questions because of the different rubrics.&lt;/div&gt;</summary>
		<author><name>Bjain</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2018-_Project_E1818:_Role-based_reviewing&amp;diff=116593</id>
		<title>CSC/ECE 517 Spring 2018- Project E1818: Role-based reviewing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2018-_Project_E1818:_Role-based_reviewing&amp;diff=116593"/>
		<updated>2018-04-14T01:40:32Z</updated>

		<summary type="html">&lt;p&gt;Bjain: /* Test Plan */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Overview===&lt;br /&gt;
&lt;br /&gt;
The project is a role-based reviewing project. These roles can be better named as duties, corresponding to the duty of a team member in a particular project/assignment. Borrowing from different Agile methodologies like SCRUM, each team member has a particular role. For example, one team member may work mainly on the documentation, another on writing tests and another member may write most of the code. Although there is no clear distinction in the duties as each team member still contributes to other duties, a much more meaningful review can be done if the review questionnaire was role specific rather than being assignment specific. Currently, there is a single teammate review rubric for each assignment. This means that some review rubrics are not applicable for all the projects and also for all team members. For instance, if there is a question which says “What percentage of the code was written by this member?” This may not be applicable for the team member who wrote tests and it is definitely not applicable for the member who wrote the documentation. The project aims at creating different review rubrics for different duties, which an instructor can create for an assignment. Students can select a particular duty they want to perform in that project.&lt;br /&gt;
&lt;br /&gt;
==UML Diagram==&lt;br /&gt;
&lt;br /&gt;
[[File:Uml2.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a UML Class diagram, The relationships depicted above are as follows: &lt;br /&gt;
&lt;br /&gt;
* Between the User and Duty class, there is a bidirectional association. The user table is used for both the instructor and the student. &lt;br /&gt;
** Each instructor can have multiple roles that he can choose from for a particular assignment/questionnaire.&lt;br /&gt;
** Each student can have 0 or 1 role for a particular project.&lt;br /&gt;
* For each Questionnaire instance, there are one or more Questions that can be stored, hence there is an aggregation relationship from Question to Questionnaire. This is for the grading rubric based on the role.&lt;br /&gt;
* The Question table and the Questionnaire table each will be using the the duty ID to sort out questions for a particular assignment.&lt;br /&gt;
&lt;br /&gt;
==Proposed Implementation==&lt;br /&gt;
&lt;br /&gt;
The project introduces changes from the instructor view and the student view. The steps for implementation are as follow:&lt;br /&gt;
===Migration changes===&lt;br /&gt;
* .    Create a migration for adding the duties table having the following fields:&lt;br /&gt;
               * id&lt;br /&gt;
               * assignment_id&lt;br /&gt;
               * instructor_id&lt;br /&gt;
               * course_id&lt;br /&gt;
*	The duty ID will be used by other tables like the questionnaire table and hence will be the primary key.&lt;br /&gt;
*	An assignment has particular duties. Thus, the assignment number will be the foreign key for the Duties table. &lt;br /&gt;
*	The Duties created by one Instructor should be visible and reusable by that instructor only. Thus, the instructor id will also be a foreign key in the Duties table.&lt;br /&gt;
*      Add a column entry named &amp;quot;is role based review enabled&amp;quot; in the assignments table which would be of type boolean. This field would save the status of the role based review checkbox.&lt;br /&gt;
*      Add a column entry named &amp;quot;Can multiple students select the same role ?&amp;quot;  in the assignments table which would be of type boolean. This field would save the status of the checkbox for multiple students with the same role.&lt;br /&gt;
*      Add a column entry named &amp;quot;Duties&amp;quot; to the Users table which would be of type string. This field would save the duty that a student would select if role based reviews are permitted.&lt;br /&gt;
&lt;br /&gt;
===Instructor view changes===&lt;br /&gt;
*	For a particular assignment, create a check box called &amp;quot;Is role based review allowed.? &amp;quot;that allows an instructor to add a role based review for a particular assignment or not. This can be done by adding a checkbox tag in the review strategy subpage of the edit assignments page.&lt;br /&gt;
*	If the instructor selects the checkbox for role-based reviewing, then a button should appear for adding roles called “Add Duties” along with a dropdown to select from the previously added duties by the same instructor. &lt;br /&gt;
* .    The duties appearing in the dropdown would consist of duties added by the instructor for any of his courses.    &lt;br /&gt;
*      This can be achieved by including a subform tag in the same table entry as the checkbox which should have a hidden attribute.&lt;br /&gt;
* .    A javascript function would be created which is invoked when the status of the checkbox changes. This function should remove the hidden attribute of the subform tag if the checkbox is checked. This would enable the add duties field and the select duties dropdown to appear only on checking the box.&lt;br /&gt;
*	An instructor can decide the number of duties for a particular assignment, the number of team members who can undertake a particular duty and if any of the duties are optional. &lt;br /&gt;
*      To implement this , another checkbox called &amp;quot;Can multiple students select the same role ? &amp;quot;is added in the review strategy subpage of the edit assignments page. This will be visible only if the role based reviewing checkbox is selected.  &lt;br /&gt;
*	The instructor can create Team-mate review Questionnaires for the different duties he created or can use any from the existing list of questionnaires.&lt;br /&gt;
* .    The instructor would have to create questionnaires for the newly created duties in the standard way by going to manage questionnaires and creating a new public or private item.&lt;br /&gt;
*      If the role based review checkbox is selected, the instructor would get a dropbox box to select the duty and another dropdown box to select the team-mate review questionnaire applicable for this duty. In this way , the instructor can select different questionnaires for different duties. If role based reviewing is not permitted on an assignment, the existing view with a single dropdown box for selecting the team-mate review would be displayed.&lt;br /&gt;
*     This can be implemented by making changes in the rubrics subpage of the edit assignments page. A conditional statement would be included in the view which would show the modified view if role based review is permitted or else it would show the existing view.&lt;br /&gt;
&lt;br /&gt;
===Student view changes=== &lt;br /&gt;
*	When a student goes to “Your team”, he should be able to select a duty from a drop down menu. &lt;br /&gt;
*	A student can only select one duty.&lt;br /&gt;
*	A team member cannot change their role after the assignment submission deadline.&lt;br /&gt;
&lt;br /&gt;
==Files to be modified==&lt;br /&gt;
&lt;br /&gt;
===New files===&lt;br /&gt;
&lt;br /&gt;
*	Duties Table&lt;br /&gt;
**	Duty ID&lt;br /&gt;
**	Name of duty&lt;br /&gt;
**	Instructor user id&lt;br /&gt;
&lt;br /&gt;
===Files that have to be modified===&lt;br /&gt;
&lt;br /&gt;
*	app/views/assignment/edit&lt;br /&gt;
        &lt;br /&gt;
*	app/views/student_teams/view&lt;br /&gt;
*	app/tree_display/views/list&lt;br /&gt;
*	app/questionnaire/new&lt;br /&gt;
*	app/questionnaire/edit&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
*	Instructor tests&lt;br /&gt;
**	Check the box for role based reviewing. If not, proceed with the default rubric for the assignment.&lt;br /&gt;
**	Able to create new roles(duties) and select from already existing roles(duties).&lt;br /&gt;
**	Should not be able to see roles(duties) from other instructors.&lt;br /&gt;
**	Select corresponding rubrics for a particular role(duty). &lt;br /&gt;
&lt;br /&gt;
*	Student(team member) tests&lt;br /&gt;
**	Before submitting the project, the team members should be able to add a role(duty) for themselves from the roles(duties) set by the instructor.&lt;br /&gt;
**	Multiple students may have the role(duty) but 1 student cannot have multiple roles(duties).&lt;br /&gt;
&lt;br /&gt;
*	Reviewer tests&lt;br /&gt;
**	For the teammate review, students with different roles(duties) should have different questions because of the different rubrics.&lt;/div&gt;</summary>
		<author><name>Bjain</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Uml1.png&amp;diff=116589</id>
		<title>File:Uml1.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Uml1.png&amp;diff=116589"/>
		<updated>2018-04-14T01:31:13Z</updated>

		<summary type="html">&lt;p&gt;Bjain: uploaded a new version of &amp;amp;quot;File:Uml1.png&amp;amp;quot;: Reverted to version as of 01:24, 14 April 2018&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Bjain</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Uml1.png&amp;diff=116588</id>
		<title>File:Uml1.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Uml1.png&amp;diff=116588"/>
		<updated>2018-04-14T01:31:05Z</updated>

		<summary type="html">&lt;p&gt;Bjain: uploaded a new version of &amp;amp;quot;File:Uml1.png&amp;amp;quot;: Reverted to version as of 01:24, 14 April 2018&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Bjain</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2018_E1813_Menu_item_tests&amp;diff=115984</id>
		<title>CSC/ECE 517 Spring 2018 E1813 Menu item tests</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2018_E1813_Menu_item_tests&amp;diff=115984"/>
		<updated>2018-04-03T05:17:11Z</updated>

		<summary type="html">&lt;p&gt;Bjain: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page corresponds to the OSS Project for CSE/ECE 517 (Spring 2018) E1813 Write unit tests for menu_item.rb.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
===Expertiza===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source web application based on [http://rubyonrails.org/ Ruby on Rails] framework,  supported by the National Science Foundation. &lt;br /&gt;
It is a place where students can submit and peer-review learning objects (assignments, codes, write ups, websites, etc). For an instructor, expertiza allows to create and customize new or existing assignments. For students, it allows to create and work on various projects and assignments. It provides a platform to peer review other students' submissions across various document types, including the URLs and wiki pages.&lt;br /&gt;
===Behavior Driven-Development===&lt;br /&gt;
In software engineering, behavior-driven development (BDD) is a software development process that emerged from test-driven development (TDD). Behavior-driven development combines the general techniques and principles of TDD with ideas from domain-driven design and object-oriented analysis and design to provide software development and management teams with shared tools and a shared process to collaborate on software development.&lt;br /&gt;
&lt;br /&gt;
BDD focuses on:&lt;br /&gt;
&lt;br /&gt;
1. Where to start in the process&lt;br /&gt;
&lt;br /&gt;
2. What to test and what not to test&lt;br /&gt;
&lt;br /&gt;
3. How much to test in one go&lt;br /&gt;
&lt;br /&gt;
4. What to call the tests&lt;br /&gt;
&lt;br /&gt;
5. How to understand why a test fails&lt;br /&gt;
&lt;br /&gt;
Test-driven development is a software development methodology which essentially states that for each unit of software, a software developer must:&lt;br /&gt;
&lt;br /&gt;
Define a test set for the unit first;&lt;br /&gt;
&lt;br /&gt;
Make the tests fail;&lt;br /&gt;
&lt;br /&gt;
Then implement the unit;&lt;br /&gt;
&lt;br /&gt;
Finally, verify that the implementation of the unit makes the tests succeed.&lt;br /&gt;
&lt;br /&gt;
This definition is rather non-specific in that it allows tests in terms of high-level software requirements, low-level technical details or anything in between. One way of looking at BDD therefore, is that it is a continued development of TDD which makes more specific choices than TDD.&lt;br /&gt;
&lt;br /&gt;
===Unit Testing===&lt;br /&gt;
In computer programming, [https://en.wikipedia.org/wiki/Unit_testing Unit Testing] is a software testing method by which individual units of source code, sets of one or more computer program modules together with associated control data, usage procedures, and operating procedures, are tested to determine whether they are fit for use. Ideally, each test case is independent from the others. Substitutes such as method stubs, mock objects, fakes, and test harnesses can be used to assist testing a module in isolation.&lt;br /&gt;
&lt;br /&gt;
Some of the advantages of unit testing are:&lt;br /&gt;
&lt;br /&gt;
1. Finds problems early: Unit testing finds problems early in the development cycle. This includes both bugs in the programmer's implementation and flaws or missing parts of the specification for the unit.&lt;br /&gt;
In test-driven development (TDD), which is frequently used in both extreme programming and scrum, unit tests are created before the code itself is written. When the tests pass, that code is considered complete.&lt;br /&gt;
&lt;br /&gt;
2. Facilitates change: Unit testing allows the programmer to refactor code or upgrade system libraries at a later date, and make sure the module still works correctly (e.g., in regression testing). The procedure is to write test cases for all functions and methods so that whenever a change causes a fault, it can be quickly identified. Unit tests detect changes which may break a design contract.&lt;br /&gt;
&lt;br /&gt;
3. Simplifies Integration: Unit testing may reduce uncertainty in the units themselves and can be used in a bottom-up testing style approach. By testing the parts of a program first and then testing the sum of its parts, integration testing becomes much easier.&lt;br /&gt;
&lt;br /&gt;
4. Documentation: Developers looking to learn what functionality is provided by a unit, and how to use it, can look at the unit tests to gain a basic understanding of the unit's interface's API.&lt;br /&gt;
&lt;br /&gt;
5. Design: When software is developed using a test-driven approach, the combination of writing the unit test to specify the interface plus the refactoring activities performed after the test is passing, may take the place of formal design. Each unit test can be seen as a design element specifying classes, methods, and observable behavior.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
&lt;br /&gt;
This project is to write unit tests using rspec for menu_items.rb model. The unit tests are to be written to make the path coverage of menu_item.rb more than 90% and achieve the highest possible branch coverage.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
The files to be understood and created are:&lt;br /&gt;
&lt;br /&gt;
1. app/models/menu_items.rb&lt;br /&gt;
&lt;br /&gt;
2. spec/models/menu_items_spec.rb&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
Students who collaborated to work on this problem statement are:&lt;br /&gt;
&lt;br /&gt;
1. Angad Singh Wadhwa (awadhwa3@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
2. Bhavuk Jain (bjain@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
== Plan Of Work ==&lt;br /&gt;
&lt;br /&gt;
The task in hand was to write test cases for testing the menu_items model file. No Rspec file for the corresponding model exists so there was a need to create a new file and build tests from scratch. &lt;br /&gt;
For this purposes different sub tasks involved&lt;br /&gt;
&lt;br /&gt;
1. Setting up the Expertiza environment &lt;br /&gt;
&lt;br /&gt;
2. Understand the functionality of model file in menu_items.rb &lt;br /&gt;
&lt;br /&gt;
3. Understand the linked data attributes being used, like controller_actions, content_page, permissions_id&lt;br /&gt;
&lt;br /&gt;
4. Creating stub entries for testing different functionalities. &lt;br /&gt;
&lt;br /&gt;
5. Writing testing conditions for different functions and cross checking with the expected outputs.&lt;br /&gt;
&lt;br /&gt;
== Implementation Steps==&lt;br /&gt;
&lt;br /&gt;
=== Expertiza Environment Setup ===&lt;br /&gt;
We used the Ubuntu-Expertiza image to setup the environment.&lt;br /&gt;
We forked the master from Expertiza, cloned that and then run through the command terminal.&lt;br /&gt;
&lt;br /&gt;
cd/expetiza/app/models&lt;br /&gt;
&lt;br /&gt;
The menu_item.rb model file is present in this directory&lt;br /&gt;
&lt;br /&gt;
=== Functionality of Menu Items model ===&lt;br /&gt;
Menu Items is a model which gives the functionality to the top menu bar in the Expertiza website. It controls the display of drop down menus and its sub menus. It directs how these drop downs are displayed with regards to different users which have different permission attributes.&lt;br /&gt;
A super admin has the permission to edit the menu bar, by adding or deleting menu item blocks from it. Upon adding each item, he gets to position it either in the main menu bar or into different sub categories.&lt;br /&gt;
&lt;br /&gt;
====Parameters ====&lt;br /&gt;
Following are the parameters associated with the menu_item model: &lt;br /&gt;
&lt;br /&gt;
1. Name: This parameter gives the name to the menu item. &lt;br /&gt;
&lt;br /&gt;
2. Label: This parameter gives the label to the menu item. &lt;br /&gt;
&lt;br /&gt;
3. Parent id: It gives the id of the parent and establishes the hierarchy of the various objects of the menu item model. It can also be 'null' which means that it will be the base category. &lt;br /&gt;
&lt;br /&gt;
4. Sequence id: It gives the sequence numbering for determining the way the attributes are ordered within a parent. &lt;br /&gt;
&lt;br /&gt;
5. Controller action id: This parameter is associated with the direction in which the user is directed onto.&lt;br /&gt;
 &lt;br /&gt;
6. Content page id: This parameter is also associated with the direction in which the user is directed onto.&lt;br /&gt;
&lt;br /&gt;
====Methods====&lt;br /&gt;
&lt;br /&gt;
Different instance methods and class methods exist in this models . Brief description of each of them are: &lt;br /&gt;
&lt;br /&gt;
1. find_or_create_by_name(params): Class Method &lt;br /&gt;
This method finds or creates a new entry with the given name obtained in params. &lt;br /&gt;
&lt;br /&gt;
2. delete: Instance Method &lt;br /&gt;
This methods deletes the entry and all the child entries (entries having the same parent id) lined to it &lt;br /&gt;
&lt;br /&gt;
3. above: Instance Method &lt;br /&gt;
It returns the entry that is above a present sequence number for a given parent id &lt;br /&gt;
&lt;br /&gt;
4. below: Instance Method &lt;br /&gt;
It returns the entry that is below a present sequence number for a given parent id &lt;br /&gt;
&lt;br /&gt;
5. repack(repack_id): Class Method &lt;br /&gt;
It modifies the sequence numbers, making them in order, removing the skip entries present in it. It is performed after certain sequences have been deleted. repack_id tells the parent id under which these changes are to be made&lt;br /&gt;
&lt;br /&gt;
6. next_seq(parent id): Class Method&lt;br /&gt;
It returns the next possible sequence id corresponding to a given parent id entries. This function would be helpful if we wish to add a new entry and find out which sequence id is to be given to it. &lt;br /&gt;
&lt;br /&gt;
7. items_for_permission: Class Method&lt;br /&gt;
It returns the set of items that are possible to be displayed for a given permission id and also based on controller action id and page id being present for it.&lt;br /&gt;
&lt;br /&gt;
=== Test Entries Creation ===&lt;br /&gt;
Stub objects are needed to be created for any unit testing criteria.These objects are loaded freshly and deleted after every testing condition. &lt;br /&gt;
&lt;br /&gt;
Several methods exist for creating such a objects, whose parameters need to be designed to satisfy the conditions under test. Using 'factories' is one such method where few of the attributes are filled in with predefined values when an created. Here, for this specific case, we haven't used, factories method as, the number of attributes were limited in menu_items model and could be filled in completely with the required values each time. &lt;br /&gt;
&lt;br /&gt;
For testing menu_items, we created required entries into the database using &amp;quot;Let&amp;quot; and &amp;quot;MenuItem.create&amp;quot; method, giving different values for each of the test inputs to cover the required testing conditions.&lt;br /&gt;
&lt;br /&gt;
       let!(:menuitem) {MenuItem.create id: 1, parent_id: nil, name: &amp;quot;navigate&amp;quot;, label: &amp;quot;Navigate&amp;quot;, seq: 1, controller_action_id: 1, content_page_id: 1}&lt;br /&gt;
&lt;br /&gt;
The above is an example entry used for menu item. 5 more similar objects were created with entries giving combinations of parent_id, sequence numbers and controller_action_id. We also created objects for controller_action and content_page which were used to define conditions for coverage of items_for_permission. &lt;br /&gt;
&lt;br /&gt;
=== Testing Conditions ===&lt;br /&gt;
&lt;br /&gt;
A total of 13 unit tests were performed for testing all the functions in menu items model file and achieving complete code coverage.&lt;br /&gt;
&lt;br /&gt;
The conditions that needed to be tested are as below:&lt;br /&gt;
&lt;br /&gt;
1. .find_or_create_by_name: &lt;br /&gt;
 In this test case we check whether the find_or_create_by_name function returns a valid menu item.&lt;br /&gt;
&lt;br /&gt;
2. #delete: &lt;br /&gt;
 For this test case, we delete a parent menu item and check whether the count of total item reduces considering parent and child items are also deleted.&lt;br /&gt;
 &lt;br /&gt;
3. #above: Test cases were written to check the below conditions:&lt;br /&gt;
 3.1 If the given menu item has a valid parent_id, return the previous menu item in terms of sequence number that is a child of the same parent_id.&lt;br /&gt;
 3.2 If the given menu item has a null parent_id, return the previous menu item in terms of sequence number that also has a null parent_id value.&lt;br /&gt;
&lt;br /&gt;
4. #below: Test cases were written to check the below conditions:&lt;br /&gt;
 4.1 If the given menu item has a valid parent_id, return the next menu item in terms of sequence number that is a child of the same parent_id.&lt;br /&gt;
 4.2 If the given menu item has a null parent_id, return the next menu item in terms of sequence number that also has a null parent_id value.&lt;br /&gt;
&lt;br /&gt;
5. .repack: Test cases were written to check the below conditions:&lt;br /&gt;
 5.1 If the given menu item is updated and parent id is valid, repack is called with current menu item id as repack id and re calculate sequence number for all child items.&lt;br /&gt;
 5.2 If the given menu item is updated and parent id is null, repack is called with parent id of current menu and sequence number is recalculated for all child items.&lt;br /&gt;
&lt;br /&gt;
6. .next_seq: Test cases were written to check the below conditions:&lt;br /&gt;
 6.1 If parent id is not null and next_seq is called, the function increments the maximum sequence number for that parent group and returns that value to be stored as the next sequence number for the new menu item.&lt;br /&gt;
 6.2 If parent id is null, and next_seq is called, the function increments the maximum sequence number amongst all menu items having parent id as null and returns that value to be stored as the next sequence number for the new menu item.&lt;br /&gt;
&lt;br /&gt;
7. .items_for_permissions: Test cases were written to check the below conditions:&lt;br /&gt;
 7.1 If permission id is null, we check if the controller action id is greater than zero and add menu items to a list accordingly.&lt;br /&gt;
 7.2 If permission id is not null, we check if controller action id is greater than zero. If not, we check the items for matching content page id and list menu items accordingly.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
After writing the test cases we used SimpleCov to measure the C0 coverage of our rails application. After running rake spec to run the test cases, SimpleCov creates a directory called coverage in our rails application folder. This folder called coverage contains an index.html file which when opened in a browser renders an html page which gives the C0 coverage of each of the files in the Controllers, Models, Helpers in the app directory.&lt;br /&gt;
&lt;br /&gt;
For our case, the C0 coverage of the menu_items.rb file in the Models folder increased from 0 to 100.&lt;br /&gt;
Following are the screenshots of the completed code coverage taken from coverage/index.html:&lt;br /&gt;
 [[File:Coverage1.PNG]]&lt;br /&gt;
 [[File:Coverage2.PNG]]&lt;br /&gt;
 [[File:Coverage3.PNG]]&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/angad8292/expertiza/blob/master/spec/models/menu_item_spec.rb GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;/div&gt;</summary>
		<author><name>Bjain</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2018_E1813_Menu_item_tests&amp;diff=115982</id>
		<title>CSC/ECE 517 Spring 2018 E1813 Menu item tests</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2018_E1813_Menu_item_tests&amp;diff=115982"/>
		<updated>2018-04-03T05:16:28Z</updated>

		<summary type="html">&lt;p&gt;Bjain: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page corresponds to the OSS Project for CSE/ECE 517 (Spring 2018) E1813 Write unit tests for menu_item.rb.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
===Expertiza===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source web application based on [http://rubyonrails.org/ Ruby on Rails] framework,  supported by the National Science Foundation. &lt;br /&gt;
It is a place where students can submit and peer-review learning objects (assignments, codes, write ups, websites, etc). For an instructor, expertiza allows to create and customize new or existing assignments. For students, it allows to create and work on various projects and assignments. It provides a platform to peer review other students' submissions across various document types, including the URLs and wiki pages.&lt;br /&gt;
===Behavior Driven-Development===&lt;br /&gt;
In software engineering, behavior-driven development (BDD) is a software development process that emerged from test-driven development (TDD). Behavior-driven development combines the general techniques and principles of TDD with ideas from domain-driven design and object-oriented analysis and design to provide software development and management teams with shared tools and a shared process to collaborate on software development.&lt;br /&gt;
&lt;br /&gt;
BDD focuses on:&lt;br /&gt;
&lt;br /&gt;
1. Where to start in the process&lt;br /&gt;
&lt;br /&gt;
2. What to test and what not to test&lt;br /&gt;
&lt;br /&gt;
3. How much to test in one go&lt;br /&gt;
&lt;br /&gt;
4. What to call the tests&lt;br /&gt;
&lt;br /&gt;
5. How to understand why a test fails&lt;br /&gt;
&lt;br /&gt;
Test-driven development is a software development methodology which essentially states that for each unit of software, a software developer must:&lt;br /&gt;
&lt;br /&gt;
Define a test set for the unit first;&lt;br /&gt;
&lt;br /&gt;
Make the tests fail;&lt;br /&gt;
&lt;br /&gt;
Then implement the unit;&lt;br /&gt;
&lt;br /&gt;
Finally, verify that the implementation of the unit makes the tests succeed.&lt;br /&gt;
&lt;br /&gt;
This definition is rather non-specific in that it allows tests in terms of high-level software requirements, low-level technical details or anything in between. One way of looking at BDD therefore, is that it is a continued development of TDD which makes more specific choices than TDD.&lt;br /&gt;
&lt;br /&gt;
===Unit Testing===&lt;br /&gt;
In computer programming, [https://en.wikipedia.org/wiki/Unit_testing Unit Testing] is a software testing method by which individual units of source code, sets of one or more computer program modules together with associated control data, usage procedures, and operating procedures, are tested to determine whether they are fit for use. Ideally, each test case is independent from the others. Substitutes such as method stubs, mock objects, fakes, and test harnesses can be used to assist testing a module in isolation.&lt;br /&gt;
&lt;br /&gt;
Some of the advantages of unit testing are:&lt;br /&gt;
&lt;br /&gt;
1. Finds problems early: Unit testing finds problems early in the development cycle. This includes both bugs in the programmer's implementation and flaws or missing parts of the specification for the unit.&lt;br /&gt;
In test-driven development (TDD), which is frequently used in both extreme programming and scrum, unit tests are created before the code itself is written. When the tests pass, that code is considered complete.&lt;br /&gt;
&lt;br /&gt;
2. Facilitates change: Unit testing allows the programmer to refactor code or upgrade system libraries at a later date, and make sure the module still works correctly (e.g., in regression testing). The procedure is to write test cases for all functions and methods so that whenever a change causes a fault, it can be quickly identified. Unit tests detect changes which may break a design contract.&lt;br /&gt;
&lt;br /&gt;
3. Simplifies Integration: Unit testing may reduce uncertainty in the units themselves and can be used in a bottom-up testing style approach. By testing the parts of a program first and then testing the sum of its parts, integration testing becomes much easier.&lt;br /&gt;
&lt;br /&gt;
4. Documentation: Developers looking to learn what functionality is provided by a unit, and how to use it, can look at the unit tests to gain a basic understanding of the unit's interface's API.&lt;br /&gt;
&lt;br /&gt;
5. Design: When software is developed using a test-driven approach, the combination of writing the unit test to specify the interface plus the refactoring activities performed after the test is passing, may take the place of formal design. Each unit test can be seen as a design element specifying classes, methods, and observable behavior.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
&lt;br /&gt;
This project is to write unit tests using rspec for menu_items.rb model. The unit tests are to be written to make the path coverage of menu_item.rb more than 90% and achieve the highest possible branch coverage.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
The files to be understood and created are:&lt;br /&gt;
&lt;br /&gt;
1. app/models/menu_items.rb&lt;br /&gt;
&lt;br /&gt;
2. spec/models/menu_items_spec.rb&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
Students who collaborated to work on this problem statement are:&lt;br /&gt;
&lt;br /&gt;
1. Angad Singh Wadhwa (awadhwa3@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
2. Bhavuk Jain (bjain@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
== Plan Of Work ==&lt;br /&gt;
&lt;br /&gt;
The task in hand was to write test cases for testing the menu_items model file. No Rspec file for the corresponding model exists so there was a need to create a new file and build tests from scratch. &lt;br /&gt;
For this purposes different sub tasks involved&lt;br /&gt;
&lt;br /&gt;
1. Setting up the Expertiza environment &lt;br /&gt;
&lt;br /&gt;
2. Understand the functionality of model file in menu_items.rb &lt;br /&gt;
&lt;br /&gt;
3. Understand the linked data attributes being used, like controller_actions, content_page, permissions_id&lt;br /&gt;
&lt;br /&gt;
4. Creating stub entries for testing different functionalities. &lt;br /&gt;
&lt;br /&gt;
5. Writing testing conditions for different functions and cross checking with the expected outputs.&lt;br /&gt;
&lt;br /&gt;
== Implementation Steps==&lt;br /&gt;
&lt;br /&gt;
=== Expertiza Environment Setup ===&lt;br /&gt;
We used the Ubuntu-Expertiza image to setup the environment.&lt;br /&gt;
We forked the master from Expertiza, cloned that and then run through the command terminal.&lt;br /&gt;
&lt;br /&gt;
cd/expetiza/app/models&lt;br /&gt;
&lt;br /&gt;
The menu_item.rb model file is present in this directory&lt;br /&gt;
&lt;br /&gt;
=== Functionality of Menu Items model ===&lt;br /&gt;
Menu Items is a model which gives the functionality to the top menu bar in the Expertiza website. It controls the display of drop down menus and its sub menus. It directs how these drop downs are displayed with regards to different users which have different permission attributes.&lt;br /&gt;
A super admin has the permission to edit the menu bar, by adding or deleting menu item blocks from it. Upon adding each item, he gets to position it either in the main menu bar or into different sub categories.&lt;br /&gt;
&lt;br /&gt;
====Parameters ====&lt;br /&gt;
Following are the parameters associated with the menu_item model: &lt;br /&gt;
&lt;br /&gt;
1. Name: This parameter gives the name to the menu item. &lt;br /&gt;
&lt;br /&gt;
2. Label: This parameter gives the label to the menu item. &lt;br /&gt;
&lt;br /&gt;
3. Parent id: It gives the id of the parent and establishes the hierarchy of the various objects of the menu item model. It can also be 'null' which means that it will be the base category. &lt;br /&gt;
&lt;br /&gt;
4. Sequence id: It gives the sequence numbering for determining the way the attributes are ordered within a parent. &lt;br /&gt;
&lt;br /&gt;
5. Controller action id: This parameter is associated with the direction in which the user is directed onto.&lt;br /&gt;
 &lt;br /&gt;
6. Content page id: This parameter is also associated with the direction in which the user is directed onto.&lt;br /&gt;
&lt;br /&gt;
====Methods====&lt;br /&gt;
&lt;br /&gt;
Different instance methods and class methods exist in this models . Brief description of each of them are: &lt;br /&gt;
&lt;br /&gt;
1. find_or_create_by_name(params): Class Method &lt;br /&gt;
This method finds or creates a new entry with the given name obtained in params. &lt;br /&gt;
&lt;br /&gt;
2. delete: Instance Method &lt;br /&gt;
This methods deletes the entry and all the child entries (entries having the same parent id) lined to it &lt;br /&gt;
&lt;br /&gt;
3. above: Instance Method &lt;br /&gt;
It returns the entry that is above a present sequence number for a given parent id &lt;br /&gt;
&lt;br /&gt;
4. below: Instance Method &lt;br /&gt;
It returns the entry that is below a present sequence number for a given parent id &lt;br /&gt;
&lt;br /&gt;
5. repack(repack_id): Class Method &lt;br /&gt;
It modifies the sequence numbers, making them in order, removing the skip entries present in it. It is performed after certain sequences have been deleted. repack_id tells the parent id under which these changes are to be made&lt;br /&gt;
&lt;br /&gt;
6. next_seq(parent id): Class Method&lt;br /&gt;
It returns the next possible sequence id corresponding to a given parent id entries. This function would be helpful if we wish to add a new entry and find out which sequence id is to be given to it. &lt;br /&gt;
&lt;br /&gt;
7. items_for_permission: Class Method&lt;br /&gt;
It returns the set of items that are possible to be displayed for a given permission id and also based on controller action id and page id being present for it.&lt;br /&gt;
&lt;br /&gt;
=== Test Entries Creation ===&lt;br /&gt;
Stub objects are needed to be created for any unit testing criteria.These objects are loaded freshly and deleted after every testing condition. &lt;br /&gt;
&lt;br /&gt;
Several methods exist for creating such a objects, whose parameters need to be designed to satisfy the conditions under test. Using 'factories' is one such method where few of the attributes are filled in with predefined values when an created. Here, for this specific case, we haven't used, factories method as, the number of attributes were limited in menu_items model and could be filled in completely with the required values each time. &lt;br /&gt;
&lt;br /&gt;
For testing menu_items, we created required entries into the database using &amp;quot;Let&amp;quot; and &amp;quot;MenuItem.create&amp;quot; method, giving different values for each of the test inputs to cover the required testing conditions.&lt;br /&gt;
&lt;br /&gt;
       let!(:menuitem) {MenuItem.create id: 1, parent_id: nil, name: &amp;quot;navigate&amp;quot;, label: &amp;quot;Navigate&amp;quot;, seq: 1, controller_action_id: 1, content_page_id: 1}&lt;br /&gt;
&lt;br /&gt;
The above is an example entry used for menu item. 5 more similar objects were created with entries giving combinations of parent_id, sequence numbers and controller_action_id. We also created objects for controller_action and content_page which were used to define conditions for coverage of items_for_permission. &lt;br /&gt;
&lt;br /&gt;
=== Testing Conditions ===&lt;br /&gt;
&lt;br /&gt;
A total of 13 unit tests were performed for testing all the functions in menu items model file and achieving complete code coverage.&lt;br /&gt;
&lt;br /&gt;
The conditions that needed to be tested are as below:&lt;br /&gt;
&lt;br /&gt;
1. .find_or_create_by_name: &lt;br /&gt;
 In this test case we check whether the find_or_create_by_name function returns a valid menu item.&lt;br /&gt;
&lt;br /&gt;
2. #delete: &lt;br /&gt;
 For this test case, we delete a parent menu item and check whether the count of total item reduces considering parent and child items are also deleted.&lt;br /&gt;
 &lt;br /&gt;
3. #above: Test cases were written to check the below conditions:&lt;br /&gt;
 3.1 If the given menu item has a valid parent_id, return the previous menu item in terms of sequence number that is a child of the same parent_id.&lt;br /&gt;
 3.2 If the given menu item has a null parent_id, return the previous menu item in terms of sequence number that also has a null parent_id value.&lt;br /&gt;
&lt;br /&gt;
4. #below: Test cases were written to check the below conditions:&lt;br /&gt;
 4.1 If the given menu item has a valid parent_id, return the next menu item in terms of sequence number that is a child of the same parent_id.&lt;br /&gt;
 4.2 If the given menu item has a null parent_id, return the next menu item in terms of sequence number that also has a null parent_id value.&lt;br /&gt;
&lt;br /&gt;
5. .repack: Test cases were written to check the below conditions:&lt;br /&gt;
 5.1 If the given menu item is updated and parent id is valid, repack is called with current menu item id as repack id and re calculate sequence number for all child items.&lt;br /&gt;
 5.2 If the given menu item is updated and parent id is null, repack is called with parent id of current menu and sequence number is recalculated for all child items.&lt;br /&gt;
&lt;br /&gt;
6. .next_seq: Test cases were written to check the below conditions:&lt;br /&gt;
 6.1 If parent id is not null and next_seq is called, the function increments the maximum sequence number for that parent group and returns that value to be stored as the next sequence number for the new menu item.&lt;br /&gt;
 6.2 If parent id is null, and next_seq is called, the function increments the maximum sequence number amongst all menu items having parent id as null and returns that value to be stored as the next sequence number for the new menu item.&lt;br /&gt;
&lt;br /&gt;
7. .items_for_permissions: Test cases were written to check the below conditions:&lt;br /&gt;
 7.1 If permission id is null, we check if the controller action id is greater than zero and add menu items to a list accordingly.&lt;br /&gt;
 7.2 If permission id is not null, we check if controller action id is greater than zero. If not, we check the items for matching content page id and list menu items accordingly.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
After writing the test cases we used SimpleCov to measure the C0 coverage of our rails application. After running rake spec to run the test cases, SimpleCov creates a directory called coverage in our rails application folder. This folder called coverage contains an index.html file which when opened in a browser renders an html page which gives the C0 coverage of each of the files in the Controllers, Models, Helpers in the app directory.&lt;br /&gt;
&lt;br /&gt;
For our case, the C0 coverage of the menu_items.rb file in the Models folder increased from 0 to 100.&lt;br /&gt;
Following are the screenshots of the completed code coverage:&lt;br /&gt;
 [[File:Coverage1.PNG]]&lt;br /&gt;
 [[File:Coverage2.PNG]]&lt;br /&gt;
 [[File:Coverage3.PNG]]&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/angad8292/expertiza/blob/master/spec/models/menu_item_spec.rb GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;/div&gt;</summary>
		<author><name>Bjain</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Coverage3.PNG&amp;diff=115981</id>
		<title>File:Coverage3.PNG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Coverage3.PNG&amp;diff=115981"/>
		<updated>2018-04-03T05:15:38Z</updated>

		<summary type="html">&lt;p&gt;Bjain: uploaded a new version of &amp;amp;quot;File:Coverage3.PNG&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Bjain</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Coverage3.PNG&amp;diff=115979</id>
		<title>File:Coverage3.PNG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Coverage3.PNG&amp;diff=115979"/>
		<updated>2018-04-03T05:12:10Z</updated>

		<summary type="html">&lt;p&gt;Bjain: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Bjain</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Coverage2.PNG&amp;diff=115978</id>
		<title>File:Coverage2.PNG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Coverage2.PNG&amp;diff=115978"/>
		<updated>2018-04-03T05:12:00Z</updated>

		<summary type="html">&lt;p&gt;Bjain: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Bjain</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Coverage1.PNG&amp;diff=115977</id>
		<title>File:Coverage1.PNG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Coverage1.PNG&amp;diff=115977"/>
		<updated>2018-04-03T05:09:16Z</updated>

		<summary type="html">&lt;p&gt;Bjain: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Bjain</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2018_E1813_Menu_item_tests&amp;diff=115420</id>
		<title>CSC/ECE 517 Spring 2018 E1813 Menu item tests</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2018_E1813_Menu_item_tests&amp;diff=115420"/>
		<updated>2018-03-27T03:55:56Z</updated>

		<summary type="html">&lt;p&gt;Bjain: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page corresponds to the OSS Project for CSE/ECE 517 (Spring 2018) E1813 Write unit tests for menu_item.rb.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
===Expertiza===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source web application based on [http://rubyonrails.org/ Ruby on Rails] framework,  supported by the National Science Foundation. &lt;br /&gt;
It is a place where students can submit and peer-review learning objects (assignments, codes, write ups, websites, etc). For an instructor, expertiza allows to create and customize new or existing assignments. For students, it allows to create and work on various projects and assignments. It provides a platform to peer review other students' submissions across various document types, including the URLs and wiki pages.&lt;br /&gt;
===Behavior Driven-Development===&lt;br /&gt;
In software engineering, behavior-driven development (BDD) is a software development process that emerged from test-driven development (TDD). Behavior-driven development combines the general techniques and principles of TDD with ideas from domain-driven design and object-oriented analysis and design to provide software development and management teams with shared tools and a shared process to collaborate on software development.&lt;br /&gt;
&lt;br /&gt;
BDD focuses on:&lt;br /&gt;
&lt;br /&gt;
1. Where to start in the process&lt;br /&gt;
&lt;br /&gt;
2. What to test and what not to test&lt;br /&gt;
&lt;br /&gt;
3. How much to test in one go&lt;br /&gt;
&lt;br /&gt;
4. What to call the tests&lt;br /&gt;
&lt;br /&gt;
5. How to understand why a test fails&lt;br /&gt;
&lt;br /&gt;
Test-driven development is a software development methodology which essentially states that for each unit of software, a software developer must:&lt;br /&gt;
&lt;br /&gt;
Define a test set for the unit first;&lt;br /&gt;
&lt;br /&gt;
Make the tests fail;&lt;br /&gt;
&lt;br /&gt;
Then implement the unit;&lt;br /&gt;
&lt;br /&gt;
Finally, verify that the implementation of the unit makes the tests succeed.&lt;br /&gt;
&lt;br /&gt;
This definition is rather non-specific in that it allows tests in terms of high-level software requirements, low-level technical details or anything in between. One way of looking at BDD therefore, is that it is a continued development of TDD which makes more specific choices than TDD.&lt;br /&gt;
&lt;br /&gt;
===Unit Testing===&lt;br /&gt;
In computer programming, [https://en.wikipedia.org/wiki/Unit_testing Unit Testing] is a software testing method by which individual units of source code, sets of one or more computer program modules together with associated control data, usage procedures, and operating procedures, are tested to determine whether they are fit for use. Ideally, each test case is independent from the others. Substitutes such as method stubs, mock objects, fakes, and test harnesses can be used to assist testing a module in isolation.&lt;br /&gt;
&lt;br /&gt;
Some of the advantages of unit testing are:&lt;br /&gt;
&lt;br /&gt;
1. Finds problems early: Unit testing finds problems early in the development cycle. This includes both bugs in the programmer's implementation and flaws or missing parts of the specification for the unit.&lt;br /&gt;
In test-driven development (TDD), which is frequently used in both extreme programming and scrum, unit tests are created before the code itself is written. When the tests pass, that code is considered complete.&lt;br /&gt;
&lt;br /&gt;
2. Facilitates change: Unit testing allows the programmer to refactor code or upgrade system libraries at a later date, and make sure the module still works correctly (e.g., in regression testing). The procedure is to write test cases for all functions and methods so that whenever a change causes a fault, it can be quickly identified. Unit tests detect changes which may break a design contract.&lt;br /&gt;
&lt;br /&gt;
3. Simplifies Integration: Unit testing may reduce uncertainty in the units themselves and can be used in a bottom-up testing style approach. By testing the parts of a program first and then testing the sum of its parts, integration testing becomes much easier.&lt;br /&gt;
&lt;br /&gt;
4. Documentation: Developers looking to learn what functionality is provided by a unit, and how to use it, can look at the unit tests to gain a basic understanding of the unit's interface's API.&lt;br /&gt;
&lt;br /&gt;
5. Design: When software is developed using a test-driven approach, the combination of writing the unit test to specify the interface plus the refactoring activities performed after the test is passing, may take the place of formal design. Each unit test can be seen as a design element specifying classes, methods, and observable behavior.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
&lt;br /&gt;
This project is to write unit tests using rspec for menu_items.rb model. The unit tests are to be written to make the path coverage of menu_item.rb more than 90% and achieve the highest possible branch coverage.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
The files to be understood and created are:&lt;br /&gt;
&lt;br /&gt;
1. app/models/menu_items.rb&lt;br /&gt;
&lt;br /&gt;
2. spec/models/menu_items_spec.rb&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
Students who collaborated to work on this problem statement are:&lt;br /&gt;
&lt;br /&gt;
1. Angad Singh Wadhwa (awadhwa3@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
2. Bhavuk Jain (bjain@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
== Plan Of Work ==&lt;br /&gt;
&lt;br /&gt;
The task in hand was to write test cases for testing the menu_items model file. No Rspec file for the corresponding model exists so there was a need to create a new file and build tests from scratch. &lt;br /&gt;
For this purposes different sub tasks involved&lt;br /&gt;
&lt;br /&gt;
1. Setting up the Expertiza environment &lt;br /&gt;
&lt;br /&gt;
2. Understand the functionality of model file in menu_items.rb &lt;br /&gt;
&lt;br /&gt;
3. Understand the linked data attributes being used, like controller_actions, content_page, permissions_id&lt;br /&gt;
&lt;br /&gt;
4. Creating stub entries for testing different functionalities. &lt;br /&gt;
&lt;br /&gt;
5. Writing testing conditions for different functions and cross checking with the expected outputs.&lt;br /&gt;
&lt;br /&gt;
== Implementation Steps==&lt;br /&gt;
&lt;br /&gt;
=== Expertiza Environment Setup ===&lt;br /&gt;
We used the Ubuntu-Expertiza image to setup the environment.&lt;br /&gt;
We forked the master from Expertiza, cloned that and then run through the command terminal.&lt;br /&gt;
&lt;br /&gt;
cd/expetiza/app/models&lt;br /&gt;
&lt;br /&gt;
The menu_item.rb model file is present in this directory&lt;br /&gt;
&lt;br /&gt;
=== Functionality of Menu Items model ===&lt;br /&gt;
Menu Items is a model which gives the functionality to the top menu bar in the Expertiza website. It controls the display of drop down menus and its sub menus. It directs how these drop downs are displayed with regards to different users which have different permission attributes.&lt;br /&gt;
A super admin has the permission to edit the menu bar, by adding or deleting menu item blocks from it. Upon adding each item, he gets to position it either in the main menu bar or into different sub categories.&lt;br /&gt;
&lt;br /&gt;
====Parameters ====&lt;br /&gt;
Following are the parameters associated with the menu_item model: &lt;br /&gt;
&lt;br /&gt;
1. Name: This parameter gives the name to the menu item. &lt;br /&gt;
&lt;br /&gt;
2. Label: This parameter gives the label to the menu item. &lt;br /&gt;
&lt;br /&gt;
3. Parent id: It gives the id of the parent and establishes the hierarchy of the various objects of the menu item model. It can also be 'null' which means that it will be the base category. &lt;br /&gt;
&lt;br /&gt;
4. Sequence id: It gives the sequence numbering for determining the way the attributes are ordered within a parent. &lt;br /&gt;
&lt;br /&gt;
5. Controller action id: This parameter is associated with the direction in which the user is directed onto.&lt;br /&gt;
 &lt;br /&gt;
6. Content page id: This parameter is also associated with the direction in which the user is directed onto.&lt;br /&gt;
&lt;br /&gt;
====Methods====&lt;br /&gt;
&lt;br /&gt;
Different instance methods and class methods exist in this models . Brief description of each of them are: &lt;br /&gt;
&lt;br /&gt;
1. find_or_create_by_name(params): Class Method &lt;br /&gt;
This method finds or creates a new entry with the given name obtained in params. &lt;br /&gt;
&lt;br /&gt;
2. delete: Instance Method &lt;br /&gt;
This methods deletes the entry and all the child entries (entries having the same parent id) lined to it &lt;br /&gt;
&lt;br /&gt;
3. above: Instance Method &lt;br /&gt;
It returns the entry that is above a present sequence number for a given parent id &lt;br /&gt;
&lt;br /&gt;
4. below: Instance Method &lt;br /&gt;
It returns the entry that is below a present sequence number for a given parent id &lt;br /&gt;
&lt;br /&gt;
5. repack(repack_id): Class Method &lt;br /&gt;
It modifies the sequence numbers, making them in order, removing the skip entries present in it. It is performed after certain sequences have been deleted. repack_id tells the parent id under which these changes are to be made&lt;br /&gt;
&lt;br /&gt;
6. next_seq(parent id): Class Method&lt;br /&gt;
It returns the next possible sequence id corresponding to a given parent id entries. This function would be helpful if we wish to add a new entry and find out which sequence id is to be given to it. &lt;br /&gt;
&lt;br /&gt;
7. items_for_permission: Class Method&lt;br /&gt;
It returns the set of items that are possible to be displayed for a given permission id and also based on controller action id and page id being present for it.&lt;br /&gt;
&lt;br /&gt;
=== Test Entries Creation ===&lt;br /&gt;
Stub objects are needed to be created for any unit testing criteria.These objects are loaded freshly and deleted after every testing condition. &lt;br /&gt;
&lt;br /&gt;
Several methods exist for creating such a objects, whose parameters need to be designed to satisfy the conditions under test. Using 'factories' is one such method where few of the attributes are filled in with predefined values when an created. Here, for this specific case, we haven't used, factories method as, the number of attributes were limited in menu_items model and could be filled in completely with the required values each time. &lt;br /&gt;
&lt;br /&gt;
For testing menu_items, we created required entries into the database using &amp;quot;Let&amp;quot; and &amp;quot;MenuItem.create&amp;quot; method, giving different values for each of the test inputs to cover the required testing conditions.&lt;br /&gt;
&lt;br /&gt;
       let!(:menuitem) {MenuItem.create id: 1, parent_id: nil, name: &amp;quot;navigate&amp;quot;, label: &amp;quot;Navigate&amp;quot;, seq: 1, controller_action_id: 1, content_page_id: 1}&lt;br /&gt;
&lt;br /&gt;
The above is an example entry used for menu item. 5 more similar objects were created with entries giving combinations of parent_id, sequence numbers and controller_action_id. We also created objects for controller_action and content_page which were used to define conditions for coverage of items_for_permission. &lt;br /&gt;
&lt;br /&gt;
=== Testing Conditions ===&lt;br /&gt;
&lt;br /&gt;
A total of 13 unit tests were performed for testing all the functions in menu items model file and achieving complete code coverage.&lt;br /&gt;
&lt;br /&gt;
The conditions that needed to be tested are as below:&lt;br /&gt;
&lt;br /&gt;
1. .find_or_create_by_name: &lt;br /&gt;
 In this test case we check whether the find_or_create_by_name function returns a valid menu item.&lt;br /&gt;
&lt;br /&gt;
2. #delete: &lt;br /&gt;
 For this test case, we delete a parent menu item and check whether the count of total item reduces considering parent and child items are also deleted.&lt;br /&gt;
 &lt;br /&gt;
3. #above: Test cases were written to check the below conditions:&lt;br /&gt;
 3.1 If the given menu item has a valid parent_id, return the previous menu item in terms of sequence number that is a child of the same parent_id.&lt;br /&gt;
 3.2 If the given menu item has a null parent_id, return the previous menu item in terms of sequence number that also has a null parent_id value.&lt;br /&gt;
&lt;br /&gt;
4. #below: Test cases were written to check the below conditions:&lt;br /&gt;
 4.1 If the given menu item has a valid parent_id, return the next menu item in terms of sequence number that is a child of the same parent_id.&lt;br /&gt;
 4.2 If the given menu item has a null parent_id, return the next menu item in terms of sequence number that also has a null parent_id value.&lt;br /&gt;
&lt;br /&gt;
5. .repack: Test cases were written to check the below conditions:&lt;br /&gt;
 5.1 If the given menu item is updated and parent id is valid, repack is called with current menu item id as repack id and re calculate sequence number for all child items.&lt;br /&gt;
 5.2 If the given menu item is updated and parent id is null, repack is called with parent id of current menu and sequence number is recalculated for all child items.&lt;br /&gt;
&lt;br /&gt;
6. .next_seq: Test cases were written to check the below conditions:&lt;br /&gt;
 6.1 If parent id is not null and next_seq is called, the function increments the maximum sequence number for that parent group and returns that value to be stored as the next sequence number for the new menu item.&lt;br /&gt;
 6.2 If parent id is null, and next_seq is called, the function increments the maximum sequence number amongst all menu items having parent id as null and returns that value to be stored as the next sequence number for the new menu item.&lt;br /&gt;
&lt;br /&gt;
7. .items_for_permissions: Test cases were written to check the below conditions:&lt;br /&gt;
 7.1 If permission id is null, we check if the controller action id is greater than zero and add menu items to a list accordingly.&lt;br /&gt;
 7.2 If permission id is not null, we check if controller action id is greater than zero. If not, we check the items for matching content page id and list menu items accordingly.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
After writing the test cases we used SimpleCov to measure the C0 coverage of our rails application. After running rake spec to run the test cases, SimpleCov creates a directory called coverage in our rails application folder. This folder called coverage contains an index.html file which when opened in a browser renders an html page which gives the C0 coverage of each of the files in the Controllers, Models, Helpers in the app directory.&lt;br /&gt;
&lt;br /&gt;
For our case, the C0 coverage of the menu_items.rb file in the Models folder increased from 0 to 100.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/angad8292/expertiza/blob/master/spec/models/menu_item_spec.rb GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;/div&gt;</summary>
		<author><name>Bjain</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2018_E1813_Menu_item_tests&amp;diff=115419</id>
		<title>CSC/ECE 517 Spring 2018 E1813 Menu item tests</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2018_E1813_Menu_item_tests&amp;diff=115419"/>
		<updated>2018-03-27T03:54:36Z</updated>

		<summary type="html">&lt;p&gt;Bjain: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page corresponds to the OSS Project for CSE/ECE 517 (Spring 2018) E1813 Write unit tests for menu_item.rb.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
===Expertiza===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source web application based on [http://rubyonrails.org/ Ruby on Rails] framework,  supported by the National Science Foundation. &lt;br /&gt;
It is a place where students can submit and peer-review learning objects (assignments, codes, write ups, websites, etc). For an instructor, expertiza allows to create and customize new or existing assignments. For students, it allows to create and work on various projects and assignments. It provides a platform to peer review other students' submissions across various document types, including the URLs and wiki pages.&lt;br /&gt;
===Behavior Driven-Development===&lt;br /&gt;
In software engineering, behavior-driven development (BDD) is a software development process that emerged from test-driven development (TDD). Behavior-driven development combines the general techniques and principles of TDD with ideas from domain-driven design and object-oriented analysis and design to provide software development and management teams with shared tools and a shared process to collaborate on software development.&lt;br /&gt;
&lt;br /&gt;
BDD focuses on:&lt;br /&gt;
&lt;br /&gt;
1. Where to start in the process&lt;br /&gt;
&lt;br /&gt;
2. What to test and what not to test&lt;br /&gt;
&lt;br /&gt;
3. How much to test in one go&lt;br /&gt;
&lt;br /&gt;
4. What to call the tests&lt;br /&gt;
&lt;br /&gt;
5. How to understand why a test fails&lt;br /&gt;
&lt;br /&gt;
Test-driven development is a software development methodology which essentially states that for each unit of software, a software developer must:&lt;br /&gt;
&lt;br /&gt;
Define a test set for the unit first;&lt;br /&gt;
&lt;br /&gt;
Make the tests fail;&lt;br /&gt;
&lt;br /&gt;
Then implement the unit;&lt;br /&gt;
&lt;br /&gt;
Finally, verify that the implementation of the unit makes the tests succeed.&lt;br /&gt;
&lt;br /&gt;
This definition is rather non-specific in that it allows tests in terms of high-level software requirements, low-level technical details or anything in between. One way of looking at BDD therefore, is that it is a continued development of TDD which makes more specific choices than TDD.&lt;br /&gt;
&lt;br /&gt;
===Unit Testing===&lt;br /&gt;
In computer programming, [https://en.wikipedia.org/wiki/Unit_testing Unit Testing] is a software testing method by which individual units of source code, sets of one or more computer program modules together with associated control data, usage procedures, and operating procedures, are tested to determine whether they are fit for use. Ideally, each test case is independent from the others. Substitutes such as method stubs, mock objects, fakes, and test harnesses can be used to assist testing a module in isolation.&lt;br /&gt;
&lt;br /&gt;
Some of the advantages of unit testing are:&lt;br /&gt;
&lt;br /&gt;
1. Finds problems early: Unit testing finds problems early in the development cycle. This includes both bugs in the programmer's implementation and flaws or missing parts of the specification for the unit.&lt;br /&gt;
In test-driven development (TDD), which is frequently used in both extreme programming and scrum, unit tests are created before the code itself is written. When the tests pass, that code is considered complete.&lt;br /&gt;
&lt;br /&gt;
2. Facilitates change: Unit testing allows the programmer to refactor code or upgrade system libraries at a later date, and make sure the module still works correctly (e.g., in regression testing). The procedure is to write test cases for all functions and methods so that whenever a change causes a fault, it can be quickly identified. Unit tests detect changes which may break a design contract.&lt;br /&gt;
&lt;br /&gt;
3. Simplifies Integration: Unit testing may reduce uncertainty in the units themselves and can be used in a bottom-up testing style approach. By testing the parts of a program first and then testing the sum of its parts, integration testing becomes much easier.&lt;br /&gt;
&lt;br /&gt;
4. Documentation: Developers looking to learn what functionality is provided by a unit, and how to use it, can look at the unit tests to gain a basic understanding of the unit's interface's API.&lt;br /&gt;
&lt;br /&gt;
5. Design: When software is developed using a test-driven approach, the combination of writing the unit test to specify the interface plus the refactoring activities performed after the test is passing, may take the place of formal design. Each unit test can be seen as a design element specifying classes, methods, and observable behavior.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
&lt;br /&gt;
This project is to write unit tests using rspec for menu_items.rb model. The unit tests are to be written to make the path coverage of menu_item.rb more than 90% and achieve the highest possible branch coverage.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
The files to be understood and created are:&lt;br /&gt;
&lt;br /&gt;
1. app/models/menu_items.rb&lt;br /&gt;
&lt;br /&gt;
2. spec/models/menu_items_spec.rb&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
Students who collaborated to work on this problem statement are:&lt;br /&gt;
&lt;br /&gt;
1. Angad Singh Wadhwa (awadhwa3@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
2. Bhavuk Jain (bjain@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
== Plan Of Work ==&lt;br /&gt;
&lt;br /&gt;
The task in hand was to write test cases for testing the menu_items model file. No Rspec file for the corresponding model exists so there was a need to create a new file and build tests from scratch. &lt;br /&gt;
For this purposes different sub tasks involved&lt;br /&gt;
&lt;br /&gt;
1. Setting up the Expertiza environment &lt;br /&gt;
&lt;br /&gt;
2. Understand the functionality of model file in menu_items.rb &lt;br /&gt;
&lt;br /&gt;
3. Understand the linked data attributes being used, like controller_actions, content_page, permissions_id&lt;br /&gt;
&lt;br /&gt;
4. Creating dummy entries for testing different functionalities. &lt;br /&gt;
&lt;br /&gt;
5. Writing testing conditions for different functions and cross checking with the expected outputs.&lt;br /&gt;
&lt;br /&gt;
== Implementation Steps==&lt;br /&gt;
&lt;br /&gt;
=== Expertiza Environment Setup ===&lt;br /&gt;
We used the Ubuntu-Expertiza image to setup the environment.&lt;br /&gt;
We forked the master from Expertiza, cloned that and then run through the command terminal.&lt;br /&gt;
&lt;br /&gt;
cd/expetiza/app/models&lt;br /&gt;
&lt;br /&gt;
The menu_item.rb model file is present in this directory&lt;br /&gt;
&lt;br /&gt;
=== Functionality of Menu Items model ===&lt;br /&gt;
Menu Items is a model which gives the functionality to the top menu bar in the Expertiza website. It controls the display of drop down menus and its sub menus. It directs how these drop downs are displayed with regards to different users which have different permission attributes.&lt;br /&gt;
A super admin has the permission to edit the menu bar, by adding or deleting menu item blocks from it. Upon adding each item, he gets to position it either in the main menu bar or into different sub categories.&lt;br /&gt;
&lt;br /&gt;
====Parameters ====&lt;br /&gt;
Following are the parameters associated with the menu_item model: &lt;br /&gt;
&lt;br /&gt;
1. Name: This parameter gives the name to the menu item. &lt;br /&gt;
&lt;br /&gt;
2. Label: This parameter gives the label to the menu item. &lt;br /&gt;
&lt;br /&gt;
3. Parent id: It gives the id of the parent and establishes the hierarchy of the various objects of the menu item model. It can also be 'null' which means that it will be the base category. &lt;br /&gt;
&lt;br /&gt;
4. Sequence id: It gives the sequence numbering for determining the way the attributes are ordered within a parent. &lt;br /&gt;
&lt;br /&gt;
5. Controller action id: This parameter is associated with the direction in which the user is directed onto.&lt;br /&gt;
 &lt;br /&gt;
6. Content page id: This parameter is also associated with the direction in which the user is directed onto.&lt;br /&gt;
&lt;br /&gt;
====Methods====&lt;br /&gt;
&lt;br /&gt;
Different instance methods and class methods exist in this models . Brief description of each of them are: &lt;br /&gt;
&lt;br /&gt;
1. find_or_create_by_name(params): Class Method &lt;br /&gt;
This method finds or creates a new entry with the given name obtained in params. &lt;br /&gt;
&lt;br /&gt;
2. delete: Instance Method &lt;br /&gt;
This methods deletes the entry and all the child entries (entries having the same parent id) lined to it &lt;br /&gt;
&lt;br /&gt;
3. above: Instance Method &lt;br /&gt;
It returns the entry that is above a present sequence number for a given parent id &lt;br /&gt;
&lt;br /&gt;
4. below: Instance Method &lt;br /&gt;
It returns the entry that is below a present sequence number for a given parent id &lt;br /&gt;
&lt;br /&gt;
5. repack(repack_id): Class Method &lt;br /&gt;
It modifies the sequence numbers, making them in order, removing the skip entries present in it. It is performed after certain sequences have been deleted. repack_id tells the parent id under which these changes are to be made&lt;br /&gt;
&lt;br /&gt;
6. next_seq(parent id): Class Method&lt;br /&gt;
It returns the next possible sequence id corresponding to a given parent id entries. This function would be helpful if we wish to add a new entry and find out which sequence id is to be given to it. &lt;br /&gt;
&lt;br /&gt;
7. items_for_permission: Class Method&lt;br /&gt;
It returns the set of items that are possible to be displayed for a given permission id and also based on controller action id and page id being present for it.&lt;br /&gt;
&lt;br /&gt;
=== Test Entries Creation ===&lt;br /&gt;
Mock/dummy objects are needed to be created for any unit testing criteria.These objects are loaded freshly and deleted after every testing condition. &lt;br /&gt;
&lt;br /&gt;
Several methods exist for creating such a objects, whose parameters need to be designed to satisfy the conditions under test. Using 'factories' is one such method where few of the attributes are filled in with predefined values when an created. Here, for this specific case, we haven't used, factories method as, the number of attributes were limited in menu_items model and could be filled in completely with the required values each time. &lt;br /&gt;
&lt;br /&gt;
For testing menu_items, we created required entries into the database using &amp;quot;Let&amp;quot; and &amp;quot;MenuItem.create&amp;quot; method, giving different values for each of the test inputs to cover the required testing conditions.&lt;br /&gt;
&lt;br /&gt;
       let!(:menuitem) {MenuItem.create id: 1, parent_id: nil, name: &amp;quot;navigate&amp;quot;, label: &amp;quot;Navigate&amp;quot;, seq: 1, controller_action_id: 1, content_page_id: 1}&lt;br /&gt;
&lt;br /&gt;
The above is an example entry used for menu item. 5 more similar objects were created with entries giving combinations of parent_id, sequence numbers and controller_action_id. We also created objects for controller_action and content_page which were used to define conditions for coverage of items_for_permission. &lt;br /&gt;
&lt;br /&gt;
=== Testing Conditions ===&lt;br /&gt;
&lt;br /&gt;
A total of 13 unit tests were performed for testing all the functions in menu items model file and achieving complete code coverage.&lt;br /&gt;
&lt;br /&gt;
The conditions that needed to be tested are as below:&lt;br /&gt;
&lt;br /&gt;
1. .find_or_create_by_name: &lt;br /&gt;
 In this test case we check whether the find_or_create_by_name function returns a valid menu item.&lt;br /&gt;
&lt;br /&gt;
2. #delete: &lt;br /&gt;
 For this test case, we delete a parent menu item and check whether the count of total item reduces considering parent and child items are also deleted.&lt;br /&gt;
 &lt;br /&gt;
3. #above: Test cases were written to check the below conditions:&lt;br /&gt;
 3.1 If the given menu item has a valid parent_id, return the previous menu item in terms of sequence number that is a child of the same parent_id.&lt;br /&gt;
 3.2 If the given menu item has a null parent_id, return the previous menu item in terms of sequence number that also has a null parent_id value.&lt;br /&gt;
&lt;br /&gt;
4. #below: Test cases were written to check the below conditions:&lt;br /&gt;
 4.1 If the given menu item has a valid parent_id, return the next menu item in terms of sequence number that is a child of the same parent_id.&lt;br /&gt;
 4.2 If the given menu item has a null parent_id, return the next menu item in terms of sequence number that also has a null parent_id value.&lt;br /&gt;
&lt;br /&gt;
5. .repack: Test cases were written to check the below conditions:&lt;br /&gt;
 5.1 If the given menu item is updated and parent id is valid, repack is called with current menu item id as repack id and re calculate sequence number for all child items.&lt;br /&gt;
 5.2 If the given menu item is updated and parent id is null, repack is called with parent id of current menu and sequence number is recalculated for all child items.&lt;br /&gt;
&lt;br /&gt;
6. .next_seq: Test cases were written to check the below conditions:&lt;br /&gt;
 6.1 If parent id is not null and next_seq is called, the function increments the maximum sequence number for that parent group and returns that value to be stored as the next sequence number for the new menu item.&lt;br /&gt;
 6.2 If parent id is null, and next_seq is called, the function increments the maximum sequence number amongst all menu items having parent id as null and returns that value to be stored as the next sequence number for the new menu item.&lt;br /&gt;
&lt;br /&gt;
7. .items_for_permissions: Test cases were written to check the below conditions:&lt;br /&gt;
 7.1 If permission id is null, we check if the controller action id is greater than zero and add menu items to a list accordingly.&lt;br /&gt;
 7.2 If permission id is not null, we check if controller action id is greater than zero. If not, we check the items for matching content page id and list menu items accordingly.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
After writing the test cases we used SimpleCov to measure the C0 coverage of our rails application. After running rake spec to run the test cases, SimpleCov creates a directory called coverage in our rails application folder. This folder called coverage contains an index.html file which when opened in a browser renders an html page which gives the C0 coverage of each of the files in the Controllers, Models, Helpers in the app directory.&lt;br /&gt;
&lt;br /&gt;
For our case, the C0 coverage of the menu_items.rb file in the Models folder increased from 0 to 100.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/angad8292/expertiza/blob/master/spec/models/menu_item_spec.rb GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;/div&gt;</summary>
		<author><name>Bjain</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2018_E1813_Menu_item_tests&amp;diff=115415</id>
		<title>CSC/ECE 517 Spring 2018 E1813 Menu item tests</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2018_E1813_Menu_item_tests&amp;diff=115415"/>
		<updated>2018-03-27T03:52:09Z</updated>

		<summary type="html">&lt;p&gt;Bjain: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page corresponds to the OSS Project for CSE/ECE 517 (Spring 2018) E1813 Write unit tests for menu_item.rb.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
===Expertiza===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source web application based on [http://rubyonrails.org/ Ruby on Rails] framework,  supported by the National Science Foundation. &lt;br /&gt;
It is a place where students can submit and peer-review learning objects (assignments, codes, write ups, websites, etc). For an instructor, expertiza allows to create and customize new or existing assignments. For students, it allows to create and work on various projects and assignments. It provides a platform to peer review other students' submissions across various document types, including the URLs and wiki pages.&lt;br /&gt;
===Behavior Driven-Development===&lt;br /&gt;
In software engineering, behavior-driven development (BDD) is a software development process that emerged from test-driven development (TDD). Behavior-driven development combines the general techniques and principles of TDD with ideas from domain-driven design and object-oriented analysis and design to provide software development and management teams with shared tools and a shared process to collaborate on software development.&lt;br /&gt;
&lt;br /&gt;
BDD focuses on:&lt;br /&gt;
&lt;br /&gt;
1. Where to start in the process&lt;br /&gt;
&lt;br /&gt;
2. What to test and what not to test&lt;br /&gt;
&lt;br /&gt;
3. How much to test in one go&lt;br /&gt;
&lt;br /&gt;
4. What to call the tests&lt;br /&gt;
&lt;br /&gt;
5. How to understand why a test fails&lt;br /&gt;
&lt;br /&gt;
Test-driven development is a software development methodology which essentially states that for each unit of software, a software developer must:&lt;br /&gt;
&lt;br /&gt;
Define a test set for the unit first;&lt;br /&gt;
&lt;br /&gt;
Make the tests fail;&lt;br /&gt;
&lt;br /&gt;
Then implement the unit;&lt;br /&gt;
&lt;br /&gt;
Finally, verify that the implementation of the unit makes the tests succeed.&lt;br /&gt;
&lt;br /&gt;
This definition is rather non-specific in that it allows tests in terms of high-level software requirements, low-level technical details or anything in between. One way of looking at BDD therefore, is that it is a continued development of TDD which makes more specific choices than TDD.&lt;br /&gt;
&lt;br /&gt;
===Unit Testing===&lt;br /&gt;
In computer programming, [https://en.wikipedia.org/wiki/Unit_testing Unit Testing] is a software testing method by which individual units of source code, sets of one or more computer program modules together with associated control data, usage procedures, and operating procedures, are tested to determine whether they are fit for use. Ideally, each test case is independent from the others. Substitutes such as method stubs, mock objects, fakes, and test harnesses can be used to assist testing a module in isolation.&lt;br /&gt;
&lt;br /&gt;
Some of the advantages of unit testing are:&lt;br /&gt;
&lt;br /&gt;
1. Finds problems early: Unit testing finds problems early in the development cycle. This includes both bugs in the programmer's implementation and flaws or missing parts of the specification for the unit.&lt;br /&gt;
In test-driven development (TDD), which is frequently used in both extreme programming and scrum, unit tests are created before the code itself is written. When the tests pass, that code is considered complete.&lt;br /&gt;
&lt;br /&gt;
2. Facilitates change: Unit testing allows the programmer to refactor code or upgrade system libraries at a later date, and make sure the module still works correctly (e.g., in regression testing). The procedure is to write test cases for all functions and methods so that whenever a change causes a fault, it can be quickly identified. Unit tests detect changes which may break a design contract.&lt;br /&gt;
&lt;br /&gt;
3. Simplifies Integration: Unit testing may reduce uncertainty in the units themselves and can be used in a bottom-up testing style approach. By testing the parts of a program first and then testing the sum of its parts, integration testing becomes much easier.&lt;br /&gt;
&lt;br /&gt;
4. Documentation: Developers looking to learn what functionality is provided by a unit, and how to use it, can look at the unit tests to gain a basic understanding of the unit's interface's API.&lt;br /&gt;
&lt;br /&gt;
5. Design: When software is developed using a test-driven approach, the combination of writing the unit test to specify the interface plus the refactoring activities performed after the test is passing, may take the place of formal design. Each unit test can be seen as a design element specifying classes, methods, and observable behavior.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
&lt;br /&gt;
This project is to write unit tests using rspec for menu_items.rb model. The unit tests are to be written to make the path coverage of menu_item.rb more than 90% and achieve the highest possible branch coverage.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
The files to be understood and created are:&lt;br /&gt;
&lt;br /&gt;
1. app/models/menu_items.rb&lt;br /&gt;
&lt;br /&gt;
2. spec/models/menu_items_spec.rb&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
Students who collaborated to work on this problem statement are:&lt;br /&gt;
&lt;br /&gt;
1. Angad Singh Wadhwa (awadhwa3@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
2. Bhavuk Jain (bjain@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
== Plan Of Work ==&lt;br /&gt;
&lt;br /&gt;
The task in hand was to write test cases for testing the menu_items model file. No Rspec file for the corresponding model exists so there was a need to create a new file and build tests from scratch. &lt;br /&gt;
For this purposes different sub tasks involved&lt;br /&gt;
&lt;br /&gt;
1. Setting up the Expertiza environment &lt;br /&gt;
&lt;br /&gt;
2. Understand the functionality of model file in menu_items.rb &lt;br /&gt;
&lt;br /&gt;
3. Understand the linked data attributes being used, like controller_actions, content_page, permissions_id&lt;br /&gt;
&lt;br /&gt;
4. Creating dummy entries for testing different functionalities. &lt;br /&gt;
&lt;br /&gt;
5. Writing testing conditions for different functions and cross checking with the expected outputs.&lt;br /&gt;
&lt;br /&gt;
== Implementation Steps==&lt;br /&gt;
&lt;br /&gt;
=== Expertiza Environment Setup ===&lt;br /&gt;
We used the Ubuntu-Expertiza image to setup the environment.&lt;br /&gt;
We forked the master from Expertiza, cloned that and then run through the command terminal.&lt;br /&gt;
&lt;br /&gt;
cd/expetiza/app/models&lt;br /&gt;
&lt;br /&gt;
The menu_item.rb model file is present in this directory&lt;br /&gt;
&lt;br /&gt;
=== Functionality of Menu Items model ===&lt;br /&gt;
Menu Items is a model which gives the functionality to the top menu bar in the Expertiza website. It controls the display of drop down menus and its sub menus. It directs how these drop downs are displayed with regards to different users which have different permission attributes.&lt;br /&gt;
A super admin has the permission to edit the menu bar, by adding or deleting menu item blocks from it. Upon adding each item, he gets to position it either in the main menu bar or into different sub categories.&lt;br /&gt;
&lt;br /&gt;
====Parameters ====&lt;br /&gt;
Following are the parameters associated with the menu_item model: &lt;br /&gt;
&lt;br /&gt;
1. Name: This parameter gives the name to the menu item. &lt;br /&gt;
&lt;br /&gt;
2. Label: This parameter gives the label to the menu item. &lt;br /&gt;
&lt;br /&gt;
3. Parent id: It gives the id of the parent and establishes the hierarchy of the various objects of the menu item model. It can also be 'null' which means that it will be the base category. &lt;br /&gt;
&lt;br /&gt;
4. Sequence id: It gives the sequence numbering for determining the way the attributes are ordered within a parent. &lt;br /&gt;
&lt;br /&gt;
5. Controller action id: This parameter is associated with the direction in which the user is directed onto.&lt;br /&gt;
 &lt;br /&gt;
6. Content page id: This parameter is also associated with the direction in which the user is directed onto.&lt;br /&gt;
&lt;br /&gt;
====Methods====&lt;br /&gt;
&lt;br /&gt;
Different instance methods and class methods exist in this models . Brief description of each of them are: &lt;br /&gt;
&lt;br /&gt;
1. find_or_create_by_name(params): Class Method &lt;br /&gt;
This method finds or creates a new entry with the given name obtained in params. &lt;br /&gt;
&lt;br /&gt;
2. delete: Instance Method &lt;br /&gt;
This methods deletes the entry and all the child entries (entries having the same parent id) lined to it &lt;br /&gt;
&lt;br /&gt;
3. above: Instance Method &lt;br /&gt;
It returns the entry that is above a present sequence number for a given parent id &lt;br /&gt;
&lt;br /&gt;
4. below: Instance Method &lt;br /&gt;
It returns the entry that is below a present sequence number for a given parent id &lt;br /&gt;
&lt;br /&gt;
5. repack(repack_id): Class Method &lt;br /&gt;
It modifies the sequence numbers, making them in order, removing the skip entries present in it. It is performed after certain sequences have been deleted. repack_id tells the parent id under which these changes are to be made&lt;br /&gt;
&lt;br /&gt;
6. next_seq(parent id): Class Method&lt;br /&gt;
It returns the next possible sequence id corresponding to a given parent id entries. This function would be helpful if we wish to add a new entry and find out which sequence id is to be given to it. &lt;br /&gt;
&lt;br /&gt;
7. items_for_permission: Class Method&lt;br /&gt;
It returns the set of items that are possible to be displayed for a given permission id and also based on controller action id and page id being present for it.&lt;br /&gt;
&lt;br /&gt;
=== Test Entries Creation ===&lt;br /&gt;
Mock/dummy objects are needed to be created for any unit testing criteria.These objects are loaded freshly and deleted after every testing condition. &lt;br /&gt;
&lt;br /&gt;
Several methods exist for creating such a objects, whose parameters need to be designed to satisfy the conditions under test. Using 'factories' is one such method where few of the attributes are filled in with predefined values when an created. Here, for this specific case, we haven't used, factories method as, the number of attributes were limited in menu_items model and could be filled in completely with the required values each time. &lt;br /&gt;
&lt;br /&gt;
For testing menu_items, we created required entries into the database using &amp;quot;Let&amp;quot; and &amp;quot;MenuItem.create&amp;quot; method, giving different values for each of the test inputs to cover the required testing conditions.&lt;br /&gt;
&lt;br /&gt;
       let!(:menuitem) {MenuItem.create id: 1, parent_id: nil, name: &amp;quot;navigate&amp;quot;, label: &amp;quot;Navigate&amp;quot;, seq: 1, controller_action_id: 1, content_page_id: 1}&lt;br /&gt;
&lt;br /&gt;
The above is an example entry used for menu item. 5 more similar objects were created with entries giving combinations of parent_id, sequence numbers and controller_action_id. We also created objects for controller_action and content_page which were used to define conditions for coverage of items_for_permission. &lt;br /&gt;
&lt;br /&gt;
=== Testing Conditions ===&lt;br /&gt;
=== Testing Conditions ===&lt;br /&gt;
A total of 13 unit tests were performed for testing all the functions in menu items model file and achieving complete code coverage.&lt;br /&gt;
&lt;br /&gt;
The conditions that needed to be tested are as below:&lt;br /&gt;
&lt;br /&gt;
1. .find_or_create_by_name: &lt;br /&gt;
 In this test case we check whether the find_or_create_by_name function returns a valid menu item.&lt;br /&gt;
&lt;br /&gt;
2. #delete: &lt;br /&gt;
 For this test case, we delete a parent menu item and check whether the count of total item reduces considering parent and child items are also deleted.&lt;br /&gt;
 &lt;br /&gt;
3. #above: Test cases were written to check the below conditions:&lt;br /&gt;
 3.1 If the given menu item has a valid parent_id, return the previous menu item in terms of sequence number that is a child of the same parent_id.&lt;br /&gt;
 3.2 If the given menu item has a null parent_id, return the previous menu item in terms of sequence number that also has a null parent_id value.&lt;br /&gt;
&lt;br /&gt;
4. #below: Test cases were written to check the below conditions:&lt;br /&gt;
 4.1 If the given menu item has a valid parent_id, return the next menu item in terms of sequence number that is a child of the same parent_id.&lt;br /&gt;
 4.2 If the given menu item has a null parent_id, return the next menu item in terms of sequence number that also has a null parent_id value.&lt;br /&gt;
&lt;br /&gt;
5. .repack: Test cases were written to check the below conditions:&lt;br /&gt;
 5.1 If the given menu item is updated and parent id is valid, repack is called with current menu item id as repack id and re calculate sequence number for all child items.&lt;br /&gt;
 5.2 If the given menu item is updated and parent id is null, repack is called with parent id of current menu and sequence number is recalculated for all child items.&lt;br /&gt;
&lt;br /&gt;
6. .next_seq: Test cases were written to check the below conditions:&lt;br /&gt;
 6.1 If parent id is not null and next_seq is called, the function increments the maximum sequence number for that parent group and returns that value to be stored as the next sequence number for the new menu item.&lt;br /&gt;
 6.2 If parent id is null, and next_seq is called, the function increments the maximum sequence number amongst all menu items having parent id as null and returns that value to be stored as the next sequence number for the new menu item.&lt;br /&gt;
&lt;br /&gt;
7. .items_for_permissions: Test cases were written to check the below conditions:&lt;br /&gt;
 7.1 If permission id is null, we check if the controller action id is greater than zero and add menu items to a list accordingly.&lt;br /&gt;
 7.2 If permission id is not null, we check if controller action id is greater than zero. If not, we check the items for matching content page id and list menu items accordingly.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
After writing the test cases we used SimpleCov to measure the C0 coverage of our rails application. After running rake spec to run the test cases, SimpleCov creates a directory called coverage in our rails application folder. This folder called coverage contains an index.html file which when opened in a browser renders an html page which gives the C0 coverage of each of the files in the Controllers, Models, Helpers in the app directory.&lt;br /&gt;
&lt;br /&gt;
For our case, the C0 coverage of the menu_items.rb file in the Models folder increased from 0 to 100.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/angad8292/expertiza/blob/master/spec/models/menu_item_spec.rb GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;/div&gt;</summary>
		<author><name>Bjain</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2018_E1813_Menu_item_tests&amp;diff=115407</id>
		<title>CSC/ECE 517 Spring 2018 E1813 Menu item tests</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2018_E1813_Menu_item_tests&amp;diff=115407"/>
		<updated>2018-03-27T03:38:41Z</updated>

		<summary type="html">&lt;p&gt;Bjain: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page corresponds to the OSS Project for CSE/ECE 517 (Spring 2018) E1813 Write unit tests for menu_item.rb&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
===Expertiza===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source web application based on [http://rubyonrails.org/ Ruby on Rails] framework,  supported by the National Science Foundation. &lt;br /&gt;
It is a place where students can submit and peer-review learning objects (assignments, codes, write ups, websites, etc). For an instructor, expertiza allows to create and customize new or existing assignments. For students, it allows to create and work on various projects and assignments. It provides a platform to peer review other students' submissions across various document types, including the URLs and wiki pages.&lt;br /&gt;
===Behavior Driven-Development===&lt;br /&gt;
In software engineering, behavior-driven development (BDD) is a software development process that emerged from test-driven development (TDD). Behavior-driven development combines the general techniques and principles of TDD with ideas from domain-driven design and object-oriented analysis and design to provide software development and management teams with shared tools and a shared process to collaborate on software development.&lt;br /&gt;
&lt;br /&gt;
BDD focuses on:&lt;br /&gt;
&lt;br /&gt;
1. Where to start in the process&lt;br /&gt;
&lt;br /&gt;
2. What to test and what not to test&lt;br /&gt;
&lt;br /&gt;
3. How much to test in one go&lt;br /&gt;
&lt;br /&gt;
4. What to call the tests&lt;br /&gt;
&lt;br /&gt;
5. How to understand why a test fails&lt;br /&gt;
&lt;br /&gt;
Test-driven development is a software development methodology which essentially states that for each unit of software, a software developer must:&lt;br /&gt;
&lt;br /&gt;
Define a test set for the unit first;&lt;br /&gt;
&lt;br /&gt;
Make the tests fail;&lt;br /&gt;
&lt;br /&gt;
Then implement the unit;&lt;br /&gt;
&lt;br /&gt;
Finally, verify that the implementation of the unit makes the tests succeed.&lt;br /&gt;
&lt;br /&gt;
This definition is rather non-specific in that it allows tests in terms of high-level software requirements, low-level technical details or anything in between. One way of looking at BDD therefore, is that it is a continued development of TDD which makes more specific choices than TDD.&lt;br /&gt;
&lt;br /&gt;
===Unit Testing===&lt;br /&gt;
In computer programming, [https://en.wikipedia.org/wiki/Unit_testing Unit Testing] is a software testing method by which individual units of source code, sets of one or more computer program modules together with associated control data, usage procedures, and operating procedures, are tested to determine whether they are fit for use. Ideally, each test case is independent from the others. Substitutes such as method stubs, mock objects, fakes, and test harnesses can be used to assist testing a module in isolation.&lt;br /&gt;
&lt;br /&gt;
Some of the advantages of unit testing are:&lt;br /&gt;
&lt;br /&gt;
1. Finds problems early: Unit testing finds problems early in the development cycle. This includes both bugs in the programmer's implementation and flaws or missing parts of the specification for the unit.&lt;br /&gt;
In test-driven development (TDD), which is frequently used in both extreme programming and scrum, unit tests are created before the code itself is written. When the tests pass, that code is considered complete.&lt;br /&gt;
&lt;br /&gt;
2. Facilitates change: Unit testing allows the programmer to refactor code or upgrade system libraries at a later date, and make sure the module still works correctly (e.g., in regression testing). The procedure is to write test cases for all functions and methods so that whenever a change causes a fault, it can be quickly identified. Unit tests detect changes which may break a design contract.&lt;br /&gt;
&lt;br /&gt;
3. Simplifies Integration: Unit testing may reduce uncertainty in the units themselves and can be used in a bottom-up testing style approach. By testing the parts of a program first and then testing the sum of its parts, integration testing becomes much easier.&lt;br /&gt;
&lt;br /&gt;
4. Documentation: Developers looking to learn what functionality is provided by a unit, and how to use it, can look at the unit tests to gain a basic understanding of the unit's interface's API.&lt;br /&gt;
&lt;br /&gt;
5. Design: When software is developed using a test-driven approach, the combination of writing the unit test to specify the interface plus the refactoring activities performed after the test is passing, may take the place of formal design. Each unit test can be seen as a design element specifying classes, methods, and observable behavior.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
&lt;br /&gt;
This project is to write unit tests using rspec for menu_items.rb model. The unit tests are to be written to make the path coverage of menu_item.rb more than 90% and achieve the highest possible branch coverage.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
The files to be understood and created are:&lt;br /&gt;
&lt;br /&gt;
1. app/models/menu_items.rb&lt;br /&gt;
&lt;br /&gt;
2. spec/models/menu_items_spec.rb&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
Students who collaborated to work on this problem statement are:&lt;br /&gt;
&lt;br /&gt;
1. Angad Singh Wadhwa (awadhwa3@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
2. Bhavuk Jain (bjain@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
== Plan Of Work ==&lt;br /&gt;
&lt;br /&gt;
The task in hand was to write test cases for testing the menu_items model file. No Rspec file for the corresponding model exists so there was a need to create a new file and build tests from scratch. &lt;br /&gt;
For this purposes different sub tasks involved&lt;br /&gt;
&lt;br /&gt;
1. Setting up the Expertiza environment &lt;br /&gt;
&lt;br /&gt;
2. Understand the functionality of model file in menu_items.rb &lt;br /&gt;
&lt;br /&gt;
3. Understand the linked data attributes being used, like controller_actions, content_page, permissions_id&lt;br /&gt;
&lt;br /&gt;
4. Creating dummy entries for testing different functionalities. &lt;br /&gt;
&lt;br /&gt;
5. Writing testing conditions for different functions and cross checking with the expected outputs.&lt;br /&gt;
&lt;br /&gt;
== Implementation Steps==&lt;br /&gt;
&lt;br /&gt;
=== Expertiza Environment Setup ===&lt;br /&gt;
We used the Ubuntu-Expertiza image to setup the environment.&lt;br /&gt;
We forked the master from Expertiza, clone and then run through the command terminal.&lt;br /&gt;
&lt;br /&gt;
cd/expetiza/app/models&lt;br /&gt;
&lt;br /&gt;
The menu_item.rb model file is present in this directory&lt;br /&gt;
&lt;br /&gt;
=== Functionality of Menu Items model ===&lt;br /&gt;
Menu Items is a model which gives the functionality to the top menu bar in the Expertiza website. It controls the display of drop down menus and its sub menus. It directs how these drop downs are displayed with regards to different users which have different permission attributes.&lt;br /&gt;
A super admin has the permission to edit the menu bar, by adding or deleting menu item blocks from it. Upon adding each item, he gets to position it either in the main menu bar or into different sub categories.&lt;br /&gt;
&lt;br /&gt;
====Parameters ====&lt;br /&gt;
Following are the parameters associated with the menu_item model: &lt;br /&gt;
&lt;br /&gt;
1. Name: This parameter gives the name to the menu item. &lt;br /&gt;
&lt;br /&gt;
2. Label: This parameter gives the label to the menu item. &lt;br /&gt;
&lt;br /&gt;
3. Parent id: It gives the id of the parent and establishes the hierarchy of the various objects of the menu item model. It can also be 'null' which means that it will be the base category. &lt;br /&gt;
&lt;br /&gt;
4. Sequence id: It gives the sequence numbering for determining the way the attributes are ordered within a parent. &lt;br /&gt;
&lt;br /&gt;
5. Controller action id: This parameter is associated with the direction in which the user is directed onto.&lt;br /&gt;
 &lt;br /&gt;
6. Content page id: This parameter is also associated with the direction in which the user is directed onto.&lt;br /&gt;
&lt;br /&gt;
====Methods====&lt;br /&gt;
&lt;br /&gt;
Different instance methods and class methods exist in this models . Brief description of each of them are: &lt;br /&gt;
&lt;br /&gt;
1. find_or_create_by_name(params): Class Method &lt;br /&gt;
This method finds or creates a new entry with the given name obtained in params. &lt;br /&gt;
&lt;br /&gt;
2. delete: Instance Method &lt;br /&gt;
This methods deletes the entry and all the child entries (entries having the same parent id) lined to it &lt;br /&gt;
&lt;br /&gt;
3. above: Instance Method &lt;br /&gt;
It returns the entry that is above a present sequence number for a given parent id &lt;br /&gt;
&lt;br /&gt;
4. below: Instance Method &lt;br /&gt;
It returns the entry that is below a present sequence number for a given parent id &lt;br /&gt;
&lt;br /&gt;
5. repack(repack_id): Class Method &lt;br /&gt;
It modifies the sequence numbers, making them in order, removing the skip entries present in it. It is performed after certain sequences have been deleted. repack_id tells the parent id under which these changes are to be made&lt;br /&gt;
&lt;br /&gt;
6. next_seq(parent id): Class Method&lt;br /&gt;
It returns the next possible sequence id corresponding to a given parent id entries. This function would be helpful if we wish to add a new entry and find out which sequence id is to be given to it. &lt;br /&gt;
&lt;br /&gt;
7. items_for_permission: Class Method&lt;br /&gt;
It returns the set of items that are possible to be displayed for a given permission id and also based on controller action id and page id being present for it.&lt;br /&gt;
&lt;br /&gt;
=== Test Entries Creation ===&lt;br /&gt;
Mock/dummy objects are needed to be created for any unit testing criteria.These objects are loaded freshly and deleted after every testing condition. &lt;br /&gt;
&lt;br /&gt;
Several methods exist for creating such a objects, whose parameters need to be designed to satisfy the conditions under test. Using 'factories' is one such method where few of the attributes are filled in with predefined values when an created. Here, for this specific case, we haven't used, factories method as, the number of attributes were limited in menu_items model and could be filled in completely with the required values each time. &lt;br /&gt;
&lt;br /&gt;
For testing menu_items, we created required entries into the database using &amp;quot;Let&amp;quot; and &amp;quot;MenuItem.create&amp;quot; method, giving different values for each of the test inputs to cover the required testing conditions.&lt;br /&gt;
&lt;br /&gt;
       let!(:menuitem) {MenuItem.create id: 1, parent_id: nil, name: &amp;quot;navigate&amp;quot;, label: &amp;quot;Navigate&amp;quot;, seq: 1, controller_action_id: 1, content_page_id: 1}&lt;br /&gt;
&lt;br /&gt;
The above is an example entry used for menu item. 5 more similar objects were created with entries giving combinations of parent_id, sequence numbers and controller_action_id. We also created objects for controller_action and content_page which were used to define conditions for coverage of items_for_permission. &lt;br /&gt;
&lt;br /&gt;
=== Testing Conditions ===&lt;br /&gt;
A total of 16 testing conditions were required to be performed for testing all the functions in menu items model file.&lt;br /&gt;
&lt;br /&gt;
The conditions that needed to be tested are as below:&lt;br /&gt;
&lt;br /&gt;
1. .find_or_create_by_name:&lt;br /&gt;
&lt;br /&gt;
 In this we had write unit test cases to test if the method returned a menu_item corresponding to a name.&lt;br /&gt;
 Here we expect that if the method find_or_create_by_name() is passed the parameter &amp;quot;home&amp;quot;, then it should return a value equal to &amp;quot;home&amp;quot;&lt;br /&gt;
&lt;br /&gt;
2. #delete:&lt;br /&gt;
&lt;br /&gt;
 In this test cases were written to check if the method deletes current menu items and all child menu items.&lt;br /&gt;
 In this case, if the parent menu item is deleted, all its child record should should be deleted.&lt;br /&gt;
 For our specific case, the parent and its 3 child menu_items are expected to be deleted.&lt;br /&gt;
&lt;br /&gt;
3. #above:&lt;br /&gt;
&lt;br /&gt;
Test cases were written to check if the below conditions are satisfied:&lt;br /&gt;
&lt;br /&gt;
 3.1 &amp;quot;When current menu item has parent_id, the method returns the first parent menu item by querying the parent_id and current sequence number minus one&amp;quot;.&lt;br /&gt;
      Here we expect that if we invoke the method above() on the active record test4, the method should return a value equal to the active record test3.&lt;br /&gt;
&lt;br /&gt;
 3.2 &amp;quot;When current menu item does not have parent_id, the method returns the first parent menu item by querying the current sequence number minus one&amp;quot;.&lt;br /&gt;
      Here we expect that if we invoke the method above() on the active record test5, the method should return a value equal to the active record test1.&lt;br /&gt;
&lt;br /&gt;
4. #below:&lt;br /&gt;
&lt;br /&gt;
Test cases were written to check if the below conditions are satisfied:&lt;br /&gt;
&lt;br /&gt;
 4.1 &amp;quot;When current menu item has parent_id,the method returns the first parent menu item by querying the parent_id and current sequence number plus one&amp;quot;.&lt;br /&gt;
      Here we expect that if we invoke the method below() on the active record test3, the method should return a value equal to the active record test4&lt;br /&gt;
      &lt;br /&gt;
 4.2 &amp;quot;When current menu item does not have parent_id, the method returns the first parent menu item by querying the current sequence number plus one&amp;quot;.&lt;br /&gt;
      Here we expect that if we invoke the method below() on the active record test1, the method should return a value equal to the active record test5.&lt;br /&gt;
&lt;br /&gt;
5. .repack:&lt;br /&gt;
&lt;br /&gt;
Test cases were written to check if the below conditions are satisfied:&lt;br /&gt;
&lt;br /&gt;
 5.1 &amp;quot;When current menu item has repack_id, the method finds all menus items with parent_id equal to repack_id and repacks the sequence number&amp;quot;.&lt;br /&gt;
      Here we expect that if the method repack() is invoked on the MenuItem and passed the value 1, &lt;br /&gt;
      then, it will repack the sequence ids and returns the list of repacked seq_ids.&lt;br /&gt;
 5.2 &amp;quot;When current menu item does not have repack_id, the method finds all menus items with parent_id null and repacks the sequence number&amp;quot;.&lt;br /&gt;
      Here we expect that if the method repack() is invoked on the MenuItem and passed the value Null, &lt;br /&gt;
      it will match all the values with parent_id = Null and returns the list of repacked seq_ids.&lt;br /&gt;
&lt;br /&gt;
6. .next_seq:&lt;br /&gt;
&lt;br /&gt;
Test cases were written to check if the below conditions are satisfied:&lt;br /&gt;
&lt;br /&gt;
 6.1 &amp;quot;When parent_id is bigger than 0, the method selects corresponding menu items with inputted parent_id and returns the next sequence number&amp;quot;.&lt;br /&gt;
      Here we expect that if we invoke the method next_seq() on the MenuItem and pass the value 1, the method should return a value equal to 5.&lt;br /&gt;
      &lt;br /&gt;
 6.2 &amp;quot;When parent_id is smaller than or equal to 0, the method selects corresponding menu items with parent_id null and returns the next sequence number&amp;quot;.&lt;br /&gt;
      Here we expect that if we invoke the method next_seq() on the MenuItem and pass the value nil, the method should return a value equal to 6.&lt;br /&gt;
&lt;br /&gt;
7. .items_for_permissions:&lt;br /&gt;
&lt;br /&gt;
Test cases were written to check if the below conditions are satisfied:&lt;br /&gt;
&lt;br /&gt;
 7.1 &amp;quot;When inputted variable (permission_ids) is nil and when the controller_action_id of current item is bigger than 0 and when perms does not exist, &lt;br /&gt;
     the method returns the corresponding items&amp;quot;.&lt;br /&gt;
     Here we expect that if the method items_for_permissions() is invoked on the MenuItems, &lt;br /&gt;
     then the method should return a list of active_records which satisfy the condition.&lt;br /&gt;
 7.2 &amp;quot;When the controller_action_id of current item is smaller than or equal to 0 and the content_page_id of current item is bigger than 0 and when perms does not exist, &lt;br /&gt;
     the method returns the corresponding items&amp;quot;.&lt;br /&gt;
     Here we expect that if the method items_for_permissions() is invoked on the MenuItems, &lt;br /&gt;
     then the method should return a list of active_records which satisfy the condition.&lt;br /&gt;
 7.3 &amp;quot;When the controller_action_id and content_page_id of current item is smaller than or equal to 0, &lt;br /&gt;
     the method returns the corresponding items&amp;quot;.&lt;br /&gt;
     Here we expect that if the method items_for_permissions() is invoked on the MenuItems, &lt;br /&gt;
     the method should return an empty list.&lt;br /&gt;
 7.4 &amp;quot;When inputted variable (permission_ids) is not nil and when the controller_action_id of current item is bigger than 0 and when perms exists, &lt;br /&gt;
     the method returns the corresponding items&amp;quot;.&lt;br /&gt;
     Here we expect that if the method items_for_permissions() is invoked on the MenuItems and passed the value 1 as parameter, &lt;br /&gt;
     then the method should return a list of active_records &lt;br /&gt;
     which satisfy the condition.&lt;br /&gt;
 7.5 &amp;quot;When the controller_action_id of current item is smaller than or equal to 0 and the content_page_id of current item is bigger than 0, and when perms exists, &lt;br /&gt;
     the method returns corresponding items.&amp;quot;&lt;br /&gt;
     Here we expect that if the method items_for_permissions() is invoked on the MenuItems and passed the value 1 as parameter, &lt;br /&gt;
     then the method should return a list of active_records which satisfy the condition.&lt;br /&gt;
 7.6 &amp;quot;When the controller_action_id and content_page_id of current item is smaller than or equal to 0, &lt;br /&gt;
     the method returns the corresponding items.&amp;quot;&lt;br /&gt;
     Here we expect that if the method items_for_permissions() is invoked on the MenuItems and passed the value 1 as a parameter, &lt;br /&gt;
     the method should return an empty list.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
After writing the test cases we used SimpleCov to measure the C0 coverage of our rails application. After running rake spec to run the test cases, SimpleCov creates a directory called coverage in our rails application folder. This folder called coverage contains an index.html file which when opened in a browser renders an html page which gives the C0 coverage of each of the files in the Controllers, Models, Helpers in the app directory.&lt;br /&gt;
&lt;br /&gt;
For our case, the C0 coverage of the menu_items.rb file in the Models folder increased from 0 to 100.&lt;br /&gt;
&lt;br /&gt;
The learning outcomes after performing this project can be summarized in the following points:&lt;br /&gt;
&lt;br /&gt;
1. We got an hands on experience about how to write tests following the Test Driven Development approach.&lt;br /&gt;
&lt;br /&gt;
2. We learned about how to write units tests for models and controllers in RSpec.&lt;br /&gt;
&lt;br /&gt;
3. We also learned how to understand the functionality of an already developed application.For our case, before writing the test cases for the menu_items.rb we had the understand how different models interacted with each other and how each action by different users would make changes in the database schema.&lt;br /&gt;
&lt;br /&gt;
4. We also gained a better understanding about how different tables, columns of a large applications in structured in the database schema.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/angad8292/expertiza/blob/master/spec/models/menu_item_spec.rb GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;/div&gt;</summary>
		<author><name>Bjain</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2018_E1813_Menu_item_tests&amp;diff=115403</id>
		<title>CSC/ECE 517 Spring 2018 E1813 Menu item tests</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2018_E1813_Menu_item_tests&amp;diff=115403"/>
		<updated>2018-03-27T03:32:19Z</updated>

		<summary type="html">&lt;p&gt;Bjain: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page corresponds to the OSS Project for CSE/ECE 517 (Spring 2018) E1813 Write unit tests for menu_item.rb&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
===Expertiza===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source web application based on [http://rubyonrails.org/ Ruby on Rails] framework,  supported by the National Science Foundation. &lt;br /&gt;
It is a place where students can submit and peer-review learning objects (assignments, codes, write ups, websites, etc). For an instructor, expertiza allows to create and customize new or existing assignments. For students, it allows to create and work on various projects and assignments. It provides a platform to peer review other students' submissions across various document types, including the URLs and wiki pages.&lt;br /&gt;
===Behavior Driven-Development===&lt;br /&gt;
In software engineering, behavior-driven development (BDD) is a software development process that emerged from test-driven development (TDD). Behavior-driven development combines the general techniques and principles of TDD with ideas from domain-driven design and object-oriented analysis and design to provide software development and management teams with shared tools and a shared process to collaborate on software development.&lt;br /&gt;
&lt;br /&gt;
BDD focuses on:&lt;br /&gt;
&lt;br /&gt;
1. Where to start in the process&lt;br /&gt;
&lt;br /&gt;
2. What to test and what not to test&lt;br /&gt;
&lt;br /&gt;
3. How much to test in one go&lt;br /&gt;
&lt;br /&gt;
4. What to call the tests&lt;br /&gt;
&lt;br /&gt;
5. How to understand why a test fails&lt;br /&gt;
&lt;br /&gt;
Test-driven development is a software development methodology which essentially states that for each unit of software, a software developer must:&lt;br /&gt;
&lt;br /&gt;
Define a test set for the unit first;&lt;br /&gt;
&lt;br /&gt;
Make the tests fail;&lt;br /&gt;
&lt;br /&gt;
Then implement the unit;&lt;br /&gt;
&lt;br /&gt;
Finally, verify that the implementation of the unit makes the tests succeed.&lt;br /&gt;
&lt;br /&gt;
This definition is rather non-specific in that it allows tests in terms of high-level software requirements, low-level technical details or anything in between. One way of looking at BDD therefore, is that it is a continued development of TDD which makes more specific choices than TDD.&lt;br /&gt;
&lt;br /&gt;
===Unit Testing===&lt;br /&gt;
In computer programming, [https://en.wikipedia.org/wiki/Unit_testing Unit Testing] is a software testing method by which individual units of source code, sets of one or more computer program modules together with associated control data, usage procedures, and operating procedures, are tested to determine whether they are fit for use. Ideally, each test case is independent from the others. Substitutes such as method stubs, mock objects, fakes, and test harnesses can be used to assist testing a module in isolation.&lt;br /&gt;
&lt;br /&gt;
Some of the advantages of unit testing are:&lt;br /&gt;
&lt;br /&gt;
1. Finds problems early:&lt;br /&gt;
&lt;br /&gt;
Unit testing finds problems early in the development cycle. This includes both bugs in the programmer's implementation and flaws or missing parts of the specification for the unit.&lt;br /&gt;
In test-driven development (TDD), which is frequently used in both extreme programming and scrum, unit tests are created before the code itself is written. When the tests pass, that code is considered complete.&lt;br /&gt;
&lt;br /&gt;
2. Facilitates change:&lt;br /&gt;
&lt;br /&gt;
Unit testing allows the programmer to refactor code or upgrade system libraries at a later date, and make sure the module still works correctly (e.g., in regression testing). The procedure is to write test cases for all functions and methods so that whenever a change causes a fault, it can be quickly identified. Unit tests detect changes which may break a design contract.&lt;br /&gt;
&lt;br /&gt;
3. Simplifies Integration:&lt;br /&gt;
&lt;br /&gt;
Unit testing may reduce uncertainty in the units themselves and can be used in a bottom-up testing style approach. By testing the parts of a program first and then testing the sum of its parts, integration testing becomes much easier.&lt;br /&gt;
&lt;br /&gt;
4. Documentation:&lt;br /&gt;
&lt;br /&gt;
Developers looking to learn what functionality is provided by a unit, and how to use it, can look at the unit tests to gain a basic understanding of the unit's interface's API.&lt;br /&gt;
&lt;br /&gt;
5. Design:&lt;br /&gt;
&lt;br /&gt;
When software is developed using a test-driven approach, the combination of writing the unit test to specify the interface plus the refactoring activities performed after the test is passing, may take the place of formal design. Each unit test can be seen as a design element specifying classes, methods, and observable behavior.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
&lt;br /&gt;
This project is to write unit tests using rspec for menu_items.rb model. The unit tests are to be written to make the path coverage of menu_item.rb more than 90% and achieve the highest possible branch coverage.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
The files to be understood and created are:&lt;br /&gt;
&lt;br /&gt;
1. app/models/menu_items.rb&lt;br /&gt;
&lt;br /&gt;
2. spec/models/menu_items_spec.rb&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
Students who collaborated to work on this problem statement are:&lt;br /&gt;
&lt;br /&gt;
1. Angad Singh Wadhwa (awadhwa3@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
2. Bhavuk Jain (bjain@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
== Plan Of Work ==&lt;br /&gt;
&lt;br /&gt;
The task in hand was to write test cases for testing the menu_items model file. No Rspec file for the corresponding model exists so there was a need to create a new file and build tests from scratch. &lt;br /&gt;
For this purposes different sub tasks involved&lt;br /&gt;
&lt;br /&gt;
1. Setting up the Expertiza environment &lt;br /&gt;
&lt;br /&gt;
2. Understand the functionality of model file in menu_items.rb &lt;br /&gt;
&lt;br /&gt;
3. Understand the linked data attributes being used, like controller_actions, content_page, permissions_id&lt;br /&gt;
&lt;br /&gt;
4. Creating dummy entries for testing different functionalities. &lt;br /&gt;
&lt;br /&gt;
5. Writing testing conditions for different functions and cross checking with the expected outputs.&lt;br /&gt;
&lt;br /&gt;
== Implementation Steps==&lt;br /&gt;
&lt;br /&gt;
=== Expertiza Environment Setup ===&lt;br /&gt;
We used the Ubuntu-Expertiza image to setup the environment.&lt;br /&gt;
We forked the master from Expertiza, clone and then run through the command terminal.&lt;br /&gt;
&lt;br /&gt;
cd/expetiza/app/models&lt;br /&gt;
&lt;br /&gt;
The menu_item.rb model file is present in this directory&lt;br /&gt;
&lt;br /&gt;
=== Functionality of Menu Items model ===&lt;br /&gt;
Menu Items is a model which gives the functionality to the top menu bar in the Expertiza website. It controls the display of drop down menus and its sub menus. It directs how these drop downs are displayed with regards to different users which have different permission attributes.&lt;br /&gt;
A super admin has the permission to edit the menu bar, by adding or deleting menu item blocks from it. Upon adding each item, he gets to position it either in the main menu bar or into different sub categories.&lt;br /&gt;
&lt;br /&gt;
====Parameters ====&lt;br /&gt;
Following are the parameters associated with the menu_item model: &lt;br /&gt;
&lt;br /&gt;
1. Name : This parameter gives the name to the menu item. &lt;br /&gt;
&lt;br /&gt;
2. Label : This parameter gives the label to the menu item. &lt;br /&gt;
&lt;br /&gt;
3. Parent id : It gives the id of the parent and establishes the hierarchy of the various objects of the menu item model. It can also be 'null' which means that it will be the base category. &lt;br /&gt;
&lt;br /&gt;
4. Sequence id : It gives the sequence numbering for determining the way the attributes are ordered within a parent. &lt;br /&gt;
&lt;br /&gt;
5. Controller action id : This parameter is associated with the direction in which the user is directed onto.&lt;br /&gt;
 &lt;br /&gt;
6. Content page id : This parameter is also associated with the direction in which the user is directed onto.&lt;br /&gt;
&lt;br /&gt;
====Methods====&lt;br /&gt;
&lt;br /&gt;
Different instance methods and class methods exist in this models . Brief description of each of them are: &lt;br /&gt;
&lt;br /&gt;
1. find_or_create_by_name(params) : Class Method &lt;br /&gt;
This method finds or creates a new entry with the given name obtained in params. &lt;br /&gt;
&lt;br /&gt;
2. delete : Instance Method &lt;br /&gt;
This methods deletes the entry and all the child entries (entries having the same parent id) lined to it &lt;br /&gt;
&lt;br /&gt;
3. above : Instance Method &lt;br /&gt;
It returns the entry that is above a present sequence number for a given parent id &lt;br /&gt;
&lt;br /&gt;
4. below : Instance Method &lt;br /&gt;
It returns the entry that is below a present sequence number for a given parent id &lt;br /&gt;
&lt;br /&gt;
5. repack(repack_id) : Class Method &lt;br /&gt;
It modifies the sequence numbers, making them in order, removing the skip entries present in it. It is performed after certain sequences have been deleted. repack_id tells the parent id under which these changes are to be made&lt;br /&gt;
&lt;br /&gt;
6. next_seq(parent id) : Class Method&lt;br /&gt;
It returns the next possible sequence id corresponding to a given parent id entries. This function would be helpful if we wish to add a new entry and find out which sequence id is to be given to it. &lt;br /&gt;
&lt;br /&gt;
7. items_for_permission : Class Method&lt;br /&gt;
It returns the set of items that are possible to be displayed for a given permission id and also based on controller action id and page id being present for it.&lt;br /&gt;
&lt;br /&gt;
=== Test Entries Creation ===&lt;br /&gt;
Mock/dummy objects are needed to be created for any unit testing criteria.These objects are loaded freshly and deleted after every testing condition. &lt;br /&gt;
&lt;br /&gt;
Several methods exist for creating such a objects, whose parameters need to be designed to satisfy the conditions under test. Using 'factories' is one such method where few of the attributes are filled in with predefined values when an created. Here, for this specific case, we haven't used, factories method as, the number of attributes were limited in menu_items model and could be filled in completely with the required values each time. &lt;br /&gt;
&lt;br /&gt;
For testing menu_items, we created required entries into the database using &amp;quot;Let&amp;quot; and &amp;quot;MenuItem.create&amp;quot; method, giving different values for each of the test inputs to cover the required testing conditions.&lt;br /&gt;
&lt;br /&gt;
       let!(:menuitem) {MenuItem.create id: 1, parent_id: nil, name: &amp;quot;navigate&amp;quot;, label: &amp;quot;Navigate&amp;quot;, seq: 1, controller_action_id: 1, content_page_id: 1}&lt;br /&gt;
&lt;br /&gt;
The above is an example entry used for menu item. 5 more similar objects were created with entries giving combinations of parent_id, sequence numbers and controller_action_id. We also created objects for controller_action and content_page which were used to define conditions for coverage of items_for_permission. &lt;br /&gt;
&lt;br /&gt;
=== Testing Conditions ===&lt;br /&gt;
A total of 16 testing conditions were required to be performed for testing all the functions in menu items model file.&lt;br /&gt;
&lt;br /&gt;
The conditions that needed to be tested are as below:&lt;br /&gt;
&lt;br /&gt;
1. .find_or_create_by_name:&lt;br /&gt;
&lt;br /&gt;
 In this we had write unit test cases to test if the method returned a menu_item corresponding to a name.&lt;br /&gt;
 Here we expect that if the method find_or_create_by_name() is passed the parameter &amp;quot;home&amp;quot;, then it should return a value equal to &amp;quot;home&amp;quot;&lt;br /&gt;
&lt;br /&gt;
2. #delete:&lt;br /&gt;
&lt;br /&gt;
 In this test cases were written to check if the method deletes current menu items and all child menu items.&lt;br /&gt;
 In this case, if the parent menu item is deleted, all its child record should should be deleted.&lt;br /&gt;
 For our specific case, the parent and its 3 child menu_items are expected to be deleted.&lt;br /&gt;
&lt;br /&gt;
3. #above:&lt;br /&gt;
&lt;br /&gt;
Test cases were written to check if the below conditions are satisfied:&lt;br /&gt;
&lt;br /&gt;
 3.1 &amp;quot;When current menu item has parent_id, the method returns the first parent menu item by querying the parent_id and current sequence number minus one&amp;quot;.&lt;br /&gt;
      Here we expect that if we invoke the method above() on the active record test4, the method should return a value equal to the active record test3.&lt;br /&gt;
&lt;br /&gt;
 3.2 &amp;quot;When current menu item does not have parent_id, the method returns the first parent menu item by querying the current sequence number minus one&amp;quot;.&lt;br /&gt;
      Here we expect that if we invoke the method above() on the active record test5, the method should return a value equal to the active record test1.&lt;br /&gt;
&lt;br /&gt;
4. #below:&lt;br /&gt;
&lt;br /&gt;
Test cases were written to check if the below conditions are satisfied:&lt;br /&gt;
&lt;br /&gt;
 4.1 &amp;quot;When current menu item has parent_id,the method returns the first parent menu item by querying the parent_id and current sequence number plus one&amp;quot;.&lt;br /&gt;
      Here we expect that if we invoke the method below() on the active record test3, the method should return a value equal to the active record test4&lt;br /&gt;
      &lt;br /&gt;
 4.2 &amp;quot;When current menu item does not have parent_id, the method returns the first parent menu item by querying the current sequence number plus one&amp;quot;.&lt;br /&gt;
      Here we expect that if we invoke the method below() on the active record test1, the method should return a value equal to the active record test5.&lt;br /&gt;
&lt;br /&gt;
5. .repack:&lt;br /&gt;
&lt;br /&gt;
Test cases were written to check if the below conditions are satisfied:&lt;br /&gt;
&lt;br /&gt;
 5.1 &amp;quot;When current menu item has repack_id, the method finds all menus items with parent_id equal to repack_id and repacks the sequence number&amp;quot;.&lt;br /&gt;
      Here we expect that if the method repack() is invoked on the MenuItem and passed the value 1, &lt;br /&gt;
      then, it will repack the sequence ids and returns the list of repacked seq_ids.&lt;br /&gt;
 5.2 &amp;quot;When current menu item does not have repack_id, the method finds all menus items with parent_id null and repacks the sequence number&amp;quot;.&lt;br /&gt;
      Here we expect that if the method repack() is invoked on the MenuItem and passed the value Null, &lt;br /&gt;
      it will match all the values with parent_id = Null and returns the list of repacked seq_ids.&lt;br /&gt;
&lt;br /&gt;
6. .next_seq:&lt;br /&gt;
&lt;br /&gt;
Test cases were written to check if the below conditions are satisfied:&lt;br /&gt;
&lt;br /&gt;
 6.1 &amp;quot;When parent_id is bigger than 0, the method selects corresponding menu items with inputted parent_id and returns the next sequence number&amp;quot;.&lt;br /&gt;
      Here we expect that if we invoke the method next_seq() on the MenuItem and pass the value 1, the method should return a value equal to 5.&lt;br /&gt;
      &lt;br /&gt;
 6.2 &amp;quot;When parent_id is smaller than or equal to 0, the method selects corresponding menu items with parent_id null and returns the next sequence number&amp;quot;.&lt;br /&gt;
      Here we expect that if we invoke the method next_seq() on the MenuItem and pass the value nil, the method should return a value equal to 6.&lt;br /&gt;
&lt;br /&gt;
7. .items_for_permissions:&lt;br /&gt;
&lt;br /&gt;
Test cases were written to check if the below conditions are satisfied:&lt;br /&gt;
&lt;br /&gt;
 7.1 &amp;quot;When inputted variable (permission_ids) is nil and when the controller_action_id of current item is bigger than 0 and when perms does not exist, &lt;br /&gt;
     the method returns the corresponding items&amp;quot;.&lt;br /&gt;
     Here we expect that if the method items_for_permissions() is invoked on the MenuItems, &lt;br /&gt;
     then the method should return a list of active_records which satisfy the condition.&lt;br /&gt;
 7.2 &amp;quot;When the controller_action_id of current item is smaller than or equal to 0 and the content_page_id of current item is bigger than 0 and when perms does not exist, &lt;br /&gt;
     the method returns the corresponding items&amp;quot;.&lt;br /&gt;
     Here we expect that if the method items_for_permissions() is invoked on the MenuItems, &lt;br /&gt;
     then the method should return a list of active_records which satisfy the condition.&lt;br /&gt;
 7.3 &amp;quot;When the controller_action_id and content_page_id of current item is smaller than or equal to 0, &lt;br /&gt;
     the method returns the corresponding items&amp;quot;.&lt;br /&gt;
     Here we expect that if the method items_for_permissions() is invoked on the MenuItems, &lt;br /&gt;
     the method should return an empty list.&lt;br /&gt;
 7.4 &amp;quot;When inputted variable (permission_ids) is not nil and when the controller_action_id of current item is bigger than 0 and when perms exists, &lt;br /&gt;
     the method returns the corresponding items&amp;quot;.&lt;br /&gt;
     Here we expect that if the method items_for_permissions() is invoked on the MenuItems and passed the value 1 as parameter, &lt;br /&gt;
     then the method should return a list of active_records &lt;br /&gt;
     which satisfy the condition.&lt;br /&gt;
 7.5 &amp;quot;When the controller_action_id of current item is smaller than or equal to 0 and the content_page_id of current item is bigger than 0, and when perms exists, &lt;br /&gt;
     the method returns corresponding items.&amp;quot;&lt;br /&gt;
     Here we expect that if the method items_for_permissions() is invoked on the MenuItems and passed the value 1 as parameter, &lt;br /&gt;
     then the method should return a list of active_records which satisfy the condition.&lt;br /&gt;
 7.6 &amp;quot;When the controller_action_id and content_page_id of current item is smaller than or equal to 0, &lt;br /&gt;
     the method returns the corresponding items.&amp;quot;&lt;br /&gt;
     Here we expect that if the method items_for_permissions() is invoked on the MenuItems and passed the value 1 as a parameter, &lt;br /&gt;
     the method should return an empty list.&lt;br /&gt;
&lt;br /&gt;
== Conclusion and Learning Outcomes ==&lt;br /&gt;
&lt;br /&gt;
After writing the test cases we used SimpleCov to measure the C0 coverage of our rails application.&lt;br /&gt;
In our case we did not have to install SimpleCov explicitly since it was already installed earlier.&lt;br /&gt;
After running rake spec to run the test cases, SimpleCov creates a directory called coverage in our rails application folder.&lt;br /&gt;
This folder called coverage contains an index.html file which when opened in a browser renders an html page which gives the C0 coverage of each of the files in the Controllers,Models,Helpers in the app directory.&lt;br /&gt;
For our case, the C0 coverage of the menu_items.rb file in the Models folder increased from &amp;lt;&amp;gt; to &amp;lt;&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The learning outcomes after performing this project can be summarized in the following points:&lt;br /&gt;
&lt;br /&gt;
1. We got an hands on experience about how to write tests following the Test Driven Development approach.&lt;br /&gt;
&lt;br /&gt;
2. We learned about how to write units tests for models and controllers in RSpec.&lt;br /&gt;
&lt;br /&gt;
3. We also learned how to understand the functionality of an already developed application.For our case, before writing the test cases for the menu_items.rb we had the understand how different models interacted with each other and how each action by different users would make changes in the database schema.&lt;br /&gt;
&lt;br /&gt;
4. We also gained a better understanding about how different tables, columns of a large applications in structured in the database schema.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/sandeep993/expertiza/tree/menu_item_branch GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;/div&gt;</summary>
		<author><name>Bjain</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2018_E1813_Menu_item_tests&amp;diff=115394</id>
		<title>CSC/ECE 517 Spring 2018 E1813 Menu item tests</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2018_E1813_Menu_item_tests&amp;diff=115394"/>
		<updated>2018-03-27T03:21:15Z</updated>

		<summary type="html">&lt;p&gt;Bjain: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page corresponds to the OSS Project for CSE/ECE 517 (Spring 2018) E1813 Write unit tests for menu_item.rb&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
===Expertiza===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source web application based on [http://rubyonrails.org/ Ruby on Rails] framework,  supported by the National Science Foundation. &lt;br /&gt;
It is a place where students can submit and peer-review learning objects (assignments, codes, write ups, websites, etc). For an instructor, expertiza allows to create and customize new or existing assignments. For students, it allows to create and work on various projects and assignments. It provides a platform to peer review other students' submissions across various document types, including the URLs and wiki pages.&lt;br /&gt;
===Behavior Driven-Development===&lt;br /&gt;
In software engineering, behavior-driven development (BDD) is a software development process that emerged from test-driven development (TDD). Behavior-driven development combines the general techniques and principles of TDD with ideas from domain-driven design and object-oriented analysis and design to provide software development and management teams with shared tools and a shared process to collaborate on software development.&lt;br /&gt;
&lt;br /&gt;
BDD focuses on:&lt;br /&gt;
&lt;br /&gt;
1. Where to start in the process&lt;br /&gt;
&lt;br /&gt;
2. What to test and what not to test&lt;br /&gt;
&lt;br /&gt;
3. How much to test in one go&lt;br /&gt;
&lt;br /&gt;
4. What to call the tests&lt;br /&gt;
&lt;br /&gt;
5. How to understand why a test fails&lt;br /&gt;
&lt;br /&gt;
Test-driven development is a software development methodology which essentially states that for each unit of software, a software developer must:&lt;br /&gt;
&lt;br /&gt;
Define a test set for the unit first;&lt;br /&gt;
&lt;br /&gt;
Make the tests fail;&lt;br /&gt;
&lt;br /&gt;
Then implement the unit;&lt;br /&gt;
&lt;br /&gt;
Finally, verify that the implementation of the unit makes the tests succeed.&lt;br /&gt;
&lt;br /&gt;
This definition is rather non-specific in that it allows tests in terms of high-level software requirements, low-level technical details or anything in between. One way of looking at BDD therefore, is that it is a continued development of TDD which makes more specific choices than TDD.&lt;br /&gt;
&lt;br /&gt;
===Unit Testing===&lt;br /&gt;
In computer programming, [https://en.wikipedia.org/wiki/Unit_testing Unit Testing] is a software testing method by which individual units of source code, sets of one or more computer program modules together with associated control data, usage procedures, and operating procedures, are tested to determine whether they are fit for use. Ideally, each test case is independent from the others. Substitutes such as method stubs, mock objects, fakes, and test harnesses can be used to assist testing a module in isolation.&lt;br /&gt;
&lt;br /&gt;
Some of the advantages of unit testing are:&lt;br /&gt;
&lt;br /&gt;
1. Finds problems early:&lt;br /&gt;
&lt;br /&gt;
Unit testing finds problems early in the development cycle. This includes both bugs in the programmer's implementation and flaws or missing parts of the specification for the unit.&lt;br /&gt;
In test-driven development (TDD), which is frequently used in both extreme programming and scrum, unit tests are created before the code itself is written. When the tests pass, that code is considered complete.&lt;br /&gt;
&lt;br /&gt;
2. Facilitates change:&lt;br /&gt;
&lt;br /&gt;
Unit testing allows the programmer to refactor code or upgrade system libraries at a later date, and make sure the module still works correctly (e.g., in regression testing). The procedure is to write test cases for all functions and methods so that whenever a change causes a fault, it can be quickly identified. Unit tests detect changes which may break a design contract.&lt;br /&gt;
&lt;br /&gt;
3. Simplifies Integration:&lt;br /&gt;
&lt;br /&gt;
Unit testing may reduce uncertainty in the units themselves and can be used in a bottom-up testing style approach. By testing the parts of a program first and then testing the sum of its parts, integration testing becomes much easier.&lt;br /&gt;
&lt;br /&gt;
4. Documentation:&lt;br /&gt;
&lt;br /&gt;
Developers looking to learn what functionality is provided by a unit, and how to use it, can look at the unit tests to gain a basic understanding of the unit's interface's API.&lt;br /&gt;
&lt;br /&gt;
5. Design:&lt;br /&gt;
&lt;br /&gt;
When software is developed using a test-driven approach, the combination of writing the unit test to specify the interface plus the refactoring activities performed after the test is passing, may take the place of formal design. Each unit test can be seen as a design element specifying classes, methods, and observable behavior.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
&lt;br /&gt;
This project is to write unit tests using rspec for menu_items.rb model. The unit tests are to be written to make the path coverage of menu_item.rb more than 90% and achieve the highest possible branch coverage.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
The files to be understood and created are:&lt;br /&gt;
&lt;br /&gt;
1. app/models/menu_items.rb&lt;br /&gt;
&lt;br /&gt;
2. spec/models/menu_items_spec.rb&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
Students who collaborated to work on this problem statement are :&lt;br /&gt;
&lt;br /&gt;
1. Angad Singh Wadhwa (awadhwa3@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
2. Bhavuk Jain (bjain@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
== Plan Of Work ==&lt;br /&gt;
&lt;br /&gt;
The task in hand was to write test cases for testing the menu_items model file. No Rspec file for the corresponding model exists so there was a need to create a new file and build tests from scratch. &lt;br /&gt;
For this purposes different sub tasks involved&lt;br /&gt;
&lt;br /&gt;
1. Setting up the Expertiza environment &lt;br /&gt;
&lt;br /&gt;
2. Understand the functionality of model file in menu_items.rb &lt;br /&gt;
&lt;br /&gt;
3. Understand the linked data attributes being used, like controller_actions, content_page, permissions_id&lt;br /&gt;
&lt;br /&gt;
4. Creating dummy entries for testing different functionalities. &lt;br /&gt;
&lt;br /&gt;
5. Writing testing conditions for different functions and cross checking with the expected outputs.&lt;br /&gt;
&lt;br /&gt;
== Implementation Steps==&lt;br /&gt;
&lt;br /&gt;
=== Expertiza Environment Setup ===&lt;br /&gt;
We used the Ubuntu-Expertiza image to setup the environment.&lt;br /&gt;
We forked the master from Expertiza, clone and then run through the command terminal.&lt;br /&gt;
&lt;br /&gt;
cd/expetiza/app/models&lt;br /&gt;
&lt;br /&gt;
The menu_item.rb model file is present in this directory&lt;br /&gt;
&lt;br /&gt;
=== Functionality of Menu Items model ===&lt;br /&gt;
Menu Items is a model which gives the functionality to the top menu bar in the Expertiza website. It controls the display of drop down menus and its sub menus. It directs how these drop downs are displayed with regards to different users which have different permission attributes.&lt;br /&gt;
A super admin has the permission to edit the menu bar, by adding or deleting menu item blocks from it. Upon adding each item, he gets to position it either in the main menu bar or into different sub categories.&lt;br /&gt;
&lt;br /&gt;
====Parameters ====&lt;br /&gt;
Following are the parameters associated with the menu_item model: &lt;br /&gt;
&lt;br /&gt;
1. Name : This parameter gives the name to the menu item. &lt;br /&gt;
&lt;br /&gt;
2. Label : This parameter gives the label to the menu item. &lt;br /&gt;
&lt;br /&gt;
3. Parent id : It gives the id of the parent and establishes the hierarchy of the various objects of the menu item model. It can also be 'null' which means that it will be the base category. &lt;br /&gt;
&lt;br /&gt;
4. Sequence id : It gives the sequence numbering for determining the way the attributes are ordered within a parent. &lt;br /&gt;
&lt;br /&gt;
5. Controller action id : This parameter is associated with the direction in which the user is directed onto.&lt;br /&gt;
 &lt;br /&gt;
6. Content page id : This parameter is also associated with the direction in which the user is directed onto.&lt;br /&gt;
&lt;br /&gt;
====Methods====&lt;br /&gt;
&lt;br /&gt;
Different instance methods and class methods exist in this models . Brief description of each of them are : - &lt;br /&gt;
&lt;br /&gt;
1. find_or_create_by_name(params) : Class Method &lt;br /&gt;
This method finds or creates a new entry with the given name obtained in params. &lt;br /&gt;
&lt;br /&gt;
2. delete : Instance Method &lt;br /&gt;
This methods deletes the entry and all the child entries (entries having the same parent id) lined to it &lt;br /&gt;
&lt;br /&gt;
3. above : Instance Method &lt;br /&gt;
It returns the entry that is above a present sequence number for a given parent id &lt;br /&gt;
&lt;br /&gt;
4. below : Instance Method &lt;br /&gt;
It returns the entry that is below a present sequence number for a given parent id &lt;br /&gt;
&lt;br /&gt;
5. repack(repack_id) : Class Method &lt;br /&gt;
It modifies the sequence numbers, making them in order, removing the skip entries present in it. It is performed after certain sequences have been deleted. repack_id tells the parent id under which these changes are to be made&lt;br /&gt;
&lt;br /&gt;
6. next_seq(parent id) : Class Method&lt;br /&gt;
It returns the next possible sequence id corresponding to a given parent id entries. This function would be helpful if we wish to add a new entry and find out which sequence id is to be given to it. &lt;br /&gt;
&lt;br /&gt;
7. items_for_permission : Class Method&lt;br /&gt;
It returns the set of items that are possible to be displayed for a given permission id and also based on controller action id and page id being present for it.&lt;br /&gt;
&lt;br /&gt;
=== Test Entries Creation ===&lt;br /&gt;
Mock/dummy objects are needed to be created for any unit testing criteria.These objects are loaded freshly and deleted after every testing condition. &lt;br /&gt;
&lt;br /&gt;
Several methods exist for creating such a objects, whose parameters need to be designed to satisfy the conditions under test. Using 'factories' is one such method where few of the attributes are filled in with predefined values when an created. Here, for this specific case, we haven't used, factories method as, the number of attributes were limited in menu_items model and could be filled in completely with the required values each time. &lt;br /&gt;
&lt;br /&gt;
For testing menu_items, we created required entries into the database using &amp;quot;MenuItem.new()&amp;quot; method, giving different values for each of the test inputs to cover the required testing conditions.&lt;br /&gt;
&lt;br /&gt;
  before(:each) do&lt;br /&gt;
    @test1 = MenuItem.new(name: &amp;quot;home1&amp;quot;, parent_id: nil, seq: 1, controller_action_id: nil, content_page_id: nil, label: &amp;quot;newlabel&amp;quot;)&lt;br /&gt;
    @test1.save&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
The above is an example entry used for creating objects. 6 such test objects were created with entries giving combinations of parent_id and sequence numbers. &lt;br /&gt;
&lt;br /&gt;
Before each test, all the objects are created, which is done using &amp;quot;before(:each)&amp;quot; key word.&lt;br /&gt;
Also several objects of 'ControllerAction' and 'ContentPage' had to be created for testing one of the methods which acted based on those values.&lt;br /&gt;
&lt;br /&gt;
=== Testing Conditions ===&lt;br /&gt;
A total of 16 testing conditions were required to be performed for testing all the functions in menu items model file.&lt;br /&gt;
&lt;br /&gt;
The conditions that needed to be tested are as below:&lt;br /&gt;
&lt;br /&gt;
1. .find_or_create_by_name:&lt;br /&gt;
&lt;br /&gt;
 In this we had write unit test cases to test if the method returned a menu_item corresponding to a name.&lt;br /&gt;
 Here we expect that if the method find_or_create_by_name() is passed the parameter &amp;quot;home&amp;quot;, then it should return a value equal to &amp;quot;home&amp;quot;&lt;br /&gt;
&lt;br /&gt;
2. #delete:&lt;br /&gt;
&lt;br /&gt;
 In this test cases were written to check if the method deletes current menu items and all child menu items.&lt;br /&gt;
 In this case, if the parent menu item is deleted, all its child record should should be deleted.&lt;br /&gt;
 For our specific case, the parent and its 3 child menu_items are expected to be deleted.&lt;br /&gt;
&lt;br /&gt;
3. #above:&lt;br /&gt;
&lt;br /&gt;
Test cases were written to check if the below conditions are satisfied:&lt;br /&gt;
&lt;br /&gt;
 3.1 &amp;quot;When current menu item has parent_id, the method returns the first parent menu item by querying the parent_id and current sequence number minus one&amp;quot;.&lt;br /&gt;
      Here we expect that if we invoke the method above() on the active record test4, the method should return a value equal to the active record test3.&lt;br /&gt;
&lt;br /&gt;
 3.2 &amp;quot;When current menu item does not have parent_id, the method returns the first parent menu item by querying the current sequence number minus one&amp;quot;.&lt;br /&gt;
      Here we expect that if we invoke the method above() on the active record test5, the method should return a value equal to the active record test1.&lt;br /&gt;
&lt;br /&gt;
4. #below:&lt;br /&gt;
&lt;br /&gt;
Test cases were written to check if the below conditions are satisfied:&lt;br /&gt;
&lt;br /&gt;
 4.1 &amp;quot;When current menu item has parent_id,the method returns the first parent menu item by querying the parent_id and current sequence number plus one&amp;quot;.&lt;br /&gt;
      Here we expect that if we invoke the method below() on the active record test3, the method should return a value equal to the active record test4&lt;br /&gt;
      &lt;br /&gt;
 4.2 &amp;quot;When current menu item does not have parent_id, the method returns the first parent menu item by querying the current sequence number plus one&amp;quot;.&lt;br /&gt;
      Here we expect that if we invoke the method below() on the active record test1, the method should return a value equal to the active record test5.&lt;br /&gt;
&lt;br /&gt;
5. .repack:&lt;br /&gt;
&lt;br /&gt;
Test cases were written to check if the below conditions are satisfied:&lt;br /&gt;
&lt;br /&gt;
 5.1 &amp;quot;When current menu item has repack_id, the method finds all menus items with parent_id equal to repack_id and repacks the sequence number&amp;quot;.&lt;br /&gt;
      Here we expect that if the method repack() is invoked on the MenuItem and passed the value 1, &lt;br /&gt;
      then, it will repack the sequence ids and returns the list of repacked seq_ids.&lt;br /&gt;
 5.2 &amp;quot;When current menu item does not have repack_id, the method finds all menus items with parent_id null and repacks the sequence number&amp;quot;.&lt;br /&gt;
      Here we expect that if the method repack() is invoked on the MenuItem and passed the value Null, &lt;br /&gt;
      it will match all the values with parent_id = Null and returns the list of repacked seq_ids.&lt;br /&gt;
&lt;br /&gt;
6. .next_seq:&lt;br /&gt;
&lt;br /&gt;
Test cases were written to check if the below conditions are satisfied:&lt;br /&gt;
&lt;br /&gt;
 6.1 &amp;quot;When parent_id is bigger than 0, the method selects corresponding menu items with inputted parent_id and returns the next sequence number&amp;quot;.&lt;br /&gt;
      Here we expect that if we invoke the method next_seq() on the MenuItem and pass the value 1, the method should return a value equal to 5.&lt;br /&gt;
      &lt;br /&gt;
 6.2 &amp;quot;When parent_id is smaller than or equal to 0, the method selects corresponding menu items with parent_id null and returns the next sequence number&amp;quot;.&lt;br /&gt;
      Here we expect that if we invoke the method next_seq() on the MenuItem and pass the value nil, the method should return a value equal to 6.&lt;br /&gt;
&lt;br /&gt;
7. .items_for_permissions:&lt;br /&gt;
&lt;br /&gt;
Test cases were written to check if the below conditions are satisfied:&lt;br /&gt;
&lt;br /&gt;
 7.1 &amp;quot;When inputted variable (permission_ids) is nil and when the controller_action_id of current item is bigger than 0 and when perms does not exist, &lt;br /&gt;
     the method returns the corresponding items&amp;quot;.&lt;br /&gt;
     Here we expect that if the method items_for_permissions() is invoked on the MenuItems, &lt;br /&gt;
     then the method should return a list of active_records which satisfy the condition.&lt;br /&gt;
 7.2 &amp;quot;When the controller_action_id of current item is smaller than or equal to 0 and the content_page_id of current item is bigger than 0 and when perms does not exist, &lt;br /&gt;
     the method returns the corresponding items&amp;quot;.&lt;br /&gt;
     Here we expect that if the method items_for_permissions() is invoked on the MenuItems, &lt;br /&gt;
     then the method should return a list of active_records which satisfy the condition.&lt;br /&gt;
 7.3 &amp;quot;When the controller_action_id and content_page_id of current item is smaller than or equal to 0, &lt;br /&gt;
     the method returns the corresponding items&amp;quot;.&lt;br /&gt;
     Here we expect that if the method items_for_permissions() is invoked on the MenuItems, &lt;br /&gt;
     the method should return an empty list.&lt;br /&gt;
 7.4 &amp;quot;When inputted variable (permission_ids) is not nil and when the controller_action_id of current item is bigger than 0 and when perms exists, &lt;br /&gt;
     the method returns the corresponding items&amp;quot;.&lt;br /&gt;
     Here we expect that if the method items_for_permissions() is invoked on the MenuItems and passed the value 1 as parameter, &lt;br /&gt;
     then the method should return a list of active_records &lt;br /&gt;
     which satisfy the condition.&lt;br /&gt;
 7.5 &amp;quot;When the controller_action_id of current item is smaller than or equal to 0 and the content_page_id of current item is bigger than 0, and when perms exists, &lt;br /&gt;
     the method returns corresponding items.&amp;quot;&lt;br /&gt;
     Here we expect that if the method items_for_permissions() is invoked on the MenuItems and passed the value 1 as parameter, &lt;br /&gt;
     then the method should return a list of active_records which satisfy the condition.&lt;br /&gt;
 7.6 &amp;quot;When the controller_action_id and content_page_id of current item is smaller than or equal to 0, &lt;br /&gt;
     the method returns the corresponding items.&amp;quot;&lt;br /&gt;
     Here we expect that if the method items_for_permissions() is invoked on the MenuItems and passed the value 1 as a parameter, &lt;br /&gt;
     the method should return an empty list.&lt;br /&gt;
&lt;br /&gt;
== Conclusion and Learning Outcomes ==&lt;br /&gt;
&lt;br /&gt;
After writing the test cases we used SimpleCov to measure the C0 coverage of our rails application.&lt;br /&gt;
In our case we did not have to install SimpleCov explicitly since it was already installed earlier.&lt;br /&gt;
After running rake spec to run the test cases, SimpleCov creates a directory called coverage in our rails application folder.&lt;br /&gt;
This folder called coverage contains an index.html file which when opened in a browser renders an html page which gives the C0 coverage of each of the files in the Controllers,Models,Helpers in the app directory.&lt;br /&gt;
For our case, the C0 coverage of the menu_items.rb file in the Models folder increased from &amp;lt;&amp;gt; to &amp;lt;&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The learning outcomes after performing this project can be summarized in the following points:&lt;br /&gt;
&lt;br /&gt;
1. We got an hands on experience about how to write tests following the Test Driven Development approach.&lt;br /&gt;
&lt;br /&gt;
2. We learned about how to write units tests for models and controllers in RSpec.&lt;br /&gt;
&lt;br /&gt;
3. We also learned how to understand the functionality of an already developed application.For our case, before writing the test cases for the menu_items.rb we had the understand how different models interacted with each other and how each action by different users would make changes in the database schema.&lt;br /&gt;
&lt;br /&gt;
4. We also gained a better understanding about how different tables, columns of a large applications in structured in the database schema.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/sandeep993/expertiza/tree/menu_item_branch GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;/div&gt;</summary>
		<author><name>Bjain</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2018_E1813_Menu_item_tests&amp;diff=115390</id>
		<title>CSC/ECE 517 Spring 2018 E1813 Menu item tests</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2018_E1813_Menu_item_tests&amp;diff=115390"/>
		<updated>2018-03-27T03:16:27Z</updated>

		<summary type="html">&lt;p&gt;Bjain: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page corresponds to the OSS Project for CSE/ECE 517 (Spring 2018) E1813 Write unit tests for menu_item.rb&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
===Expertiza===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source web application based on [http://rubyonrails.org/ Ruby on Rails] framework,  supported by the National Science Foundation. &lt;br /&gt;
It is a place where students can submit and peer-review learning objects (assignments, codes, write ups, websites, etc). For an instructor, expertiza allows to create and customize new or existing assignments. For students, it allows to create and work on various projects and assignments. It provides a platform to peer review other students' submissions across various document types, including the URLs and wiki pages.&lt;br /&gt;
===Behavior Driven-Development===&lt;br /&gt;
In software engineering, behavior-driven development (BDD) is a software development process that emerged from test-driven development (TDD). Behavior-driven development combines the general techniques and principles of TDD with ideas from domain-driven design and object-oriented analysis and design to provide software development and management teams with shared tools and a shared process to collaborate on software development.&lt;br /&gt;
&lt;br /&gt;
BDD focuses on:&lt;br /&gt;
&lt;br /&gt;
Where to start in the process&lt;br /&gt;
What to test and what not to test&lt;br /&gt;
How much to test in one go&lt;br /&gt;
What to call the tests&lt;br /&gt;
How to understand why a test fails&lt;br /&gt;
&lt;br /&gt;
Test-driven development is a software development methodology which essentially states that for each unit of software, a software developer must:&lt;br /&gt;
&lt;br /&gt;
Define a test set for the unit first;&lt;br /&gt;
Make the tests fail;&lt;br /&gt;
Then implement the unit;&lt;br /&gt;
Finally, verify that the implementation of the unit makes the tests succeed.&lt;br /&gt;
This definition is rather non-specific in that it allows tests in terms of high-level software requirements, low-level technical details or anything in between. One way of looking at BDD therefore, is that it is a continued development of TDD which makes more specific choices than TDD.&lt;br /&gt;
&lt;br /&gt;
===Unit Testing===&lt;br /&gt;
In computer programming, [https://en.wikipedia.org/wiki/Unit_testing Unit Testing] is a software testing method by which individual units of source code, sets of one or more computer program modules together with associated control data, usage procedures, and operating procedures, are tested to determine whether they are fit for use. Ideally, each test case is independent from the others. Substitutes such as method stubs, mock objects, fakes, and test harnesses can be used to assist testing a module in isolation.&lt;br /&gt;
&lt;br /&gt;
Some of the advantages of unit testing are:&lt;br /&gt;
&lt;br /&gt;
1. Finds problems early:&lt;br /&gt;
&lt;br /&gt;
Unit testing finds problems early in the development cycle. This includes both bugs in the programmer's implementation and flaws or missing parts of the specification for the unit.&lt;br /&gt;
In test-driven development (TDD), which is frequently used in both extreme programming and scrum, unit tests are created before the code itself is written. When the tests pass, that code is considered complete.&lt;br /&gt;
&lt;br /&gt;
2. Facilitates change:&lt;br /&gt;
&lt;br /&gt;
Unit testing allows the programmer to refactor code or upgrade system libraries at a later date, and make sure the module still works correctly (e.g., in regression testing). The procedure is to write test cases for all functions and methods so that whenever a change causes a fault, it can be quickly identified. Unit tests detect changes which may break a design contract.&lt;br /&gt;
&lt;br /&gt;
3. Simplifies Integration:&lt;br /&gt;
&lt;br /&gt;
Unit testing may reduce uncertainty in the units themselves and can be used in a bottom-up testing style approach. By testing the parts of a program first and then testing the sum of its parts, integration testing becomes much easier.&lt;br /&gt;
&lt;br /&gt;
4. Documentation:&lt;br /&gt;
&lt;br /&gt;
Developers looking to learn what functionality is provided by a unit, and how to use it, can look at the unit tests to gain a basic understanding of the unit's interface's API.&lt;br /&gt;
&lt;br /&gt;
5. Design:&lt;br /&gt;
&lt;br /&gt;
When software is developed using a test-driven approach, the combination of writing the unit test to specify the interface plus the refactoring activities performed after the test is passing, may take the place of formal design. Each unit test can be seen as a design element specifying classes, methods, and observable behavior.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
&lt;br /&gt;
This project is to write unit tests using rspec for menu_items.rb model. The unit tests are to be written to make the path coverage of menu_item.rb more than 90% and achieve the highest possible branch coverage.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
The files to be understood and created are:&lt;br /&gt;
&lt;br /&gt;
1. app/models/menu_items.rb&lt;br /&gt;
&lt;br /&gt;
2. spec/models/menu_items_spec.rb&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
Students who collaborated to work on this problem statement are :&lt;br /&gt;
&lt;br /&gt;
1. Angad Singh Wadhwa (awadhwa3@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
2. Bhavuk Jain (bjain@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
== Plan Of Work ==&lt;br /&gt;
&lt;br /&gt;
The task in hand was to write test cases for testing the menu_items model file. No Rspec file for the corresponding model exists so there was a need to create a new file and build tests from scratch. &lt;br /&gt;
For this purposes different sub tasks involved&lt;br /&gt;
&lt;br /&gt;
1. Setting up the Expertiza environment &lt;br /&gt;
&lt;br /&gt;
2. Understand the functionality of model file in menu_items.rb &lt;br /&gt;
&lt;br /&gt;
3. Understand the linked data attributes being used, like controller_actions, content_page, permissions_id&lt;br /&gt;
&lt;br /&gt;
4. Creating dummy entries for testing different functionalities. &lt;br /&gt;
&lt;br /&gt;
5. Writing testing conditions for different functions and cross checking with the expected outputs.&lt;br /&gt;
&lt;br /&gt;
== Implementation Steps==&lt;br /&gt;
&lt;br /&gt;
=== Expertiza Environment Setup ===&lt;br /&gt;
We used the Ubuntu-Expertiza image to setup the environment.&lt;br /&gt;
We forked the master from Expertiza, clone and then run through the command terminal.&lt;br /&gt;
&lt;br /&gt;
cd/expetiza/app/models&lt;br /&gt;
&lt;br /&gt;
The menu_item.rb model file is present in this directory&lt;br /&gt;
&lt;br /&gt;
=== Functionality of Menu Items model ===&lt;br /&gt;
Menu Items is a model which gives the functionality to the top menu bar in the Expertiza website. It controls the display of drop down menus and its sub menus. It directs how these drop downs are displayed with regards to different users which have different permission attributes.&lt;br /&gt;
A super admin has the permission to edit the menu bar, by adding or deleting menu item blocks from it. Upon adding each item, he gets to position it either in the main menu bar or into different sub categories.&lt;br /&gt;
&lt;br /&gt;
====Parameters ====&lt;br /&gt;
Following are the parameters associated with the menu_item model: &lt;br /&gt;
&lt;br /&gt;
1. Name : This parameter gives the name to the menu item. &lt;br /&gt;
2. Label : This parameter gives the label to the menu item &lt;br /&gt;
3. Parent id : It gives the id of the parent and establishes the hierarchy of the various objects of the menu item model. It can also be 'null' which means that it will be the base category. &lt;br /&gt;
4. Sequence id : It gives the sequence numbering for determining the way the attributes are ordered within a parent. &lt;br /&gt;
5. Controller action id :  &lt;br /&gt;
6. Content page id :- These attributes tell, to which direction/ page, this selection directs the user onto.&lt;br /&gt;
&lt;br /&gt;
====Methods====&lt;br /&gt;
&lt;br /&gt;
Different instance methods and class methods exist in this models . Brief description of each of them are : - &lt;br /&gt;
&lt;br /&gt;
1. find_or_create_by_name(params) :- Class Method &lt;br /&gt;
This method finds or creates a new entry with the given name obtained in params &lt;br /&gt;
&lt;br /&gt;
2. delete :- Instance Method &lt;br /&gt;
This methods deletes the entry and all the child entries ( entries having the same parent id ) lined to it &lt;br /&gt;
&lt;br /&gt;
3. above :- Instance Method &lt;br /&gt;
It returns the entry that is above a present sequence number for a given parent id &lt;br /&gt;
&lt;br /&gt;
4. below :- Instance Method &lt;br /&gt;
It returns the entry that is below a present sequence number for a given parent id &lt;br /&gt;
&lt;br /&gt;
5. repack(repack_id) :- Class Method &lt;br /&gt;
It modifies the sequence numbers, making them in order, removing the skip entries present in it. It is performed after certain sequences have been deleted. repack_id tells the parent id under which these changes are to be made&lt;br /&gt;
&lt;br /&gt;
6. next_seq(parent id) :- Class Method&lt;br /&gt;
It returns the next possible sequence id corresponding to a given parent id entries. This function would be helpful if we wish to add a new entry and find out which sequence id is to be given to it. &lt;br /&gt;
&lt;br /&gt;
7. items_for_permission :- Class Method&lt;br /&gt;
It returns the set of items that are possible to be displayed for a given permission id and also based on controller action id and page id being present for it.&lt;br /&gt;
&lt;br /&gt;
=== Test Entries Creation ===&lt;br /&gt;
Mock/dummy objects are needed to be created for any unit testing criteria.These objects are loaded freshly and deleted after every testing condition. &lt;br /&gt;
&lt;br /&gt;
Several methods exist for creating such a objects, whose parameters need to be designed to satisfy the conditions under test. Using 'factories' is one such method where few of the attributes are filled in with predefined values when an created. Here, for this specific case, we haven't used, factories method as, the number of attributes were limited in menu_items model and could be filled in completely with the required values each time. &lt;br /&gt;
&lt;br /&gt;
For testing menu_items, we created required entries into the database using &amp;quot;MenuItem.new()&amp;quot; method, giving different values for each of the test inputs to cover the required testing conditions.&lt;br /&gt;
&lt;br /&gt;
  before(:each) do&lt;br /&gt;
    @test1 = MenuItem.new(name: &amp;quot;home1&amp;quot;, parent_id: nil, seq: 1, controller_action_id: nil, content_page_id: nil, label: &amp;quot;newlabel&amp;quot;)&lt;br /&gt;
    @test1.save&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
The above is an example entry used for creating objects. 6 such test objects were created with entries giving combinations of parent_id and sequence numbers. &lt;br /&gt;
&lt;br /&gt;
Before each test, all the objects are created, which is done using &amp;quot;before(:each)&amp;quot; key word.&lt;br /&gt;
Also several objects of 'ControllerAction' and 'ContentPage' had to be created for testing one of the methods which acted based on those values.&lt;br /&gt;
&lt;br /&gt;
=== Testing Conditions ===&lt;br /&gt;
A total of 16 testing conditions were required to be performed for testing all the functions in menu items model file.&lt;br /&gt;
&lt;br /&gt;
The conditions that needed to be tested are as below:&lt;br /&gt;
&lt;br /&gt;
1. .find_or_create_by_name:&lt;br /&gt;
&lt;br /&gt;
 In this we had write unit test cases to test if the method returned a menu_item corresponding to a name.&lt;br /&gt;
 Here we expect that if the method find_or_create_by_name() is passed the parameter &amp;quot;home&amp;quot;, then it should return a value equal to &amp;quot;home&amp;quot;&lt;br /&gt;
&lt;br /&gt;
2. #delete:&lt;br /&gt;
&lt;br /&gt;
 In this test cases were written to check if the method deletes current menu items and all child menu items.&lt;br /&gt;
 In this case, if the parent menu item is deleted, all its child record should should be deleted.&lt;br /&gt;
 For our specific case, the parent and its 3 child menu_items are expected to be deleted.&lt;br /&gt;
&lt;br /&gt;
3. #above:&lt;br /&gt;
&lt;br /&gt;
Test cases were written to check if the below conditions are satisfied:&lt;br /&gt;
&lt;br /&gt;
 3.1 &amp;quot;When current menu item has parent_id, the method returns the first parent menu item by querying the parent_id and current sequence number minus one&amp;quot;.&lt;br /&gt;
      Here we expect that if we invoke the method above() on the active record test4, the method should return a value equal to the active record test3.&lt;br /&gt;
&lt;br /&gt;
 3.2 &amp;quot;When current menu item does not have parent_id, the method returns the first parent menu item by querying the current sequence number minus one&amp;quot;.&lt;br /&gt;
      Here we expect that if we invoke the method above() on the active record test5, the method should return a value equal to the active record test1.&lt;br /&gt;
&lt;br /&gt;
4. #below:&lt;br /&gt;
&lt;br /&gt;
Test cases were written to check if the below conditions are satisfied:&lt;br /&gt;
&lt;br /&gt;
 4.1 &amp;quot;When current menu item has parent_id,the method returns the first parent menu item by querying the parent_id and current sequence number plus one&amp;quot;.&lt;br /&gt;
      Here we expect that if we invoke the method below() on the active record test3, the method should return a value equal to the active record test4&lt;br /&gt;
      &lt;br /&gt;
 4.2 &amp;quot;When current menu item does not have parent_id, the method returns the first parent menu item by querying the current sequence number plus one&amp;quot;.&lt;br /&gt;
      Here we expect that if we invoke the method below() on the active record test1, the method should return a value equal to the active record test5.&lt;br /&gt;
&lt;br /&gt;
5. .repack:&lt;br /&gt;
&lt;br /&gt;
Test cases were written to check if the below conditions are satisfied:&lt;br /&gt;
&lt;br /&gt;
 5.1 &amp;quot;When current menu item has repack_id, the method finds all menus items with parent_id equal to repack_id and repacks the sequence number&amp;quot;.&lt;br /&gt;
      Here we expect that if the method repack() is invoked on the MenuItem and passed the value 1, &lt;br /&gt;
      then, it will repack the sequence ids and returns the list of repacked seq_ids.&lt;br /&gt;
 5.2 &amp;quot;When current menu item does not have repack_id, the method finds all menus items with parent_id null and repacks the sequence number&amp;quot;.&lt;br /&gt;
      Here we expect that if the method repack() is invoked on the MenuItem and passed the value Null, &lt;br /&gt;
      it will match all the values with parent_id = Null and returns the list of repacked seq_ids.&lt;br /&gt;
&lt;br /&gt;
6. .next_seq:&lt;br /&gt;
&lt;br /&gt;
Test cases were written to check if the below conditions are satisfied:&lt;br /&gt;
&lt;br /&gt;
 6.1 &amp;quot;When parent_id is bigger than 0, the method selects corresponding menu items with inputted parent_id and returns the next sequence number&amp;quot;.&lt;br /&gt;
      Here we expect that if we invoke the method next_seq() on the MenuItem and pass the value 1, the method should return a value equal to 5.&lt;br /&gt;
      &lt;br /&gt;
 6.2 &amp;quot;When parent_id is smaller than or equal to 0, the method selects corresponding menu items with parent_id null and returns the next sequence number&amp;quot;.&lt;br /&gt;
      Here we expect that if we invoke the method next_seq() on the MenuItem and pass the value nil, the method should return a value equal to 6.&lt;br /&gt;
&lt;br /&gt;
7. .items_for_permissions:&lt;br /&gt;
&lt;br /&gt;
Test cases were written to check if the below conditions are satisfied:&lt;br /&gt;
&lt;br /&gt;
 7.1 &amp;quot;When inputted variable (permission_ids) is nil and when the controller_action_id of current item is bigger than 0 and when perms does not exist, &lt;br /&gt;
     the method returns the corresponding items&amp;quot;.&lt;br /&gt;
     Here we expect that if the method items_for_permissions() is invoked on the MenuItems, &lt;br /&gt;
     then the method should return a list of active_records which satisfy the condition.&lt;br /&gt;
 7.2 &amp;quot;When the controller_action_id of current item is smaller than or equal to 0 and the content_page_id of current item is bigger than 0 and when perms does not exist, &lt;br /&gt;
     the method returns the corresponding items&amp;quot;.&lt;br /&gt;
     Here we expect that if the method items_for_permissions() is invoked on the MenuItems, &lt;br /&gt;
     then the method should return a list of active_records which satisfy the condition.&lt;br /&gt;
 7.3 &amp;quot;When the controller_action_id and content_page_id of current item is smaller than or equal to 0, &lt;br /&gt;
     the method returns the corresponding items&amp;quot;.&lt;br /&gt;
     Here we expect that if the method items_for_permissions() is invoked on the MenuItems, &lt;br /&gt;
     the method should return an empty list.&lt;br /&gt;
 7.4 &amp;quot;When inputted variable (permission_ids) is not nil and when the controller_action_id of current item is bigger than 0 and when perms exists, &lt;br /&gt;
     the method returns the corresponding items&amp;quot;.&lt;br /&gt;
     Here we expect that if the method items_for_permissions() is invoked on the MenuItems and passed the value 1 as parameter, &lt;br /&gt;
     then the method should return a list of active_records &lt;br /&gt;
     which satisfy the condition.&lt;br /&gt;
 7.5 &amp;quot;When the controller_action_id of current item is smaller than or equal to 0 and the content_page_id of current item is bigger than 0, and when perms exists, &lt;br /&gt;
     the method returns corresponding items.&amp;quot;&lt;br /&gt;
     Here we expect that if the method items_for_permissions() is invoked on the MenuItems and passed the value 1 as parameter, &lt;br /&gt;
     then the method should return a list of active_records which satisfy the condition.&lt;br /&gt;
 7.6 &amp;quot;When the controller_action_id and content_page_id of current item is smaller than or equal to 0, &lt;br /&gt;
     the method returns the corresponding items.&amp;quot;&lt;br /&gt;
     Here we expect that if the method items_for_permissions() is invoked on the MenuItems and passed the value 1 as a parameter, &lt;br /&gt;
     the method should return an empty list.&lt;br /&gt;
&lt;br /&gt;
== Conclusion and Learning Outcomes ==&lt;br /&gt;
&lt;br /&gt;
After writing the test cases we used SimpleCov to measure the C0 coverage of our rails application.&lt;br /&gt;
In our case we did not have to install SimpleCov explicitly since it was already installed earlier.&lt;br /&gt;
After running rake spec to run the test cases, SimpleCov creates a directory called coverage in our rails application folder.&lt;br /&gt;
This folder called coverage contains an index.html file which when opened in a browser renders an html page which gives the C0 coverage of each of the files in the Controllers,Models,Helpers in the app directory.&lt;br /&gt;
For our case, the C0 coverage of the menu_items.rb file in the Models folder increased from &amp;lt;&amp;gt; to &amp;lt;&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The learning outcomes after performing this project can be summarized in the following points:&lt;br /&gt;
&lt;br /&gt;
1. We got an hands on experience about how to write tests following the Test Driven Development approach.&lt;br /&gt;
&lt;br /&gt;
2. We learned about how to write units tests for models and controllers in RSpec.&lt;br /&gt;
&lt;br /&gt;
3. We also learned how to understand the functionality of an already developed application.For our case, before writing the test cases for the menu_items.rb we had the understand how different models interacted with each other and how each action by different users would make changes in the database schema.&lt;br /&gt;
&lt;br /&gt;
4. We also gained a better understanding about how different tables, columns of a large applications in structured in the database schema.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/sandeep993/expertiza/tree/menu_item_branch GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;/div&gt;</summary>
		<author><name>Bjain</name></author>
	</entry>
</feed>