<?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=Ngtitov</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=Ngtitov"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Ngtitov"/>
	<updated>2026-07-14T01:54:11Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics&amp;diff=124573</id>
		<title>E1936 Specialized Rubrics</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics&amp;diff=124573"/>
		<updated>2019-04-26T22:16:07Z</updated>

		<summary type="html">&lt;p&gt;Ngtitov: /* Sequence Diagram */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page describes the work and goals that have been completed and achieved while implementing Expertiza Project &amp;quot;''E1936. Specialized Rubrics for Different Topic Types (e.g., Servo project, refactoring project)''&amp;quot; for the CSC/ECE 517 &amp;quot;Object-Oriented Design and Development&amp;quot; class, in the Spring semester of the 2019.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This Wiki page is created per CSC/ECE 517: &amp;quot;Object-Oriented Design and Development&amp;quot;, Expertiza Project requirements (Spring, 2019).&lt;br /&gt;
&lt;br /&gt;
Our [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Team team] was assigned the project &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936. Specialized rubrics for different topic types (e.g., Servo project, refactoring project)]&amp;quot;.  This is an Expertiza project.&lt;br /&gt;
&lt;br /&gt;
In this wiki page we describe the problem to be solved, how we solve that problem, and how we test our solution.  We also provide helpful links and contact information for our team.&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
In this section, we discuss the problem we need to solve, the Expertiza feature this problem is related to, what needs to be done to solve the problem (at a high level), and the previous attempt to solve this problem.&lt;br /&gt;
&lt;br /&gt;
=== Problem Statement ===&lt;br /&gt;
&lt;br /&gt;
This problem statement summarizes the problem as described in the project description &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936. Specialized rubrics for different topic types (e.g., Servo project, refactoring project)]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
In CSC/ECE 517, there are several types of topics that could be covered in a single class assignment.&lt;br /&gt;
* Code base&lt;br /&gt;
** Expertiza&lt;br /&gt;
** Mozilla&lt;br /&gt;
** etc.&lt;br /&gt;
* Goal&lt;br /&gt;
** Refactoring&lt;br /&gt;
** Testing&lt;br /&gt;
** etc.&lt;br /&gt;
However, currently we can only specify one kind of rubric for an assignment.  This means that teams working on different topics will be evaluated using the same rubric.  With this setup, it's not possible to fine-tune rubrics for different topics - rubrics tend to be overly general.&lt;br /&gt;
&lt;br /&gt;
=== Feature Description ===&lt;br /&gt;
&lt;br /&gt;
The Expertiza project already has a feature that allows rubrics to vary by project phase or &amp;quot;round&amp;quot;.  The feature we will add in this project is a feature to allow rubrics to vary not only by round, but also by topic.  This allows more flexibility to the instructor when setting up an assignment, so that they can use rubrics better suited to the tasks that students are performing in an assignment.&lt;br /&gt;
&lt;br /&gt;
When this feature is complete, the following scenarios will be possible, and the instructor will be the judge of which scenario is the best fit to the assignment:&lt;br /&gt;
&lt;br /&gt;
* Rubric does not vary by round or by topic.&lt;br /&gt;
* Rubric varies by round, but not by topic.&lt;br /&gt;
* Rubric varies by topic, but not by round.&lt;br /&gt;
* Rubric varies by both round and topic.&lt;br /&gt;
&lt;br /&gt;
=== What Needs to be Done ===&lt;br /&gt;
&lt;br /&gt;
This section summarizes the work as described in the project description &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936. Specialized rubrics for different topic types (e.g., Servo project, refactoring project)]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* In assignment#edit page &amp;quot;Rubrics&amp;quot; tab, add a checkbox to specify whether rubric should vary by topic.&lt;br /&gt;
* In assignment#edit page &amp;quot;Topics&amp;quot; tab, add dropdown(s) next to each topic to specify which rubric(s) are associated with the topic.&lt;br /&gt;
** The dropdown(s) should appear only if rubric should vary by topic, per the Rubrics tab.&lt;br /&gt;
** The topic should have a multiple dropdowns (one for each round) only if rubrics vary by round, per the Rubrics tab.&lt;br /&gt;
** By default, the rubric(s) for each course project will be the one(s) specified in “Rubrics” tab.&lt;br /&gt;
** The dropdown value can overwrite the default rubric.&lt;br /&gt;
* Be careful when making changes to the code&lt;br /&gt;
** The signup_sheet_controller should have as little to do as possible with the selection of rubrics.&lt;br /&gt;
** Anything not germane to selecting topics should be in another controller or (more probably) a helper.&lt;br /&gt;
* Create a DB migration to allow rubric to vary by topic as well as by round.&lt;br /&gt;
&lt;br /&gt;
==== Screenshots ====&lt;br /&gt;
'''Before: (Rubrics tab for an Assignment)'''&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Screenshot Assignment Edit Rubrics.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Before: (Topics tab for an Assignment)'''&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Screenshot Assignment Edit Topics.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''After: (Rubrics tab for an Assignment)'''&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Specialized Rubric checkbox after.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''After: (Topics tab for an Assignment)'''&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Specialized Rubrics dropdown after.png]]&lt;br /&gt;
&lt;br /&gt;
== Previous Work ==&lt;br /&gt;
&lt;br /&gt;
There was previous attempt to implement this project in the Fall of 2018 semester by different team, but it was rejected due to several reasons. As a result our team was assigned to complete this project with the given implementation. However, after detailed investigation of the proposed design that team has made in the previous semester and review of the code changes, we proposed different architectural solution for the problem, which we believe is simpler, more efficient, and elegant solution.&lt;br /&gt;
&lt;br /&gt;
=== Previous Project Implementation ===&lt;br /&gt;
&lt;br /&gt;
Our team was provided with all relevant information and materials about the design and implementation of the previously attempted project. We would like to acknowledge that we use previous implementation and design as reference and our starting point for our own implementation. The following is the list of links with the relevant materials that we have used for better project understanding, determining pros and cons of previously proposed changes, and establishing our design strategy and implementation:&lt;br /&gt;
&lt;br /&gt;
# [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1873_Specialized_rubics_for_different_topic_types Wiki]&lt;br /&gt;
# [https://github.com/expertiza/expertiza/pull/1327 Pull Request]&lt;br /&gt;
# [https://drive.google.com/file/d/1UrLb0Ula_Lb_F4MOrdC-s6xng6B08VYu/view Video Demo]&lt;br /&gt;
&lt;br /&gt;
After reviewing all relevant materials above, we concluded that the project implementation was incomplete and proposed design had significant flaw. &lt;br /&gt;
We identified main drawbacks and flaw as follows:&lt;br /&gt;
&lt;br /&gt;
* Establishing incorrect ''many-to-one'' relationship between ''sign_up_topics'' and ''questionnaires'' tables:&lt;br /&gt;
** Creating a DB migration to add ''questionnaire_id'' in the ''sign_up_topics'' table to store the dropdown data presumes ''one-to-one'' or ''many-to-one'' relationship between ''sign_up_topics'' and ''questionnaires'' tables&lt;br /&gt;
** Correct relationship between ''sign_up_topics'' and ''questionnaires'' tables is ''many-to-many''. For example, each project topic may have various rubrics depending on the round it is used (e.g., for round 1, topic may have one rubric; but for round 2, the same topic may have different rubric)&lt;br /&gt;
** Proposed previous migration changes would break DB design and would not allow to store correctly topic and its associated rubric per different round.&lt;br /&gt;
* Per project requirement specifications, &amp;quot;''The dropdown box should appear only if 'Vary rubric by topic' is selected in the Rubrics tab.''&amp;quot; This requirement was not met and ''Vary rubric by topic'' checkbox in the Rubrics tab was not implemented. Therefore, dropdown box with the list of rubrics appears regardless of whether &amp;quot;''Vary rubric by topic''&amp;quot; is selected or not.&lt;br /&gt;
* The dropdown box includes the list of all possible rubrics including default value. However, this condition can be improved. The dropdown box should list the rubrics that were created by the current user (professor who is logged in). This would allow to shorten the list of possible rubrics dramatically and help to avoid any misunderstanding and confusion while user selects desired rubric for the course project.&lt;br /&gt;
&lt;br /&gt;
We found no further issues with the rest implementation and in other project materials. Wiki page is very useful for understanding design of proposed changes, finding drawbacks and the flaw. Considering all the pros and cons, and taking into account drawbacks of the proposed changes, our team evolved different approach that should successfully solve the problem stated for the project without without creating additional issues. Please see our [http://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics#Project_Implementation Project Implementation] for more details.&lt;br /&gt;
&lt;br /&gt;
=== Previous Project Requirements ===&lt;br /&gt;
&lt;br /&gt;
The project requirements originally specified how to alter the databases to support varying rubrics by topic.&lt;br /&gt;
&lt;br /&gt;
''Create a new table named topic_questionnaires with field:''&lt;br /&gt;
* ''id''&lt;br /&gt;
* ''topic_id''&lt;br /&gt;
* ''questionnaire_id''&lt;br /&gt;
* ''used_in_round''&lt;br /&gt;
&lt;br /&gt;
However, the E1936 team successfully petitioned for this requirement to change to give us more freedom in the implementation.  The original suggestion had a flaw.  There is already an existing table in the Expertiza project called ''assignment_questionnaires'', which has columns including ''assignment_id'', ''questionnaire_id'', and ''used_in_round''.  It is this table that maintains the knowledge of which rubric is used in which round of an assignment.  If we were to add a new table to maintains the knowledge of which rubric is used in which topic of an assignment as originally suggested, then we would have a big problem.  Knowledge of round-rubric relationship is duplicated.  This would lead (best case scenario) to extra work, and (worst case scenario) to lots of bugs caused by inconsistencies in how these tables are handled with CRUD operations throughout the code.  In other words, this is not a DRY solution.&lt;br /&gt;
&lt;br /&gt;
== Project Implementation ==&lt;br /&gt;
&lt;br /&gt;
In this section, we propose our solution to the problem with the set of UML diagrams, discuss implementation techniques and details, and list the goals we achieved.&lt;br /&gt;
&lt;br /&gt;
We start by proposing our solution to the problem utilizing UML diagrams that include Use case, Entity Relationship, Class, and Sequence diagrams! Further, we discuss design strategy by breaking project problem into multiple staged sub-problems and provide solutions for each of these sub-problems. We also discuss some design strategies in the form of problem - solution, and provide the list of involved files. To illustrate implementation details for different tasks we decided to include selected (only) modified code where pseudocode-like solution is provided for each major task in this project. Finally, since we received some common questions and misunderstanding during first peer review period, we include Q/A section, where we provide an answer to each common question and concern we received.&lt;br /&gt;
&lt;br /&gt;
=== UML Diagrams ===&lt;br /&gt;
&lt;br /&gt;
Our solution and implementation of the project can be easily shown by discussing Use Case, Entity Relationship, and Class diagrams. First, for simplicity we discuss in general possible sequence of interactions between a user (in this case instructor) and the system (Expertiza) via presenting Use Case Diagram. Then we plan to show proposed database modification via Entity Relationship Diagram. At this point the high-level design and proposed changes should be clear. To make our design more concrete and dive into implementation level, we decided to provide UML Class diagram. Finally, to demonstrate our achievements, we complete this section with the UML Sequence diagram to illustrate interactive behavior of a system with utilized specialized rubrics feature.&lt;br /&gt;
&lt;br /&gt;
==== Use Case Diagram ====&lt;br /&gt;
&lt;br /&gt;
[[File: use_case_diagram_1936.png]]&lt;br /&gt;
&lt;br /&gt;
The above Use Case Diagram shows general sequence of interactions between an instructor and the system (Expertiza) that defines where and how the feature can be utilized. Note that highlighted use cases are objects of our interest and work. Also please note that all of the shown use cases already exist in the system and we simply added a new feature into the system with existing use cases. Particularly, the rubric for each assignment and newly added ''Review rubric varies by topic'' checkbox with which instructor may choose to vary assignment by topic or not, by checking and unchecking the checkbox is displayed in the ''Rubrics'' tab. Hence, we show how instructor can get to the ''Rubrics'' tab of the assignments. Similarly, ''Topics'' tab of assignments has additional ''Questionnaires'' column for each topic, where instructor may specify which rubric associates with which topic. To perform this sequence of interactions and utilize the new feature, instructor must choose ''Edit'' any assignment from the list of all assignments displayed to him/her in the ''Manage Assignments'' page, which can be navigated by instructor by selecting it from the header of the system.&lt;br /&gt;
&lt;br /&gt;
==== Entity Relationship Diagram ====&lt;br /&gt;
&lt;br /&gt;
[[File: HW04_ERD_Closed_Arrow.png]]&lt;br /&gt;
&lt;br /&gt;
The sections of the diagram highlighted in yellow show newly introduced items.  That is, we are adding a new column called ''topic_id'' to ''assignment_questionnaires'', in order to link ''assignment_questionnaires'' to ''sign_up_topics''.&lt;br /&gt;
&lt;br /&gt;
Any assignment, topic, or questionnaire may be represented by multiple records within ''assignment_questionnaires'', but each record within ''assignment_questionnaires'' refers to just one assignment, topic, or questionnaire.  It is the ability to have an assignment represented by multiple records, and the new relationship to ''sign_up_topics'', that allows us to support all of the required scenarios:&lt;br /&gt;
&lt;br /&gt;
* Rubric does not vary by round or by topic.&lt;br /&gt;
* Rubric varies by round, but not by topic.&lt;br /&gt;
* Rubric varies by topic, but not by round.&lt;br /&gt;
* Rubric varies by both round and topic.&lt;br /&gt;
&lt;br /&gt;
[[File: HW04_table.PNG]]&lt;br /&gt;
&lt;br /&gt;
This table illustrates the possibilities that the system may have.&lt;br /&gt;
&lt;br /&gt;
* Assignment 1 does not vary by round or by topic.&lt;br /&gt;
* Assignment 2 varies by round, but not by topic.&lt;br /&gt;
* Assignment 3 varies by topic, but not by round.&lt;br /&gt;
* Assignment 4 varies by both round and topic.&lt;br /&gt;
&lt;br /&gt;
This change is done via database migration by running the following commands:&lt;br /&gt;
&lt;br /&gt;
  rails generate migration AddTopicIdToAssignmentQuestionnaires&lt;br /&gt;
&lt;br /&gt;
Above command adds the ''topic_id'' column to the ''AssignmentQuestionnaires'' table and generates new migration file:&lt;br /&gt;
&lt;br /&gt;
[[File: db_migration.png]]&lt;br /&gt;
&lt;br /&gt;
To see the details of the entire database change please check this [https://github.com/gabalmat/expertiza/commit/d46dd57d35a21ab43efb82c28d3f14b75c695f2e commit].&lt;br /&gt;
&lt;br /&gt;
==== Class Diagram ====&lt;br /&gt;
&lt;br /&gt;
[[File: class_diagram_1936.png]]&lt;br /&gt;
&lt;br /&gt;
The above UML Class diagram describes the changes our team made in the Ruby classes, methods and attributes. Please note that all provided classes in the diagram had already existed in the system, and we only added new relationship, modified existing methods (and some method signatures) and utilized given attributes. All of the class's attributes and methods that are shown in the diagram are utilized (directly and indirectly) in our current implementation. Some of the methods and attributes provided within the classes in the diagram are newly developed. There is only one newly added aggregation relationship between the ''SingUpTopic'' class and ''AssignmentQuestionnaire'' class. Moreover, controllers and models for the certain classes were combined into a single class for simplicity to the design description. In reality, half of the methods shown in  the ''Assignment'' class are implemented in the ''app/controllers/assignments_controller.rb'' file and other half is in the ''app/models/assignment.rb'' file. We decided to combine all of the functionalities of each ''relevant'' controller and model class into single class for the ease of design presentation and interpretation. We used Sequence diagram below to illustrate how MVC architectural pattern is used for a given classes.&lt;br /&gt;
&lt;br /&gt;
==== Sequence Diagram ====&lt;br /&gt;
&lt;br /&gt;
Below we provide UML Sequence diagram to illustrate the interactive behavior of a system utilizing the specialized rubric feature that we implemented. ''Note'' that the following UML Sequence Diagram still is considered to be a high-level diagram and it displays the behavior of the system that we observed while debugging and implementing our code. By presenting the following sequence diagram, we do not make a claim that this is how Expertiza works, we simply documented our observations and want to share it with the teaching staff and fellow students. It is possible that we could have missed something or incorrectly interpreted the source code, but this diagram is the best of our knowledge. We hope that this would be useful for the teams working on similar projects in the future!  &lt;br /&gt;
&lt;br /&gt;
[[File: sequence_diagram_1936.png]]&lt;br /&gt;
&lt;br /&gt;
=== Design Strategy ===&lt;br /&gt;
&lt;br /&gt;
As we have concrete understanding of the problem and proposed solution, we would like break this problem into multiple more manageable sub-problems with specific tasks and well-defined solutions to these tasks. Generally, each sub-problem requires modification of one or more files. We would like to propose our Design Strategy as follows:&lt;br /&gt;
&lt;br /&gt;
==== Preparation ====&lt;br /&gt;
&lt;br /&gt;
* Clean up code that our implementation will use&lt;br /&gt;
** PROBLEM: We need to add/change content to the edit assignment Topics tab, but unlike other tabs in the views, it does not have its own partial view to work with&lt;br /&gt;
*** SOLUTION: Refactor and move the code dealing with topics into separate ''app/views/assignments/edit/_topics.html.erb'' file&lt;br /&gt;
*** File: ''app/views/assignments/edit.html.erb''&lt;br /&gt;
** PROBLEM: In a section below, we discuss the need to modify existing methods to also accept an optional argument ''topic_id''.  In many cases these existing method use confusing variable names or lack sufficient comments.&lt;br /&gt;
*** SOLUTION: Clean up methods that we plan to modify&lt;br /&gt;
*** FILE: (many)&lt;br /&gt;
&lt;br /&gt;
==== Implementation ====&lt;br /&gt;
&lt;br /&gt;
* Allow an instructor to indicate that rubric should vary by topic&lt;br /&gt;
** PROBLEM: There is no way for an instructor to indicate that an assignments' rubric should vary by topic&lt;br /&gt;
*** SOLUTION: Add a new checkbox in the edit assignment Rubrics tab to indicate this preference&lt;br /&gt;
*** FILE: ''app/views/assignments/edit/_rubrics.html.erb''&lt;br /&gt;
** PROBLEM: If the user changes the &amp;quot;Review rubric varies by round?&amp;quot; or &amp;quot;Review rubric varies by topic?&amp;quot; checkbox on the Rubrics tab, but leaves the page in an inappropriate state before leaving the tab (e.g. rubric weights that do not add up to 0% or 100%), then the user does not get feedback that they made a mistake.  They only get such feedback when explicitly performing a &amp;quot;Save&amp;quot;.  Switching from tab to tab on the assignments edit page attempts to perform an implicit save, but there is no mechanism to update the flash messages onscreen if anything goes wrong.  This becomes more problematic now that the Topics tab appearance depends on choices made on the Rubrics tab.  &lt;br /&gt;
*** SOLUTION: Provide a route to an assignments controller method that can return a render of the flash messages.  Add an AJAX call on the assignments edit view that can update the flash messages onscreen.&lt;br /&gt;
*** FILE: app/controllers/assignments_controller.rb&lt;br /&gt;
*** FILE: app/views/assignments/edit.html.erb&lt;br /&gt;
&lt;br /&gt;
* Allow an instructor to choose different rubrics for different topics&lt;br /&gt;
** PROBLEM: There is no way for an instructor to choose different rubrics for different topics&lt;br /&gt;
*** SOLUTION: Add a new column in the edit assignment Topics tab for choosing rubric(s)&lt;br /&gt;
**** New column only visible if rubrics vary by topic, per Rubrics tab&lt;br /&gt;
**** New column has multiple rounds per topic only if rubrics vary by round, per Rubrics tab&lt;br /&gt;
**** Default value for any rubric is that rubric which is shown on Rubrics tab&lt;br /&gt;
**** Rubric(s) in the dropdown list is/are only those that were created by the currently logged in instructor&lt;br /&gt;
*** FILE: ''app/views/assignments/edit/_topics.html.erb''&lt;br /&gt;
** PROBLEM: The code in ''app/views/assignments/edit/_rubrics.html.erb'' includes dropdowns like the ones we need to add for topics, but that code is way too complex for its functionality (too heavy for a view, uses JavaScript)&lt;br /&gt;
*** SOLUTION: Use the code in ''app/views/assignments/edit/_rubrics.html.erb'' for inspiration only&lt;br /&gt;
**** Refactor and move as much actual work as possible out into helper methods that are simply called from this view&lt;br /&gt;
**** Views are not intended to do heavy lifting&lt;br /&gt;
**** Use as little JavaScript as possible, since this is a Ruby On Rails project, not a JS project&lt;br /&gt;
*** FILE: ''app/views/assignments/edit/_topics.html.erb''&lt;br /&gt;
** PROBLEM: The drop-downs for selecting rubrics should show only those rubrics created by the currently-logged in instructor (per project mentor).  They currently include those created by the instructor of the relevant assignment.&lt;br /&gt;
*** SOLUTION: Change the filtering in the ''questionnaire_options'' method to reflect the desired filtering.&lt;br /&gt;
*** FILE: app/helpers/assignment_helper.rb&lt;br /&gt;
&lt;br /&gt;
* Support the ability of the database to link rubrics to topics&lt;br /&gt;
** PROBLEM: There is no relationship in the database that can link together rubrics with topics&lt;br /&gt;
*** SOLUTION: Add a new migration that adds topic_id field to existing assignment_questionnaires table&lt;br /&gt;
**** This new field will reference the id field in the sign_up_topics table&lt;br /&gt;
*** FILE: ''db/migrate/[timestamp]_add_topic_id_to_assignment_questionnaires_table.rb''&lt;br /&gt;
** PROBLEM: The AssignmentQuestionnaire model does not have any knowledge of topics&lt;br /&gt;
*** SOLUTION: Add a new belongs_to reference in the model, to sign_up_topic&lt;br /&gt;
*** FILE: ''app/models/assignment_questionnaire.rb''&lt;br /&gt;
** PROBLEM: The SignUpTopic model does not have any knowledge of assignment_questionnaire records&lt;br /&gt;
*** SOLUTION: Add a new has_many reference in the model, to assignment_questionnaires&lt;br /&gt;
*** FILE: ''app/models/sign_up_topic.rb''&lt;br /&gt;
&lt;br /&gt;
* React to an instructor saving an assignment after altering the rubrics-vary-by-topic checkbox&lt;br /&gt;
** PROBLEM: There is nothing in place to remember when an instructor chooses to vary rubrics by topic, or chooses to not vary rubrics by topic&lt;br /&gt;
*** SOLUTION: Modify existing method ''update_assignment_questionnaires()''.  This method executes upon assignment save (explicit or via tab-change).  This method deletes all ''AssignmentQuestionnaire'' records before creating new correct records reflecting the user's selections in the edit assignment form.  Modify such that this method can create multiple records reflecting multiple topics, in the case where rubric should vary by topic.  With this modification, the correct records (with default rubrics) are present when the user goes to the Topics tab, so that the Topics tab can display properly.&lt;br /&gt;
*** FILE: app\models\assignment_form.rb&lt;br /&gt;
** PROBLEM: There is no way to refresh the Topics tab to show / hide drop-downs after the instructor changes checkbox on Rubrics tab&lt;br /&gt;
*** SOLUTION: Make use of existing &amp;quot;Save&amp;quot;-like functionality when changing tabs on the edit assignment page.  When updating due to tab-change, cause a fresh render of the Topics tab.  When updating due to &amp;quot;Save&amp;quot; button, keep functionality as-is.&lt;br /&gt;
*** FILE: ''app/controllers/assignments_controller.rb''&lt;br /&gt;
*** FILE: ''app/views/assignments/edit.html.erb''&lt;br /&gt;
&lt;br /&gt;
* Support the ability to find the correct rubric for a particular topic&lt;br /&gt;
** PROBLEM: The existing methods allow us to find the correct rubric for a particular round, but not a particular topic&lt;br /&gt;
*** SOLUTION: Modify the existing method questionnaire(assignment, type, round_number) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/helpers/assignment_helper.rb''&lt;br /&gt;
*** SOLUTION: Modify the existing method assignment_questionnaire(assignment, type, number) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/helpers/assignment_helper.rb''&lt;br /&gt;
*** SOLUTION: Modify the existing method questionnaire(round = nil) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/models/review_response_map.rb''&lt;br /&gt;
*** SOLUTION: Modify the existing method questionnaire(round) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/models/self_review_response_map.rb''&lt;br /&gt;
*** SOLUTION: Modify the existing method review_questionnaire_id(round = nil) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/models/assignment.rb''&lt;br /&gt;
&lt;br /&gt;
* Use the correct rubric for a particular topic&lt;br /&gt;
** PROBLEM: When finding rubrics to display, save results from, calculate scores from, etc. round may be used but topic is not&lt;br /&gt;
*** SOLUTION: Examine all callers of methods modified in the previous section and pass in ''topic_id'' where appropriate to grab the correct rubric&lt;br /&gt;
*** FILE: (many)&lt;br /&gt;
&lt;br /&gt;
* Support the ability to determine if an assignment has rubrics that vary by topic&lt;br /&gt;
** PROBLEM: There is no handy method to call that can tell us if an assignment has rubrics that vary by topic&lt;br /&gt;
*** SOLUTION: Add a new method ''varying_rubrics_by_topic?'' based on the existing method ''varying_rubrics_by_round?''&lt;br /&gt;
*** FILE: ''app/models/assignment.rb''&lt;br /&gt;
&lt;br /&gt;
=== Q&amp;amp;A ===&lt;br /&gt;
&lt;br /&gt;
Here we paraphrase some questions we received during round 1 of the documentation review.&lt;br /&gt;
&lt;br /&gt;
* Q: How will the new logic for varying rubric by topic tie in with the existing logic?&lt;br /&gt;
** A: We will add a new field ''topic_id'' into the existing table ''assignment_questionnaires'', as noted in the [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Entity_Relationship_Diagram E/R Diagram].  We will update methods that find questionnaires to allow these methods to also accept a ''topic_id'' argument, as noted in [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Implementation Implementation].&lt;br /&gt;
* Q: How will the &amp;quot;Rubric varies by topic&amp;quot; selection be stored?&lt;br /&gt;
** A: Indirectly, by saving records in the ''assignment_questionnaires'' table which either reference a ''topic_id'' or leave this field nil.  For more details please see the [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Entity_Relationship_Diagram E/R Diagram] discussion.&lt;br /&gt;
* Q: What will happen if an instructor selects &amp;quot;Rubric varies by topic&amp;quot;, makes selections on the &amp;quot;Topics&amp;quot; tab, and then deselects &amp;quot;Rubric varies by topic&amp;quot;?&lt;br /&gt;
** A: The Topics tab, when next visited, will no longer show dropdowns for selecting rubrics by topic.  When the assignment is saved, the appropriate not-varying-by-topic records will be saved in the ''assignment_questionnaires'' table.  For more details please see [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Implementation Implementation].&lt;br /&gt;
* Q: What will happen after an instructor selects &amp;quot;Rubric varies by topic&amp;quot;?&lt;br /&gt;
** A: The Topics tab, when next visited, will now show dropdowns for selecting rubrics by topic.  These rubrics will default to those shown on the Rubrics tab.  When the assignment is saved, the appropriate varying-by-topic records will be saved in the ''assignment_questionnaires'' table.  For more details please see [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Implementation Implementation].&lt;br /&gt;
* Q: How will the appropriate list of questionnaires for the new dropdowns on the Topics tab be determined?&lt;br /&gt;
** A: In the same way that the appropriate list of questionnaires for the existing dropdowns on the Rubrics tab is determined.  Namely, by the ''questionnaire_options'' method in the file ''expertiza/app/helpers/assignment_helper.rb''.&lt;br /&gt;
&lt;br /&gt;
=== (Selected) Modified Code ===&lt;br /&gt;
&lt;br /&gt;
In this section, we provide ''selected portions'' of modified code to illustrate how we implemented the new feature.&lt;br /&gt;
&lt;br /&gt;
Allow an instructor to indicate that rubric should vary by topic&lt;br /&gt;
&lt;br /&gt;
''app\views\assignments\edit\_rubrics.html.erb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;lt;input name=&amp;quot;vary_by_topic&amp;quot; type=&amp;quot;hidden&amp;quot; value=&amp;quot;false&amp;quot; /&amp;gt;&lt;br /&gt;
  &amp;lt;%= check_box_tag('vary_by_topic', 'true', @review_vary_by_topic_check) %&amp;gt;&lt;br /&gt;
  &amp;lt;%= label_tag('vary_by_topic', 'Review rubric varies by topic?') %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Allow an instructor to choose different rubrics for different topics&lt;br /&gt;
&lt;br /&gt;
''app\views\sign_up_sheet\_table_line.html.erb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;lt;% if @assignment_form.assignment.varying_rubrics_by_topic? %&amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;table id = &amp;lt;%=table_id %&amp;gt;&amp;gt;&lt;br /&gt;
        &amp;lt;tr&amp;gt;&lt;br /&gt;
          &amp;lt;script&amp;gt;&lt;br /&gt;
              ...&lt;br /&gt;
              &amp;lt;% if @assignment_form.assignment.varying_rubrics_by_round? %&amp;gt;&lt;br /&gt;
                &amp;lt;% for round in 1..@assignment_form.assignment.rounds_of_reviews %&amp;gt;&lt;br /&gt;
                  ...&lt;br /&gt;
                &amp;lt;% end %&amp;gt;&lt;br /&gt;
              &amp;lt;% else %&amp;gt;&lt;br /&gt;
                ...&lt;br /&gt;
              &amp;lt;% end %&amp;gt;&lt;br /&gt;
          &amp;lt;/script&amp;gt;&lt;br /&gt;
        &amp;lt;/tr&amp;gt;&lt;br /&gt;
      &amp;lt;/table&amp;gt;&lt;br /&gt;
    &amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Support the ability of the database to link rubrics to topics&lt;br /&gt;
&lt;br /&gt;
''app\models\sign_up_topic.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  class SignUpTopic &amp;lt; ActiveRecord::Base&lt;br /&gt;
    ...&lt;br /&gt;
    has_many :assignment_questionnaires, class_name: 'AssignmentQuestionnaire', foreign_key: 'topic_id', dependent: :destroy&lt;br /&gt;
    ...&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
React to an instructor saving an assignment after altering the rubrics-vary-by-topic checkbox&lt;br /&gt;
&lt;br /&gt;
''app/controllers/assignments_controller.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def update&lt;br /&gt;
    ...&lt;br /&gt;
    # What to do next depends on how we got here&lt;br /&gt;
    if params['button'].nil?&lt;br /&gt;
      # REFRESH the topics tab after changing tabs&lt;br /&gt;
      ...&lt;br /&gt;
      render :partial =&amp;gt; &amp;quot;assignments/edit/topics&amp;quot;&lt;br /&gt;
    else&lt;br /&gt;
      # SAVE button was used (do a redirect)&lt;br /&gt;
      redirect_to edit_assignment_path @assignment_form.assignment.id&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Support the ability to find the correct rubric for a particular topic&lt;br /&gt;
&lt;br /&gt;
''app/helpers/assignment_helper.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def assignment_questionnaire(assignment, questionnaire_type, round_number = nil, topic_id = nil)&lt;br /&gt;
    q_by_type = assignment.questionnaires.find_by(type: questionnaire_type)&lt;br /&gt;
    if q_by_type.nil?&lt;br /&gt;
      ...&lt;br /&gt;
    else&lt;br /&gt;
      ...&lt;br /&gt;
      aq_by_type = assignment.assignment_questionnaires.find_by(questionnaire_id: q_by_type.id)&lt;br /&gt;
      if round_number.nil? &amp;amp;&amp;amp; topic_id.nil?&lt;br /&gt;
        # Find by type&lt;br /&gt;
        aq = aq_by_type&lt;br /&gt;
      elsif topic_id.nil?&lt;br /&gt;
        # Find by round&lt;br /&gt;
        aq = assignment.assignment_questionnaires.find_by(used_in_round: round_number)&lt;br /&gt;
      elsif round_number.nil?&lt;br /&gt;
        # Find by topic&lt;br /&gt;
        aq = assignment.assignment_questionnaires.find_by(topic_id: topic_id)&lt;br /&gt;
      else&lt;br /&gt;
        # Find by round and topic&lt;br /&gt;
        aq = assignment.assignment_questionnaires.where(used_in_round: round_number, topic_id: topic_id).first&lt;br /&gt;
      end&lt;br /&gt;
      aq.nil? ? aq_by_type : aq&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use the correct rubric for a particular topic&lt;br /&gt;
&lt;br /&gt;
''app\controllers\response_controller.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def set_questionnaire_for_new_response&lt;br /&gt;
    case @map.type&lt;br /&gt;
    when &amp;quot;ReviewResponseMap&amp;quot;, &amp;quot;SelfReviewResponseMap&amp;quot;&lt;br /&gt;
      reviewees_topic = SignedUpTeam.topic_id_by_team_id(@contributor.id)&lt;br /&gt;
      @current_round = @assignment.number_of_current_round(reviewees_topic)&lt;br /&gt;
      @questionnaire = @map.questionnaire(@current_round, reviewees_topic)&lt;br /&gt;
    when&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Support the ability to determine if an assignment has rubrics that vary by topic&lt;br /&gt;
&lt;br /&gt;
''app\models\assignment.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def varying_rubrics_by_topic?&lt;br /&gt;
    aq_no_topic_id = AssignmentQuestionnaire.where(assignment_id: self.id, topic_id: nil).size &amp;gt;= 1&lt;br /&gt;
    aq_with_topic_id = AssignmentQuestionnaire.where(assignment_id: self.id).where.not(topic_id: nil).size &amp;gt;= 1&lt;br /&gt;
    if !aq_no_topic_id &amp;amp;&amp;amp; !aq_with_topic_id&lt;br /&gt;
      return false&lt;br /&gt;
    elsif aq_no_topic_id &amp;amp;&amp;amp; !aq_with_topic_id&lt;br /&gt;
      return false&lt;br /&gt;
    elsif !aq_no_topic_id &amp;amp;&amp;amp; aq_with_topic_id&lt;br /&gt;
      return true&lt;br /&gt;
    else&lt;br /&gt;
      raise StandardError.new(&amp;quot;Assignment with id &amp;quot; + self.id.to_s + &amp;quot; has a conflict about whether or not it varies by topic&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== How To ==&lt;br /&gt;
&lt;br /&gt;
In this section, we describe how to use the newly implemented feature.&lt;br /&gt;
&lt;br /&gt;
(Log in as an Instructor)&lt;br /&gt;
&lt;br /&gt;
=== Specify Rubrics should vary by Topic ===&lt;br /&gt;
# Navigate to Edit page for an Assignment.&lt;br /&gt;
# Click the Rubrics tab.&lt;br /&gt;
# Check the &amp;quot;Review rubric varies by topic?&amp;quot; checkbox.&lt;br /&gt;
&lt;br /&gt;
=== Select a Rubric for a Topic ===&lt;br /&gt;
After checking the &amp;quot;Review rubric varies by topic?&amp;quot; checkbox,&lt;br /&gt;
# Click the Topics tab.&lt;br /&gt;
# Select the appropriate Rubric from the dropdown menu(s) beside each Topic.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
See also: [https://www.youtube.com/watch?v=F7nQsIUspQM Video Demonstration of Specialized Rubrics]&lt;br /&gt;
&lt;br /&gt;
== Project Testing ==&lt;br /&gt;
&lt;br /&gt;
=== Strategy ===&lt;br /&gt;
&lt;br /&gt;
To test code implementation, correctness of the added feature, verify that the team did not break any existing functionalities in the Expertiza, and ensure that no bugs were introduced in the code, we developed the following Test Strategy:&lt;br /&gt;
&lt;br /&gt;
# Code inspection&lt;br /&gt;
# Run and pass existing RSpec Tests&lt;br /&gt;
# Develop New RSpec Tests&lt;br /&gt;
# Run through live UI to test a feature using Expertiza instance&lt;br /&gt;
&lt;br /&gt;
=== Rspec Testing ===&lt;br /&gt;
&lt;br /&gt;
==== Existing Tests ====&lt;br /&gt;
&lt;br /&gt;
Run all existing RSpec tests on any changed files, after our changes, to ensure that we have not introduced any failures.&lt;br /&gt;
The commands and results are shown below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
e@ubuntu:~/Desktop/CSC517_HW04/expertiza$ bundle exec rspec spec/helpers/ spec/controllers/ spec/models/&lt;br /&gt;
[Coveralls] Set up the SimpleCov formatter.&lt;br /&gt;
[Coveralls] Using SimpleCov's 'rails' settings.&lt;br /&gt;
&lt;br /&gt;
Randomized with seed 6978&lt;br /&gt;
[...]&lt;br /&gt;
&lt;br /&gt;
Finished in 8 minutes 10 seconds (files took 12.32 seconds to load)&lt;br /&gt;
900 examples, 0 failures, 16 pending&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The features tests were extremely time-consuming so we did not routinely run them during development.  However TravisCI results on our [https://github.com/expertiza/expertiza/pull/1444 Pull Request] demonstrate the passing status of all tests.&lt;br /&gt;
&lt;br /&gt;
==== New Tests ====&lt;br /&gt;
&lt;br /&gt;
Write comprehensive RSpec tests, for all new or modified methods.&lt;br /&gt;
* FILE: ''spec/helpers/assignment_helper_spec.rb''&lt;br /&gt;
** METHODS TO TEST: &lt;br /&gt;
*** questionnaire(assignment, type, round_number, topic_id)&lt;br /&gt;
*** assignment_questionnaire(assignment, type, number, topic_id)&lt;br /&gt;
* FILE: ''spec/models/review_response_map_spec.rb''&lt;br /&gt;
*** METHODS TO TEST:&lt;br /&gt;
**** questionnaire(round, topic_id)&lt;br /&gt;
* FILE: ''spec/models/self_review_response_map_spec.rb''&lt;br /&gt;
*** METHODS TO TEST:&lt;br /&gt;
**** questionnaire(round, topic_id)&lt;br /&gt;
* FILE: ''spec/models/assignment_spec.rb''&lt;br /&gt;
*** METHODS TO TEST:&lt;br /&gt;
**** review_questionnaire_id(round, topic_id)&lt;br /&gt;
**** varying_rubrics_by_topic?()&lt;br /&gt;
&lt;br /&gt;
Run these tests, to ensure that the new code works as intended.&lt;br /&gt;
The commands and results are shown below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
e@ubuntu:~/Desktop/CSC517_HW04/expertiza$ bundle exec rspec spec/helpers/assignment_helper_spec.rb spec/models/review_response_map_spec.rb spec/models/self_review_response_map_spec.rb spec/models/assignment_spec.rb &lt;br /&gt;
[Coveralls] Set up the SimpleCov formatter.&lt;br /&gt;
[Coveralls] Using SimpleCov's 'rails' settings.&lt;br /&gt;
&lt;br /&gt;
Randomized with seed 47508&lt;br /&gt;
....................................................................................................................&lt;br /&gt;
&lt;br /&gt;
Finished in 1 minute 7.94 seconds (files took 10.85 seconds to load)&lt;br /&gt;
116 examples, 0 failures&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The test suite for a single new method is shown below.&lt;br /&gt;
* There are many such suites added in expertiza/spec  &lt;br /&gt;
* This example illustrates our general strategy:&lt;br /&gt;
** test missing input&lt;br /&gt;
** test bad input&lt;br /&gt;
** test various acceptable forms of input&lt;br /&gt;
** test scenarios that lead to various return values&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  describe &amp;quot;#questionnaire&amp;quot; do&lt;br /&gt;
&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;throws exception if assignment argument nil&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;throws exception if all arguments nil except for assignment&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;finds by type if round number &amp;amp; topic id not given&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;throws exception if round number &amp;amp; topic id not given, no luck finding by type&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;finds by round number alone if round number alone is given&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;creates new questionnaire of given type if round number alone is given, no luck finding by round&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;finds by topic id alone if topic id alone is given&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;creates new questionnaire of given type if topic id alone is given, no luck finding by topic&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;finds by round number and topic id if both are given&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;creates new questionnaire of given type if round and topic are given, no luck finding by round and topic&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== UI Testing ===&lt;br /&gt;
&lt;br /&gt;
Here we describe manual UI Testing that was performed.&lt;br /&gt;
&lt;br /&gt;
==== Rubric does not vary by round or by topic ====&lt;br /&gt;
&lt;br /&gt;
* Go to Rubrics tab and verify that both &amp;quot;Review rubric varies by round?&amp;quot; and &amp;quot;Review rubric varies by topic?&amp;quot; checkboxes are unchecked.&lt;br /&gt;
* Go to Topics tab and verify that there are no dropdown menus beside each Topic.&lt;br /&gt;
&lt;br /&gt;
==== Rubric varies by round, but not by topic ====&lt;br /&gt;
&lt;br /&gt;
* Go to Rubrics tab and verify that &amp;quot;Review rubric varies by round?&amp;quot; is checked and &amp;quot;Review rubric varies by topic?&amp;quot; is unchecked.&lt;br /&gt;
* Go to Topics tab and verify that there are no dropdown menus beside each Topic.&lt;br /&gt;
&lt;br /&gt;
==== Rubric varies by topic, but not by round ====&lt;br /&gt;
&lt;br /&gt;
* Go to Rubrics tab and verify that &amp;quot;Review rubric varies by round?&amp;quot; is unchecked and &amp;quot;Review rubric varies by topic?&amp;quot; is checked.&lt;br /&gt;
* Go to Topics tab and verify that there is only 1 dropdown menu beside each Topic.&lt;br /&gt;
&lt;br /&gt;
==== Rubric varies by both round and topic ====&lt;br /&gt;
&lt;br /&gt;
* Go to Rubrics tab and verify that both &amp;quot;Review rubric varies by round?&amp;quot; and &amp;quot;Review rubric varies by topic?&amp;quot; checkboxes are checked.&lt;br /&gt;
* Go to Topics tab and verify that there is 1 dropdown menu per round for each Topic.&lt;br /&gt;
&lt;br /&gt;
==== Updates rejected if Rubric weights do not add up to 100% or 0% ====&lt;br /&gt;
&lt;br /&gt;
* Go to Rubrics tab and check the &amp;quot;Review rubric varies by topic?&amp;quot; checkbox. &lt;br /&gt;
* Change weight values for the Rubrics so that they add up to 97%.&lt;br /&gt;
* Go to Topics tab and verify that checking the &amp;quot;Review rubric varies by topic?&amp;quot; checkbox did not work.&lt;br /&gt;
* Verify that there are no dropdown menus beside each Topic.&lt;br /&gt;
* Verify that the proper error message is shown.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
In CSC/ECE 517, there are several types of topics that could be covered in a single class assignment.  However, currently we can only specify one kind of rubric for an assignment. This means that teams working on different topics will be evaluated using the same rubric. With this setup, it's not possible to fine-tune rubrics for different topics - rubrics tend to be overly general.&lt;br /&gt;
&lt;br /&gt;
In this project, we have solved this issue, by allowing rubrics to vary not only by round, but also by topic. This allows more flexibility to the instructor when setting up an assignment, so that they can use rubrics better suited to the tasks that students are performing in an assignment.  The following scenarios will be possible, and the instructor will be the judge of which scenario is the best fit to the assignment:&lt;br /&gt;
&lt;br /&gt;
* Rubric does not vary by round or by topic.&lt;br /&gt;
* Rubric varies by round, but not by topic.&lt;br /&gt;
* Rubric varies by topic, but not by round.&lt;br /&gt;
* Rubric varies by both round and topic.&lt;br /&gt;
&lt;br /&gt;
The instructor may use the Rubrics tab of the assignments edit page to make changes to the &amp;quot;Review rubric varies by round?&amp;quot; and &amp;quot;Review rubric varies by topic?&amp;quot; checkboxes.  The instructor may then use the Topics tab to select the appropriate rubric(s) for every topic in the assignment.&lt;br /&gt;
&lt;br /&gt;
Various other Expertiza code has been updated to retrieve the correct rubric depending on round and topic after the instructor has made these selections.&lt;br /&gt;
&lt;br /&gt;
== Future Work ==&lt;br /&gt;
&lt;br /&gt;
This section discusses possible future work for another CSC 517 team to take on.  Such a team can search the Expertiza codebase for &amp;quot;TODO E1936 (future work)&amp;quot; to find most of the places in the code that the notes below refer to.&lt;br /&gt;
&lt;br /&gt;
* Reduce the delay between changing the state of the &amp;quot;Review rubric varies by topic?&amp;quot; checkbox on the Rubrics tab, and the show / hide of rubric drop-downs on the Topics tab.&lt;br /&gt;
* Redesign UI for tone analysis, heatmaps, and review scores pop-up.  These areas are designed around the assumption that reviews do NOT vary by topic.  For example, in the review scores pop-up, a reviewer can see the reviews they have given, arranged by question, across multiple reviewees.&lt;br /&gt;
* Consider whether the questionnaire options available for selection in drop-downs on the Topics and Rubrics tabs should include ''only'' those questionnaires created by the currently-logged-in instructor.  Our work in this project changed the filtering from instructor-owning-assignment to currently-logged-in instructor - but left in place all non-private questionnaires.  ''Consider'' whether non-private questionnaires should be excluded.  This may result in some drop-downs not having any available questionnaires.&lt;br /&gt;
&lt;br /&gt;
== Useful Links ==&lt;br /&gt;
In this section we provide useful links related to the work that has been completed by our team.&lt;br /&gt;
# [https://github.com/gabalmat/expertiza Forked Project Repository]&lt;br /&gt;
# [https://github.com/expertiza/expertiza/pull/1444 Pull Request]&lt;br /&gt;
# [https://www.youtube.com/watch?v=F7nQsIUspQM Video Demonstration of Specialized Rubrics]&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Contacts ===&lt;br /&gt;
We have 4 (four) members in our team and 1 (one) mentor was also assigned to us. For any project-related questions/concerns please contact us:&lt;br /&gt;
* Aurora Tiffany-Davis - attiffan@ncsu.edu&lt;br /&gt;
* Ginger Balmat - gabalmat@ncsu.edu&lt;br /&gt;
* Joe Hutchinson - jehutch3@ncsu.edu&lt;br /&gt;
* Nikolay Titov - ngtitov@ncsu.edu&lt;br /&gt;
* Zhewei Hu (mentor) - zhu6@ncsu.edu&lt;br /&gt;
&lt;br /&gt;
=== Contribution Based Inquiry ===&lt;br /&gt;
For any questions or concerns related to the project design, implementation, testing of the feature developed by our team, please contact an engineer who worked closely on the topic of your interest based on the [https://docs.google.com/spreadsheets/d/11uxuI_5gaC-FQDwIOxtCaN3HZ9bfWDJgIjFemtYV5jE/edit?ts=5ca222f3#gid=0 Contribution Assignment Grid] we created to keep track of our progress and contribution. Please carbon copy all team members and our mentor in the email.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* Expertiza Web [https://github.com/expertiza/expertiza#expertiza]&lt;br /&gt;
* Expertiza on GitHub [https://github.com/expertiza/expertiza]&lt;br /&gt;
* Expertiza Wiki [http://wikis.lib.ncsu.edu/index.php/Expertiza]&lt;br /&gt;
* Rspec Documentation [https://relishapp.com/rspec]&lt;br /&gt;
* Wiki with Previous Work [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1873_Specialized_rubics_for_different_topic_types]&lt;br /&gt;
* Pull Request of the Previous Work [https://github.com/expertiza/expertiza/pull/1327]&lt;/div&gt;</summary>
		<author><name>Ngtitov</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Sequence_diagram_1936.png&amp;diff=124543</id>
		<title>File:Sequence diagram 1936.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Sequence_diagram_1936.png&amp;diff=124543"/>
		<updated>2019-04-26T21:09:29Z</updated>

		<summary type="html">&lt;p&gt;Ngtitov: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Ngtitov</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics&amp;diff=124542</id>
		<title>E1936 Specialized Rubrics</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics&amp;diff=124542"/>
		<updated>2019-04-26T21:08:32Z</updated>

		<summary type="html">&lt;p&gt;Ngtitov: /* Sequence Diagram */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page describes the work and goals that have been completed and achieved while implementing Expertiza Project &amp;quot;''E1936. Specialized Rubrics for Different Topic Types (e.g., Servo project, refactoring project)''&amp;quot; for the CSC/ECE 517 &amp;quot;Object-Oriented Design and Development&amp;quot; class, in the Spring semester of the 2019.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This Wiki page is created per CSC/ECE 517: &amp;quot;Object-Oriented Design and Development&amp;quot;, Expertiza Project requirements (Spring, 2019).&lt;br /&gt;
&lt;br /&gt;
Our [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Team team] was assigned the project &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936. Specialized rubrics for different topic types (e.g., Servo project, refactoring project)]&amp;quot;.  This is an Expertiza project.&lt;br /&gt;
&lt;br /&gt;
In this wiki page we describe the problem to be solved, how we solve that problem, and how we test our solution.  We also provide helpful links and contact information for our team.&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
In this section, we discuss the problem we need to solve, the Expertiza feature this problem is related to, what needs to be done to solve the problem (at a high level), and the previous attempt to solve this problem.&lt;br /&gt;
&lt;br /&gt;
=== Problem Statement ===&lt;br /&gt;
&lt;br /&gt;
This problem statement summarizes the problem as described in the project description &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936. Specialized rubrics for different topic types (e.g., Servo project, refactoring project)]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
In CSC/ECE 517, there are several types of topics that could be covered in a single class assignment.&lt;br /&gt;
* Code base&lt;br /&gt;
** Expertiza&lt;br /&gt;
** Mozilla&lt;br /&gt;
** etc.&lt;br /&gt;
* Goal&lt;br /&gt;
** Refactoring&lt;br /&gt;
** Testing&lt;br /&gt;
** etc.&lt;br /&gt;
However, currently we can only specify one kind of rubric for an assignment.  This means that teams working on different topics will be evaluated using the same rubric.  With this setup, it's not possible to fine-tune rubrics for different topics - rubrics tend to be overly general.&lt;br /&gt;
&lt;br /&gt;
=== Feature Description ===&lt;br /&gt;
&lt;br /&gt;
The Expertiza project already has a feature that allows rubrics to vary by project phase or &amp;quot;round&amp;quot;.  The feature we will add in this project is a feature to allow rubrics to vary not only by round, but also by topic.  This allows more flexibility to the instructor when setting up an assignment, so that they can use rubrics better suited to the tasks that students are performing in an assignment.&lt;br /&gt;
&lt;br /&gt;
When this feature is complete, the following scenarios will be possible, and the instructor will be the judge of which scenario is the best fit to the assignment:&lt;br /&gt;
&lt;br /&gt;
* Rubric does not vary by round or by topic.&lt;br /&gt;
* Rubric varies by round, but not by topic.&lt;br /&gt;
* Rubric varies by topic, but not by round.&lt;br /&gt;
* Rubric varies by both round and topic.&lt;br /&gt;
&lt;br /&gt;
=== What Needs to be Done ===&lt;br /&gt;
&lt;br /&gt;
This section summarizes the work as described in the project description &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936. Specialized rubrics for different topic types (e.g., Servo project, refactoring project)]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* In assignment#edit page &amp;quot;Rubrics&amp;quot; tab, add a checkbox to specify whether rubric should vary by topic.&lt;br /&gt;
* In assignment#edit page &amp;quot;Topics&amp;quot; tab, add dropdown(s) next to each topic to specify which rubric(s) are associated with the topic.&lt;br /&gt;
** The dropdown(s) should appear only if rubric should vary by topic, per the Rubrics tab.&lt;br /&gt;
** The topic should have a multiple dropdowns (one for each round) only if rubrics vary by round, per the Rubrics tab.&lt;br /&gt;
** By default, the rubric(s) for each course project will be the one(s) specified in “Rubrics” tab.&lt;br /&gt;
** The dropdown value can overwrite the default rubric.&lt;br /&gt;
* Be careful when making changes to the code&lt;br /&gt;
** The signup_sheet_controller should have as little to do as possible with the selection of rubrics.&lt;br /&gt;
** Anything not germane to selecting topics should be in another controller or (more probably) a helper.&lt;br /&gt;
* Create a DB migration to allow rubric to vary by topic as well as by round.&lt;br /&gt;
&lt;br /&gt;
==== Screenshots ====&lt;br /&gt;
'''Before: (Rubrics tab for an Assignment)'''&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Screenshot Assignment Edit Rubrics.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Before: (Topics tab for an Assignment)'''&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Screenshot Assignment Edit Topics.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''After: (Rubrics tab for an Assignment)'''&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Specialized Rubric checkbox after.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''After: (Topics tab for an Assignment)'''&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Specialized Rubrics dropdown after.png]]&lt;br /&gt;
&lt;br /&gt;
== Previous Work ==&lt;br /&gt;
&lt;br /&gt;
There was previous attempt to implement this project in the Fall of 2018 semester by different team, but it was rejected due to several reasons. As a result our team was assigned to complete this project with the given implementation. However, after detailed investigation of the proposed design that team has made in the previous semester and review of the code changes, we proposed different architectural solution for the problem, which we believe is simpler, more efficient, and elegant solution.&lt;br /&gt;
&lt;br /&gt;
=== Previous Project Implementation ===&lt;br /&gt;
&lt;br /&gt;
Our team was provided with all relevant information and materials about the design and implementation of the previously attempted project. We would like to acknowledge that we use previous implementation and design as reference and our starting point for our own implementation. The following is the list of links with the relevant materials that we have used for better project understanding, determining pros and cons of previously proposed changes, and establishing our design strategy and implementation:&lt;br /&gt;
&lt;br /&gt;
# [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1873_Specialized_rubics_for_different_topic_types Wiki]&lt;br /&gt;
# [https://github.com/expertiza/expertiza/pull/1327 Pull Request]&lt;br /&gt;
# [https://drive.google.com/file/d/1UrLb0Ula_Lb_F4MOrdC-s6xng6B08VYu/view Video Demo]&lt;br /&gt;
&lt;br /&gt;
After reviewing all relevant materials above, we concluded that the project implementation was incomplete and proposed design had significant flaw. &lt;br /&gt;
We identified main drawbacks and flaw as follows:&lt;br /&gt;
&lt;br /&gt;
* Establishing incorrect ''many-to-one'' relationship between ''sign_up_topics'' and ''questionnaires'' tables:&lt;br /&gt;
** Creating a DB migration to add ''questionnaire_id'' in the ''sign_up_topics'' table to store the dropdown data presumes ''one-to-one'' or ''many-to-one'' relationship between ''sign_up_topics'' and ''questionnaires'' tables&lt;br /&gt;
** Correct relationship between ''sign_up_topics'' and ''questionnaires'' tables is ''many-to-many''. For example, each project topic may have various rubrics depending on the round it is used (e.g., for round 1, topic may have one rubric; but for round 2, the same topic may have different rubric)&lt;br /&gt;
** Proposed previous migration changes would break DB design and would not allow to store correctly topic and its associated rubric per different round.&lt;br /&gt;
* Per project requirement specifications, &amp;quot;''The dropdown box should appear only if 'Vary rubric by topic' is selected in the Rubrics tab.''&amp;quot; This requirement was not met and ''Vary rubric by topic'' checkbox in the Rubrics tab was not implemented. Therefore, dropdown box with the list of rubrics appears regardless of whether &amp;quot;''Vary rubric by topic''&amp;quot; is selected or not.&lt;br /&gt;
* The dropdown box includes the list of all possible rubrics including default value. However, this condition can be improved. The dropdown box should list the rubrics that were created by the current user (professor who is logged in). This would allow to shorten the list of possible rubrics dramatically and help to avoid any misunderstanding and confusion while user selects desired rubric for the course project.&lt;br /&gt;
&lt;br /&gt;
We found no further issues with the rest implementation and in other project materials. Wiki page is very useful for understanding design of proposed changes, finding drawbacks and the flaw. Considering all the pros and cons, and taking into account drawbacks of the proposed changes, our team evolved different approach that should successfully solve the problem stated for the project without without creating additional issues. Please see our [http://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics#Project_Implementation Project Implementation] for more details.&lt;br /&gt;
&lt;br /&gt;
=== Previous Project Requirements ===&lt;br /&gt;
&lt;br /&gt;
The project requirements originally specified how to alter the databases to support varying rubrics by topic.&lt;br /&gt;
&lt;br /&gt;
''Create a new table named topic_questionnaires with field:''&lt;br /&gt;
* ''id''&lt;br /&gt;
* ''topic_id''&lt;br /&gt;
* ''questionnaire_id''&lt;br /&gt;
* ''used_in_round''&lt;br /&gt;
&lt;br /&gt;
However, the E1936 team successfully petitioned for this requirement to change to give us more freedom in the implementation.  The original suggestion had a flaw.  There is already an existing table in the Expertiza project called ''assignment_questionnaires'', which has columns including ''assignment_id'', ''questionnaire_id'', and ''used_in_round''.  It is this table that maintains the knowledge of which rubric is used in which round of an assignment.  If we were to add a new table to maintains the knowledge of which rubric is used in which topic of an assignment as originally suggested, then we would have a big problem.  Knowledge of round-rubric relationship is duplicated.  This would lead (best case scenario) to extra work, and (worst case scenario) to lots of bugs caused by inconsistencies in how these tables are handled with CRUD operations throughout the code.  In other words, this is not a DRY solution.&lt;br /&gt;
&lt;br /&gt;
== Project Implementation ==&lt;br /&gt;
&lt;br /&gt;
In this section, we propose our solution to the problem with the set of UML diagrams, discuss implementation techniques and details, and list the goals we achieved.&lt;br /&gt;
&lt;br /&gt;
We start by proposing our solution to the problem utilizing UML diagrams that include Use case, Entity Relationship, Class, and Sequence diagrams! Further, we discuss design strategy by breaking project problem into multiple staged sub-problems and provide solutions for each of these sub-problems. We also discuss some design strategies in the form of problem - solution, and provide the list of involved files. To illustrate implementation details for different tasks we decided to include selected (only) modified code where pseudocode-like solution is provided for each major task in this project. Finally, since we received some common questions and misunderstanding during first peer review period, we include Q/A section, where we provide an answer to each common question and concern we received.&lt;br /&gt;
&lt;br /&gt;
=== UML Diagrams ===&lt;br /&gt;
&lt;br /&gt;
Our solution and implementation of the project can be easily shown by discussing Use Case, Entity Relationship, and Class diagrams. First, for simplicity we discuss in general possible sequence of interactions between a user (in this case instructor) and the system (Expertiza) via presenting Use Case Diagram. Then we plan to show proposed database modification via Entity Relationship Diagram. At this point the high-level design and proposed changes should be clear. To make our design more concrete and dive into implementation level, we decided to provide UML Class diagram. Finally, to demonstrate our achievements, we complete this section with the UML Sequence diagram to illustrate interactive behavior of a system with utilized specialized rubrics feature.&lt;br /&gt;
&lt;br /&gt;
==== Use Case Diagram ====&lt;br /&gt;
&lt;br /&gt;
[[File: use_case_diagram_1936.png]]&lt;br /&gt;
&lt;br /&gt;
The above Use Case Diagram shows general sequence of interactions between an instructor and the system (Expertiza) that defines where and how the feature can be utilized. Note that highlighted use cases are objects of our interest and work. Also please note that all of the shown use cases already exist in the system and we simply added a new feature into the system with existing use cases. Particularly, the rubric for each assignment and newly added ''Review rubric varies by topic'' checkbox with which instructor may choose to vary assignment by topic or not, by checking and unchecking the checkbox is displayed in the ''Rubrics'' tab. Hence, we show how instructor can get to the ''Rubrics'' tab of the assignments. Similarly, ''Topics'' tab of assignments has additional ''Questionnaires'' column for each topic, where instructor may specify which rubric associates with which topic. To perform this sequence of interactions and utilize the new feature, instructor must choose ''Edit'' any assignment from the list of all assignments displayed to him/her in the ''Manage Assignments'' page, which can be navigated by instructor by selecting it from the header of the system.&lt;br /&gt;
&lt;br /&gt;
==== Entity Relationship Diagram ====&lt;br /&gt;
&lt;br /&gt;
[[File: HW04_ERD_Closed_Arrow.png]]&lt;br /&gt;
&lt;br /&gt;
The sections of the diagram highlighted in yellow show newly introduced items.  That is, we are adding a new column called ''topic_id'' to ''assignment_questionnaires'', in order to link ''assignment_questionnaires'' to ''sign_up_topics''.&lt;br /&gt;
&lt;br /&gt;
Any assignment, topic, or questionnaire may be represented by multiple records within ''assignment_questionnaires'', but each record within ''assignment_questionnaires'' refers to just one assignment, topic, or questionnaire.  It is the ability to have an assignment represented by multiple records, and the new relationship to ''sign_up_topics'', that allows us to support all of the required scenarios:&lt;br /&gt;
&lt;br /&gt;
* Rubric does not vary by round or by topic.&lt;br /&gt;
* Rubric varies by round, but not by topic.&lt;br /&gt;
* Rubric varies by topic, but not by round.&lt;br /&gt;
* Rubric varies by both round and topic.&lt;br /&gt;
&lt;br /&gt;
[[File: HW04_table.PNG]]&lt;br /&gt;
&lt;br /&gt;
This table illustrates the possibilities that the system may have.&lt;br /&gt;
&lt;br /&gt;
* Assignment 1 does not vary by round or by topic.&lt;br /&gt;
* Assignment 2 varies by round, but not by topic.&lt;br /&gt;
* Assignment 3 varies by topic, but not by round.&lt;br /&gt;
* Assignment 4 varies by both round and topic.&lt;br /&gt;
&lt;br /&gt;
This change is done via database migration by running the following commands:&lt;br /&gt;
&lt;br /&gt;
  rails generate migration AddTopicIdToAssignmentQuestionnaires&lt;br /&gt;
&lt;br /&gt;
Above command adds the ''topic_id'' column to the ''AssignmentQuestionnaires'' table and generates new migration file:&lt;br /&gt;
&lt;br /&gt;
[[File: db_migration.png]]&lt;br /&gt;
&lt;br /&gt;
To see the details of the entire database change please check this [https://github.com/gabalmat/expertiza/commit/d46dd57d35a21ab43efb82c28d3f14b75c695f2e commit].&lt;br /&gt;
&lt;br /&gt;
==== Class Diagram ====&lt;br /&gt;
&lt;br /&gt;
[[File: class_diagram_1936.png]]&lt;br /&gt;
&lt;br /&gt;
The above UML Class diagram describes the changes our team made in the Ruby classes, methods and attributes. Please note that all provided classes in the diagram had already existed in the system, and we only added new relationship, modified existing methods (and some method signatures) and utilized given attributes. All of the class's attributes and methods that are shown in the diagram are utilized (directly and indirectly) in our current implementation. Some of the methods and attributes provided within the classes in the diagram are newly developed. There is only one newly added aggregation relationship between the ''SingUpTopic'' class and ''AssignmentQuestionnaire'' class. Moreover, controllers and models for the certain classes were combined into a single class for simplicity to the design description. In reality, half of the methods shown in  the ''Assignment'' class are implemented in the ''app/controllers/assignments_controller.rb'' file and other half is in the ''app/models/assignment.rb'' file. We decided to combine all of the functionalities of each ''relevant'' controller and model class into single class for the ease of design presentation and interpretation. We used Sequence diagram below to illustrate how MVC architectural pattern is used for a given classes.&lt;br /&gt;
&lt;br /&gt;
==== Sequence Diagram ====&lt;br /&gt;
&lt;br /&gt;
[[File: sequence_diagram_1936.png]]&lt;br /&gt;
&lt;br /&gt;
=== Design Strategy ===&lt;br /&gt;
&lt;br /&gt;
As we have concrete understanding of the problem and proposed solution, we would like break this problem into multiple more manageable sub-problems with specific tasks and well-defined solutions to these tasks. Generally, each sub-problem requires modification of one or more files. We would like to propose our Design Strategy as follows:&lt;br /&gt;
&lt;br /&gt;
==== Preparation ====&lt;br /&gt;
&lt;br /&gt;
* Clean up code that our implementation will use&lt;br /&gt;
** PROBLEM: We need to add/change content to the edit assignment Topics tab, but unlike other tabs in the views, it does not have its own partial view to work with&lt;br /&gt;
*** SOLUTION: Refactor and move the code dealing with topics into separate ''app/views/assignments/edit/_topics.html.erb'' file&lt;br /&gt;
*** File: ''app/views/assignments/edit.html.erb''&lt;br /&gt;
** PROBLEM: In a section below, we discuss the need to modify existing methods to also accept an optional argument ''topic_id''.  In many cases these existing method use confusing variable names or lack sufficient comments.&lt;br /&gt;
*** SOLUTION: Clean up methods that we plan to modify&lt;br /&gt;
*** FILE: (many)&lt;br /&gt;
&lt;br /&gt;
==== Implementation ====&lt;br /&gt;
&lt;br /&gt;
* Allow an instructor to indicate that rubric should vary by topic&lt;br /&gt;
** PROBLEM: There is no way for an instructor to indicate that an assignments' rubric should vary by topic&lt;br /&gt;
*** SOLUTION: Add a new checkbox in the edit assignment Rubrics tab to indicate this preference&lt;br /&gt;
*** FILE: ''app/views/assignments/edit/_rubrics.html.erb''&lt;br /&gt;
** PROBLEM: If the user changes the &amp;quot;Review rubric varies by round?&amp;quot; or &amp;quot;Review rubric varies by topic?&amp;quot; checkbox on the Rubrics tab, but leaves the page in an inappropriate state before leaving the tab (e.g. rubric weights that do not add up to 0% or 100%), then the user does not get feedback that they made a mistake.  They only get such feedback when explicitly performing a &amp;quot;Save&amp;quot;.  Switching from tab to tab on the assignments edit page attempts to perform an implicit save, but there is no mechanism to update the flash messages onscreen if anything goes wrong.  This becomes more problematic now that the Topics tab appearance depends on choices made on the Rubrics tab.  &lt;br /&gt;
*** SOLUTION: Provide a route to an assignments controller method that can return a render of the flash messages.  Add an AJAX call on the assignments edit view that can update the flash messages onscreen.&lt;br /&gt;
*** FILE: app/controllers/assignments_controller.rb&lt;br /&gt;
*** FILE: app/views/assignments/edit.html.erb&lt;br /&gt;
&lt;br /&gt;
* Allow an instructor to choose different rubrics for different topics&lt;br /&gt;
** PROBLEM: There is no way for an instructor to choose different rubrics for different topics&lt;br /&gt;
*** SOLUTION: Add a new column in the edit assignment Topics tab for choosing rubric(s)&lt;br /&gt;
**** New column only visible if rubrics vary by topic, per Rubrics tab&lt;br /&gt;
**** New column has multiple rounds per topic only if rubrics vary by round, per Rubrics tab&lt;br /&gt;
**** Default value for any rubric is that rubric which is shown on Rubrics tab&lt;br /&gt;
**** Rubric(s) in the dropdown list is/are only those that were created by the currently logged in instructor&lt;br /&gt;
*** FILE: ''app/views/assignments/edit/_topics.html.erb''&lt;br /&gt;
** PROBLEM: The code in ''app/views/assignments/edit/_rubrics.html.erb'' includes dropdowns like the ones we need to add for topics, but that code is way too complex for its functionality (too heavy for a view, uses JavaScript)&lt;br /&gt;
*** SOLUTION: Use the code in ''app/views/assignments/edit/_rubrics.html.erb'' for inspiration only&lt;br /&gt;
**** Refactor and move as much actual work as possible out into helper methods that are simply called from this view&lt;br /&gt;
**** Views are not intended to do heavy lifting&lt;br /&gt;
**** Use as little JavaScript as possible, since this is a Ruby On Rails project, not a JS project&lt;br /&gt;
*** FILE: ''app/views/assignments/edit/_topics.html.erb''&lt;br /&gt;
** PROBLEM: The drop-downs for selecting rubrics should show only those rubrics created by the currently-logged in instructor (per project mentor).  They currently include those created by the instructor of the relevant assignment.&lt;br /&gt;
*** SOLUTION: Change the filtering in the ''questionnaire_options'' method to reflect the desired filtering.&lt;br /&gt;
*** FILE: app/helpers/assignment_helper.rb&lt;br /&gt;
&lt;br /&gt;
* Support the ability of the database to link rubrics to topics&lt;br /&gt;
** PROBLEM: There is no relationship in the database that can link together rubrics with topics&lt;br /&gt;
*** SOLUTION: Add a new migration that adds topic_id field to existing assignment_questionnaires table&lt;br /&gt;
**** This new field will reference the id field in the sign_up_topics table&lt;br /&gt;
*** FILE: ''db/migrate/[timestamp]_add_topic_id_to_assignment_questionnaires_table.rb''&lt;br /&gt;
** PROBLEM: The AssignmentQuestionnaire model does not have any knowledge of topics&lt;br /&gt;
*** SOLUTION: Add a new belongs_to reference in the model, to sign_up_topic&lt;br /&gt;
*** FILE: ''app/models/assignment_questionnaire.rb''&lt;br /&gt;
** PROBLEM: The SignUpTopic model does not have any knowledge of assignment_questionnaire records&lt;br /&gt;
*** SOLUTION: Add a new has_many reference in the model, to assignment_questionnaires&lt;br /&gt;
*** FILE: ''app/models/sign_up_topic.rb''&lt;br /&gt;
&lt;br /&gt;
* React to an instructor saving an assignment after altering the rubrics-vary-by-topic checkbox&lt;br /&gt;
** PROBLEM: There is nothing in place to remember when an instructor chooses to vary rubrics by topic, or chooses to not vary rubrics by topic&lt;br /&gt;
*** SOLUTION: Modify existing method ''update_assignment_questionnaires()''.  This method executes upon assignment save (explicit or via tab-change).  This method deletes all ''AssignmentQuestionnaire'' records before creating new correct records reflecting the user's selections in the edit assignment form.  Modify such that this method can create multiple records reflecting multiple topics, in the case where rubric should vary by topic.  With this modification, the correct records (with default rubrics) are present when the user goes to the Topics tab, so that the Topics tab can display properly.&lt;br /&gt;
*** FILE: app\models\assignment_form.rb&lt;br /&gt;
** PROBLEM: There is no way to refresh the Topics tab to show / hide drop-downs after the instructor changes checkbox on Rubrics tab&lt;br /&gt;
*** SOLUTION: Make use of existing &amp;quot;Save&amp;quot;-like functionality when changing tabs on the edit assignment page.  When updating due to tab-change, cause a fresh render of the Topics tab.  When updating due to &amp;quot;Save&amp;quot; button, keep functionality as-is.&lt;br /&gt;
*** FILE: ''app/controllers/assignments_controller.rb''&lt;br /&gt;
*** FILE: ''app/views/assignments/edit.html.erb''&lt;br /&gt;
&lt;br /&gt;
* Support the ability to find the correct rubric for a particular topic&lt;br /&gt;
** PROBLEM: The existing methods allow us to find the correct rubric for a particular round, but not a particular topic&lt;br /&gt;
*** SOLUTION: Modify the existing method questionnaire(assignment, type, round_number) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/helpers/assignment_helper.rb''&lt;br /&gt;
*** SOLUTION: Modify the existing method assignment_questionnaire(assignment, type, number) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/helpers/assignment_helper.rb''&lt;br /&gt;
*** SOLUTION: Modify the existing method questionnaire(round = nil) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/models/review_response_map.rb''&lt;br /&gt;
*** SOLUTION: Modify the existing method questionnaire(round) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/models/self_review_response_map.rb''&lt;br /&gt;
*** SOLUTION: Modify the existing method review_questionnaire_id(round = nil) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/models/assignment.rb''&lt;br /&gt;
&lt;br /&gt;
* Use the correct rubric for a particular topic&lt;br /&gt;
** PROBLEM: When finding rubrics to display, save results from, calculate scores from, etc. round may be used but topic is not&lt;br /&gt;
*** SOLUTION: Examine all callers of methods modified in the previous section and pass in ''topic_id'' where appropriate to grab the correct rubric&lt;br /&gt;
*** FILE: (many)&lt;br /&gt;
&lt;br /&gt;
* Support the ability to determine if an assignment has rubrics that vary by topic&lt;br /&gt;
** PROBLEM: There is no handy method to call that can tell us if an assignment has rubrics that vary by topic&lt;br /&gt;
*** SOLUTION: Add a new method ''varying_rubrics_by_topic?'' based on the existing method ''varying_rubrics_by_round?''&lt;br /&gt;
*** FILE: ''app/models/assignment.rb''&lt;br /&gt;
&lt;br /&gt;
=== Q&amp;amp;A ===&lt;br /&gt;
&lt;br /&gt;
Here we paraphrase some questions we received during round 1 of the documentation review.&lt;br /&gt;
&lt;br /&gt;
* Q: How will the new logic for varying rubric by topic tie in with the existing logic?&lt;br /&gt;
** A: We will add a new field ''topic_id'' into the existing table ''assignment_questionnaires'', as noted in the [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Entity_Relationship_Diagram E/R Diagram].  We will update methods that find questionnaires to allow these methods to also accept a ''topic_id'' argument, as noted in [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Implementation Implementation].&lt;br /&gt;
* Q: How will the &amp;quot;Rubric varies by topic&amp;quot; selection be stored?&lt;br /&gt;
** A: Indirectly, by saving records in the ''assignment_questionnaires'' table which either reference a ''topic_id'' or leave this field nil.  For more details please see the [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Entity_Relationship_Diagram E/R Diagram] discussion.&lt;br /&gt;
* Q: What will happen if an instructor selects &amp;quot;Rubric varies by topic&amp;quot;, makes selections on the &amp;quot;Topics&amp;quot; tab, and then deselects &amp;quot;Rubric varies by topic&amp;quot;?&lt;br /&gt;
** A: The Topics tab, when next visited, will no longer show dropdowns for selecting rubrics by topic.  When the assignment is saved, the appropriate not-varying-by-topic records will be saved in the ''assignment_questionnaires'' table.  For more details please see [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Implementation Implementation].&lt;br /&gt;
* Q: What will happen after an instructor selects &amp;quot;Rubric varies by topic&amp;quot;?&lt;br /&gt;
** A: The Topics tab, when next visited, will now show dropdowns for selecting rubrics by topic.  These rubrics will default to those shown on the Rubrics tab.  When the assignment is saved, the appropriate varying-by-topic records will be saved in the ''assignment_questionnaires'' table.  For more details please see [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Implementation Implementation].&lt;br /&gt;
* Q: How will the appropriate list of questionnaires for the new dropdowns on the Topics tab be determined?&lt;br /&gt;
** A: In the same way that the appropriate list of questionnaires for the existing dropdowns on the Rubrics tab is determined.  Namely, by the ''questionnaire_options'' method in the file ''expertiza/app/helpers/assignment_helper.rb''.&lt;br /&gt;
&lt;br /&gt;
=== (Selected) Modified Code ===&lt;br /&gt;
&lt;br /&gt;
In this section, we provide ''selected portions'' of modified code to illustrate how we implemented the new feature.&lt;br /&gt;
&lt;br /&gt;
Allow an instructor to indicate that rubric should vary by topic&lt;br /&gt;
&lt;br /&gt;
''app\views\assignments\edit\_rubrics.html.erb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;lt;input name=&amp;quot;vary_by_topic&amp;quot; type=&amp;quot;hidden&amp;quot; value=&amp;quot;false&amp;quot; /&amp;gt;&lt;br /&gt;
  &amp;lt;%= check_box_tag('vary_by_topic', 'true', @review_vary_by_topic_check) %&amp;gt;&lt;br /&gt;
  &amp;lt;%= label_tag('vary_by_topic', 'Review rubric varies by topic?') %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Allow an instructor to choose different rubrics for different topics&lt;br /&gt;
&lt;br /&gt;
''app\views\sign_up_sheet\_table_line.html.erb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;lt;% if @assignment_form.assignment.varying_rubrics_by_topic? %&amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;table id = &amp;lt;%=table_id %&amp;gt;&amp;gt;&lt;br /&gt;
        &amp;lt;tr&amp;gt;&lt;br /&gt;
          &amp;lt;script&amp;gt;&lt;br /&gt;
              ...&lt;br /&gt;
              &amp;lt;% if @assignment_form.assignment.varying_rubrics_by_round? %&amp;gt;&lt;br /&gt;
                &amp;lt;% for round in 1..@assignment_form.assignment.rounds_of_reviews %&amp;gt;&lt;br /&gt;
                  ...&lt;br /&gt;
                &amp;lt;% end %&amp;gt;&lt;br /&gt;
              &amp;lt;% else %&amp;gt;&lt;br /&gt;
                ...&lt;br /&gt;
              &amp;lt;% end %&amp;gt;&lt;br /&gt;
          &amp;lt;/script&amp;gt;&lt;br /&gt;
        &amp;lt;/tr&amp;gt;&lt;br /&gt;
      &amp;lt;/table&amp;gt;&lt;br /&gt;
    &amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Support the ability of the database to link rubrics to topics&lt;br /&gt;
&lt;br /&gt;
''app\models\sign_up_topic.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  class SignUpTopic &amp;lt; ActiveRecord::Base&lt;br /&gt;
    ...&lt;br /&gt;
    has_many :assignment_questionnaires, class_name: 'AssignmentQuestionnaire', foreign_key: 'topic_id', dependent: :destroy&lt;br /&gt;
    ...&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
React to an instructor saving an assignment after altering the rubrics-vary-by-topic checkbox&lt;br /&gt;
&lt;br /&gt;
''app/controllers/assignments_controller.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def update&lt;br /&gt;
    ...&lt;br /&gt;
    # What to do next depends on how we got here&lt;br /&gt;
    if params['button'].nil?&lt;br /&gt;
      # REFRESH the topics tab after changing tabs&lt;br /&gt;
      ...&lt;br /&gt;
      render :partial =&amp;gt; &amp;quot;assignments/edit/topics&amp;quot;&lt;br /&gt;
    else&lt;br /&gt;
      # SAVE button was used (do a redirect)&lt;br /&gt;
      redirect_to edit_assignment_path @assignment_form.assignment.id&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Support the ability to find the correct rubric for a particular topic&lt;br /&gt;
&lt;br /&gt;
''app/helpers/assignment_helper.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def assignment_questionnaire(assignment, questionnaire_type, round_number = nil, topic_id = nil)&lt;br /&gt;
    q_by_type = assignment.questionnaires.find_by(type: questionnaire_type)&lt;br /&gt;
    if q_by_type.nil?&lt;br /&gt;
      ...&lt;br /&gt;
    else&lt;br /&gt;
      ...&lt;br /&gt;
      aq_by_type = assignment.assignment_questionnaires.find_by(questionnaire_id: q_by_type.id)&lt;br /&gt;
      if round_number.nil? &amp;amp;&amp;amp; topic_id.nil?&lt;br /&gt;
        # Find by type&lt;br /&gt;
        aq = aq_by_type&lt;br /&gt;
      elsif topic_id.nil?&lt;br /&gt;
        # Find by round&lt;br /&gt;
        aq = assignment.assignment_questionnaires.find_by(used_in_round: round_number)&lt;br /&gt;
      elsif round_number.nil?&lt;br /&gt;
        # Find by topic&lt;br /&gt;
        aq = assignment.assignment_questionnaires.find_by(topic_id: topic_id)&lt;br /&gt;
      else&lt;br /&gt;
        # Find by round and topic&lt;br /&gt;
        aq = assignment.assignment_questionnaires.where(used_in_round: round_number, topic_id: topic_id).first&lt;br /&gt;
      end&lt;br /&gt;
      aq.nil? ? aq_by_type : aq&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use the correct rubric for a particular topic&lt;br /&gt;
&lt;br /&gt;
''app\controllers\response_controller.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def set_questionnaire_for_new_response&lt;br /&gt;
    case @map.type&lt;br /&gt;
    when &amp;quot;ReviewResponseMap&amp;quot;, &amp;quot;SelfReviewResponseMap&amp;quot;&lt;br /&gt;
      reviewees_topic = SignedUpTeam.topic_id_by_team_id(@contributor.id)&lt;br /&gt;
      @current_round = @assignment.number_of_current_round(reviewees_topic)&lt;br /&gt;
      @questionnaire = @map.questionnaire(@current_round, reviewees_topic)&lt;br /&gt;
    when&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Support the ability to determine if an assignment has rubrics that vary by topic&lt;br /&gt;
&lt;br /&gt;
''app\models\assignment.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def varying_rubrics_by_topic?&lt;br /&gt;
    aq_no_topic_id = AssignmentQuestionnaire.where(assignment_id: self.id, topic_id: nil).size &amp;gt;= 1&lt;br /&gt;
    aq_with_topic_id = AssignmentQuestionnaire.where(assignment_id: self.id).where.not(topic_id: nil).size &amp;gt;= 1&lt;br /&gt;
    if !aq_no_topic_id &amp;amp;&amp;amp; !aq_with_topic_id&lt;br /&gt;
      return false&lt;br /&gt;
    elsif aq_no_topic_id &amp;amp;&amp;amp; !aq_with_topic_id&lt;br /&gt;
      return false&lt;br /&gt;
    elsif !aq_no_topic_id &amp;amp;&amp;amp; aq_with_topic_id&lt;br /&gt;
      return true&lt;br /&gt;
    else&lt;br /&gt;
      raise StandardError.new(&amp;quot;Assignment with id &amp;quot; + self.id.to_s + &amp;quot; has a conflict about whether or not it varies by topic&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== How To ==&lt;br /&gt;
&lt;br /&gt;
In this section, we describe how to use the newly implemented feature.&lt;br /&gt;
&lt;br /&gt;
(Log in as an Instructor)&lt;br /&gt;
&lt;br /&gt;
=== Specify Rubrics should vary by Topic ===&lt;br /&gt;
# Navigate to Edit page for an Assignment.&lt;br /&gt;
# Click the Rubrics tab.&lt;br /&gt;
# Check the &amp;quot;Review rubric varies by topic?&amp;quot; checkbox.&lt;br /&gt;
&lt;br /&gt;
=== Select a Rubric for a Topic ===&lt;br /&gt;
After checking the &amp;quot;Review rubric varies by topic?&amp;quot; checkbox,&lt;br /&gt;
# Click the Topics tab.&lt;br /&gt;
# Select the appropriate Rubric from the dropdown menu(s) beside each Topic.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
See also: [https://www.youtube.com/watch?v=F7nQsIUspQM Video Demonstration of Specialized Rubrics]&lt;br /&gt;
&lt;br /&gt;
== Project Testing ==&lt;br /&gt;
&lt;br /&gt;
=== Strategy ===&lt;br /&gt;
&lt;br /&gt;
To test code implementation, correctness of the added feature, verify that the team did not break any existing functionalities in the Expertiza, and ensure that no bugs were introduced in the code, we developed the following Test Strategy:&lt;br /&gt;
&lt;br /&gt;
# Code inspection&lt;br /&gt;
# Run and pass existing RSpec Tests&lt;br /&gt;
# Develop New RSpec Tests&lt;br /&gt;
# Run through live UI to test a feature using Expertiza instance&lt;br /&gt;
&lt;br /&gt;
=== Rspec Testing ===&lt;br /&gt;
&lt;br /&gt;
==== Existing Tests ====&lt;br /&gt;
&lt;br /&gt;
Run all existing RSpec tests on any changed files, after our changes, to ensure that we have not introduced any failures.&lt;br /&gt;
The commands and results are shown below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
e@ubuntu:~/Desktop/CSC517_HW04/expertiza$ bundle exec rspec spec/helpers/ spec/controllers/ spec/models/&lt;br /&gt;
[Coveralls] Set up the SimpleCov formatter.&lt;br /&gt;
[Coveralls] Using SimpleCov's 'rails' settings.&lt;br /&gt;
&lt;br /&gt;
Randomized with seed 6978&lt;br /&gt;
[...]&lt;br /&gt;
&lt;br /&gt;
Finished in 8 minutes 10 seconds (files took 12.32 seconds to load)&lt;br /&gt;
900 examples, 0 failures, 16 pending&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The features tests were extremely time-consuming so we did not routinely run them during development.  However TravisCI results on our [https://github.com/expertiza/expertiza/pull/1444 Pull Request] demonstrate the passing status of all tests.&lt;br /&gt;
&lt;br /&gt;
==== New Tests ====&lt;br /&gt;
&lt;br /&gt;
Write comprehensive RSpec tests, for all new or modified methods.&lt;br /&gt;
* FILE: ''spec/helpers/assignment_helper_spec.rb''&lt;br /&gt;
** METHODS TO TEST: &lt;br /&gt;
*** questionnaire(assignment, type, round_number, topic_id)&lt;br /&gt;
*** assignment_questionnaire(assignment, type, number, topic_id)&lt;br /&gt;
* FILE: ''spec/models/review_response_map_spec.rb''&lt;br /&gt;
*** METHODS TO TEST:&lt;br /&gt;
**** questionnaire(round, topic_id)&lt;br /&gt;
* FILE: ''spec/models/self_review_response_map_spec.rb''&lt;br /&gt;
*** METHODS TO TEST:&lt;br /&gt;
**** questionnaire(round, topic_id)&lt;br /&gt;
* FILE: ''spec/models/assignment_spec.rb''&lt;br /&gt;
*** METHODS TO TEST:&lt;br /&gt;
**** review_questionnaire_id(round, topic_id)&lt;br /&gt;
**** varying_rubrics_by_topic?()&lt;br /&gt;
&lt;br /&gt;
Run these tests, to ensure that the new code works as intended.&lt;br /&gt;
The commands and results are shown below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
e@ubuntu:~/Desktop/CSC517_HW04/expertiza$ bundle exec rspec spec/helpers/assignment_helper_spec.rb spec/models/review_response_map_spec.rb spec/models/self_review_response_map_spec.rb spec/models/assignment_spec.rb &lt;br /&gt;
[Coveralls] Set up the SimpleCov formatter.&lt;br /&gt;
[Coveralls] Using SimpleCov's 'rails' settings.&lt;br /&gt;
&lt;br /&gt;
Randomized with seed 47508&lt;br /&gt;
....................................................................................................................&lt;br /&gt;
&lt;br /&gt;
Finished in 1 minute 7.94 seconds (files took 10.85 seconds to load)&lt;br /&gt;
116 examples, 0 failures&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The test suite for a single new method is shown below.&lt;br /&gt;
* There are many such suites added in expertiza/spec  &lt;br /&gt;
* This example illustrates our general strategy:&lt;br /&gt;
** test missing input&lt;br /&gt;
** test bad input&lt;br /&gt;
** test various acceptable forms of input&lt;br /&gt;
** test scenarios that lead to various return values&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  describe &amp;quot;#questionnaire&amp;quot; do&lt;br /&gt;
&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;throws exception if assignment argument nil&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;throws exception if all arguments nil except for assignment&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;finds by type if round number &amp;amp; topic id not given&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;throws exception if round number &amp;amp; topic id not given, no luck finding by type&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;finds by round number alone if round number alone is given&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;creates new questionnaire of given type if round number alone is given, no luck finding by round&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;finds by topic id alone if topic id alone is given&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;creates new questionnaire of given type if topic id alone is given, no luck finding by topic&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;finds by round number and topic id if both are given&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;creates new questionnaire of given type if round and topic are given, no luck finding by round and topic&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== UI Testing ===&lt;br /&gt;
&lt;br /&gt;
Here we describe manual UI Testing that was performed.&lt;br /&gt;
&lt;br /&gt;
==== Rubric does not vary by round or by topic ====&lt;br /&gt;
&lt;br /&gt;
* Go to Rubrics tab and verify that both &amp;quot;Review rubric varies by round?&amp;quot; and &amp;quot;Review rubric varies by topic?&amp;quot; checkboxes are unchecked.&lt;br /&gt;
* Go to Topics tab and verify that there are no dropdown menus beside each Topic.&lt;br /&gt;
&lt;br /&gt;
==== Rubric varies by round, but not by topic ====&lt;br /&gt;
&lt;br /&gt;
* Go to Rubrics tab and verify that &amp;quot;Review rubric varies by round?&amp;quot; is checked and &amp;quot;Review rubric varies by topic?&amp;quot; is unchecked.&lt;br /&gt;
* Go to Topics tab and verify that there are no dropdown menus beside each Topic.&lt;br /&gt;
&lt;br /&gt;
==== Rubric varies by topic, but not by round ====&lt;br /&gt;
&lt;br /&gt;
* Go to Rubrics tab and verify that &amp;quot;Review rubric varies by round?&amp;quot; is unchecked and &amp;quot;Review rubric varies by topic?&amp;quot; is checked.&lt;br /&gt;
* Go to Topics tab and verify that there is only 1 dropdown menu beside each Topic.&lt;br /&gt;
&lt;br /&gt;
==== Rubric varies by both round and topic ====&lt;br /&gt;
&lt;br /&gt;
* Go to Rubrics tab and verify that both &amp;quot;Review rubric varies by round?&amp;quot; and &amp;quot;Review rubric varies by topic?&amp;quot; checkboxes are checked.&lt;br /&gt;
* Go to Topics tab and verify that there is 1 dropdown menu per round for each Topic.&lt;br /&gt;
&lt;br /&gt;
==== Updates rejected if Rubric weights do not add up to 100% or 0% ====&lt;br /&gt;
&lt;br /&gt;
* Go to Rubrics tab and check the &amp;quot;Review rubric varies by topic?&amp;quot; checkbox. &lt;br /&gt;
* Change weight values for the Rubrics so that they add up to 97%.&lt;br /&gt;
* Go to Topics tab and verify that checking the &amp;quot;Review rubric varies by topic?&amp;quot; checkbox did not work.&lt;br /&gt;
* Verify that there are no dropdown menus beside each Topic.&lt;br /&gt;
* Verify that the proper error message is shown.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
In CSC/ECE 517, there are several types of topics that could be covered in a single class assignment.  However, currently we can only specify one kind of rubric for an assignment. This means that teams working on different topics will be evaluated using the same rubric. With this setup, it's not possible to fine-tune rubrics for different topics - rubrics tend to be overly general.&lt;br /&gt;
&lt;br /&gt;
In this project, we have solved this issue, by allowing rubrics to vary not only by round, but also by topic. This allows more flexibility to the instructor when setting up an assignment, so that they can use rubrics better suited to the tasks that students are performing in an assignment.  The following scenarios will be possible, and the instructor will be the judge of which scenario is the best fit to the assignment:&lt;br /&gt;
&lt;br /&gt;
* Rubric does not vary by round or by topic.&lt;br /&gt;
* Rubric varies by round, but not by topic.&lt;br /&gt;
* Rubric varies by topic, but not by round.&lt;br /&gt;
* Rubric varies by both round and topic.&lt;br /&gt;
&lt;br /&gt;
The instructor may use the Rubrics tab of the assignments edit page to make changes to the &amp;quot;Review rubric varies by round?&amp;quot; and &amp;quot;Review rubric varies by topic?&amp;quot; checkboxes.  The instructor may then use the Topics tab to select the appropriate rubric(s) for every topic in the assignment.&lt;br /&gt;
&lt;br /&gt;
Various other Expertiza code has been updated to retrieve the correct rubric depending on round and topic after the instructor has made these selections.&lt;br /&gt;
&lt;br /&gt;
== Future Work ==&lt;br /&gt;
&lt;br /&gt;
This section discusses possible future work for another CSC 517 team to take on.  Such a team can search the Expertiza codebase for &amp;quot;TODO E1936 (future work)&amp;quot; to find most of the places in the code that the notes below refer to.&lt;br /&gt;
&lt;br /&gt;
* Reduce the delay between changing the state of the &amp;quot;Review rubric varies by topic?&amp;quot; checkbox on the Rubrics tab, and the show / hide of rubric drop-downs on the Topics tab.&lt;br /&gt;
* Redesign UI for tone analysis, heatmaps, and review scores pop-up.  These areas are designed around the assumption that reviews do NOT vary by topic.  For example, in the review scores pop-up, a reviewer can see the reviews they have given, arranged by question, across multiple reviewees.&lt;br /&gt;
* Consider whether the questionnaire options available for selection in drop-downs on the Topics and Rubrics tabs should include ''only'' those questionnaires created by the currently-logged-in instructor.  Our work in this project changed the filtering from instructor-owning-assignment to currently-logged-in instructor - but left in place all non-private questionnaires.  ''Consider'' whether non-private questionnaires should be excluded.  This may result in some drop-downs not having any available questionnaires.&lt;br /&gt;
&lt;br /&gt;
== Useful Links ==&lt;br /&gt;
In this section we provide useful links related to the work that has been completed by our team.&lt;br /&gt;
# [https://github.com/gabalmat/expertiza Forked Project Repository]&lt;br /&gt;
# [https://github.com/expertiza/expertiza/pull/1444 Pull Request]&lt;br /&gt;
# [https://www.youtube.com/watch?v=F7nQsIUspQM Video Demonstration of Specialized Rubrics]&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Contacts ===&lt;br /&gt;
We have 4 (four) members in our team and 1 (one) mentor was also assigned to us. For any project-related questions/concerns please contact us:&lt;br /&gt;
* Aurora Tiffany-Davis - attiffan@ncsu.edu&lt;br /&gt;
* Ginger Balmat - gabalmat@ncsu.edu&lt;br /&gt;
* Joe Hutchinson - jehutch3@ncsu.edu&lt;br /&gt;
* Nikolay Titov - ngtitov@ncsu.edu&lt;br /&gt;
* Zhewei Hu (mentor) - zhu6@ncsu.edu&lt;br /&gt;
&lt;br /&gt;
=== Contribution Based Inquiry ===&lt;br /&gt;
For any questions or concerns related to the project design, implementation, testing of the feature developed by our team, please contact an engineer who worked closely on the topic of your interest based on the [https://docs.google.com/spreadsheets/d/11uxuI_5gaC-FQDwIOxtCaN3HZ9bfWDJgIjFemtYV5jE/edit?ts=5ca222f3#gid=0 Contribution Assignment Grid] we created to keep track of our progress and contribution. Please carbon copy all team members and our mentor in the email.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* Expertiza Web [https://github.com/expertiza/expertiza#expertiza]&lt;br /&gt;
* Expertiza on GitHub [https://github.com/expertiza/expertiza]&lt;br /&gt;
* Expertiza Wiki [http://wikis.lib.ncsu.edu/index.php/Expertiza]&lt;br /&gt;
* Rspec Documentation [https://relishapp.com/rspec]&lt;br /&gt;
* Wiki with Previous Work [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1873_Specialized_rubics_for_different_topic_types]&lt;br /&gt;
* Pull Request of the Previous Work [https://github.com/expertiza/expertiza/pull/1327]&lt;/div&gt;</summary>
		<author><name>Ngtitov</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics&amp;diff=124496</id>
		<title>E1936 Specialized Rubrics</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics&amp;diff=124496"/>
		<updated>2019-04-26T16:16:50Z</updated>

		<summary type="html">&lt;p&gt;Ngtitov: /* Project Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page describes the work and goals that have been completed and achieved while implementing Expertiza Project &amp;quot;''E1936. Specialized Rubrics for Different Topic Types (e.g., Servo project, refactoring project)''&amp;quot; for the CSC/ECE 517 &amp;quot;Object-Oriented Design and Development&amp;quot; class, in the Spring semester of the 2019.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This Wiki page is created per CSC/ECE 517: &amp;quot;Object-Oriented Design and Development&amp;quot;, Expertiza Project requirements (Spring, 2019).&lt;br /&gt;
&lt;br /&gt;
Our [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Team team] was assigned the project &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936. Specialized rubrics for different topic types (e.g., Servo project, refactoring project)]&amp;quot;.  This is an Expertiza project.&lt;br /&gt;
&lt;br /&gt;
In this wiki page we describe the problem to be solved, how we solve that problem, and how we test our solution.  We also provide helpful links and contact information for our team.&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
In this section, we discuss the problem we need to solve, the Expertiza feature this problem is related to, what needs to be done to solve the problem (at a high level), and the previous attempt to solve this problem.&lt;br /&gt;
&lt;br /&gt;
=== Problem Statement ===&lt;br /&gt;
&lt;br /&gt;
This problem statement summarizes the problem as described in the project description &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936. Specialized rubrics for different topic types (e.g., Servo project, refactoring project)]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
In CSC/ECE 517, there are several types of topics that could be covered in a single class assignment.&lt;br /&gt;
* Code base&lt;br /&gt;
** Expertiza&lt;br /&gt;
** Mozilla&lt;br /&gt;
** etc.&lt;br /&gt;
* Goal&lt;br /&gt;
** Refactoring&lt;br /&gt;
** Testing&lt;br /&gt;
** etc.&lt;br /&gt;
However, currently we can only specify one kind of rubric for an assignment.  This means that teams working on different topics will be evaluated using the same rubric.  With this setup, it's not possible to fine-tune rubrics for different topics - rubrics tend to be overly general.&lt;br /&gt;
&lt;br /&gt;
=== Feature Description ===&lt;br /&gt;
&lt;br /&gt;
The Expertiza project already has a feature that allows rubrics to vary by project phase or &amp;quot;round&amp;quot;.  The feature we will add in this project is a feature to allow rubrics to vary not only by round, but also by topic.  This allows more flexibility to the instructor when setting up an assignment, so that they can use rubrics better suited to the tasks that students are performing in an assignment.&lt;br /&gt;
&lt;br /&gt;
When this feature is complete, the following scenarios will be possible, and the instructor will be the judge of which scenario is the best fit to the assignment:&lt;br /&gt;
&lt;br /&gt;
* Rubric does not vary by round or by topic.&lt;br /&gt;
* Rubric varies by round, but not by topic.&lt;br /&gt;
* Rubric varies by topic, but not by round.&lt;br /&gt;
* Rubric varies by both round and topic.&lt;br /&gt;
&lt;br /&gt;
=== What Needs to be Done ===&lt;br /&gt;
&lt;br /&gt;
This section summarizes the work as described in the project description &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936. Specialized rubrics for different topic types (e.g., Servo project, refactoring project)]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* In assignment#edit page &amp;quot;Rubrics&amp;quot; tab, add a checkbox to specify whether rubric should vary by topic.&lt;br /&gt;
* In assignment#edit page &amp;quot;Topics&amp;quot; tab, add dropdown(s) next to each topic to specify which rubric(s) are associated with the topic.&lt;br /&gt;
** The dropdown(s) should appear only if rubric should vary by topic, per the Rubrics tab.&lt;br /&gt;
** The topic should have a multiple dropdowns (one for each round) only if rubrics vary by round, per the Rubrics tab.&lt;br /&gt;
** By default, the rubric(s) for each course project will be the one(s) specified in “Rubrics” tab.&lt;br /&gt;
** The dropdown value can overwrite the default rubric.&lt;br /&gt;
* Be careful when making changes to the code&lt;br /&gt;
** The signup_sheet_controller should have as little to do as possible with the selection of rubrics.&lt;br /&gt;
** Anything not germane to selecting topics should be in another controller or (more probably) a helper.&lt;br /&gt;
* Create a DB migration to allow rubric to vary by topic as well as by round.&lt;br /&gt;
&lt;br /&gt;
==== Screenshots ====&lt;br /&gt;
'''Current screenshot of Rubrics tab for an Assignment'''&lt;br /&gt;
(need to add a checkbox to indicate that rubric should vary by topic)&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Screenshot Assignment Edit Rubrics.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Current screenshot of Topics tab for an Assignment'''&lt;br /&gt;
(need to add a way to select rubrics for particular topics)&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Screenshot Assignment Edit Topics.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Proposed screenshot of Rubrics tab for an Assignment'''&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Specialized Rubric rubric checkbox.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Proposed screenshot of Topics tab for an Assignment'''&lt;br /&gt;
&lt;br /&gt;
(drop down shown for only one topic here, but final product will have one for each topic)&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Specialized Rubric dropdown menu.png]]&lt;br /&gt;
&lt;br /&gt;
== Previous Work ==&lt;br /&gt;
&lt;br /&gt;
There was previous attempt to implement this project in the Fall of 2018 semester by different team, but it was rejected due to several reasons. As a result our team was assigned to complete this project with the given implementation. However, after detailed investigation of the proposed design that team has made in the previous semester and review of the code changes, we proposed different architectural solution for the problem, which we believe is simpler, more efficient, and elegant solution.&lt;br /&gt;
&lt;br /&gt;
=== Previous Project Implementation ===&lt;br /&gt;
&lt;br /&gt;
Our team was provided with all relevant information and materials about the design and implementation of the previously attempted project. We would like to acknowledge that we use previous implementation and design as reference and our starting point for our own implementation. The following is the list of links with the relevant materials that we have used for better project understanding, determining pros and cons of previously proposed changes, and establishing our design strategy and implementation:&lt;br /&gt;
&lt;br /&gt;
# [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1873_Specialized_rubics_for_different_topic_types Wiki]&lt;br /&gt;
# [https://github.com/expertiza/expertiza/pull/1327 Pull Request]&lt;br /&gt;
# [https://drive.google.com/file/d/1UrLb0Ula_Lb_F4MOrdC-s6xng6B08VYu/view Video Demo]&lt;br /&gt;
&lt;br /&gt;
After reviewing all relevant materials above, we concluded that the project implementation was incomplete and proposed design had significant flaw. &lt;br /&gt;
We identified main drawbacks and flaw as follows:&lt;br /&gt;
&lt;br /&gt;
* Establishing incorrect ''many-to-one'' relationship between ''sign_up_topics'' and ''questionnaires'' tables:&lt;br /&gt;
** Creating a DB migration to add ''questionnaire_id'' in the ''sign_up_topics'' table to store the dropdown data presumes ''one-to-one'' or ''many-to-one'' relationship between ''sign_up_topics'' and ''questionnaires'' tables&lt;br /&gt;
** Correct relationship between ''sign_up_topics'' and ''questionnaires'' tables is ''many-to-many''. For example, each project topic may have various rubrics depending on the round it is used (e.g., for round 1, topic may have one rubric; but for round 2, the same topic may have different rubric)&lt;br /&gt;
** Proposed previous migration changes would break DB design and would not allow to store correctly topic and its associated rubric per different round.&lt;br /&gt;
* Per project requirement specifications, &amp;quot;''The dropdown box should appear only if 'Vary rubric by topic' is selected in the Rubrics tab.''&amp;quot; This requirement was not met and ''Vary rubric by topic'' checkbox in the Rubrics tab was not implemented. Therefore, dropdown box with the list of rubrics appears regardless of whether &amp;quot;''Vary rubric by topic''&amp;quot; is selected or not.&lt;br /&gt;
* The dropdown box includes the list of all possible rubrics including default value. However, this condition can be improved. The dropdown box should list the rubrics that were created by the current user (professor who is logged in). This would allow to shorten the list of possible rubrics dramatically and help to avoid any misunderstanding and confusion while user selects desired rubric for the course project.&lt;br /&gt;
&lt;br /&gt;
We found no further issues with the rest implementation and in other project materials. Wiki page is very useful for understanding design of proposed changes, finding drawbacks and the flaw. Considering all the pros and cons, and taking into account drawbacks of the proposed changes, our team evolved different approach that should successfully solve the problem stated for the project without without creating additional issues. Please see our [http://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics#Project_Implementation Project Implementation] for more details.&lt;br /&gt;
&lt;br /&gt;
=== Previous Project Requirements ===&lt;br /&gt;
&lt;br /&gt;
The project requirements originally specified how to alter the databases to support varying rubrics by topic.&lt;br /&gt;
&lt;br /&gt;
''Create a new table named topic_questionnaires with field:''&lt;br /&gt;
* ''id''&lt;br /&gt;
* ''topic_id''&lt;br /&gt;
* ''questionnaire_id''&lt;br /&gt;
* ''used_in_round''&lt;br /&gt;
&lt;br /&gt;
However, the E1936 team successfully petitioned for this requirement to change to give us more freedom in the implementation.  The original suggestion had a flaw.  There is already an existing table in the Expertiza project called ''assignment_questionnaires'', which has columns including ''assignment_id'', ''questionnaire_id'', and ''used_in_round''.  It is this table that maintains the knowledge of which rubric is used in which round of an assignment.  If we were to add a new table to maintains the knowledge of which rubric is used in which topic of an assignment as originally suggested, then we would have a big problem.  Knowledge of round-rubric relationship is duplicated.  This would lead (best case scenario) to extra work, and (worst case scenario) to lots of bugs caused by inconsistencies in how these tables are handled with CRUD operations throughout the code.  In other words, this is not a DRY solution.&lt;br /&gt;
&lt;br /&gt;
== Project Implementation ==&lt;br /&gt;
&lt;br /&gt;
In this section, we propose our solution to the problem with the set of UML diagrams, discuss implementation techniques and details, and list the goals we achieved.&lt;br /&gt;
&lt;br /&gt;
We start by proposing our solution to the problem utilizing UML diagrams that include Use case, Entity Relationship, Class, and Sequence diagrams! Further, we discuss design strategy by breaking project problem into multiple staged sub-problems and provide solutions for each of these sub-problems. We also discuss some design strategies in the form of problem - solution, and provide the list of involved files. To illustrate implementation details for different tasks we decided to include selected (only) modified code where pseudocode-like solution is provided for each major task in this project. Finally, since we received some common questions and misunderstanding during first peer review period, we include Q/A section, where we provide an answer to each common question and concern we received.&lt;br /&gt;
&lt;br /&gt;
=== UML Diagrams ===&lt;br /&gt;
&lt;br /&gt;
Our solution and implementation of the project can be easily shown by discussing Use Case, Entity Relationship, and Class diagrams. First, for simplicity we discuss in general possible sequence of interactions between a user (in this case instructor) and the system (Expertiza) via presenting Use Case Diagram. Then we plan to show proposed database modification via Entity Relationship Diagram. At this point the high-level design and proposed changes should be clear. To make our design more concrete and dive into implementation level, we decided to provide UML Class diagram. Finally, to demonstrate our achievements, we complete this section with the UML Sequence diagram to illustrate interactive behavior of a system with utilized specialized rubrics feature.&lt;br /&gt;
&lt;br /&gt;
==== Use Case Diagram ====&lt;br /&gt;
&lt;br /&gt;
[[File: use_case_diagram_1936.png]]&lt;br /&gt;
&lt;br /&gt;
The above Use Case Diagram shows general sequence of interactions between an instructor and the system (Expertiza) that defines where and how the feature can be utilized. Note that highlighted use cases are objects of our interest and work. Also please note that all of the shown use cases already exist in the system and we simply added a new feature into the system with existing use cases. Particularly, the rubric for each assignment and newly added ''Review rubric varies by topic'' checkbox with which instructor may choose to vary assignment by topic or not, by checking and unchecking the checkbox is displayed in the ''Rubrics'' tab. Hence, we show how instructor can get to the ''Rubrics'' tab of the assignments. Similarly, ''Topics'' tab of assignments has additional ''Questionnaires'' column for each topic, where instructor may specify which rubric associates with which topic. To perform this sequence of interactions and utilize the new feature, instructor must choose ''Edit'' any assignment from the list of all assignments displayed to him/her in the ''Manage Assignments'' page, which can be navigated by instructor by selecting it from the header of the system.&lt;br /&gt;
&lt;br /&gt;
==== Entity Relationship Diagram ====&lt;br /&gt;
&lt;br /&gt;
[[File: HW04_ERD.png]]&lt;br /&gt;
&lt;br /&gt;
The sections of the diagram highlighted in yellow show newly introduced items.  That is, we are adding a new column called ''topic_id'' to ''assignment_questionnaires'', in order to link ''assignment_questionnaires'' to ''sign_up_topics''.&lt;br /&gt;
&lt;br /&gt;
Any assignment, topic, or questionnaire may be represented by multiple records within ''assignment_questionnaires'', but each record within ''assignment_questionnaires'' refers to just one assignment, topic, or questionnaire.  It is the ability to have an assignment represented by multiple records, and the new relationship to ''sign_up_topics'', that allows us to support all of the required scenarios:&lt;br /&gt;
&lt;br /&gt;
* Rubric does not vary by round or by topic.&lt;br /&gt;
* Rubric varies by round, but not by topic.&lt;br /&gt;
* Rubric varies by topic, but not by round.&lt;br /&gt;
* Rubric varies by both round and topic.&lt;br /&gt;
&lt;br /&gt;
[[File: HW04_table.PNG]]&lt;br /&gt;
&lt;br /&gt;
This table illustrates the possibilities that the system may have.&lt;br /&gt;
&lt;br /&gt;
* Assignment 1 does not vary by round or by topic.&lt;br /&gt;
* Assignment 2 varies by round, but not by topic.&lt;br /&gt;
* Assignment 3 varies by topic, but not by round.&lt;br /&gt;
* Assignment 4 varies by both round and topic.&lt;br /&gt;
&lt;br /&gt;
This change is done via database migration by running the following commands:&lt;br /&gt;
&lt;br /&gt;
  rails generate migration AddTopicIdToAssignmentQuestionnaires&lt;br /&gt;
&lt;br /&gt;
Above command adds the ''topic_id'' column to the ''AssignmentQuestionnaires'' table and generates new migration file:&lt;br /&gt;
&lt;br /&gt;
[[File: db_migration.png]]&lt;br /&gt;
&lt;br /&gt;
To see the details of the entire database change please check this [https://github.com/gabalmat/expertiza/commit/d46dd57d35a21ab43efb82c28d3f14b75c695f2e commit].&lt;br /&gt;
&lt;br /&gt;
==== Class Diagram ====&lt;br /&gt;
&lt;br /&gt;
[[File: class_diagram_1936.png]]&lt;br /&gt;
&lt;br /&gt;
The above UML Class diagram describes the changes our team made in the Ruby classes, methods and attributes. Please note that all provided classes in the diagram had already existed in the system, and we only added new relationship, modified existing methods (and some method signatures) and utilized given attributes. All of the class's attributes and methods that are shown in the diagram are utilized (directly and indirectly) in our current implementation. Some of the methods and attributes provided within the classes in the diagram are newly developed. There is only one newly added aggregation relationship between the ''SingUpTopic'' class and ''AssignmentQuestionnaire'' class. Moreover, controllers and models for the certain classes were combined into a single class for simplicity to the design description. In reality, half of the methods shown in  the ''Assignment'' class are implemented in the ''app/controllers/assignments_controller.rb'' file and other half is in the ''app/models/assignment.rb'' file. We decided to combine all of the functionalities of each ''relevant'' controller and model class into single class for the ease of design presentation and interpretation. We used Sequence diagram below to illustrate how MVC architectural pattern is used for a given classes.&lt;br /&gt;
&lt;br /&gt;
==== Sequence Diagram ====&lt;br /&gt;
&lt;br /&gt;
This is Sequence Diagram.&lt;br /&gt;
&lt;br /&gt;
=== Design Strategy ===&lt;br /&gt;
&lt;br /&gt;
As we have concrete understanding of the problem and proposed solution, we would like break this problem into multiple more manageable sub-problems with specific tasks and well-defined solutions to these tasks. Generally, each sub-problem requires modification of one or more files. We would like to propose our Design Strategy as follows:&lt;br /&gt;
&lt;br /&gt;
==== Preparation ====&lt;br /&gt;
&lt;br /&gt;
* Clean up code that our implementation will use&lt;br /&gt;
** PROBLEM: We need to add/change content to the edit assignment Topics tab, but unlike other tabs in the views, it does not have its own partial view to work with&lt;br /&gt;
*** SOLUTION: Refactor and move the code dealing with topics into separate ''app/views/assignments/edit/_topics.html.erb'' file&lt;br /&gt;
*** File: ''app/views/assignments/edit.html.erb''&lt;br /&gt;
** PROBLEM: In a section below, we discuss the need to modify existing methods to also accept an optional argument ''topic_id''.  In many cases these existing method use confusing variable names or lack sufficient comments.&lt;br /&gt;
*** SOLUTION: Clean up methods that we plan to modify&lt;br /&gt;
*** FILE: (many)&lt;br /&gt;
&lt;br /&gt;
==== Implementation ====&lt;br /&gt;
&lt;br /&gt;
* Allow an instructor to indicate that rubric should vary by topic&lt;br /&gt;
** PROBLEM: There is no way for an instructor to indicate that an assignments' rubric should vary by topic&lt;br /&gt;
*** SOLUTION: Add a new checkbox in the edit assignment Rubrics tab to indicate this preference&lt;br /&gt;
*** FILE: ''app/views/assignments/edit/_rubrics.html.erb''&lt;br /&gt;
** PROBLEM: If the user changes the &amp;quot;Review rubric varies by round?&amp;quot; or &amp;quot;Review rubric varies by topic?&amp;quot; checkbox on the Rubrics tab, but leaves the page in an inappropriate state before leaving the tab (e.g. rubric weights that do not add up to 0% or 100%), then the user does not get feedback that they made a mistake.  They only get such feedback when explicitly performing a &amp;quot;Save&amp;quot;.  Switching from tab to tab on the assignments edit page attempts to perform an implicit save, but there is no mechanism to update the flash messages onscreen if anything goes wrong.  This becomes more problematic now that the Topics tab appearance depends on choices made on the Rubrics tab.  &lt;br /&gt;
*** SOLUTION: Provide a route to an assignments controller method that can return a render of the flash messages.  Add an AJAX call on the assignments edit view that can update the flash messages onscreen.&lt;br /&gt;
*** FILE: app/controllers/assignments_controller.rb&lt;br /&gt;
*** FILE: app/views/assignments/edit.html.erb&lt;br /&gt;
&lt;br /&gt;
* Allow an instructor to choose different rubrics for different topics&lt;br /&gt;
** PROBLEM: There is no way for an instructor to choose different rubrics for different topics&lt;br /&gt;
*** SOLUTION: Add a new column in the edit assignment Topics tab for choosing rubric(s)&lt;br /&gt;
**** New column only visible if rubrics vary by topic, per Rubrics tab&lt;br /&gt;
**** New column has multiple rounds per topic only if rubrics vary by round, per Rubrics tab&lt;br /&gt;
**** Default value for any rubric is that rubric which is shown on Rubrics tab&lt;br /&gt;
**** Rubric(s) in the dropdown list is/are only those that were created by the currently logged in instructor&lt;br /&gt;
*** FILE: ''app/views/assignments/edit/_topics.html.erb''&lt;br /&gt;
** PROBLEM: The code in ''app/views/assignments/edit/_rubrics.html.erb'' includes dropdowns like the ones we need to add for topics, but that code is way too complex for its functionality (too heavy for a view, uses JavaScript)&lt;br /&gt;
*** SOLUTION: Use the code in ''app/views/assignments/edit/_rubrics.html.erb'' for inspiration only&lt;br /&gt;
**** Refactor and move as much actual work as possible out into helper methods that are simply called from this view&lt;br /&gt;
**** Views are not intended to do heavy lifting&lt;br /&gt;
**** Use as little JavaScript as possible, since this is a Ruby On Rails project, not a JS project&lt;br /&gt;
*** FILE: ''app/views/assignments/edit/_topics.html.erb''&lt;br /&gt;
** PROBLEM: The drop-downs for selecting rubrics should show only those rubrics created by the currently-logged in instructor (per project mentor).  They currently include those created by the instructor of the relevant assignment.&lt;br /&gt;
*** SOLUTION: Change the filtering in the ''questionnaire_options'' method to reflect the desired filtering.&lt;br /&gt;
*** FILE: app/helpers/assignment_helper.rb&lt;br /&gt;
&lt;br /&gt;
* Support the ability of the database to link rubrics to topics&lt;br /&gt;
** PROBLEM: There is no relationship in the database that can link together rubrics with topics&lt;br /&gt;
*** SOLUTION: Add a new migration that adds topic_id field to existing assignment_questionnaires table&lt;br /&gt;
**** This new field will reference the id field in the sign_up_topics table&lt;br /&gt;
*** FILE: ''db/migrate/[timestamp]_add_topic_id_to_assignment_questionnaires_table.rb''&lt;br /&gt;
** PROBLEM: The AssignmentQuestionnaire model does not have any knowledge of topics&lt;br /&gt;
*** SOLUTION: Add a new belongs_to reference in the model, to sign_up_topic&lt;br /&gt;
*** FILE: ''app/models/assignment_questionnaire.rb''&lt;br /&gt;
** PROBLEM: The SignUpTopic model does not have any knowledge of assignment_questionnaire records&lt;br /&gt;
*** SOLUTION: Add a new has_many reference in the model, to assignment_questionnaires&lt;br /&gt;
*** FILE: ''app/models/sign_up_topic.rb''&lt;br /&gt;
&lt;br /&gt;
* React to an instructor saving an assignment after altering the rubrics-vary-by-topic checkbox&lt;br /&gt;
** PROBLEM: There is nothing in place to remember when an instructor chooses to vary rubrics by topic, or chooses to not vary rubrics by topic&lt;br /&gt;
*** SOLUTION: Modify existing method ''update_assignment_questionnaires()''.  This method executes upon assignment save (explicit or via tab-change).  This method deletes all ''AssignmentQuestionnaire'' records before creating new correct records reflecting the user's selections in the edit assignment form.  Modify such that this method can create multiple records reflecting multiple topics, in the case where rubric should vary by topic.  With this modification, the correct records (with default rubrics) are present when the user goes to the Topics tab, so that the Topics tab can display properly.&lt;br /&gt;
*** FILE: app\models\assignment_form.rb&lt;br /&gt;
** PROBLEM: There is no way to refresh the Topics tab to show / hide drop-downs after the instructor changes checkbox on Rubrics tab&lt;br /&gt;
*** SOLUTION: Make use of existing &amp;quot;Save&amp;quot;-like functionality when changing tabs on the edit assignment page.  When updating due to tab-change, cause a fresh render of the Topics tab.  When updating due to &amp;quot;Save&amp;quot; button, keep functionality as-is.&lt;br /&gt;
*** FILE: ''app/controllers/assignments_controller.rb''&lt;br /&gt;
*** FILE: ''app/views/assignments/edit.html.erb''&lt;br /&gt;
&lt;br /&gt;
* Support the ability to find the correct rubric for a particular topic&lt;br /&gt;
** PROBLEM: The existing methods allow us to find the correct rubric for a particular round, but not a particular topic&lt;br /&gt;
*** SOLUTION: Modify the existing method questionnaire(assignment, type, round_number) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/helpers/assignment_helper.rb''&lt;br /&gt;
*** SOLUTION: Modify the existing method assignment_questionnaire(assignment, type, number) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/helpers/assignment_helper.rb''&lt;br /&gt;
*** SOLUTION: Modify the existing method questionnaire(round = nil) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/models/review_response_map.rb''&lt;br /&gt;
*** SOLUTION: Modify the existing method questionnaire(round) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/models/self_review_response_map.rb''&lt;br /&gt;
*** SOLUTION: Modify the existing method review_questionnaire_id(round = nil) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/models/assignment.rb''&lt;br /&gt;
&lt;br /&gt;
* Use the correct rubric for a particular topic&lt;br /&gt;
** PROBLEM: When finding rubrics to display, save results from, calculate scores from, etc. round may be used but topic is not&lt;br /&gt;
*** SOLUTION: Examine all callers of methods modified in the previous section and pass in ''topic_id'' where appropriate to grab the correct rubric&lt;br /&gt;
*** FILE: (many)&lt;br /&gt;
&lt;br /&gt;
* Support the ability to determine if an assignment has rubrics that vary by topic&lt;br /&gt;
** PROBLEM: There is no handy method to call that can tell us if an assignment has rubrics that vary by topic&lt;br /&gt;
*** SOLUTION: Add a new method ''varying_rubrics_by_topic?'' based on the existing method ''varying_rubrics_by_round?''&lt;br /&gt;
*** FILE: ''app/models/assignment.rb''&lt;br /&gt;
&lt;br /&gt;
=== Q&amp;amp;A ===&lt;br /&gt;
&lt;br /&gt;
Here we paraphrase some questions we received during round 1 of the documentation review.&lt;br /&gt;
&lt;br /&gt;
* Q: How will the new logic for varying rubric by topic tie in with the existing logic?&lt;br /&gt;
** A: We will add a new field ''topic_id'' into the existing table ''assignment_questionnaires'', as noted in the [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Entity_Relationship_Diagram E/R Diagram].  We will update methods that find questionnaires to allow these methods to also accept a ''topic_id'' argument, as noted in [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Implementation Implementation].&lt;br /&gt;
* Q: How will the &amp;quot;Rubric varies by topic&amp;quot; selection be stored?&lt;br /&gt;
** A: Indirectly, by saving records in the ''assignment_questionnaires'' table which either reference a ''topic_id'' or leave this field nil.  For more details please see the [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Entity_Relationship_Diagram E/R Diagram] discussion.&lt;br /&gt;
* Q: What will happen if an instructor selects &amp;quot;Rubric varies by topic&amp;quot;, makes selections on the &amp;quot;Topics&amp;quot; tab, and then deselects &amp;quot;Rubric varies by topic&amp;quot;?&lt;br /&gt;
** A: The Topics tab, when next visited, will no longer show dropdowns for selecting rubrics by topic.  When the assignment is saved, the appropriate not-varying-by-topic records will be saved in the ''assignment_questionnaires'' table.  For more details please see [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Implementation Implementation].&lt;br /&gt;
* Q: What will happen after an instructor selects &amp;quot;Rubric varies by topic&amp;quot;?&lt;br /&gt;
** A: The Topics tab, when next visited, will now show dropdowns for selecting rubrics by topic.  These rubrics will default to those shown on the Rubrics tab.  When the assignment is saved, the appropriate varying-by-topic records will be saved in the ''assignment_questionnaires'' table.  For more details please see [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Implementation Implementation].&lt;br /&gt;
* Q: How will the appropriate list of questionnaires for the new dropdowns on the Topics tab be determined?&lt;br /&gt;
** A: In the same way that the appropriate list of questionnaires for the existing dropdowns on the Rubrics tab is determined.  Namely, by the ''questionnaire_options'' method in the file ''expertiza/app/helpers/assignment_helper.rb''.&lt;br /&gt;
&lt;br /&gt;
=== (Selected) Modified Code ===&lt;br /&gt;
&lt;br /&gt;
In this section, we provide ''selected portions'' of modified code to illustrate how we implemented the new feature.&lt;br /&gt;
&lt;br /&gt;
Allow an instructor to indicate that rubric should vary by topic&lt;br /&gt;
&lt;br /&gt;
''app\views\assignments\edit\_rubrics.html.erb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;lt;input name=&amp;quot;vary_by_topic&amp;quot; type=&amp;quot;hidden&amp;quot; value=&amp;quot;false&amp;quot; /&amp;gt;&lt;br /&gt;
  &amp;lt;%= check_box_tag('vary_by_topic', 'true', @review_vary_by_topic_check) %&amp;gt;&lt;br /&gt;
  &amp;lt;%= label_tag('vary_by_topic', 'Review rubric varies by topic?') %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Allow an instructor to choose different rubrics for different topics&lt;br /&gt;
&lt;br /&gt;
''app\views\sign_up_sheet\_table_line.html.erb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;lt;% if @assignment_form.assignment.varying_rubrics_by_topic? %&amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;table id = &amp;lt;%=table_id %&amp;gt;&amp;gt;&lt;br /&gt;
        &amp;lt;tr&amp;gt;&lt;br /&gt;
          &amp;lt;script&amp;gt;&lt;br /&gt;
              ...&lt;br /&gt;
              &amp;lt;% if @assignment_form.assignment.varying_rubrics_by_round? %&amp;gt;&lt;br /&gt;
                &amp;lt;% for round in 1..@assignment_form.assignment.rounds_of_reviews %&amp;gt;&lt;br /&gt;
                  ...&lt;br /&gt;
                &amp;lt;% end %&amp;gt;&lt;br /&gt;
              &amp;lt;% else %&amp;gt;&lt;br /&gt;
                ...&lt;br /&gt;
              &amp;lt;% end %&amp;gt;&lt;br /&gt;
          &amp;lt;/script&amp;gt;&lt;br /&gt;
        &amp;lt;/tr&amp;gt;&lt;br /&gt;
      &amp;lt;/table&amp;gt;&lt;br /&gt;
    &amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Support the ability of the database to link rubrics to topics&lt;br /&gt;
&lt;br /&gt;
''app\models\sign_up_topic.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  class SignUpTopic &amp;lt; ActiveRecord::Base&lt;br /&gt;
    ...&lt;br /&gt;
    has_many :assignment_questionnaires, class_name: 'AssignmentQuestionnaire', foreign_key: 'topic_id', dependent: :destroy&lt;br /&gt;
    ...&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
React to an instructor saving an assignment after altering the rubrics-vary-by-topic checkbox&lt;br /&gt;
&lt;br /&gt;
''app/controllers/assignments_controller.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def update&lt;br /&gt;
    ...&lt;br /&gt;
    # What to do next depends on how we got here&lt;br /&gt;
    if params['button'].nil?&lt;br /&gt;
      # REFRESH the topics tab after changing tabs&lt;br /&gt;
      ...&lt;br /&gt;
      render :partial =&amp;gt; &amp;quot;assignments/edit/topics&amp;quot;&lt;br /&gt;
    else&lt;br /&gt;
      # SAVE button was used (do a redirect)&lt;br /&gt;
      redirect_to edit_assignment_path @assignment_form.assignment.id&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Support the ability to find the correct rubric for a particular topic&lt;br /&gt;
&lt;br /&gt;
''app/helpers/assignment_helper.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def assignment_questionnaire(assignment, questionnaire_type, round_number = nil, topic_id = nil)&lt;br /&gt;
    q_by_type = assignment.questionnaires.find_by(type: questionnaire_type)&lt;br /&gt;
    if q_by_type.nil?&lt;br /&gt;
      ...&lt;br /&gt;
    else&lt;br /&gt;
      ...&lt;br /&gt;
      aq_by_type = assignment.assignment_questionnaires.find_by(questionnaire_id: q_by_type.id)&lt;br /&gt;
      if round_number.nil? &amp;amp;&amp;amp; topic_id.nil?&lt;br /&gt;
        # Find by type&lt;br /&gt;
        aq = aq_by_type&lt;br /&gt;
      elsif topic_id.nil?&lt;br /&gt;
        # Find by round&lt;br /&gt;
        aq = assignment.assignment_questionnaires.find_by(used_in_round: round_number)&lt;br /&gt;
      elsif round_number.nil?&lt;br /&gt;
        # Find by topic&lt;br /&gt;
        aq = assignment.assignment_questionnaires.find_by(topic_id: topic_id)&lt;br /&gt;
      else&lt;br /&gt;
        # Find by round and topic&lt;br /&gt;
        aq = assignment.assignment_questionnaires.where(used_in_round: round_number, topic_id: topic_id).first&lt;br /&gt;
      end&lt;br /&gt;
      aq.nil? ? aq_by_type : aq&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use the correct rubric for a particular topic&lt;br /&gt;
&lt;br /&gt;
''app\controllers\response_controller.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def set_questionnaire_for_new_response&lt;br /&gt;
    case @map.type&lt;br /&gt;
    when &amp;quot;ReviewResponseMap&amp;quot;, &amp;quot;SelfReviewResponseMap&amp;quot;&lt;br /&gt;
      reviewees_topic = SignedUpTeam.topic_id_by_team_id(@contributor.id)&lt;br /&gt;
      @current_round = @assignment.number_of_current_round(reviewees_topic)&lt;br /&gt;
      @questionnaire = @map.questionnaire(@current_round, reviewees_topic)&lt;br /&gt;
    when&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Support the ability to determine if an assignment has rubrics that vary by topic&lt;br /&gt;
&lt;br /&gt;
''app\models\assignment.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def varying_rubrics_by_topic?&lt;br /&gt;
    aq_no_topic_id = AssignmentQuestionnaire.where(assignment_id: self.id, topic_id: nil).size &amp;gt;= 1&lt;br /&gt;
    aq_with_topic_id = AssignmentQuestionnaire.where(assignment_id: self.id).where.not(topic_id: nil).size &amp;gt;= 1&lt;br /&gt;
    if !aq_no_topic_id &amp;amp;&amp;amp; !aq_with_topic_id&lt;br /&gt;
      return false&lt;br /&gt;
    elsif aq_no_topic_id &amp;amp;&amp;amp; !aq_with_topic_id&lt;br /&gt;
      return false&lt;br /&gt;
    elsif !aq_no_topic_id &amp;amp;&amp;amp; aq_with_topic_id&lt;br /&gt;
      return true&lt;br /&gt;
    else&lt;br /&gt;
      raise StandardError.new(&amp;quot;Assignment with id &amp;quot; + self.id.to_s + &amp;quot; has a conflict about whether or not it varies by topic&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== How To ==&lt;br /&gt;
&lt;br /&gt;
In this section, we describe how to use the newly implemented feature.&lt;br /&gt;
&lt;br /&gt;
=== Add a New Rubric ===&lt;br /&gt;
&lt;br /&gt;
* [to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
=== Select a Rubric for a Topic ===&lt;br /&gt;
&lt;br /&gt;
* [to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
== Project Testing ==&lt;br /&gt;
&lt;br /&gt;
=== Strategy ===&lt;br /&gt;
&lt;br /&gt;
To test code implementation, correctness of the added feature, verify that the team did not break any existing functionalities in the Expertiza, and ensure that no bugs were introduced in the code, we developed the following Test Strategy:&lt;br /&gt;
&lt;br /&gt;
# Code inspection&lt;br /&gt;
# Run and pass existing RSpec Tests&lt;br /&gt;
# Develop New RSpec Tests&lt;br /&gt;
# Run through live UI to test a feature using Expertiza instance&lt;br /&gt;
&lt;br /&gt;
=== Rspec Testing ===&lt;br /&gt;
&lt;br /&gt;
==== Existing Tests ====&lt;br /&gt;
&lt;br /&gt;
Run all existing RSpec tests on any changed files, after our changes, to ensure that we have not introduced any failures.&lt;br /&gt;
The commands and results are shown below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
e@ubuntu:~/Desktop/CSC517_HW04/expertiza$ bundle exec rspec spec/helpers/ spec/controllers/ spec/models/&lt;br /&gt;
[Coveralls] Set up the SimpleCov formatter.&lt;br /&gt;
[Coveralls] Using SimpleCov's 'rails' settings.&lt;br /&gt;
&lt;br /&gt;
Randomized with seed 6978&lt;br /&gt;
[...]&lt;br /&gt;
&lt;br /&gt;
Finished in 8 minutes 10 seconds (files took 12.32 seconds to load)&lt;br /&gt;
900 examples, 0 failures, 16 pending&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The features tests were extremely time-consuming so we did not routinely run them during development.  However TravisCI results on our [https://github.com/expertiza/expertiza/pull/1444 Pull Request] demonstrate the passing status of all tests.&lt;br /&gt;
&lt;br /&gt;
==== New Tests ====&lt;br /&gt;
&lt;br /&gt;
Write comprehensive RSpec tests, for all new or modified methods.&lt;br /&gt;
* FILE: ''spec/helpers/assignment_helper_spec.rb''&lt;br /&gt;
** METHODS TO TEST: &lt;br /&gt;
*** questionnaire(assignment, type, round_number, topic_id)&lt;br /&gt;
*** assignment_questionnaire(assignment, type, number, topic_id)&lt;br /&gt;
* FILE: ''spec/models/review_response_map_spec.rb''&lt;br /&gt;
*** METHODS TO TEST:&lt;br /&gt;
**** questionnaire(round, topic_id)&lt;br /&gt;
* FILE: ''spec/models/self_review_response_map_spec.rb''&lt;br /&gt;
*** METHODS TO TEST:&lt;br /&gt;
**** questionnaire(round, topic_id)&lt;br /&gt;
* FILE: ''spec/models/assignment_spec.rb''&lt;br /&gt;
*** METHODS TO TEST:&lt;br /&gt;
**** review_questionnaire_id(round, topic_id)&lt;br /&gt;
**** varying_rubrics_by_topic?()&lt;br /&gt;
&lt;br /&gt;
Run these tests, to ensure that the new code works as intended.&lt;br /&gt;
The commands and results are shown below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
e@ubuntu:~/Desktop/CSC517_HW04/expertiza$ bundle exec rspec spec/helpers/assignment_helper_spec.rb spec/models/review_response_map_spec.rb spec/models/self_review_response_map_spec.rb spec/models/assignment_spec.rb &lt;br /&gt;
[Coveralls] Set up the SimpleCov formatter.&lt;br /&gt;
[Coveralls] Using SimpleCov's 'rails' settings.&lt;br /&gt;
&lt;br /&gt;
Randomized with seed 47508&lt;br /&gt;
....................................................................................................................&lt;br /&gt;
&lt;br /&gt;
Finished in 1 minute 7.94 seconds (files took 10.85 seconds to load)&lt;br /&gt;
116 examples, 0 failures&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The test suite for a single new method is shown below.&lt;br /&gt;
* There are many such suites added in expertiza/spec  &lt;br /&gt;
* This example illustrates our general strategy:&lt;br /&gt;
** test missing input&lt;br /&gt;
** test bad input&lt;br /&gt;
** test various acceptable forms of input&lt;br /&gt;
** test scenarios that lead to various return values&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  describe &amp;quot;#questionnaire&amp;quot; do&lt;br /&gt;
&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;throws exception if assignment argument nil&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;throws exception if all arguments nil except for assignment&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;finds by type if round number &amp;amp; topic id not given&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;throws exception if round number &amp;amp; topic id not given, no luck finding by type&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;finds by round number alone if round number alone is given&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;creates new questionnaire of given type if round number alone is given, no luck finding by round&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;finds by topic id alone if topic id alone is given&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;creates new questionnaire of given type if topic id alone is given, no luck finding by topic&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;finds by round number and topic id if both are given&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;creates new questionnaire of given type if round and topic are given, no luck finding by round and topic&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== UI Testing ===&lt;br /&gt;
&lt;br /&gt;
Here we describe manual UI Testing that was performed.&lt;br /&gt;
&lt;br /&gt;
==== Rubric does not vary by round or by topic ====&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
==== Rubric varies by round, but not by topic ====&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
==== Rubric varies by topic, but not by round ====&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
==== Rubric varies by both round and topic ====&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
In CSC/ECE 517, there are several types of topics that could be covered in a single class assignment.  However, currently we can only specify one kind of rubric for an assignment. This means that teams working on different topics will be evaluated using the same rubric. With this setup, it's not possible to fine-tune rubrics for different topics - rubrics tend to be overly general.&lt;br /&gt;
&lt;br /&gt;
In this project, we have solved this issue, by allowing rubrics to vary not only by round, but also by topic. This allows more flexibility to the instructor when setting up an assignment, so that they can use rubrics better suited to the tasks that students are performing in an assignment.  The following scenarios will be possible, and the instructor will be the judge of which scenario is the best fit to the assignment:&lt;br /&gt;
&lt;br /&gt;
* Rubric does not vary by round or by topic.&lt;br /&gt;
* Rubric varies by round, but not by topic.&lt;br /&gt;
* Rubric varies by topic, but not by round.&lt;br /&gt;
* Rubric varies by both round and topic.&lt;br /&gt;
&lt;br /&gt;
The instructor may use the Rubrics tab of the assignments edit page to make changes to the &amp;quot;Review rubric varies by round?&amp;quot; and &amp;quot;Review rubric varies by topic?&amp;quot; checkboxes.  The instructor may then use the Topics tab to select the appropriate rubric(s) for every topic in the assignment.&lt;br /&gt;
&lt;br /&gt;
Various other Expertiza code has been updated to retrieve the correct rubric depending on round and topic after the instructor has made these selections.&lt;br /&gt;
&lt;br /&gt;
== Future Work ==&lt;br /&gt;
&lt;br /&gt;
This section discusses possible future work for another CSC 517 team to take on.  Such a team can search the Expertiza codebase for &amp;quot;TODO E1936 (future work)&amp;quot; to find most of the places in the code that the notes below refer to.&lt;br /&gt;
&lt;br /&gt;
* Reduce the delay between changing the state of the &amp;quot;Review rubric varies by topic?&amp;quot; checkbox on the Rubrics tab, and the show / hide of rubric drop-downs on the Topics tab.&lt;br /&gt;
* Redesign UI for tone analysis, heatmaps, and review scores pop-up.  These areas are designed around the assumption that reviews do NOT vary by topic.  For example, in the review scores pop-up, a reviewer can see the reviews they have given, arranged by question, across multiple reviewees.&lt;br /&gt;
* Consider whether the questionnaire options available for selection in drop-downs on the Topics and Rubrics tabs should include ''only'' those questionnaires created by the currently-logged-in instructor.  Our work in this project changed the filtering from instructor-owning-assignment to currently-logged-in instructor - but left in place all non-private questionnaires.  ''Consider'' whether non-private questionnaires should be excluded.  This may result in some drop-downs not having any available questionnaires.&lt;br /&gt;
&lt;br /&gt;
== Useful Links ==&lt;br /&gt;
In this section we provide useful links related to the work that has been completed by our team.&lt;br /&gt;
# [https://github.com/gabalmat/expertiza Forked Project Repository]&lt;br /&gt;
# [https://github.com/expertiza/expertiza/pull/1444 Pull Request]&lt;br /&gt;
# [(add link here) Video Demonstration of Specialized Rubrics]&lt;br /&gt;
# [(add link here) Video Demonstration of Passing Rspec Tests]&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Contacts ===&lt;br /&gt;
We have 4 (four) members in our team and 1 (one) mentor was also assigned to us. For any project-related questions/concerns please contact us:&lt;br /&gt;
* Aurora Tiffany-Davis - attiffan@ncsu.edu&lt;br /&gt;
* Ginger Balmat - gabalmat@ncsu.edu&lt;br /&gt;
* Joe Hutchinson - jehutch3@ncsu.edu&lt;br /&gt;
* Nikolay Titov - ngtitov@ncsu.edu&lt;br /&gt;
* Zhewei Hu (mentor) - zhu6@ncsu.edu&lt;br /&gt;
&lt;br /&gt;
=== Contribution Based Inquiry ===&lt;br /&gt;
For any questions or concerns related to the project design, implementation, testing of the feature developed by our team, please contact an engineer who worked closely on the topic of your interest based on the [https://docs.google.com/spreadsheets/d/11uxuI_5gaC-FQDwIOxtCaN3HZ9bfWDJgIjFemtYV5jE/edit?ts=5ca222f3#gid=0 Contribution Assignment Grid] we created to keep track of our progress and contribution. Please carbon copy all team members and our mentor in the email.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* Expertiza Web [https://github.com/expertiza/expertiza#expertiza]&lt;br /&gt;
* Expertiza on GitHub [https://github.com/expertiza/expertiza]&lt;br /&gt;
* Expertiza Wiki [http://wikis.lib.ncsu.edu/index.php/Expertiza]&lt;br /&gt;
* Rspec Documentation [https://relishapp.com/rspec]&lt;br /&gt;
* Wiki with Previous Work [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1873_Specialized_rubics_for_different_topic_types]&lt;br /&gt;
* Pull Request of the Previous Work [https://github.com/expertiza/expertiza/pull/1327]&lt;/div&gt;</summary>
		<author><name>Ngtitov</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics&amp;diff=124493</id>
		<title>E1936 Specialized Rubrics</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics&amp;diff=124493"/>
		<updated>2019-04-26T16:05:38Z</updated>

		<summary type="html">&lt;p&gt;Ngtitov: /* Project Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page describes the work and goals that have been completed and achieved while implementing Expertiza Project &amp;quot;''E1936. Specialized Rubrics for Different Topic Types (e.g., Servo project, refactoring project)''&amp;quot; for the CSC/ECE 517 &amp;quot;Object-Oriented Design and Development&amp;quot; class, in the Spring semester of the 2019.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This Wiki page is created per CSC/ECE 517: &amp;quot;Object-Oriented Design and Development&amp;quot;, Expertiza Project requirements (Spring, 2019).&lt;br /&gt;
&lt;br /&gt;
Our [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Team team] was assigned the project &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936. Specialized rubrics for different topic types (e.g., Servo project, refactoring project)]&amp;quot;.  This is an Expertiza project.&lt;br /&gt;
&lt;br /&gt;
In this wiki page we describe the problem to be solved, how we solve that problem, and how we test our solution.  We also provide helpful links and contact information for our team.&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
In this section, we discuss the problem we need to solve, the Expertiza feature this problem is related to, what needs to be done to solve the problem (at a high level), and the previous attempt to solve this problem.&lt;br /&gt;
&lt;br /&gt;
=== Problem Statement ===&lt;br /&gt;
&lt;br /&gt;
This problem statement summarizes the problem as described in the project description &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936. Specialized rubrics for different topic types (e.g., Servo project, refactoring project)]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
In CSC/ECE 517, there are several types of topics that could be covered in a single class assignment.&lt;br /&gt;
* Code base&lt;br /&gt;
** Expertiza&lt;br /&gt;
** Mozilla&lt;br /&gt;
** etc.&lt;br /&gt;
* Goal&lt;br /&gt;
** Refactoring&lt;br /&gt;
** Testing&lt;br /&gt;
** etc.&lt;br /&gt;
However, currently we can only specify one kind of rubric for an assignment.  This means that teams working on different topics will be evaluated using the same rubric.  With this setup, it's not possible to fine-tune rubrics for different topics - rubrics tend to be overly general.&lt;br /&gt;
&lt;br /&gt;
=== Feature Description ===&lt;br /&gt;
&lt;br /&gt;
The Expertiza project already has a feature that allows rubrics to vary by project phase or &amp;quot;round&amp;quot;.  The feature we will add in this project is a feature to allow rubrics to vary not only by round, but also by topic.  This allows more flexibility to the instructor when setting up an assignment, so that they can use rubrics better suited to the tasks that students are performing in an assignment.&lt;br /&gt;
&lt;br /&gt;
When this feature is complete, the following scenarios will be possible, and the instructor will be the judge of which scenario is the best fit to the assignment:&lt;br /&gt;
&lt;br /&gt;
* Rubric does not vary by round or by topic.&lt;br /&gt;
* Rubric varies by round, but not by topic.&lt;br /&gt;
* Rubric varies by topic, but not by round.&lt;br /&gt;
* Rubric varies by both round and topic.&lt;br /&gt;
&lt;br /&gt;
=== What Needs to be Done ===&lt;br /&gt;
&lt;br /&gt;
This section summarizes the work as described in the project description &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936. Specialized rubrics for different topic types (e.g., Servo project, refactoring project)]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* In assignment#edit page &amp;quot;Rubrics&amp;quot; tab, add a checkbox to specify whether rubric should vary by topic.&lt;br /&gt;
* In assignment#edit page &amp;quot;Topics&amp;quot; tab, add dropdown(s) next to each topic to specify which rubric(s) are associated with the topic.&lt;br /&gt;
** The dropdown(s) should appear only if rubric should vary by topic, per the Rubrics tab.&lt;br /&gt;
** The topic should have a multiple dropdowns (one for each round) only if rubrics vary by round, per the Rubrics tab.&lt;br /&gt;
** By default, the rubric(s) for each course project will be the one(s) specified in “Rubrics” tab.&lt;br /&gt;
** The dropdown value can overwrite the default rubric.&lt;br /&gt;
* Be careful when making changes to the code&lt;br /&gt;
** The signup_sheet_controller should have as little to do as possible with the selection of rubrics.&lt;br /&gt;
** Anything not germane to selecting topics should be in another controller or (more probably) a helper.&lt;br /&gt;
* Create a DB migration to allow rubric to vary by topic as well as by round.&lt;br /&gt;
&lt;br /&gt;
==== Screenshots ====&lt;br /&gt;
'''Current screenshot of Rubrics tab for an Assignment'''&lt;br /&gt;
(need to add a checkbox to indicate that rubric should vary by topic)&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Screenshot Assignment Edit Rubrics.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Current screenshot of Topics tab for an Assignment'''&lt;br /&gt;
(need to add a way to select rubrics for particular topics)&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Screenshot Assignment Edit Topics.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Proposed screenshot of Rubrics tab for an Assignment'''&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Specialized Rubric rubric checkbox.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Proposed screenshot of Topics tab for an Assignment'''&lt;br /&gt;
&lt;br /&gt;
(drop down shown for only one topic here, but final product will have one for each topic)&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Specialized Rubric dropdown menu.png]]&lt;br /&gt;
&lt;br /&gt;
== Previous Work ==&lt;br /&gt;
&lt;br /&gt;
There was previous attempt to implement this project in the Fall of 2018 semester by different team, but it was rejected due to several reasons. As a result our team was assigned to complete this project with the given implementation. However, after detailed investigation of the proposed design that team has made in the previous semester and review of the code changes, we proposed different architectural solution for the problem, which we believe is simpler, more efficient, and elegant solution.&lt;br /&gt;
&lt;br /&gt;
=== Previous Project Implementation ===&lt;br /&gt;
&lt;br /&gt;
Our team was provided with all relevant information and materials about the design and implementation of the previously attempted project. We would like to acknowledge that we use previous implementation and design as reference and our starting point for our own implementation. The following is the list of links with the relevant materials that we have used for better project understanding, determining pros and cons of previously proposed changes, and establishing our design strategy and implementation:&lt;br /&gt;
&lt;br /&gt;
# [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1873_Specialized_rubics_for_different_topic_types Wiki]&lt;br /&gt;
# [https://github.com/expertiza/expertiza/pull/1327 Pull Request]&lt;br /&gt;
# [https://drive.google.com/file/d/1UrLb0Ula_Lb_F4MOrdC-s6xng6B08VYu/view Video Demo]&lt;br /&gt;
&lt;br /&gt;
After reviewing all relevant materials above, we concluded that the project implementation was incomplete and proposed design had significant flaw. &lt;br /&gt;
We identified main drawbacks and flaw as follows:&lt;br /&gt;
&lt;br /&gt;
* Establishing incorrect ''many-to-one'' relationship between ''sign_up_topics'' and ''questionnaires'' tables:&lt;br /&gt;
** Creating a DB migration to add ''questionnaire_id'' in the ''sign_up_topics'' table to store the dropdown data presumes ''one-to-one'' or ''many-to-one'' relationship between ''sign_up_topics'' and ''questionnaires'' tables&lt;br /&gt;
** Correct relationship between ''sign_up_topics'' and ''questionnaires'' tables is ''many-to-many''. For example, each project topic may have various rubrics depending on the round it is used (e.g., for round 1, topic may have one rubric; but for round 2, the same topic may have different rubric)&lt;br /&gt;
** Proposed previous migration changes would break DB design and would not allow to store correctly topic and its associated rubric per different round.&lt;br /&gt;
* Per project requirement specifications, &amp;quot;''The dropdown box should appear only if 'Vary rubric by topic' is selected in the Rubrics tab.''&amp;quot; This requirement was not met and ''Vary rubric by topic'' checkbox in the Rubrics tab was not implemented. Therefore, dropdown box with the list of rubrics appears regardless of whether &amp;quot;''Vary rubric by topic''&amp;quot; is selected or not.&lt;br /&gt;
* The dropdown box includes the list of all possible rubrics including default value. However, this condition can be improved. The dropdown box should list the rubrics that were created by the current user (professor who is logged in). This would allow to shorten the list of possible rubrics dramatically and help to avoid any misunderstanding and confusion while user selects desired rubric for the course project.&lt;br /&gt;
&lt;br /&gt;
We found no further issues with the rest implementation and in other project materials. Wiki page is very useful for understanding design of proposed changes, finding drawbacks and the flaw. Considering all the pros and cons, and taking into account drawbacks of the proposed changes, our team evolved different approach that should successfully solve the problem stated for the project without without creating additional issues. Please see our [http://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics#Project_Implementation Project Implementation] for more details.&lt;br /&gt;
&lt;br /&gt;
=== Previous Project Requirements ===&lt;br /&gt;
&lt;br /&gt;
The project requirements originally specified how to alter the databases to support varying rubrics by topic.&lt;br /&gt;
&lt;br /&gt;
''Create a new table named topic_questionnaires with field:''&lt;br /&gt;
* ''id''&lt;br /&gt;
* ''topic_id''&lt;br /&gt;
* ''questionnaire_id''&lt;br /&gt;
* ''used_in_round''&lt;br /&gt;
&lt;br /&gt;
However, the E1936 team successfully petitioned for this requirement to change to give us more freedom in the implementation.  The original suggestion had a flaw.  There is already an existing table in the Expertiza project called ''assignment_questionnaires'', which has columns including ''assignment_id'', ''questionnaire_id'', and ''used_in_round''.  It is this table that maintains the knowledge of which rubric is used in which round of an assignment.  If we were to add a new table to maintains the knowledge of which rubric is used in which topic of an assignment as originally suggested, then we would have a big problem.  Knowledge of round-rubric relationship is duplicated.  This would lead (best case scenario) to extra work, and (worst case scenario) to lots of bugs caused by inconsistencies in how these tables are handled with CRUD operations throughout the code.  In other words, this is not a DRY solution.&lt;br /&gt;
&lt;br /&gt;
== Project Implementation ==&lt;br /&gt;
&lt;br /&gt;
In this section, we propose our solution to the problem with the set of UML diagrams, discuss implementation techniques and details, and list the goals we achieved.&lt;br /&gt;
&lt;br /&gt;
We start by proposing our solution to the problem utilizing UML diagrams that include Use case, Entity Relationship, Class, and Sequence diagrams! Further, we discuss design strategy by breaking project problem into multiple staged sub-problems and provide solutions for each of these sub-problems. We also discuss some implementation details in the form of problem - solution, and provide the list of involved files. Finally, we demonstrate how the implemented feature can be used by providing a ''How To'' sub-section.&lt;br /&gt;
&lt;br /&gt;
=== UML Diagrams ===&lt;br /&gt;
&lt;br /&gt;
Our solution and implementation of the project can be easily shown by discussing Use Case, Entity Relationship, and Class diagrams. First, for simplicity we discuss in general possible sequence of interactions between a user (in this case instructor) and the system (Expertiza) via presenting Use Case Diagram. Then we plan to show proposed database modification via Entity Relationship Diagram. At this point the high-level design and proposed changes should be clear. To make our design more concrete and dive into implementation level, we decided to provide UML Class diagram. Finally, to demonstrate our achievements, we complete this section with the UML Sequence diagram to illustrate interactive behavior of a system with utilized specialized rubrics feature.&lt;br /&gt;
&lt;br /&gt;
==== Use Case Diagram ====&lt;br /&gt;
&lt;br /&gt;
[[File: use_case_diagram_1936.png]]&lt;br /&gt;
&lt;br /&gt;
The above Use Case Diagram shows general sequence of interactions between an instructor and the system (Expertiza) that defines where and how the feature can be utilized. Note that highlighted use cases are objects of our interest and work. Also please note that all of the shown use cases already exist in the system and we simply added a new feature into the system with existing use cases. Particularly, the rubric for each assignment and newly added ''Review rubric varies by topic'' checkbox with which instructor may choose to vary assignment by topic or not, by checking and unchecking the checkbox is displayed in the ''Rubrics'' tab. Hence, we show how instructor can get to the ''Rubrics'' tab of the assignments. Similarly, ''Topics'' tab of assignments has additional ''Questionnaires'' column for each topic, where instructor may specify which rubric associates with which topic. To perform this sequence of interactions and utilize the new feature, instructor must choose ''Edit'' any assignment from the list of all assignments displayed to him/her in the ''Manage Assignments'' page, which can be navigated by instructor by selecting it from the header of the system.&lt;br /&gt;
&lt;br /&gt;
==== Entity Relationship Diagram ====&lt;br /&gt;
&lt;br /&gt;
[[File: HW04_ERD.png]]&lt;br /&gt;
&lt;br /&gt;
The sections of the diagram highlighted in yellow show newly introduced items.  That is, we are adding a new column called ''topic_id'' to ''assignment_questionnaires'', in order to link ''assignment_questionnaires'' to ''sign_up_topics''.&lt;br /&gt;
&lt;br /&gt;
Any assignment, topic, or questionnaire may be represented by multiple records within ''assignment_questionnaires'', but each record within ''assignment_questionnaires'' refers to just one assignment, topic, or questionnaire.  It is the ability to have an assignment represented by multiple records, and the new relationship to ''sign_up_topics'', that allows us to support all of the required scenarios:&lt;br /&gt;
&lt;br /&gt;
* Rubric does not vary by round or by topic.&lt;br /&gt;
* Rubric varies by round, but not by topic.&lt;br /&gt;
* Rubric varies by topic, but not by round.&lt;br /&gt;
* Rubric varies by both round and topic.&lt;br /&gt;
&lt;br /&gt;
[[File: HW04_table.PNG]]&lt;br /&gt;
&lt;br /&gt;
This table illustrates the possibilities that the system may have.&lt;br /&gt;
&lt;br /&gt;
* Assignment 1 does not vary by round or by topic.&lt;br /&gt;
* Assignment 2 varies by round, but not by topic.&lt;br /&gt;
* Assignment 3 varies by topic, but not by round.&lt;br /&gt;
* Assignment 4 varies by both round and topic.&lt;br /&gt;
&lt;br /&gt;
This change is done via database migration by running the following commands:&lt;br /&gt;
&lt;br /&gt;
  rails generate migration AddTopicIdToAssignmentQuestionnaires&lt;br /&gt;
&lt;br /&gt;
Above command adds the ''topic_id'' column to the ''AssignmentQuestionnaires'' table and generates new migration file:&lt;br /&gt;
&lt;br /&gt;
[[File: db_migration.png]]&lt;br /&gt;
&lt;br /&gt;
To see the details of the entire database change please check this [https://github.com/gabalmat/expertiza/commit/d46dd57d35a21ab43efb82c28d3f14b75c695f2e commit].&lt;br /&gt;
&lt;br /&gt;
==== Class Diagram ====&lt;br /&gt;
&lt;br /&gt;
[[File: class_diagram_1936.png]]&lt;br /&gt;
&lt;br /&gt;
The above UML Class diagram describes the changes our team made in the Ruby classes, methods and attributes. Please note that all provided classes in the diagram had already existed in the system, and we only added new relationship, modified existing methods (and some method signatures) and utilized given attributes. All of the class's attributes and methods that are shown in the diagram are utilized (directly and indirectly) in our current implementation. Some of the methods and attributes provided within the classes in the diagram are newly developed. There is only one newly added aggregation relationship between the ''SingUpTopic'' class and ''AssignmentQuestionnaire'' class. Moreover, controllers and models for the certain classes were combined into a single class for simplicity to the design description. In reality, half of the methods shown in  the ''Assignment'' class are implemented in the ''app/controllers/assignments_controller.rb'' file and other half is in the ''app/models/assignment.rb'' file. We decided to combine all of the functionalities of each ''relevant'' controller and model class into single class for the ease of design presentation and interpretation. We used Sequence diagram below to illustrate how MVC architectural pattern is used for a given classes.&lt;br /&gt;
&lt;br /&gt;
==== Sequence Diagram ====&lt;br /&gt;
&lt;br /&gt;
This is Sequence Diagram.&lt;br /&gt;
&lt;br /&gt;
=== Design Strategy ===&lt;br /&gt;
&lt;br /&gt;
As we have concrete understanding of the problem and proposed solution, we would like break this problem into multiple more manageable sub-problems with specific tasks and well-defined solutions to these tasks. Generally, each sub-problem requires modification of one or more files. We would like to propose our Design Strategy as follows:&lt;br /&gt;
&lt;br /&gt;
==== Preparation ====&lt;br /&gt;
&lt;br /&gt;
* Clean up code that our implementation will use&lt;br /&gt;
** PROBLEM: We need to add/change content to the edit assignment Topics tab, but unlike other tabs in the views, it does not have its own partial view to work with&lt;br /&gt;
*** SOLUTION: Refactor and move the code dealing with topics into separate ''app/views/assignments/edit/_topics.html.erb'' file&lt;br /&gt;
*** File: ''app/views/assignments/edit.html.erb''&lt;br /&gt;
** PROBLEM: In a section below, we discuss the need to modify existing methods to also accept an optional argument ''topic_id''.  In many cases these existing method use confusing variable names or lack sufficient comments.&lt;br /&gt;
*** SOLUTION: Clean up methods that we plan to modify&lt;br /&gt;
*** FILE: (many)&lt;br /&gt;
&lt;br /&gt;
==== Implementation ====&lt;br /&gt;
&lt;br /&gt;
* Allow an instructor to indicate that rubric should vary by topic&lt;br /&gt;
** PROBLEM: There is no way for an instructor to indicate that an assignments' rubric should vary by topic&lt;br /&gt;
*** SOLUTION: Add a new checkbox in the edit assignment Rubrics tab to indicate this preference&lt;br /&gt;
*** FILE: ''app/views/assignments/edit/_rubrics.html.erb''&lt;br /&gt;
** PROBLEM: If the user changes the &amp;quot;Review rubric varies by round?&amp;quot; or &amp;quot;Review rubric varies by topic?&amp;quot; checkbox on the Rubrics tab, but leaves the page in an inappropriate state before leaving the tab (e.g. rubric weights that do not add up to 0% or 100%), then the user does not get feedback that they made a mistake.  They only get such feedback when explicitly performing a &amp;quot;Save&amp;quot;.  Switching from tab to tab on the assignments edit page attempts to perform an implicit save, but there is no mechanism to update the flash messages onscreen if anything goes wrong.  This becomes more problematic now that the Topics tab appearance depends on choices made on the Rubrics tab.  &lt;br /&gt;
*** SOLUTION: Provide a route to an assignments controller method that can return a render of the flash messages.  Add an AJAX call on the assignments edit view that can update the flash messages onscreen.&lt;br /&gt;
*** FILE: app/controllers/assignments_controller.rb&lt;br /&gt;
*** FILE: app/views/assignments/edit.html.erb&lt;br /&gt;
&lt;br /&gt;
* Allow an instructor to choose different rubrics for different topics&lt;br /&gt;
** PROBLEM: There is no way for an instructor to choose different rubrics for different topics&lt;br /&gt;
*** SOLUTION: Add a new column in the edit assignment Topics tab for choosing rubric(s)&lt;br /&gt;
**** New column only visible if rubrics vary by topic, per Rubrics tab&lt;br /&gt;
**** New column has multiple rounds per topic only if rubrics vary by round, per Rubrics tab&lt;br /&gt;
**** Default value for any rubric is that rubric which is shown on Rubrics tab&lt;br /&gt;
**** Rubric(s) in the dropdown list is/are only those that were created by the currently logged in instructor&lt;br /&gt;
*** FILE: ''app/views/assignments/edit/_topics.html.erb''&lt;br /&gt;
** PROBLEM: The code in ''app/views/assignments/edit/_rubrics.html.erb'' includes dropdowns like the ones we need to add for topics, but that code is way too complex for its functionality (too heavy for a view, uses JavaScript)&lt;br /&gt;
*** SOLUTION: Use the code in ''app/views/assignments/edit/_rubrics.html.erb'' for inspiration only&lt;br /&gt;
**** Refactor and move as much actual work as possible out into helper methods that are simply called from this view&lt;br /&gt;
**** Views are not intended to do heavy lifting&lt;br /&gt;
**** Use as little JavaScript as possible, since this is a Ruby On Rails project, not a JS project&lt;br /&gt;
*** FILE: ''app/views/assignments/edit/_topics.html.erb''&lt;br /&gt;
** PROBLEM: The drop-downs for selecting rubrics should show only those rubrics created by the currently-logged in instructor (per project mentor).  They currently include those created by the instructor of the relevant assignment.&lt;br /&gt;
*** SOLUTION: Change the filtering in the ''questionnaire_options'' method to reflect the desired filtering.&lt;br /&gt;
*** FILE: app/helpers/assignment_helper.rb&lt;br /&gt;
&lt;br /&gt;
* Support the ability of the database to link rubrics to topics&lt;br /&gt;
** PROBLEM: There is no relationship in the database that can link together rubrics with topics&lt;br /&gt;
*** SOLUTION: Add a new migration that adds topic_id field to existing assignment_questionnaires table&lt;br /&gt;
**** This new field will reference the id field in the sign_up_topics table&lt;br /&gt;
*** FILE: ''db/migrate/[timestamp]_add_topic_id_to_assignment_questionnaires_table.rb''&lt;br /&gt;
** PROBLEM: The AssignmentQuestionnaire model does not have any knowledge of topics&lt;br /&gt;
*** SOLUTION: Add a new belongs_to reference in the model, to sign_up_topic&lt;br /&gt;
*** FILE: ''app/models/assignment_questionnaire.rb''&lt;br /&gt;
** PROBLEM: The SignUpTopic model does not have any knowledge of assignment_questionnaire records&lt;br /&gt;
*** SOLUTION: Add a new has_many reference in the model, to assignment_questionnaires&lt;br /&gt;
*** FILE: ''app/models/sign_up_topic.rb''&lt;br /&gt;
&lt;br /&gt;
* React to an instructor saving an assignment after altering the rubrics-vary-by-topic checkbox&lt;br /&gt;
** PROBLEM: There is nothing in place to remember when an instructor chooses to vary rubrics by topic, or chooses to not vary rubrics by topic&lt;br /&gt;
*** SOLUTION: Modify existing method ''update_assignment_questionnaires()''.  This method executes upon assignment save (explicit or via tab-change).  This method deletes all ''AssignmentQuestionnaire'' records before creating new correct records reflecting the user's selections in the edit assignment form.  Modify such that this method can create multiple records reflecting multiple topics, in the case where rubric should vary by topic.  With this modification, the correct records (with default rubrics) are present when the user goes to the Topics tab, so that the Topics tab can display properly.&lt;br /&gt;
*** FILE: app\models\assignment_form.rb&lt;br /&gt;
** PROBLEM: There is no way to refresh the Topics tab to show / hide drop-downs after the instructor changes checkbox on Rubrics tab&lt;br /&gt;
*** SOLUTION: Make use of existing &amp;quot;Save&amp;quot;-like functionality when changing tabs on the edit assignment page.  When updating due to tab-change, cause a fresh render of the Topics tab.  When updating due to &amp;quot;Save&amp;quot; button, keep functionality as-is.&lt;br /&gt;
*** FILE: ''app/controllers/assignments_controller.rb''&lt;br /&gt;
*** FILE: ''app/views/assignments/edit.html.erb''&lt;br /&gt;
&lt;br /&gt;
* Support the ability to find the correct rubric for a particular topic&lt;br /&gt;
** PROBLEM: The existing methods allow us to find the correct rubric for a particular round, but not a particular topic&lt;br /&gt;
*** SOLUTION: Modify the existing method questionnaire(assignment, type, round_number) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/helpers/assignment_helper.rb''&lt;br /&gt;
*** SOLUTION: Modify the existing method assignment_questionnaire(assignment, type, number) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/helpers/assignment_helper.rb''&lt;br /&gt;
*** SOLUTION: Modify the existing method questionnaire(round = nil) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/models/review_response_map.rb''&lt;br /&gt;
*** SOLUTION: Modify the existing method questionnaire(round) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/models/self_review_response_map.rb''&lt;br /&gt;
*** SOLUTION: Modify the existing method review_questionnaire_id(round = nil) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/models/assignment.rb''&lt;br /&gt;
&lt;br /&gt;
* Use the correct rubric for a particular topic&lt;br /&gt;
** PROBLEM: When finding rubrics to display, save results from, calculate scores from, etc. round may be used but topic is not&lt;br /&gt;
*** SOLUTION: Examine all callers of methods modified in the previous section and pass in ''topic_id'' where appropriate to grab the correct rubric&lt;br /&gt;
*** FILE: (many)&lt;br /&gt;
&lt;br /&gt;
* Support the ability to determine if an assignment has rubrics that vary by topic&lt;br /&gt;
** PROBLEM: There is no handy method to call that can tell us if an assignment has rubrics that vary by topic&lt;br /&gt;
*** SOLUTION: Add a new method ''varying_rubrics_by_topic?'' based on the existing method ''varying_rubrics_by_round?''&lt;br /&gt;
*** FILE: ''app/models/assignment.rb''&lt;br /&gt;
&lt;br /&gt;
=== Q&amp;amp;A ===&lt;br /&gt;
&lt;br /&gt;
Here we paraphrase some questions we received during round 1 of the documentation review.&lt;br /&gt;
&lt;br /&gt;
* Q: How will the new logic for varying rubric by topic tie in with the existing logic?&lt;br /&gt;
** A: We will add a new field ''topic_id'' into the existing table ''assignment_questionnaires'', as noted in the [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Entity_Relationship_Diagram E/R Diagram].  We will update methods that find questionnaires to allow these methods to also accept a ''topic_id'' argument, as noted in [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Implementation Implementation].&lt;br /&gt;
* Q: How will the &amp;quot;Rubric varies by topic&amp;quot; selection be stored?&lt;br /&gt;
** A: Indirectly, by saving records in the ''assignment_questionnaires'' table which either reference a ''topic_id'' or leave this field nil.  For more details please see the [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Entity_Relationship_Diagram E/R Diagram] discussion.&lt;br /&gt;
* Q: What will happen if an instructor selects &amp;quot;Rubric varies by topic&amp;quot;, makes selections on the &amp;quot;Topics&amp;quot; tab, and then deselects &amp;quot;Rubric varies by topic&amp;quot;?&lt;br /&gt;
** A: The Topics tab, when next visited, will no longer show dropdowns for selecting rubrics by topic.  When the assignment is saved, the appropriate not-varying-by-topic records will be saved in the ''assignment_questionnaires'' table.  For more details please see [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Implementation Implementation].&lt;br /&gt;
* Q: What will happen after an instructor selects &amp;quot;Rubric varies by topic&amp;quot;?&lt;br /&gt;
** A: The Topics tab, when next visited, will now show dropdowns for selecting rubrics by topic.  These rubrics will default to those shown on the Rubrics tab.  When the assignment is saved, the appropriate varying-by-topic records will be saved in the ''assignment_questionnaires'' table.  For more details please see [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Implementation Implementation].&lt;br /&gt;
* Q: How will the appropriate list of questionnaires for the new dropdowns on the Topics tab be determined?&lt;br /&gt;
** A: In the same way that the appropriate list of questionnaires for the existing dropdowns on the Rubrics tab is determined.  Namely, by the ''questionnaire_options'' method in the file ''expertiza/app/helpers/assignment_helper.rb''.&lt;br /&gt;
&lt;br /&gt;
=== (Selected) Modified Code ===&lt;br /&gt;
&lt;br /&gt;
In this section, we provide ''selected portions'' of modified code to illustrate how we implemented the new feature.&lt;br /&gt;
&lt;br /&gt;
Allow an instructor to indicate that rubric should vary by topic&lt;br /&gt;
&lt;br /&gt;
''app\views\assignments\edit\_rubrics.html.erb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;lt;input name=&amp;quot;vary_by_topic&amp;quot; type=&amp;quot;hidden&amp;quot; value=&amp;quot;false&amp;quot; /&amp;gt;&lt;br /&gt;
  &amp;lt;%= check_box_tag('vary_by_topic', 'true', @review_vary_by_topic_check) %&amp;gt;&lt;br /&gt;
  &amp;lt;%= label_tag('vary_by_topic', 'Review rubric varies by topic?') %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Allow an instructor to choose different rubrics for different topics&lt;br /&gt;
&lt;br /&gt;
''app\views\sign_up_sheet\_table_line.html.erb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;lt;% if @assignment_form.assignment.varying_rubrics_by_topic? %&amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;table id = &amp;lt;%=table_id %&amp;gt;&amp;gt;&lt;br /&gt;
        &amp;lt;tr&amp;gt;&lt;br /&gt;
          &amp;lt;script&amp;gt;&lt;br /&gt;
              ...&lt;br /&gt;
              &amp;lt;% if @assignment_form.assignment.varying_rubrics_by_round? %&amp;gt;&lt;br /&gt;
                &amp;lt;% for round in 1..@assignment_form.assignment.rounds_of_reviews %&amp;gt;&lt;br /&gt;
                  ...&lt;br /&gt;
                &amp;lt;% end %&amp;gt;&lt;br /&gt;
              &amp;lt;% else %&amp;gt;&lt;br /&gt;
                ...&lt;br /&gt;
              &amp;lt;% end %&amp;gt;&lt;br /&gt;
          &amp;lt;/script&amp;gt;&lt;br /&gt;
        &amp;lt;/tr&amp;gt;&lt;br /&gt;
      &amp;lt;/table&amp;gt;&lt;br /&gt;
    &amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Support the ability of the database to link rubrics to topics&lt;br /&gt;
&lt;br /&gt;
''app\models\sign_up_topic.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  class SignUpTopic &amp;lt; ActiveRecord::Base&lt;br /&gt;
    ...&lt;br /&gt;
    has_many :assignment_questionnaires, class_name: 'AssignmentQuestionnaire', foreign_key: 'topic_id', dependent: :destroy&lt;br /&gt;
    ...&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
React to an instructor saving an assignment after altering the rubrics-vary-by-topic checkbox&lt;br /&gt;
&lt;br /&gt;
''app/controllers/assignments_controller.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def update&lt;br /&gt;
    ...&lt;br /&gt;
    # What to do next depends on how we got here&lt;br /&gt;
    if params['button'].nil?&lt;br /&gt;
      # REFRESH the topics tab after changing tabs&lt;br /&gt;
      ...&lt;br /&gt;
      render :partial =&amp;gt; &amp;quot;assignments/edit/topics&amp;quot;&lt;br /&gt;
    else&lt;br /&gt;
      # SAVE button was used (do a redirect)&lt;br /&gt;
      redirect_to edit_assignment_path @assignment_form.assignment.id&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Support the ability to find the correct rubric for a particular topic&lt;br /&gt;
&lt;br /&gt;
''app/helpers/assignment_helper.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def assignment_questionnaire(assignment, questionnaire_type, round_number = nil, topic_id = nil)&lt;br /&gt;
    q_by_type = assignment.questionnaires.find_by(type: questionnaire_type)&lt;br /&gt;
    if q_by_type.nil?&lt;br /&gt;
      ...&lt;br /&gt;
    else&lt;br /&gt;
      ...&lt;br /&gt;
      aq_by_type = assignment.assignment_questionnaires.find_by(questionnaire_id: q_by_type.id)&lt;br /&gt;
      if round_number.nil? &amp;amp;&amp;amp; topic_id.nil?&lt;br /&gt;
        # Find by type&lt;br /&gt;
        aq = aq_by_type&lt;br /&gt;
      elsif topic_id.nil?&lt;br /&gt;
        # Find by round&lt;br /&gt;
        aq = assignment.assignment_questionnaires.find_by(used_in_round: round_number)&lt;br /&gt;
      elsif round_number.nil?&lt;br /&gt;
        # Find by topic&lt;br /&gt;
        aq = assignment.assignment_questionnaires.find_by(topic_id: topic_id)&lt;br /&gt;
      else&lt;br /&gt;
        # Find by round and topic&lt;br /&gt;
        aq = assignment.assignment_questionnaires.where(used_in_round: round_number, topic_id: topic_id).first&lt;br /&gt;
      end&lt;br /&gt;
      aq.nil? ? aq_by_type : aq&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use the correct rubric for a particular topic&lt;br /&gt;
&lt;br /&gt;
''app\controllers\response_controller.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def set_questionnaire_for_new_response&lt;br /&gt;
    case @map.type&lt;br /&gt;
    when &amp;quot;ReviewResponseMap&amp;quot;, &amp;quot;SelfReviewResponseMap&amp;quot;&lt;br /&gt;
      reviewees_topic = SignedUpTeam.topic_id_by_team_id(@contributor.id)&lt;br /&gt;
      @current_round = @assignment.number_of_current_round(reviewees_topic)&lt;br /&gt;
      @questionnaire = @map.questionnaire(@current_round, reviewees_topic)&lt;br /&gt;
    when&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Support the ability to determine if an assignment has rubrics that vary by topic&lt;br /&gt;
&lt;br /&gt;
''app\models\assignment.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def varying_rubrics_by_topic?&lt;br /&gt;
    aq_no_topic_id = AssignmentQuestionnaire.where(assignment_id: self.id, topic_id: nil).size &amp;gt;= 1&lt;br /&gt;
    aq_with_topic_id = AssignmentQuestionnaire.where(assignment_id: self.id).where.not(topic_id: nil).size &amp;gt;= 1&lt;br /&gt;
    if !aq_no_topic_id &amp;amp;&amp;amp; !aq_with_topic_id&lt;br /&gt;
      return false&lt;br /&gt;
    elsif aq_no_topic_id &amp;amp;&amp;amp; !aq_with_topic_id&lt;br /&gt;
      return false&lt;br /&gt;
    elsif !aq_no_topic_id &amp;amp;&amp;amp; aq_with_topic_id&lt;br /&gt;
      return true&lt;br /&gt;
    else&lt;br /&gt;
      raise StandardError.new(&amp;quot;Assignment with id &amp;quot; + self.id.to_s + &amp;quot; has a conflict about whether or not it varies by topic&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== How To ==&lt;br /&gt;
&lt;br /&gt;
In this section, we describe how to use the newly implemented feature.&lt;br /&gt;
&lt;br /&gt;
=== Add a New Rubric ===&lt;br /&gt;
&lt;br /&gt;
* [to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
=== Select a Rubric for a Topic ===&lt;br /&gt;
&lt;br /&gt;
* [to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
== Project Testing ==&lt;br /&gt;
&lt;br /&gt;
=== Strategy ===&lt;br /&gt;
&lt;br /&gt;
To test code implementation, correctness of the added feature, verify that the team did not break any existing functionalities in the Expertiza, and ensure that no bugs were introduced in the code, we developed the following Test Strategy:&lt;br /&gt;
&lt;br /&gt;
# Code inspection&lt;br /&gt;
# Run and pass existing RSpec Tests&lt;br /&gt;
# Develop New RSpec Tests&lt;br /&gt;
# Run through live UI to test a feature using Expertiza instance&lt;br /&gt;
&lt;br /&gt;
=== Rspec Testing ===&lt;br /&gt;
&lt;br /&gt;
==== Existing Tests ====&lt;br /&gt;
&lt;br /&gt;
Run all existing RSpec tests on any changed files, after our changes, to ensure that we have not introduced any failures.&lt;br /&gt;
The commands and results are shown below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
e@ubuntu:~/Desktop/CSC517_HW04/expertiza$ bundle exec rspec spec/helpers/ spec/controllers/ spec/models/&lt;br /&gt;
[Coveralls] Set up the SimpleCov formatter.&lt;br /&gt;
[Coveralls] Using SimpleCov's 'rails' settings.&lt;br /&gt;
&lt;br /&gt;
Randomized with seed 6978&lt;br /&gt;
[...]&lt;br /&gt;
&lt;br /&gt;
Finished in 8 minutes 10 seconds (files took 12.32 seconds to load)&lt;br /&gt;
900 examples, 0 failures, 16 pending&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The features tests were extremely time-consuming so we did not routinely run them during development.  However TravisCI results on our [https://github.com/expertiza/expertiza/pull/1444 Pull Request] demonstrate the passing status of all tests.&lt;br /&gt;
&lt;br /&gt;
==== New Tests ====&lt;br /&gt;
&lt;br /&gt;
Write comprehensive RSpec tests, for all new or modified methods.&lt;br /&gt;
* FILE: ''spec/helpers/assignment_helper_spec.rb''&lt;br /&gt;
** METHODS TO TEST: &lt;br /&gt;
*** questionnaire(assignment, type, round_number, topic_id)&lt;br /&gt;
*** assignment_questionnaire(assignment, type, number, topic_id)&lt;br /&gt;
* FILE: ''spec/models/review_response_map_spec.rb''&lt;br /&gt;
*** METHODS TO TEST:&lt;br /&gt;
**** questionnaire(round, topic_id)&lt;br /&gt;
* FILE: ''spec/models/self_review_response_map_spec.rb''&lt;br /&gt;
*** METHODS TO TEST:&lt;br /&gt;
**** questionnaire(round, topic_id)&lt;br /&gt;
* FILE: ''spec/models/assignment_spec.rb''&lt;br /&gt;
*** METHODS TO TEST:&lt;br /&gt;
**** review_questionnaire_id(round, topic_id)&lt;br /&gt;
**** varying_rubrics_by_topic?()&lt;br /&gt;
&lt;br /&gt;
Run these tests, to ensure that the new code works as intended.&lt;br /&gt;
The commands and results are shown below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
e@ubuntu:~/Desktop/CSC517_HW04/expertiza$ bundle exec rspec spec/helpers/assignment_helper_spec.rb spec/models/review_response_map_spec.rb spec/models/self_review_response_map_spec.rb spec/models/assignment_spec.rb &lt;br /&gt;
[Coveralls] Set up the SimpleCov formatter.&lt;br /&gt;
[Coveralls] Using SimpleCov's 'rails' settings.&lt;br /&gt;
&lt;br /&gt;
Randomized with seed 47508&lt;br /&gt;
....................................................................................................................&lt;br /&gt;
&lt;br /&gt;
Finished in 1 minute 7.94 seconds (files took 10.85 seconds to load)&lt;br /&gt;
116 examples, 0 failures&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The test suite for a single new method is shown below.&lt;br /&gt;
* There are many such suites added in expertiza/spec  &lt;br /&gt;
* This example illustrates our general strategy:&lt;br /&gt;
** test missing input&lt;br /&gt;
** test bad input&lt;br /&gt;
** test various acceptable forms of input&lt;br /&gt;
** test scenarios that lead to various return values&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  describe &amp;quot;#questionnaire&amp;quot; do&lt;br /&gt;
&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;throws exception if assignment argument nil&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;throws exception if all arguments nil except for assignment&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;finds by type if round number &amp;amp; topic id not given&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;throws exception if round number &amp;amp; topic id not given, no luck finding by type&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;finds by round number alone if round number alone is given&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;creates new questionnaire of given type if round number alone is given, no luck finding by round&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;finds by topic id alone if topic id alone is given&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;creates new questionnaire of given type if topic id alone is given, no luck finding by topic&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;finds by round number and topic id if both are given&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;creates new questionnaire of given type if round and topic are given, no luck finding by round and topic&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== UI Testing ===&lt;br /&gt;
&lt;br /&gt;
Here we describe manual UI Testing that was performed.&lt;br /&gt;
&lt;br /&gt;
==== Rubric does not vary by round or by topic ====&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
==== Rubric varies by round, but not by topic ====&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
==== Rubric varies by topic, but not by round ====&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
==== Rubric varies by both round and topic ====&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
In CSC/ECE 517, there are several types of topics that could be covered in a single class assignment.  However, currently we can only specify one kind of rubric for an assignment. This means that teams working on different topics will be evaluated using the same rubric. With this setup, it's not possible to fine-tune rubrics for different topics - rubrics tend to be overly general.&lt;br /&gt;
&lt;br /&gt;
In this project, we have solved this issue, by allowing rubrics to vary not only by round, but also by topic. This allows more flexibility to the instructor when setting up an assignment, so that they can use rubrics better suited to the tasks that students are performing in an assignment.  The following scenarios will be possible, and the instructor will be the judge of which scenario is the best fit to the assignment:&lt;br /&gt;
&lt;br /&gt;
* Rubric does not vary by round or by topic.&lt;br /&gt;
* Rubric varies by round, but not by topic.&lt;br /&gt;
* Rubric varies by topic, but not by round.&lt;br /&gt;
* Rubric varies by both round and topic.&lt;br /&gt;
&lt;br /&gt;
The instructor may use the Rubrics tab of the assignments edit page to make changes to the &amp;quot;Review rubric varies by round?&amp;quot; and &amp;quot;Review rubric varies by topic?&amp;quot; checkboxes.  The instructor may then use the Topics tab to select the appropriate rubric(s) for every topic in the assignment.&lt;br /&gt;
&lt;br /&gt;
Various other Expertiza code has been updated to retrieve the correct rubric depending on round and topic after the instructor has made these selections.&lt;br /&gt;
&lt;br /&gt;
== Future Work ==&lt;br /&gt;
&lt;br /&gt;
This section discusses possible future work for another CSC 517 team to take on.  Such a team can search the Expertiza codebase for &amp;quot;TODO E1936 (future work)&amp;quot; to find most of the places in the code that the notes below refer to.&lt;br /&gt;
&lt;br /&gt;
* Reduce the delay between changing the state of the &amp;quot;Review rubric varies by topic?&amp;quot; checkbox on the Rubrics tab, and the show / hide of rubric drop-downs on the Topics tab.&lt;br /&gt;
* Redesign UI for tone analysis, heatmaps, and review scores pop-up.  These areas are designed around the assumption that reviews do NOT vary by topic.  For example, in the review scores pop-up, a reviewer can see the reviews they have given, arranged by question, across multiple reviewees.&lt;br /&gt;
* Consider whether the questionnaire options available for selection in drop-downs on the Topics and Rubrics tabs should include ''only'' those questionnaires created by the currently-logged-in instructor.  Our work in this project changed the filtering from instructor-owning-assignment to currently-logged-in instructor - but left in place all non-private questionnaires.  ''Consider'' whether non-private questionnaires should be excluded.  This may result in some drop-downs not having any available questionnaires.&lt;br /&gt;
&lt;br /&gt;
== Useful Links ==&lt;br /&gt;
In this section we provide useful links related to the work that has been completed by our team.&lt;br /&gt;
# [https://github.com/gabalmat/expertiza Forked Project Repository]&lt;br /&gt;
# [https://github.com/expertiza/expertiza/pull/1444 Pull Request]&lt;br /&gt;
# [(add link here) Video Demonstration of Specialized Rubrics]&lt;br /&gt;
# [(add link here) Video Demonstration of Passing Rspec Tests]&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Contacts ===&lt;br /&gt;
We have 4 (four) members in our team and 1 (one) mentor was also assigned to us. For any project-related questions/concerns please contact us:&lt;br /&gt;
* Aurora Tiffany-Davis - attiffan@ncsu.edu&lt;br /&gt;
* Ginger Balmat - gabalmat@ncsu.edu&lt;br /&gt;
* Joe Hutchinson - jehutch3@ncsu.edu&lt;br /&gt;
* Nikolay Titov - ngtitov@ncsu.edu&lt;br /&gt;
* Zhewei Hu (mentor) - zhu6@ncsu.edu&lt;br /&gt;
&lt;br /&gt;
=== Contribution Based Inquiry ===&lt;br /&gt;
For any questions or concerns related to the project design, implementation, testing of the feature developed by our team, please contact an engineer who worked closely on the topic of your interest based on the [https://docs.google.com/spreadsheets/d/11uxuI_5gaC-FQDwIOxtCaN3HZ9bfWDJgIjFemtYV5jE/edit?ts=5ca222f3#gid=0 Contribution Assignment Grid] we created to keep track of our progress and contribution. Please carbon copy all team members and our mentor in the email.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* Expertiza Web [https://github.com/expertiza/expertiza#expertiza]&lt;br /&gt;
* Expertiza on GitHub [https://github.com/expertiza/expertiza]&lt;br /&gt;
* Expertiza Wiki [http://wikis.lib.ncsu.edu/index.php/Expertiza]&lt;br /&gt;
* Rspec Documentation [https://relishapp.com/rspec]&lt;br /&gt;
* Wiki with Previous Work [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1873_Specialized_rubics_for_different_topic_types]&lt;br /&gt;
* Pull Request of the Previous Work [https://github.com/expertiza/expertiza/pull/1327]&lt;/div&gt;</summary>
		<author><name>Ngtitov</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics&amp;diff=124487</id>
		<title>E1936 Specialized Rubrics</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics&amp;diff=124487"/>
		<updated>2019-04-26T15:58:40Z</updated>

		<summary type="html">&lt;p&gt;Ngtitov: /* Diagrams */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page describes the work and goals that have been completed and achieved while implementing Expertiza Project &amp;quot;''E1936. Specialized Rubrics for Different Topic Types (e.g., Servo project, refactoring project)''&amp;quot; for the CSC/ECE 517 &amp;quot;Object-Oriented Design and Development&amp;quot; class, in the Spring semester of the 2019.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This Wiki page is created per CSC/ECE 517: &amp;quot;Object-Oriented Design and Development&amp;quot;, Expertiza Project requirements (Spring, 2019).&lt;br /&gt;
&lt;br /&gt;
Our [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Team team] was assigned the project &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936. Specialized rubrics for different topic types (e.g., Servo project, refactoring project)]&amp;quot;.  This is an Expertiza project.&lt;br /&gt;
&lt;br /&gt;
In this wiki page we describe the problem to be solved, how we solve that problem, and how we test our solution.  We also provide helpful links and contact information for our team.&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
In this section, we discuss the problem we need to solve, the Expertiza feature this problem is related to, what needs to be done to solve the problem (at a high level), and the previous attempt to solve this problem.&lt;br /&gt;
&lt;br /&gt;
=== Problem Statement ===&lt;br /&gt;
&lt;br /&gt;
This problem statement summarizes the problem as described in the project description &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936. Specialized rubrics for different topic types (e.g., Servo project, refactoring project)]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
In CSC/ECE 517, there are several types of topics that could be covered in a single class assignment.&lt;br /&gt;
* Code base&lt;br /&gt;
** Expertiza&lt;br /&gt;
** Mozilla&lt;br /&gt;
** etc.&lt;br /&gt;
* Goal&lt;br /&gt;
** Refactoring&lt;br /&gt;
** Testing&lt;br /&gt;
** etc.&lt;br /&gt;
However, currently we can only specify one kind of rubric for an assignment.  This means that teams working on different topics will be evaluated using the same rubric.  With this setup, it's not possible to fine-tune rubrics for different topics - rubrics tend to be overly general.&lt;br /&gt;
&lt;br /&gt;
=== Feature Description ===&lt;br /&gt;
&lt;br /&gt;
The Expertiza project already has a feature that allows rubrics to vary by project phase or &amp;quot;round&amp;quot;.  The feature we will add in this project is a feature to allow rubrics to vary not only by round, but also by topic.  This allows more flexibility to the instructor when setting up an assignment, so that they can use rubrics better suited to the tasks that students are performing in an assignment.&lt;br /&gt;
&lt;br /&gt;
When this feature is complete, the following scenarios will be possible, and the instructor will be the judge of which scenario is the best fit to the assignment:&lt;br /&gt;
&lt;br /&gt;
* Rubric does not vary by round or by topic.&lt;br /&gt;
* Rubric varies by round, but not by topic.&lt;br /&gt;
* Rubric varies by topic, but not by round.&lt;br /&gt;
* Rubric varies by both round and topic.&lt;br /&gt;
&lt;br /&gt;
=== What Needs to be Done ===&lt;br /&gt;
&lt;br /&gt;
This section summarizes the work as described in the project description &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936. Specialized rubrics for different topic types (e.g., Servo project, refactoring project)]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* In assignment#edit page &amp;quot;Rubrics&amp;quot; tab, add a checkbox to specify whether rubric should vary by topic.&lt;br /&gt;
* In assignment#edit page &amp;quot;Topics&amp;quot; tab, add dropdown(s) next to each topic to specify which rubric(s) are associated with the topic.&lt;br /&gt;
** The dropdown(s) should appear only if rubric should vary by topic, per the Rubrics tab.&lt;br /&gt;
** The topic should have a multiple dropdowns (one for each round) only if rubrics vary by round, per the Rubrics tab.&lt;br /&gt;
** By default, the rubric(s) for each course project will be the one(s) specified in “Rubrics” tab.&lt;br /&gt;
** The dropdown value can overwrite the default rubric.&lt;br /&gt;
* Be careful when making changes to the code&lt;br /&gt;
** The signup_sheet_controller should have as little to do as possible with the selection of rubrics.&lt;br /&gt;
** Anything not germane to selecting topics should be in another controller or (more probably) a helper.&lt;br /&gt;
* Create a DB migration to allow rubric to vary by topic as well as by round.&lt;br /&gt;
&lt;br /&gt;
==== Screenshots ====&lt;br /&gt;
'''Current screenshot of Rubrics tab for an Assignment'''&lt;br /&gt;
(need to add a checkbox to indicate that rubric should vary by topic)&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Screenshot Assignment Edit Rubrics.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Current screenshot of Topics tab for an Assignment'''&lt;br /&gt;
(need to add a way to select rubrics for particular topics)&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Screenshot Assignment Edit Topics.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Proposed screenshot of Rubrics tab for an Assignment'''&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Specialized Rubric rubric checkbox.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Proposed screenshot of Topics tab for an Assignment'''&lt;br /&gt;
&lt;br /&gt;
(drop down shown for only one topic here, but final product will have one for each topic)&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Specialized Rubric dropdown menu.png]]&lt;br /&gt;
&lt;br /&gt;
== Previous Work ==&lt;br /&gt;
&lt;br /&gt;
There was previous attempt to implement this project in the Fall of 2018 semester by different team, but it was rejected due to several reasons. As a result our team was assigned to complete this project with the given implementation. However, after detailed investigation of the proposed design that team has made in the previous semester and review of the code changes, we proposed different architectural solution for the problem, which we believe is simpler, more efficient, and elegant solution.&lt;br /&gt;
&lt;br /&gt;
=== Previous Project Implementation ===&lt;br /&gt;
&lt;br /&gt;
Our team was provided with all relevant information and materials about the design and implementation of the previously attempted project. We would like to acknowledge that we use previous implementation and design as reference and our starting point for our own implementation. The following is the list of links with the relevant materials that we have used for better project understanding, determining pros and cons of previously proposed changes, and establishing our design strategy and implementation:&lt;br /&gt;
&lt;br /&gt;
# [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1873_Specialized_rubics_for_different_topic_types Wiki]&lt;br /&gt;
# [https://github.com/expertiza/expertiza/pull/1327 Pull Request]&lt;br /&gt;
# [https://drive.google.com/file/d/1UrLb0Ula_Lb_F4MOrdC-s6xng6B08VYu/view Video Demo]&lt;br /&gt;
&lt;br /&gt;
After reviewing all relevant materials above, we concluded that the project implementation was incomplete and proposed design had significant flaw. &lt;br /&gt;
We identified main drawbacks and flaw as follows:&lt;br /&gt;
&lt;br /&gt;
* Establishing incorrect ''many-to-one'' relationship between ''sign_up_topics'' and ''questionnaires'' tables:&lt;br /&gt;
** Creating a DB migration to add ''questionnaire_id'' in the ''sign_up_topics'' table to store the dropdown data presumes ''one-to-one'' or ''many-to-one'' relationship between ''sign_up_topics'' and ''questionnaires'' tables&lt;br /&gt;
** Correct relationship between ''sign_up_topics'' and ''questionnaires'' tables is ''many-to-many''. For example, each project topic may have various rubrics depending on the round it is used (e.g., for round 1, topic may have one rubric; but for round 2, the same topic may have different rubric)&lt;br /&gt;
** Proposed previous migration changes would break DB design and would not allow to store correctly topic and its associated rubric per different round.&lt;br /&gt;
* Per project requirement specifications, &amp;quot;''The dropdown box should appear only if 'Vary rubric by topic' is selected in the Rubrics tab.''&amp;quot; This requirement was not met and ''Vary rubric by topic'' checkbox in the Rubrics tab was not implemented. Therefore, dropdown box with the list of rubrics appears regardless of whether &amp;quot;''Vary rubric by topic''&amp;quot; is selected or not.&lt;br /&gt;
* The dropdown box includes the list of all possible rubrics including default value. However, this condition can be improved. The dropdown box should list the rubrics that were created by the current user (professor who is logged in). This would allow to shorten the list of possible rubrics dramatically and help to avoid any misunderstanding and confusion while user selects desired rubric for the course project.&lt;br /&gt;
&lt;br /&gt;
We found no further issues with the rest implementation and in other project materials. Wiki page is very useful for understanding design of proposed changes, finding drawbacks and the flaw. Considering all the pros and cons, and taking into account drawbacks of the proposed changes, our team evolved different approach that should successfully solve the problem stated for the project without without creating additional issues. Please see our [http://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics#Project_Implementation Project Implementation] for more details.&lt;br /&gt;
&lt;br /&gt;
=== Previous Project Requirements ===&lt;br /&gt;
&lt;br /&gt;
The project requirements originally specified how to alter the databases to support varying rubrics by topic.&lt;br /&gt;
&lt;br /&gt;
''Create a new table named topic_questionnaires with field:''&lt;br /&gt;
* ''id''&lt;br /&gt;
* ''topic_id''&lt;br /&gt;
* ''questionnaire_id''&lt;br /&gt;
* ''used_in_round''&lt;br /&gt;
&lt;br /&gt;
However, the E1936 team successfully petitioned for this requirement to change to give us more freedom in the implementation.  The original suggestion had a flaw.  There is already an existing table in the Expertiza project called ''assignment_questionnaires'', which has columns including ''assignment_id'', ''questionnaire_id'', and ''used_in_round''.  It is this table that maintains the knowledge of which rubric is used in which round of an assignment.  If we were to add a new table to maintains the knowledge of which rubric is used in which topic of an assignment as originally suggested, then we would have a big problem.  Knowledge of round-rubric relationship is duplicated.  This would lead (best case scenario) to extra work, and (worst case scenario) to lots of bugs caused by inconsistencies in how these tables are handled with CRUD operations throughout the code.  In other words, this is not a DRY solution.&lt;br /&gt;
&lt;br /&gt;
== Project Implementation ==&lt;br /&gt;
&lt;br /&gt;
In this section, we propose our solution to the problem, discuss implementation techniques and details, and list the goals we achieved.&lt;br /&gt;
&lt;br /&gt;
We start by analyzing Entity Relationship Diagram where we state the solution to the problem. Further we discuss design strategy by breaking project problem into multiple staged sub-problems and provide solutions for each of these sub-problems. We also discuss some implementation details and provide the list of involved files. Finally, we demonstrate how the implemented feature can be used by providing a ''How To'' sub-section.&lt;br /&gt;
&lt;br /&gt;
=== UML Diagrams ===&lt;br /&gt;
&lt;br /&gt;
Our solution and implementation of the project can be easily shown by discussing Use Case, Entity Relationship, and Class diagrams. First, for simplicity we discuss in general possible sequence of interactions between a user (in this case instructor) and the system (Expertiza) via presenting Use Case Diagram. Then we plan to show proposed database modification via Entity Relationship Diagram. At this point the high-level design and proposed changes should be clear. To make our design more concrete and dive into implementation level, we decided to provide UML Class diagram. Finally, to demonstrate our achievements, we complete this section with the UML Sequence diagram to illustrate interactive behavior of a system with utilized specialized rubrics feature.&lt;br /&gt;
&lt;br /&gt;
==== Use Case Diagram ====&lt;br /&gt;
&lt;br /&gt;
[[File: use_case_diagram_1936.png]]&lt;br /&gt;
&lt;br /&gt;
The above Use Case Diagram shows general sequence of interactions between an instructor and the system (Expertiza) that defines where and how the feature can be utilized. Note that highlighted use cases are objects of our interest and work. Also please note that all of the shown use cases already exist in the system and we simply added a new feature into the system with existing use cases. Particularly, the rubric for each assignment and newly added ''Review rubric varies by topic'' checkbox with which instructor may choose to vary assignment by topic or not, by checking and unchecking the checkbox is displayed in the ''Rubrics'' tab. Hence, we show how instructor can get to the ''Rubrics'' tab of the assignments. Similarly, ''Topics'' tab of assignments has additional ''Questionnaires'' column for each topic, where instructor may specify which rubric associates with which topic. To perform this sequence of interactions and utilize the new feature, instructor must choose ''Edit'' any assignment from the list of all assignments displayed to him/her in the ''Manage Assignments'' page, which can be navigated by instructor by selecting it from the header of the system.&lt;br /&gt;
&lt;br /&gt;
==== Entity Relationship Diagram ====&lt;br /&gt;
&lt;br /&gt;
[[File: HW04_ERD.png]]&lt;br /&gt;
&lt;br /&gt;
The sections of the diagram highlighted in yellow show newly introduced items.  That is, we are adding a new column called ''topic_id'' to ''assignment_questionnaires'', in order to link ''assignment_questionnaires'' to ''sign_up_topics''.&lt;br /&gt;
&lt;br /&gt;
Any assignment, topic, or questionnaire may be represented by multiple records within ''assignment_questionnaires'', but each record within ''assignment_questionnaires'' refers to just one assignment, topic, or questionnaire.  It is the ability to have an assignment represented by multiple records, and the new relationship to ''sign_up_topics'', that allows us to support all of the required scenarios:&lt;br /&gt;
&lt;br /&gt;
* Rubric does not vary by round or by topic.&lt;br /&gt;
* Rubric varies by round, but not by topic.&lt;br /&gt;
* Rubric varies by topic, but not by round.&lt;br /&gt;
* Rubric varies by both round and topic.&lt;br /&gt;
&lt;br /&gt;
[[File: HW04_table.PNG]]&lt;br /&gt;
&lt;br /&gt;
This table illustrates the possibilities that the system may have.&lt;br /&gt;
&lt;br /&gt;
* Assignment 1 does not vary by round or by topic.&lt;br /&gt;
* Assignment 2 varies by round, but not by topic.&lt;br /&gt;
* Assignment 3 varies by topic, but not by round.&lt;br /&gt;
* Assignment 4 varies by both round and topic.&lt;br /&gt;
&lt;br /&gt;
This change is done via database migration by running the following commands:&lt;br /&gt;
&lt;br /&gt;
  rails generate migration AddTopicIdToAssignmentQuestionnaires&lt;br /&gt;
&lt;br /&gt;
Above command adds the ''topic_id'' column to the ''AssignmentQuestionnaires'' table and generates new migration file:&lt;br /&gt;
&lt;br /&gt;
[[File: db_migration.png]]&lt;br /&gt;
&lt;br /&gt;
To see the details of the entire database change please check this [https://github.com/gabalmat/expertiza/commit/d46dd57d35a21ab43efb82c28d3f14b75c695f2e commit].&lt;br /&gt;
&lt;br /&gt;
==== Class Diagram ====&lt;br /&gt;
&lt;br /&gt;
[[File: class_diagram_1936.png]]&lt;br /&gt;
&lt;br /&gt;
The above UML Class diagram describes the changes our team made in the Ruby classes, methods and attributes. Please note that all provided classes in the diagram had already existed in the system, and we only added new relationship, modified existing methods (and some method signatures) and utilized given attributes. All of the class's attributes and methods that are shown in the diagram are utilized (directly and indirectly) in our current implementation. Some of the methods and attributes provided within the classes in the diagram are newly developed. There is only one newly added aggregation relationship between the ''SingUpTopic'' class and ''AssignmentQuestionnaire'' class. Moreover, controllers and models for the certain classes were combined into a single class for simplicity to the design description. In reality, half of the methods shown in  the ''Assignment'' class are implemented in the ''app/controllers/assignments_controller.rb'' file and other half is in the ''app/models/assignment.rb'' file. We decided to combine all of the functionalities of each ''relevant'' controller and model class into single class for the ease of design presentation and interpretation. We used Sequence diagram below to illustrate how MVC architectural pattern is used for a given classes.&lt;br /&gt;
&lt;br /&gt;
=== Design Strategy ===&lt;br /&gt;
&lt;br /&gt;
As we have concrete understanding of the problem and proposed solution, we would like break this problem into multiple more manageable sub-problems with specific tasks and well-defined solutions to these tasks. Generally, each sub-problem requires modification of one or more files. We would like to propose our Design Strategy as follows:&lt;br /&gt;
&lt;br /&gt;
==== Preparation ====&lt;br /&gt;
&lt;br /&gt;
* Clean up code that our implementation will use&lt;br /&gt;
** PROBLEM: We need to add/change content to the edit assignment Topics tab, but unlike other tabs in the views, it does not have its own partial view to work with&lt;br /&gt;
*** SOLUTION: Refactor and move the code dealing with topics into separate ''app/views/assignments/edit/_topics.html.erb'' file&lt;br /&gt;
*** File: ''app/views/assignments/edit.html.erb''&lt;br /&gt;
** PROBLEM: In a section below, we discuss the need to modify existing methods to also accept an optional argument ''topic_id''.  In many cases these existing method use confusing variable names or lack sufficient comments.&lt;br /&gt;
*** SOLUTION: Clean up methods that we plan to modify&lt;br /&gt;
*** FILE: (many)&lt;br /&gt;
&lt;br /&gt;
==== Implementation ====&lt;br /&gt;
&lt;br /&gt;
* Allow an instructor to indicate that rubric should vary by topic&lt;br /&gt;
** PROBLEM: There is no way for an instructor to indicate that an assignments' rubric should vary by topic&lt;br /&gt;
*** SOLUTION: Add a new checkbox in the edit assignment Rubrics tab to indicate this preference&lt;br /&gt;
*** FILE: ''app/views/assignments/edit/_rubrics.html.erb''&lt;br /&gt;
** PROBLEM: If the user changes the &amp;quot;Review rubric varies by round?&amp;quot; or &amp;quot;Review rubric varies by topic?&amp;quot; checkbox on the Rubrics tab, but leaves the page in an inappropriate state before leaving the tab (e.g. rubric weights that do not add up to 0% or 100%), then the user does not get feedback that they made a mistake.  They only get such feedback when explicitly performing a &amp;quot;Save&amp;quot;.  Switching from tab to tab on the assignments edit page attempts to perform an implicit save, but there is no mechanism to update the flash messages onscreen if anything goes wrong.  This becomes more problematic now that the Topics tab appearance depends on choices made on the Rubrics tab.  &lt;br /&gt;
*** SOLUTION: Provide a route to an assignments controller method that can return a render of the flash messages.  Add an AJAX call on the assignments edit view that can update the flash messages onscreen.&lt;br /&gt;
*** FILE: app/controllers/assignments_controller.rb&lt;br /&gt;
*** FILE: app/views/assignments/edit.html.erb&lt;br /&gt;
&lt;br /&gt;
* Allow an instructor to choose different rubrics for different topics&lt;br /&gt;
** PROBLEM: There is no way for an instructor to choose different rubrics for different topics&lt;br /&gt;
*** SOLUTION: Add a new column in the edit assignment Topics tab for choosing rubric(s)&lt;br /&gt;
**** New column only visible if rubrics vary by topic, per Rubrics tab&lt;br /&gt;
**** New column has multiple rounds per topic only if rubrics vary by round, per Rubrics tab&lt;br /&gt;
**** Default value for any rubric is that rubric which is shown on Rubrics tab&lt;br /&gt;
**** Rubric(s) in the dropdown list is/are only those that were created by the currently logged in instructor&lt;br /&gt;
*** FILE: ''app/views/assignments/edit/_topics.html.erb''&lt;br /&gt;
** PROBLEM: The code in ''app/views/assignments/edit/_rubrics.html.erb'' includes dropdowns like the ones we need to add for topics, but that code is way too complex for its functionality (too heavy for a view, uses JavaScript)&lt;br /&gt;
*** SOLUTION: Use the code in ''app/views/assignments/edit/_rubrics.html.erb'' for inspiration only&lt;br /&gt;
**** Refactor and move as much actual work as possible out into helper methods that are simply called from this view&lt;br /&gt;
**** Views are not intended to do heavy lifting&lt;br /&gt;
**** Use as little JavaScript as possible, since this is a Ruby On Rails project, not a JS project&lt;br /&gt;
*** FILE: ''app/views/assignments/edit/_topics.html.erb''&lt;br /&gt;
** PROBLEM: The drop-downs for selecting rubrics should show only those rubrics created by the currently-logged in instructor (per project mentor).  They currently include those created by the instructor of the relevant assignment.&lt;br /&gt;
*** SOLUTION: Change the filtering in the ''questionnaire_options'' method to reflect the desired filtering.&lt;br /&gt;
*** FILE: app/helpers/assignment_helper.rb&lt;br /&gt;
&lt;br /&gt;
* Support the ability of the database to link rubrics to topics&lt;br /&gt;
** PROBLEM: There is no relationship in the database that can link together rubrics with topics&lt;br /&gt;
*** SOLUTION: Add a new migration that adds topic_id field to existing assignment_questionnaires table&lt;br /&gt;
**** This new field will reference the id field in the sign_up_topics table&lt;br /&gt;
*** FILE: ''db/migrate/[timestamp]_add_topic_id_to_assignment_questionnaires_table.rb''&lt;br /&gt;
** PROBLEM: The AssignmentQuestionnaire model does not have any knowledge of topics&lt;br /&gt;
*** SOLUTION: Add a new belongs_to reference in the model, to sign_up_topic&lt;br /&gt;
*** FILE: ''app/models/assignment_questionnaire.rb''&lt;br /&gt;
** PROBLEM: The SignUpTopic model does not have any knowledge of assignment_questionnaire records&lt;br /&gt;
*** SOLUTION: Add a new has_many reference in the model, to assignment_questionnaires&lt;br /&gt;
*** FILE: ''app/models/sign_up_topic.rb''&lt;br /&gt;
&lt;br /&gt;
* React to an instructor saving an assignment after altering the rubrics-vary-by-topic checkbox&lt;br /&gt;
** PROBLEM: There is nothing in place to remember when an instructor chooses to vary rubrics by topic, or chooses to not vary rubrics by topic&lt;br /&gt;
*** SOLUTION: Modify existing method ''update_assignment_questionnaires()''.  This method executes upon assignment save (explicit or via tab-change).  This method deletes all ''AssignmentQuestionnaire'' records before creating new correct records reflecting the user's selections in the edit assignment form.  Modify such that this method can create multiple records reflecting multiple topics, in the case where rubric should vary by topic.  With this modification, the correct records (with default rubrics) are present when the user goes to the Topics tab, so that the Topics tab can display properly.&lt;br /&gt;
*** FILE: app\models\assignment_form.rb&lt;br /&gt;
** PROBLEM: There is no way to refresh the Topics tab to show / hide drop-downs after the instructor changes checkbox on Rubrics tab&lt;br /&gt;
*** SOLUTION: Make use of existing &amp;quot;Save&amp;quot;-like functionality when changing tabs on the edit assignment page.  When updating due to tab-change, cause a fresh render of the Topics tab.  When updating due to &amp;quot;Save&amp;quot; button, keep functionality as-is.&lt;br /&gt;
*** FILE: ''app/controllers/assignments_controller.rb''&lt;br /&gt;
*** FILE: ''app/views/assignments/edit.html.erb''&lt;br /&gt;
&lt;br /&gt;
* Support the ability to find the correct rubric for a particular topic&lt;br /&gt;
** PROBLEM: The existing methods allow us to find the correct rubric for a particular round, but not a particular topic&lt;br /&gt;
*** SOLUTION: Modify the existing method questionnaire(assignment, type, round_number) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/helpers/assignment_helper.rb''&lt;br /&gt;
*** SOLUTION: Modify the existing method assignment_questionnaire(assignment, type, number) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/helpers/assignment_helper.rb''&lt;br /&gt;
*** SOLUTION: Modify the existing method questionnaire(round = nil) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/models/review_response_map.rb''&lt;br /&gt;
*** SOLUTION: Modify the existing method questionnaire(round) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/models/self_review_response_map.rb''&lt;br /&gt;
*** SOLUTION: Modify the existing method review_questionnaire_id(round = nil) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/models/assignment.rb''&lt;br /&gt;
&lt;br /&gt;
* Use the correct rubric for a particular topic&lt;br /&gt;
** PROBLEM: When finding rubrics to display, save results from, calculate scores from, etc. round may be used but topic is not&lt;br /&gt;
*** SOLUTION: Examine all callers of methods modified in the previous section and pass in ''topic_id'' where appropriate to grab the correct rubric&lt;br /&gt;
*** FILE: (many)&lt;br /&gt;
&lt;br /&gt;
* Support the ability to determine if an assignment has rubrics that vary by topic&lt;br /&gt;
** PROBLEM: There is no handy method to call that can tell us if an assignment has rubrics that vary by topic&lt;br /&gt;
*** SOLUTION: Add a new method ''varying_rubrics_by_topic?'' based on the existing method ''varying_rubrics_by_round?''&lt;br /&gt;
*** FILE: ''app/models/assignment.rb''&lt;br /&gt;
&lt;br /&gt;
=== Q&amp;amp;A ===&lt;br /&gt;
&lt;br /&gt;
Here we paraphrase some questions we received during round 1 of the documentation review.&lt;br /&gt;
&lt;br /&gt;
* Q: How will the new logic for varying rubric by topic tie in with the existing logic?&lt;br /&gt;
** A: We will add a new field ''topic_id'' into the existing table ''assignment_questionnaires'', as noted in the [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Entity_Relationship_Diagram E/R Diagram].  We will update methods that find questionnaires to allow these methods to also accept a ''topic_id'' argument, as noted in [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Implementation Implementation].&lt;br /&gt;
* Q: How will the &amp;quot;Rubric varies by topic&amp;quot; selection be stored?&lt;br /&gt;
** A: Indirectly, by saving records in the ''assignment_questionnaires'' table which either reference a ''topic_id'' or leave this field nil.  For more details please see the [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Entity_Relationship_Diagram E/R Diagram] discussion.&lt;br /&gt;
* Q: What will happen if an instructor selects &amp;quot;Rubric varies by topic&amp;quot;, makes selections on the &amp;quot;Topics&amp;quot; tab, and then deselects &amp;quot;Rubric varies by topic&amp;quot;?&lt;br /&gt;
** A: The Topics tab, when next visited, will no longer show dropdowns for selecting rubrics by topic.  When the assignment is saved, the appropriate not-varying-by-topic records will be saved in the ''assignment_questionnaires'' table.  For more details please see [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Implementation Implementation].&lt;br /&gt;
* Q: What will happen after an instructor selects &amp;quot;Rubric varies by topic&amp;quot;?&lt;br /&gt;
** A: The Topics tab, when next visited, will now show dropdowns for selecting rubrics by topic.  These rubrics will default to those shown on the Rubrics tab.  When the assignment is saved, the appropriate varying-by-topic records will be saved in the ''assignment_questionnaires'' table.  For more details please see [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Implementation Implementation].&lt;br /&gt;
* Q: How will the appropriate list of questionnaires for the new dropdowns on the Topics tab be determined?&lt;br /&gt;
** A: In the same way that the appropriate list of questionnaires for the existing dropdowns on the Rubrics tab is determined.  Namely, by the ''questionnaire_options'' method in the file ''expertiza/app/helpers/assignment_helper.rb''.&lt;br /&gt;
&lt;br /&gt;
=== (Selected) Modified Code ===&lt;br /&gt;
&lt;br /&gt;
In this section, we provide ''selected portions'' of modified code to illustrate how we implemented the new feature.&lt;br /&gt;
&lt;br /&gt;
Allow an instructor to indicate that rubric should vary by topic&lt;br /&gt;
&lt;br /&gt;
''app\views\assignments\edit\_rubrics.html.erb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;lt;input name=&amp;quot;vary_by_topic&amp;quot; type=&amp;quot;hidden&amp;quot; value=&amp;quot;false&amp;quot; /&amp;gt;&lt;br /&gt;
  &amp;lt;%= check_box_tag('vary_by_topic', 'true', @review_vary_by_topic_check) %&amp;gt;&lt;br /&gt;
  &amp;lt;%= label_tag('vary_by_topic', 'Review rubric varies by topic?') %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Allow an instructor to choose different rubrics for different topics&lt;br /&gt;
&lt;br /&gt;
''app\views\sign_up_sheet\_table_line.html.erb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;lt;% if @assignment_form.assignment.varying_rubrics_by_topic? %&amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;table id = &amp;lt;%=table_id %&amp;gt;&amp;gt;&lt;br /&gt;
        &amp;lt;tr&amp;gt;&lt;br /&gt;
          &amp;lt;script&amp;gt;&lt;br /&gt;
              ...&lt;br /&gt;
              &amp;lt;% if @assignment_form.assignment.varying_rubrics_by_round? %&amp;gt;&lt;br /&gt;
                &amp;lt;% for round in 1..@assignment_form.assignment.rounds_of_reviews %&amp;gt;&lt;br /&gt;
                  ...&lt;br /&gt;
                &amp;lt;% end %&amp;gt;&lt;br /&gt;
              &amp;lt;% else %&amp;gt;&lt;br /&gt;
                ...&lt;br /&gt;
              &amp;lt;% end %&amp;gt;&lt;br /&gt;
          &amp;lt;/script&amp;gt;&lt;br /&gt;
        &amp;lt;/tr&amp;gt;&lt;br /&gt;
      &amp;lt;/table&amp;gt;&lt;br /&gt;
    &amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Support the ability of the database to link rubrics to topics&lt;br /&gt;
&lt;br /&gt;
''app\models\sign_up_topic.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  class SignUpTopic &amp;lt; ActiveRecord::Base&lt;br /&gt;
    ...&lt;br /&gt;
    has_many :assignment_questionnaires, class_name: 'AssignmentQuestionnaire', foreign_key: 'topic_id', dependent: :destroy&lt;br /&gt;
    ...&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
React to an instructor saving an assignment after altering the rubrics-vary-by-topic checkbox&lt;br /&gt;
&lt;br /&gt;
''app/controllers/assignments_controller.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def update&lt;br /&gt;
    ...&lt;br /&gt;
    # What to do next depends on how we got here&lt;br /&gt;
    if params['button'].nil?&lt;br /&gt;
      # REFRESH the topics tab after changing tabs&lt;br /&gt;
      ...&lt;br /&gt;
      render :partial =&amp;gt; &amp;quot;assignments/edit/topics&amp;quot;&lt;br /&gt;
    else&lt;br /&gt;
      # SAVE button was used (do a redirect)&lt;br /&gt;
      redirect_to edit_assignment_path @assignment_form.assignment.id&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Support the ability to find the correct rubric for a particular topic&lt;br /&gt;
&lt;br /&gt;
''app/helpers/assignment_helper.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def assignment_questionnaire(assignment, questionnaire_type, round_number = nil, topic_id = nil)&lt;br /&gt;
    q_by_type = assignment.questionnaires.find_by(type: questionnaire_type)&lt;br /&gt;
    if q_by_type.nil?&lt;br /&gt;
      ...&lt;br /&gt;
    else&lt;br /&gt;
      ...&lt;br /&gt;
      aq_by_type = assignment.assignment_questionnaires.find_by(questionnaire_id: q_by_type.id)&lt;br /&gt;
      if round_number.nil? &amp;amp;&amp;amp; topic_id.nil?&lt;br /&gt;
        # Find by type&lt;br /&gt;
        aq = aq_by_type&lt;br /&gt;
      elsif topic_id.nil?&lt;br /&gt;
        # Find by round&lt;br /&gt;
        aq = assignment.assignment_questionnaires.find_by(used_in_round: round_number)&lt;br /&gt;
      elsif round_number.nil?&lt;br /&gt;
        # Find by topic&lt;br /&gt;
        aq = assignment.assignment_questionnaires.find_by(topic_id: topic_id)&lt;br /&gt;
      else&lt;br /&gt;
        # Find by round and topic&lt;br /&gt;
        aq = assignment.assignment_questionnaires.where(used_in_round: round_number, topic_id: topic_id).first&lt;br /&gt;
      end&lt;br /&gt;
      aq.nil? ? aq_by_type : aq&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use the correct rubric for a particular topic&lt;br /&gt;
&lt;br /&gt;
''app\controllers\response_controller.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def set_questionnaire_for_new_response&lt;br /&gt;
    case @map.type&lt;br /&gt;
    when &amp;quot;ReviewResponseMap&amp;quot;, &amp;quot;SelfReviewResponseMap&amp;quot;&lt;br /&gt;
      reviewees_topic = SignedUpTeam.topic_id_by_team_id(@contributor.id)&lt;br /&gt;
      @current_round = @assignment.number_of_current_round(reviewees_topic)&lt;br /&gt;
      @questionnaire = @map.questionnaire(@current_round, reviewees_topic)&lt;br /&gt;
    when&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Support the ability to determine if an assignment has rubrics that vary by topic&lt;br /&gt;
&lt;br /&gt;
''app\models\assignment.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def varying_rubrics_by_topic?&lt;br /&gt;
    aq_no_topic_id = AssignmentQuestionnaire.where(assignment_id: self.id, topic_id: nil).size &amp;gt;= 1&lt;br /&gt;
    aq_with_topic_id = AssignmentQuestionnaire.where(assignment_id: self.id).where.not(topic_id: nil).size &amp;gt;= 1&lt;br /&gt;
    if !aq_no_topic_id &amp;amp;&amp;amp; !aq_with_topic_id&lt;br /&gt;
      return false&lt;br /&gt;
    elsif aq_no_topic_id &amp;amp;&amp;amp; !aq_with_topic_id&lt;br /&gt;
      return false&lt;br /&gt;
    elsif !aq_no_topic_id &amp;amp;&amp;amp; aq_with_topic_id&lt;br /&gt;
      return true&lt;br /&gt;
    else&lt;br /&gt;
      raise StandardError.new(&amp;quot;Assignment with id &amp;quot; + self.id.to_s + &amp;quot; has a conflict about whether or not it varies by topic&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== How To ==&lt;br /&gt;
&lt;br /&gt;
In this section, we describe how to use the newly implemented feature.&lt;br /&gt;
&lt;br /&gt;
=== Add a New Rubric ===&lt;br /&gt;
&lt;br /&gt;
* [to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
=== Select a Rubric for a Topic ===&lt;br /&gt;
&lt;br /&gt;
* [to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
== Project Testing ==&lt;br /&gt;
&lt;br /&gt;
=== Strategy ===&lt;br /&gt;
&lt;br /&gt;
To test code implementation, correctness of the added feature, verify that the team did not break any existing functionalities in the Expertiza, and ensure that no bugs were introduced in the code, we developed the following Test Strategy:&lt;br /&gt;
&lt;br /&gt;
# Code inspection&lt;br /&gt;
# Run and pass existing RSpec Tests&lt;br /&gt;
# Develop New RSpec Tests&lt;br /&gt;
# Run through live UI to test a feature using Expertiza instance&lt;br /&gt;
&lt;br /&gt;
=== Rspec Testing ===&lt;br /&gt;
&lt;br /&gt;
==== Existing Tests ====&lt;br /&gt;
&lt;br /&gt;
Run all existing RSpec tests on any changed files, after our changes, to ensure that we have not introduced any failures.&lt;br /&gt;
The commands and results are shown below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
e@ubuntu:~/Desktop/CSC517_HW04/expertiza$ bundle exec rspec spec/helpers/ spec/controllers/ spec/models/&lt;br /&gt;
[Coveralls] Set up the SimpleCov formatter.&lt;br /&gt;
[Coveralls] Using SimpleCov's 'rails' settings.&lt;br /&gt;
&lt;br /&gt;
Randomized with seed 6978&lt;br /&gt;
[...]&lt;br /&gt;
&lt;br /&gt;
Finished in 8 minutes 10 seconds (files took 12.32 seconds to load)&lt;br /&gt;
900 examples, 0 failures, 16 pending&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The features tests were extremely time-consuming so we did not routinely run them during development.  However TravisCI results on our [https://github.com/expertiza/expertiza/pull/1444 Pull Request] demonstrate the passing status of all tests.&lt;br /&gt;
&lt;br /&gt;
==== New Tests ====&lt;br /&gt;
&lt;br /&gt;
Write comprehensive RSpec tests, for all new or modified methods.&lt;br /&gt;
* FILE: ''spec/helpers/assignment_helper_spec.rb''&lt;br /&gt;
** METHODS TO TEST: &lt;br /&gt;
*** questionnaire(assignment, type, round_number, topic_id)&lt;br /&gt;
*** assignment_questionnaire(assignment, type, number, topic_id)&lt;br /&gt;
* FILE: ''spec/models/review_response_map_spec.rb''&lt;br /&gt;
*** METHODS TO TEST:&lt;br /&gt;
**** questionnaire(round, topic_id)&lt;br /&gt;
* FILE: ''spec/models/self_review_response_map_spec.rb''&lt;br /&gt;
*** METHODS TO TEST:&lt;br /&gt;
**** questionnaire(round, topic_id)&lt;br /&gt;
* FILE: ''spec/models/assignment_spec.rb''&lt;br /&gt;
*** METHODS TO TEST:&lt;br /&gt;
**** review_questionnaire_id(round, topic_id)&lt;br /&gt;
**** varying_rubrics_by_topic?()&lt;br /&gt;
&lt;br /&gt;
Run these tests, to ensure that the new code works as intended.&lt;br /&gt;
The commands and results are shown below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
e@ubuntu:~/Desktop/CSC517_HW04/expertiza$ bundle exec rspec spec/helpers/assignment_helper_spec.rb spec/models/review_response_map_spec.rb spec/models/self_review_response_map_spec.rb spec/models/assignment_spec.rb &lt;br /&gt;
[Coveralls] Set up the SimpleCov formatter.&lt;br /&gt;
[Coveralls] Using SimpleCov's 'rails' settings.&lt;br /&gt;
&lt;br /&gt;
Randomized with seed 47508&lt;br /&gt;
....................................................................................................................&lt;br /&gt;
&lt;br /&gt;
Finished in 1 minute 7.94 seconds (files took 10.85 seconds to load)&lt;br /&gt;
116 examples, 0 failures&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The test suite for a single new method is shown below.&lt;br /&gt;
* There are many such suites added in expertiza/spec  &lt;br /&gt;
* This example illustrates our general strategy:&lt;br /&gt;
** test missing input&lt;br /&gt;
** test bad input&lt;br /&gt;
** test various acceptable forms of input&lt;br /&gt;
** test scenarios that lead to various return values&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  describe &amp;quot;#questionnaire&amp;quot; do&lt;br /&gt;
&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;throws exception if assignment argument nil&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;throws exception if all arguments nil except for assignment&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;finds by type if round number &amp;amp; topic id not given&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;throws exception if round number &amp;amp; topic id not given, no luck finding by type&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;finds by round number alone if round number alone is given&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;creates new questionnaire of given type if round number alone is given, no luck finding by round&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;finds by topic id alone if topic id alone is given&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;creates new questionnaire of given type if topic id alone is given, no luck finding by topic&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;finds by round number and topic id if both are given&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;creates new questionnaire of given type if round and topic are given, no luck finding by round and topic&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== UI Testing ===&lt;br /&gt;
&lt;br /&gt;
Here we describe manual UI Testing that was performed.&lt;br /&gt;
&lt;br /&gt;
==== Rubric does not vary by round or by topic ====&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
==== Rubric varies by round, but not by topic ====&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
==== Rubric varies by topic, but not by round ====&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
==== Rubric varies by both round and topic ====&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
In CSC/ECE 517, there are several types of topics that could be covered in a single class assignment.  However, currently we can only specify one kind of rubric for an assignment. This means that teams working on different topics will be evaluated using the same rubric. With this setup, it's not possible to fine-tune rubrics for different topics - rubrics tend to be overly general.&lt;br /&gt;
&lt;br /&gt;
In this project, we have solved this issue, by allowing rubrics to vary not only by round, but also by topic. This allows more flexibility to the instructor when setting up an assignment, so that they can use rubrics better suited to the tasks that students are performing in an assignment.  The following scenarios will be possible, and the instructor will be the judge of which scenario is the best fit to the assignment:&lt;br /&gt;
&lt;br /&gt;
* Rubric does not vary by round or by topic.&lt;br /&gt;
* Rubric varies by round, but not by topic.&lt;br /&gt;
* Rubric varies by topic, but not by round.&lt;br /&gt;
* Rubric varies by both round and topic.&lt;br /&gt;
&lt;br /&gt;
The instructor may use the Rubrics tab of the assignments edit page to make changes to the &amp;quot;Review rubric varies by round?&amp;quot; and &amp;quot;Review rubric varies by topic?&amp;quot; checkboxes.  The instructor may then use the Topics tab to select the appropriate rubric(s) for every topic in the assignment.&lt;br /&gt;
&lt;br /&gt;
Various other Expertiza code has been updated to retrieve the correct rubric depending on round and topic after the instructor has made these selections.&lt;br /&gt;
&lt;br /&gt;
== Future Work ==&lt;br /&gt;
&lt;br /&gt;
This section discusses possible future work for another CSC 517 team to take on.  Such a team can search the Expertiza codebase for &amp;quot;TODO E1936 (future work)&amp;quot; to find most of the places in the code that the notes below refer to.&lt;br /&gt;
&lt;br /&gt;
* Reduce the delay between changing the state of the &amp;quot;Review rubric varies by topic?&amp;quot; checkbox on the Rubrics tab, and the show / hide of rubric drop-downs on the Topics tab.&lt;br /&gt;
* Redesign UI for tone analysis, heatmaps, and review scores pop-up.  These areas are designed around the assumption that reviews do NOT vary by topic.  For example, in the review scores pop-up, a reviewer can see the reviews they have given, arranged by question, across multiple reviewees.&lt;br /&gt;
* Consider whether the questionnaire options available for selection in drop-downs on the Topics and Rubrics tabs should include ''only'' those questionnaires created by the currently-logged-in instructor.  Our work in this project changed the filtering from instructor-owning-assignment to currently-logged-in instructor - but left in place all non-private questionnaires.  ''Consider'' whether non-private questionnaires should be excluded.  This may result in some drop-downs not having any available questionnaires.&lt;br /&gt;
&lt;br /&gt;
== Useful Links ==&lt;br /&gt;
In this section we provide useful links related to the work that has been completed by our team.&lt;br /&gt;
# [https://github.com/gabalmat/expertiza Forked Project Repository]&lt;br /&gt;
# [https://github.com/expertiza/expertiza/pull/1444 Pull Request]&lt;br /&gt;
# [(add link here) Video Demonstration of Specialized Rubrics]&lt;br /&gt;
# [(add link here) Video Demonstration of Passing Rspec Tests]&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Contacts ===&lt;br /&gt;
We have 4 (four) members in our team and 1 (one) mentor was also assigned to us. For any project-related questions/concerns please contact us:&lt;br /&gt;
* Aurora Tiffany-Davis - attiffan@ncsu.edu&lt;br /&gt;
* Ginger Balmat - gabalmat@ncsu.edu&lt;br /&gt;
* Joe Hutchinson - jehutch3@ncsu.edu&lt;br /&gt;
* Nikolay Titov - ngtitov@ncsu.edu&lt;br /&gt;
* Zhewei Hu (mentor) - zhu6@ncsu.edu&lt;br /&gt;
&lt;br /&gt;
=== Contribution Based Inquiry ===&lt;br /&gt;
For any questions or concerns related to the project design, implementation, testing of the feature developed by our team, please contact an engineer who worked closely on the topic of your interest based on the [https://docs.google.com/spreadsheets/d/11uxuI_5gaC-FQDwIOxtCaN3HZ9bfWDJgIjFemtYV5jE/edit?ts=5ca222f3#gid=0 Contribution Assignment Grid] we created to keep track of our progress and contribution. Please carbon copy all team members and our mentor in the email.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* Expertiza Web [https://github.com/expertiza/expertiza#expertiza]&lt;br /&gt;
* Expertiza on GitHub [https://github.com/expertiza/expertiza]&lt;br /&gt;
* Expertiza Wiki [http://wikis.lib.ncsu.edu/index.php/Expertiza]&lt;br /&gt;
* Rspec Documentation [https://relishapp.com/rspec]&lt;br /&gt;
* Wiki with Previous Work [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1873_Specialized_rubics_for_different_topic_types]&lt;br /&gt;
* Pull Request of the Previous Work [https://github.com/expertiza/expertiza/pull/1327]&lt;/div&gt;</summary>
		<author><name>Ngtitov</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics&amp;diff=124485</id>
		<title>E1936 Specialized Rubrics</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics&amp;diff=124485"/>
		<updated>2019-04-26T15:45:59Z</updated>

		<summary type="html">&lt;p&gt;Ngtitov: /* Previous Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page describes the work and goals that have been completed and achieved while implementing Expertiza Project &amp;quot;''E1936. Specialized Rubrics for Different Topic Types (e.g., Servo project, refactoring project)''&amp;quot; for the CSC/ECE 517 &amp;quot;Object-Oriented Design and Development&amp;quot; class, in the Spring semester of the 2019.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This Wiki page is created per CSC/ECE 517: &amp;quot;Object-Oriented Design and Development&amp;quot;, Expertiza Project requirements (Spring, 2019).&lt;br /&gt;
&lt;br /&gt;
Our [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Team team] was assigned the project &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936. Specialized rubrics for different topic types (e.g., Servo project, refactoring project)]&amp;quot;.  This is an Expertiza project.&lt;br /&gt;
&lt;br /&gt;
In this wiki page we describe the problem to be solved, how we solve that problem, and how we test our solution.  We also provide helpful links and contact information for our team.&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
In this section, we discuss the problem we need to solve, the Expertiza feature this problem is related to, what needs to be done to solve the problem (at a high level), and the previous attempt to solve this problem.&lt;br /&gt;
&lt;br /&gt;
=== Problem Statement ===&lt;br /&gt;
&lt;br /&gt;
This problem statement summarizes the problem as described in the project description &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936. Specialized rubrics for different topic types (e.g., Servo project, refactoring project)]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
In CSC/ECE 517, there are several types of topics that could be covered in a single class assignment.&lt;br /&gt;
* Code base&lt;br /&gt;
** Expertiza&lt;br /&gt;
** Mozilla&lt;br /&gt;
** etc.&lt;br /&gt;
* Goal&lt;br /&gt;
** Refactoring&lt;br /&gt;
** Testing&lt;br /&gt;
** etc.&lt;br /&gt;
However, currently we can only specify one kind of rubric for an assignment.  This means that teams working on different topics will be evaluated using the same rubric.  With this setup, it's not possible to fine-tune rubrics for different topics - rubrics tend to be overly general.&lt;br /&gt;
&lt;br /&gt;
=== Feature Description ===&lt;br /&gt;
&lt;br /&gt;
The Expertiza project already has a feature that allows rubrics to vary by project phase or &amp;quot;round&amp;quot;.  The feature we will add in this project is a feature to allow rubrics to vary not only by round, but also by topic.  This allows more flexibility to the instructor when setting up an assignment, so that they can use rubrics better suited to the tasks that students are performing in an assignment.&lt;br /&gt;
&lt;br /&gt;
When this feature is complete, the following scenarios will be possible, and the instructor will be the judge of which scenario is the best fit to the assignment:&lt;br /&gt;
&lt;br /&gt;
* Rubric does not vary by round or by topic.&lt;br /&gt;
* Rubric varies by round, but not by topic.&lt;br /&gt;
* Rubric varies by topic, but not by round.&lt;br /&gt;
* Rubric varies by both round and topic.&lt;br /&gt;
&lt;br /&gt;
=== What Needs to be Done ===&lt;br /&gt;
&lt;br /&gt;
This section summarizes the work as described in the project description &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936. Specialized rubrics for different topic types (e.g., Servo project, refactoring project)]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* In assignment#edit page &amp;quot;Rubrics&amp;quot; tab, add a checkbox to specify whether rubric should vary by topic.&lt;br /&gt;
* In assignment#edit page &amp;quot;Topics&amp;quot; tab, add dropdown(s) next to each topic to specify which rubric(s) are associated with the topic.&lt;br /&gt;
** The dropdown(s) should appear only if rubric should vary by topic, per the Rubrics tab.&lt;br /&gt;
** The topic should have a multiple dropdowns (one for each round) only if rubrics vary by round, per the Rubrics tab.&lt;br /&gt;
** By default, the rubric(s) for each course project will be the one(s) specified in “Rubrics” tab.&lt;br /&gt;
** The dropdown value can overwrite the default rubric.&lt;br /&gt;
* Be careful when making changes to the code&lt;br /&gt;
** The signup_sheet_controller should have as little to do as possible with the selection of rubrics.&lt;br /&gt;
** Anything not germane to selecting topics should be in another controller or (more probably) a helper.&lt;br /&gt;
* Create a DB migration to allow rubric to vary by topic as well as by round.&lt;br /&gt;
&lt;br /&gt;
==== Screenshots ====&lt;br /&gt;
'''Current screenshot of Rubrics tab for an Assignment'''&lt;br /&gt;
(need to add a checkbox to indicate that rubric should vary by topic)&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Screenshot Assignment Edit Rubrics.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Current screenshot of Topics tab for an Assignment'''&lt;br /&gt;
(need to add a way to select rubrics for particular topics)&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Screenshot Assignment Edit Topics.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Proposed screenshot of Rubrics tab for an Assignment'''&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Specialized Rubric rubric checkbox.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Proposed screenshot of Topics tab for an Assignment'''&lt;br /&gt;
&lt;br /&gt;
(drop down shown for only one topic here, but final product will have one for each topic)&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Specialized Rubric dropdown menu.png]]&lt;br /&gt;
&lt;br /&gt;
== Previous Work ==&lt;br /&gt;
&lt;br /&gt;
There was previous attempt to implement this project in the Fall of 2018 semester by different team, but it was rejected due to several reasons. As a result our team was assigned to complete this project with the given implementation. However, after detailed investigation of the proposed design that team has made in the previous semester and review of the code changes, we proposed different architectural solution for the problem, which we believe is simpler, more efficient, and elegant solution.&lt;br /&gt;
&lt;br /&gt;
=== Previous Project Implementation ===&lt;br /&gt;
&lt;br /&gt;
Our team was provided with all relevant information and materials about the design and implementation of the previously attempted project. We would like to acknowledge that we use previous implementation and design as reference and our starting point for our own implementation. The following is the list of links with the relevant materials that we have used for better project understanding, determining pros and cons of previously proposed changes, and establishing our design strategy and implementation:&lt;br /&gt;
&lt;br /&gt;
# [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1873_Specialized_rubics_for_different_topic_types Wiki]&lt;br /&gt;
# [https://github.com/expertiza/expertiza/pull/1327 Pull Request]&lt;br /&gt;
# [https://drive.google.com/file/d/1UrLb0Ula_Lb_F4MOrdC-s6xng6B08VYu/view Video Demo]&lt;br /&gt;
&lt;br /&gt;
After reviewing all relevant materials above, we concluded that the project implementation was incomplete and proposed design had significant flaw. &lt;br /&gt;
We identified main drawbacks and flaw as follows:&lt;br /&gt;
&lt;br /&gt;
* Establishing incorrect ''many-to-one'' relationship between ''sign_up_topics'' and ''questionnaires'' tables:&lt;br /&gt;
** Creating a DB migration to add ''questionnaire_id'' in the ''sign_up_topics'' table to store the dropdown data presumes ''one-to-one'' or ''many-to-one'' relationship between ''sign_up_topics'' and ''questionnaires'' tables&lt;br /&gt;
** Correct relationship between ''sign_up_topics'' and ''questionnaires'' tables is ''many-to-many''. For example, each project topic may have various rubrics depending on the round it is used (e.g., for round 1, topic may have one rubric; but for round 2, the same topic may have different rubric)&lt;br /&gt;
** Proposed previous migration changes would break DB design and would not allow to store correctly topic and its associated rubric per different round.&lt;br /&gt;
* Per project requirement specifications, &amp;quot;''The dropdown box should appear only if 'Vary rubric by topic' is selected in the Rubrics tab.''&amp;quot; This requirement was not met and ''Vary rubric by topic'' checkbox in the Rubrics tab was not implemented. Therefore, dropdown box with the list of rubrics appears regardless of whether &amp;quot;''Vary rubric by topic''&amp;quot; is selected or not.&lt;br /&gt;
* The dropdown box includes the list of all possible rubrics including default value. However, this condition can be improved. The dropdown box should list the rubrics that were created by the current user (professor who is logged in). This would allow to shorten the list of possible rubrics dramatically and help to avoid any misunderstanding and confusion while user selects desired rubric for the course project.&lt;br /&gt;
&lt;br /&gt;
We found no further issues with the rest implementation and in other project materials. Wiki page is very useful for understanding design of proposed changes, finding drawbacks and the flaw. Considering all the pros and cons, and taking into account drawbacks of the proposed changes, our team evolved different approach that should successfully solve the problem stated for the project without without creating additional issues. Please see our [http://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics#Project_Implementation Project Implementation] for more details.&lt;br /&gt;
&lt;br /&gt;
=== Previous Project Requirements ===&lt;br /&gt;
&lt;br /&gt;
The project requirements originally specified how to alter the databases to support varying rubrics by topic.&lt;br /&gt;
&lt;br /&gt;
''Create a new table named topic_questionnaires with field:''&lt;br /&gt;
* ''id''&lt;br /&gt;
* ''topic_id''&lt;br /&gt;
* ''questionnaire_id''&lt;br /&gt;
* ''used_in_round''&lt;br /&gt;
&lt;br /&gt;
However, the E1936 team successfully petitioned for this requirement to change to give us more freedom in the implementation.  The original suggestion had a flaw.  There is already an existing table in the Expertiza project called ''assignment_questionnaires'', which has columns including ''assignment_id'', ''questionnaire_id'', and ''used_in_round''.  It is this table that maintains the knowledge of which rubric is used in which round of an assignment.  If we were to add a new table to maintains the knowledge of which rubric is used in which topic of an assignment as originally suggested, then we would have a big problem.  Knowledge of round-rubric relationship is duplicated.  This would lead (best case scenario) to extra work, and (worst case scenario) to lots of bugs caused by inconsistencies in how these tables are handled with CRUD operations throughout the code.  In other words, this is not a DRY solution.&lt;br /&gt;
&lt;br /&gt;
== Project Implementation ==&lt;br /&gt;
&lt;br /&gt;
In this section, we propose our solution to the problem, discuss implementation techniques and details, and list the goals we achieved.&lt;br /&gt;
&lt;br /&gt;
We start by analyzing Entity Relationship Diagram where we state the solution to the problem. Further we discuss design strategy by breaking project problem into multiple staged sub-problems and provide solutions for each of these sub-problems. We also discuss some implementation details and provide the list of involved files. Finally, we demonstrate how the implemented feature can be used by providing a ''How To'' sub-section.&lt;br /&gt;
&lt;br /&gt;
=== Diagrams ===&lt;br /&gt;
&lt;br /&gt;
Our solution and implementation of the project can be easily shown by discussing Use Case, Entity Relationship, and Class diagrams. First, for simplicity we discuss in general possible sequence of interactions between a user (in this case instructor) and the system (Expertiza) via presenting Use Case Diagram. Then we plan to show proposed database modification via Entity Relationship Diagram.&lt;br /&gt;
&lt;br /&gt;
==== Use Case Diagram ====&lt;br /&gt;
&lt;br /&gt;
[[File: use_case_diagram_1936.png]]&lt;br /&gt;
&lt;br /&gt;
The above Use Case Diagram shows general sequence of interactions between an instructor and the system (Expertiza) that defines where and how the feature can be utilized. Note that highlighted use cases are objects of our interest and work. Also please note that all of the shown use cases already exist in the system and we simply added a new feature into the system with existing use cases. Particularly, the rubric for each assignment and newly added ''Review rubric varies by topic'' checkbox with which instructor may choose to vary assignment by topic or not, by checking and unchecking the checkbox is displayed in the ''Rubrics'' tab. Hence, we show how instructor can get to the ''Rubrics'' tab of the assignments. Similarly, ''Topics'' tab of assignments has additional ''Questionnaires'' column for each topic, where instructor may specify which rubric associates with which topic. To perform this sequence of interactions and utilize the new feature, instructor must choose ''Edit'' any assignment from the list of all assignments displayed to him/her in the ''Manage Assignments'' page, which can be navigated by instructor by selecting it from the header of the system.&lt;br /&gt;
&lt;br /&gt;
==== Entity Relationship Diagram ====&lt;br /&gt;
&lt;br /&gt;
[[File: HW04_ERD.png]]&lt;br /&gt;
&lt;br /&gt;
The sections of the diagram highlighted in yellow show newly introduced items.  That is, we are adding a new column called ''topic_id'' to ''assignment_questionnaires'', in order to link ''assignment_questionnaires'' to ''sign_up_topics''.&lt;br /&gt;
&lt;br /&gt;
Any assignment, topic, or questionnaire may be represented by multiple records within ''assignment_questionnaires'', but each record within ''assignment_questionnaires'' refers to just one assignment, topic, or questionnaire.  It is the ability to have an assignment represented by multiple records, and the new relationship to ''sign_up_topics'', that allows us to support all of the required scenarios:&lt;br /&gt;
&lt;br /&gt;
* Rubric does not vary by round or by topic.&lt;br /&gt;
* Rubric varies by round, but not by topic.&lt;br /&gt;
* Rubric varies by topic, but not by round.&lt;br /&gt;
* Rubric varies by both round and topic.&lt;br /&gt;
&lt;br /&gt;
[[File: HW04_table.PNG]]&lt;br /&gt;
&lt;br /&gt;
This table illustrates the possibilities that the system may have.&lt;br /&gt;
&lt;br /&gt;
* Assignment 1 does not vary by round or by topic.&lt;br /&gt;
* Assignment 2 varies by round, but not by topic.&lt;br /&gt;
* Assignment 3 varies by topic, but not by round.&lt;br /&gt;
* Assignment 4 varies by both round and topic.&lt;br /&gt;
&lt;br /&gt;
This change is done via database migration by running the following commands:&lt;br /&gt;
&lt;br /&gt;
  rails generate migration AddTopicIdToAssignmentQuestionnaires&lt;br /&gt;
&lt;br /&gt;
Above command adds the ''topic_id'' column to the ''AssignmentQuestionnaires'' table and generates new migration file:&lt;br /&gt;
&lt;br /&gt;
[[File: db_migration.png]]&lt;br /&gt;
&lt;br /&gt;
To see the details of the entire database change please check this [https://github.com/gabalmat/expertiza/commit/d46dd57d35a21ab43efb82c28d3f14b75c695f2e commit].&lt;br /&gt;
&lt;br /&gt;
==== Class Diagram ====&lt;br /&gt;
&lt;br /&gt;
[[File: class_diagram_1936.png]]&lt;br /&gt;
&lt;br /&gt;
The above UML Class diagram describes the changes our team made in the Ruby classes, methods and attributes. Please note that all provided classes in the diagram had already existed in the system, and we only added new relationship, modified existing methods (and some method signatures) and utilized given attributes. All of the class's attributes and methods that are shown in the diagram are utilized (directly and indirectly) in our current implementation. Some of the methods and attributes provided within the classes in the diagram are newly developed. There is only one newly added aggregation relationship between the ''SingUpTopic'' class and ''AssignmentQuestionnaire'' class. Moreover, controllers and models for the certain classes were combined into a single class for simplicity to the design description. In reality, half of the methods shown in  the ''Assignment'' class are implemented in the ''app/controllers/assignments_controller.rb'' file and other half is in the ''app/models/assignment.rb'' file. We decided to combine all of the functionalities of each ''relevant'' controller and model class into single class for the ease of design presentation and interpretation. We used Sequence diagram below to illustrate how MVC architectural pattern is used for a given classes.&lt;br /&gt;
&lt;br /&gt;
=== Design Strategy ===&lt;br /&gt;
&lt;br /&gt;
As we have concrete understanding of the problem and proposed solution, we would like break this problem into multiple more manageable sub-problems with specific tasks and well-defined solutions to these tasks. Generally, each sub-problem requires modification of one or more files. We would like to propose our Design Strategy as follows:&lt;br /&gt;
&lt;br /&gt;
==== Preparation ====&lt;br /&gt;
&lt;br /&gt;
* Clean up code that our implementation will use&lt;br /&gt;
** PROBLEM: We need to add/change content to the edit assignment Topics tab, but unlike other tabs in the views, it does not have its own partial view to work with&lt;br /&gt;
*** SOLUTION: Refactor and move the code dealing with topics into separate ''app/views/assignments/edit/_topics.html.erb'' file&lt;br /&gt;
*** File: ''app/views/assignments/edit.html.erb''&lt;br /&gt;
** PROBLEM: In a section below, we discuss the need to modify existing methods to also accept an optional argument ''topic_id''.  In many cases these existing method use confusing variable names or lack sufficient comments.&lt;br /&gt;
*** SOLUTION: Clean up methods that we plan to modify&lt;br /&gt;
*** FILE: (many)&lt;br /&gt;
&lt;br /&gt;
==== Implementation ====&lt;br /&gt;
&lt;br /&gt;
* Allow an instructor to indicate that rubric should vary by topic&lt;br /&gt;
** PROBLEM: There is no way for an instructor to indicate that an assignments' rubric should vary by topic&lt;br /&gt;
*** SOLUTION: Add a new checkbox in the edit assignment Rubrics tab to indicate this preference&lt;br /&gt;
*** FILE: ''app/views/assignments/edit/_rubrics.html.erb''&lt;br /&gt;
** PROBLEM: If the user changes the &amp;quot;Review rubric varies by round?&amp;quot; or &amp;quot;Review rubric varies by topic?&amp;quot; checkbox on the Rubrics tab, but leaves the page in an inappropriate state before leaving the tab (e.g. rubric weights that do not add up to 0% or 100%), then the user does not get feedback that they made a mistake.  They only get such feedback when explicitly performing a &amp;quot;Save&amp;quot;.  Switching from tab to tab on the assignments edit page attempts to perform an implicit save, but there is no mechanism to update the flash messages onscreen if anything goes wrong.  This becomes more problematic now that the Topics tab appearance depends on choices made on the Rubrics tab.  &lt;br /&gt;
*** SOLUTION: Provide a route to an assignments controller method that can return a render of the flash messages.  Add an AJAX call on the assignments edit view that can update the flash messages onscreen.&lt;br /&gt;
*** FILE: app/controllers/assignments_controller.rb&lt;br /&gt;
*** FILE: app/views/assignments/edit.html.erb&lt;br /&gt;
&lt;br /&gt;
* Allow an instructor to choose different rubrics for different topics&lt;br /&gt;
** PROBLEM: There is no way for an instructor to choose different rubrics for different topics&lt;br /&gt;
*** SOLUTION: Add a new column in the edit assignment Topics tab for choosing rubric(s)&lt;br /&gt;
**** New column only visible if rubrics vary by topic, per Rubrics tab&lt;br /&gt;
**** New column has multiple rounds per topic only if rubrics vary by round, per Rubrics tab&lt;br /&gt;
**** Default value for any rubric is that rubric which is shown on Rubrics tab&lt;br /&gt;
**** Rubric(s) in the dropdown list is/are only those that were created by the currently logged in instructor&lt;br /&gt;
*** FILE: ''app/views/assignments/edit/_topics.html.erb''&lt;br /&gt;
** PROBLEM: The code in ''app/views/assignments/edit/_rubrics.html.erb'' includes dropdowns like the ones we need to add for topics, but that code is way too complex for its functionality (too heavy for a view, uses JavaScript)&lt;br /&gt;
*** SOLUTION: Use the code in ''app/views/assignments/edit/_rubrics.html.erb'' for inspiration only&lt;br /&gt;
**** Refactor and move as much actual work as possible out into helper methods that are simply called from this view&lt;br /&gt;
**** Views are not intended to do heavy lifting&lt;br /&gt;
**** Use as little JavaScript as possible, since this is a Ruby On Rails project, not a JS project&lt;br /&gt;
*** FILE: ''app/views/assignments/edit/_topics.html.erb''&lt;br /&gt;
** PROBLEM: The drop-downs for selecting rubrics should show only those rubrics created by the currently-logged in instructor (per project mentor).  They currently include those created by the instructor of the relevant assignment.&lt;br /&gt;
*** SOLUTION: Change the filtering in the ''questionnaire_options'' method to reflect the desired filtering.&lt;br /&gt;
*** FILE: app/helpers/assignment_helper.rb&lt;br /&gt;
&lt;br /&gt;
* Support the ability of the database to link rubrics to topics&lt;br /&gt;
** PROBLEM: There is no relationship in the database that can link together rubrics with topics&lt;br /&gt;
*** SOLUTION: Add a new migration that adds topic_id field to existing assignment_questionnaires table&lt;br /&gt;
**** This new field will reference the id field in the sign_up_topics table&lt;br /&gt;
*** FILE: ''db/migrate/[timestamp]_add_topic_id_to_assignment_questionnaires_table.rb''&lt;br /&gt;
** PROBLEM: The AssignmentQuestionnaire model does not have any knowledge of topics&lt;br /&gt;
*** SOLUTION: Add a new belongs_to reference in the model, to sign_up_topic&lt;br /&gt;
*** FILE: ''app/models/assignment_questionnaire.rb''&lt;br /&gt;
** PROBLEM: The SignUpTopic model does not have any knowledge of assignment_questionnaire records&lt;br /&gt;
*** SOLUTION: Add a new has_many reference in the model, to assignment_questionnaires&lt;br /&gt;
*** FILE: ''app/models/sign_up_topic.rb''&lt;br /&gt;
&lt;br /&gt;
* React to an instructor saving an assignment after altering the rubrics-vary-by-topic checkbox&lt;br /&gt;
** PROBLEM: There is nothing in place to remember when an instructor chooses to vary rubrics by topic, or chooses to not vary rubrics by topic&lt;br /&gt;
*** SOLUTION: Modify existing method ''update_assignment_questionnaires()''.  This method executes upon assignment save (explicit or via tab-change).  This method deletes all ''AssignmentQuestionnaire'' records before creating new correct records reflecting the user's selections in the edit assignment form.  Modify such that this method can create multiple records reflecting multiple topics, in the case where rubric should vary by topic.  With this modification, the correct records (with default rubrics) are present when the user goes to the Topics tab, so that the Topics tab can display properly.&lt;br /&gt;
*** FILE: app\models\assignment_form.rb&lt;br /&gt;
** PROBLEM: There is no way to refresh the Topics tab to show / hide drop-downs after the instructor changes checkbox on Rubrics tab&lt;br /&gt;
*** SOLUTION: Make use of existing &amp;quot;Save&amp;quot;-like functionality when changing tabs on the edit assignment page.  When updating due to tab-change, cause a fresh render of the Topics tab.  When updating due to &amp;quot;Save&amp;quot; button, keep functionality as-is.&lt;br /&gt;
*** FILE: ''app/controllers/assignments_controller.rb''&lt;br /&gt;
*** FILE: ''app/views/assignments/edit.html.erb''&lt;br /&gt;
&lt;br /&gt;
* Support the ability to find the correct rubric for a particular topic&lt;br /&gt;
** PROBLEM: The existing methods allow us to find the correct rubric for a particular round, but not a particular topic&lt;br /&gt;
*** SOLUTION: Modify the existing method questionnaire(assignment, type, round_number) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/helpers/assignment_helper.rb''&lt;br /&gt;
*** SOLUTION: Modify the existing method assignment_questionnaire(assignment, type, number) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/helpers/assignment_helper.rb''&lt;br /&gt;
*** SOLUTION: Modify the existing method questionnaire(round = nil) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/models/review_response_map.rb''&lt;br /&gt;
*** SOLUTION: Modify the existing method questionnaire(round) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/models/self_review_response_map.rb''&lt;br /&gt;
*** SOLUTION: Modify the existing method review_questionnaire_id(round = nil) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/models/assignment.rb''&lt;br /&gt;
&lt;br /&gt;
* Use the correct rubric for a particular topic&lt;br /&gt;
** PROBLEM: When finding rubrics to display, save results from, calculate scores from, etc. round may be used but topic is not&lt;br /&gt;
*** SOLUTION: Examine all callers of methods modified in the previous section and pass in ''topic_id'' where appropriate to grab the correct rubric&lt;br /&gt;
*** FILE: (many)&lt;br /&gt;
&lt;br /&gt;
* Support the ability to determine if an assignment has rubrics that vary by topic&lt;br /&gt;
** PROBLEM: There is no handy method to call that can tell us if an assignment has rubrics that vary by topic&lt;br /&gt;
*** SOLUTION: Add a new method ''varying_rubrics_by_topic?'' based on the existing method ''varying_rubrics_by_round?''&lt;br /&gt;
*** FILE: ''app/models/assignment.rb''&lt;br /&gt;
&lt;br /&gt;
=== Q&amp;amp;A ===&lt;br /&gt;
&lt;br /&gt;
Here we paraphrase some questions we received during round 1 of the documentation review.&lt;br /&gt;
&lt;br /&gt;
* Q: How will the new logic for varying rubric by topic tie in with the existing logic?&lt;br /&gt;
** A: We will add a new field ''topic_id'' into the existing table ''assignment_questionnaires'', as noted in the [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Entity_Relationship_Diagram E/R Diagram].  We will update methods that find questionnaires to allow these methods to also accept a ''topic_id'' argument, as noted in [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Implementation Implementation].&lt;br /&gt;
* Q: How will the &amp;quot;Rubric varies by topic&amp;quot; selection be stored?&lt;br /&gt;
** A: Indirectly, by saving records in the ''assignment_questionnaires'' table which either reference a ''topic_id'' or leave this field nil.  For more details please see the [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Entity_Relationship_Diagram E/R Diagram] discussion.&lt;br /&gt;
* Q: What will happen if an instructor selects &amp;quot;Rubric varies by topic&amp;quot;, makes selections on the &amp;quot;Topics&amp;quot; tab, and then deselects &amp;quot;Rubric varies by topic&amp;quot;?&lt;br /&gt;
** A: The Topics tab, when next visited, will no longer show dropdowns for selecting rubrics by topic.  When the assignment is saved, the appropriate not-varying-by-topic records will be saved in the ''assignment_questionnaires'' table.  For more details please see [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Implementation Implementation].&lt;br /&gt;
* Q: What will happen after an instructor selects &amp;quot;Rubric varies by topic&amp;quot;?&lt;br /&gt;
** A: The Topics tab, when next visited, will now show dropdowns for selecting rubrics by topic.  These rubrics will default to those shown on the Rubrics tab.  When the assignment is saved, the appropriate varying-by-topic records will be saved in the ''assignment_questionnaires'' table.  For more details please see [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Implementation Implementation].&lt;br /&gt;
* Q: How will the appropriate list of questionnaires for the new dropdowns on the Topics tab be determined?&lt;br /&gt;
** A: In the same way that the appropriate list of questionnaires for the existing dropdowns on the Rubrics tab is determined.  Namely, by the ''questionnaire_options'' method in the file ''expertiza/app/helpers/assignment_helper.rb''.&lt;br /&gt;
&lt;br /&gt;
=== (Selected) Modified Code ===&lt;br /&gt;
&lt;br /&gt;
In this section, we provide ''selected portions'' of modified code to illustrate how we implemented the new feature.&lt;br /&gt;
&lt;br /&gt;
Allow an instructor to indicate that rubric should vary by topic&lt;br /&gt;
&lt;br /&gt;
''app\views\assignments\edit\_rubrics.html.erb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;lt;input name=&amp;quot;vary_by_topic&amp;quot; type=&amp;quot;hidden&amp;quot; value=&amp;quot;false&amp;quot; /&amp;gt;&lt;br /&gt;
  &amp;lt;%= check_box_tag('vary_by_topic', 'true', @review_vary_by_topic_check) %&amp;gt;&lt;br /&gt;
  &amp;lt;%= label_tag('vary_by_topic', 'Review rubric varies by topic?') %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Allow an instructor to choose different rubrics for different topics&lt;br /&gt;
&lt;br /&gt;
''app\views\sign_up_sheet\_table_line.html.erb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;lt;% if @assignment_form.assignment.varying_rubrics_by_topic? %&amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;table id = &amp;lt;%=table_id %&amp;gt;&amp;gt;&lt;br /&gt;
        &amp;lt;tr&amp;gt;&lt;br /&gt;
          &amp;lt;script&amp;gt;&lt;br /&gt;
              ...&lt;br /&gt;
              &amp;lt;% if @assignment_form.assignment.varying_rubrics_by_round? %&amp;gt;&lt;br /&gt;
                &amp;lt;% for round in 1..@assignment_form.assignment.rounds_of_reviews %&amp;gt;&lt;br /&gt;
                  ...&lt;br /&gt;
                &amp;lt;% end %&amp;gt;&lt;br /&gt;
              &amp;lt;% else %&amp;gt;&lt;br /&gt;
                ...&lt;br /&gt;
              &amp;lt;% end %&amp;gt;&lt;br /&gt;
          &amp;lt;/script&amp;gt;&lt;br /&gt;
        &amp;lt;/tr&amp;gt;&lt;br /&gt;
      &amp;lt;/table&amp;gt;&lt;br /&gt;
    &amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Support the ability of the database to link rubrics to topics&lt;br /&gt;
&lt;br /&gt;
''app\models\sign_up_topic.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  class SignUpTopic &amp;lt; ActiveRecord::Base&lt;br /&gt;
    ...&lt;br /&gt;
    has_many :assignment_questionnaires, class_name: 'AssignmentQuestionnaire', foreign_key: 'topic_id', dependent: :destroy&lt;br /&gt;
    ...&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
React to an instructor saving an assignment after altering the rubrics-vary-by-topic checkbox&lt;br /&gt;
&lt;br /&gt;
''app/controllers/assignments_controller.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def update&lt;br /&gt;
    ...&lt;br /&gt;
    # What to do next depends on how we got here&lt;br /&gt;
    if params['button'].nil?&lt;br /&gt;
      # REFRESH the topics tab after changing tabs&lt;br /&gt;
      ...&lt;br /&gt;
      render :partial =&amp;gt; &amp;quot;assignments/edit/topics&amp;quot;&lt;br /&gt;
    else&lt;br /&gt;
      # SAVE button was used (do a redirect)&lt;br /&gt;
      redirect_to edit_assignment_path @assignment_form.assignment.id&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Support the ability to find the correct rubric for a particular topic&lt;br /&gt;
&lt;br /&gt;
''app/helpers/assignment_helper.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def assignment_questionnaire(assignment, questionnaire_type, round_number = nil, topic_id = nil)&lt;br /&gt;
    q_by_type = assignment.questionnaires.find_by(type: questionnaire_type)&lt;br /&gt;
    if q_by_type.nil?&lt;br /&gt;
      ...&lt;br /&gt;
    else&lt;br /&gt;
      ...&lt;br /&gt;
      aq_by_type = assignment.assignment_questionnaires.find_by(questionnaire_id: q_by_type.id)&lt;br /&gt;
      if round_number.nil? &amp;amp;&amp;amp; topic_id.nil?&lt;br /&gt;
        # Find by type&lt;br /&gt;
        aq = aq_by_type&lt;br /&gt;
      elsif topic_id.nil?&lt;br /&gt;
        # Find by round&lt;br /&gt;
        aq = assignment.assignment_questionnaires.find_by(used_in_round: round_number)&lt;br /&gt;
      elsif round_number.nil?&lt;br /&gt;
        # Find by topic&lt;br /&gt;
        aq = assignment.assignment_questionnaires.find_by(topic_id: topic_id)&lt;br /&gt;
      else&lt;br /&gt;
        # Find by round and topic&lt;br /&gt;
        aq = assignment.assignment_questionnaires.where(used_in_round: round_number, topic_id: topic_id).first&lt;br /&gt;
      end&lt;br /&gt;
      aq.nil? ? aq_by_type : aq&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use the correct rubric for a particular topic&lt;br /&gt;
&lt;br /&gt;
''app\controllers\response_controller.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def set_questionnaire_for_new_response&lt;br /&gt;
    case @map.type&lt;br /&gt;
    when &amp;quot;ReviewResponseMap&amp;quot;, &amp;quot;SelfReviewResponseMap&amp;quot;&lt;br /&gt;
      reviewees_topic = SignedUpTeam.topic_id_by_team_id(@contributor.id)&lt;br /&gt;
      @current_round = @assignment.number_of_current_round(reviewees_topic)&lt;br /&gt;
      @questionnaire = @map.questionnaire(@current_round, reviewees_topic)&lt;br /&gt;
    when&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Support the ability to determine if an assignment has rubrics that vary by topic&lt;br /&gt;
&lt;br /&gt;
''app\models\assignment.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def varying_rubrics_by_topic?&lt;br /&gt;
    aq_no_topic_id = AssignmentQuestionnaire.where(assignment_id: self.id, topic_id: nil).size &amp;gt;= 1&lt;br /&gt;
    aq_with_topic_id = AssignmentQuestionnaire.where(assignment_id: self.id).where.not(topic_id: nil).size &amp;gt;= 1&lt;br /&gt;
    if !aq_no_topic_id &amp;amp;&amp;amp; !aq_with_topic_id&lt;br /&gt;
      return false&lt;br /&gt;
    elsif aq_no_topic_id &amp;amp;&amp;amp; !aq_with_topic_id&lt;br /&gt;
      return false&lt;br /&gt;
    elsif !aq_no_topic_id &amp;amp;&amp;amp; aq_with_topic_id&lt;br /&gt;
      return true&lt;br /&gt;
    else&lt;br /&gt;
      raise StandardError.new(&amp;quot;Assignment with id &amp;quot; + self.id.to_s + &amp;quot; has a conflict about whether or not it varies by topic&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== How To ==&lt;br /&gt;
&lt;br /&gt;
In this section, we describe how to use the newly implemented feature.&lt;br /&gt;
&lt;br /&gt;
=== Add a New Rubric ===&lt;br /&gt;
&lt;br /&gt;
* [to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
=== Select a Rubric for a Topic ===&lt;br /&gt;
&lt;br /&gt;
* [to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
== Project Testing ==&lt;br /&gt;
&lt;br /&gt;
=== Strategy ===&lt;br /&gt;
&lt;br /&gt;
To test code implementation, correctness of the added feature, verify that the team did not break any existing functionalities in the Expertiza, and ensure that no bugs were introduced in the code, we developed the following Test Strategy:&lt;br /&gt;
&lt;br /&gt;
# Code inspection&lt;br /&gt;
# Run and pass existing RSpec Tests&lt;br /&gt;
# Develop New RSpec Tests&lt;br /&gt;
# Run through live UI to test a feature using Expertiza instance&lt;br /&gt;
&lt;br /&gt;
=== Rspec Testing ===&lt;br /&gt;
&lt;br /&gt;
==== Existing Tests ====&lt;br /&gt;
&lt;br /&gt;
Run all existing RSpec tests on any changed files, after our changes, to ensure that we have not introduced any failures.&lt;br /&gt;
The commands and results are shown below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
e@ubuntu:~/Desktop/CSC517_HW04/expertiza$ bundle exec rspec spec/helpers/ spec/controllers/ spec/models/&lt;br /&gt;
[Coveralls] Set up the SimpleCov formatter.&lt;br /&gt;
[Coveralls] Using SimpleCov's 'rails' settings.&lt;br /&gt;
&lt;br /&gt;
Randomized with seed 6978&lt;br /&gt;
[...]&lt;br /&gt;
&lt;br /&gt;
Finished in 8 minutes 10 seconds (files took 12.32 seconds to load)&lt;br /&gt;
900 examples, 0 failures, 16 pending&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The features tests were extremely time-consuming so we did not routinely run them during development.  However TravisCI results on our [https://github.com/expertiza/expertiza/pull/1444 Pull Request] demonstrate the passing status of all tests.&lt;br /&gt;
&lt;br /&gt;
==== New Tests ====&lt;br /&gt;
&lt;br /&gt;
Write comprehensive RSpec tests, for all new or modified methods.&lt;br /&gt;
* FILE: ''spec/helpers/assignment_helper_spec.rb''&lt;br /&gt;
** METHODS TO TEST: &lt;br /&gt;
*** questionnaire(assignment, type, round_number, topic_id)&lt;br /&gt;
*** assignment_questionnaire(assignment, type, number, topic_id)&lt;br /&gt;
* FILE: ''spec/models/review_response_map_spec.rb''&lt;br /&gt;
*** METHODS TO TEST:&lt;br /&gt;
**** questionnaire(round, topic_id)&lt;br /&gt;
* FILE: ''spec/models/self_review_response_map_spec.rb''&lt;br /&gt;
*** METHODS TO TEST:&lt;br /&gt;
**** questionnaire(round, topic_id)&lt;br /&gt;
* FILE: ''spec/models/assignment_spec.rb''&lt;br /&gt;
*** METHODS TO TEST:&lt;br /&gt;
**** review_questionnaire_id(round, topic_id)&lt;br /&gt;
**** varying_rubrics_by_topic?()&lt;br /&gt;
&lt;br /&gt;
Run these tests, to ensure that the new code works as intended.&lt;br /&gt;
The commands and results are shown below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
e@ubuntu:~/Desktop/CSC517_HW04/expertiza$ bundle exec rspec spec/helpers/assignment_helper_spec.rb spec/models/review_response_map_spec.rb spec/models/self_review_response_map_spec.rb spec/models/assignment_spec.rb &lt;br /&gt;
[Coveralls] Set up the SimpleCov formatter.&lt;br /&gt;
[Coveralls] Using SimpleCov's 'rails' settings.&lt;br /&gt;
&lt;br /&gt;
Randomized with seed 47508&lt;br /&gt;
....................................................................................................................&lt;br /&gt;
&lt;br /&gt;
Finished in 1 minute 7.94 seconds (files took 10.85 seconds to load)&lt;br /&gt;
116 examples, 0 failures&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The test suite for a single new method is shown below.&lt;br /&gt;
* There are many such suites added in expertiza/spec  &lt;br /&gt;
* This example illustrates our general strategy:&lt;br /&gt;
** test missing input&lt;br /&gt;
** test bad input&lt;br /&gt;
** test various acceptable forms of input&lt;br /&gt;
** test scenarios that lead to various return values&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  describe &amp;quot;#questionnaire&amp;quot; do&lt;br /&gt;
&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;throws exception if assignment argument nil&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;throws exception if all arguments nil except for assignment&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;finds by type if round number &amp;amp; topic id not given&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;throws exception if round number &amp;amp; topic id not given, no luck finding by type&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;finds by round number alone if round number alone is given&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;creates new questionnaire of given type if round number alone is given, no luck finding by round&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;finds by topic id alone if topic id alone is given&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;creates new questionnaire of given type if topic id alone is given, no luck finding by topic&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;finds by round number and topic id if both are given&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;creates new questionnaire of given type if round and topic are given, no luck finding by round and topic&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== UI Testing ===&lt;br /&gt;
&lt;br /&gt;
Here we describe manual UI Testing that was performed.&lt;br /&gt;
&lt;br /&gt;
==== Rubric does not vary by round or by topic ====&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
==== Rubric varies by round, but not by topic ====&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
==== Rubric varies by topic, but not by round ====&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
==== Rubric varies by both round and topic ====&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
In CSC/ECE 517, there are several types of topics that could be covered in a single class assignment.  However, currently we can only specify one kind of rubric for an assignment. This means that teams working on different topics will be evaluated using the same rubric. With this setup, it's not possible to fine-tune rubrics for different topics - rubrics tend to be overly general.&lt;br /&gt;
&lt;br /&gt;
In this project, we have solved this issue, by allowing rubrics to vary not only by round, but also by topic. This allows more flexibility to the instructor when setting up an assignment, so that they can use rubrics better suited to the tasks that students are performing in an assignment.  The following scenarios will be possible, and the instructor will be the judge of which scenario is the best fit to the assignment:&lt;br /&gt;
&lt;br /&gt;
* Rubric does not vary by round or by topic.&lt;br /&gt;
* Rubric varies by round, but not by topic.&lt;br /&gt;
* Rubric varies by topic, but not by round.&lt;br /&gt;
* Rubric varies by both round and topic.&lt;br /&gt;
&lt;br /&gt;
The instructor may use the Rubrics tab of the assignments edit page to make changes to the &amp;quot;Review rubric varies by round?&amp;quot; and &amp;quot;Review rubric varies by topic?&amp;quot; checkboxes.  The instructor may then use the Topics tab to select the appropriate rubric(s) for every topic in the assignment.&lt;br /&gt;
&lt;br /&gt;
Various other Expertiza code has been updated to retrieve the correct rubric depending on round and topic after the instructor has made these selections.&lt;br /&gt;
&lt;br /&gt;
== Future Work ==&lt;br /&gt;
&lt;br /&gt;
This section discusses possible future work for another CSC 517 team to take on.  Such a team can search the Expertiza codebase for &amp;quot;TODO E1936 (future work)&amp;quot; to find most of the places in the code that the notes below refer to.&lt;br /&gt;
&lt;br /&gt;
* Reduce the delay between changing the state of the &amp;quot;Review rubric varies by topic?&amp;quot; checkbox on the Rubrics tab, and the show / hide of rubric drop-downs on the Topics tab.&lt;br /&gt;
* Redesign UI for tone analysis, heatmaps, and review scores pop-up.  These areas are designed around the assumption that reviews do NOT vary by topic.  For example, in the review scores pop-up, a reviewer can see the reviews they have given, arranged by question, across multiple reviewees.&lt;br /&gt;
* Consider whether the questionnaire options available for selection in drop-downs on the Topics and Rubrics tabs should include ''only'' those questionnaires created by the currently-logged-in instructor.  Our work in this project changed the filtering from instructor-owning-assignment to currently-logged-in instructor - but left in place all non-private questionnaires.  ''Consider'' whether non-private questionnaires should be excluded.  This may result in some drop-downs not having any available questionnaires.&lt;br /&gt;
&lt;br /&gt;
== Useful Links ==&lt;br /&gt;
In this section we provide useful links related to the work that has been completed by our team.&lt;br /&gt;
# [https://github.com/gabalmat/expertiza Forked Project Repository]&lt;br /&gt;
# [https://github.com/expertiza/expertiza/pull/1444 Pull Request]&lt;br /&gt;
# [(add link here) Video Demonstration of Specialized Rubrics]&lt;br /&gt;
# [(add link here) Video Demonstration of Passing Rspec Tests]&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Contacts ===&lt;br /&gt;
We have 4 (four) members in our team and 1 (one) mentor was also assigned to us. For any project-related questions/concerns please contact us:&lt;br /&gt;
* Aurora Tiffany-Davis - attiffan@ncsu.edu&lt;br /&gt;
* Ginger Balmat - gabalmat@ncsu.edu&lt;br /&gt;
* Joe Hutchinson - jehutch3@ncsu.edu&lt;br /&gt;
* Nikolay Titov - ngtitov@ncsu.edu&lt;br /&gt;
* Zhewei Hu (mentor) - zhu6@ncsu.edu&lt;br /&gt;
&lt;br /&gt;
=== Contribution Based Inquiry ===&lt;br /&gt;
For any questions or concerns related to the project design, implementation, testing of the feature developed by our team, please contact an engineer who worked closely on the topic of your interest based on the [https://docs.google.com/spreadsheets/d/11uxuI_5gaC-FQDwIOxtCaN3HZ9bfWDJgIjFemtYV5jE/edit?ts=5ca222f3#gid=0 Contribution Assignment Grid] we created to keep track of our progress and contribution. Please carbon copy all team members and our mentor in the email.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* Expertiza Web [https://github.com/expertiza/expertiza#expertiza]&lt;br /&gt;
* Expertiza on GitHub [https://github.com/expertiza/expertiza]&lt;br /&gt;
* Expertiza Wiki [http://wikis.lib.ncsu.edu/index.php/Expertiza]&lt;br /&gt;
* Rspec Documentation [https://relishapp.com/rspec]&lt;br /&gt;
* Wiki with Previous Work [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1873_Specialized_rubics_for_different_topic_types]&lt;br /&gt;
* Pull Request of the Previous Work [https://github.com/expertiza/expertiza/pull/1327]&lt;/div&gt;</summary>
		<author><name>Ngtitov</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics&amp;diff=124484</id>
		<title>E1936 Specialized Rubrics</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics&amp;diff=124484"/>
		<updated>2019-04-26T15:45:27Z</updated>

		<summary type="html">&lt;p&gt;Ngtitov: /* Previous Project Requirements */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page describes the work and goals that have been completed and achieved while implementing Expertiza Project &amp;quot;''E1936. Specialized Rubrics for Different Topic Types (e.g., Servo project, refactoring project)''&amp;quot; for the CSC/ECE 517 &amp;quot;Object-Oriented Design and Development&amp;quot; class, in the Spring semester of the 2019.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This Wiki page is created per CSC/ECE 517: &amp;quot;Object-Oriented Design and Development&amp;quot;, Expertiza Project requirements (Spring, 2019).&lt;br /&gt;
&lt;br /&gt;
Our [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Team team] was assigned the project &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936. Specialized rubrics for different topic types (e.g., Servo project, refactoring project)]&amp;quot;.  This is an Expertiza project.&lt;br /&gt;
&lt;br /&gt;
In this wiki page we describe the problem to be solved, how we solve that problem, and how we test our solution.  We also provide helpful links and contact information for our team.&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
In this section, we discuss the problem we need to solve, the Expertiza feature this problem is related to, what needs to be done to solve the problem (at a high level), and the previous attempt to solve this problem.&lt;br /&gt;
&lt;br /&gt;
=== Problem Statement ===&lt;br /&gt;
&lt;br /&gt;
This problem statement summarizes the problem as described in the project description &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936. Specialized rubrics for different topic types (e.g., Servo project, refactoring project)]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
In CSC/ECE 517, there are several types of topics that could be covered in a single class assignment.&lt;br /&gt;
* Code base&lt;br /&gt;
** Expertiza&lt;br /&gt;
** Mozilla&lt;br /&gt;
** etc.&lt;br /&gt;
* Goal&lt;br /&gt;
** Refactoring&lt;br /&gt;
** Testing&lt;br /&gt;
** etc.&lt;br /&gt;
However, currently we can only specify one kind of rubric for an assignment.  This means that teams working on different topics will be evaluated using the same rubric.  With this setup, it's not possible to fine-tune rubrics for different topics - rubrics tend to be overly general.&lt;br /&gt;
&lt;br /&gt;
=== Feature Description ===&lt;br /&gt;
&lt;br /&gt;
The Expertiza project already has a feature that allows rubrics to vary by project phase or &amp;quot;round&amp;quot;.  The feature we will add in this project is a feature to allow rubrics to vary not only by round, but also by topic.  This allows more flexibility to the instructor when setting up an assignment, so that they can use rubrics better suited to the tasks that students are performing in an assignment.&lt;br /&gt;
&lt;br /&gt;
When this feature is complete, the following scenarios will be possible, and the instructor will be the judge of which scenario is the best fit to the assignment:&lt;br /&gt;
&lt;br /&gt;
* Rubric does not vary by round or by topic.&lt;br /&gt;
* Rubric varies by round, but not by topic.&lt;br /&gt;
* Rubric varies by topic, but not by round.&lt;br /&gt;
* Rubric varies by both round and topic.&lt;br /&gt;
&lt;br /&gt;
=== What Needs to be Done ===&lt;br /&gt;
&lt;br /&gt;
This section summarizes the work as described in the project description &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936. Specialized rubrics for different topic types (e.g., Servo project, refactoring project)]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* In assignment#edit page &amp;quot;Rubrics&amp;quot; tab, add a checkbox to specify whether rubric should vary by topic.&lt;br /&gt;
* In assignment#edit page &amp;quot;Topics&amp;quot; tab, add dropdown(s) next to each topic to specify which rubric(s) are associated with the topic.&lt;br /&gt;
** The dropdown(s) should appear only if rubric should vary by topic, per the Rubrics tab.&lt;br /&gt;
** The topic should have a multiple dropdowns (one for each round) only if rubrics vary by round, per the Rubrics tab.&lt;br /&gt;
** By default, the rubric(s) for each course project will be the one(s) specified in “Rubrics” tab.&lt;br /&gt;
** The dropdown value can overwrite the default rubric.&lt;br /&gt;
* Be careful when making changes to the code&lt;br /&gt;
** The signup_sheet_controller should have as little to do as possible with the selection of rubrics.&lt;br /&gt;
** Anything not germane to selecting topics should be in another controller or (more probably) a helper.&lt;br /&gt;
* Create a DB migration to allow rubric to vary by topic as well as by round.&lt;br /&gt;
&lt;br /&gt;
==== Screenshots ====&lt;br /&gt;
'''Current screenshot of Rubrics tab for an Assignment'''&lt;br /&gt;
(need to add a checkbox to indicate that rubric should vary by topic)&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Screenshot Assignment Edit Rubrics.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Current screenshot of Topics tab for an Assignment'''&lt;br /&gt;
(need to add a way to select rubrics for particular topics)&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Screenshot Assignment Edit Topics.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Proposed screenshot of Rubrics tab for an Assignment'''&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Specialized Rubric rubric checkbox.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Proposed screenshot of Topics tab for an Assignment'''&lt;br /&gt;
&lt;br /&gt;
(drop down shown for only one topic here, but final product will have one for each topic)&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Specialized Rubric dropdown menu.png]]&lt;br /&gt;
&lt;br /&gt;
== Previous Work ==&lt;br /&gt;
&lt;br /&gt;
There was previous attempt to implement this project in the Fall of 2018 semester by different team, but it was rejected due to several reasons. As a result our team was assigned to complete this project with the given implementation. However, after detailed investigation of the proposed design that team has made in the previous semester and review of the code changes, we proposed different architectural solution for the problem, which we believe is simpler, more efficient, and elegant solution.&lt;br /&gt;
&lt;br /&gt;
=== Previous Implementation ===&lt;br /&gt;
&lt;br /&gt;
Our team was provided with all relevant information and materials about the design and implementation of the previously attempted project. We would like to acknowledge that we use previous implementation and design as reference and our starting point for our own implementation. The following is the list of links with the relevant materials that we have used for better project understanding, determining pros and cons of previously proposed changes, and establishing our design strategy and implementation:&lt;br /&gt;
&lt;br /&gt;
# [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1873_Specialized_rubics_for_different_topic_types Wiki]&lt;br /&gt;
# [https://github.com/expertiza/expertiza/pull/1327 Pull Request]&lt;br /&gt;
# [https://drive.google.com/file/d/1UrLb0Ula_Lb_F4MOrdC-s6xng6B08VYu/view Video Demo]&lt;br /&gt;
&lt;br /&gt;
After reviewing all relevant materials above, we concluded that the project implementation was incomplete and proposed design had significant flaw. &lt;br /&gt;
We identified main drawbacks and flaw as follows:&lt;br /&gt;
&lt;br /&gt;
* Establishing incorrect ''many-to-one'' relationship between ''sign_up_topics'' and ''questionnaires'' tables:&lt;br /&gt;
** Creating a DB migration to add ''questionnaire_id'' in the ''sign_up_topics'' table to store the dropdown data presumes ''one-to-one'' or ''many-to-one'' relationship between ''sign_up_topics'' and ''questionnaires'' tables&lt;br /&gt;
** Correct relationship between ''sign_up_topics'' and ''questionnaires'' tables is ''many-to-many''. For example, each project topic may have various rubrics depending on the round it is used (e.g., for round 1, topic may have one rubric; but for round 2, the same topic may have different rubric)&lt;br /&gt;
** Proposed previous migration changes would break DB design and would not allow to store correctly topic and its associated rubric per different round.&lt;br /&gt;
* Per project requirement specifications, &amp;quot;''The dropdown box should appear only if 'Vary rubric by topic' is selected in the Rubrics tab.''&amp;quot; This requirement was not met and ''Vary rubric by topic'' checkbox in the Rubrics tab was not implemented. Therefore, dropdown box with the list of rubrics appears regardless of whether &amp;quot;''Vary rubric by topic''&amp;quot; is selected or not.&lt;br /&gt;
* The dropdown box includes the list of all possible rubrics including default value. However, this condition can be improved. The dropdown box should list the rubrics that were created by the current user (professor who is logged in). This would allow to shorten the list of possible rubrics dramatically and help to avoid any misunderstanding and confusion while user selects desired rubric for the course project.&lt;br /&gt;
&lt;br /&gt;
We found no further issues with the rest implementation and in other project materials. Wiki page is very useful for understanding design of proposed changes, finding drawbacks and the flaw. Considering all the pros and cons, and taking into account drawbacks of the proposed changes, our team evolved different approach that should successfully solve the problem stated for the project without without creating additional issues. Please see our [http://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics#Project_Implementation Project Implementation] for more details.&lt;br /&gt;
&lt;br /&gt;
=== Previous Project Requirements ===&lt;br /&gt;
&lt;br /&gt;
The project requirements originally specified how to alter the databases to support varying rubrics by topic.&lt;br /&gt;
&lt;br /&gt;
''Create a new table named topic_questionnaires with field:''&lt;br /&gt;
* ''id''&lt;br /&gt;
* ''topic_id''&lt;br /&gt;
* ''questionnaire_id''&lt;br /&gt;
* ''used_in_round''&lt;br /&gt;
&lt;br /&gt;
However, the E1936 team successfully petitioned for this requirement to change to give us more freedom in the implementation.  The original suggestion had a flaw.  There is already an existing table in the Expertiza project called ''assignment_questionnaires'', which has columns including ''assignment_id'', ''questionnaire_id'', and ''used_in_round''.  It is this table that maintains the knowledge of which rubric is used in which round of an assignment.  If we were to add a new table to maintains the knowledge of which rubric is used in which topic of an assignment as originally suggested, then we would have a big problem.  Knowledge of round-rubric relationship is duplicated.  This would lead (best case scenario) to extra work, and (worst case scenario) to lots of bugs caused by inconsistencies in how these tables are handled with CRUD operations throughout the code.  In other words, this is not a DRY solution.&lt;br /&gt;
&lt;br /&gt;
== Project Implementation ==&lt;br /&gt;
&lt;br /&gt;
In this section, we propose our solution to the problem, discuss implementation techniques and details, and list the goals we achieved.&lt;br /&gt;
&lt;br /&gt;
We start by analyzing Entity Relationship Diagram where we state the solution to the problem. Further we discuss design strategy by breaking project problem into multiple staged sub-problems and provide solutions for each of these sub-problems. We also discuss some implementation details and provide the list of involved files. Finally, we demonstrate how the implemented feature can be used by providing a ''How To'' sub-section.&lt;br /&gt;
&lt;br /&gt;
=== Diagrams ===&lt;br /&gt;
&lt;br /&gt;
Our solution and implementation of the project can be easily shown by discussing Use Case, Entity Relationship, and Class diagrams. First, for simplicity we discuss in general possible sequence of interactions between a user (in this case instructor) and the system (Expertiza) via presenting Use Case Diagram. Then we plan to show proposed database modification via Entity Relationship Diagram.&lt;br /&gt;
&lt;br /&gt;
==== Use Case Diagram ====&lt;br /&gt;
&lt;br /&gt;
[[File: use_case_diagram_1936.png]]&lt;br /&gt;
&lt;br /&gt;
The above Use Case Diagram shows general sequence of interactions between an instructor and the system (Expertiza) that defines where and how the feature can be utilized. Note that highlighted use cases are objects of our interest and work. Also please note that all of the shown use cases already exist in the system and we simply added a new feature into the system with existing use cases. Particularly, the rubric for each assignment and newly added ''Review rubric varies by topic'' checkbox with which instructor may choose to vary assignment by topic or not, by checking and unchecking the checkbox is displayed in the ''Rubrics'' tab. Hence, we show how instructor can get to the ''Rubrics'' tab of the assignments. Similarly, ''Topics'' tab of assignments has additional ''Questionnaires'' column for each topic, where instructor may specify which rubric associates with which topic. To perform this sequence of interactions and utilize the new feature, instructor must choose ''Edit'' any assignment from the list of all assignments displayed to him/her in the ''Manage Assignments'' page, which can be navigated by instructor by selecting it from the header of the system.&lt;br /&gt;
&lt;br /&gt;
==== Entity Relationship Diagram ====&lt;br /&gt;
&lt;br /&gt;
[[File: HW04_ERD.png]]&lt;br /&gt;
&lt;br /&gt;
The sections of the diagram highlighted in yellow show newly introduced items.  That is, we are adding a new column called ''topic_id'' to ''assignment_questionnaires'', in order to link ''assignment_questionnaires'' to ''sign_up_topics''.&lt;br /&gt;
&lt;br /&gt;
Any assignment, topic, or questionnaire may be represented by multiple records within ''assignment_questionnaires'', but each record within ''assignment_questionnaires'' refers to just one assignment, topic, or questionnaire.  It is the ability to have an assignment represented by multiple records, and the new relationship to ''sign_up_topics'', that allows us to support all of the required scenarios:&lt;br /&gt;
&lt;br /&gt;
* Rubric does not vary by round or by topic.&lt;br /&gt;
* Rubric varies by round, but not by topic.&lt;br /&gt;
* Rubric varies by topic, but not by round.&lt;br /&gt;
* Rubric varies by both round and topic.&lt;br /&gt;
&lt;br /&gt;
[[File: HW04_table.PNG]]&lt;br /&gt;
&lt;br /&gt;
This table illustrates the possibilities that the system may have.&lt;br /&gt;
&lt;br /&gt;
* Assignment 1 does not vary by round or by topic.&lt;br /&gt;
* Assignment 2 varies by round, but not by topic.&lt;br /&gt;
* Assignment 3 varies by topic, but not by round.&lt;br /&gt;
* Assignment 4 varies by both round and topic.&lt;br /&gt;
&lt;br /&gt;
This change is done via database migration by running the following commands:&lt;br /&gt;
&lt;br /&gt;
  rails generate migration AddTopicIdToAssignmentQuestionnaires&lt;br /&gt;
&lt;br /&gt;
Above command adds the ''topic_id'' column to the ''AssignmentQuestionnaires'' table and generates new migration file:&lt;br /&gt;
&lt;br /&gt;
[[File: db_migration.png]]&lt;br /&gt;
&lt;br /&gt;
To see the details of the entire database change please check this [https://github.com/gabalmat/expertiza/commit/d46dd57d35a21ab43efb82c28d3f14b75c695f2e commit].&lt;br /&gt;
&lt;br /&gt;
==== Class Diagram ====&lt;br /&gt;
&lt;br /&gt;
[[File: class_diagram_1936.png]]&lt;br /&gt;
&lt;br /&gt;
The above UML Class diagram describes the changes our team made in the Ruby classes, methods and attributes. Please note that all provided classes in the diagram had already existed in the system, and we only added new relationship, modified existing methods (and some method signatures) and utilized given attributes. All of the class's attributes and methods that are shown in the diagram are utilized (directly and indirectly) in our current implementation. Some of the methods and attributes provided within the classes in the diagram are newly developed. There is only one newly added aggregation relationship between the ''SingUpTopic'' class and ''AssignmentQuestionnaire'' class. Moreover, controllers and models for the certain classes were combined into a single class for simplicity to the design description. In reality, half of the methods shown in  the ''Assignment'' class are implemented in the ''app/controllers/assignments_controller.rb'' file and other half is in the ''app/models/assignment.rb'' file. We decided to combine all of the functionalities of each ''relevant'' controller and model class into single class for the ease of design presentation and interpretation. We used Sequence diagram below to illustrate how MVC architectural pattern is used for a given classes.&lt;br /&gt;
&lt;br /&gt;
=== Design Strategy ===&lt;br /&gt;
&lt;br /&gt;
As we have concrete understanding of the problem and proposed solution, we would like break this problem into multiple more manageable sub-problems with specific tasks and well-defined solutions to these tasks. Generally, each sub-problem requires modification of one or more files. We would like to propose our Design Strategy as follows:&lt;br /&gt;
&lt;br /&gt;
==== Preparation ====&lt;br /&gt;
&lt;br /&gt;
* Clean up code that our implementation will use&lt;br /&gt;
** PROBLEM: We need to add/change content to the edit assignment Topics tab, but unlike other tabs in the views, it does not have its own partial view to work with&lt;br /&gt;
*** SOLUTION: Refactor and move the code dealing with topics into separate ''app/views/assignments/edit/_topics.html.erb'' file&lt;br /&gt;
*** File: ''app/views/assignments/edit.html.erb''&lt;br /&gt;
** PROBLEM: In a section below, we discuss the need to modify existing methods to also accept an optional argument ''topic_id''.  In many cases these existing method use confusing variable names or lack sufficient comments.&lt;br /&gt;
*** SOLUTION: Clean up methods that we plan to modify&lt;br /&gt;
*** FILE: (many)&lt;br /&gt;
&lt;br /&gt;
==== Implementation ====&lt;br /&gt;
&lt;br /&gt;
* Allow an instructor to indicate that rubric should vary by topic&lt;br /&gt;
** PROBLEM: There is no way for an instructor to indicate that an assignments' rubric should vary by topic&lt;br /&gt;
*** SOLUTION: Add a new checkbox in the edit assignment Rubrics tab to indicate this preference&lt;br /&gt;
*** FILE: ''app/views/assignments/edit/_rubrics.html.erb''&lt;br /&gt;
** PROBLEM: If the user changes the &amp;quot;Review rubric varies by round?&amp;quot; or &amp;quot;Review rubric varies by topic?&amp;quot; checkbox on the Rubrics tab, but leaves the page in an inappropriate state before leaving the tab (e.g. rubric weights that do not add up to 0% or 100%), then the user does not get feedback that they made a mistake.  They only get such feedback when explicitly performing a &amp;quot;Save&amp;quot;.  Switching from tab to tab on the assignments edit page attempts to perform an implicit save, but there is no mechanism to update the flash messages onscreen if anything goes wrong.  This becomes more problematic now that the Topics tab appearance depends on choices made on the Rubrics tab.  &lt;br /&gt;
*** SOLUTION: Provide a route to an assignments controller method that can return a render of the flash messages.  Add an AJAX call on the assignments edit view that can update the flash messages onscreen.&lt;br /&gt;
*** FILE: app/controllers/assignments_controller.rb&lt;br /&gt;
*** FILE: app/views/assignments/edit.html.erb&lt;br /&gt;
&lt;br /&gt;
* Allow an instructor to choose different rubrics for different topics&lt;br /&gt;
** PROBLEM: There is no way for an instructor to choose different rubrics for different topics&lt;br /&gt;
*** SOLUTION: Add a new column in the edit assignment Topics tab for choosing rubric(s)&lt;br /&gt;
**** New column only visible if rubrics vary by topic, per Rubrics tab&lt;br /&gt;
**** New column has multiple rounds per topic only if rubrics vary by round, per Rubrics tab&lt;br /&gt;
**** Default value for any rubric is that rubric which is shown on Rubrics tab&lt;br /&gt;
**** Rubric(s) in the dropdown list is/are only those that were created by the currently logged in instructor&lt;br /&gt;
*** FILE: ''app/views/assignments/edit/_topics.html.erb''&lt;br /&gt;
** PROBLEM: The code in ''app/views/assignments/edit/_rubrics.html.erb'' includes dropdowns like the ones we need to add for topics, but that code is way too complex for its functionality (too heavy for a view, uses JavaScript)&lt;br /&gt;
*** SOLUTION: Use the code in ''app/views/assignments/edit/_rubrics.html.erb'' for inspiration only&lt;br /&gt;
**** Refactor and move as much actual work as possible out into helper methods that are simply called from this view&lt;br /&gt;
**** Views are not intended to do heavy lifting&lt;br /&gt;
**** Use as little JavaScript as possible, since this is a Ruby On Rails project, not a JS project&lt;br /&gt;
*** FILE: ''app/views/assignments/edit/_topics.html.erb''&lt;br /&gt;
** PROBLEM: The drop-downs for selecting rubrics should show only those rubrics created by the currently-logged in instructor (per project mentor).  They currently include those created by the instructor of the relevant assignment.&lt;br /&gt;
*** SOLUTION: Change the filtering in the ''questionnaire_options'' method to reflect the desired filtering.&lt;br /&gt;
*** FILE: app/helpers/assignment_helper.rb&lt;br /&gt;
&lt;br /&gt;
* Support the ability of the database to link rubrics to topics&lt;br /&gt;
** PROBLEM: There is no relationship in the database that can link together rubrics with topics&lt;br /&gt;
*** SOLUTION: Add a new migration that adds topic_id field to existing assignment_questionnaires table&lt;br /&gt;
**** This new field will reference the id field in the sign_up_topics table&lt;br /&gt;
*** FILE: ''db/migrate/[timestamp]_add_topic_id_to_assignment_questionnaires_table.rb''&lt;br /&gt;
** PROBLEM: The AssignmentQuestionnaire model does not have any knowledge of topics&lt;br /&gt;
*** SOLUTION: Add a new belongs_to reference in the model, to sign_up_topic&lt;br /&gt;
*** FILE: ''app/models/assignment_questionnaire.rb''&lt;br /&gt;
** PROBLEM: The SignUpTopic model does not have any knowledge of assignment_questionnaire records&lt;br /&gt;
*** SOLUTION: Add a new has_many reference in the model, to assignment_questionnaires&lt;br /&gt;
*** FILE: ''app/models/sign_up_topic.rb''&lt;br /&gt;
&lt;br /&gt;
* React to an instructor saving an assignment after altering the rubrics-vary-by-topic checkbox&lt;br /&gt;
** PROBLEM: There is nothing in place to remember when an instructor chooses to vary rubrics by topic, or chooses to not vary rubrics by topic&lt;br /&gt;
*** SOLUTION: Modify existing method ''update_assignment_questionnaires()''.  This method executes upon assignment save (explicit or via tab-change).  This method deletes all ''AssignmentQuestionnaire'' records before creating new correct records reflecting the user's selections in the edit assignment form.  Modify such that this method can create multiple records reflecting multiple topics, in the case where rubric should vary by topic.  With this modification, the correct records (with default rubrics) are present when the user goes to the Topics tab, so that the Topics tab can display properly.&lt;br /&gt;
*** FILE: app\models\assignment_form.rb&lt;br /&gt;
** PROBLEM: There is no way to refresh the Topics tab to show / hide drop-downs after the instructor changes checkbox on Rubrics tab&lt;br /&gt;
*** SOLUTION: Make use of existing &amp;quot;Save&amp;quot;-like functionality when changing tabs on the edit assignment page.  When updating due to tab-change, cause a fresh render of the Topics tab.  When updating due to &amp;quot;Save&amp;quot; button, keep functionality as-is.&lt;br /&gt;
*** FILE: ''app/controllers/assignments_controller.rb''&lt;br /&gt;
*** FILE: ''app/views/assignments/edit.html.erb''&lt;br /&gt;
&lt;br /&gt;
* Support the ability to find the correct rubric for a particular topic&lt;br /&gt;
** PROBLEM: The existing methods allow us to find the correct rubric for a particular round, but not a particular topic&lt;br /&gt;
*** SOLUTION: Modify the existing method questionnaire(assignment, type, round_number) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/helpers/assignment_helper.rb''&lt;br /&gt;
*** SOLUTION: Modify the existing method assignment_questionnaire(assignment, type, number) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/helpers/assignment_helper.rb''&lt;br /&gt;
*** SOLUTION: Modify the existing method questionnaire(round = nil) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/models/review_response_map.rb''&lt;br /&gt;
*** SOLUTION: Modify the existing method questionnaire(round) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/models/self_review_response_map.rb''&lt;br /&gt;
*** SOLUTION: Modify the existing method review_questionnaire_id(round = nil) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/models/assignment.rb''&lt;br /&gt;
&lt;br /&gt;
* Use the correct rubric for a particular topic&lt;br /&gt;
** PROBLEM: When finding rubrics to display, save results from, calculate scores from, etc. round may be used but topic is not&lt;br /&gt;
*** SOLUTION: Examine all callers of methods modified in the previous section and pass in ''topic_id'' where appropriate to grab the correct rubric&lt;br /&gt;
*** FILE: (many)&lt;br /&gt;
&lt;br /&gt;
* Support the ability to determine if an assignment has rubrics that vary by topic&lt;br /&gt;
** PROBLEM: There is no handy method to call that can tell us if an assignment has rubrics that vary by topic&lt;br /&gt;
*** SOLUTION: Add a new method ''varying_rubrics_by_topic?'' based on the existing method ''varying_rubrics_by_round?''&lt;br /&gt;
*** FILE: ''app/models/assignment.rb''&lt;br /&gt;
&lt;br /&gt;
=== Q&amp;amp;A ===&lt;br /&gt;
&lt;br /&gt;
Here we paraphrase some questions we received during round 1 of the documentation review.&lt;br /&gt;
&lt;br /&gt;
* Q: How will the new logic for varying rubric by topic tie in with the existing logic?&lt;br /&gt;
** A: We will add a new field ''topic_id'' into the existing table ''assignment_questionnaires'', as noted in the [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Entity_Relationship_Diagram E/R Diagram].  We will update methods that find questionnaires to allow these methods to also accept a ''topic_id'' argument, as noted in [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Implementation Implementation].&lt;br /&gt;
* Q: How will the &amp;quot;Rubric varies by topic&amp;quot; selection be stored?&lt;br /&gt;
** A: Indirectly, by saving records in the ''assignment_questionnaires'' table which either reference a ''topic_id'' or leave this field nil.  For more details please see the [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Entity_Relationship_Diagram E/R Diagram] discussion.&lt;br /&gt;
* Q: What will happen if an instructor selects &amp;quot;Rubric varies by topic&amp;quot;, makes selections on the &amp;quot;Topics&amp;quot; tab, and then deselects &amp;quot;Rubric varies by topic&amp;quot;?&lt;br /&gt;
** A: The Topics tab, when next visited, will no longer show dropdowns for selecting rubrics by topic.  When the assignment is saved, the appropriate not-varying-by-topic records will be saved in the ''assignment_questionnaires'' table.  For more details please see [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Implementation Implementation].&lt;br /&gt;
* Q: What will happen after an instructor selects &amp;quot;Rubric varies by topic&amp;quot;?&lt;br /&gt;
** A: The Topics tab, when next visited, will now show dropdowns for selecting rubrics by topic.  These rubrics will default to those shown on the Rubrics tab.  When the assignment is saved, the appropriate varying-by-topic records will be saved in the ''assignment_questionnaires'' table.  For more details please see [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Implementation Implementation].&lt;br /&gt;
* Q: How will the appropriate list of questionnaires for the new dropdowns on the Topics tab be determined?&lt;br /&gt;
** A: In the same way that the appropriate list of questionnaires for the existing dropdowns on the Rubrics tab is determined.  Namely, by the ''questionnaire_options'' method in the file ''expertiza/app/helpers/assignment_helper.rb''.&lt;br /&gt;
&lt;br /&gt;
=== (Selected) Modified Code ===&lt;br /&gt;
&lt;br /&gt;
In this section, we provide ''selected portions'' of modified code to illustrate how we implemented the new feature.&lt;br /&gt;
&lt;br /&gt;
Allow an instructor to indicate that rubric should vary by topic&lt;br /&gt;
&lt;br /&gt;
''app\views\assignments\edit\_rubrics.html.erb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;lt;input name=&amp;quot;vary_by_topic&amp;quot; type=&amp;quot;hidden&amp;quot; value=&amp;quot;false&amp;quot; /&amp;gt;&lt;br /&gt;
  &amp;lt;%= check_box_tag('vary_by_topic', 'true', @review_vary_by_topic_check) %&amp;gt;&lt;br /&gt;
  &amp;lt;%= label_tag('vary_by_topic', 'Review rubric varies by topic?') %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Allow an instructor to choose different rubrics for different topics&lt;br /&gt;
&lt;br /&gt;
''app\views\sign_up_sheet\_table_line.html.erb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;lt;% if @assignment_form.assignment.varying_rubrics_by_topic? %&amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;table id = &amp;lt;%=table_id %&amp;gt;&amp;gt;&lt;br /&gt;
        &amp;lt;tr&amp;gt;&lt;br /&gt;
          &amp;lt;script&amp;gt;&lt;br /&gt;
              ...&lt;br /&gt;
              &amp;lt;% if @assignment_form.assignment.varying_rubrics_by_round? %&amp;gt;&lt;br /&gt;
                &amp;lt;% for round in 1..@assignment_form.assignment.rounds_of_reviews %&amp;gt;&lt;br /&gt;
                  ...&lt;br /&gt;
                &amp;lt;% end %&amp;gt;&lt;br /&gt;
              &amp;lt;% else %&amp;gt;&lt;br /&gt;
                ...&lt;br /&gt;
              &amp;lt;% end %&amp;gt;&lt;br /&gt;
          &amp;lt;/script&amp;gt;&lt;br /&gt;
        &amp;lt;/tr&amp;gt;&lt;br /&gt;
      &amp;lt;/table&amp;gt;&lt;br /&gt;
    &amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Support the ability of the database to link rubrics to topics&lt;br /&gt;
&lt;br /&gt;
''app\models\sign_up_topic.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  class SignUpTopic &amp;lt; ActiveRecord::Base&lt;br /&gt;
    ...&lt;br /&gt;
    has_many :assignment_questionnaires, class_name: 'AssignmentQuestionnaire', foreign_key: 'topic_id', dependent: :destroy&lt;br /&gt;
    ...&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
React to an instructor saving an assignment after altering the rubrics-vary-by-topic checkbox&lt;br /&gt;
&lt;br /&gt;
''app/controllers/assignments_controller.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def update&lt;br /&gt;
    ...&lt;br /&gt;
    # What to do next depends on how we got here&lt;br /&gt;
    if params['button'].nil?&lt;br /&gt;
      # REFRESH the topics tab after changing tabs&lt;br /&gt;
      ...&lt;br /&gt;
      render :partial =&amp;gt; &amp;quot;assignments/edit/topics&amp;quot;&lt;br /&gt;
    else&lt;br /&gt;
      # SAVE button was used (do a redirect)&lt;br /&gt;
      redirect_to edit_assignment_path @assignment_form.assignment.id&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Support the ability to find the correct rubric for a particular topic&lt;br /&gt;
&lt;br /&gt;
''app/helpers/assignment_helper.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def assignment_questionnaire(assignment, questionnaire_type, round_number = nil, topic_id = nil)&lt;br /&gt;
    q_by_type = assignment.questionnaires.find_by(type: questionnaire_type)&lt;br /&gt;
    if q_by_type.nil?&lt;br /&gt;
      ...&lt;br /&gt;
    else&lt;br /&gt;
      ...&lt;br /&gt;
      aq_by_type = assignment.assignment_questionnaires.find_by(questionnaire_id: q_by_type.id)&lt;br /&gt;
      if round_number.nil? &amp;amp;&amp;amp; topic_id.nil?&lt;br /&gt;
        # Find by type&lt;br /&gt;
        aq = aq_by_type&lt;br /&gt;
      elsif topic_id.nil?&lt;br /&gt;
        # Find by round&lt;br /&gt;
        aq = assignment.assignment_questionnaires.find_by(used_in_round: round_number)&lt;br /&gt;
      elsif round_number.nil?&lt;br /&gt;
        # Find by topic&lt;br /&gt;
        aq = assignment.assignment_questionnaires.find_by(topic_id: topic_id)&lt;br /&gt;
      else&lt;br /&gt;
        # Find by round and topic&lt;br /&gt;
        aq = assignment.assignment_questionnaires.where(used_in_round: round_number, topic_id: topic_id).first&lt;br /&gt;
      end&lt;br /&gt;
      aq.nil? ? aq_by_type : aq&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use the correct rubric for a particular topic&lt;br /&gt;
&lt;br /&gt;
''app\controllers\response_controller.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def set_questionnaire_for_new_response&lt;br /&gt;
    case @map.type&lt;br /&gt;
    when &amp;quot;ReviewResponseMap&amp;quot;, &amp;quot;SelfReviewResponseMap&amp;quot;&lt;br /&gt;
      reviewees_topic = SignedUpTeam.topic_id_by_team_id(@contributor.id)&lt;br /&gt;
      @current_round = @assignment.number_of_current_round(reviewees_topic)&lt;br /&gt;
      @questionnaire = @map.questionnaire(@current_round, reviewees_topic)&lt;br /&gt;
    when&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Support the ability to determine if an assignment has rubrics that vary by topic&lt;br /&gt;
&lt;br /&gt;
''app\models\assignment.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def varying_rubrics_by_topic?&lt;br /&gt;
    aq_no_topic_id = AssignmentQuestionnaire.where(assignment_id: self.id, topic_id: nil).size &amp;gt;= 1&lt;br /&gt;
    aq_with_topic_id = AssignmentQuestionnaire.where(assignment_id: self.id).where.not(topic_id: nil).size &amp;gt;= 1&lt;br /&gt;
    if !aq_no_topic_id &amp;amp;&amp;amp; !aq_with_topic_id&lt;br /&gt;
      return false&lt;br /&gt;
    elsif aq_no_topic_id &amp;amp;&amp;amp; !aq_with_topic_id&lt;br /&gt;
      return false&lt;br /&gt;
    elsif !aq_no_topic_id &amp;amp;&amp;amp; aq_with_topic_id&lt;br /&gt;
      return true&lt;br /&gt;
    else&lt;br /&gt;
      raise StandardError.new(&amp;quot;Assignment with id &amp;quot; + self.id.to_s + &amp;quot; has a conflict about whether or not it varies by topic&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== How To ==&lt;br /&gt;
&lt;br /&gt;
In this section, we describe how to use the newly implemented feature.&lt;br /&gt;
&lt;br /&gt;
=== Add a New Rubric ===&lt;br /&gt;
&lt;br /&gt;
* [to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
=== Select a Rubric for a Topic ===&lt;br /&gt;
&lt;br /&gt;
* [to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
== Project Testing ==&lt;br /&gt;
&lt;br /&gt;
=== Strategy ===&lt;br /&gt;
&lt;br /&gt;
To test code implementation, correctness of the added feature, verify that the team did not break any existing functionalities in the Expertiza, and ensure that no bugs were introduced in the code, we developed the following Test Strategy:&lt;br /&gt;
&lt;br /&gt;
# Code inspection&lt;br /&gt;
# Run and pass existing RSpec Tests&lt;br /&gt;
# Develop New RSpec Tests&lt;br /&gt;
# Run through live UI to test a feature using Expertiza instance&lt;br /&gt;
&lt;br /&gt;
=== Rspec Testing ===&lt;br /&gt;
&lt;br /&gt;
==== Existing Tests ====&lt;br /&gt;
&lt;br /&gt;
Run all existing RSpec tests on any changed files, after our changes, to ensure that we have not introduced any failures.&lt;br /&gt;
The commands and results are shown below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
e@ubuntu:~/Desktop/CSC517_HW04/expertiza$ bundle exec rspec spec/helpers/ spec/controllers/ spec/models/&lt;br /&gt;
[Coveralls] Set up the SimpleCov formatter.&lt;br /&gt;
[Coveralls] Using SimpleCov's 'rails' settings.&lt;br /&gt;
&lt;br /&gt;
Randomized with seed 6978&lt;br /&gt;
[...]&lt;br /&gt;
&lt;br /&gt;
Finished in 8 minutes 10 seconds (files took 12.32 seconds to load)&lt;br /&gt;
900 examples, 0 failures, 16 pending&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The features tests were extremely time-consuming so we did not routinely run them during development.  However TravisCI results on our [https://github.com/expertiza/expertiza/pull/1444 Pull Request] demonstrate the passing status of all tests.&lt;br /&gt;
&lt;br /&gt;
==== New Tests ====&lt;br /&gt;
&lt;br /&gt;
Write comprehensive RSpec tests, for all new or modified methods.&lt;br /&gt;
* FILE: ''spec/helpers/assignment_helper_spec.rb''&lt;br /&gt;
** METHODS TO TEST: &lt;br /&gt;
*** questionnaire(assignment, type, round_number, topic_id)&lt;br /&gt;
*** assignment_questionnaire(assignment, type, number, topic_id)&lt;br /&gt;
* FILE: ''spec/models/review_response_map_spec.rb''&lt;br /&gt;
*** METHODS TO TEST:&lt;br /&gt;
**** questionnaire(round, topic_id)&lt;br /&gt;
* FILE: ''spec/models/self_review_response_map_spec.rb''&lt;br /&gt;
*** METHODS TO TEST:&lt;br /&gt;
**** questionnaire(round, topic_id)&lt;br /&gt;
* FILE: ''spec/models/assignment_spec.rb''&lt;br /&gt;
*** METHODS TO TEST:&lt;br /&gt;
**** review_questionnaire_id(round, topic_id)&lt;br /&gt;
**** varying_rubrics_by_topic?()&lt;br /&gt;
&lt;br /&gt;
Run these tests, to ensure that the new code works as intended.&lt;br /&gt;
The commands and results are shown below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
e@ubuntu:~/Desktop/CSC517_HW04/expertiza$ bundle exec rspec spec/helpers/assignment_helper_spec.rb spec/models/review_response_map_spec.rb spec/models/self_review_response_map_spec.rb spec/models/assignment_spec.rb &lt;br /&gt;
[Coveralls] Set up the SimpleCov formatter.&lt;br /&gt;
[Coveralls] Using SimpleCov's 'rails' settings.&lt;br /&gt;
&lt;br /&gt;
Randomized with seed 47508&lt;br /&gt;
....................................................................................................................&lt;br /&gt;
&lt;br /&gt;
Finished in 1 minute 7.94 seconds (files took 10.85 seconds to load)&lt;br /&gt;
116 examples, 0 failures&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The test suite for a single new method is shown below.&lt;br /&gt;
* There are many such suites added in expertiza/spec  &lt;br /&gt;
* This example illustrates our general strategy:&lt;br /&gt;
** test missing input&lt;br /&gt;
** test bad input&lt;br /&gt;
** test various acceptable forms of input&lt;br /&gt;
** test scenarios that lead to various return values&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  describe &amp;quot;#questionnaire&amp;quot; do&lt;br /&gt;
&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;throws exception if assignment argument nil&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;throws exception if all arguments nil except for assignment&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;finds by type if round number &amp;amp; topic id not given&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;throws exception if round number &amp;amp; topic id not given, no luck finding by type&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;finds by round number alone if round number alone is given&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;creates new questionnaire of given type if round number alone is given, no luck finding by round&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;finds by topic id alone if topic id alone is given&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;creates new questionnaire of given type if topic id alone is given, no luck finding by topic&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;finds by round number and topic id if both are given&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;creates new questionnaire of given type if round and topic are given, no luck finding by round and topic&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== UI Testing ===&lt;br /&gt;
&lt;br /&gt;
Here we describe manual UI Testing that was performed.&lt;br /&gt;
&lt;br /&gt;
==== Rubric does not vary by round or by topic ====&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
==== Rubric varies by round, but not by topic ====&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
==== Rubric varies by topic, but not by round ====&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
==== Rubric varies by both round and topic ====&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
In CSC/ECE 517, there are several types of topics that could be covered in a single class assignment.  However, currently we can only specify one kind of rubric for an assignment. This means that teams working on different topics will be evaluated using the same rubric. With this setup, it's not possible to fine-tune rubrics for different topics - rubrics tend to be overly general.&lt;br /&gt;
&lt;br /&gt;
In this project, we have solved this issue, by allowing rubrics to vary not only by round, but also by topic. This allows more flexibility to the instructor when setting up an assignment, so that they can use rubrics better suited to the tasks that students are performing in an assignment.  The following scenarios will be possible, and the instructor will be the judge of which scenario is the best fit to the assignment:&lt;br /&gt;
&lt;br /&gt;
* Rubric does not vary by round or by topic.&lt;br /&gt;
* Rubric varies by round, but not by topic.&lt;br /&gt;
* Rubric varies by topic, but not by round.&lt;br /&gt;
* Rubric varies by both round and topic.&lt;br /&gt;
&lt;br /&gt;
The instructor may use the Rubrics tab of the assignments edit page to make changes to the &amp;quot;Review rubric varies by round?&amp;quot; and &amp;quot;Review rubric varies by topic?&amp;quot; checkboxes.  The instructor may then use the Topics tab to select the appropriate rubric(s) for every topic in the assignment.&lt;br /&gt;
&lt;br /&gt;
Various other Expertiza code has been updated to retrieve the correct rubric depending on round and topic after the instructor has made these selections.&lt;br /&gt;
&lt;br /&gt;
== Future Work ==&lt;br /&gt;
&lt;br /&gt;
This section discusses possible future work for another CSC 517 team to take on.  Such a team can search the Expertiza codebase for &amp;quot;TODO E1936 (future work)&amp;quot; to find most of the places in the code that the notes below refer to.&lt;br /&gt;
&lt;br /&gt;
* Reduce the delay between changing the state of the &amp;quot;Review rubric varies by topic?&amp;quot; checkbox on the Rubrics tab, and the show / hide of rubric drop-downs on the Topics tab.&lt;br /&gt;
* Redesign UI for tone analysis, heatmaps, and review scores pop-up.  These areas are designed around the assumption that reviews do NOT vary by topic.  For example, in the review scores pop-up, a reviewer can see the reviews they have given, arranged by question, across multiple reviewees.&lt;br /&gt;
* Consider whether the questionnaire options available for selection in drop-downs on the Topics and Rubrics tabs should include ''only'' those questionnaires created by the currently-logged-in instructor.  Our work in this project changed the filtering from instructor-owning-assignment to currently-logged-in instructor - but left in place all non-private questionnaires.  ''Consider'' whether non-private questionnaires should be excluded.  This may result in some drop-downs not having any available questionnaires.&lt;br /&gt;
&lt;br /&gt;
== Useful Links ==&lt;br /&gt;
In this section we provide useful links related to the work that has been completed by our team.&lt;br /&gt;
# [https://github.com/gabalmat/expertiza Forked Project Repository]&lt;br /&gt;
# [https://github.com/expertiza/expertiza/pull/1444 Pull Request]&lt;br /&gt;
# [(add link here) Video Demonstration of Specialized Rubrics]&lt;br /&gt;
# [(add link here) Video Demonstration of Passing Rspec Tests]&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Contacts ===&lt;br /&gt;
We have 4 (four) members in our team and 1 (one) mentor was also assigned to us. For any project-related questions/concerns please contact us:&lt;br /&gt;
* Aurora Tiffany-Davis - attiffan@ncsu.edu&lt;br /&gt;
* Ginger Balmat - gabalmat@ncsu.edu&lt;br /&gt;
* Joe Hutchinson - jehutch3@ncsu.edu&lt;br /&gt;
* Nikolay Titov - ngtitov@ncsu.edu&lt;br /&gt;
* Zhewei Hu (mentor) - zhu6@ncsu.edu&lt;br /&gt;
&lt;br /&gt;
=== Contribution Based Inquiry ===&lt;br /&gt;
For any questions or concerns related to the project design, implementation, testing of the feature developed by our team, please contact an engineer who worked closely on the topic of your interest based on the [https://docs.google.com/spreadsheets/d/11uxuI_5gaC-FQDwIOxtCaN3HZ9bfWDJgIjFemtYV5jE/edit?ts=5ca222f3#gid=0 Contribution Assignment Grid] we created to keep track of our progress and contribution. Please carbon copy all team members and our mentor in the email.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* Expertiza Web [https://github.com/expertiza/expertiza#expertiza]&lt;br /&gt;
* Expertiza on GitHub [https://github.com/expertiza/expertiza]&lt;br /&gt;
* Expertiza Wiki [http://wikis.lib.ncsu.edu/index.php/Expertiza]&lt;br /&gt;
* Rspec Documentation [https://relishapp.com/rspec]&lt;br /&gt;
* Wiki with Previous Work [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1873_Specialized_rubics_for_different_topic_types]&lt;br /&gt;
* Pull Request of the Previous Work [https://github.com/expertiza/expertiza/pull/1327]&lt;/div&gt;</summary>
		<author><name>Ngtitov</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics&amp;diff=124482</id>
		<title>E1936 Specialized Rubrics</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics&amp;diff=124482"/>
		<updated>2019-04-26T15:45:00Z</updated>

		<summary type="html">&lt;p&gt;Ngtitov: /* Previous Work */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page describes the work and goals that have been completed and achieved while implementing Expertiza Project &amp;quot;''E1936. Specialized Rubrics for Different Topic Types (e.g., Servo project, refactoring project)''&amp;quot; for the CSC/ECE 517 &amp;quot;Object-Oriented Design and Development&amp;quot; class, in the Spring semester of the 2019.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This Wiki page is created per CSC/ECE 517: &amp;quot;Object-Oriented Design and Development&amp;quot;, Expertiza Project requirements (Spring, 2019).&lt;br /&gt;
&lt;br /&gt;
Our [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Team team] was assigned the project &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936. Specialized rubrics for different topic types (e.g., Servo project, refactoring project)]&amp;quot;.  This is an Expertiza project.&lt;br /&gt;
&lt;br /&gt;
In this wiki page we describe the problem to be solved, how we solve that problem, and how we test our solution.  We also provide helpful links and contact information for our team.&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
In this section, we discuss the problem we need to solve, the Expertiza feature this problem is related to, what needs to be done to solve the problem (at a high level), and the previous attempt to solve this problem.&lt;br /&gt;
&lt;br /&gt;
=== Problem Statement ===&lt;br /&gt;
&lt;br /&gt;
This problem statement summarizes the problem as described in the project description &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936. Specialized rubrics for different topic types (e.g., Servo project, refactoring project)]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
In CSC/ECE 517, there are several types of topics that could be covered in a single class assignment.&lt;br /&gt;
* Code base&lt;br /&gt;
** Expertiza&lt;br /&gt;
** Mozilla&lt;br /&gt;
** etc.&lt;br /&gt;
* Goal&lt;br /&gt;
** Refactoring&lt;br /&gt;
** Testing&lt;br /&gt;
** etc.&lt;br /&gt;
However, currently we can only specify one kind of rubric for an assignment.  This means that teams working on different topics will be evaluated using the same rubric.  With this setup, it's not possible to fine-tune rubrics for different topics - rubrics tend to be overly general.&lt;br /&gt;
&lt;br /&gt;
=== Feature Description ===&lt;br /&gt;
&lt;br /&gt;
The Expertiza project already has a feature that allows rubrics to vary by project phase or &amp;quot;round&amp;quot;.  The feature we will add in this project is a feature to allow rubrics to vary not only by round, but also by topic.  This allows more flexibility to the instructor when setting up an assignment, so that they can use rubrics better suited to the tasks that students are performing in an assignment.&lt;br /&gt;
&lt;br /&gt;
When this feature is complete, the following scenarios will be possible, and the instructor will be the judge of which scenario is the best fit to the assignment:&lt;br /&gt;
&lt;br /&gt;
* Rubric does not vary by round or by topic.&lt;br /&gt;
* Rubric varies by round, but not by topic.&lt;br /&gt;
* Rubric varies by topic, but not by round.&lt;br /&gt;
* Rubric varies by both round and topic.&lt;br /&gt;
&lt;br /&gt;
=== What Needs to be Done ===&lt;br /&gt;
&lt;br /&gt;
This section summarizes the work as described in the project description &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936. Specialized rubrics for different topic types (e.g., Servo project, refactoring project)]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* In assignment#edit page &amp;quot;Rubrics&amp;quot; tab, add a checkbox to specify whether rubric should vary by topic.&lt;br /&gt;
* In assignment#edit page &amp;quot;Topics&amp;quot; tab, add dropdown(s) next to each topic to specify which rubric(s) are associated with the topic.&lt;br /&gt;
** The dropdown(s) should appear only if rubric should vary by topic, per the Rubrics tab.&lt;br /&gt;
** The topic should have a multiple dropdowns (one for each round) only if rubrics vary by round, per the Rubrics tab.&lt;br /&gt;
** By default, the rubric(s) for each course project will be the one(s) specified in “Rubrics” tab.&lt;br /&gt;
** The dropdown value can overwrite the default rubric.&lt;br /&gt;
* Be careful when making changes to the code&lt;br /&gt;
** The signup_sheet_controller should have as little to do as possible with the selection of rubrics.&lt;br /&gt;
** Anything not germane to selecting topics should be in another controller or (more probably) a helper.&lt;br /&gt;
* Create a DB migration to allow rubric to vary by topic as well as by round.&lt;br /&gt;
&lt;br /&gt;
==== Screenshots ====&lt;br /&gt;
'''Current screenshot of Rubrics tab for an Assignment'''&lt;br /&gt;
(need to add a checkbox to indicate that rubric should vary by topic)&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Screenshot Assignment Edit Rubrics.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Current screenshot of Topics tab for an Assignment'''&lt;br /&gt;
(need to add a way to select rubrics for particular topics)&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Screenshot Assignment Edit Topics.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Proposed screenshot of Rubrics tab for an Assignment'''&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Specialized Rubric rubric checkbox.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Proposed screenshot of Topics tab for an Assignment'''&lt;br /&gt;
&lt;br /&gt;
(drop down shown for only one topic here, but final product will have one for each topic)&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Specialized Rubric dropdown menu.png]]&lt;br /&gt;
&lt;br /&gt;
== Previous Work ==&lt;br /&gt;
&lt;br /&gt;
There was previous attempt to implement this project in the Fall of 2018 semester by different team, but it was rejected due to several reasons. As a result our team was assigned to complete this project with the given implementation. However, after detailed investigation of the proposed design that team has made in the previous semester and review of the code changes, we proposed different architectural solution for the problem, which we believe is simpler, more efficient, and elegant solution.&lt;br /&gt;
&lt;br /&gt;
=== Previous Implementation ===&lt;br /&gt;
&lt;br /&gt;
Our team was provided with all relevant information and materials about the design and implementation of the previously attempted project. We would like to acknowledge that we use previous implementation and design as reference and our starting point for our own implementation. The following is the list of links with the relevant materials that we have used for better project understanding, determining pros and cons of previously proposed changes, and establishing our design strategy and implementation:&lt;br /&gt;
&lt;br /&gt;
# [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1873_Specialized_rubics_for_different_topic_types Wiki]&lt;br /&gt;
# [https://github.com/expertiza/expertiza/pull/1327 Pull Request]&lt;br /&gt;
# [https://drive.google.com/file/d/1UrLb0Ula_Lb_F4MOrdC-s6xng6B08VYu/view Video Demo]&lt;br /&gt;
&lt;br /&gt;
After reviewing all relevant materials above, we concluded that the project implementation was incomplete and proposed design had significant flaw. &lt;br /&gt;
We identified main drawbacks and flaw as follows:&lt;br /&gt;
&lt;br /&gt;
* Establishing incorrect ''many-to-one'' relationship between ''sign_up_topics'' and ''questionnaires'' tables:&lt;br /&gt;
** Creating a DB migration to add ''questionnaire_id'' in the ''sign_up_topics'' table to store the dropdown data presumes ''one-to-one'' or ''many-to-one'' relationship between ''sign_up_topics'' and ''questionnaires'' tables&lt;br /&gt;
** Correct relationship between ''sign_up_topics'' and ''questionnaires'' tables is ''many-to-many''. For example, each project topic may have various rubrics depending on the round it is used (e.g., for round 1, topic may have one rubric; but for round 2, the same topic may have different rubric)&lt;br /&gt;
** Proposed previous migration changes would break DB design and would not allow to store correctly topic and its associated rubric per different round.&lt;br /&gt;
* Per project requirement specifications, &amp;quot;''The dropdown box should appear only if 'Vary rubric by topic' is selected in the Rubrics tab.''&amp;quot; This requirement was not met and ''Vary rubric by topic'' checkbox in the Rubrics tab was not implemented. Therefore, dropdown box with the list of rubrics appears regardless of whether &amp;quot;''Vary rubric by topic''&amp;quot; is selected or not.&lt;br /&gt;
* The dropdown box includes the list of all possible rubrics including default value. However, this condition can be improved. The dropdown box should list the rubrics that were created by the current user (professor who is logged in). This would allow to shorten the list of possible rubrics dramatically and help to avoid any misunderstanding and confusion while user selects desired rubric for the course project.&lt;br /&gt;
&lt;br /&gt;
We found no further issues with the rest implementation and in other project materials. Wiki page is very useful for understanding design of proposed changes, finding drawbacks and the flaw. Considering all the pros and cons, and taking into account drawbacks of the proposed changes, our team evolved different approach that should successfully solve the problem stated for the project without without creating additional issues. Please see our [http://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics#Project_Implementation Project Implementation] for more details.&lt;br /&gt;
&lt;br /&gt;
== Previous Project Requirements ==&lt;br /&gt;
&lt;br /&gt;
The project requirements originally specified how to alter the databases to support varying rubrics by topic.&lt;br /&gt;
&lt;br /&gt;
''Create a new table named topic_questionnaires with field:''&lt;br /&gt;
* ''id''&lt;br /&gt;
* ''topic_id''&lt;br /&gt;
* ''questionnaire_id''&lt;br /&gt;
* ''used_in_round''&lt;br /&gt;
&lt;br /&gt;
However, the E1936 team successfully petitioned for this requirement to change to give us more freedom in the implementation.  The original suggestion had a flaw.  There is already an existing table in the Expertiza project called ''assignment_questionnaires'', which has columns including ''assignment_id'', ''questionnaire_id'', and ''used_in_round''.  It is this table that maintains the knowledge of which rubric is used in which round of an assignment.  If we were to add a new table to maintains the knowledge of which rubric is used in which topic of an assignment as originally suggested, then we would have a big problem.  Knowledge of round-rubric relationship is duplicated.  This would lead (best case scenario) to extra work, and (worst case scenario) to lots of bugs caused by inconsistencies in how these tables are handled with CRUD operations throughout the code.  In other words, this is not a DRY solution.&lt;br /&gt;
&lt;br /&gt;
== Project Implementation ==&lt;br /&gt;
&lt;br /&gt;
In this section, we propose our solution to the problem, discuss implementation techniques and details, and list the goals we achieved.&lt;br /&gt;
&lt;br /&gt;
We start by analyzing Entity Relationship Diagram where we state the solution to the problem. Further we discuss design strategy by breaking project problem into multiple staged sub-problems and provide solutions for each of these sub-problems. We also discuss some implementation details and provide the list of involved files. Finally, we demonstrate how the implemented feature can be used by providing a ''How To'' sub-section.&lt;br /&gt;
&lt;br /&gt;
=== Diagrams ===&lt;br /&gt;
&lt;br /&gt;
Our solution and implementation of the project can be easily shown by discussing Use Case, Entity Relationship, and Class diagrams. First, for simplicity we discuss in general possible sequence of interactions between a user (in this case instructor) and the system (Expertiza) via presenting Use Case Diagram. Then we plan to show proposed database modification via Entity Relationship Diagram.&lt;br /&gt;
&lt;br /&gt;
==== Use Case Diagram ====&lt;br /&gt;
&lt;br /&gt;
[[File: use_case_diagram_1936.png]]&lt;br /&gt;
&lt;br /&gt;
The above Use Case Diagram shows general sequence of interactions between an instructor and the system (Expertiza) that defines where and how the feature can be utilized. Note that highlighted use cases are objects of our interest and work. Also please note that all of the shown use cases already exist in the system and we simply adding new feature into the system with existing use cases. Particularly, the rubric for each assignment and newly added ''Review rubric varies by topic'' checkbox with which instructor may choose to vary assignment by topic or not by checking and unchecking the checkbox is displayed in the ''Rubrics'' tab. Hence, we show how instructor can get to the ''Rubrics'' tab of the assignments. Similarly, ''Topics'' tab of assignments has additional ''Questionnaires'' column for each topic, where instructor may specify which rubric associates with the topic. To perform such sequence of iterations and utilize the new feature, instructor must choose ''Edit'' any assignment from the list of all assignments displayed to him/her in the ''Manage Assignments'' boundary, which can be navigated by instructor by selecting it from the header of the page.&lt;br /&gt;
&lt;br /&gt;
==== Entity Relationship Diagram ====&lt;br /&gt;
&lt;br /&gt;
[[File: HW04_ERD.png]]&lt;br /&gt;
&lt;br /&gt;
The sections of the diagram highlighted in yellow show newly introduced items.  That is, we are adding a new column called ''topic_id'' to ''assignment_questionnaires'', in order to link ''assignment_questionnaires'' to ''sign_up_topics''.&lt;br /&gt;
&lt;br /&gt;
Any assignment, topic, or questionnaire may be represented by multiple records within ''assignment_questionnaires'', but each record within ''assignment_questionnaires'' refers to just one assignment, topic, or questionnaire.  It is the ability to have an assignment represented by multiple records, and the new relationship to ''sign_up_topics'', that allows us to support all of the required scenarios:&lt;br /&gt;
&lt;br /&gt;
* Rubric does not vary by round or by topic.&lt;br /&gt;
* Rubric varies by round, but not by topic.&lt;br /&gt;
* Rubric varies by topic, but not by round.&lt;br /&gt;
* Rubric varies by both round and topic.&lt;br /&gt;
&lt;br /&gt;
[[File: HW04_table.PNG]]&lt;br /&gt;
&lt;br /&gt;
This table illustrates the possibilities that the system may have.&lt;br /&gt;
&lt;br /&gt;
* Assignment 1 does not vary by round or by topic.&lt;br /&gt;
* Assignment 2 varies by round, but not by topic.&lt;br /&gt;
* Assignment 3 varies by topic, but not by round.&lt;br /&gt;
* Assignment 4 varies by both round and topic.&lt;br /&gt;
&lt;br /&gt;
This change is done via database migration by running the following commands:&lt;br /&gt;
&lt;br /&gt;
  rails generate migration AddTopicIdToAssignmentQuestionnaires&lt;br /&gt;
&lt;br /&gt;
Above command adds the ''topic_id'' column to the ''AssignmentQuestionnaires'' table and generates new migration file:&lt;br /&gt;
&lt;br /&gt;
[[File: db_migration.png]]&lt;br /&gt;
&lt;br /&gt;
To see the details of the entire database change please check this [https://github.com/gabalmat/expertiza/commit/d46dd57d35a21ab43efb82c28d3f14b75c695f2e commit].&lt;br /&gt;
&lt;br /&gt;
==== Class Diagram ====&lt;br /&gt;
&lt;br /&gt;
[[File: class_diagram_1936.png]]&lt;br /&gt;
&lt;br /&gt;
The above UML Class diagram describes the changes our team made in the Ruby classes, methods and attributes. Please note that all provided classes in the diagram had already existed in the system, and we only added new relationship, modified existing methods (and some method signatures) and utilized given attributes. All of the class's attributes and methods that are shown in the diagram are utilized (directly and indirectly) in our current implementation. Some of the methods and attributes provided within the classes in the diagram are newly developed. There is only one newly added aggregation relationship between the ''SingUpTopic'' class and ''AssignmentQuestionnaire'' class. Moreover, controllers and models for the certain classes were combined into a single class for simplicity to the design description. In reality, half of the methods shown in  the ''Assignment'' class are implemented in the ''app/controllers/assignments_controller.rb'' file and other half is in the ''app/models/assignment.rb'' file. We decided to combine all of the functionalities of each ''relevant'' controller and model class into single class for the ease of design presentation and interpretation. We used Sequence diagram below to illustrate how MVC architectural pattern is used for a given classes.&lt;br /&gt;
&lt;br /&gt;
=== Design Strategy ===&lt;br /&gt;
&lt;br /&gt;
As we have concrete understanding of the problem and proposed solution, we would like break this problem into multiple more manageable sub-problems with specific tasks and well-defined solutions to these tasks. Generally, each sub-problem requires modification of one or more files. We would like to propose our Design Strategy as follows:&lt;br /&gt;
&lt;br /&gt;
==== Preparation ====&lt;br /&gt;
&lt;br /&gt;
* Clean up code that our implementation will use&lt;br /&gt;
** PROBLEM: We need to add/change content to the edit assignment Topics tab, but unlike other tabs in the views, it does not have its own partial view to work with&lt;br /&gt;
*** SOLUTION: Refactor and move the code dealing with topics into separate ''app/views/assignments/edit/_topics.html.erb'' file&lt;br /&gt;
*** File: ''app/views/assignments/edit.html.erb''&lt;br /&gt;
** PROBLEM: In a section below, we discuss the need to modify existing methods to also accept an optional argument ''topic_id''.  In many cases these existing method use confusing variable names or lack sufficient comments.&lt;br /&gt;
*** SOLUTION: Clean up methods that we plan to modify&lt;br /&gt;
*** FILE: (many)&lt;br /&gt;
&lt;br /&gt;
==== Implementation ====&lt;br /&gt;
&lt;br /&gt;
* Allow an instructor to indicate that rubric should vary by topic&lt;br /&gt;
** PROBLEM: There is no way for an instructor to indicate that an assignments' rubric should vary by topic&lt;br /&gt;
*** SOLUTION: Add a new checkbox in the edit assignment Rubrics tab to indicate this preference&lt;br /&gt;
*** FILE: ''app/views/assignments/edit/_rubrics.html.erb''&lt;br /&gt;
** PROBLEM: If the user changes the &amp;quot;Review rubric varies by round?&amp;quot; or &amp;quot;Review rubric varies by topic?&amp;quot; checkbox on the Rubrics tab, but leaves the page in an inappropriate state before leaving the tab (e.g. rubric weights that do not add up to 0% or 100%), then the user does not get feedback that they made a mistake.  They only get such feedback when explicitly performing a &amp;quot;Save&amp;quot;.  Switching from tab to tab on the assignments edit page attempts to perform an implicit save, but there is no mechanism to update the flash messages onscreen if anything goes wrong.  This becomes more problematic now that the Topics tab appearance depends on choices made on the Rubrics tab.  &lt;br /&gt;
*** SOLUTION: Provide a route to an assignments controller method that can return a render of the flash messages.  Add an AJAX call on the assignments edit view that can update the flash messages onscreen.&lt;br /&gt;
*** FILE: app/controllers/assignments_controller.rb&lt;br /&gt;
*** FILE: app/views/assignments/edit.html.erb&lt;br /&gt;
&lt;br /&gt;
* Allow an instructor to choose different rubrics for different topics&lt;br /&gt;
** PROBLEM: There is no way for an instructor to choose different rubrics for different topics&lt;br /&gt;
*** SOLUTION: Add a new column in the edit assignment Topics tab for choosing rubric(s)&lt;br /&gt;
**** New column only visible if rubrics vary by topic, per Rubrics tab&lt;br /&gt;
**** New column has multiple rounds per topic only if rubrics vary by round, per Rubrics tab&lt;br /&gt;
**** Default value for any rubric is that rubric which is shown on Rubrics tab&lt;br /&gt;
**** Rubric(s) in the dropdown list is/are only those that were created by the currently logged in instructor&lt;br /&gt;
*** FILE: ''app/views/assignments/edit/_topics.html.erb''&lt;br /&gt;
** PROBLEM: The code in ''app/views/assignments/edit/_rubrics.html.erb'' includes dropdowns like the ones we need to add for topics, but that code is way too complex for its functionality (too heavy for a view, uses JavaScript)&lt;br /&gt;
*** SOLUTION: Use the code in ''app/views/assignments/edit/_rubrics.html.erb'' for inspiration only&lt;br /&gt;
**** Refactor and move as much actual work as possible out into helper methods that are simply called from this view&lt;br /&gt;
**** Views are not intended to do heavy lifting&lt;br /&gt;
**** Use as little JavaScript as possible, since this is a Ruby On Rails project, not a JS project&lt;br /&gt;
*** FILE: ''app/views/assignments/edit/_topics.html.erb''&lt;br /&gt;
** PROBLEM: The drop-downs for selecting rubrics should show only those rubrics created by the currently-logged in instructor (per project mentor).  They currently include those created by the instructor of the relevant assignment.&lt;br /&gt;
*** SOLUTION: Change the filtering in the ''questionnaire_options'' method to reflect the desired filtering.&lt;br /&gt;
*** FILE: app/helpers/assignment_helper.rb&lt;br /&gt;
&lt;br /&gt;
* Support the ability of the database to link rubrics to topics&lt;br /&gt;
** PROBLEM: There is no relationship in the database that can link together rubrics with topics&lt;br /&gt;
*** SOLUTION: Add a new migration that adds topic_id field to existing assignment_questionnaires table&lt;br /&gt;
**** This new field will reference the id field in the sign_up_topics table&lt;br /&gt;
*** FILE: ''db/migrate/[timestamp]_add_topic_id_to_assignment_questionnaires_table.rb''&lt;br /&gt;
** PROBLEM: The AssignmentQuestionnaire model does not have any knowledge of topics&lt;br /&gt;
*** SOLUTION: Add a new belongs_to reference in the model, to sign_up_topic&lt;br /&gt;
*** FILE: ''app/models/assignment_questionnaire.rb''&lt;br /&gt;
** PROBLEM: The SignUpTopic model does not have any knowledge of assignment_questionnaire records&lt;br /&gt;
*** SOLUTION: Add a new has_many reference in the model, to assignment_questionnaires&lt;br /&gt;
*** FILE: ''app/models/sign_up_topic.rb''&lt;br /&gt;
&lt;br /&gt;
* React to an instructor saving an assignment after altering the rubrics-vary-by-topic checkbox&lt;br /&gt;
** PROBLEM: There is nothing in place to remember when an instructor chooses to vary rubrics by topic, or chooses to not vary rubrics by topic&lt;br /&gt;
*** SOLUTION: Modify existing method ''update_assignment_questionnaires()''.  This method executes upon assignment save (explicit or via tab-change).  This method deletes all ''AssignmentQuestionnaire'' records before creating new correct records reflecting the user's selections in the edit assignment form.  Modify such that this method can create multiple records reflecting multiple topics, in the case where rubric should vary by topic.  With this modification, the correct records (with default rubrics) are present when the user goes to the Topics tab, so that the Topics tab can display properly.&lt;br /&gt;
*** FILE: app\models\assignment_form.rb&lt;br /&gt;
** PROBLEM: There is no way to refresh the Topics tab to show / hide drop-downs after the instructor changes checkbox on Rubrics tab&lt;br /&gt;
*** SOLUTION: Make use of existing &amp;quot;Save&amp;quot;-like functionality when changing tabs on the edit assignment page.  When updating due to tab-change, cause a fresh render of the Topics tab.  When updating due to &amp;quot;Save&amp;quot; button, keep functionality as-is.&lt;br /&gt;
*** FILE: ''app/controllers/assignments_controller.rb''&lt;br /&gt;
*** FILE: ''app/views/assignments/edit.html.erb''&lt;br /&gt;
&lt;br /&gt;
* Support the ability to find the correct rubric for a particular topic&lt;br /&gt;
** PROBLEM: The existing methods allow us to find the correct rubric for a particular round, but not a particular topic&lt;br /&gt;
*** SOLUTION: Modify the existing method questionnaire(assignment, type, round_number) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/helpers/assignment_helper.rb''&lt;br /&gt;
*** SOLUTION: Modify the existing method assignment_questionnaire(assignment, type, number) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/helpers/assignment_helper.rb''&lt;br /&gt;
*** SOLUTION: Modify the existing method questionnaire(round = nil) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/models/review_response_map.rb''&lt;br /&gt;
*** SOLUTION: Modify the existing method questionnaire(round) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/models/self_review_response_map.rb''&lt;br /&gt;
*** SOLUTION: Modify the existing method review_questionnaire_id(round = nil) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/models/assignment.rb''&lt;br /&gt;
&lt;br /&gt;
* Use the correct rubric for a particular topic&lt;br /&gt;
** PROBLEM: When finding rubrics to display, save results from, calculate scores from, etc. round may be used but topic is not&lt;br /&gt;
*** SOLUTION: Examine all callers of methods modified in the previous section and pass in ''topic_id'' where appropriate to grab the correct rubric&lt;br /&gt;
*** FILE: (many)&lt;br /&gt;
&lt;br /&gt;
* Support the ability to determine if an assignment has rubrics that vary by topic&lt;br /&gt;
** PROBLEM: There is no handy method to call that can tell us if an assignment has rubrics that vary by topic&lt;br /&gt;
*** SOLUTION: Add a new method ''varying_rubrics_by_topic?'' based on the existing method ''varying_rubrics_by_round?''&lt;br /&gt;
*** FILE: ''app/models/assignment.rb''&lt;br /&gt;
&lt;br /&gt;
=== Q&amp;amp;A ===&lt;br /&gt;
&lt;br /&gt;
Here we paraphrase some questions we received during round 1 of the documentation review.&lt;br /&gt;
&lt;br /&gt;
* Q: How will the new logic for varying rubric by topic tie in with the existing logic?&lt;br /&gt;
** A: We will add a new field ''topic_id'' into the existing table ''assignment_questionnaires'', as noted in the [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Entity_Relationship_Diagram E/R Diagram].  We will update methods that find questionnaires to allow these methods to also accept a ''topic_id'' argument, as noted in [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Implementation Implementation].&lt;br /&gt;
* Q: How will the &amp;quot;Rubric varies by topic&amp;quot; selection be stored?&lt;br /&gt;
** A: Indirectly, by saving records in the ''assignment_questionnaires'' table which either reference a ''topic_id'' or leave this field nil.  For more details please see the [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Entity_Relationship_Diagram E/R Diagram] discussion.&lt;br /&gt;
* Q: What will happen if an instructor selects &amp;quot;Rubric varies by topic&amp;quot;, makes selections on the &amp;quot;Topics&amp;quot; tab, and then deselects &amp;quot;Rubric varies by topic&amp;quot;?&lt;br /&gt;
** A: The Topics tab, when next visited, will no longer show dropdowns for selecting rubrics by topic.  When the assignment is saved, the appropriate not-varying-by-topic records will be saved in the ''assignment_questionnaires'' table.  For more details please see [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Implementation Implementation].&lt;br /&gt;
* Q: What will happen after an instructor selects &amp;quot;Rubric varies by topic&amp;quot;?&lt;br /&gt;
** A: The Topics tab, when next visited, will now show dropdowns for selecting rubrics by topic.  These rubrics will default to those shown on the Rubrics tab.  When the assignment is saved, the appropriate varying-by-topic records will be saved in the ''assignment_questionnaires'' table.  For more details please see [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Implementation Implementation].&lt;br /&gt;
* Q: How will the appropriate list of questionnaires for the new dropdowns on the Topics tab be determined?&lt;br /&gt;
** A: In the same way that the appropriate list of questionnaires for the existing dropdowns on the Rubrics tab is determined.  Namely, by the ''questionnaire_options'' method in the file ''expertiza/app/helpers/assignment_helper.rb''.&lt;br /&gt;
&lt;br /&gt;
=== (Selected) Modified Code ===&lt;br /&gt;
&lt;br /&gt;
In this section, we provide ''selected portions'' of modified code to illustrate how we implemented the new feature.&lt;br /&gt;
&lt;br /&gt;
Allow an instructor to indicate that rubric should vary by topic&lt;br /&gt;
&lt;br /&gt;
''app\views\assignments\edit\_rubrics.html.erb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;lt;input name=&amp;quot;vary_by_topic&amp;quot; type=&amp;quot;hidden&amp;quot; value=&amp;quot;false&amp;quot; /&amp;gt;&lt;br /&gt;
  &amp;lt;%= check_box_tag('vary_by_topic', 'true', @review_vary_by_topic_check) %&amp;gt;&lt;br /&gt;
  &amp;lt;%= label_tag('vary_by_topic', 'Review rubric varies by topic?') %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Allow an instructor to choose different rubrics for different topics&lt;br /&gt;
&lt;br /&gt;
''app\views\sign_up_sheet\_table_line.html.erb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;lt;% if @assignment_form.assignment.varying_rubrics_by_topic? %&amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;table id = &amp;lt;%=table_id %&amp;gt;&amp;gt;&lt;br /&gt;
        &amp;lt;tr&amp;gt;&lt;br /&gt;
          &amp;lt;script&amp;gt;&lt;br /&gt;
              ...&lt;br /&gt;
              &amp;lt;% if @assignment_form.assignment.varying_rubrics_by_round? %&amp;gt;&lt;br /&gt;
                &amp;lt;% for round in 1..@assignment_form.assignment.rounds_of_reviews %&amp;gt;&lt;br /&gt;
                  ...&lt;br /&gt;
                &amp;lt;% end %&amp;gt;&lt;br /&gt;
              &amp;lt;% else %&amp;gt;&lt;br /&gt;
                ...&lt;br /&gt;
              &amp;lt;% end %&amp;gt;&lt;br /&gt;
          &amp;lt;/script&amp;gt;&lt;br /&gt;
        &amp;lt;/tr&amp;gt;&lt;br /&gt;
      &amp;lt;/table&amp;gt;&lt;br /&gt;
    &amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Support the ability of the database to link rubrics to topics&lt;br /&gt;
&lt;br /&gt;
''app\models\sign_up_topic.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  class SignUpTopic &amp;lt; ActiveRecord::Base&lt;br /&gt;
    ...&lt;br /&gt;
    has_many :assignment_questionnaires, class_name: 'AssignmentQuestionnaire', foreign_key: 'topic_id', dependent: :destroy&lt;br /&gt;
    ...&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
React to an instructor saving an assignment after altering the rubrics-vary-by-topic checkbox&lt;br /&gt;
&lt;br /&gt;
''app/controllers/assignments_controller.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def update&lt;br /&gt;
    ...&lt;br /&gt;
    # What to do next depends on how we got here&lt;br /&gt;
    if params['button'].nil?&lt;br /&gt;
      # REFRESH the topics tab after changing tabs&lt;br /&gt;
      ...&lt;br /&gt;
      render :partial =&amp;gt; &amp;quot;assignments/edit/topics&amp;quot;&lt;br /&gt;
    else&lt;br /&gt;
      # SAVE button was used (do a redirect)&lt;br /&gt;
      redirect_to edit_assignment_path @assignment_form.assignment.id&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Support the ability to find the correct rubric for a particular topic&lt;br /&gt;
&lt;br /&gt;
''app/helpers/assignment_helper.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def assignment_questionnaire(assignment, questionnaire_type, round_number = nil, topic_id = nil)&lt;br /&gt;
    q_by_type = assignment.questionnaires.find_by(type: questionnaire_type)&lt;br /&gt;
    if q_by_type.nil?&lt;br /&gt;
      ...&lt;br /&gt;
    else&lt;br /&gt;
      ...&lt;br /&gt;
      aq_by_type = assignment.assignment_questionnaires.find_by(questionnaire_id: q_by_type.id)&lt;br /&gt;
      if round_number.nil? &amp;amp;&amp;amp; topic_id.nil?&lt;br /&gt;
        # Find by type&lt;br /&gt;
        aq = aq_by_type&lt;br /&gt;
      elsif topic_id.nil?&lt;br /&gt;
        # Find by round&lt;br /&gt;
        aq = assignment.assignment_questionnaires.find_by(used_in_round: round_number)&lt;br /&gt;
      elsif round_number.nil?&lt;br /&gt;
        # Find by topic&lt;br /&gt;
        aq = assignment.assignment_questionnaires.find_by(topic_id: topic_id)&lt;br /&gt;
      else&lt;br /&gt;
        # Find by round and topic&lt;br /&gt;
        aq = assignment.assignment_questionnaires.where(used_in_round: round_number, topic_id: topic_id).first&lt;br /&gt;
      end&lt;br /&gt;
      aq.nil? ? aq_by_type : aq&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use the correct rubric for a particular topic&lt;br /&gt;
&lt;br /&gt;
''app\controllers\response_controller.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def set_questionnaire_for_new_response&lt;br /&gt;
    case @map.type&lt;br /&gt;
    when &amp;quot;ReviewResponseMap&amp;quot;, &amp;quot;SelfReviewResponseMap&amp;quot;&lt;br /&gt;
      reviewees_topic = SignedUpTeam.topic_id_by_team_id(@contributor.id)&lt;br /&gt;
      @current_round = @assignment.number_of_current_round(reviewees_topic)&lt;br /&gt;
      @questionnaire = @map.questionnaire(@current_round, reviewees_topic)&lt;br /&gt;
    when&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Support the ability to determine if an assignment has rubrics that vary by topic&lt;br /&gt;
&lt;br /&gt;
''app\models\assignment.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def varying_rubrics_by_topic?&lt;br /&gt;
    aq_no_topic_id = AssignmentQuestionnaire.where(assignment_id: self.id, topic_id: nil).size &amp;gt;= 1&lt;br /&gt;
    aq_with_topic_id = AssignmentQuestionnaire.where(assignment_id: self.id).where.not(topic_id: nil).size &amp;gt;= 1&lt;br /&gt;
    if !aq_no_topic_id &amp;amp;&amp;amp; !aq_with_topic_id&lt;br /&gt;
      return false&lt;br /&gt;
    elsif aq_no_topic_id &amp;amp;&amp;amp; !aq_with_topic_id&lt;br /&gt;
      return false&lt;br /&gt;
    elsif !aq_no_topic_id &amp;amp;&amp;amp; aq_with_topic_id&lt;br /&gt;
      return true&lt;br /&gt;
    else&lt;br /&gt;
      raise StandardError.new(&amp;quot;Assignment with id &amp;quot; + self.id.to_s + &amp;quot; has a conflict about whether or not it varies by topic&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== How To ==&lt;br /&gt;
&lt;br /&gt;
In this section, we describe how to use the newly implemented feature.&lt;br /&gt;
&lt;br /&gt;
=== Add a New Rubric ===&lt;br /&gt;
&lt;br /&gt;
* [to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
=== Select a Rubric for a Topic ===&lt;br /&gt;
&lt;br /&gt;
* [to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
== Project Testing ==&lt;br /&gt;
&lt;br /&gt;
=== Strategy ===&lt;br /&gt;
&lt;br /&gt;
To test code implementation, correctness of the added feature, verify that the team did not break any existing functionalities in the Expertiza, and ensure that no bugs were introduced in the code, we developed the following Test Strategy:&lt;br /&gt;
&lt;br /&gt;
# Code inspection&lt;br /&gt;
# Run and pass existing RSpec Tests&lt;br /&gt;
# Develop New RSpec Tests&lt;br /&gt;
# Run through live UI to test a feature using Expertiza instance&lt;br /&gt;
&lt;br /&gt;
=== Rspec Testing ===&lt;br /&gt;
&lt;br /&gt;
==== Existing Tests ====&lt;br /&gt;
&lt;br /&gt;
Run all existing RSpec tests on any changed files, after our changes, to ensure that we have not introduced any failures.&lt;br /&gt;
The commands and results are shown below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
e@ubuntu:~/Desktop/CSC517_HW04/expertiza$ bundle exec rspec spec/helpers/ spec/controllers/ spec/models/&lt;br /&gt;
[Coveralls] Set up the SimpleCov formatter.&lt;br /&gt;
[Coveralls] Using SimpleCov's 'rails' settings.&lt;br /&gt;
&lt;br /&gt;
Randomized with seed 6978&lt;br /&gt;
[...]&lt;br /&gt;
&lt;br /&gt;
Finished in 8 minutes 10 seconds (files took 12.32 seconds to load)&lt;br /&gt;
900 examples, 0 failures, 16 pending&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The features tests were extremely time-consuming so we did not routinely run them during development.  However TravisCI results on our [https://github.com/expertiza/expertiza/pull/1444 Pull Request] demonstrate the passing status of all tests.&lt;br /&gt;
&lt;br /&gt;
==== New Tests ====&lt;br /&gt;
&lt;br /&gt;
Write comprehensive RSpec tests, for all new or modified methods.&lt;br /&gt;
* FILE: ''spec/helpers/assignment_helper_spec.rb''&lt;br /&gt;
** METHODS TO TEST: &lt;br /&gt;
*** questionnaire(assignment, type, round_number, topic_id)&lt;br /&gt;
*** assignment_questionnaire(assignment, type, number, topic_id)&lt;br /&gt;
* FILE: ''spec/models/review_response_map_spec.rb''&lt;br /&gt;
*** METHODS TO TEST:&lt;br /&gt;
**** questionnaire(round, topic_id)&lt;br /&gt;
* FILE: ''spec/models/self_review_response_map_spec.rb''&lt;br /&gt;
*** METHODS TO TEST:&lt;br /&gt;
**** questionnaire(round, topic_id)&lt;br /&gt;
* FILE: ''spec/models/assignment_spec.rb''&lt;br /&gt;
*** METHODS TO TEST:&lt;br /&gt;
**** review_questionnaire_id(round, topic_id)&lt;br /&gt;
**** varying_rubrics_by_topic?()&lt;br /&gt;
&lt;br /&gt;
Run these tests, to ensure that the new code works as intended.&lt;br /&gt;
The commands and results are shown below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
e@ubuntu:~/Desktop/CSC517_HW04/expertiza$ bundle exec rspec spec/helpers/assignment_helper_spec.rb spec/models/review_response_map_spec.rb spec/models/self_review_response_map_spec.rb spec/models/assignment_spec.rb &lt;br /&gt;
[Coveralls] Set up the SimpleCov formatter.&lt;br /&gt;
[Coveralls] Using SimpleCov's 'rails' settings.&lt;br /&gt;
&lt;br /&gt;
Randomized with seed 47508&lt;br /&gt;
....................................................................................................................&lt;br /&gt;
&lt;br /&gt;
Finished in 1 minute 7.94 seconds (files took 10.85 seconds to load)&lt;br /&gt;
116 examples, 0 failures&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The test suite for a single new method is shown below.&lt;br /&gt;
* There are many such suites added in expertiza/spec  &lt;br /&gt;
* This example illustrates our general strategy:&lt;br /&gt;
** test missing input&lt;br /&gt;
** test bad input&lt;br /&gt;
** test various acceptable forms of input&lt;br /&gt;
** test scenarios that lead to various return values&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  describe &amp;quot;#questionnaire&amp;quot; do&lt;br /&gt;
&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;throws exception if assignment argument nil&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;throws exception if all arguments nil except for assignment&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;finds by type if round number &amp;amp; topic id not given&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;throws exception if round number &amp;amp; topic id not given, no luck finding by type&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;finds by round number alone if round number alone is given&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;creates new questionnaire of given type if round number alone is given, no luck finding by round&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;finds by topic id alone if topic id alone is given&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;creates new questionnaire of given type if topic id alone is given, no luck finding by topic&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;finds by round number and topic id if both are given&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;creates new questionnaire of given type if round and topic are given, no luck finding by round and topic&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== UI Testing ===&lt;br /&gt;
&lt;br /&gt;
Here we describe manual UI Testing that was performed.&lt;br /&gt;
&lt;br /&gt;
==== Rubric does not vary by round or by topic ====&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
==== Rubric varies by round, but not by topic ====&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
==== Rubric varies by topic, but not by round ====&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
==== Rubric varies by both round and topic ====&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
In CSC/ECE 517, there are several types of topics that could be covered in a single class assignment.  However, currently we can only specify one kind of rubric for an assignment. This means that teams working on different topics will be evaluated using the same rubric. With this setup, it's not possible to fine-tune rubrics for different topics - rubrics tend to be overly general.&lt;br /&gt;
&lt;br /&gt;
In this project, we have solved this issue, by allowing rubrics to vary not only by round, but also by topic. This allows more flexibility to the instructor when setting up an assignment, so that they can use rubrics better suited to the tasks that students are performing in an assignment.  The following scenarios will be possible, and the instructor will be the judge of which scenario is the best fit to the assignment:&lt;br /&gt;
&lt;br /&gt;
* Rubric does not vary by round or by topic.&lt;br /&gt;
* Rubric varies by round, but not by topic.&lt;br /&gt;
* Rubric varies by topic, but not by round.&lt;br /&gt;
* Rubric varies by both round and topic.&lt;br /&gt;
&lt;br /&gt;
The instructor may use the Rubrics tab of the assignments edit page to make changes to the &amp;quot;Review rubric varies by round?&amp;quot; and &amp;quot;Review rubric varies by topic?&amp;quot; checkboxes.  The instructor may then use the Topics tab to select the appropriate rubric(s) for every topic in the assignment.&lt;br /&gt;
&lt;br /&gt;
Various other Expertiza code has been updated to retrieve the correct rubric depending on round and topic after the instructor has made these selections.&lt;br /&gt;
&lt;br /&gt;
== Future Work ==&lt;br /&gt;
&lt;br /&gt;
This section discusses possible future work for another CSC 517 team to take on.  Such a team can search the Expertiza codebase for &amp;quot;TODO E1936 (future work)&amp;quot; to find most of the places in the code that the notes below refer to.&lt;br /&gt;
&lt;br /&gt;
* Reduce the delay between changing the state of the &amp;quot;Review rubric varies by topic?&amp;quot; checkbox on the Rubrics tab, and the show / hide of rubric drop-downs on the Topics tab.&lt;br /&gt;
* Redesign UI for tone analysis, heatmaps, and review scores pop-up.  These areas are designed around the assumption that reviews do NOT vary by topic.  For example, in the review scores pop-up, a reviewer can see the reviews they have given, arranged by question, across multiple reviewees.&lt;br /&gt;
* Consider whether the questionnaire options available for selection in drop-downs on the Topics and Rubrics tabs should include ''only'' those questionnaires created by the currently-logged-in instructor.  Our work in this project changed the filtering from instructor-owning-assignment to currently-logged-in instructor - but left in place all non-private questionnaires.  ''Consider'' whether non-private questionnaires should be excluded.  This may result in some drop-downs not having any available questionnaires.&lt;br /&gt;
&lt;br /&gt;
== Useful Links ==&lt;br /&gt;
In this section we provide useful links related to the work that has been completed by our team.&lt;br /&gt;
# [https://github.com/gabalmat/expertiza Forked Project Repository]&lt;br /&gt;
# [https://github.com/expertiza/expertiza/pull/1444 Pull Request]&lt;br /&gt;
# [(add link here) Video Demonstration of Specialized Rubrics]&lt;br /&gt;
# [(add link here) Video Demonstration of Passing Rspec Tests]&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Contacts ===&lt;br /&gt;
We have 4 (four) members in our team and 1 (one) mentor was also assigned to us. For any project-related questions/concerns please contact us:&lt;br /&gt;
* Aurora Tiffany-Davis - attiffan@ncsu.edu&lt;br /&gt;
* Ginger Balmat - gabalmat@ncsu.edu&lt;br /&gt;
* Joe Hutchinson - jehutch3@ncsu.edu&lt;br /&gt;
* Nikolay Titov - ngtitov@ncsu.edu&lt;br /&gt;
* Zhewei Hu (mentor) - zhu6@ncsu.edu&lt;br /&gt;
&lt;br /&gt;
=== Contribution Based Inquiry ===&lt;br /&gt;
For any questions or concerns related to the project design, implementation, testing of the feature developed by our team, please contact an engineer who worked closely on the topic of your interest based on the [https://docs.google.com/spreadsheets/d/11uxuI_5gaC-FQDwIOxtCaN3HZ9bfWDJgIjFemtYV5jE/edit?ts=5ca222f3#gid=0 Contribution Assignment Grid] we created to keep track of our progress and contribution. Please carbon copy all team members and our mentor in the email.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* Expertiza Web [https://github.com/expertiza/expertiza#expertiza]&lt;br /&gt;
* Expertiza on GitHub [https://github.com/expertiza/expertiza]&lt;br /&gt;
* Expertiza Wiki [http://wikis.lib.ncsu.edu/index.php/Expertiza]&lt;br /&gt;
* Rspec Documentation [https://relishapp.com/rspec]&lt;br /&gt;
* Wiki with Previous Work [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1873_Specialized_rubics_for_different_topic_types]&lt;br /&gt;
* Pull Request of the Previous Work [https://github.com/expertiza/expertiza/pull/1327]&lt;/div&gt;</summary>
		<author><name>Ngtitov</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics&amp;diff=124479</id>
		<title>E1936 Specialized Rubrics</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics&amp;diff=124479"/>
		<updated>2019-04-26T15:32:21Z</updated>

		<summary type="html">&lt;p&gt;Ngtitov: /* Class Diagram */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page describes the work and goals that have been completed and achieved while implementing Expertiza Project &amp;quot;''E1936. Specialized Rubrics for Different Topic Types (e.g., Servo project, refactoring project)''&amp;quot; for the CSC/ECE 517 &amp;quot;Object-Oriented Design and Development&amp;quot; class, in the Spring semester of the 2019.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This Wiki page is created per CSC/ECE 517: &amp;quot;Object-Oriented Design and Development&amp;quot;, Expertiza Project requirements (Spring, 2019).&lt;br /&gt;
&lt;br /&gt;
Our [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Team team] was assigned the project &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936. Specialized rubrics for different topic types (e.g., Servo project, refactoring project)]&amp;quot;.  This is an Expertiza project.&lt;br /&gt;
&lt;br /&gt;
In this wiki page we describe the problem to be solved, how we solve that problem, and how we test our solution.  We also provide helpful links and contact information for our team.&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
In this section, we discuss the problem we need to solve, the Expertiza feature this problem is related to, what needs to be done to solve the problem (at a high level), and the previous attempt to solve this problem.&lt;br /&gt;
&lt;br /&gt;
=== Problem Statement ===&lt;br /&gt;
&lt;br /&gt;
This problem statement summarizes the problem as described in the project description &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936. Specialized rubrics for different topic types (e.g., Servo project, refactoring project)]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
In CSC/ECE 517, there are several types of topics that could be covered in a single class assignment.&lt;br /&gt;
* Code base&lt;br /&gt;
** Expertiza&lt;br /&gt;
** Mozilla&lt;br /&gt;
** etc.&lt;br /&gt;
* Goal&lt;br /&gt;
** Refactoring&lt;br /&gt;
** Testing&lt;br /&gt;
** etc.&lt;br /&gt;
However, currently we can only specify one kind of rubric for an assignment.  This means that teams working on different topics will be evaluated using the same rubric.  With this setup, it's not possible to fine-tune rubrics for different topics - rubrics tend to be overly general.&lt;br /&gt;
&lt;br /&gt;
=== Feature Description ===&lt;br /&gt;
&lt;br /&gt;
The Expertiza project already has a feature that allows rubrics to vary by project phase or &amp;quot;round&amp;quot;.  The feature we will add in this project is a feature to allow rubrics to vary not only by round, but also by topic.  This allows more flexibility to the instructor when setting up an assignment, so that they can use rubrics better suited to the tasks that students are performing in an assignment.&lt;br /&gt;
&lt;br /&gt;
When this feature is complete, the following scenarios will be possible, and the instructor will be the judge of which scenario is the best fit to the assignment:&lt;br /&gt;
&lt;br /&gt;
* Rubric does not vary by round or by topic.&lt;br /&gt;
* Rubric varies by round, but not by topic.&lt;br /&gt;
* Rubric varies by topic, but not by round.&lt;br /&gt;
* Rubric varies by both round and topic.&lt;br /&gt;
&lt;br /&gt;
=== What Needs to be Done ===&lt;br /&gt;
&lt;br /&gt;
This section summarizes the work as described in the project description &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936. Specialized rubrics for different topic types (e.g., Servo project, refactoring project)]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* In assignment#edit page &amp;quot;Rubrics&amp;quot; tab, add a checkbox to specify whether rubric should vary by topic.&lt;br /&gt;
* In assignment#edit page &amp;quot;Topics&amp;quot; tab, add dropdown(s) next to each topic to specify which rubric(s) are associated with the topic.&lt;br /&gt;
** The dropdown(s) should appear only if rubric should vary by topic, per the Rubrics tab.&lt;br /&gt;
** The topic should have a multiple dropdowns (one for each round) only if rubrics vary by round, per the Rubrics tab.&lt;br /&gt;
** By default, the rubric(s) for each course project will be the one(s) specified in “Rubrics” tab.&lt;br /&gt;
** The dropdown value can overwrite the default rubric.&lt;br /&gt;
* Be careful when making changes to the code&lt;br /&gt;
** The signup_sheet_controller should have as little to do as possible with the selection of rubrics.&lt;br /&gt;
** Anything not germane to selecting topics should be in another controller or (more probably) a helper.&lt;br /&gt;
* Create a DB migration to allow rubric to vary by topic as well as by round.&lt;br /&gt;
&lt;br /&gt;
==== Screenshots ====&lt;br /&gt;
'''Current screenshot of Rubrics tab for an Assignment'''&lt;br /&gt;
(need to add a checkbox to indicate that rubric should vary by topic)&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Screenshot Assignment Edit Rubrics.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Current screenshot of Topics tab for an Assignment'''&lt;br /&gt;
(need to add a way to select rubrics for particular topics)&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Screenshot Assignment Edit Topics.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Proposed screenshot of Rubrics tab for an Assignment'''&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Specialized Rubric rubric checkbox.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Proposed screenshot of Topics tab for an Assignment'''&lt;br /&gt;
&lt;br /&gt;
(drop down shown for only one topic here, but final product will have one for each topic)&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Specialized Rubric dropdown menu.png]]&lt;br /&gt;
&lt;br /&gt;
== Previous Work ==&lt;br /&gt;
&lt;br /&gt;
There was previous attempt to implement this project in the Fall of 2018 semester by different team, but it was rejected due to several reasons. Our team was provided with all relevant information and materials about the design and implementation of the previously attempted project. We would like to acknowledge that we use previous implementation and design as reference and our starting point for our own implementation. The following is the list of links with the relevant materials that we have used for better project understanding, determining pros and cons of previously proposed changes, and establishing our design strategy and implementation:&lt;br /&gt;
&lt;br /&gt;
# [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1873_Specialized_rubics_for_different_topic_types Wiki]&lt;br /&gt;
# [https://github.com/expertiza/expertiza/pull/1327 Pull Request]&lt;br /&gt;
# [https://drive.google.com/file/d/1UrLb0Ula_Lb_F4MOrdC-s6xng6B08VYu/view Video Demo]&lt;br /&gt;
&lt;br /&gt;
After reviewing all relevant materials above, we concluded that the project implementation was incomplete and proposed design had significant flaw. &lt;br /&gt;
We identified main drawbacks and flaw as follows:&lt;br /&gt;
&lt;br /&gt;
* Establishing incorrect ''many-to-one'' relationship between ''sign_up_topics'' and ''questionnaires'' tables:&lt;br /&gt;
** Creating a DB migration to add ''questionnaire_id'' in the ''sign_up_topics'' table to store the dropdown data presumes ''one-to-one'' or ''many-to-one'' relationship between ''sign_up_topics'' and ''questionnaires'' tables&lt;br /&gt;
** Correct relationship between ''sign_up_topics'' and ''questionnaires'' tables is ''many-to-many''. For example, each project topic may have various rubrics depending on the round it is used (e.g., for round 1, topic may have one rubric; but for round 2, the same topic may have different rubric)&lt;br /&gt;
** Proposed previous migration changes would break DB design and would not allow to store correctly topic and its associated rubric per different round.&lt;br /&gt;
* Per project requirement specifications, &amp;quot;''The dropdown box should appear only if 'Vary rubric by topic' is selected in the Rubrics tab.''&amp;quot; This requirement was not met and ''Vary rubric by topic'' checkbox in the Rubrics tab was not implemented. Therefore, dropdown box with the list of rubrics appears regardless of whether &amp;quot;''Vary rubric by topic''&amp;quot; is selected or not.&lt;br /&gt;
* The dropdown box includes the list of all possible rubrics including default value. However, this condition can be improved. The dropdown box should list the rubrics that were created by the current user (professor who is logged in). This would allow to shorten the list of possible rubrics dramatically and help to avoid any misunderstanding and confusion while user selects desired rubric for the course project.&lt;br /&gt;
&lt;br /&gt;
We found no further issues with the rest implementation and in other project materials. Wiki page is very useful for understanding design of proposed changes, finding drawbacks and the flaw. Considering all the pros and cons, and taking into account drawbacks of the proposed changes, our team evolved different approach that should successfully solve the problem stated for the project without without creating additional issues. Please see our [http://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics#Project_Implementation Project Implementation] for more details.&lt;br /&gt;
&lt;br /&gt;
== Previous Project Requirements ==&lt;br /&gt;
&lt;br /&gt;
The project requirements originally specified how to alter the databases to support varying rubrics by topic.&lt;br /&gt;
&lt;br /&gt;
''Create a new table named topic_questionnaires with field:''&lt;br /&gt;
* ''id''&lt;br /&gt;
* ''topic_id''&lt;br /&gt;
* ''questionnaire_id''&lt;br /&gt;
* ''used_in_round''&lt;br /&gt;
&lt;br /&gt;
However, the E1936 team successfully petitioned for this requirement to change to give us more freedom in the implementation.  The original suggestion had a flaw.  There is already an existing table in the Expertiza project called ''assignment_questionnaires'', which has columns including ''assignment_id'', ''questionnaire_id'', and ''used_in_round''.  It is this table that maintains the knowledge of which rubric is used in which round of an assignment.  If we were to add a new table to maintains the knowledge of which rubric is used in which topic of an assignment as originally suggested, then we would have a big problem.  Knowledge of round-rubric relationship is duplicated.  This would lead (best case scenario) to extra work, and (worst case scenario) to lots of bugs caused by inconsistencies in how these tables are handled with CRUD operations throughout the code.  In other words, this is not a DRY solution.&lt;br /&gt;
&lt;br /&gt;
== Project Implementation ==&lt;br /&gt;
&lt;br /&gt;
In this section, we propose our solution to the problem, discuss implementation techniques and details, and list the goals we achieved.&lt;br /&gt;
&lt;br /&gt;
We start by analyzing Entity Relationship Diagram where we state the solution to the problem. Further we discuss design strategy by breaking project problem into multiple staged sub-problems and provide solutions for each of these sub-problems. We also discuss some implementation details and provide the list of involved files. Finally, we demonstrate how the implemented feature can be used by providing a ''How To'' sub-section.&lt;br /&gt;
&lt;br /&gt;
=== Diagrams ===&lt;br /&gt;
&lt;br /&gt;
Our solution and implementation of the project can be easily shown by discussing Use Case, Entity Relationship, and Class diagrams. First, for simplicity we discuss in general possible sequence of interactions between a user (in this case instructor) and the system (Expertiza) via presenting Use Case Diagram. Then we plan to show proposed database modification via Entity Relationship Diagram.&lt;br /&gt;
&lt;br /&gt;
==== User Case Diagram ====&lt;br /&gt;
&lt;br /&gt;
[[File: use_case_diagram_1936.png]]&lt;br /&gt;
&lt;br /&gt;
The above Use Case Diagram shows general sequence of interactions between an instructor and the system (Expertiza) that defines where and how the feature can be utilized. Note that highlighted use cases are objects of our interest and work. Also please note that all of the shown use cases already exist in the system and we simply adding new feature into the system with existing use cases. Particularly, the rubric for each assignment and newly added ''Review rubric varies by topic'' checkbox with which instructor may choose to vary assignment by topic or not by checking and unchecking the checkbox is displayed in the ''Rubrics'' tab. Hence, we show how instructor can get to the ''Rubrics'' tab of the assignments. Similarly, ''Topics'' tab of assignments has additional ''Questionnaires'' column for each topic, where instructor may specify which rubric associates with the topic. To perform such sequence of iterations and utilize the new feature, instructor must choose ''Edit'' any assignment from the list of all assignments displayed to him/her in the ''Manage Assignments'' boundary, which can be navigated by instructor by selecting it from the header of the page.&lt;br /&gt;
&lt;br /&gt;
==== Entity Relationship Diagram ====&lt;br /&gt;
&lt;br /&gt;
[[File: HW04_ERD.png]]&lt;br /&gt;
&lt;br /&gt;
The sections of the diagram highlighted in yellow show newly introduced items.  That is, we are adding a new column called ''topic_id'' to ''assignment_questionnaires'', in order to link ''assignment_questionnaires'' to ''sign_up_topics''.&lt;br /&gt;
&lt;br /&gt;
Any assignment, topic, or questionnaire may be represented by multiple records within ''assignment_questionnaires'', but each record within ''assignment_questionnaires'' refers to just one assignment, topic, or questionnaire.  It is the ability to have an assignment represented by multiple records, and the new relationship to ''sign_up_topics'', that allows us to support all of the required scenarios:&lt;br /&gt;
&lt;br /&gt;
* Rubric does not vary by round or by topic.&lt;br /&gt;
* Rubric varies by round, but not by topic.&lt;br /&gt;
* Rubric varies by topic, but not by round.&lt;br /&gt;
* Rubric varies by both round and topic.&lt;br /&gt;
&lt;br /&gt;
[[File: HW04_table.PNG]]&lt;br /&gt;
&lt;br /&gt;
This table illustrates the possibilities that the system may have.&lt;br /&gt;
&lt;br /&gt;
* Assignment 1 does not vary by round or by topic.&lt;br /&gt;
* Assignment 2 varies by round, but not by topic.&lt;br /&gt;
* Assignment 3 varies by topic, but not by round.&lt;br /&gt;
* Assignment 4 varies by both round and topic.&lt;br /&gt;
&lt;br /&gt;
This change is done via database migration by running the following commands:&lt;br /&gt;
&lt;br /&gt;
  rails generate migration AddTopicIdToAssignmentQuestionnaires&lt;br /&gt;
&lt;br /&gt;
Above command adds the ''topic_id'' column to the ''AssignmentQuestionnaires'' table and generates new migration file:&lt;br /&gt;
&lt;br /&gt;
[[File: db_migration.png]]&lt;br /&gt;
&lt;br /&gt;
To see the details of the entire database change please check this [https://github.com/gabalmat/expertiza/commit/d46dd57d35a21ab43efb82c28d3f14b75c695f2e commit].&lt;br /&gt;
&lt;br /&gt;
==== Class Diagram ====&lt;br /&gt;
&lt;br /&gt;
[[File: class_diagram_1936.png]]&lt;br /&gt;
&lt;br /&gt;
The above UML Class diagram describes the changes our team made in the Ruby classes, methods and attributes. Please note that all provided classes in the diagram had already existed in the system, and we only added new relationship, modified existing methods (and some method signatures) and utilized given attributes. All of the class's attributes and methods that are shown in the diagram are utilized (directly and indirectly) in our current implementation. Some of the methods and attributes provided within the classes in the diagram are newly developed. There is only one newly added aggregation relationship between the ''SingUpTopic'' class and ''AssignmentQuestionnaire'' class. Moreover, controllers and models for the certain classes were combined into a single class for simplicity to the design description. In reality, half of the methods shown in  the ''Assignment'' class are implemented in the ''app/controllers/assignments_controller.rb'' file and other half is in the ''app/models/assignment.rb'' file. We decided to combine all of the functionalities of each ''relevant'' controller and model class into single class for the ease of design presentation and interpretation. We used Sequence diagram below to illustrate how MVC architectural pattern is used for a given classes.&lt;br /&gt;
&lt;br /&gt;
=== Design Strategy ===&lt;br /&gt;
&lt;br /&gt;
As we have concrete understanding of the problem and proposed solution, we would like break this problem into multiple more manageable sub-problems with specific tasks and well-defined solutions to these tasks. Generally, each sub-problem requires modification of one or more files. We would like to propose our Design Strategy as follows:&lt;br /&gt;
&lt;br /&gt;
==== Preparation ====&lt;br /&gt;
&lt;br /&gt;
* Clean up code that our implementation will use&lt;br /&gt;
** PROBLEM: We need to add/change content to the edit assignment Topics tab, but unlike other tabs in the views, it does not have its own partial view to work with&lt;br /&gt;
*** SOLUTION: Refactor and move the code dealing with topics into separate ''app/views/assignments/edit/_topics.html.erb'' file&lt;br /&gt;
*** File: ''app/views/assignments/edit.html.erb''&lt;br /&gt;
** PROBLEM: In a section below, we discuss the need to modify existing methods to also accept an optional argument ''topic_id''.  In many cases these existing method use confusing variable names or lack sufficient comments.&lt;br /&gt;
*** SOLUTION: Clean up methods that we plan to modify&lt;br /&gt;
*** FILE: (many)&lt;br /&gt;
&lt;br /&gt;
==== Implementation ====&lt;br /&gt;
&lt;br /&gt;
* Allow an instructor to indicate that rubric should vary by topic&lt;br /&gt;
** PROBLEM: There is no way for an instructor to indicate that an assignments' rubric should vary by topic&lt;br /&gt;
*** SOLUTION: Add a new checkbox in the edit assignment Rubrics tab to indicate this preference&lt;br /&gt;
*** FILE: ''app/views/assignments/edit/_rubrics.html.erb''&lt;br /&gt;
** PROBLEM: If the user changes the &amp;quot;Review rubric varies by round?&amp;quot; or &amp;quot;Review rubric varies by topic?&amp;quot; checkbox on the Rubrics tab, but leaves the page in an inappropriate state before leaving the tab (e.g. rubric weights that do not add up to 0% or 100%), then the user does not get feedback that they made a mistake.  They only get such feedback when explicitly performing a &amp;quot;Save&amp;quot;.  Switching from tab to tab on the assignments edit page attempts to perform an implicit save, but there is no mechanism to update the flash messages onscreen if anything goes wrong.  This becomes more problematic now that the Topics tab appearance depends on choices made on the Rubrics tab.  &lt;br /&gt;
*** SOLUTION: Provide a route to an assignments controller method that can return a render of the flash messages.  Add an AJAX call on the assignments edit view that can update the flash messages onscreen.&lt;br /&gt;
*** FILE: app/controllers/assignments_controller.rb&lt;br /&gt;
*** FILE: app/views/assignments/edit.html.erb&lt;br /&gt;
&lt;br /&gt;
* Allow an instructor to choose different rubrics for different topics&lt;br /&gt;
** PROBLEM: There is no way for an instructor to choose different rubrics for different topics&lt;br /&gt;
*** SOLUTION: Add a new column in the edit assignment Topics tab for choosing rubric(s)&lt;br /&gt;
**** New column only visible if rubrics vary by topic, per Rubrics tab&lt;br /&gt;
**** New column has multiple rounds per topic only if rubrics vary by round, per Rubrics tab&lt;br /&gt;
**** Default value for any rubric is that rubric which is shown on Rubrics tab&lt;br /&gt;
**** Rubric(s) in the dropdown list is/are only those that were created by the currently logged in instructor&lt;br /&gt;
*** FILE: ''app/views/assignments/edit/_topics.html.erb''&lt;br /&gt;
** PROBLEM: The code in ''app/views/assignments/edit/_rubrics.html.erb'' includes dropdowns like the ones we need to add for topics, but that code is way too complex for its functionality (too heavy for a view, uses JavaScript)&lt;br /&gt;
*** SOLUTION: Use the code in ''app/views/assignments/edit/_rubrics.html.erb'' for inspiration only&lt;br /&gt;
**** Refactor and move as much actual work as possible out into helper methods that are simply called from this view&lt;br /&gt;
**** Views are not intended to do heavy lifting&lt;br /&gt;
**** Use as little JavaScript as possible, since this is a Ruby On Rails project, not a JS project&lt;br /&gt;
*** FILE: ''app/views/assignments/edit/_topics.html.erb''&lt;br /&gt;
** PROBLEM: The drop-downs for selecting rubrics should show only those rubrics created by the currently-logged in instructor (per project mentor).  They currently include those created by the instructor of the relevant assignment.&lt;br /&gt;
*** SOLUTION: Change the filtering in the ''questionnaire_options'' method to reflect the desired filtering.&lt;br /&gt;
*** FILE: app/helpers/assignment_helper.rb&lt;br /&gt;
&lt;br /&gt;
* Support the ability of the database to link rubrics to topics&lt;br /&gt;
** PROBLEM: There is no relationship in the database that can link together rubrics with topics&lt;br /&gt;
*** SOLUTION: Add a new migration that adds topic_id field to existing assignment_questionnaires table&lt;br /&gt;
**** This new field will reference the id field in the sign_up_topics table&lt;br /&gt;
*** FILE: ''db/migrate/[timestamp]_add_topic_id_to_assignment_questionnaires_table.rb''&lt;br /&gt;
** PROBLEM: The AssignmentQuestionnaire model does not have any knowledge of topics&lt;br /&gt;
*** SOLUTION: Add a new belongs_to reference in the model, to sign_up_topic&lt;br /&gt;
*** FILE: ''app/models/assignment_questionnaire.rb''&lt;br /&gt;
** PROBLEM: The SignUpTopic model does not have any knowledge of assignment_questionnaire records&lt;br /&gt;
*** SOLUTION: Add a new has_many reference in the model, to assignment_questionnaires&lt;br /&gt;
*** FILE: ''app/models/sign_up_topic.rb''&lt;br /&gt;
&lt;br /&gt;
* React to an instructor saving an assignment after altering the rubrics-vary-by-topic checkbox&lt;br /&gt;
** PROBLEM: There is nothing in place to remember when an instructor chooses to vary rubrics by topic, or chooses to not vary rubrics by topic&lt;br /&gt;
*** SOLUTION: Modify existing method ''update_assignment_questionnaires()''.  This method executes upon assignment save (explicit or via tab-change).  This method deletes all ''AssignmentQuestionnaire'' records before creating new correct records reflecting the user's selections in the edit assignment form.  Modify such that this method can create multiple records reflecting multiple topics, in the case where rubric should vary by topic.  With this modification, the correct records (with default rubrics) are present when the user goes to the Topics tab, so that the Topics tab can display properly.&lt;br /&gt;
*** FILE: app\models\assignment_form.rb&lt;br /&gt;
** PROBLEM: There is no way to refresh the Topics tab to show / hide drop-downs after the instructor changes checkbox on Rubrics tab&lt;br /&gt;
*** SOLUTION: Make use of existing &amp;quot;Save&amp;quot;-like functionality when changing tabs on the edit assignment page.  When updating due to tab-change, cause a fresh render of the Topics tab.  When updating due to &amp;quot;Save&amp;quot; button, keep functionality as-is.&lt;br /&gt;
*** FILE: ''app/controllers/assignments_controller.rb''&lt;br /&gt;
*** FILE: ''app/views/assignments/edit.html.erb''&lt;br /&gt;
&lt;br /&gt;
* Support the ability to find the correct rubric for a particular topic&lt;br /&gt;
** PROBLEM: The existing methods allow us to find the correct rubric for a particular round, but not a particular topic&lt;br /&gt;
*** SOLUTION: Modify the existing method questionnaire(assignment, type, round_number) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/helpers/assignment_helper.rb''&lt;br /&gt;
*** SOLUTION: Modify the existing method assignment_questionnaire(assignment, type, number) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/helpers/assignment_helper.rb''&lt;br /&gt;
*** SOLUTION: Modify the existing method questionnaire(round = nil) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/models/review_response_map.rb''&lt;br /&gt;
*** SOLUTION: Modify the existing method questionnaire(round) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/models/self_review_response_map.rb''&lt;br /&gt;
*** SOLUTION: Modify the existing method review_questionnaire_id(round = nil) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/models/assignment.rb''&lt;br /&gt;
&lt;br /&gt;
* Use the correct rubric for a particular topic&lt;br /&gt;
** PROBLEM: When finding rubrics to display, save results from, calculate scores from, etc. round may be used but topic is not&lt;br /&gt;
*** SOLUTION: Examine all callers of methods modified in the previous section and pass in ''topic_id'' where appropriate to grab the correct rubric&lt;br /&gt;
*** FILE: (many)&lt;br /&gt;
&lt;br /&gt;
* Support the ability to determine if an assignment has rubrics that vary by topic&lt;br /&gt;
** PROBLEM: There is no handy method to call that can tell us if an assignment has rubrics that vary by topic&lt;br /&gt;
*** SOLUTION: Add a new method ''varying_rubrics_by_topic?'' based on the existing method ''varying_rubrics_by_round?''&lt;br /&gt;
*** FILE: ''app/models/assignment.rb''&lt;br /&gt;
&lt;br /&gt;
=== Q&amp;amp;A ===&lt;br /&gt;
&lt;br /&gt;
Here we paraphrase some questions we received during round 1 of the documentation review.&lt;br /&gt;
&lt;br /&gt;
* Q: How will the new logic for varying rubric by topic tie in with the existing logic?&lt;br /&gt;
** A: We will add a new field ''topic_id'' into the existing table ''assignment_questionnaires'', as noted in the [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Entity_Relationship_Diagram E/R Diagram].  We will update methods that find questionnaires to allow these methods to also accept a ''topic_id'' argument, as noted in [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Implementation Implementation].&lt;br /&gt;
* Q: How will the &amp;quot;Rubric varies by topic&amp;quot; selection be stored?&lt;br /&gt;
** A: Indirectly, by saving records in the ''assignment_questionnaires'' table which either reference a ''topic_id'' or leave this field nil.  For more details please see the [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Entity_Relationship_Diagram E/R Diagram] discussion.&lt;br /&gt;
* Q: What will happen if an instructor selects &amp;quot;Rubric varies by topic&amp;quot;, makes selections on the &amp;quot;Topics&amp;quot; tab, and then deselects &amp;quot;Rubric varies by topic&amp;quot;?&lt;br /&gt;
** A: The Topics tab, when next visited, will no longer show dropdowns for selecting rubrics by topic.  When the assignment is saved, the appropriate not-varying-by-topic records will be saved in the ''assignment_questionnaires'' table.  For more details please see [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Implementation Implementation].&lt;br /&gt;
* Q: What will happen after an instructor selects &amp;quot;Rubric varies by topic&amp;quot;?&lt;br /&gt;
** A: The Topics tab, when next visited, will now show dropdowns for selecting rubrics by topic.  These rubrics will default to those shown on the Rubrics tab.  When the assignment is saved, the appropriate varying-by-topic records will be saved in the ''assignment_questionnaires'' table.  For more details please see [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Implementation Implementation].&lt;br /&gt;
* Q: How will the appropriate list of questionnaires for the new dropdowns on the Topics tab be determined?&lt;br /&gt;
** A: In the same way that the appropriate list of questionnaires for the existing dropdowns on the Rubrics tab is determined.  Namely, by the ''questionnaire_options'' method in the file ''expertiza/app/helpers/assignment_helper.rb''.&lt;br /&gt;
&lt;br /&gt;
=== (Selected) Modified Code ===&lt;br /&gt;
&lt;br /&gt;
In this section, we provide ''selected portions'' of modified code to illustrate how we implemented the new feature.&lt;br /&gt;
&lt;br /&gt;
Allow an instructor to indicate that rubric should vary by topic&lt;br /&gt;
&lt;br /&gt;
''app\views\assignments\edit\_rubrics.html.erb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;lt;input name=&amp;quot;vary_by_topic&amp;quot; type=&amp;quot;hidden&amp;quot; value=&amp;quot;false&amp;quot; /&amp;gt;&lt;br /&gt;
  &amp;lt;%= check_box_tag('vary_by_topic', 'true', @review_vary_by_topic_check) %&amp;gt;&lt;br /&gt;
  &amp;lt;%= label_tag('vary_by_topic', 'Review rubric varies by topic?') %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Allow an instructor to choose different rubrics for different topics&lt;br /&gt;
&lt;br /&gt;
''app\views\sign_up_sheet\_table_line.html.erb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;lt;% if @assignment_form.assignment.varying_rubrics_by_topic? %&amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;table id = &amp;lt;%=table_id %&amp;gt;&amp;gt;&lt;br /&gt;
        &amp;lt;tr&amp;gt;&lt;br /&gt;
          &amp;lt;script&amp;gt;&lt;br /&gt;
              ...&lt;br /&gt;
              &amp;lt;% if @assignment_form.assignment.varying_rubrics_by_round? %&amp;gt;&lt;br /&gt;
                &amp;lt;% for round in 1..@assignment_form.assignment.rounds_of_reviews %&amp;gt;&lt;br /&gt;
                  ...&lt;br /&gt;
                &amp;lt;% end %&amp;gt;&lt;br /&gt;
              &amp;lt;% else %&amp;gt;&lt;br /&gt;
                ...&lt;br /&gt;
              &amp;lt;% end %&amp;gt;&lt;br /&gt;
          &amp;lt;/script&amp;gt;&lt;br /&gt;
        &amp;lt;/tr&amp;gt;&lt;br /&gt;
      &amp;lt;/table&amp;gt;&lt;br /&gt;
    &amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Support the ability of the database to link rubrics to topics&lt;br /&gt;
&lt;br /&gt;
''app\models\sign_up_topic.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  class SignUpTopic &amp;lt; ActiveRecord::Base&lt;br /&gt;
    ...&lt;br /&gt;
    has_many :assignment_questionnaires, class_name: 'AssignmentQuestionnaire', foreign_key: 'topic_id', dependent: :destroy&lt;br /&gt;
    ...&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
React to an instructor saving an assignment after altering the rubrics-vary-by-topic checkbox&lt;br /&gt;
&lt;br /&gt;
''app/controllers/assignments_controller.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def update&lt;br /&gt;
    ...&lt;br /&gt;
    # What to do next depends on how we got here&lt;br /&gt;
    if params['button'].nil?&lt;br /&gt;
      # REFRESH the topics tab after changing tabs&lt;br /&gt;
      ...&lt;br /&gt;
      render :partial =&amp;gt; &amp;quot;assignments/edit/topics&amp;quot;&lt;br /&gt;
    else&lt;br /&gt;
      # SAVE button was used (do a redirect)&lt;br /&gt;
      redirect_to edit_assignment_path @assignment_form.assignment.id&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Support the ability to find the correct rubric for a particular topic&lt;br /&gt;
&lt;br /&gt;
''app/helpers/assignment_helper.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def assignment_questionnaire(assignment, questionnaire_type, round_number = nil, topic_id = nil)&lt;br /&gt;
    q_by_type = assignment.questionnaires.find_by(type: questionnaire_type)&lt;br /&gt;
    if q_by_type.nil?&lt;br /&gt;
      ...&lt;br /&gt;
    else&lt;br /&gt;
      ...&lt;br /&gt;
      aq_by_type = assignment.assignment_questionnaires.find_by(questionnaire_id: q_by_type.id)&lt;br /&gt;
      if round_number.nil? &amp;amp;&amp;amp; topic_id.nil?&lt;br /&gt;
        # Find by type&lt;br /&gt;
        aq = aq_by_type&lt;br /&gt;
      elsif topic_id.nil?&lt;br /&gt;
        # Find by round&lt;br /&gt;
        aq = assignment.assignment_questionnaires.find_by(used_in_round: round_number)&lt;br /&gt;
      elsif round_number.nil?&lt;br /&gt;
        # Find by topic&lt;br /&gt;
        aq = assignment.assignment_questionnaires.find_by(topic_id: topic_id)&lt;br /&gt;
      else&lt;br /&gt;
        # Find by round and topic&lt;br /&gt;
        aq = assignment.assignment_questionnaires.where(used_in_round: round_number, topic_id: topic_id).first&lt;br /&gt;
      end&lt;br /&gt;
      aq.nil? ? aq_by_type : aq&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use the correct rubric for a particular topic&lt;br /&gt;
&lt;br /&gt;
''app\controllers\response_controller.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def set_questionnaire_for_new_response&lt;br /&gt;
    case @map.type&lt;br /&gt;
    when &amp;quot;ReviewResponseMap&amp;quot;, &amp;quot;SelfReviewResponseMap&amp;quot;&lt;br /&gt;
      reviewees_topic = SignedUpTeam.topic_id_by_team_id(@contributor.id)&lt;br /&gt;
      @current_round = @assignment.number_of_current_round(reviewees_topic)&lt;br /&gt;
      @questionnaire = @map.questionnaire(@current_round, reviewees_topic)&lt;br /&gt;
    when&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Support the ability to determine if an assignment has rubrics that vary by topic&lt;br /&gt;
&lt;br /&gt;
''app\models\assignment.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def varying_rubrics_by_topic?&lt;br /&gt;
    aq_no_topic_id = AssignmentQuestionnaire.where(assignment_id: self.id, topic_id: nil).size &amp;gt;= 1&lt;br /&gt;
    aq_with_topic_id = AssignmentQuestionnaire.where(assignment_id: self.id).where.not(topic_id: nil).size &amp;gt;= 1&lt;br /&gt;
    if !aq_no_topic_id &amp;amp;&amp;amp; !aq_with_topic_id&lt;br /&gt;
      return false&lt;br /&gt;
    elsif aq_no_topic_id &amp;amp;&amp;amp; !aq_with_topic_id&lt;br /&gt;
      return false&lt;br /&gt;
    elsif !aq_no_topic_id &amp;amp;&amp;amp; aq_with_topic_id&lt;br /&gt;
      return true&lt;br /&gt;
    else&lt;br /&gt;
      raise StandardError.new(&amp;quot;Assignment with id &amp;quot; + self.id.to_s + &amp;quot; has a conflict about whether or not it varies by topic&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== How To ==&lt;br /&gt;
&lt;br /&gt;
In this section, we describe how to use the newly implemented feature.&lt;br /&gt;
&lt;br /&gt;
=== Add a New Rubric ===&lt;br /&gt;
&lt;br /&gt;
* [to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
=== Select a Rubric for a Topic ===&lt;br /&gt;
&lt;br /&gt;
* [to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
== Project Testing ==&lt;br /&gt;
&lt;br /&gt;
=== Strategy ===&lt;br /&gt;
&lt;br /&gt;
To test code implementation, correctness of the added feature, verify that the team did not break any existing functionalities in the Expertiza, and ensure that no bugs were introduced in the code, we developed the following Test Strategy:&lt;br /&gt;
&lt;br /&gt;
# Code inspection&lt;br /&gt;
# Run and pass existing RSpec Tests&lt;br /&gt;
# Develop New RSpec Tests&lt;br /&gt;
# Run through live UI to test a feature using Expertiza instance&lt;br /&gt;
&lt;br /&gt;
=== Rspec Testing ===&lt;br /&gt;
&lt;br /&gt;
==== Existing Tests ====&lt;br /&gt;
&lt;br /&gt;
Run all existing RSpec tests on any changed files, after our changes, to ensure that we have not introduced any failures.&lt;br /&gt;
The commands and results are shown below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
e@ubuntu:~/Desktop/CSC517_HW04/expertiza$ bundle exec rspec spec/helpers/ spec/controllers/ spec/models/&lt;br /&gt;
[Coveralls] Set up the SimpleCov formatter.&lt;br /&gt;
[Coveralls] Using SimpleCov's 'rails' settings.&lt;br /&gt;
&lt;br /&gt;
Randomized with seed 6978&lt;br /&gt;
[...]&lt;br /&gt;
&lt;br /&gt;
Finished in 8 minutes 10 seconds (files took 12.32 seconds to load)&lt;br /&gt;
900 examples, 0 failures, 16 pending&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The features tests were extremely time-consuming so we did not routinely run them during development.  However TravisCI results on our [https://github.com/expertiza/expertiza/pull/1444 Pull Request] demonstrate the passing status of all tests.&lt;br /&gt;
&lt;br /&gt;
==== New Tests ====&lt;br /&gt;
&lt;br /&gt;
Write comprehensive RSpec tests, for all new or modified methods.&lt;br /&gt;
* FILE: ''spec/helpers/assignment_helper_spec.rb''&lt;br /&gt;
** METHODS TO TEST: &lt;br /&gt;
*** questionnaire(assignment, type, round_number, topic_id)&lt;br /&gt;
*** assignment_questionnaire(assignment, type, number, topic_id)&lt;br /&gt;
* FILE: ''spec/models/review_response_map_spec.rb''&lt;br /&gt;
*** METHODS TO TEST:&lt;br /&gt;
**** questionnaire(round, topic_id)&lt;br /&gt;
* FILE: ''spec/models/self_review_response_map_spec.rb''&lt;br /&gt;
*** METHODS TO TEST:&lt;br /&gt;
**** questionnaire(round, topic_id)&lt;br /&gt;
* FILE: ''spec/models/assignment_spec.rb''&lt;br /&gt;
*** METHODS TO TEST:&lt;br /&gt;
**** review_questionnaire_id(round, topic_id)&lt;br /&gt;
**** varying_rubrics_by_topic?()&lt;br /&gt;
&lt;br /&gt;
Run these tests, to ensure that the new code works as intended.&lt;br /&gt;
The commands and results are shown below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
e@ubuntu:~/Desktop/CSC517_HW04/expertiza$ bundle exec rspec spec/helpers/assignment_helper_spec.rb spec/models/review_response_map_spec.rb spec/models/self_review_response_map_spec.rb spec/models/assignment_spec.rb &lt;br /&gt;
[Coveralls] Set up the SimpleCov formatter.&lt;br /&gt;
[Coveralls] Using SimpleCov's 'rails' settings.&lt;br /&gt;
&lt;br /&gt;
Randomized with seed 47508&lt;br /&gt;
....................................................................................................................&lt;br /&gt;
&lt;br /&gt;
Finished in 1 minute 7.94 seconds (files took 10.85 seconds to load)&lt;br /&gt;
116 examples, 0 failures&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The test suite for a single new method is shown below.&lt;br /&gt;
* There are many such suites added in expertiza/spec  &lt;br /&gt;
* This example illustrates our general strategy:&lt;br /&gt;
** test missing input&lt;br /&gt;
** test bad input&lt;br /&gt;
** test various acceptable forms of input&lt;br /&gt;
** test scenarios that lead to various return values&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  describe &amp;quot;#questionnaire&amp;quot; do&lt;br /&gt;
&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;throws exception if assignment argument nil&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;throws exception if all arguments nil except for assignment&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;finds by type if round number &amp;amp; topic id not given&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;throws exception if round number &amp;amp; topic id not given, no luck finding by type&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;finds by round number alone if round number alone is given&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;creates new questionnaire of given type if round number alone is given, no luck finding by round&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;finds by topic id alone if topic id alone is given&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;creates new questionnaire of given type if topic id alone is given, no luck finding by topic&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;finds by round number and topic id if both are given&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;creates new questionnaire of given type if round and topic are given, no luck finding by round and topic&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== UI Testing ===&lt;br /&gt;
&lt;br /&gt;
Here we describe manual UI Testing that was performed.&lt;br /&gt;
&lt;br /&gt;
==== Rubric does not vary by round or by topic ====&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
==== Rubric varies by round, but not by topic ====&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
==== Rubric varies by topic, but not by round ====&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
==== Rubric varies by both round and topic ====&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
In CSC/ECE 517, there are several types of topics that could be covered in a single class assignment.  However, currently we can only specify one kind of rubric for an assignment. This means that teams working on different topics will be evaluated using the same rubric. With this setup, it's not possible to fine-tune rubrics for different topics - rubrics tend to be overly general.&lt;br /&gt;
&lt;br /&gt;
In this project, we have solved this issue, by allowing rubrics to vary not only by round, but also by topic. This allows more flexibility to the instructor when setting up an assignment, so that they can use rubrics better suited to the tasks that students are performing in an assignment.  The following scenarios will be possible, and the instructor will be the judge of which scenario is the best fit to the assignment:&lt;br /&gt;
&lt;br /&gt;
* Rubric does not vary by round or by topic.&lt;br /&gt;
* Rubric varies by round, but not by topic.&lt;br /&gt;
* Rubric varies by topic, but not by round.&lt;br /&gt;
* Rubric varies by both round and topic.&lt;br /&gt;
&lt;br /&gt;
The instructor may use the Rubrics tab of the assignments edit page to make changes to the &amp;quot;Review rubric varies by round?&amp;quot; and &amp;quot;Review rubric varies by topic?&amp;quot; checkboxes.  The instructor may then use the Topics tab to select the appropriate rubric(s) for every topic in the assignment.&lt;br /&gt;
&lt;br /&gt;
Various other Expertiza code has been updated to retrieve the correct rubric depending on round and topic after the instructor has made these selections.&lt;br /&gt;
&lt;br /&gt;
== Future Work ==&lt;br /&gt;
&lt;br /&gt;
This section discusses possible future work for another CSC 517 team to take on.  Such a team can search the Expertiza codebase for &amp;quot;TODO E1936 (future work)&amp;quot; to find most of the places in the code that the notes below refer to.&lt;br /&gt;
&lt;br /&gt;
* Reduce the delay between changing the state of the &amp;quot;Review rubric varies by topic?&amp;quot; checkbox on the Rubrics tab, and the show / hide of rubric drop-downs on the Topics tab.&lt;br /&gt;
* Redesign UI for tone analysis, heatmaps, and review scores pop-up.  These areas are designed around the assumption that reviews do NOT vary by topic.  For example, in the review scores pop-up, a reviewer can see the reviews they have given, arranged by question, across multiple reviewees.&lt;br /&gt;
* Consider whether the questionnaire options available for selection in drop-downs on the Topics and Rubrics tabs should include ''only'' those questionnaires created by the currently-logged-in instructor.  Our work in this project changed the filtering from instructor-owning-assignment to currently-logged-in instructor - but left in place all non-private questionnaires.  ''Consider'' whether non-private questionnaires should be excluded.  This may result in some drop-downs not having any available questionnaires.&lt;br /&gt;
&lt;br /&gt;
== Useful Links ==&lt;br /&gt;
In this section we provide useful links related to the work that has been completed by our team.&lt;br /&gt;
# [https://github.com/gabalmat/expertiza Forked Project Repository]&lt;br /&gt;
# [https://github.com/expertiza/expertiza/pull/1444 Pull Request]&lt;br /&gt;
# [(add link here) Video Demonstration of Specialized Rubrics]&lt;br /&gt;
# [(add link here) Video Demonstration of Passing Rspec Tests]&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Contacts ===&lt;br /&gt;
We have 4 (four) members in our team and 1 (one) mentor was also assigned to us. For any project-related questions/concerns please contact us:&lt;br /&gt;
* Aurora Tiffany-Davis - attiffan@ncsu.edu&lt;br /&gt;
* Ginger Balmat - gabalmat@ncsu.edu&lt;br /&gt;
* Joe Hutchinson - jehutch3@ncsu.edu&lt;br /&gt;
* Nikolay Titov - ngtitov@ncsu.edu&lt;br /&gt;
* Zhewei Hu (mentor) - zhu6@ncsu.edu&lt;br /&gt;
&lt;br /&gt;
=== Contribution Based Inquiry ===&lt;br /&gt;
For any questions or concerns related to the project design, implementation, testing of the feature developed by our team, please contact an engineer who worked closely on the topic of your interest based on the [https://docs.google.com/spreadsheets/d/11uxuI_5gaC-FQDwIOxtCaN3HZ9bfWDJgIjFemtYV5jE/edit?ts=5ca222f3#gid=0 Contribution Assignment Grid] we created to keep track of our progress and contribution. Please carbon copy all team members and our mentor in the email.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* Expertiza Web [https://github.com/expertiza/expertiza#expertiza]&lt;br /&gt;
* Expertiza on GitHub [https://github.com/expertiza/expertiza]&lt;br /&gt;
* Expertiza Wiki [http://wikis.lib.ncsu.edu/index.php/Expertiza]&lt;br /&gt;
* Rspec Documentation [https://relishapp.com/rspec]&lt;br /&gt;
* Wiki with Previous Work [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1873_Specialized_rubics_for_different_topic_types]&lt;br /&gt;
* Pull Request of the Previous Work [https://github.com/expertiza/expertiza/pull/1327]&lt;/div&gt;</summary>
		<author><name>Ngtitov</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics&amp;diff=124466</id>
		<title>E1936 Specialized Rubrics</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics&amp;diff=124466"/>
		<updated>2019-04-26T15:24:13Z</updated>

		<summary type="html">&lt;p&gt;Ngtitov: /* Class Diagram */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page describes the work and goals that have been completed and achieved while implementing Expertiza Project &amp;quot;''E1936. Specialized Rubrics for Different Topic Types (e.g., Servo project, refactoring project)''&amp;quot; for the CSC/ECE 517 &amp;quot;Object-Oriented Design and Development&amp;quot; class, in the Spring semester of the 2019.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This Wiki page is created per CSC/ECE 517: &amp;quot;Object-Oriented Design and Development&amp;quot;, Expertiza Project requirements (Spring, 2019).&lt;br /&gt;
&lt;br /&gt;
Our [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Team team] was assigned the project &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936. Specialized rubrics for different topic types (e.g., Servo project, refactoring project)]&amp;quot;.  This is an Expertiza project.&lt;br /&gt;
&lt;br /&gt;
In this wiki page we describe the problem to be solved, how we solve that problem, and how we test our solution.  We also provide helpful links and contact information for our team.&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
In this section, we discuss the problem we need to solve, the Expertiza feature this problem is related to, what needs to be done to solve the problem (at a high level), and the previous attempt to solve this problem.&lt;br /&gt;
&lt;br /&gt;
=== Problem Statement ===&lt;br /&gt;
&lt;br /&gt;
This problem statement summarizes the problem as described in the project description &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936. Specialized rubrics for different topic types (e.g., Servo project, refactoring project)]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
In CSC/ECE 517, there are several types of topics that could be covered in a single class assignment.&lt;br /&gt;
* Code base&lt;br /&gt;
** Expertiza&lt;br /&gt;
** Mozilla&lt;br /&gt;
** etc.&lt;br /&gt;
* Goal&lt;br /&gt;
** Refactoring&lt;br /&gt;
** Testing&lt;br /&gt;
** etc.&lt;br /&gt;
However, currently we can only specify one kind of rubric for an assignment.  This means that teams working on different topics will be evaluated using the same rubric.  With this setup, it's not possible to fine-tune rubrics for different topics - rubrics tend to be overly general.&lt;br /&gt;
&lt;br /&gt;
=== Feature Description ===&lt;br /&gt;
&lt;br /&gt;
The Expertiza project already has a feature that allows rubrics to vary by project phase or &amp;quot;round&amp;quot;.  The feature we will add in this project is a feature to allow rubrics to vary not only by round, but also by topic.  This allows more flexibility to the instructor when setting up an assignment, so that they can use rubrics better suited to the tasks that students are performing in an assignment.&lt;br /&gt;
&lt;br /&gt;
When this feature is complete, the following scenarios will be possible, and the instructor will be the judge of which scenario is the best fit to the assignment:&lt;br /&gt;
&lt;br /&gt;
* Rubric does not vary by round or by topic.&lt;br /&gt;
* Rubric varies by round, but not by topic.&lt;br /&gt;
* Rubric varies by topic, but not by round.&lt;br /&gt;
* Rubric varies by both round and topic.&lt;br /&gt;
&lt;br /&gt;
=== What Needs to be Done ===&lt;br /&gt;
&lt;br /&gt;
This section summarizes the work as described in the project description &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936. Specialized rubrics for different topic types (e.g., Servo project, refactoring project)]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* In assignment#edit page &amp;quot;Rubrics&amp;quot; tab, add a checkbox to specify whether rubric should vary by topic.&lt;br /&gt;
* In assignment#edit page &amp;quot;Topics&amp;quot; tab, add dropdown(s) next to each topic to specify which rubric(s) are associated with the topic.&lt;br /&gt;
** The dropdown(s) should appear only if rubric should vary by topic, per the Rubrics tab.&lt;br /&gt;
** The topic should have a multiple dropdowns (one for each round) only if rubrics vary by round, per the Rubrics tab.&lt;br /&gt;
** By default, the rubric(s) for each course project will be the one(s) specified in “Rubrics” tab.&lt;br /&gt;
** The dropdown value can overwrite the default rubric.&lt;br /&gt;
* Be careful when making changes to the code&lt;br /&gt;
** The signup_sheet_controller should have as little to do as possible with the selection of rubrics.&lt;br /&gt;
** Anything not germane to selecting topics should be in another controller or (more probably) a helper.&lt;br /&gt;
* Create a DB migration to allow rubric to vary by topic as well as by round.&lt;br /&gt;
&lt;br /&gt;
==== Screenshots ====&lt;br /&gt;
'''Current screenshot of Rubrics tab for an Assignment'''&lt;br /&gt;
(need to add a checkbox to indicate that rubric should vary by topic)&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Screenshot Assignment Edit Rubrics.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Current screenshot of Topics tab for an Assignment'''&lt;br /&gt;
(need to add a way to select rubrics for particular topics)&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Screenshot Assignment Edit Topics.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Proposed screenshot of Rubrics tab for an Assignment'''&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Specialized Rubric rubric checkbox.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Proposed screenshot of Topics tab for an Assignment'''&lt;br /&gt;
&lt;br /&gt;
(drop down shown for only one topic here, but final product will have one for each topic)&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Specialized Rubric dropdown menu.png]]&lt;br /&gt;
&lt;br /&gt;
== Previous Work ==&lt;br /&gt;
&lt;br /&gt;
There was previous attempt to implement this project in the Fall of 2018 semester by different team, but it was rejected due to several reasons. Our team was provided with all relevant information and materials about the design and implementation of the previously attempted project. We would like to acknowledge that we use previous implementation and design as reference and our starting point for our own implementation. The following is the list of links with the relevant materials that we have used for better project understanding, determining pros and cons of previously proposed changes, and establishing our design strategy and implementation:&lt;br /&gt;
&lt;br /&gt;
# [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1873_Specialized_rubics_for_different_topic_types Wiki]&lt;br /&gt;
# [https://github.com/expertiza/expertiza/pull/1327 Pull Request]&lt;br /&gt;
# [https://drive.google.com/file/d/1UrLb0Ula_Lb_F4MOrdC-s6xng6B08VYu/view Video Demo]&lt;br /&gt;
&lt;br /&gt;
After reviewing all relevant materials above, we concluded that the project implementation was incomplete and proposed design had significant flaw. &lt;br /&gt;
We identified main drawbacks and flaw as follows:&lt;br /&gt;
&lt;br /&gt;
* Establishing incorrect ''many-to-one'' relationship between ''sign_up_topics'' and ''questionnaires'' tables:&lt;br /&gt;
** Creating a DB migration to add ''questionnaire_id'' in the ''sign_up_topics'' table to store the dropdown data presumes ''one-to-one'' or ''many-to-one'' relationship between ''sign_up_topics'' and ''questionnaires'' tables&lt;br /&gt;
** Correct relationship between ''sign_up_topics'' and ''questionnaires'' tables is ''many-to-many''. For example, each project topic may have various rubrics depending on the round it is used (e.g., for round 1, topic may have one rubric; but for round 2, the same topic may have different rubric)&lt;br /&gt;
** Proposed previous migration changes would break DB design and would not allow to store correctly topic and its associated rubric per different round.&lt;br /&gt;
* Per project requirement specifications, &amp;quot;''The dropdown box should appear only if 'Vary rubric by topic' is selected in the Rubrics tab.''&amp;quot; This requirement was not met and ''Vary rubric by topic'' checkbox in the Rubrics tab was not implemented. Therefore, dropdown box with the list of rubrics appears regardless of whether &amp;quot;''Vary rubric by topic''&amp;quot; is selected or not.&lt;br /&gt;
* The dropdown box includes the list of all possible rubrics including default value. However, this condition can be improved. The dropdown box should list the rubrics that were created by the current user (professor who is logged in). This would allow to shorten the list of possible rubrics dramatically and help to avoid any misunderstanding and confusion while user selects desired rubric for the course project.&lt;br /&gt;
&lt;br /&gt;
We found no further issues with the rest implementation and in other project materials. Wiki page is very useful for understanding design of proposed changes, finding drawbacks and the flaw. Considering all the pros and cons, and taking into account drawbacks of the proposed changes, our team evolved different approach that should successfully solve the problem stated for the project without without creating additional issues. Please see our [http://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics#Project_Implementation Project Implementation] for more details.&lt;br /&gt;
&lt;br /&gt;
== Previous Project Requirements ==&lt;br /&gt;
&lt;br /&gt;
The project requirements originally specified how to alter the databases to support varying rubrics by topic.&lt;br /&gt;
&lt;br /&gt;
''Create a new table named topic_questionnaires with field:''&lt;br /&gt;
* ''id''&lt;br /&gt;
* ''topic_id''&lt;br /&gt;
* ''questionnaire_id''&lt;br /&gt;
* ''used_in_round''&lt;br /&gt;
&lt;br /&gt;
However, the E1936 team successfully petitioned for this requirement to change to give us more freedom in the implementation.  The original suggestion had a flaw.  There is already an existing table in the Expertiza project called ''assignment_questionnaires'', which has columns including ''assignment_id'', ''questionnaire_id'', and ''used_in_round''.  It is this table that maintains the knowledge of which rubric is used in which round of an assignment.  If we were to add a new table to maintains the knowledge of which rubric is used in which topic of an assignment as originally suggested, then we would have a big problem.  Knowledge of round-rubric relationship is duplicated.  This would lead (best case scenario) to extra work, and (worst case scenario) to lots of bugs caused by inconsistencies in how these tables are handled with CRUD operations throughout the code.  In other words, this is not a DRY solution.&lt;br /&gt;
&lt;br /&gt;
== Project Implementation ==&lt;br /&gt;
&lt;br /&gt;
In this section, we propose our solution to the problem, discuss implementation techniques and details, and list the goals we achieved.&lt;br /&gt;
&lt;br /&gt;
We start by analyzing Entity Relationship Diagram where we state the solution to the problem. Further we discuss design strategy by breaking project problem into multiple staged sub-problems and provide solutions for each of these sub-problems. We also discuss some implementation details and provide the list of involved files. Finally, we demonstrate how the implemented feature can be used by providing a ''How To'' sub-section.&lt;br /&gt;
&lt;br /&gt;
=== Diagrams ===&lt;br /&gt;
&lt;br /&gt;
Our solution and implementation of the project can be easily shown by discussing Use Case, Entity Relationship, and Class diagrams. First, for simplicity we discuss in general possible sequence of interactions between a user (in this case instructor) and the system (Expertiza) via presenting Use Case Diagram. Then we plan to show proposed database modification via Entity Relationship Diagram.&lt;br /&gt;
&lt;br /&gt;
==== User Case Diagram ====&lt;br /&gt;
&lt;br /&gt;
[[File: use_case_diagram_1936.png]]&lt;br /&gt;
&lt;br /&gt;
The above Use Case Diagram shows general sequence of interactions between an instructor and the system (Expertiza) that defines where and how the feature can be utilized. Note that highlighted use cases are objects of our interest and work. Also please note that all of the shown use cases already exist in the system and we simply adding new feature into the system with existing use cases. Particularly, the rubric for each assignment and newly added ''Review rubric varies by topic'' checkbox with which instructor may choose to vary assignment by topic or not by checking and unchecking the checkbox is displayed in the ''Rubrics'' tab. Hence, we show how instructor can get to the ''Rubrics'' tab of the assignments. Similarly, ''Topics'' tab of assignments has additional ''Questionnaires'' column for each topic, where instructor may specify which rubric associates with the topic. To perform such sequence of iterations and utilize the new feature, instructor must choose ''Edit'' any assignment from the list of all assignments displayed to him/her in the ''Manage Assignments'' boundary, which can be navigated by instructor by selecting it from the header of the page.&lt;br /&gt;
&lt;br /&gt;
==== Entity Relationship Diagram ====&lt;br /&gt;
&lt;br /&gt;
[[File: HW04_ERD.png]]&lt;br /&gt;
&lt;br /&gt;
The sections of the diagram highlighted in yellow show newly introduced items.  That is, we are adding a new column called ''topic_id'' to ''assignment_questionnaires'', in order to link ''assignment_questionnaires'' to ''sign_up_topics''.&lt;br /&gt;
&lt;br /&gt;
Any assignment, topic, or questionnaire may be represented by multiple records within ''assignment_questionnaires'', but each record within ''assignment_questionnaires'' refers to just one assignment, topic, or questionnaire.  It is the ability to have an assignment represented by multiple records, and the new relationship to ''sign_up_topics'', that allows us to support all of the required scenarios:&lt;br /&gt;
&lt;br /&gt;
* Rubric does not vary by round or by topic.&lt;br /&gt;
* Rubric varies by round, but not by topic.&lt;br /&gt;
* Rubric varies by topic, but not by round.&lt;br /&gt;
* Rubric varies by both round and topic.&lt;br /&gt;
&lt;br /&gt;
[[File: HW04_table.PNG]]&lt;br /&gt;
&lt;br /&gt;
This table illustrates the possibilities that the system may have.&lt;br /&gt;
&lt;br /&gt;
* Assignment 1 does not vary by round or by topic.&lt;br /&gt;
* Assignment 2 varies by round, but not by topic.&lt;br /&gt;
* Assignment 3 varies by topic, but not by round.&lt;br /&gt;
* Assignment 4 varies by both round and topic.&lt;br /&gt;
&lt;br /&gt;
This change is done via database migration by running the following commands:&lt;br /&gt;
&lt;br /&gt;
  rails generate migration AddTopicIdToAssignmentQuestionnaires&lt;br /&gt;
&lt;br /&gt;
Above command adds the ''topic_id'' column to the ''AssignmentQuestionnaires'' table and generates new migration file:&lt;br /&gt;
&lt;br /&gt;
[[File: db_migration.png]]&lt;br /&gt;
&lt;br /&gt;
To see the details of the entire database change please check this [https://github.com/gabalmat/expertiza/commit/d46dd57d35a21ab43efb82c28d3f14b75c695f2e commit].&lt;br /&gt;
&lt;br /&gt;
==== Class Diagram ====&lt;br /&gt;
&lt;br /&gt;
[[File: class_diagram_1936.png]]&lt;br /&gt;
&lt;br /&gt;
The above UML Class diagram describes the changes our team made in the Ruby classes, methods and attributes. Please note that all provided classes already existed in the system, and we only added new relationships, modified existing methods and utilized given attributes. All of the class's attributes and methods that are shown in the diagram were used in our code implementation to complete the feature of specialized rubrics. Some of the methods and attributes provided within classes in the diagram are newly introduced. Moreover, there is only one newly added aggregation relationship between the ''SingUpTopic'' class and ''AssignmentQuestionnaire'' class. Furthermore, controllers and models for the certain classes were combined into a single class for simplicity to describe the design. In reality, half of the methods shown for the ''Assignment'' class are implemented in the ''app/controllers/assignments_controller.rb'' file and other half is in the ''app/models/assignment.rb'' file. We decided to combine all of the functionalities of each ''relevant'' controllers and models class into single class for the ease of design presentation. We used Sequence diagram below to illustrate how MVC architectural pattern is used for these classes.&lt;br /&gt;
&lt;br /&gt;
=== Design Strategy ===&lt;br /&gt;
&lt;br /&gt;
As we have concrete understanding of the problem and proposed solution, we would like break this problem into multiple more manageable sub-problems with specific tasks and well-defined solutions to these tasks. Generally, each sub-problem requires modification of one or more files. We would like to propose our Design Strategy as follows:&lt;br /&gt;
&lt;br /&gt;
==== Preparation ====&lt;br /&gt;
&lt;br /&gt;
* Clean up code that our implementation will use&lt;br /&gt;
** PROBLEM: We need to add/change content to the edit assignment Topics tab, but unlike other tabs in the views, it does not have its own partial view to work with&lt;br /&gt;
*** SOLUTION: Refactor and move the code dealing with topics into separate ''app/views/assignments/edit/_topics.html.erb'' file&lt;br /&gt;
*** File: ''app/views/assignments/edit.html.erb''&lt;br /&gt;
** PROBLEM: In a section below, we discuss the need to modify existing methods to also accept an optional argument ''topic_id''.  In many cases these existing method use confusing variable names or lack sufficient comments.&lt;br /&gt;
*** SOLUTION: Clean up methods that we plan to modify&lt;br /&gt;
*** FILE: (many)&lt;br /&gt;
&lt;br /&gt;
==== Implementation ====&lt;br /&gt;
&lt;br /&gt;
* Allow an instructor to indicate that rubric should vary by topic&lt;br /&gt;
** PROBLEM: There is no way for an instructor to indicate that an assignments' rubric should vary by topic&lt;br /&gt;
*** SOLUTION: Add a new checkbox in the edit assignment Rubrics tab to indicate this preference&lt;br /&gt;
*** FILE: ''app/views/assignments/edit/_rubrics.html.erb''&lt;br /&gt;
** PROBLEM: If the user changes the &amp;quot;Review rubric varies by round?&amp;quot; or &amp;quot;Review rubric varies by topic?&amp;quot; checkbox on the Rubrics tab, but leaves the page in an inappropriate state before leaving the tab (e.g. rubric weights that do not add up to 0% or 100%), then the user does not get feedback that they made a mistake.  They only get such feedback when explicitly performing a &amp;quot;Save&amp;quot;.  Switching from tab to tab on the assignments edit page attempts to perform an implicit save, but there is no mechanism to update the flash messages onscreen if anything goes wrong.  This becomes more problematic now that the Topics tab appearance depends on choices made on the Rubrics tab.  &lt;br /&gt;
*** SOLUTION: Provide a route to an assignments controller method that can return a render of the flash messages.  Add an AJAX call on the assignments edit view that can update the flash messages onscreen.&lt;br /&gt;
*** FILE: app/controllers/assignments_controller.rb&lt;br /&gt;
*** FILE: app/views/assignments/edit.html.erb&lt;br /&gt;
&lt;br /&gt;
* Allow an instructor to choose different rubrics for different topics&lt;br /&gt;
** PROBLEM: There is no way for an instructor to choose different rubrics for different topics&lt;br /&gt;
*** SOLUTION: Add a new column in the edit assignment Topics tab for choosing rubric(s)&lt;br /&gt;
**** New column only visible if rubrics vary by topic, per Rubrics tab&lt;br /&gt;
**** New column has multiple rounds per topic only if rubrics vary by round, per Rubrics tab&lt;br /&gt;
**** Default value for any rubric is that rubric which is shown on Rubrics tab&lt;br /&gt;
**** Rubric(s) in the dropdown list is/are only those that were created by the currently logged in instructor&lt;br /&gt;
*** FILE: ''app/views/assignments/edit/_topics.html.erb''&lt;br /&gt;
** PROBLEM: The code in ''app/views/assignments/edit/_rubrics.html.erb'' includes dropdowns like the ones we need to add for topics, but that code is way too complex for its functionality (too heavy for a view, uses JavaScript)&lt;br /&gt;
*** SOLUTION: Use the code in ''app/views/assignments/edit/_rubrics.html.erb'' for inspiration only&lt;br /&gt;
**** Refactor and move as much actual work as possible out into helper methods that are simply called from this view&lt;br /&gt;
**** Views are not intended to do heavy lifting&lt;br /&gt;
**** Use as little JavaScript as possible, since this is a Ruby On Rails project, not a JS project&lt;br /&gt;
*** FILE: ''app/views/assignments/edit/_topics.html.erb''&lt;br /&gt;
** PROBLEM: The drop-downs for selecting rubrics should show only those rubrics created by the currently-logged in instructor (per project mentor).  They currently include those created by the instructor of the relevant assignment.&lt;br /&gt;
*** SOLUTION: Change the filtering in the ''questionnaire_options'' method to reflect the desired filtering.&lt;br /&gt;
*** FILE: app/helpers/assignment_helper.rb&lt;br /&gt;
&lt;br /&gt;
* Support the ability of the database to link rubrics to topics&lt;br /&gt;
** PROBLEM: There is no relationship in the database that can link together rubrics with topics&lt;br /&gt;
*** SOLUTION: Add a new migration that adds topic_id field to existing assignment_questionnaires table&lt;br /&gt;
**** This new field will reference the id field in the sign_up_topics table&lt;br /&gt;
*** FILE: ''db/migrate/[timestamp]_add_topic_id_to_assignment_questionnaires_table.rb''&lt;br /&gt;
** PROBLEM: The AssignmentQuestionnaire model does not have any knowledge of topics&lt;br /&gt;
*** SOLUTION: Add a new belongs_to reference in the model, to sign_up_topic&lt;br /&gt;
*** FILE: ''app/models/assignment_questionnaire.rb''&lt;br /&gt;
** PROBLEM: The SignUpTopic model does not have any knowledge of assignment_questionnaire records&lt;br /&gt;
*** SOLUTION: Add a new has_many reference in the model, to assignment_questionnaires&lt;br /&gt;
*** FILE: ''app/models/sign_up_topic.rb''&lt;br /&gt;
&lt;br /&gt;
* React to an instructor saving an assignment after altering the rubrics-vary-by-topic checkbox&lt;br /&gt;
** PROBLEM: There is nothing in place to remember when an instructor chooses to vary rubrics by topic, or chooses to not vary rubrics by topic&lt;br /&gt;
*** SOLUTION: Modify existing method ''update_assignment_questionnaires()''.  This method executes upon assignment save (explicit or via tab-change).  This method deletes all ''AssignmentQuestionnaire'' records before creating new correct records reflecting the user's selections in the edit assignment form.  Modify such that this method can create multiple records reflecting multiple topics, in the case where rubric should vary by topic.  With this modification, the correct records (with default rubrics) are present when the user goes to the Topics tab, so that the Topics tab can display properly.&lt;br /&gt;
*** FILE: app\models\assignment_form.rb&lt;br /&gt;
** PROBLEM: There is no way to refresh the Topics tab to show / hide drop-downs after the instructor changes checkbox on Rubrics tab&lt;br /&gt;
*** SOLUTION: Make use of existing &amp;quot;Save&amp;quot;-like functionality when changing tabs on the edit assignment page.  When updating due to tab-change, cause a fresh render of the Topics tab.  When updating due to &amp;quot;Save&amp;quot; button, keep functionality as-is.&lt;br /&gt;
*** FILE: ''app/controllers/assignments_controller.rb''&lt;br /&gt;
*** FILE: ''app/views/assignments/edit.html.erb''&lt;br /&gt;
&lt;br /&gt;
* Support the ability to find the correct rubric for a particular topic&lt;br /&gt;
** PROBLEM: The existing methods allow us to find the correct rubric for a particular round, but not a particular topic&lt;br /&gt;
*** SOLUTION: Modify the existing method questionnaire(assignment, type, round_number) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/helpers/assignment_helper.rb''&lt;br /&gt;
*** SOLUTION: Modify the existing method assignment_questionnaire(assignment, type, number) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/helpers/assignment_helper.rb''&lt;br /&gt;
*** SOLUTION: Modify the existing method questionnaire(round = nil) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/models/review_response_map.rb''&lt;br /&gt;
*** SOLUTION: Modify the existing method questionnaire(round) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/models/self_review_response_map.rb''&lt;br /&gt;
*** SOLUTION: Modify the existing method review_questionnaire_id(round = nil) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/models/assignment.rb''&lt;br /&gt;
&lt;br /&gt;
* Use the correct rubric for a particular topic&lt;br /&gt;
** PROBLEM: When finding rubrics to display, save results from, calculate scores from, etc. round may be used but topic is not&lt;br /&gt;
*** SOLUTION: Examine all callers of methods modified in the previous section and pass in ''topic_id'' where appropriate to grab the correct rubric&lt;br /&gt;
*** FILE: (many)&lt;br /&gt;
&lt;br /&gt;
* Support the ability to determine if an assignment has rubrics that vary by topic&lt;br /&gt;
** PROBLEM: There is no handy method to call that can tell us if an assignment has rubrics that vary by topic&lt;br /&gt;
*** SOLUTION: Add a new method ''varying_rubrics_by_topic?'' based on the existing method ''varying_rubrics_by_round?''&lt;br /&gt;
*** FILE: ''app/models/assignment.rb''&lt;br /&gt;
&lt;br /&gt;
=== Q&amp;amp;A ===&lt;br /&gt;
&lt;br /&gt;
Here we paraphrase some questions we received during round 1 of the documentation review.&lt;br /&gt;
&lt;br /&gt;
* Q: How will the new logic for varying rubric by topic tie in with the existing logic?&lt;br /&gt;
** A: We will add a new field ''topic_id'' into the existing table ''assignment_questionnaires'', as noted in the [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Entity_Relationship_Diagram E/R Diagram].  We will update methods that find questionnaires to allow these methods to also accept a ''topic_id'' argument, as noted in [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Implementation Implementation].&lt;br /&gt;
* Q: How will the &amp;quot;Rubric varies by topic&amp;quot; selection be stored?&lt;br /&gt;
** A: Indirectly, by saving records in the ''assignment_questionnaires'' table which either reference a ''topic_id'' or leave this field nil.  For more details please see the [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Entity_Relationship_Diagram E/R Diagram] discussion.&lt;br /&gt;
* Q: What will happen if an instructor selects &amp;quot;Rubric varies by topic&amp;quot;, makes selections on the &amp;quot;Topics&amp;quot; tab, and then deselects &amp;quot;Rubric varies by topic&amp;quot;?&lt;br /&gt;
** A: The Topics tab, when next visited, will no longer show dropdowns for selecting rubrics by topic.  When the assignment is saved, the appropriate not-varying-by-topic records will be saved in the ''assignment_questionnaires'' table.  For more details please see [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Implementation Implementation].&lt;br /&gt;
* Q: What will happen after an instructor selects &amp;quot;Rubric varies by topic&amp;quot;?&lt;br /&gt;
** A: The Topics tab, when next visited, will now show dropdowns for selecting rubrics by topic.  These rubrics will default to those shown on the Rubrics tab.  When the assignment is saved, the appropriate varying-by-topic records will be saved in the ''assignment_questionnaires'' table.  For more details please see [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Implementation Implementation].&lt;br /&gt;
* Q: How will the appropriate list of questionnaires for the new dropdowns on the Topics tab be determined?&lt;br /&gt;
** A: In the same way that the appropriate list of questionnaires for the existing dropdowns on the Rubrics tab is determined.  Namely, by the ''questionnaire_options'' method in the file ''expertiza/app/helpers/assignment_helper.rb''.&lt;br /&gt;
&lt;br /&gt;
=== (Selected) Modified Code ===&lt;br /&gt;
&lt;br /&gt;
In this section, we provide ''selected portions'' of modified code to illustrate how we implemented the new feature.&lt;br /&gt;
&lt;br /&gt;
Allow an instructor to indicate that rubric should vary by topic&lt;br /&gt;
&lt;br /&gt;
''app\views\assignments\edit\_rubrics.html.erb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;lt;input name=&amp;quot;vary_by_topic&amp;quot; type=&amp;quot;hidden&amp;quot; value=&amp;quot;false&amp;quot; /&amp;gt;&lt;br /&gt;
  &amp;lt;%= check_box_tag('vary_by_topic', 'true', @review_vary_by_topic_check) %&amp;gt;&lt;br /&gt;
  &amp;lt;%= label_tag('vary_by_topic', 'Review rubric varies by topic?') %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Allow an instructor to choose different rubrics for different topics&lt;br /&gt;
&lt;br /&gt;
''app\views\sign_up_sheet\_table_line.html.erb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;lt;% if @assignment_form.assignment.varying_rubrics_by_topic? %&amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;table id = &amp;lt;%=table_id %&amp;gt;&amp;gt;&lt;br /&gt;
        &amp;lt;tr&amp;gt;&lt;br /&gt;
          &amp;lt;script&amp;gt;&lt;br /&gt;
              ...&lt;br /&gt;
              &amp;lt;% if @assignment_form.assignment.varying_rubrics_by_round? %&amp;gt;&lt;br /&gt;
                &amp;lt;% for round in 1..@assignment_form.assignment.rounds_of_reviews %&amp;gt;&lt;br /&gt;
                  ...&lt;br /&gt;
                &amp;lt;% end %&amp;gt;&lt;br /&gt;
              &amp;lt;% else %&amp;gt;&lt;br /&gt;
                ...&lt;br /&gt;
              &amp;lt;% end %&amp;gt;&lt;br /&gt;
          &amp;lt;/script&amp;gt;&lt;br /&gt;
        &amp;lt;/tr&amp;gt;&lt;br /&gt;
      &amp;lt;/table&amp;gt;&lt;br /&gt;
    &amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Support the ability of the database to link rubrics to topics&lt;br /&gt;
&lt;br /&gt;
''app\models\sign_up_topic.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  class SignUpTopic &amp;lt; ActiveRecord::Base&lt;br /&gt;
    ...&lt;br /&gt;
    has_many :assignment_questionnaires, class_name: 'AssignmentQuestionnaire', foreign_key: 'topic_id', dependent: :destroy&lt;br /&gt;
    ...&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
React to an instructor saving an assignment after altering the rubrics-vary-by-topic checkbox&lt;br /&gt;
&lt;br /&gt;
''app/controllers/assignments_controller.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def update&lt;br /&gt;
    ...&lt;br /&gt;
    # What to do next depends on how we got here&lt;br /&gt;
    if params['button'].nil?&lt;br /&gt;
      # REFRESH the topics tab after changing tabs&lt;br /&gt;
      ...&lt;br /&gt;
      render :partial =&amp;gt; &amp;quot;assignments/edit/topics&amp;quot;&lt;br /&gt;
    else&lt;br /&gt;
      # SAVE button was used (do a redirect)&lt;br /&gt;
      redirect_to edit_assignment_path @assignment_form.assignment.id&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Support the ability to find the correct rubric for a particular topic&lt;br /&gt;
&lt;br /&gt;
''app/helpers/assignment_helper.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def assignment_questionnaire(assignment, questionnaire_type, round_number = nil, topic_id = nil)&lt;br /&gt;
    q_by_type = assignment.questionnaires.find_by(type: questionnaire_type)&lt;br /&gt;
    if q_by_type.nil?&lt;br /&gt;
      ...&lt;br /&gt;
    else&lt;br /&gt;
      ...&lt;br /&gt;
      aq_by_type = assignment.assignment_questionnaires.find_by(questionnaire_id: q_by_type.id)&lt;br /&gt;
      if round_number.nil? &amp;amp;&amp;amp; topic_id.nil?&lt;br /&gt;
        # Find by type&lt;br /&gt;
        aq = aq_by_type&lt;br /&gt;
      elsif topic_id.nil?&lt;br /&gt;
        # Find by round&lt;br /&gt;
        aq = assignment.assignment_questionnaires.find_by(used_in_round: round_number)&lt;br /&gt;
      elsif round_number.nil?&lt;br /&gt;
        # Find by topic&lt;br /&gt;
        aq = assignment.assignment_questionnaires.find_by(topic_id: topic_id)&lt;br /&gt;
      else&lt;br /&gt;
        # Find by round and topic&lt;br /&gt;
        aq = assignment.assignment_questionnaires.where(used_in_round: round_number, topic_id: topic_id).first&lt;br /&gt;
      end&lt;br /&gt;
      aq.nil? ? aq_by_type : aq&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use the correct rubric for a particular topic&lt;br /&gt;
&lt;br /&gt;
''app\controllers\response_controller.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def set_questionnaire_for_new_response&lt;br /&gt;
    case @map.type&lt;br /&gt;
    when &amp;quot;ReviewResponseMap&amp;quot;, &amp;quot;SelfReviewResponseMap&amp;quot;&lt;br /&gt;
      reviewees_topic = SignedUpTeam.topic_id_by_team_id(@contributor.id)&lt;br /&gt;
      @current_round = @assignment.number_of_current_round(reviewees_topic)&lt;br /&gt;
      @questionnaire = @map.questionnaire(@current_round, reviewees_topic)&lt;br /&gt;
    when&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Support the ability to determine if an assignment has rubrics that vary by topic&lt;br /&gt;
&lt;br /&gt;
''app\models\assignment.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def varying_rubrics_by_topic?&lt;br /&gt;
    aq_no_topic_id = AssignmentQuestionnaire.where(assignment_id: self.id, topic_id: nil).size &amp;gt;= 1&lt;br /&gt;
    aq_with_topic_id = AssignmentQuestionnaire.where(assignment_id: self.id).where.not(topic_id: nil).size &amp;gt;= 1&lt;br /&gt;
    if !aq_no_topic_id &amp;amp;&amp;amp; !aq_with_topic_id&lt;br /&gt;
      return false&lt;br /&gt;
    elsif aq_no_topic_id &amp;amp;&amp;amp; !aq_with_topic_id&lt;br /&gt;
      return false&lt;br /&gt;
    elsif !aq_no_topic_id &amp;amp;&amp;amp; aq_with_topic_id&lt;br /&gt;
      return true&lt;br /&gt;
    else&lt;br /&gt;
      raise StandardError.new(&amp;quot;Assignment with id &amp;quot; + self.id.to_s + &amp;quot; has a conflict about whether or not it varies by topic&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== How To ==&lt;br /&gt;
&lt;br /&gt;
In this section, we describe how to use the newly implemented feature.&lt;br /&gt;
&lt;br /&gt;
=== Add a New Rubric ===&lt;br /&gt;
&lt;br /&gt;
* [to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
=== Select a Rubric for a Topic ===&lt;br /&gt;
&lt;br /&gt;
* [to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
== Project Testing ==&lt;br /&gt;
&lt;br /&gt;
=== Strategy ===&lt;br /&gt;
&lt;br /&gt;
To test code implementation, correctness of the added feature, verify that the team did not break any existing functionalities in the Expertiza, and ensure that no bugs were introduced in the code, we developed the following Test Strategy:&lt;br /&gt;
&lt;br /&gt;
# Code inspection&lt;br /&gt;
# Run and pass existing RSpec Tests&lt;br /&gt;
# Develop New RSpec Tests&lt;br /&gt;
# Run through live UI to test a feature using Expertiza instance&lt;br /&gt;
&lt;br /&gt;
=== Rspec Testing ===&lt;br /&gt;
&lt;br /&gt;
==== Existing Tests ====&lt;br /&gt;
&lt;br /&gt;
Run all existing RSpec tests on any changed files, after our changes, to ensure that we have not introduced any failures.&lt;br /&gt;
The commands and results are shown below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
e@ubuntu:~/Desktop/CSC517_HW04/expertiza$ bundle exec rspec spec/helpers/ spec/controllers/ spec/models/&lt;br /&gt;
[Coveralls] Set up the SimpleCov formatter.&lt;br /&gt;
[Coveralls] Using SimpleCov's 'rails' settings.&lt;br /&gt;
&lt;br /&gt;
Randomized with seed 6978&lt;br /&gt;
[...]&lt;br /&gt;
&lt;br /&gt;
Finished in 8 minutes 10 seconds (files took 12.32 seconds to load)&lt;br /&gt;
900 examples, 0 failures, 16 pending&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The features tests were extremely time-consuming so we did not routinely run them during development.  However TravisCI results on our [https://github.com/expertiza/expertiza/pull/1444 Pull Request] demonstrate the passing status of all tests.&lt;br /&gt;
&lt;br /&gt;
==== New Tests ====&lt;br /&gt;
&lt;br /&gt;
Write comprehensive RSpec tests, for all new or modified methods.&lt;br /&gt;
* FILE: ''spec/helpers/assignment_helper_spec.rb''&lt;br /&gt;
** METHODS TO TEST: &lt;br /&gt;
*** questionnaire(assignment, type, round_number, topic_id)&lt;br /&gt;
*** assignment_questionnaire(assignment, type, number, topic_id)&lt;br /&gt;
* FILE: ''spec/models/review_response_map_spec.rb''&lt;br /&gt;
*** METHODS TO TEST:&lt;br /&gt;
**** questionnaire(round, topic_id)&lt;br /&gt;
* FILE: ''spec/models/self_review_response_map_spec.rb''&lt;br /&gt;
*** METHODS TO TEST:&lt;br /&gt;
**** questionnaire(round, topic_id)&lt;br /&gt;
* FILE: ''spec/models/assignment_spec.rb''&lt;br /&gt;
*** METHODS TO TEST:&lt;br /&gt;
**** review_questionnaire_id(round, topic_id)&lt;br /&gt;
**** varying_rubrics_by_topic?()&lt;br /&gt;
&lt;br /&gt;
Run these tests, to ensure that the new code works as intended.&lt;br /&gt;
The commands and results are shown below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
e@ubuntu:~/Desktop/CSC517_HW04/expertiza$ bundle exec rspec spec/helpers/assignment_helper_spec.rb spec/models/review_response_map_spec.rb spec/models/self_review_response_map_spec.rb spec/models/assignment_spec.rb &lt;br /&gt;
[Coveralls] Set up the SimpleCov formatter.&lt;br /&gt;
[Coveralls] Using SimpleCov's 'rails' settings.&lt;br /&gt;
&lt;br /&gt;
Randomized with seed 47508&lt;br /&gt;
....................................................................................................................&lt;br /&gt;
&lt;br /&gt;
Finished in 1 minute 7.94 seconds (files took 10.85 seconds to load)&lt;br /&gt;
116 examples, 0 failures&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The test suite for a single new method is shown below.&lt;br /&gt;
* There are many such suites added in expertiza/spec  &lt;br /&gt;
* This example illustrates our general strategy:&lt;br /&gt;
** test missing input&lt;br /&gt;
** test bad input&lt;br /&gt;
** test various acceptable forms of input&lt;br /&gt;
** test scenarios that lead to various return values&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  describe &amp;quot;#questionnaire&amp;quot; do&lt;br /&gt;
&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;throws exception if assignment argument nil&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;throws exception if all arguments nil except for assignment&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;finds by type if round number &amp;amp; topic id not given&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;throws exception if round number &amp;amp; topic id not given, no luck finding by type&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;finds by round number alone if round number alone is given&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;creates new questionnaire of given type if round number alone is given, no luck finding by round&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;finds by topic id alone if topic id alone is given&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;creates new questionnaire of given type if topic id alone is given, no luck finding by topic&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;finds by round number and topic id if both are given&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;creates new questionnaire of given type if round and topic are given, no luck finding by round and topic&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== UI Testing ===&lt;br /&gt;
&lt;br /&gt;
Here we describe manual UI Testing that was performed.&lt;br /&gt;
&lt;br /&gt;
==== Rubric does not vary by round or by topic ====&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
==== Rubric varies by round, but not by topic ====&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
==== Rubric varies by topic, but not by round ====&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
==== Rubric varies by both round and topic ====&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
In CSC/ECE 517, there are several types of topics that could be covered in a single class assignment.  However, currently we can only specify one kind of rubric for an assignment. This means that teams working on different topics will be evaluated using the same rubric. With this setup, it's not possible to fine-tune rubrics for different topics - rubrics tend to be overly general.&lt;br /&gt;
&lt;br /&gt;
In this project, we have solved this issue, by allowing rubrics to vary not only by round, but also by topic. This allows more flexibility to the instructor when setting up an assignment, so that they can use rubrics better suited to the tasks that students are performing in an assignment.  The following scenarios will be possible, and the instructor will be the judge of which scenario is the best fit to the assignment:&lt;br /&gt;
&lt;br /&gt;
* Rubric does not vary by round or by topic.&lt;br /&gt;
* Rubric varies by round, but not by topic.&lt;br /&gt;
* Rubric varies by topic, but not by round.&lt;br /&gt;
* Rubric varies by both round and topic.&lt;br /&gt;
&lt;br /&gt;
The instructor may use the Rubrics tab of the assignments edit page to make changes to the &amp;quot;Review rubric varies by round?&amp;quot; and &amp;quot;Review rubric varies by topic?&amp;quot; checkboxes.  The instructor may then use the Topics tab to select the appropriate rubric(s) for every topic in the assignment.&lt;br /&gt;
&lt;br /&gt;
Various other Expertiza code has been updated to retrieve the correct rubric depending on round and topic after the instructor has made these selections.&lt;br /&gt;
&lt;br /&gt;
== Future Work ==&lt;br /&gt;
&lt;br /&gt;
This section discusses possible future work for another CSC 517 team to take on.  Such a team can search the Expertiza codebase for &amp;quot;TODO E1936 (future work)&amp;quot; to find most of the places in the code that the notes below refer to.&lt;br /&gt;
&lt;br /&gt;
* Reduce the delay between changing the state of the &amp;quot;Review rubric varies by topic?&amp;quot; checkbox on the Rubrics tab, and the show / hide of rubric drop-downs on the Topics tab.&lt;br /&gt;
* Redesign UI for tone analysis, heatmaps, and review scores pop-up.  These areas are designed around the assumption that reviews do NOT vary by topic.  For example, in the review scores pop-up, a reviewer can see the reviews they have given, arranged by question, across multiple reviewees.&lt;br /&gt;
* Consider whether the questionnaire options available for selection in drop-downs on the Topics and Rubrics tabs should include ''only'' those questionnaires created by the currently-logged-in instructor.  Our work in this project changed the filtering from instructor-owning-assignment to currently-logged-in instructor - but left in place all non-private questionnaires.  ''Consider'' whether non-private questionnaires should be excluded.  This may result in some drop-downs not having any available questionnaires.&lt;br /&gt;
&lt;br /&gt;
== Useful Links ==&lt;br /&gt;
In this section we provide useful links related to the work that has been completed by our team.&lt;br /&gt;
# [https://github.com/gabalmat/expertiza Forked Project Repository]&lt;br /&gt;
# [https://github.com/expertiza/expertiza/pull/1444 Pull Request]&lt;br /&gt;
# [(add link here) Video Demonstration of Specialized Rubrics]&lt;br /&gt;
# [(add link here) Video Demonstration of Passing Rspec Tests]&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Contacts ===&lt;br /&gt;
We have 4 (four) members in our team and 1 (one) mentor was also assigned to us. For any project-related questions/concerns please contact us:&lt;br /&gt;
* Aurora Tiffany-Davis - attiffan@ncsu.edu&lt;br /&gt;
* Ginger Balmat - gabalmat@ncsu.edu&lt;br /&gt;
* Joe Hutchinson - jehutch3@ncsu.edu&lt;br /&gt;
* Nikolay Titov - ngtitov@ncsu.edu&lt;br /&gt;
* Zhewei Hu (mentor) - zhu6@ncsu.edu&lt;br /&gt;
&lt;br /&gt;
=== Contribution Based Inquiry ===&lt;br /&gt;
For any questions or concerns related to the project design, implementation, testing of the feature developed by our team, please contact an engineer who worked closely on the topic of your interest based on the [https://docs.google.com/spreadsheets/d/11uxuI_5gaC-FQDwIOxtCaN3HZ9bfWDJgIjFemtYV5jE/edit?ts=5ca222f3#gid=0 Contribution Assignment Grid] we created to keep track of our progress and contribution. Please carbon copy all team members and our mentor in the email.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* Expertiza Web [https://github.com/expertiza/expertiza#expertiza]&lt;br /&gt;
* Expertiza on GitHub [https://github.com/expertiza/expertiza]&lt;br /&gt;
* Expertiza Wiki [http://wikis.lib.ncsu.edu/index.php/Expertiza]&lt;br /&gt;
* Rspec Documentation [https://relishapp.com/rspec]&lt;br /&gt;
* Wiki with Previous Work [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1873_Specialized_rubics_for_different_topic_types]&lt;br /&gt;
* Pull Request of the Previous Work [https://github.com/expertiza/expertiza/pull/1327]&lt;/div&gt;</summary>
		<author><name>Ngtitov</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Class_diagram_1936.png&amp;diff=124456</id>
		<title>File:Class diagram 1936.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Class_diagram_1936.png&amp;diff=124456"/>
		<updated>2019-04-26T14:59:22Z</updated>

		<summary type="html">&lt;p&gt;Ngtitov: uploaded a new version of &amp;amp;quot;File:Class diagram 1936.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Ngtitov</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Use_case_diagram_1936.png&amp;diff=124454</id>
		<title>File:Use case diagram 1936.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Use_case_diagram_1936.png&amp;diff=124454"/>
		<updated>2019-04-26T14:49:19Z</updated>

		<summary type="html">&lt;p&gt;Ngtitov: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Ngtitov</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics&amp;diff=124453</id>
		<title>E1936 Specialized Rubrics</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics&amp;diff=124453"/>
		<updated>2019-04-26T14:47:17Z</updated>

		<summary type="html">&lt;p&gt;Ngtitov: /* User Case Diagram */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page describes the work and goals that have been completed and achieved while implementing Expertiza Project &amp;quot;''E1936. Specialized Rubrics for Different Topic Types (e.g., Servo project, refactoring project)''&amp;quot; for the CSC/ECE 517 &amp;quot;Object-Oriented Design and Development&amp;quot; class, in the Spring semester of the 2019.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This Wiki page is created per CSC/ECE 517: &amp;quot;Object-Oriented Design and Development&amp;quot;, Expertiza Project requirements (Spring, 2019).&lt;br /&gt;
&lt;br /&gt;
Our [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Team team] was assigned the project &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936. Specialized rubrics for different topic types (e.g., Servo project, refactoring project)]&amp;quot;.  This is an Expertiza project.&lt;br /&gt;
&lt;br /&gt;
In this wiki page we describe the problem to be solved, how we solve that problem, and how we test our solution.  We also provide helpful links and contact information for our team.&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
In this section, we discuss the problem we need to solve, the Expertiza feature this problem is related to, what needs to be done to solve the problem (at a high level), and the previous attempt to solve this problem.&lt;br /&gt;
&lt;br /&gt;
=== Problem Statement ===&lt;br /&gt;
&lt;br /&gt;
This problem statement summarizes the problem as described in the project description &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936. Specialized rubrics for different topic types (e.g., Servo project, refactoring project)]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
In CSC/ECE 517, there are several types of topics that could be covered in a single class assignment.&lt;br /&gt;
* Code base&lt;br /&gt;
** Expertiza&lt;br /&gt;
** Mozilla&lt;br /&gt;
** etc.&lt;br /&gt;
* Goal&lt;br /&gt;
** Refactoring&lt;br /&gt;
** Testing&lt;br /&gt;
** etc.&lt;br /&gt;
However, currently we can only specify one kind of rubric for an assignment.  This means that teams working on different topics will be evaluated using the same rubric.  With this setup, it's not possible to fine-tune rubrics for different topics - rubrics tend to be overly general.&lt;br /&gt;
&lt;br /&gt;
=== Feature Description ===&lt;br /&gt;
&lt;br /&gt;
The Expertiza project already has a feature that allows rubrics to vary by project phase or &amp;quot;round&amp;quot;.  The feature we will add in this project is a feature to allow rubrics to vary not only by round, but also by topic.  This allows more flexibility to the instructor when setting up an assignment, so that they can use rubrics better suited to the tasks that students are performing in an assignment.&lt;br /&gt;
&lt;br /&gt;
When this feature is complete, the following scenarios will be possible, and the instructor will be the judge of which scenario is the best fit to the assignment:&lt;br /&gt;
&lt;br /&gt;
* Rubric does not vary by round or by topic.&lt;br /&gt;
* Rubric varies by round, but not by topic.&lt;br /&gt;
* Rubric varies by topic, but not by round.&lt;br /&gt;
* Rubric varies by both round and topic.&lt;br /&gt;
&lt;br /&gt;
=== What Needs to be Done ===&lt;br /&gt;
&lt;br /&gt;
This section summarizes the work as described in the project description &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936. Specialized rubrics for different topic types (e.g., Servo project, refactoring project)]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* In assignment#edit page &amp;quot;Rubrics&amp;quot; tab, add a checkbox to specify whether rubric should vary by topic.&lt;br /&gt;
* In assignment#edit page &amp;quot;Topics&amp;quot; tab, add dropdown(s) next to each topic to specify which rubric(s) are associated with the topic.&lt;br /&gt;
** The dropdown(s) should appear only if rubric should vary by topic, per the Rubrics tab.&lt;br /&gt;
** The topic should have a multiple dropdowns (one for each round) only if rubrics vary by round, per the Rubrics tab.&lt;br /&gt;
** By default, the rubric(s) for each course project will be the one(s) specified in “Rubrics” tab.&lt;br /&gt;
** The dropdown value can overwrite the default rubric.&lt;br /&gt;
* Be careful when making changes to the code&lt;br /&gt;
** The signup_sheet_controller should have as little to do as possible with the selection of rubrics.&lt;br /&gt;
** Anything not germane to selecting topics should be in another controller or (more probably) a helper.&lt;br /&gt;
* Create a DB migration to allow rubric to vary by topic as well as by round.&lt;br /&gt;
&lt;br /&gt;
==== Screenshots ====&lt;br /&gt;
'''Current screenshot of Rubrics tab for an Assignment'''&lt;br /&gt;
(need to add a checkbox to indicate that rubric should vary by topic)&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Screenshot Assignment Edit Rubrics.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Current screenshot of Topics tab for an Assignment'''&lt;br /&gt;
(need to add a way to select rubrics for particular topics)&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Screenshot Assignment Edit Topics.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Proposed screenshot of Rubrics tab for an Assignment'''&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Specialized Rubric rubric checkbox.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Proposed screenshot of Topics tab for an Assignment'''&lt;br /&gt;
&lt;br /&gt;
(drop down shown for only one topic here, but final product will have one for each topic)&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Specialized Rubric dropdown menu.png]]&lt;br /&gt;
&lt;br /&gt;
== Previous Work ==&lt;br /&gt;
&lt;br /&gt;
There was previous attempt to implement this project in the Fall of 2018 semester by different team, but it was rejected due to several reasons. Our team was provided with all relevant information and materials about the design and implementation of the previously attempted project. We would like to acknowledge that we use previous implementation and design as reference and our starting point for our own implementation. The following is the list of links with the relevant materials that we have used for better project understanding, determining pros and cons of previously proposed changes, and establishing our design strategy and implementation:&lt;br /&gt;
&lt;br /&gt;
# [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1873_Specialized_rubics_for_different_topic_types Wiki]&lt;br /&gt;
# [https://github.com/expertiza/expertiza/pull/1327 Pull Request]&lt;br /&gt;
# [https://drive.google.com/file/d/1UrLb0Ula_Lb_F4MOrdC-s6xng6B08VYu/view Video Demo]&lt;br /&gt;
&lt;br /&gt;
After reviewing all relevant materials above, we concluded that the project implementation was incomplete and proposed design had significant flaw. &lt;br /&gt;
We identified main drawbacks and flaw as follows:&lt;br /&gt;
&lt;br /&gt;
* Establishing incorrect ''many-to-one'' relationship between ''sign_up_topics'' and ''questionnaires'' tables:&lt;br /&gt;
** Creating a DB migration to add ''questionnaire_id'' in the ''sign_up_topics'' table to store the dropdown data presumes ''one-to-one'' or ''many-to-one'' relationship between ''sign_up_topics'' and ''questionnaires'' tables&lt;br /&gt;
** Correct relationship between ''sign_up_topics'' and ''questionnaires'' tables is ''many-to-many''. For example, each project topic may have various rubrics depending on the round it is used (e.g., for round 1, topic may have one rubric; but for round 2, the same topic may have different rubric)&lt;br /&gt;
** Proposed previous migration changes would break DB design and would not allow to store correctly topic and its associated rubric per different round.&lt;br /&gt;
* Per project requirement specifications, &amp;quot;''The dropdown box should appear only if 'Vary rubric by topic' is selected in the Rubrics tab.''&amp;quot; This requirement was not met and ''Vary rubric by topic'' checkbox in the Rubrics tab was not implemented. Therefore, dropdown box with the list of rubrics appears regardless of whether &amp;quot;''Vary rubric by topic''&amp;quot; is selected or not.&lt;br /&gt;
* The dropdown box includes the list of all possible rubrics including default value. However, this condition can be improved. The dropdown box should list the rubrics that were created by the current user (professor who is logged in). This would allow to shorten the list of possible rubrics dramatically and help to avoid any misunderstanding and confusion while user selects desired rubric for the course project.&lt;br /&gt;
&lt;br /&gt;
We found no further issues with the rest implementation and in other project materials. Wiki page is very useful for understanding design of proposed changes, finding drawbacks and the flaw. Considering all the pros and cons, and taking into account drawbacks of the proposed changes, our team evolved different approach that should successfully solve the problem stated for the project without without creating additional issues. Please see our [http://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics#Project_Implementation Project Implementation] for more details.&lt;br /&gt;
&lt;br /&gt;
== Previous Project Requirements ==&lt;br /&gt;
&lt;br /&gt;
The project requirements originally specified how to alter the databases to support varying rubrics by topic.&lt;br /&gt;
&lt;br /&gt;
''Create a new table named topic_questionnaires with field:''&lt;br /&gt;
* ''id''&lt;br /&gt;
* ''topic_id''&lt;br /&gt;
* ''questionnaire_id''&lt;br /&gt;
* ''used_in_round''&lt;br /&gt;
&lt;br /&gt;
However, the E1936 team successfully petitioned for this requirement to change to give us more freedom in the implementation.  The original suggestion had a flaw.  There is already an existing table in the Expertiza project called ''assignment_questionnaires'', which has columns including ''assignment_id'', ''questionnaire_id'', and ''used_in_round''.  It is this table that maintains the knowledge of which rubric is used in which round of an assignment.  If we were to add a new table to maintains the knowledge of which rubric is used in which topic of an assignment as originally suggested, then we would have a big problem.  Knowledge of round-rubric relationship is duplicated.  This would lead (best case scenario) to extra work, and (worst case scenario) to lots of bugs caused by inconsistencies in how these tables are handled with CRUD operations throughout the code.  In other words, this is not a DRY solution.&lt;br /&gt;
&lt;br /&gt;
== Project Implementation ==&lt;br /&gt;
&lt;br /&gt;
In this section, we propose our solution to the problem, discuss implementation techniques and details, and list the goals we achieved.&lt;br /&gt;
&lt;br /&gt;
We start by analyzing Entity Relationship Diagram where we state the solution to the problem. Further we discuss design strategy by breaking project problem into multiple staged sub-problems and provide solutions for each of these sub-problems. We also discuss some implementation details and provide the list of involved files. Finally, we demonstrate how the implemented feature can be used by providing a ''How To'' sub-section.&lt;br /&gt;
&lt;br /&gt;
=== Diagrams ===&lt;br /&gt;
&lt;br /&gt;
Our solution and implementation of the project can be easily shown by discussing Use Case, Entity Relationship, and Class diagrams. First, for simplicity we discuss in general possible sequence of interactions between a user (in this case instructor) and the system (Expertiza) via presenting Use Case Diagram. Then we plan to show proposed database modification via Entity Relationship Diagram.&lt;br /&gt;
&lt;br /&gt;
==== User Case Diagram ====&lt;br /&gt;
&lt;br /&gt;
[[File: use_case_diagram_1936.png]]&lt;br /&gt;
&lt;br /&gt;
The above Use Case Diagram shows general sequence of interactions between an instructor and the system (Expertiza) that defines where and how the feature can be utilized. Note that highlighted use cases are objects of our interest and work. Also please note that all of the shown use cases already exist in the system and we simply adding new feature into the system with existing use cases. Particularly, the rubric for each assignment and newly added ''Review rubric varies by topic'' checkbox with which instructor may choose to vary assignment by topic or not by checking and unchecking the checkbox is displayed in the ''Rubrics'' tab. Hence, we show how instructor can get to the ''Rubrics'' tab of the assignments. Similarly, ''Topics'' tab of assignments has additional ''Questionnaires'' column for each topic, where instructor may specify which rubric associates with the topic. To perform such sequence of iterations and utilize the new feature, instructor must choose ''Edit'' any assignment from the list of all assignments displayed to him/her in the ''Manage Assignments'' boundary, which can be navigated by instructor by selecting it from the header of the page.&lt;br /&gt;
&lt;br /&gt;
==== Entity Relationship Diagram ====&lt;br /&gt;
&lt;br /&gt;
[[File: HW04_ERD.png]]&lt;br /&gt;
&lt;br /&gt;
The sections of the diagram highlighted in yellow show newly introduced items.  That is, we are adding a new column called ''topic_id'' to ''assignment_questionnaires'', in order to link ''assignment_questionnaires'' to ''sign_up_topics''.&lt;br /&gt;
&lt;br /&gt;
Any assignment, topic, or questionnaire may be represented by multiple records within ''assignment_questionnaires'', but each record within ''assignment_questionnaires'' refers to just one assignment, topic, or questionnaire.  It is the ability to have an assignment represented by multiple records, and the new relationship to ''sign_up_topics'', that allows us to support all of the required scenarios:&lt;br /&gt;
&lt;br /&gt;
* Rubric does not vary by round or by topic.&lt;br /&gt;
* Rubric varies by round, but not by topic.&lt;br /&gt;
* Rubric varies by topic, but not by round.&lt;br /&gt;
* Rubric varies by both round and topic.&lt;br /&gt;
&lt;br /&gt;
[[File: HW04_table.PNG]]&lt;br /&gt;
&lt;br /&gt;
This table illustrates the possibilities that the system may have.&lt;br /&gt;
&lt;br /&gt;
* Assignment 1 does not vary by round or by topic.&lt;br /&gt;
* Assignment 2 varies by round, but not by topic.&lt;br /&gt;
* Assignment 3 varies by topic, but not by round.&lt;br /&gt;
* Assignment 4 varies by both round and topic.&lt;br /&gt;
&lt;br /&gt;
This change is done via database migration by running the following commands:&lt;br /&gt;
&lt;br /&gt;
  rails generate migration AddTopicIdToAssignmentQuestionnaires&lt;br /&gt;
&lt;br /&gt;
Above command adds the ''topic_id'' column to the ''AssignmentQuestionnaires'' table and generates new migration file:&lt;br /&gt;
&lt;br /&gt;
[[File: db_migration.png]]&lt;br /&gt;
&lt;br /&gt;
To see the details of the entire database change please check this [https://github.com/gabalmat/expertiza/commit/d46dd57d35a21ab43efb82c28d3f14b75c695f2e commit].&lt;br /&gt;
&lt;br /&gt;
==== Class Diagram ====&lt;br /&gt;
&lt;br /&gt;
[[File: class_diagram_1936.png]]&lt;br /&gt;
&lt;br /&gt;
This is Class Class diagram.&lt;br /&gt;
&lt;br /&gt;
=== Design Strategy ===&lt;br /&gt;
&lt;br /&gt;
As we have concrete understanding of the problem and proposed solution, we would like break this problem into multiple more manageable sub-problems with specific tasks and well-defined solutions to these tasks. Generally, each sub-problem requires modification of one or more files. We would like to propose our Design Strategy as follows:&lt;br /&gt;
&lt;br /&gt;
==== Preparation ====&lt;br /&gt;
&lt;br /&gt;
* Clean up code that our implementation will use&lt;br /&gt;
** PROBLEM: We need to add/change content to the edit assignment Topics tab, but unlike other tabs in the views, it does not have its own partial view to work with&lt;br /&gt;
*** SOLUTION: Refactor and move the code dealing with topics into separate ''app/views/assignments/edit/_topics.html.erb'' file&lt;br /&gt;
*** File: ''app/views/assignments/edit.html.erb''&lt;br /&gt;
** PROBLEM: In a section below, we discuss the need to modify existing methods to also accept an optional argument ''topic_id''.  In many cases these existing method use confusing variable names or lack sufficient comments.&lt;br /&gt;
*** SOLUTION: Clean up methods that we plan to modify&lt;br /&gt;
*** FILE: (many)&lt;br /&gt;
&lt;br /&gt;
==== Implementation ====&lt;br /&gt;
&lt;br /&gt;
* Allow an instructor to indicate that rubric should vary by topic&lt;br /&gt;
** PROBLEM: There is no way for an instructor to indicate that an assignments' rubric should vary by topic&lt;br /&gt;
*** SOLUTION: Add a new checkbox in the edit assignment Rubrics tab to indicate this preference&lt;br /&gt;
*** FILE: ''app/views/assignments/edit/_rubrics.html.erb''&lt;br /&gt;
** PROBLEM: If the user changes the &amp;quot;Review rubric varies by round?&amp;quot; or &amp;quot;Review rubric varies by topic?&amp;quot; checkbox on the Rubrics tab, but leaves the page in an inappropriate state before leaving the tab (e.g. rubric weights that do not add up to 0% or 100%), then the user does not get feedback that they made a mistake.  They only get such feedback when explicitly performing a &amp;quot;Save&amp;quot;.  Switching from tab to tab on the assignments edit page attempts to perform an implicit save, but there is no mechanism to update the flash messages onscreen if anything goes wrong.  This becomes more problematic now that the Topics tab appearance depends on choices made on the Rubrics tab.  &lt;br /&gt;
*** SOLUTION: Provide a route to an assignments controller method that can return a render of the flash messages.  Add an AJAX call on the assignments edit view that can update the flash messages onscreen.&lt;br /&gt;
*** FILE: app/controllers/assignments_controller.rb&lt;br /&gt;
*** FILE: app/views/assignments/edit.html.erb&lt;br /&gt;
&lt;br /&gt;
* Allow an instructor to choose different rubrics for different topics&lt;br /&gt;
** PROBLEM: There is no way for an instructor to choose different rubrics for different topics&lt;br /&gt;
*** SOLUTION: Add a new column in the edit assignment Topics tab for choosing rubric(s)&lt;br /&gt;
**** New column only visible if rubrics vary by topic, per Rubrics tab&lt;br /&gt;
**** New column has multiple rounds per topic only if rubrics vary by round, per Rubrics tab&lt;br /&gt;
**** Default value for any rubric is that rubric which is shown on Rubrics tab&lt;br /&gt;
**** Rubric(s) in the dropdown list is/are only those that were created by the currently logged in instructor&lt;br /&gt;
*** FILE: ''app/views/assignments/edit/_topics.html.erb''&lt;br /&gt;
** PROBLEM: The code in ''app/views/assignments/edit/_rubrics.html.erb'' includes dropdowns like the ones we need to add for topics, but that code is way too complex for its functionality (too heavy for a view, uses JavaScript)&lt;br /&gt;
*** SOLUTION: Use the code in ''app/views/assignments/edit/_rubrics.html.erb'' for inspiration only&lt;br /&gt;
**** Refactor and move as much actual work as possible out into helper methods that are simply called from this view&lt;br /&gt;
**** Views are not intended to do heavy lifting&lt;br /&gt;
**** Use as little JavaScript as possible, since this is a Ruby On Rails project, not a JS project&lt;br /&gt;
*** FILE: ''app/views/assignments/edit/_topics.html.erb''&lt;br /&gt;
** PROBLEM: The drop-downs for selecting rubrics should show only those rubrics created by the currently-logged in instructor (per project mentor).  They currently include those created by the instructor of the relevant assignment.&lt;br /&gt;
*** SOLUTION: Change the filtering in the ''questionnaire_options'' method to reflect the desired filtering.&lt;br /&gt;
*** FILE: app/helpers/assignment_helper.rb&lt;br /&gt;
&lt;br /&gt;
* Support the ability of the database to link rubrics to topics&lt;br /&gt;
** PROBLEM: There is no relationship in the database that can link together rubrics with topics&lt;br /&gt;
*** SOLUTION: Add a new migration that adds topic_id field to existing assignment_questionnaires table&lt;br /&gt;
**** This new field will reference the id field in the sign_up_topics table&lt;br /&gt;
*** FILE: ''db/migrate/[timestamp]_add_topic_id_to_assignment_questionnaires_table.rb''&lt;br /&gt;
** PROBLEM: The AssignmentQuestionnaire model does not have any knowledge of topics&lt;br /&gt;
*** SOLUTION: Add a new belongs_to reference in the model, to sign_up_topic&lt;br /&gt;
*** FILE: ''app/models/assignment_questionnaire.rb''&lt;br /&gt;
** PROBLEM: The SignUpTopic model does not have any knowledge of assignment_questionnaire records&lt;br /&gt;
*** SOLUTION: Add a new has_many reference in the model, to assignment_questionnaires&lt;br /&gt;
*** FILE: ''app/models/sign_up_topic.rb''&lt;br /&gt;
&lt;br /&gt;
* React to an instructor saving an assignment after altering the rubrics-vary-by-topic checkbox&lt;br /&gt;
** PROBLEM: There is nothing in place to remember when an instructor chooses to vary rubrics by topic, or chooses to not vary rubrics by topic&lt;br /&gt;
*** SOLUTION: Modify existing method ''update_assignment_questionnaires()''.  This method executes upon assignment save (explicit or via tab-change).  This method deletes all ''AssignmentQuestionnaire'' records before creating new correct records reflecting the user's selections in the edit assignment form.  Modify such that this method can create multiple records reflecting multiple topics, in the case where rubric should vary by topic.  With this modification, the correct records (with default rubrics) are present when the user goes to the Topics tab, so that the Topics tab can display properly.&lt;br /&gt;
*** FILE: app\models\assignment_form.rb&lt;br /&gt;
** PROBLEM: There is no way to refresh the Topics tab to show / hide drop-downs after the instructor changes checkbox on Rubrics tab&lt;br /&gt;
*** SOLUTION: Make use of existing &amp;quot;Save&amp;quot;-like functionality when changing tabs on the edit assignment page.  When updating due to tab-change, cause a fresh render of the Topics tab.  When updating due to &amp;quot;Save&amp;quot; button, keep functionality as-is.&lt;br /&gt;
*** FILE: ''app/controllers/assignments_controller.rb''&lt;br /&gt;
*** FILE: ''app/views/assignments/edit.html.erb''&lt;br /&gt;
&lt;br /&gt;
* Support the ability to find the correct rubric for a particular topic&lt;br /&gt;
** PROBLEM: The existing methods allow us to find the correct rubric for a particular round, but not a particular topic&lt;br /&gt;
*** SOLUTION: Modify the existing method questionnaire(assignment, type, round_number) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/helpers/assignment_helper.rb''&lt;br /&gt;
*** SOLUTION: Modify the existing method assignment_questionnaire(assignment, type, number) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/helpers/assignment_helper.rb''&lt;br /&gt;
*** SOLUTION: Modify the existing method questionnaire(round = nil) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/models/review_response_map.rb''&lt;br /&gt;
*** SOLUTION: Modify the existing method questionnaire(round) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/models/self_review_response_map.rb''&lt;br /&gt;
*** SOLUTION: Modify the existing method review_questionnaire_id(round = nil) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/models/assignment.rb''&lt;br /&gt;
&lt;br /&gt;
* Use the correct rubric for a particular topic&lt;br /&gt;
** PROBLEM: When finding rubrics to display, save results from, calculate scores from, etc. round may be used but topic is not&lt;br /&gt;
*** SOLUTION: Examine all callers of methods modified in the previous section and pass in ''topic_id'' where appropriate to grab the correct rubric&lt;br /&gt;
*** FILE: (many)&lt;br /&gt;
&lt;br /&gt;
* Support the ability to determine if an assignment has rubrics that vary by topic&lt;br /&gt;
** PROBLEM: There is no handy method to call that can tell us if an assignment has rubrics that vary by topic&lt;br /&gt;
*** SOLUTION: Add a new method ''varying_rubrics_by_topic?'' based on the existing method ''varying_rubrics_by_round?''&lt;br /&gt;
*** FILE: ''app/models/assignment.rb''&lt;br /&gt;
&lt;br /&gt;
=== Q&amp;amp;A ===&lt;br /&gt;
&lt;br /&gt;
Here we paraphrase some questions we received during round 1 of the documentation review.&lt;br /&gt;
&lt;br /&gt;
* Q: How will the new logic for varying rubric by topic tie in with the existing logic?&lt;br /&gt;
** A: We will add a new field ''topic_id'' into the existing table ''assignment_questionnaires'', as noted in the [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Entity_Relationship_Diagram E/R Diagram].  We will update methods that find questionnaires to allow these methods to also accept a ''topic_id'' argument, as noted in [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Implementation Implementation].&lt;br /&gt;
* Q: How will the &amp;quot;Rubric varies by topic&amp;quot; selection be stored?&lt;br /&gt;
** A: Indirectly, by saving records in the ''assignment_questionnaires'' table which either reference a ''topic_id'' or leave this field nil.  For more details please see the [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Entity_Relationship_Diagram E/R Diagram] discussion.&lt;br /&gt;
* Q: What will happen if an instructor selects &amp;quot;Rubric varies by topic&amp;quot;, makes selections on the &amp;quot;Topics&amp;quot; tab, and then deselects &amp;quot;Rubric varies by topic&amp;quot;?&lt;br /&gt;
** A: The Topics tab, when next visited, will no longer show dropdowns for selecting rubrics by topic.  When the assignment is saved, the appropriate not-varying-by-topic records will be saved in the ''assignment_questionnaires'' table.  For more details please see [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Implementation Implementation].&lt;br /&gt;
* Q: What will happen after an instructor selects &amp;quot;Rubric varies by topic&amp;quot;?&lt;br /&gt;
** A: The Topics tab, when next visited, will now show dropdowns for selecting rubrics by topic.  These rubrics will default to those shown on the Rubrics tab.  When the assignment is saved, the appropriate varying-by-topic records will be saved in the ''assignment_questionnaires'' table.  For more details please see [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Implementation Implementation].&lt;br /&gt;
* Q: How will the appropriate list of questionnaires for the new dropdowns on the Topics tab be determined?&lt;br /&gt;
** A: In the same way that the appropriate list of questionnaires for the existing dropdowns on the Rubrics tab is determined.  Namely, by the ''questionnaire_options'' method in the file ''expertiza/app/helpers/assignment_helper.rb''.&lt;br /&gt;
&lt;br /&gt;
=== (Selected) Modified Code ===&lt;br /&gt;
&lt;br /&gt;
In this section, we provide ''selected portions'' of modified code to illustrate how we implemented the new feature.&lt;br /&gt;
&lt;br /&gt;
Allow an instructor to indicate that rubric should vary by topic&lt;br /&gt;
&lt;br /&gt;
''app\views\assignments\edit\_rubrics.html.erb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;lt;input name=&amp;quot;vary_by_topic&amp;quot; type=&amp;quot;hidden&amp;quot; value=&amp;quot;false&amp;quot; /&amp;gt;&lt;br /&gt;
  &amp;lt;%= check_box_tag('vary_by_topic', 'true', @review_vary_by_topic_check) %&amp;gt;&lt;br /&gt;
  &amp;lt;%= label_tag('vary_by_topic', 'Review rubric varies by topic?') %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Allow an instructor to choose different rubrics for different topics&lt;br /&gt;
&lt;br /&gt;
''app\views\sign_up_sheet\_table_line.html.erb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;lt;% if @assignment_form.assignment.varying_rubrics_by_topic? %&amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;table id = &amp;lt;%=table_id %&amp;gt;&amp;gt;&lt;br /&gt;
        &amp;lt;tr&amp;gt;&lt;br /&gt;
          &amp;lt;script&amp;gt;&lt;br /&gt;
              ...&lt;br /&gt;
              &amp;lt;% if @assignment_form.assignment.varying_rubrics_by_round? %&amp;gt;&lt;br /&gt;
                &amp;lt;% for round in 1..@assignment_form.assignment.rounds_of_reviews %&amp;gt;&lt;br /&gt;
                  ...&lt;br /&gt;
                &amp;lt;% end %&amp;gt;&lt;br /&gt;
              &amp;lt;% else %&amp;gt;&lt;br /&gt;
                ...&lt;br /&gt;
              &amp;lt;% end %&amp;gt;&lt;br /&gt;
          &amp;lt;/script&amp;gt;&lt;br /&gt;
        &amp;lt;/tr&amp;gt;&lt;br /&gt;
      &amp;lt;/table&amp;gt;&lt;br /&gt;
    &amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Support the ability of the database to link rubrics to topics&lt;br /&gt;
&lt;br /&gt;
''app\models\sign_up_topic.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  class SignUpTopic &amp;lt; ActiveRecord::Base&lt;br /&gt;
    ...&lt;br /&gt;
    has_many :assignment_questionnaires, class_name: 'AssignmentQuestionnaire', foreign_key: 'topic_id', dependent: :destroy&lt;br /&gt;
    ...&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
React to an instructor saving an assignment after altering the rubrics-vary-by-topic checkbox&lt;br /&gt;
&lt;br /&gt;
''app/controllers/assignments_controller.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def update&lt;br /&gt;
    ...&lt;br /&gt;
    # What to do next depends on how we got here&lt;br /&gt;
    if params['button'].nil?&lt;br /&gt;
      # REFRESH the topics tab after changing tabs&lt;br /&gt;
      ...&lt;br /&gt;
      render :partial =&amp;gt; &amp;quot;assignments/edit/topics&amp;quot;&lt;br /&gt;
    else&lt;br /&gt;
      # SAVE button was used (do a redirect)&lt;br /&gt;
      redirect_to edit_assignment_path @assignment_form.assignment.id&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Support the ability to find the correct rubric for a particular topic&lt;br /&gt;
&lt;br /&gt;
''app/helpers/assignment_helper.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def assignment_questionnaire(assignment, questionnaire_type, round_number = nil, topic_id = nil)&lt;br /&gt;
    q_by_type = assignment.questionnaires.find_by(type: questionnaire_type)&lt;br /&gt;
    if q_by_type.nil?&lt;br /&gt;
      ...&lt;br /&gt;
    else&lt;br /&gt;
      ...&lt;br /&gt;
      aq_by_type = assignment.assignment_questionnaires.find_by(questionnaire_id: q_by_type.id)&lt;br /&gt;
      if round_number.nil? &amp;amp;&amp;amp; topic_id.nil?&lt;br /&gt;
        # Find by type&lt;br /&gt;
        aq = aq_by_type&lt;br /&gt;
      elsif topic_id.nil?&lt;br /&gt;
        # Find by round&lt;br /&gt;
        aq = assignment.assignment_questionnaires.find_by(used_in_round: round_number)&lt;br /&gt;
      elsif round_number.nil?&lt;br /&gt;
        # Find by topic&lt;br /&gt;
        aq = assignment.assignment_questionnaires.find_by(topic_id: topic_id)&lt;br /&gt;
      else&lt;br /&gt;
        # Find by round and topic&lt;br /&gt;
        aq = assignment.assignment_questionnaires.where(used_in_round: round_number, topic_id: topic_id).first&lt;br /&gt;
      end&lt;br /&gt;
      aq.nil? ? aq_by_type : aq&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use the correct rubric for a particular topic&lt;br /&gt;
&lt;br /&gt;
''app\controllers\response_controller.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def set_questionnaire_for_new_response&lt;br /&gt;
    case @map.type&lt;br /&gt;
    when &amp;quot;ReviewResponseMap&amp;quot;, &amp;quot;SelfReviewResponseMap&amp;quot;&lt;br /&gt;
      reviewees_topic = SignedUpTeam.topic_id_by_team_id(@contributor.id)&lt;br /&gt;
      @current_round = @assignment.number_of_current_round(reviewees_topic)&lt;br /&gt;
      @questionnaire = @map.questionnaire(@current_round, reviewees_topic)&lt;br /&gt;
    when&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Support the ability to determine if an assignment has rubrics that vary by topic&lt;br /&gt;
&lt;br /&gt;
''app\models\assignment.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def varying_rubrics_by_topic?&lt;br /&gt;
    aq_no_topic_id = AssignmentQuestionnaire.where(assignment_id: self.id, topic_id: nil).size &amp;gt;= 1&lt;br /&gt;
    aq_with_topic_id = AssignmentQuestionnaire.where(assignment_id: self.id).where.not(topic_id: nil).size &amp;gt;= 1&lt;br /&gt;
    if !aq_no_topic_id &amp;amp;&amp;amp; !aq_with_topic_id&lt;br /&gt;
      return false&lt;br /&gt;
    elsif aq_no_topic_id &amp;amp;&amp;amp; !aq_with_topic_id&lt;br /&gt;
      return false&lt;br /&gt;
    elsif !aq_no_topic_id &amp;amp;&amp;amp; aq_with_topic_id&lt;br /&gt;
      return true&lt;br /&gt;
    else&lt;br /&gt;
      raise StandardError.new(&amp;quot;Assignment with id &amp;quot; + self.id.to_s + &amp;quot; has a conflict about whether or not it varies by topic&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== How To ==&lt;br /&gt;
&lt;br /&gt;
In this section, we describe how to use the newly implemented feature.&lt;br /&gt;
&lt;br /&gt;
=== Add a New Rubric ===&lt;br /&gt;
&lt;br /&gt;
* [to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
=== Select a Rubric for a Topic ===&lt;br /&gt;
&lt;br /&gt;
* [to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
== Project Testing ==&lt;br /&gt;
&lt;br /&gt;
=== Strategy ===&lt;br /&gt;
&lt;br /&gt;
To test code implementation, correctness of the added feature, verify that the team did not break any existing functionalities in the Expertiza, and ensure that no bugs were introduced in the code, we developed the following Test Strategy:&lt;br /&gt;
&lt;br /&gt;
# Code inspection&lt;br /&gt;
# Run and pass existing RSpec Tests&lt;br /&gt;
# Develop New RSpec Tests&lt;br /&gt;
# Run through live UI to test a feature using Expertiza instance&lt;br /&gt;
&lt;br /&gt;
=== Rspec Testing ===&lt;br /&gt;
&lt;br /&gt;
==== Existing Tests ====&lt;br /&gt;
&lt;br /&gt;
Run all existing RSpec tests on any changed files, after our changes, to ensure that we have not introduced any failures.&lt;br /&gt;
The commands and results are shown below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
e@ubuntu:~/Desktop/CSC517_HW04/expertiza$ bundle exec rspec spec/helpers/ spec/controllers/ spec/models/&lt;br /&gt;
[Coveralls] Set up the SimpleCov formatter.&lt;br /&gt;
[Coveralls] Using SimpleCov's 'rails' settings.&lt;br /&gt;
&lt;br /&gt;
Randomized with seed 6978&lt;br /&gt;
[...]&lt;br /&gt;
&lt;br /&gt;
Finished in 8 minutes 10 seconds (files took 12.32 seconds to load)&lt;br /&gt;
900 examples, 0 failures, 16 pending&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The features tests were extremely time-consuming so we did not routinely run them during development.  However TravisCI results on our [https://github.com/expertiza/expertiza/pull/1444 Pull Request] demonstrate the passing status of all tests.&lt;br /&gt;
&lt;br /&gt;
==== New Tests ====&lt;br /&gt;
&lt;br /&gt;
Write comprehensive RSpec tests, for all new or modified methods.&lt;br /&gt;
* FILE: ''spec/helpers/assignment_helper_spec.rb''&lt;br /&gt;
** METHODS TO TEST: &lt;br /&gt;
*** questionnaire(assignment, type, round_number, topic_id)&lt;br /&gt;
*** assignment_questionnaire(assignment, type, number, topic_id)&lt;br /&gt;
* FILE: ''spec/models/review_response_map_spec.rb''&lt;br /&gt;
*** METHODS TO TEST:&lt;br /&gt;
**** questionnaire(round, topic_id)&lt;br /&gt;
* FILE: ''spec/models/self_review_response_map_spec.rb''&lt;br /&gt;
*** METHODS TO TEST:&lt;br /&gt;
**** questionnaire(round, topic_id)&lt;br /&gt;
* FILE: ''spec/models/assignment_spec.rb''&lt;br /&gt;
*** METHODS TO TEST:&lt;br /&gt;
**** review_questionnaire_id(round, topic_id)&lt;br /&gt;
**** varying_rubrics_by_topic?()&lt;br /&gt;
&lt;br /&gt;
Run these tests, to ensure that the new code works as intended.&lt;br /&gt;
The commands and results are shown below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
e@ubuntu:~/Desktop/CSC517_HW04/expertiza$ bundle exec rspec spec/helpers/assignment_helper_spec.rb spec/models/review_response_map_spec.rb spec/models/self_review_response_map_spec.rb spec/models/assignment_spec.rb &lt;br /&gt;
[Coveralls] Set up the SimpleCov formatter.&lt;br /&gt;
[Coveralls] Using SimpleCov's 'rails' settings.&lt;br /&gt;
&lt;br /&gt;
Randomized with seed 47508&lt;br /&gt;
....................................................................................................................&lt;br /&gt;
&lt;br /&gt;
Finished in 1 minute 7.94 seconds (files took 10.85 seconds to load)&lt;br /&gt;
116 examples, 0 failures&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The test suite for a single new method is shown below.&lt;br /&gt;
* There are many such suites added in expertiza/spec  &lt;br /&gt;
* This example illustrates our general strategy:&lt;br /&gt;
** test missing input&lt;br /&gt;
** test bad input&lt;br /&gt;
** test various acceptable forms of input&lt;br /&gt;
** test scenarios that lead to various return values&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  describe &amp;quot;#questionnaire&amp;quot; do&lt;br /&gt;
&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;throws exception if assignment argument nil&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;throws exception if all arguments nil except for assignment&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;finds by type if round number &amp;amp; topic id not given&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;throws exception if round number &amp;amp; topic id not given, no luck finding by type&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;finds by round number alone if round number alone is given&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;creates new questionnaire of given type if round number alone is given, no luck finding by round&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;finds by topic id alone if topic id alone is given&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;creates new questionnaire of given type if topic id alone is given, no luck finding by topic&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;finds by round number and topic id if both are given&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;creates new questionnaire of given type if round and topic are given, no luck finding by round and topic&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== UI Testing ===&lt;br /&gt;
&lt;br /&gt;
Here we describe manual UI Testing that was performed.&lt;br /&gt;
&lt;br /&gt;
==== Rubric does not vary by round or by topic ====&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
==== Rubric varies by round, but not by topic ====&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
==== Rubric varies by topic, but not by round ====&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
==== Rubric varies by both round and topic ====&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
In CSC/ECE 517, there are several types of topics that could be covered in a single class assignment.  However, currently we can only specify one kind of rubric for an assignment. This means that teams working on different topics will be evaluated using the same rubric. With this setup, it's not possible to fine-tune rubrics for different topics - rubrics tend to be overly general.&lt;br /&gt;
&lt;br /&gt;
In this project, we have solved this issue, by allowing rubrics to vary not only by round, but also by topic. This allows more flexibility to the instructor when setting up an assignment, so that they can use rubrics better suited to the tasks that students are performing in an assignment.  The following scenarios will be possible, and the instructor will be the judge of which scenario is the best fit to the assignment:&lt;br /&gt;
&lt;br /&gt;
* Rubric does not vary by round or by topic.&lt;br /&gt;
* Rubric varies by round, but not by topic.&lt;br /&gt;
* Rubric varies by topic, but not by round.&lt;br /&gt;
* Rubric varies by both round and topic.&lt;br /&gt;
&lt;br /&gt;
The instructor may use the Rubrics tab of the assignments edit page to make changes to the &amp;quot;Review rubric varies by round?&amp;quot; and &amp;quot;Review rubric varies by topic?&amp;quot; checkboxes.  The instructor may then use the Topics tab to select the appropriate rubric(s) for every topic in the assignment.&lt;br /&gt;
&lt;br /&gt;
Various other Expertiza code has been updated to retrieve the correct rubric depending on round and topic after the instructor has made these selections.&lt;br /&gt;
&lt;br /&gt;
== Future Work ==&lt;br /&gt;
&lt;br /&gt;
This section discusses possible future work for another CSC 517 team to take on.  Such a team can search the Expertiza codebase for &amp;quot;TODO E1936 (future work)&amp;quot; to find most of the places in the code that the notes below refer to.&lt;br /&gt;
&lt;br /&gt;
* Reduce the delay between changing the state of the &amp;quot;Review rubric varies by topic?&amp;quot; checkbox on the Rubrics tab, and the show / hide of rubric drop-downs on the Topics tab.&lt;br /&gt;
* Redesign UI for tone analysis, heatmaps, and review scores pop-up.  These areas are designed around the assumption that reviews do NOT vary by topic.  For example, in the review scores pop-up, a reviewer can see the reviews they have given, arranged by question, across multiple reviewees.&lt;br /&gt;
* Consider whether the questionnaire options available for selection in drop-downs on the Topics and Rubrics tabs should include ''only'' those questionnaires created by the currently-logged-in instructor.  Our work in this project changed the filtering from instructor-owning-assignment to currently-logged-in instructor - but left in place all non-private questionnaires.  ''Consider'' whether non-private questionnaires should be excluded.  This may result in some drop-downs not having any available questionnaires.&lt;br /&gt;
&lt;br /&gt;
== Useful Links ==&lt;br /&gt;
In this section we provide useful links related to the work that has been completed by our team.&lt;br /&gt;
# [https://github.com/gabalmat/expertiza Forked Project Repository]&lt;br /&gt;
# [https://github.com/expertiza/expertiza/pull/1444 Pull Request]&lt;br /&gt;
# [(add link here) Video Demonstration of Specialized Rubrics]&lt;br /&gt;
# [(add link here) Video Demonstration of Passing Rspec Tests]&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Contacts ===&lt;br /&gt;
We have 4 (four) members in our team and 1 (one) mentor was also assigned to us. For any project-related questions/concerns please contact us:&lt;br /&gt;
* Aurora Tiffany-Davis - attiffan@ncsu.edu&lt;br /&gt;
* Ginger Balmat - gabalmat@ncsu.edu&lt;br /&gt;
* Joe Hutchinson - jehutch3@ncsu.edu&lt;br /&gt;
* Nikolay Titov - ngtitov@ncsu.edu&lt;br /&gt;
* Zhewei Hu (mentor) - zhu6@ncsu.edu&lt;br /&gt;
&lt;br /&gt;
=== Contribution Based Inquiry ===&lt;br /&gt;
For any questions or concerns related to the project design, implementation, testing of the feature developed by our team, please contact an engineer who worked closely on the topic of your interest based on the [https://docs.google.com/spreadsheets/d/11uxuI_5gaC-FQDwIOxtCaN3HZ9bfWDJgIjFemtYV5jE/edit?ts=5ca222f3#gid=0 Contribution Assignment Grid] we created to keep track of our progress and contribution. Please carbon copy all team members and our mentor in the email.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* Expertiza Web [https://github.com/expertiza/expertiza#expertiza]&lt;br /&gt;
* Expertiza on GitHub [https://github.com/expertiza/expertiza]&lt;br /&gt;
* Expertiza Wiki [http://wikis.lib.ncsu.edu/index.php/Expertiza]&lt;br /&gt;
* Rspec Documentation [https://relishapp.com/rspec]&lt;br /&gt;
* Wiki with Previous Work [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1873_Specialized_rubics_for_different_topic_types]&lt;br /&gt;
* Pull Request of the Previous Work [https://github.com/expertiza/expertiza/pull/1327]&lt;/div&gt;</summary>
		<author><name>Ngtitov</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Use_case_diagram.png&amp;diff=124452</id>
		<title>File:Use case diagram.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Use_case_diagram.png&amp;diff=124452"/>
		<updated>2019-04-26T14:46:01Z</updated>

		<summary type="html">&lt;p&gt;Ngtitov: uploaded a new version of &amp;amp;quot;File:Use case diagram.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Ngtitov</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Use_case_diagram.png&amp;diff=124451</id>
		<title>File:Use case diagram.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Use_case_diagram.png&amp;diff=124451"/>
		<updated>2019-04-26T14:44:16Z</updated>

		<summary type="html">&lt;p&gt;Ngtitov: uploaded a new version of &amp;amp;quot;File:Use case diagram.png&amp;amp;quot;: Reverted to version as of 14:32, 26 April 2019&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Ngtitov</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Class_diagram_1936.png&amp;diff=124450</id>
		<title>File:Class diagram 1936.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Class_diagram_1936.png&amp;diff=124450"/>
		<updated>2019-04-26T14:42:09Z</updated>

		<summary type="html">&lt;p&gt;Ngtitov: uploaded a new version of &amp;amp;quot;File:Class diagram 1936.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Ngtitov</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Class_diagram_1936.png&amp;diff=124448</id>
		<title>File:Class diagram 1936.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Class_diagram_1936.png&amp;diff=124448"/>
		<updated>2019-04-26T14:38:57Z</updated>

		<summary type="html">&lt;p&gt;Ngtitov: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Ngtitov</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics&amp;diff=124447</id>
		<title>E1936 Specialized Rubrics</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics&amp;diff=124447"/>
		<updated>2019-04-26T14:37:10Z</updated>

		<summary type="html">&lt;p&gt;Ngtitov: /* Class Diagram */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page describes the work and goals that have been completed and achieved while implementing Expertiza Project &amp;quot;''E1936. Specialized Rubrics for Different Topic Types (e.g., Servo project, refactoring project)''&amp;quot; for the CSC/ECE 517 &amp;quot;Object-Oriented Design and Development&amp;quot; class, in the Spring semester of the 2019.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This Wiki page is created per CSC/ECE 517: &amp;quot;Object-Oriented Design and Development&amp;quot;, Expertiza Project requirements (Spring, 2019).&lt;br /&gt;
&lt;br /&gt;
Our [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Team team] was assigned the project &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936. Specialized rubrics for different topic types (e.g., Servo project, refactoring project)]&amp;quot;.  This is an Expertiza project.&lt;br /&gt;
&lt;br /&gt;
In this wiki page we describe the problem to be solved, how we solve that problem, and how we test our solution.  We also provide helpful links and contact information for our team.&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
In this section, we discuss the problem we need to solve, the Expertiza feature this problem is related to, what needs to be done to solve the problem (at a high level), and the previous attempt to solve this problem.&lt;br /&gt;
&lt;br /&gt;
=== Problem Statement ===&lt;br /&gt;
&lt;br /&gt;
This problem statement summarizes the problem as described in the project description &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936. Specialized rubrics for different topic types (e.g., Servo project, refactoring project)]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
In CSC/ECE 517, there are several types of topics that could be covered in a single class assignment.&lt;br /&gt;
* Code base&lt;br /&gt;
** Expertiza&lt;br /&gt;
** Mozilla&lt;br /&gt;
** etc.&lt;br /&gt;
* Goal&lt;br /&gt;
** Refactoring&lt;br /&gt;
** Testing&lt;br /&gt;
** etc.&lt;br /&gt;
However, currently we can only specify one kind of rubric for an assignment.  This means that teams working on different topics will be evaluated using the same rubric.  With this setup, it's not possible to fine-tune rubrics for different topics - rubrics tend to be overly general.&lt;br /&gt;
&lt;br /&gt;
=== Feature Description ===&lt;br /&gt;
&lt;br /&gt;
The Expertiza project already has a feature that allows rubrics to vary by project phase or &amp;quot;round&amp;quot;.  The feature we will add in this project is a feature to allow rubrics to vary not only by round, but also by topic.  This allows more flexibility to the instructor when setting up an assignment, so that they can use rubrics better suited to the tasks that students are performing in an assignment.&lt;br /&gt;
&lt;br /&gt;
When this feature is complete, the following scenarios will be possible, and the instructor will be the judge of which scenario is the best fit to the assignment:&lt;br /&gt;
&lt;br /&gt;
* Rubric does not vary by round or by topic.&lt;br /&gt;
* Rubric varies by round, but not by topic.&lt;br /&gt;
* Rubric varies by topic, but not by round.&lt;br /&gt;
* Rubric varies by both round and topic.&lt;br /&gt;
&lt;br /&gt;
=== What Needs to be Done ===&lt;br /&gt;
&lt;br /&gt;
This section summarizes the work as described in the project description &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936. Specialized rubrics for different topic types (e.g., Servo project, refactoring project)]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* In assignment#edit page &amp;quot;Rubrics&amp;quot; tab, add a checkbox to specify whether rubric should vary by topic.&lt;br /&gt;
* In assignment#edit page &amp;quot;Topics&amp;quot; tab, add dropdown(s) next to each topic to specify which rubric(s) are associated with the topic.&lt;br /&gt;
** The dropdown(s) should appear only if rubric should vary by topic, per the Rubrics tab.&lt;br /&gt;
** The topic should have a multiple dropdowns (one for each round) only if rubrics vary by round, per the Rubrics tab.&lt;br /&gt;
** By default, the rubric(s) for each course project will be the one(s) specified in “Rubrics” tab.&lt;br /&gt;
** The dropdown value can overwrite the default rubric.&lt;br /&gt;
* Be careful when making changes to the code&lt;br /&gt;
** The signup_sheet_controller should have as little to do as possible with the selection of rubrics.&lt;br /&gt;
** Anything not germane to selecting topics should be in another controller or (more probably) a helper.&lt;br /&gt;
* Create a DB migration to allow rubric to vary by topic as well as by round.&lt;br /&gt;
&lt;br /&gt;
==== Screenshots ====&lt;br /&gt;
'''Current screenshot of Rubrics tab for an Assignment'''&lt;br /&gt;
(need to add a checkbox to indicate that rubric should vary by topic)&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Screenshot Assignment Edit Rubrics.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Current screenshot of Topics tab for an Assignment'''&lt;br /&gt;
(need to add a way to select rubrics for particular topics)&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Screenshot Assignment Edit Topics.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Proposed screenshot of Rubrics tab for an Assignment'''&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Specialized Rubric rubric checkbox.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Proposed screenshot of Topics tab for an Assignment'''&lt;br /&gt;
&lt;br /&gt;
(drop down shown for only one topic here, but final product will have one for each topic)&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Specialized Rubric dropdown menu.png]]&lt;br /&gt;
&lt;br /&gt;
== Previous Work ==&lt;br /&gt;
&lt;br /&gt;
There was previous attempt to implement this project in the Fall of 2018 semester by different team, but it was rejected due to several reasons. Our team was provided with all relevant information and materials about the design and implementation of the previously attempted project. We would like to acknowledge that we use previous implementation and design as reference and our starting point for our own implementation. The following is the list of links with the relevant materials that we have used for better project understanding, determining pros and cons of previously proposed changes, and establishing our design strategy and implementation:&lt;br /&gt;
&lt;br /&gt;
# [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1873_Specialized_rubics_for_different_topic_types Wiki]&lt;br /&gt;
# [https://github.com/expertiza/expertiza/pull/1327 Pull Request]&lt;br /&gt;
# [https://drive.google.com/file/d/1UrLb0Ula_Lb_F4MOrdC-s6xng6B08VYu/view Video Demo]&lt;br /&gt;
&lt;br /&gt;
After reviewing all relevant materials above, we concluded that the project implementation was incomplete and proposed design had significant flaw. &lt;br /&gt;
We identified main drawbacks and flaw as follows:&lt;br /&gt;
&lt;br /&gt;
* Establishing incorrect ''many-to-one'' relationship between ''sign_up_topics'' and ''questionnaires'' tables:&lt;br /&gt;
** Creating a DB migration to add ''questionnaire_id'' in the ''sign_up_topics'' table to store the dropdown data presumes ''one-to-one'' or ''many-to-one'' relationship between ''sign_up_topics'' and ''questionnaires'' tables&lt;br /&gt;
** Correct relationship between ''sign_up_topics'' and ''questionnaires'' tables is ''many-to-many''. For example, each project topic may have various rubrics depending on the round it is used (e.g., for round 1, topic may have one rubric; but for round 2, the same topic may have different rubric)&lt;br /&gt;
** Proposed previous migration changes would break DB design and would not allow to store correctly topic and its associated rubric per different round.&lt;br /&gt;
* Per project requirement specifications, &amp;quot;''The dropdown box should appear only if 'Vary rubric by topic' is selected in the Rubrics tab.''&amp;quot; This requirement was not met and ''Vary rubric by topic'' checkbox in the Rubrics tab was not implemented. Therefore, dropdown box with the list of rubrics appears regardless of whether &amp;quot;''Vary rubric by topic''&amp;quot; is selected or not.&lt;br /&gt;
* The dropdown box includes the list of all possible rubrics including default value. However, this condition can be improved. The dropdown box should list the rubrics that were created by the current user (professor who is logged in). This would allow to shorten the list of possible rubrics dramatically and help to avoid any misunderstanding and confusion while user selects desired rubric for the course project.&lt;br /&gt;
&lt;br /&gt;
We found no further issues with the rest implementation and in other project materials. Wiki page is very useful for understanding design of proposed changes, finding drawbacks and the flaw. Considering all the pros and cons, and taking into account drawbacks of the proposed changes, our team evolved different approach that should successfully solve the problem stated for the project without without creating additional issues. Please see our [http://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics#Project_Implementation Project Implementation] for more details.&lt;br /&gt;
&lt;br /&gt;
== Previous Project Requirements ==&lt;br /&gt;
&lt;br /&gt;
The project requirements originally specified how to alter the databases to support varying rubrics by topic.&lt;br /&gt;
&lt;br /&gt;
''Create a new table named topic_questionnaires with field:''&lt;br /&gt;
* ''id''&lt;br /&gt;
* ''topic_id''&lt;br /&gt;
* ''questionnaire_id''&lt;br /&gt;
* ''used_in_round''&lt;br /&gt;
&lt;br /&gt;
However, the E1936 team successfully petitioned for this requirement to change to give us more freedom in the implementation.  The original suggestion had a flaw.  There is already an existing table in the Expertiza project called ''assignment_questionnaires'', which has columns including ''assignment_id'', ''questionnaire_id'', and ''used_in_round''.  It is this table that maintains the knowledge of which rubric is used in which round of an assignment.  If we were to add a new table to maintains the knowledge of which rubric is used in which topic of an assignment as originally suggested, then we would have a big problem.  Knowledge of round-rubric relationship is duplicated.  This would lead (best case scenario) to extra work, and (worst case scenario) to lots of bugs caused by inconsistencies in how these tables are handled with CRUD operations throughout the code.  In other words, this is not a DRY solution.&lt;br /&gt;
&lt;br /&gt;
== Project Implementation ==&lt;br /&gt;
&lt;br /&gt;
In this section, we propose our solution to the problem, discuss implementation techniques and details, and list the goals we achieved.&lt;br /&gt;
&lt;br /&gt;
We start by analyzing Entity Relationship Diagram where we state the solution to the problem. Further we discuss design strategy by breaking project problem into multiple staged sub-problems and provide solutions for each of these sub-problems. We also discuss some implementation details and provide the list of involved files. Finally, we demonstrate how the implemented feature can be used by providing a ''How To'' sub-section.&lt;br /&gt;
&lt;br /&gt;
=== Diagrams ===&lt;br /&gt;
&lt;br /&gt;
Our solution and implementation of the project can be easily shown by discussing Use Case, Entity Relationship, and Class diagrams. First, for simplicity we discuss in general possible sequence of interactions between a user (in this case instructor) and the system (Expertiza) via presenting Use Case Diagram. Then we plan to show proposed database modification via Entity Relationship Diagram.&lt;br /&gt;
&lt;br /&gt;
==== User Case Diagram ====&lt;br /&gt;
&lt;br /&gt;
[[File: use_case_diagram.png]]&lt;br /&gt;
&lt;br /&gt;
The above Use Case Diagram shows general sequence of interactions between an instructor and the system (Expertiza) that defines where and how the feature can be utilized. Note that highlighted use cases are objects of our interest and work. Also please note that all of the shown use cases already exist in the system and we simply adding new feature into the system with existing use cases. Particularly, the rubric for each assignment and newly added ''Review rubric varies by topic'' checkbox with which instructor may choose to vary assignment by topic or not by checking and unchecking the checkbox is displayed in the ''Rubrics'' tab. Hence, we show how instructor can get to the ''Rubrics'' tab of the assignments. Similarly, ''Topics'' tab of assignments has additional ''Questionnaires'' column for each topic, where instructor may specify which rubric associates with the topic. To perform such sequence of iterations and utilize the new feature, instructor must choose ''Edit'' any assignment from the list of all assignments displayed to him/her in the ''Manage Assignments'' boundary, which can be navigated by instructor by selecting it from the header of the page.&lt;br /&gt;
&lt;br /&gt;
==== Entity Relationship Diagram ====&lt;br /&gt;
&lt;br /&gt;
[[File: HW04_ERD.png]]&lt;br /&gt;
&lt;br /&gt;
The sections of the diagram highlighted in yellow show newly introduced items.  That is, we are adding a new column called ''topic_id'' to ''assignment_questionnaires'', in order to link ''assignment_questionnaires'' to ''sign_up_topics''.&lt;br /&gt;
&lt;br /&gt;
Any assignment, topic, or questionnaire may be represented by multiple records within ''assignment_questionnaires'', but each record within ''assignment_questionnaires'' refers to just one assignment, topic, or questionnaire.  It is the ability to have an assignment represented by multiple records, and the new relationship to ''sign_up_topics'', that allows us to support all of the required scenarios:&lt;br /&gt;
&lt;br /&gt;
* Rubric does not vary by round or by topic.&lt;br /&gt;
* Rubric varies by round, but not by topic.&lt;br /&gt;
* Rubric varies by topic, but not by round.&lt;br /&gt;
* Rubric varies by both round and topic.&lt;br /&gt;
&lt;br /&gt;
[[File: HW04_table.PNG]]&lt;br /&gt;
&lt;br /&gt;
This table illustrates the possibilities that the system may have.&lt;br /&gt;
&lt;br /&gt;
* Assignment 1 does not vary by round or by topic.&lt;br /&gt;
* Assignment 2 varies by round, but not by topic.&lt;br /&gt;
* Assignment 3 varies by topic, but not by round.&lt;br /&gt;
* Assignment 4 varies by both round and topic.&lt;br /&gt;
&lt;br /&gt;
This change is done via database migration by running the following commands:&lt;br /&gt;
&lt;br /&gt;
  rails generate migration AddTopicIdToAssignmentQuestionnaires&lt;br /&gt;
&lt;br /&gt;
Above command adds the ''topic_id'' column to the ''AssignmentQuestionnaires'' table and generates new migration file:&lt;br /&gt;
&lt;br /&gt;
[[File: db_migration.png]]&lt;br /&gt;
&lt;br /&gt;
To see the details of the entire database change please check this [https://github.com/gabalmat/expertiza/commit/d46dd57d35a21ab43efb82c28d3f14b75c695f2e commit].&lt;br /&gt;
&lt;br /&gt;
==== Class Diagram ====&lt;br /&gt;
&lt;br /&gt;
[[File: class_diagram_1936.png]]&lt;br /&gt;
&lt;br /&gt;
This is Class Class diagram.&lt;br /&gt;
&lt;br /&gt;
=== Design Strategy ===&lt;br /&gt;
&lt;br /&gt;
As we have concrete understanding of the problem and proposed solution, we would like break this problem into multiple more manageable sub-problems with specific tasks and well-defined solutions to these tasks. Generally, each sub-problem requires modification of one or more files. We would like to propose our Design Strategy as follows:&lt;br /&gt;
&lt;br /&gt;
==== Preparation ====&lt;br /&gt;
&lt;br /&gt;
* Clean up code that our implementation will use&lt;br /&gt;
** PROBLEM: We need to add/change content to the edit assignment Topics tab, but unlike other tabs in the views, it does not have its own partial view to work with&lt;br /&gt;
*** SOLUTION: Refactor and move the code dealing with topics into separate ''app/views/assignments/edit/_topics.html.erb'' file&lt;br /&gt;
*** File: ''app/views/assignments/edit.html.erb''&lt;br /&gt;
** PROBLEM: In a section below, we discuss the need to modify existing methods to also accept an optional argument ''topic_id''.  In many cases these existing method use confusing variable names or lack sufficient comments.&lt;br /&gt;
*** SOLUTION: Clean up methods that we plan to modify&lt;br /&gt;
*** FILE: (many)&lt;br /&gt;
&lt;br /&gt;
==== Implementation ====&lt;br /&gt;
&lt;br /&gt;
* Allow an instructor to indicate that rubric should vary by topic&lt;br /&gt;
** PROBLEM: There is no way for an instructor to indicate that an assignments' rubric should vary by topic&lt;br /&gt;
*** SOLUTION: Add a new checkbox in the edit assignment Rubrics tab to indicate this preference&lt;br /&gt;
*** FILE: ''app/views/assignments/edit/_rubrics.html.erb''&lt;br /&gt;
** PROBLEM: If the user changes the &amp;quot;Review rubric varies by round?&amp;quot; or &amp;quot;Review rubric varies by topic?&amp;quot; checkbox on the Rubrics tab, but leaves the page in an inappropriate state before leaving the tab (e.g. rubric weights that do not add up to 0% or 100%), then the user does not get feedback that they made a mistake.  They only get such feedback when explicitly performing a &amp;quot;Save&amp;quot;.  Switching from tab to tab on the assignments edit page attempts to perform an implicit save, but there is no mechanism to update the flash messages onscreen if anything goes wrong.  This becomes more problematic now that the Topics tab appearance depends on choices made on the Rubrics tab.  &lt;br /&gt;
*** SOLUTION: Provide a route to an assignments controller method that can return a render of the flash messages.  Add an AJAX call on the assignments edit view that can update the flash messages onscreen.&lt;br /&gt;
*** FILE: app/controllers/assignments_controller.rb&lt;br /&gt;
*** FILE: app/views/assignments/edit.html.erb&lt;br /&gt;
&lt;br /&gt;
* Allow an instructor to choose different rubrics for different topics&lt;br /&gt;
** PROBLEM: There is no way for an instructor to choose different rubrics for different topics&lt;br /&gt;
*** SOLUTION: Add a new column in the edit assignment Topics tab for choosing rubric(s)&lt;br /&gt;
**** New column only visible if rubrics vary by topic, per Rubrics tab&lt;br /&gt;
**** New column has multiple rounds per topic only if rubrics vary by round, per Rubrics tab&lt;br /&gt;
**** Default value for any rubric is that rubric which is shown on Rubrics tab&lt;br /&gt;
**** Rubric(s) in the dropdown list is/are only those that were created by the currently logged in instructor&lt;br /&gt;
*** FILE: ''app/views/assignments/edit/_topics.html.erb''&lt;br /&gt;
** PROBLEM: The code in ''app/views/assignments/edit/_rubrics.html.erb'' includes dropdowns like the ones we need to add for topics, but that code is way too complex for its functionality (too heavy for a view, uses JavaScript)&lt;br /&gt;
*** SOLUTION: Use the code in ''app/views/assignments/edit/_rubrics.html.erb'' for inspiration only&lt;br /&gt;
**** Refactor and move as much actual work as possible out into helper methods that are simply called from this view&lt;br /&gt;
**** Views are not intended to do heavy lifting&lt;br /&gt;
**** Use as little JavaScript as possible, since this is a Ruby On Rails project, not a JS project&lt;br /&gt;
*** FILE: ''app/views/assignments/edit/_topics.html.erb''&lt;br /&gt;
** PROBLEM: The drop-downs for selecting rubrics should show only those rubrics created by the currently-logged in instructor (per project mentor).  They currently include those created by the instructor of the relevant assignment.&lt;br /&gt;
*** SOLUTION: Change the filtering in the ''questionnaire_options'' method to reflect the desired filtering.&lt;br /&gt;
*** FILE: app/helpers/assignment_helper.rb&lt;br /&gt;
&lt;br /&gt;
* Support the ability of the database to link rubrics to topics&lt;br /&gt;
** PROBLEM: There is no relationship in the database that can link together rubrics with topics&lt;br /&gt;
*** SOLUTION: Add a new migration that adds topic_id field to existing assignment_questionnaires table&lt;br /&gt;
**** This new field will reference the id field in the sign_up_topics table&lt;br /&gt;
*** FILE: ''db/migrate/[timestamp]_add_topic_id_to_assignment_questionnaires_table.rb''&lt;br /&gt;
** PROBLEM: The AssignmentQuestionnaire model does not have any knowledge of topics&lt;br /&gt;
*** SOLUTION: Add a new belongs_to reference in the model, to sign_up_topic&lt;br /&gt;
*** FILE: ''app/models/assignment_questionnaire.rb''&lt;br /&gt;
** PROBLEM: The SignUpTopic model does not have any knowledge of assignment_questionnaire records&lt;br /&gt;
*** SOLUTION: Add a new has_many reference in the model, to assignment_questionnaires&lt;br /&gt;
*** FILE: ''app/models/sign_up_topic.rb''&lt;br /&gt;
&lt;br /&gt;
* React to an instructor saving an assignment after altering the rubrics-vary-by-topic checkbox&lt;br /&gt;
** PROBLEM: There is nothing in place to remember when an instructor chooses to vary rubrics by topic, or chooses to not vary rubrics by topic&lt;br /&gt;
*** SOLUTION: Modify existing method ''update_assignment_questionnaires()''.  This method executes upon assignment save (explicit or via tab-change).  This method deletes all ''AssignmentQuestionnaire'' records before creating new correct records reflecting the user's selections in the edit assignment form.  Modify such that this method can create multiple records reflecting multiple topics, in the case where rubric should vary by topic.  With this modification, the correct records (with default rubrics) are present when the user goes to the Topics tab, so that the Topics tab can display properly.&lt;br /&gt;
*** FILE: app\models\assignment_form.rb&lt;br /&gt;
** PROBLEM: There is no way to refresh the Topics tab to show / hide drop-downs after the instructor changes checkbox on Rubrics tab&lt;br /&gt;
*** SOLUTION: Make use of existing &amp;quot;Save&amp;quot;-like functionality when changing tabs on the edit assignment page.  When updating due to tab-change, cause a fresh render of the Topics tab.  When updating due to &amp;quot;Save&amp;quot; button, keep functionality as-is.&lt;br /&gt;
*** FILE: ''app/controllers/assignments_controller.rb''&lt;br /&gt;
*** FILE: ''app/views/assignments/edit.html.erb''&lt;br /&gt;
&lt;br /&gt;
* Support the ability to find the correct rubric for a particular topic&lt;br /&gt;
** PROBLEM: The existing methods allow us to find the correct rubric for a particular round, but not a particular topic&lt;br /&gt;
*** SOLUTION: Modify the existing method questionnaire(assignment, type, round_number) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/helpers/assignment_helper.rb''&lt;br /&gt;
*** SOLUTION: Modify the existing method assignment_questionnaire(assignment, type, number) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/helpers/assignment_helper.rb''&lt;br /&gt;
*** SOLUTION: Modify the existing method questionnaire(round = nil) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/models/review_response_map.rb''&lt;br /&gt;
*** SOLUTION: Modify the existing method questionnaire(round) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/models/self_review_response_map.rb''&lt;br /&gt;
*** SOLUTION: Modify the existing method review_questionnaire_id(round = nil) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/models/assignment.rb''&lt;br /&gt;
&lt;br /&gt;
* Use the correct rubric for a particular topic&lt;br /&gt;
** PROBLEM: When finding rubrics to display, save results from, calculate scores from, etc. round may be used but topic is not&lt;br /&gt;
*** SOLUTION: Examine all callers of methods modified in the previous section and pass in ''topic_id'' where appropriate to grab the correct rubric&lt;br /&gt;
*** FILE: (many)&lt;br /&gt;
&lt;br /&gt;
* Support the ability to determine if an assignment has rubrics that vary by topic&lt;br /&gt;
** PROBLEM: There is no handy method to call that can tell us if an assignment has rubrics that vary by topic&lt;br /&gt;
*** SOLUTION: Add a new method ''varying_rubrics_by_topic?'' based on the existing method ''varying_rubrics_by_round?''&lt;br /&gt;
*** FILE: ''app/models/assignment.rb''&lt;br /&gt;
&lt;br /&gt;
=== Q&amp;amp;A ===&lt;br /&gt;
&lt;br /&gt;
Here we paraphrase some questions we received during round 1 of the documentation review.&lt;br /&gt;
&lt;br /&gt;
* Q: How will the new logic for varying rubric by topic tie in with the existing logic?&lt;br /&gt;
** A: We will add a new field ''topic_id'' into the existing table ''assignment_questionnaires'', as noted in the [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Entity_Relationship_Diagram E/R Diagram].  We will update methods that find questionnaires to allow these methods to also accept a ''topic_id'' argument, as noted in [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Implementation Implementation].&lt;br /&gt;
* Q: How will the &amp;quot;Rubric varies by topic&amp;quot; selection be stored?&lt;br /&gt;
** A: Indirectly, by saving records in the ''assignment_questionnaires'' table which either reference a ''topic_id'' or leave this field nil.  For more details please see the [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Entity_Relationship_Diagram E/R Diagram] discussion.&lt;br /&gt;
* Q: What will happen if an instructor selects &amp;quot;Rubric varies by topic&amp;quot;, makes selections on the &amp;quot;Topics&amp;quot; tab, and then deselects &amp;quot;Rubric varies by topic&amp;quot;?&lt;br /&gt;
** A: The Topics tab, when next visited, will no longer show dropdowns for selecting rubrics by topic.  When the assignment is saved, the appropriate not-varying-by-topic records will be saved in the ''assignment_questionnaires'' table.  For more details please see [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Implementation Implementation].&lt;br /&gt;
* Q: What will happen after an instructor selects &amp;quot;Rubric varies by topic&amp;quot;?&lt;br /&gt;
** A: The Topics tab, when next visited, will now show dropdowns for selecting rubrics by topic.  These rubrics will default to those shown on the Rubrics tab.  When the assignment is saved, the appropriate varying-by-topic records will be saved in the ''assignment_questionnaires'' table.  For more details please see [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Implementation Implementation].&lt;br /&gt;
* Q: How will the appropriate list of questionnaires for the new dropdowns on the Topics tab be determined?&lt;br /&gt;
** A: In the same way that the appropriate list of questionnaires for the existing dropdowns on the Rubrics tab is determined.  Namely, by the ''questionnaire_options'' method in the file ''expertiza/app/helpers/assignment_helper.rb''.&lt;br /&gt;
&lt;br /&gt;
=== (Selected) Modified Code ===&lt;br /&gt;
&lt;br /&gt;
In this section, we provide ''selected portions'' of modified code to illustrate how we implemented the new feature.&lt;br /&gt;
&lt;br /&gt;
Allow an instructor to indicate that rubric should vary by topic&lt;br /&gt;
&lt;br /&gt;
''app\views\assignments\edit\_rubrics.html.erb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;lt;input name=&amp;quot;vary_by_topic&amp;quot; type=&amp;quot;hidden&amp;quot; value=&amp;quot;false&amp;quot; /&amp;gt;&lt;br /&gt;
  &amp;lt;%= check_box_tag('vary_by_topic', 'true', @review_vary_by_topic_check) %&amp;gt;&lt;br /&gt;
  &amp;lt;%= label_tag('vary_by_topic', 'Review rubric varies by topic?') %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Allow an instructor to choose different rubrics for different topics&lt;br /&gt;
&lt;br /&gt;
''app\views\sign_up_sheet\_table_line.html.erb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;lt;% if @assignment_form.assignment.varying_rubrics_by_topic? %&amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;table id = &amp;lt;%=table_id %&amp;gt;&amp;gt;&lt;br /&gt;
        &amp;lt;tr&amp;gt;&lt;br /&gt;
          &amp;lt;script&amp;gt;&lt;br /&gt;
              ...&lt;br /&gt;
              &amp;lt;% if @assignment_form.assignment.varying_rubrics_by_round? %&amp;gt;&lt;br /&gt;
                &amp;lt;% for round in 1..@assignment_form.assignment.rounds_of_reviews %&amp;gt;&lt;br /&gt;
                  ...&lt;br /&gt;
                &amp;lt;% end %&amp;gt;&lt;br /&gt;
              &amp;lt;% else %&amp;gt;&lt;br /&gt;
                ...&lt;br /&gt;
              &amp;lt;% end %&amp;gt;&lt;br /&gt;
          &amp;lt;/script&amp;gt;&lt;br /&gt;
        &amp;lt;/tr&amp;gt;&lt;br /&gt;
      &amp;lt;/table&amp;gt;&lt;br /&gt;
    &amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Support the ability of the database to link rubrics to topics&lt;br /&gt;
&lt;br /&gt;
''app\models\sign_up_topic.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  class SignUpTopic &amp;lt; ActiveRecord::Base&lt;br /&gt;
    ...&lt;br /&gt;
    has_many :assignment_questionnaires, class_name: 'AssignmentQuestionnaire', foreign_key: 'topic_id', dependent: :destroy&lt;br /&gt;
    ...&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
React to an instructor saving an assignment after altering the rubrics-vary-by-topic checkbox&lt;br /&gt;
&lt;br /&gt;
''app/controllers/assignments_controller.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def update&lt;br /&gt;
    ...&lt;br /&gt;
    # What to do next depends on how we got here&lt;br /&gt;
    if params['button'].nil?&lt;br /&gt;
      # REFRESH the topics tab after changing tabs&lt;br /&gt;
      ...&lt;br /&gt;
      render :partial =&amp;gt; &amp;quot;assignments/edit/topics&amp;quot;&lt;br /&gt;
    else&lt;br /&gt;
      # SAVE button was used (do a redirect)&lt;br /&gt;
      redirect_to edit_assignment_path @assignment_form.assignment.id&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Support the ability to find the correct rubric for a particular topic&lt;br /&gt;
&lt;br /&gt;
''app/helpers/assignment_helper.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def assignment_questionnaire(assignment, questionnaire_type, round_number = nil, topic_id = nil)&lt;br /&gt;
    q_by_type = assignment.questionnaires.find_by(type: questionnaire_type)&lt;br /&gt;
    if q_by_type.nil?&lt;br /&gt;
      ...&lt;br /&gt;
    else&lt;br /&gt;
      ...&lt;br /&gt;
      aq_by_type = assignment.assignment_questionnaires.find_by(questionnaire_id: q_by_type.id)&lt;br /&gt;
      if round_number.nil? &amp;amp;&amp;amp; topic_id.nil?&lt;br /&gt;
        # Find by type&lt;br /&gt;
        aq = aq_by_type&lt;br /&gt;
      elsif topic_id.nil?&lt;br /&gt;
        # Find by round&lt;br /&gt;
        aq = assignment.assignment_questionnaires.find_by(used_in_round: round_number)&lt;br /&gt;
      elsif round_number.nil?&lt;br /&gt;
        # Find by topic&lt;br /&gt;
        aq = assignment.assignment_questionnaires.find_by(topic_id: topic_id)&lt;br /&gt;
      else&lt;br /&gt;
        # Find by round and topic&lt;br /&gt;
        aq = assignment.assignment_questionnaires.where(used_in_round: round_number, topic_id: topic_id).first&lt;br /&gt;
      end&lt;br /&gt;
      aq.nil? ? aq_by_type : aq&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use the correct rubric for a particular topic&lt;br /&gt;
&lt;br /&gt;
''app\controllers\response_controller.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def set_questionnaire_for_new_response&lt;br /&gt;
    case @map.type&lt;br /&gt;
    when &amp;quot;ReviewResponseMap&amp;quot;, &amp;quot;SelfReviewResponseMap&amp;quot;&lt;br /&gt;
      reviewees_topic = SignedUpTeam.topic_id_by_team_id(@contributor.id)&lt;br /&gt;
      @current_round = @assignment.number_of_current_round(reviewees_topic)&lt;br /&gt;
      @questionnaire = @map.questionnaire(@current_round, reviewees_topic)&lt;br /&gt;
    when&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Support the ability to determine if an assignment has rubrics that vary by topic&lt;br /&gt;
&lt;br /&gt;
''app\models\assignment.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def varying_rubrics_by_topic?&lt;br /&gt;
    aq_no_topic_id = AssignmentQuestionnaire.where(assignment_id: self.id, topic_id: nil).size &amp;gt;= 1&lt;br /&gt;
    aq_with_topic_id = AssignmentQuestionnaire.where(assignment_id: self.id).where.not(topic_id: nil).size &amp;gt;= 1&lt;br /&gt;
    if !aq_no_topic_id &amp;amp;&amp;amp; !aq_with_topic_id&lt;br /&gt;
      return false&lt;br /&gt;
    elsif aq_no_topic_id &amp;amp;&amp;amp; !aq_with_topic_id&lt;br /&gt;
      return false&lt;br /&gt;
    elsif !aq_no_topic_id &amp;amp;&amp;amp; aq_with_topic_id&lt;br /&gt;
      return true&lt;br /&gt;
    else&lt;br /&gt;
      raise StandardError.new(&amp;quot;Assignment with id &amp;quot; + self.id.to_s + &amp;quot; has a conflict about whether or not it varies by topic&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== How To ==&lt;br /&gt;
&lt;br /&gt;
In this section, we describe how to use the newly implemented feature.&lt;br /&gt;
&lt;br /&gt;
=== Add a New Rubric ===&lt;br /&gt;
&lt;br /&gt;
* [to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
=== Select a Rubric for a Topic ===&lt;br /&gt;
&lt;br /&gt;
* [to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
== Project Testing ==&lt;br /&gt;
&lt;br /&gt;
=== Strategy ===&lt;br /&gt;
&lt;br /&gt;
To test code implementation, correctness of the added feature, verify that the team did not break any existing functionalities in the Expertiza, and ensure that no bugs were introduced in the code, we developed the following Test Strategy:&lt;br /&gt;
&lt;br /&gt;
# Code inspection&lt;br /&gt;
# Run and pass existing RSpec Tests&lt;br /&gt;
# Develop New RSpec Tests&lt;br /&gt;
# Run through live UI to test a feature using Expertiza instance&lt;br /&gt;
&lt;br /&gt;
=== Rspec Testing ===&lt;br /&gt;
&lt;br /&gt;
==== Existing Tests ====&lt;br /&gt;
&lt;br /&gt;
Run all existing RSpec tests on any changed files, after our changes, to ensure that we have not introduced any failures.&lt;br /&gt;
The commands and results are shown below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
e@ubuntu:~/Desktop/CSC517_HW04/expertiza$ bundle exec rspec spec/helpers/ spec/controllers/ spec/models/&lt;br /&gt;
[Coveralls] Set up the SimpleCov formatter.&lt;br /&gt;
[Coveralls] Using SimpleCov's 'rails' settings.&lt;br /&gt;
&lt;br /&gt;
Randomized with seed 6978&lt;br /&gt;
[...]&lt;br /&gt;
&lt;br /&gt;
Finished in 8 minutes 10 seconds (files took 12.32 seconds to load)&lt;br /&gt;
900 examples, 0 failures, 16 pending&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The features tests were extremely time-consuming so we did not routinely run them during development.  However TravisCI results on our [https://github.com/expertiza/expertiza/pull/1444 Pull Request] demonstrate the passing status of all tests.&lt;br /&gt;
&lt;br /&gt;
==== New Tests ====&lt;br /&gt;
&lt;br /&gt;
Write comprehensive RSpec tests, for all new or modified methods.&lt;br /&gt;
* FILE: ''spec/helpers/assignment_helper_spec.rb''&lt;br /&gt;
** METHODS TO TEST: &lt;br /&gt;
*** questionnaire(assignment, type, round_number, topic_id)&lt;br /&gt;
*** assignment_questionnaire(assignment, type, number, topic_id)&lt;br /&gt;
* FILE: ''spec/models/review_response_map_spec.rb''&lt;br /&gt;
*** METHODS TO TEST:&lt;br /&gt;
**** questionnaire(round, topic_id)&lt;br /&gt;
* FILE: ''spec/models/self_review_response_map_spec.rb''&lt;br /&gt;
*** METHODS TO TEST:&lt;br /&gt;
**** questionnaire(round, topic_id)&lt;br /&gt;
* FILE: ''spec/models/assignment_spec.rb''&lt;br /&gt;
*** METHODS TO TEST:&lt;br /&gt;
**** review_questionnaire_id(round, topic_id)&lt;br /&gt;
**** varying_rubrics_by_topic?()&lt;br /&gt;
&lt;br /&gt;
Run these tests, to ensure that the new code works as intended.&lt;br /&gt;
The commands and results are shown below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
e@ubuntu:~/Desktop/CSC517_HW04/expertiza$ bundle exec rspec spec/helpers/assignment_helper_spec.rb spec/models/review_response_map_spec.rb spec/models/self_review_response_map_spec.rb spec/models/assignment_spec.rb &lt;br /&gt;
[Coveralls] Set up the SimpleCov formatter.&lt;br /&gt;
[Coveralls] Using SimpleCov's 'rails' settings.&lt;br /&gt;
&lt;br /&gt;
Randomized with seed 47508&lt;br /&gt;
....................................................................................................................&lt;br /&gt;
&lt;br /&gt;
Finished in 1 minute 7.94 seconds (files took 10.85 seconds to load)&lt;br /&gt;
116 examples, 0 failures&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The test suite for a single new method is shown below.&lt;br /&gt;
* There are many such suites added in expertiza/spec  &lt;br /&gt;
* This example illustrates our general strategy:&lt;br /&gt;
** test missing input&lt;br /&gt;
** test bad input&lt;br /&gt;
** test various acceptable forms of input&lt;br /&gt;
** test scenarios that lead to various return values&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  describe &amp;quot;#questionnaire&amp;quot; do&lt;br /&gt;
&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;throws exception if assignment argument nil&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;throws exception if all arguments nil except for assignment&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;finds by type if round number &amp;amp; topic id not given&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;throws exception if round number &amp;amp; topic id not given, no luck finding by type&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;finds by round number alone if round number alone is given&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;creates new questionnaire of given type if round number alone is given, no luck finding by round&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;finds by topic id alone if topic id alone is given&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;creates new questionnaire of given type if topic id alone is given, no luck finding by topic&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;finds by round number and topic id if both are given&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;creates new questionnaire of given type if round and topic are given, no luck finding by round and topic&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== UI Testing ===&lt;br /&gt;
&lt;br /&gt;
Here we describe manual UI Testing that was performed.&lt;br /&gt;
&lt;br /&gt;
==== Rubric does not vary by round or by topic ====&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
==== Rubric varies by round, but not by topic ====&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
==== Rubric varies by topic, but not by round ====&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
==== Rubric varies by both round and topic ====&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
In CSC/ECE 517, there are several types of topics that could be covered in a single class assignment.  However, currently we can only specify one kind of rubric for an assignment. This means that teams working on different topics will be evaluated using the same rubric. With this setup, it's not possible to fine-tune rubrics for different topics - rubrics tend to be overly general.&lt;br /&gt;
&lt;br /&gt;
In this project, we have solved this issue, by allowing rubrics to vary not only by round, but also by topic. This allows more flexibility to the instructor when setting up an assignment, so that they can use rubrics better suited to the tasks that students are performing in an assignment.  The following scenarios will be possible, and the instructor will be the judge of which scenario is the best fit to the assignment:&lt;br /&gt;
&lt;br /&gt;
* Rubric does not vary by round or by topic.&lt;br /&gt;
* Rubric varies by round, but not by topic.&lt;br /&gt;
* Rubric varies by topic, but not by round.&lt;br /&gt;
* Rubric varies by both round and topic.&lt;br /&gt;
&lt;br /&gt;
The instructor may use the Rubrics tab of the assignments edit page to make changes to the &amp;quot;Review rubric varies by round?&amp;quot; and &amp;quot;Review rubric varies by topic?&amp;quot; checkboxes.  The instructor may then use the Topics tab to select the appropriate rubric(s) for every topic in the assignment.&lt;br /&gt;
&lt;br /&gt;
Various other Expertiza code has been updated to retrieve the correct rubric depending on round and topic after the instructor has made these selections.&lt;br /&gt;
&lt;br /&gt;
== Future Work ==&lt;br /&gt;
&lt;br /&gt;
This section discusses possible future work for another CSC 517 team to take on.  Such a team can search the Expertiza codebase for &amp;quot;TODO E1936 (future work)&amp;quot; to find most of the places in the code that the notes below refer to.&lt;br /&gt;
&lt;br /&gt;
* Reduce the delay between changing the state of the &amp;quot;Review rubric varies by topic?&amp;quot; checkbox on the Rubrics tab, and the show / hide of rubric drop-downs on the Topics tab.&lt;br /&gt;
* Redesign UI for tone analysis, heatmaps, and review scores pop-up.  These areas are designed around the assumption that reviews do NOT vary by topic.  For example, in the review scores pop-up, a reviewer can see the reviews they have given, arranged by question, across multiple reviewees.&lt;br /&gt;
* Consider whether the questionnaire options available for selection in drop-downs on the Topics and Rubrics tabs should include ''only'' those questionnaires created by the currently-logged-in instructor.  Our work in this project changed the filtering from instructor-owning-assignment to currently-logged-in instructor - but left in place all non-private questionnaires.  ''Consider'' whether non-private questionnaires should be excluded.  This may result in some drop-downs not having any available questionnaires.&lt;br /&gt;
&lt;br /&gt;
== Useful Links ==&lt;br /&gt;
In this section we provide useful links related to the work that has been completed by our team.&lt;br /&gt;
# [https://github.com/gabalmat/expertiza Forked Project Repository]&lt;br /&gt;
# [https://github.com/expertiza/expertiza/pull/1444 Pull Request]&lt;br /&gt;
# [(add link here) Video Demonstration of Specialized Rubrics]&lt;br /&gt;
# [(add link here) Video Demonstration of Passing Rspec Tests]&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Contacts ===&lt;br /&gt;
We have 4 (four) members in our team and 1 (one) mentor was also assigned to us. For any project-related questions/concerns please contact us:&lt;br /&gt;
* Aurora Tiffany-Davis - attiffan@ncsu.edu&lt;br /&gt;
* Ginger Balmat - gabalmat@ncsu.edu&lt;br /&gt;
* Joe Hutchinson - jehutch3@ncsu.edu&lt;br /&gt;
* Nikolay Titov - ngtitov@ncsu.edu&lt;br /&gt;
* Zhewei Hu (mentor) - zhu6@ncsu.edu&lt;br /&gt;
&lt;br /&gt;
=== Contribution Based Inquiry ===&lt;br /&gt;
For any questions or concerns related to the project design, implementation, testing of the feature developed by our team, please contact an engineer who worked closely on the topic of your interest based on the [https://docs.google.com/spreadsheets/d/11uxuI_5gaC-FQDwIOxtCaN3HZ9bfWDJgIjFemtYV5jE/edit?ts=5ca222f3#gid=0 Contribution Assignment Grid] we created to keep track of our progress and contribution. Please carbon copy all team members and our mentor in the email.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* Expertiza Web [https://github.com/expertiza/expertiza#expertiza]&lt;br /&gt;
* Expertiza on GitHub [https://github.com/expertiza/expertiza]&lt;br /&gt;
* Expertiza Wiki [http://wikis.lib.ncsu.edu/index.php/Expertiza]&lt;br /&gt;
* Rspec Documentation [https://relishapp.com/rspec]&lt;br /&gt;
* Wiki with Previous Work [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1873_Specialized_rubics_for_different_topic_types]&lt;br /&gt;
* Pull Request of the Previous Work [https://github.com/expertiza/expertiza/pull/1327]&lt;/div&gt;</summary>
		<author><name>Ngtitov</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics&amp;diff=124446</id>
		<title>E1936 Specialized Rubrics</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics&amp;diff=124446"/>
		<updated>2019-04-26T14:36:15Z</updated>

		<summary type="html">&lt;p&gt;Ngtitov: /* Class Diagram */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page describes the work and goals that have been completed and achieved while implementing Expertiza Project &amp;quot;''E1936. Specialized Rubrics for Different Topic Types (e.g., Servo project, refactoring project)''&amp;quot; for the CSC/ECE 517 &amp;quot;Object-Oriented Design and Development&amp;quot; class, in the Spring semester of the 2019.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This Wiki page is created per CSC/ECE 517: &amp;quot;Object-Oriented Design and Development&amp;quot;, Expertiza Project requirements (Spring, 2019).&lt;br /&gt;
&lt;br /&gt;
Our [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Team team] was assigned the project &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936. Specialized rubrics for different topic types (e.g., Servo project, refactoring project)]&amp;quot;.  This is an Expertiza project.&lt;br /&gt;
&lt;br /&gt;
In this wiki page we describe the problem to be solved, how we solve that problem, and how we test our solution.  We also provide helpful links and contact information for our team.&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
In this section, we discuss the problem we need to solve, the Expertiza feature this problem is related to, what needs to be done to solve the problem (at a high level), and the previous attempt to solve this problem.&lt;br /&gt;
&lt;br /&gt;
=== Problem Statement ===&lt;br /&gt;
&lt;br /&gt;
This problem statement summarizes the problem as described in the project description &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936. Specialized rubrics for different topic types (e.g., Servo project, refactoring project)]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
In CSC/ECE 517, there are several types of topics that could be covered in a single class assignment.&lt;br /&gt;
* Code base&lt;br /&gt;
** Expertiza&lt;br /&gt;
** Mozilla&lt;br /&gt;
** etc.&lt;br /&gt;
* Goal&lt;br /&gt;
** Refactoring&lt;br /&gt;
** Testing&lt;br /&gt;
** etc.&lt;br /&gt;
However, currently we can only specify one kind of rubric for an assignment.  This means that teams working on different topics will be evaluated using the same rubric.  With this setup, it's not possible to fine-tune rubrics for different topics - rubrics tend to be overly general.&lt;br /&gt;
&lt;br /&gt;
=== Feature Description ===&lt;br /&gt;
&lt;br /&gt;
The Expertiza project already has a feature that allows rubrics to vary by project phase or &amp;quot;round&amp;quot;.  The feature we will add in this project is a feature to allow rubrics to vary not only by round, but also by topic.  This allows more flexibility to the instructor when setting up an assignment, so that they can use rubrics better suited to the tasks that students are performing in an assignment.&lt;br /&gt;
&lt;br /&gt;
When this feature is complete, the following scenarios will be possible, and the instructor will be the judge of which scenario is the best fit to the assignment:&lt;br /&gt;
&lt;br /&gt;
* Rubric does not vary by round or by topic.&lt;br /&gt;
* Rubric varies by round, but not by topic.&lt;br /&gt;
* Rubric varies by topic, but not by round.&lt;br /&gt;
* Rubric varies by both round and topic.&lt;br /&gt;
&lt;br /&gt;
=== What Needs to be Done ===&lt;br /&gt;
&lt;br /&gt;
This section summarizes the work as described in the project description &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936. Specialized rubrics for different topic types (e.g., Servo project, refactoring project)]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* In assignment#edit page &amp;quot;Rubrics&amp;quot; tab, add a checkbox to specify whether rubric should vary by topic.&lt;br /&gt;
* In assignment#edit page &amp;quot;Topics&amp;quot; tab, add dropdown(s) next to each topic to specify which rubric(s) are associated with the topic.&lt;br /&gt;
** The dropdown(s) should appear only if rubric should vary by topic, per the Rubrics tab.&lt;br /&gt;
** The topic should have a multiple dropdowns (one for each round) only if rubrics vary by round, per the Rubrics tab.&lt;br /&gt;
** By default, the rubric(s) for each course project will be the one(s) specified in “Rubrics” tab.&lt;br /&gt;
** The dropdown value can overwrite the default rubric.&lt;br /&gt;
* Be careful when making changes to the code&lt;br /&gt;
** The signup_sheet_controller should have as little to do as possible with the selection of rubrics.&lt;br /&gt;
** Anything not germane to selecting topics should be in another controller or (more probably) a helper.&lt;br /&gt;
* Create a DB migration to allow rubric to vary by topic as well as by round.&lt;br /&gt;
&lt;br /&gt;
==== Screenshots ====&lt;br /&gt;
'''Current screenshot of Rubrics tab for an Assignment'''&lt;br /&gt;
(need to add a checkbox to indicate that rubric should vary by topic)&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Screenshot Assignment Edit Rubrics.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Current screenshot of Topics tab for an Assignment'''&lt;br /&gt;
(need to add a way to select rubrics for particular topics)&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Screenshot Assignment Edit Topics.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Proposed screenshot of Rubrics tab for an Assignment'''&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Specialized Rubric rubric checkbox.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Proposed screenshot of Topics tab for an Assignment'''&lt;br /&gt;
&lt;br /&gt;
(drop down shown for only one topic here, but final product will have one for each topic)&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Specialized Rubric dropdown menu.png]]&lt;br /&gt;
&lt;br /&gt;
== Previous Work ==&lt;br /&gt;
&lt;br /&gt;
There was previous attempt to implement this project in the Fall of 2018 semester by different team, but it was rejected due to several reasons. Our team was provided with all relevant information and materials about the design and implementation of the previously attempted project. We would like to acknowledge that we use previous implementation and design as reference and our starting point for our own implementation. The following is the list of links with the relevant materials that we have used for better project understanding, determining pros and cons of previously proposed changes, and establishing our design strategy and implementation:&lt;br /&gt;
&lt;br /&gt;
# [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1873_Specialized_rubics_for_different_topic_types Wiki]&lt;br /&gt;
# [https://github.com/expertiza/expertiza/pull/1327 Pull Request]&lt;br /&gt;
# [https://drive.google.com/file/d/1UrLb0Ula_Lb_F4MOrdC-s6xng6B08VYu/view Video Demo]&lt;br /&gt;
&lt;br /&gt;
After reviewing all relevant materials above, we concluded that the project implementation was incomplete and proposed design had significant flaw. &lt;br /&gt;
We identified main drawbacks and flaw as follows:&lt;br /&gt;
&lt;br /&gt;
* Establishing incorrect ''many-to-one'' relationship between ''sign_up_topics'' and ''questionnaires'' tables:&lt;br /&gt;
** Creating a DB migration to add ''questionnaire_id'' in the ''sign_up_topics'' table to store the dropdown data presumes ''one-to-one'' or ''many-to-one'' relationship between ''sign_up_topics'' and ''questionnaires'' tables&lt;br /&gt;
** Correct relationship between ''sign_up_topics'' and ''questionnaires'' tables is ''many-to-many''. For example, each project topic may have various rubrics depending on the round it is used (e.g., for round 1, topic may have one rubric; but for round 2, the same topic may have different rubric)&lt;br /&gt;
** Proposed previous migration changes would break DB design and would not allow to store correctly topic and its associated rubric per different round.&lt;br /&gt;
* Per project requirement specifications, &amp;quot;''The dropdown box should appear only if 'Vary rubric by topic' is selected in the Rubrics tab.''&amp;quot; This requirement was not met and ''Vary rubric by topic'' checkbox in the Rubrics tab was not implemented. Therefore, dropdown box with the list of rubrics appears regardless of whether &amp;quot;''Vary rubric by topic''&amp;quot; is selected or not.&lt;br /&gt;
* The dropdown box includes the list of all possible rubrics including default value. However, this condition can be improved. The dropdown box should list the rubrics that were created by the current user (professor who is logged in). This would allow to shorten the list of possible rubrics dramatically and help to avoid any misunderstanding and confusion while user selects desired rubric for the course project.&lt;br /&gt;
&lt;br /&gt;
We found no further issues with the rest implementation and in other project materials. Wiki page is very useful for understanding design of proposed changes, finding drawbacks and the flaw. Considering all the pros and cons, and taking into account drawbacks of the proposed changes, our team evolved different approach that should successfully solve the problem stated for the project without without creating additional issues. Please see our [http://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics#Project_Implementation Project Implementation] for more details.&lt;br /&gt;
&lt;br /&gt;
== Previous Project Requirements ==&lt;br /&gt;
&lt;br /&gt;
The project requirements originally specified how to alter the databases to support varying rubrics by topic.&lt;br /&gt;
&lt;br /&gt;
''Create a new table named topic_questionnaires with field:''&lt;br /&gt;
* ''id''&lt;br /&gt;
* ''topic_id''&lt;br /&gt;
* ''questionnaire_id''&lt;br /&gt;
* ''used_in_round''&lt;br /&gt;
&lt;br /&gt;
However, the E1936 team successfully petitioned for this requirement to change to give us more freedom in the implementation.  The original suggestion had a flaw.  There is already an existing table in the Expertiza project called ''assignment_questionnaires'', which has columns including ''assignment_id'', ''questionnaire_id'', and ''used_in_round''.  It is this table that maintains the knowledge of which rubric is used in which round of an assignment.  If we were to add a new table to maintains the knowledge of which rubric is used in which topic of an assignment as originally suggested, then we would have a big problem.  Knowledge of round-rubric relationship is duplicated.  This would lead (best case scenario) to extra work, and (worst case scenario) to lots of bugs caused by inconsistencies in how these tables are handled with CRUD operations throughout the code.  In other words, this is not a DRY solution.&lt;br /&gt;
&lt;br /&gt;
== Project Implementation ==&lt;br /&gt;
&lt;br /&gt;
In this section, we propose our solution to the problem, discuss implementation techniques and details, and list the goals we achieved.&lt;br /&gt;
&lt;br /&gt;
We start by analyzing Entity Relationship Diagram where we state the solution to the problem. Further we discuss design strategy by breaking project problem into multiple staged sub-problems and provide solutions for each of these sub-problems. We also discuss some implementation details and provide the list of involved files. Finally, we demonstrate how the implemented feature can be used by providing a ''How To'' sub-section.&lt;br /&gt;
&lt;br /&gt;
=== Diagrams ===&lt;br /&gt;
&lt;br /&gt;
Our solution and implementation of the project can be easily shown by discussing Use Case, Entity Relationship, and Class diagrams. First, for simplicity we discuss in general possible sequence of interactions between a user (in this case instructor) and the system (Expertiza) via presenting Use Case Diagram. Then we plan to show proposed database modification via Entity Relationship Diagram.&lt;br /&gt;
&lt;br /&gt;
==== User Case Diagram ====&lt;br /&gt;
&lt;br /&gt;
[[File: use_case_diagram.png]]&lt;br /&gt;
&lt;br /&gt;
The above Use Case Diagram shows general sequence of interactions between an instructor and the system (Expertiza) that defines where and how the feature can be utilized. Note that highlighted use cases are objects of our interest and work. Also please note that all of the shown use cases already exist in the system and we simply adding new feature into the system with existing use cases. Particularly, the rubric for each assignment and newly added ''Review rubric varies by topic'' checkbox with which instructor may choose to vary assignment by topic or not by checking and unchecking the checkbox is displayed in the ''Rubrics'' tab. Hence, we show how instructor can get to the ''Rubrics'' tab of the assignments. Similarly, ''Topics'' tab of assignments has additional ''Questionnaires'' column for each topic, where instructor may specify which rubric associates with the topic. To perform such sequence of iterations and utilize the new feature, instructor must choose ''Edit'' any assignment from the list of all assignments displayed to him/her in the ''Manage Assignments'' boundary, which can be navigated by instructor by selecting it from the header of the page.&lt;br /&gt;
&lt;br /&gt;
==== Entity Relationship Diagram ====&lt;br /&gt;
&lt;br /&gt;
[[File: HW04_ERD.png]]&lt;br /&gt;
&lt;br /&gt;
The sections of the diagram highlighted in yellow show newly introduced items.  That is, we are adding a new column called ''topic_id'' to ''assignment_questionnaires'', in order to link ''assignment_questionnaires'' to ''sign_up_topics''.&lt;br /&gt;
&lt;br /&gt;
Any assignment, topic, or questionnaire may be represented by multiple records within ''assignment_questionnaires'', but each record within ''assignment_questionnaires'' refers to just one assignment, topic, or questionnaire.  It is the ability to have an assignment represented by multiple records, and the new relationship to ''sign_up_topics'', that allows us to support all of the required scenarios:&lt;br /&gt;
&lt;br /&gt;
* Rubric does not vary by round or by topic.&lt;br /&gt;
* Rubric varies by round, but not by topic.&lt;br /&gt;
* Rubric varies by topic, but not by round.&lt;br /&gt;
* Rubric varies by both round and topic.&lt;br /&gt;
&lt;br /&gt;
[[File: HW04_table.PNG]]&lt;br /&gt;
&lt;br /&gt;
This table illustrates the possibilities that the system may have.&lt;br /&gt;
&lt;br /&gt;
* Assignment 1 does not vary by round or by topic.&lt;br /&gt;
* Assignment 2 varies by round, but not by topic.&lt;br /&gt;
* Assignment 3 varies by topic, but not by round.&lt;br /&gt;
* Assignment 4 varies by both round and topic.&lt;br /&gt;
&lt;br /&gt;
This change is done via database migration by running the following commands:&lt;br /&gt;
&lt;br /&gt;
  rails generate migration AddTopicIdToAssignmentQuestionnaires&lt;br /&gt;
&lt;br /&gt;
Above command adds the ''topic_id'' column to the ''AssignmentQuestionnaires'' table and generates new migration file:&lt;br /&gt;
&lt;br /&gt;
[[File: db_migration.png]]&lt;br /&gt;
&lt;br /&gt;
To see the details of the entire database change please check this [https://github.com/gabalmat/expertiza/commit/d46dd57d35a21ab43efb82c28d3f14b75c695f2e commit].&lt;br /&gt;
&lt;br /&gt;
==== Class Diagram ====&lt;br /&gt;
&lt;br /&gt;
[[File: class_diagram.png]]&lt;br /&gt;
&lt;br /&gt;
This is Class Class diagram.&lt;br /&gt;
&lt;br /&gt;
=== Design Strategy ===&lt;br /&gt;
&lt;br /&gt;
As we have concrete understanding of the problem and proposed solution, we would like break this problem into multiple more manageable sub-problems with specific tasks and well-defined solutions to these tasks. Generally, each sub-problem requires modification of one or more files. We would like to propose our Design Strategy as follows:&lt;br /&gt;
&lt;br /&gt;
==== Preparation ====&lt;br /&gt;
&lt;br /&gt;
* Clean up code that our implementation will use&lt;br /&gt;
** PROBLEM: We need to add/change content to the edit assignment Topics tab, but unlike other tabs in the views, it does not have its own partial view to work with&lt;br /&gt;
*** SOLUTION: Refactor and move the code dealing with topics into separate ''app/views/assignments/edit/_topics.html.erb'' file&lt;br /&gt;
*** File: ''app/views/assignments/edit.html.erb''&lt;br /&gt;
** PROBLEM: In a section below, we discuss the need to modify existing methods to also accept an optional argument ''topic_id''.  In many cases these existing method use confusing variable names or lack sufficient comments.&lt;br /&gt;
*** SOLUTION: Clean up methods that we plan to modify&lt;br /&gt;
*** FILE: (many)&lt;br /&gt;
&lt;br /&gt;
==== Implementation ====&lt;br /&gt;
&lt;br /&gt;
* Allow an instructor to indicate that rubric should vary by topic&lt;br /&gt;
** PROBLEM: There is no way for an instructor to indicate that an assignments' rubric should vary by topic&lt;br /&gt;
*** SOLUTION: Add a new checkbox in the edit assignment Rubrics tab to indicate this preference&lt;br /&gt;
*** FILE: ''app/views/assignments/edit/_rubrics.html.erb''&lt;br /&gt;
** PROBLEM: If the user changes the &amp;quot;Review rubric varies by round?&amp;quot; or &amp;quot;Review rubric varies by topic?&amp;quot; checkbox on the Rubrics tab, but leaves the page in an inappropriate state before leaving the tab (e.g. rubric weights that do not add up to 0% or 100%), then the user does not get feedback that they made a mistake.  They only get such feedback when explicitly performing a &amp;quot;Save&amp;quot;.  Switching from tab to tab on the assignments edit page attempts to perform an implicit save, but there is no mechanism to update the flash messages onscreen if anything goes wrong.  This becomes more problematic now that the Topics tab appearance depends on choices made on the Rubrics tab.  &lt;br /&gt;
*** SOLUTION: Provide a route to an assignments controller method that can return a render of the flash messages.  Add an AJAX call on the assignments edit view that can update the flash messages onscreen.&lt;br /&gt;
*** FILE: app/controllers/assignments_controller.rb&lt;br /&gt;
*** FILE: app/views/assignments/edit.html.erb&lt;br /&gt;
&lt;br /&gt;
* Allow an instructor to choose different rubrics for different topics&lt;br /&gt;
** PROBLEM: There is no way for an instructor to choose different rubrics for different topics&lt;br /&gt;
*** SOLUTION: Add a new column in the edit assignment Topics tab for choosing rubric(s)&lt;br /&gt;
**** New column only visible if rubrics vary by topic, per Rubrics tab&lt;br /&gt;
**** New column has multiple rounds per topic only if rubrics vary by round, per Rubrics tab&lt;br /&gt;
**** Default value for any rubric is that rubric which is shown on Rubrics tab&lt;br /&gt;
**** Rubric(s) in the dropdown list is/are only those that were created by the currently logged in instructor&lt;br /&gt;
*** FILE: ''app/views/assignments/edit/_topics.html.erb''&lt;br /&gt;
** PROBLEM: The code in ''app/views/assignments/edit/_rubrics.html.erb'' includes dropdowns like the ones we need to add for topics, but that code is way too complex for its functionality (too heavy for a view, uses JavaScript)&lt;br /&gt;
*** SOLUTION: Use the code in ''app/views/assignments/edit/_rubrics.html.erb'' for inspiration only&lt;br /&gt;
**** Refactor and move as much actual work as possible out into helper methods that are simply called from this view&lt;br /&gt;
**** Views are not intended to do heavy lifting&lt;br /&gt;
**** Use as little JavaScript as possible, since this is a Ruby On Rails project, not a JS project&lt;br /&gt;
*** FILE: ''app/views/assignments/edit/_topics.html.erb''&lt;br /&gt;
** PROBLEM: The drop-downs for selecting rubrics should show only those rubrics created by the currently-logged in instructor (per project mentor).  They currently include those created by the instructor of the relevant assignment.&lt;br /&gt;
*** SOLUTION: Change the filtering in the ''questionnaire_options'' method to reflect the desired filtering.&lt;br /&gt;
*** FILE: app/helpers/assignment_helper.rb&lt;br /&gt;
&lt;br /&gt;
* Support the ability of the database to link rubrics to topics&lt;br /&gt;
** PROBLEM: There is no relationship in the database that can link together rubrics with topics&lt;br /&gt;
*** SOLUTION: Add a new migration that adds topic_id field to existing assignment_questionnaires table&lt;br /&gt;
**** This new field will reference the id field in the sign_up_topics table&lt;br /&gt;
*** FILE: ''db/migrate/[timestamp]_add_topic_id_to_assignment_questionnaires_table.rb''&lt;br /&gt;
** PROBLEM: The AssignmentQuestionnaire model does not have any knowledge of topics&lt;br /&gt;
*** SOLUTION: Add a new belongs_to reference in the model, to sign_up_topic&lt;br /&gt;
*** FILE: ''app/models/assignment_questionnaire.rb''&lt;br /&gt;
** PROBLEM: The SignUpTopic model does not have any knowledge of assignment_questionnaire records&lt;br /&gt;
*** SOLUTION: Add a new has_many reference in the model, to assignment_questionnaires&lt;br /&gt;
*** FILE: ''app/models/sign_up_topic.rb''&lt;br /&gt;
&lt;br /&gt;
* React to an instructor saving an assignment after altering the rubrics-vary-by-topic checkbox&lt;br /&gt;
** PROBLEM: There is nothing in place to remember when an instructor chooses to vary rubrics by topic, or chooses to not vary rubrics by topic&lt;br /&gt;
*** SOLUTION: Modify existing method ''update_assignment_questionnaires()''.  This method executes upon assignment save (explicit or via tab-change).  This method deletes all ''AssignmentQuestionnaire'' records before creating new correct records reflecting the user's selections in the edit assignment form.  Modify such that this method can create multiple records reflecting multiple topics, in the case where rubric should vary by topic.  With this modification, the correct records (with default rubrics) are present when the user goes to the Topics tab, so that the Topics tab can display properly.&lt;br /&gt;
*** FILE: app\models\assignment_form.rb&lt;br /&gt;
** PROBLEM: There is no way to refresh the Topics tab to show / hide drop-downs after the instructor changes checkbox on Rubrics tab&lt;br /&gt;
*** SOLUTION: Make use of existing &amp;quot;Save&amp;quot;-like functionality when changing tabs on the edit assignment page.  When updating due to tab-change, cause a fresh render of the Topics tab.  When updating due to &amp;quot;Save&amp;quot; button, keep functionality as-is.&lt;br /&gt;
*** FILE: ''app/controllers/assignments_controller.rb''&lt;br /&gt;
*** FILE: ''app/views/assignments/edit.html.erb''&lt;br /&gt;
&lt;br /&gt;
* Support the ability to find the correct rubric for a particular topic&lt;br /&gt;
** PROBLEM: The existing methods allow us to find the correct rubric for a particular round, but not a particular topic&lt;br /&gt;
*** SOLUTION: Modify the existing method questionnaire(assignment, type, round_number) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/helpers/assignment_helper.rb''&lt;br /&gt;
*** SOLUTION: Modify the existing method assignment_questionnaire(assignment, type, number) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/helpers/assignment_helper.rb''&lt;br /&gt;
*** SOLUTION: Modify the existing method questionnaire(round = nil) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/models/review_response_map.rb''&lt;br /&gt;
*** SOLUTION: Modify the existing method questionnaire(round) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/models/self_review_response_map.rb''&lt;br /&gt;
*** SOLUTION: Modify the existing method review_questionnaire_id(round = nil) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/models/assignment.rb''&lt;br /&gt;
&lt;br /&gt;
* Use the correct rubric for a particular topic&lt;br /&gt;
** PROBLEM: When finding rubrics to display, save results from, calculate scores from, etc. round may be used but topic is not&lt;br /&gt;
*** SOLUTION: Examine all callers of methods modified in the previous section and pass in ''topic_id'' where appropriate to grab the correct rubric&lt;br /&gt;
*** FILE: (many)&lt;br /&gt;
&lt;br /&gt;
* Support the ability to determine if an assignment has rubrics that vary by topic&lt;br /&gt;
** PROBLEM: There is no handy method to call that can tell us if an assignment has rubrics that vary by topic&lt;br /&gt;
*** SOLUTION: Add a new method ''varying_rubrics_by_topic?'' based on the existing method ''varying_rubrics_by_round?''&lt;br /&gt;
*** FILE: ''app/models/assignment.rb''&lt;br /&gt;
&lt;br /&gt;
=== Q&amp;amp;A ===&lt;br /&gt;
&lt;br /&gt;
Here we paraphrase some questions we received during round 1 of the documentation review.&lt;br /&gt;
&lt;br /&gt;
* Q: How will the new logic for varying rubric by topic tie in with the existing logic?&lt;br /&gt;
** A: We will add a new field ''topic_id'' into the existing table ''assignment_questionnaires'', as noted in the [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Entity_Relationship_Diagram E/R Diagram].  We will update methods that find questionnaires to allow these methods to also accept a ''topic_id'' argument, as noted in [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Implementation Implementation].&lt;br /&gt;
* Q: How will the &amp;quot;Rubric varies by topic&amp;quot; selection be stored?&lt;br /&gt;
** A: Indirectly, by saving records in the ''assignment_questionnaires'' table which either reference a ''topic_id'' or leave this field nil.  For more details please see the [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Entity_Relationship_Diagram E/R Diagram] discussion.&lt;br /&gt;
* Q: What will happen if an instructor selects &amp;quot;Rubric varies by topic&amp;quot;, makes selections on the &amp;quot;Topics&amp;quot; tab, and then deselects &amp;quot;Rubric varies by topic&amp;quot;?&lt;br /&gt;
** A: The Topics tab, when next visited, will no longer show dropdowns for selecting rubrics by topic.  When the assignment is saved, the appropriate not-varying-by-topic records will be saved in the ''assignment_questionnaires'' table.  For more details please see [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Implementation Implementation].&lt;br /&gt;
* Q: What will happen after an instructor selects &amp;quot;Rubric varies by topic&amp;quot;?&lt;br /&gt;
** A: The Topics tab, when next visited, will now show dropdowns for selecting rubrics by topic.  These rubrics will default to those shown on the Rubrics tab.  When the assignment is saved, the appropriate varying-by-topic records will be saved in the ''assignment_questionnaires'' table.  For more details please see [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Implementation Implementation].&lt;br /&gt;
* Q: How will the appropriate list of questionnaires for the new dropdowns on the Topics tab be determined?&lt;br /&gt;
** A: In the same way that the appropriate list of questionnaires for the existing dropdowns on the Rubrics tab is determined.  Namely, by the ''questionnaire_options'' method in the file ''expertiza/app/helpers/assignment_helper.rb''.&lt;br /&gt;
&lt;br /&gt;
=== (Selected) Modified Code ===&lt;br /&gt;
&lt;br /&gt;
In this section, we provide ''selected portions'' of modified code to illustrate how we implemented the new feature.&lt;br /&gt;
&lt;br /&gt;
Allow an instructor to indicate that rubric should vary by topic&lt;br /&gt;
&lt;br /&gt;
''app\views\assignments\edit\_rubrics.html.erb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;lt;input name=&amp;quot;vary_by_topic&amp;quot; type=&amp;quot;hidden&amp;quot; value=&amp;quot;false&amp;quot; /&amp;gt;&lt;br /&gt;
  &amp;lt;%= check_box_tag('vary_by_topic', 'true', @review_vary_by_topic_check) %&amp;gt;&lt;br /&gt;
  &amp;lt;%= label_tag('vary_by_topic', 'Review rubric varies by topic?') %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Allow an instructor to choose different rubrics for different topics&lt;br /&gt;
&lt;br /&gt;
''app\views\sign_up_sheet\_table_line.html.erb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;lt;% if @assignment_form.assignment.varying_rubrics_by_topic? %&amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;table id = &amp;lt;%=table_id %&amp;gt;&amp;gt;&lt;br /&gt;
        &amp;lt;tr&amp;gt;&lt;br /&gt;
          &amp;lt;script&amp;gt;&lt;br /&gt;
              ...&lt;br /&gt;
              &amp;lt;% if @assignment_form.assignment.varying_rubrics_by_round? %&amp;gt;&lt;br /&gt;
                &amp;lt;% for round in 1..@assignment_form.assignment.rounds_of_reviews %&amp;gt;&lt;br /&gt;
                  ...&lt;br /&gt;
                &amp;lt;% end %&amp;gt;&lt;br /&gt;
              &amp;lt;% else %&amp;gt;&lt;br /&gt;
                ...&lt;br /&gt;
              &amp;lt;% end %&amp;gt;&lt;br /&gt;
          &amp;lt;/script&amp;gt;&lt;br /&gt;
        &amp;lt;/tr&amp;gt;&lt;br /&gt;
      &amp;lt;/table&amp;gt;&lt;br /&gt;
    &amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Support the ability of the database to link rubrics to topics&lt;br /&gt;
&lt;br /&gt;
''app\models\sign_up_topic.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  class SignUpTopic &amp;lt; ActiveRecord::Base&lt;br /&gt;
    ...&lt;br /&gt;
    has_many :assignment_questionnaires, class_name: 'AssignmentQuestionnaire', foreign_key: 'topic_id', dependent: :destroy&lt;br /&gt;
    ...&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
React to an instructor saving an assignment after altering the rubrics-vary-by-topic checkbox&lt;br /&gt;
&lt;br /&gt;
''app/controllers/assignments_controller.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def update&lt;br /&gt;
    ...&lt;br /&gt;
    # What to do next depends on how we got here&lt;br /&gt;
    if params['button'].nil?&lt;br /&gt;
      # REFRESH the topics tab after changing tabs&lt;br /&gt;
      ...&lt;br /&gt;
      render :partial =&amp;gt; &amp;quot;assignments/edit/topics&amp;quot;&lt;br /&gt;
    else&lt;br /&gt;
      # SAVE button was used (do a redirect)&lt;br /&gt;
      redirect_to edit_assignment_path @assignment_form.assignment.id&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Support the ability to find the correct rubric for a particular topic&lt;br /&gt;
&lt;br /&gt;
''app/helpers/assignment_helper.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def assignment_questionnaire(assignment, questionnaire_type, round_number = nil, topic_id = nil)&lt;br /&gt;
    q_by_type = assignment.questionnaires.find_by(type: questionnaire_type)&lt;br /&gt;
    if q_by_type.nil?&lt;br /&gt;
      ...&lt;br /&gt;
    else&lt;br /&gt;
      ...&lt;br /&gt;
      aq_by_type = assignment.assignment_questionnaires.find_by(questionnaire_id: q_by_type.id)&lt;br /&gt;
      if round_number.nil? &amp;amp;&amp;amp; topic_id.nil?&lt;br /&gt;
        # Find by type&lt;br /&gt;
        aq = aq_by_type&lt;br /&gt;
      elsif topic_id.nil?&lt;br /&gt;
        # Find by round&lt;br /&gt;
        aq = assignment.assignment_questionnaires.find_by(used_in_round: round_number)&lt;br /&gt;
      elsif round_number.nil?&lt;br /&gt;
        # Find by topic&lt;br /&gt;
        aq = assignment.assignment_questionnaires.find_by(topic_id: topic_id)&lt;br /&gt;
      else&lt;br /&gt;
        # Find by round and topic&lt;br /&gt;
        aq = assignment.assignment_questionnaires.where(used_in_round: round_number, topic_id: topic_id).first&lt;br /&gt;
      end&lt;br /&gt;
      aq.nil? ? aq_by_type : aq&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use the correct rubric for a particular topic&lt;br /&gt;
&lt;br /&gt;
''app\controllers\response_controller.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def set_questionnaire_for_new_response&lt;br /&gt;
    case @map.type&lt;br /&gt;
    when &amp;quot;ReviewResponseMap&amp;quot;, &amp;quot;SelfReviewResponseMap&amp;quot;&lt;br /&gt;
      reviewees_topic = SignedUpTeam.topic_id_by_team_id(@contributor.id)&lt;br /&gt;
      @current_round = @assignment.number_of_current_round(reviewees_topic)&lt;br /&gt;
      @questionnaire = @map.questionnaire(@current_round, reviewees_topic)&lt;br /&gt;
    when&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Support the ability to determine if an assignment has rubrics that vary by topic&lt;br /&gt;
&lt;br /&gt;
''app\models\assignment.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def varying_rubrics_by_topic?&lt;br /&gt;
    aq_no_topic_id = AssignmentQuestionnaire.where(assignment_id: self.id, topic_id: nil).size &amp;gt;= 1&lt;br /&gt;
    aq_with_topic_id = AssignmentQuestionnaire.where(assignment_id: self.id).where.not(topic_id: nil).size &amp;gt;= 1&lt;br /&gt;
    if !aq_no_topic_id &amp;amp;&amp;amp; !aq_with_topic_id&lt;br /&gt;
      return false&lt;br /&gt;
    elsif aq_no_topic_id &amp;amp;&amp;amp; !aq_with_topic_id&lt;br /&gt;
      return false&lt;br /&gt;
    elsif !aq_no_topic_id &amp;amp;&amp;amp; aq_with_topic_id&lt;br /&gt;
      return true&lt;br /&gt;
    else&lt;br /&gt;
      raise StandardError.new(&amp;quot;Assignment with id &amp;quot; + self.id.to_s + &amp;quot; has a conflict about whether or not it varies by topic&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== How To ==&lt;br /&gt;
&lt;br /&gt;
In this section, we describe how to use the newly implemented feature.&lt;br /&gt;
&lt;br /&gt;
=== Add a New Rubric ===&lt;br /&gt;
&lt;br /&gt;
* [to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
=== Select a Rubric for a Topic ===&lt;br /&gt;
&lt;br /&gt;
* [to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
== Project Testing ==&lt;br /&gt;
&lt;br /&gt;
=== Strategy ===&lt;br /&gt;
&lt;br /&gt;
To test code implementation, correctness of the added feature, verify that the team did not break any existing functionalities in the Expertiza, and ensure that no bugs were introduced in the code, we developed the following Test Strategy:&lt;br /&gt;
&lt;br /&gt;
# Code inspection&lt;br /&gt;
# Run and pass existing RSpec Tests&lt;br /&gt;
# Develop New RSpec Tests&lt;br /&gt;
# Run through live UI to test a feature using Expertiza instance&lt;br /&gt;
&lt;br /&gt;
=== Rspec Testing ===&lt;br /&gt;
&lt;br /&gt;
==== Existing Tests ====&lt;br /&gt;
&lt;br /&gt;
Run all existing RSpec tests on any changed files, after our changes, to ensure that we have not introduced any failures.&lt;br /&gt;
The commands and results are shown below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
e@ubuntu:~/Desktop/CSC517_HW04/expertiza$ bundle exec rspec spec/helpers/ spec/controllers/ spec/models/&lt;br /&gt;
[Coveralls] Set up the SimpleCov formatter.&lt;br /&gt;
[Coveralls] Using SimpleCov's 'rails' settings.&lt;br /&gt;
&lt;br /&gt;
Randomized with seed 6978&lt;br /&gt;
[...]&lt;br /&gt;
&lt;br /&gt;
Finished in 8 minutes 10 seconds (files took 12.32 seconds to load)&lt;br /&gt;
900 examples, 0 failures, 16 pending&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The features tests were extremely time-consuming so we did not routinely run them during development.  However TravisCI results on our [https://github.com/expertiza/expertiza/pull/1444 Pull Request] demonstrate the passing status of all tests.&lt;br /&gt;
&lt;br /&gt;
==== New Tests ====&lt;br /&gt;
&lt;br /&gt;
Write comprehensive RSpec tests, for all new or modified methods.&lt;br /&gt;
* FILE: ''spec/helpers/assignment_helper_spec.rb''&lt;br /&gt;
** METHODS TO TEST: &lt;br /&gt;
*** questionnaire(assignment, type, round_number, topic_id)&lt;br /&gt;
*** assignment_questionnaire(assignment, type, number, topic_id)&lt;br /&gt;
* FILE: ''spec/models/review_response_map_spec.rb''&lt;br /&gt;
*** METHODS TO TEST:&lt;br /&gt;
**** questionnaire(round, topic_id)&lt;br /&gt;
* FILE: ''spec/models/self_review_response_map_spec.rb''&lt;br /&gt;
*** METHODS TO TEST:&lt;br /&gt;
**** questionnaire(round, topic_id)&lt;br /&gt;
* FILE: ''spec/models/assignment_spec.rb''&lt;br /&gt;
*** METHODS TO TEST:&lt;br /&gt;
**** review_questionnaire_id(round, topic_id)&lt;br /&gt;
**** varying_rubrics_by_topic?()&lt;br /&gt;
&lt;br /&gt;
Run these tests, to ensure that the new code works as intended.&lt;br /&gt;
The commands and results are shown below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
e@ubuntu:~/Desktop/CSC517_HW04/expertiza$ bundle exec rspec spec/helpers/assignment_helper_spec.rb spec/models/review_response_map_spec.rb spec/models/self_review_response_map_spec.rb spec/models/assignment_spec.rb &lt;br /&gt;
[Coveralls] Set up the SimpleCov formatter.&lt;br /&gt;
[Coveralls] Using SimpleCov's 'rails' settings.&lt;br /&gt;
&lt;br /&gt;
Randomized with seed 47508&lt;br /&gt;
....................................................................................................................&lt;br /&gt;
&lt;br /&gt;
Finished in 1 minute 7.94 seconds (files took 10.85 seconds to load)&lt;br /&gt;
116 examples, 0 failures&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The test suite for a single new method is shown below.&lt;br /&gt;
* There are many such suites added in expertiza/spec  &lt;br /&gt;
* This example illustrates our general strategy:&lt;br /&gt;
** test missing input&lt;br /&gt;
** test bad input&lt;br /&gt;
** test various acceptable forms of input&lt;br /&gt;
** test scenarios that lead to various return values&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  describe &amp;quot;#questionnaire&amp;quot; do&lt;br /&gt;
&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;throws exception if assignment argument nil&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;throws exception if all arguments nil except for assignment&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;finds by type if round number &amp;amp; topic id not given&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;throws exception if round number &amp;amp; topic id not given, no luck finding by type&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;finds by round number alone if round number alone is given&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;creates new questionnaire of given type if round number alone is given, no luck finding by round&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;finds by topic id alone if topic id alone is given&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;creates new questionnaire of given type if topic id alone is given, no luck finding by topic&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;finds by round number and topic id if both are given&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;creates new questionnaire of given type if round and topic are given, no luck finding by round and topic&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== UI Testing ===&lt;br /&gt;
&lt;br /&gt;
Here we describe manual UI Testing that was performed.&lt;br /&gt;
&lt;br /&gt;
==== Rubric does not vary by round or by topic ====&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
==== Rubric varies by round, but not by topic ====&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
==== Rubric varies by topic, but not by round ====&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
==== Rubric varies by both round and topic ====&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
In CSC/ECE 517, there are several types of topics that could be covered in a single class assignment.  However, currently we can only specify one kind of rubric for an assignment. This means that teams working on different topics will be evaluated using the same rubric. With this setup, it's not possible to fine-tune rubrics for different topics - rubrics tend to be overly general.&lt;br /&gt;
&lt;br /&gt;
In this project, we have solved this issue, by allowing rubrics to vary not only by round, but also by topic. This allows more flexibility to the instructor when setting up an assignment, so that they can use rubrics better suited to the tasks that students are performing in an assignment.  The following scenarios will be possible, and the instructor will be the judge of which scenario is the best fit to the assignment:&lt;br /&gt;
&lt;br /&gt;
* Rubric does not vary by round or by topic.&lt;br /&gt;
* Rubric varies by round, but not by topic.&lt;br /&gt;
* Rubric varies by topic, but not by round.&lt;br /&gt;
* Rubric varies by both round and topic.&lt;br /&gt;
&lt;br /&gt;
The instructor may use the Rubrics tab of the assignments edit page to make changes to the &amp;quot;Review rubric varies by round?&amp;quot; and &amp;quot;Review rubric varies by topic?&amp;quot; checkboxes.  The instructor may then use the Topics tab to select the appropriate rubric(s) for every topic in the assignment.&lt;br /&gt;
&lt;br /&gt;
Various other Expertiza code has been updated to retrieve the correct rubric depending on round and topic after the instructor has made these selections.&lt;br /&gt;
&lt;br /&gt;
== Future Work ==&lt;br /&gt;
&lt;br /&gt;
This section discusses possible future work for another CSC 517 team to take on.  Such a team can search the Expertiza codebase for &amp;quot;TODO E1936 (future work)&amp;quot; to find most of the places in the code that the notes below refer to.&lt;br /&gt;
&lt;br /&gt;
* Reduce the delay between changing the state of the &amp;quot;Review rubric varies by topic?&amp;quot; checkbox on the Rubrics tab, and the show / hide of rubric drop-downs on the Topics tab.&lt;br /&gt;
* Redesign UI for tone analysis, heatmaps, and review scores pop-up.  These areas are designed around the assumption that reviews do NOT vary by topic.  For example, in the review scores pop-up, a reviewer can see the reviews they have given, arranged by question, across multiple reviewees.&lt;br /&gt;
* Consider whether the questionnaire options available for selection in drop-downs on the Topics and Rubrics tabs should include ''only'' those questionnaires created by the currently-logged-in instructor.  Our work in this project changed the filtering from instructor-owning-assignment to currently-logged-in instructor - but left in place all non-private questionnaires.  ''Consider'' whether non-private questionnaires should be excluded.  This may result in some drop-downs not having any available questionnaires.&lt;br /&gt;
&lt;br /&gt;
== Useful Links ==&lt;br /&gt;
In this section we provide useful links related to the work that has been completed by our team.&lt;br /&gt;
# [https://github.com/gabalmat/expertiza Forked Project Repository]&lt;br /&gt;
# [https://github.com/expertiza/expertiza/pull/1444 Pull Request]&lt;br /&gt;
# [(add link here) Video Demonstration of Specialized Rubrics]&lt;br /&gt;
# [(add link here) Video Demonstration of Passing Rspec Tests]&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Contacts ===&lt;br /&gt;
We have 4 (four) members in our team and 1 (one) mentor was also assigned to us. For any project-related questions/concerns please contact us:&lt;br /&gt;
* Aurora Tiffany-Davis - attiffan@ncsu.edu&lt;br /&gt;
* Ginger Balmat - gabalmat@ncsu.edu&lt;br /&gt;
* Joe Hutchinson - jehutch3@ncsu.edu&lt;br /&gt;
* Nikolay Titov - ngtitov@ncsu.edu&lt;br /&gt;
* Zhewei Hu (mentor) - zhu6@ncsu.edu&lt;br /&gt;
&lt;br /&gt;
=== Contribution Based Inquiry ===&lt;br /&gt;
For any questions or concerns related to the project design, implementation, testing of the feature developed by our team, please contact an engineer who worked closely on the topic of your interest based on the [https://docs.google.com/spreadsheets/d/11uxuI_5gaC-FQDwIOxtCaN3HZ9bfWDJgIjFemtYV5jE/edit?ts=5ca222f3#gid=0 Contribution Assignment Grid] we created to keep track of our progress and contribution. Please carbon copy all team members and our mentor in the email.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* Expertiza Web [https://github.com/expertiza/expertiza#expertiza]&lt;br /&gt;
* Expertiza on GitHub [https://github.com/expertiza/expertiza]&lt;br /&gt;
* Expertiza Wiki [http://wikis.lib.ncsu.edu/index.php/Expertiza]&lt;br /&gt;
* Rspec Documentation [https://relishapp.com/rspec]&lt;br /&gt;
* Wiki with Previous Work [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1873_Specialized_rubics_for_different_topic_types]&lt;br /&gt;
* Pull Request of the Previous Work [https://github.com/expertiza/expertiza/pull/1327]&lt;/div&gt;</summary>
		<author><name>Ngtitov</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Use_case_diagram.png&amp;diff=124445</id>
		<title>File:Use case diagram.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Use_case_diagram.png&amp;diff=124445"/>
		<updated>2019-04-26T14:35:13Z</updated>

		<summary type="html">&lt;p&gt;Ngtitov: uploaded a new version of &amp;amp;quot;File:Use case diagram.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Ngtitov</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Use_case_diagram.png&amp;diff=124444</id>
		<title>File:Use case diagram.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Use_case_diagram.png&amp;diff=124444"/>
		<updated>2019-04-26T14:32:36Z</updated>

		<summary type="html">&lt;p&gt;Ngtitov: uploaded a new version of &amp;amp;quot;File:Use case diagram.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Ngtitov</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Use_case_diagram.png&amp;diff=124443</id>
		<title>File:Use case diagram.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Use_case_diagram.png&amp;diff=124443"/>
		<updated>2019-04-26T14:31:06Z</updated>

		<summary type="html">&lt;p&gt;Ngtitov: uploaded a new version of &amp;amp;quot;File:Use case diagram.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Ngtitov</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics&amp;diff=124442</id>
		<title>E1936 Specialized Rubrics</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics&amp;diff=124442"/>
		<updated>2019-04-26T14:30:17Z</updated>

		<summary type="html">&lt;p&gt;Ngtitov: /* Entity Relationship Diagram */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page describes the work and goals that have been completed and achieved while implementing Expertiza Project &amp;quot;''E1936. Specialized Rubrics for Different Topic Types (e.g., Servo project, refactoring project)''&amp;quot; for the CSC/ECE 517 &amp;quot;Object-Oriented Design and Development&amp;quot; class, in the Spring semester of the 2019.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This Wiki page is created per CSC/ECE 517: &amp;quot;Object-Oriented Design and Development&amp;quot;, Expertiza Project requirements (Spring, 2019).&lt;br /&gt;
&lt;br /&gt;
Our [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Team team] was assigned the project &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936. Specialized rubrics for different topic types (e.g., Servo project, refactoring project)]&amp;quot;.  This is an Expertiza project.&lt;br /&gt;
&lt;br /&gt;
In this wiki page we describe the problem to be solved, how we solve that problem, and how we test our solution.  We also provide helpful links and contact information for our team.&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
In this section, we discuss the problem we need to solve, the Expertiza feature this problem is related to, what needs to be done to solve the problem (at a high level), and the previous attempt to solve this problem.&lt;br /&gt;
&lt;br /&gt;
=== Problem Statement ===&lt;br /&gt;
&lt;br /&gt;
This problem statement summarizes the problem as described in the project description &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936. Specialized rubrics for different topic types (e.g., Servo project, refactoring project)]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
In CSC/ECE 517, there are several types of topics that could be covered in a single class assignment.&lt;br /&gt;
* Code base&lt;br /&gt;
** Expertiza&lt;br /&gt;
** Mozilla&lt;br /&gt;
** etc.&lt;br /&gt;
* Goal&lt;br /&gt;
** Refactoring&lt;br /&gt;
** Testing&lt;br /&gt;
** etc.&lt;br /&gt;
However, currently we can only specify one kind of rubric for an assignment.  This means that teams working on different topics will be evaluated using the same rubric.  With this setup, it's not possible to fine-tune rubrics for different topics - rubrics tend to be overly general.&lt;br /&gt;
&lt;br /&gt;
=== Feature Description ===&lt;br /&gt;
&lt;br /&gt;
The Expertiza project already has a feature that allows rubrics to vary by project phase or &amp;quot;round&amp;quot;.  The feature we will add in this project is a feature to allow rubrics to vary not only by round, but also by topic.  This allows more flexibility to the instructor when setting up an assignment, so that they can use rubrics better suited to the tasks that students are performing in an assignment.&lt;br /&gt;
&lt;br /&gt;
When this feature is complete, the following scenarios will be possible, and the instructor will be the judge of which scenario is the best fit to the assignment:&lt;br /&gt;
&lt;br /&gt;
* Rubric does not vary by round or by topic.&lt;br /&gt;
* Rubric varies by round, but not by topic.&lt;br /&gt;
* Rubric varies by topic, but not by round.&lt;br /&gt;
* Rubric varies by both round and topic.&lt;br /&gt;
&lt;br /&gt;
=== What Needs to be Done ===&lt;br /&gt;
&lt;br /&gt;
This section summarizes the work as described in the project description &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936. Specialized rubrics for different topic types (e.g., Servo project, refactoring project)]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* In assignment#edit page &amp;quot;Rubrics&amp;quot; tab, add a checkbox to specify whether rubric should vary by topic.&lt;br /&gt;
* In assignment#edit page &amp;quot;Topics&amp;quot; tab, add dropdown(s) next to each topic to specify which rubric(s) are associated with the topic.&lt;br /&gt;
** The dropdown(s) should appear only if rubric should vary by topic, per the Rubrics tab.&lt;br /&gt;
** The topic should have a multiple dropdowns (one for each round) only if rubrics vary by round, per the Rubrics tab.&lt;br /&gt;
** By default, the rubric(s) for each course project will be the one(s) specified in “Rubrics” tab.&lt;br /&gt;
** The dropdown value can overwrite the default rubric.&lt;br /&gt;
* Be careful when making changes to the code&lt;br /&gt;
** The signup_sheet_controller should have as little to do as possible with the selection of rubrics.&lt;br /&gt;
** Anything not germane to selecting topics should be in another controller or (more probably) a helper.&lt;br /&gt;
* Create a DB migration to allow rubric to vary by topic as well as by round.&lt;br /&gt;
&lt;br /&gt;
==== Screenshots ====&lt;br /&gt;
'''Current screenshot of Rubrics tab for an Assignment'''&lt;br /&gt;
(need to add a checkbox to indicate that rubric should vary by topic)&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Screenshot Assignment Edit Rubrics.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Current screenshot of Topics tab for an Assignment'''&lt;br /&gt;
(need to add a way to select rubrics for particular topics)&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Screenshot Assignment Edit Topics.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Proposed screenshot of Rubrics tab for an Assignment'''&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Specialized Rubric rubric checkbox.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Proposed screenshot of Topics tab for an Assignment'''&lt;br /&gt;
&lt;br /&gt;
(drop down shown for only one topic here, but final product will have one for each topic)&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Specialized Rubric dropdown menu.png]]&lt;br /&gt;
&lt;br /&gt;
== Previous Work ==&lt;br /&gt;
&lt;br /&gt;
There was previous attempt to implement this project in the Fall of 2018 semester by different team, but it was rejected due to several reasons. Our team was provided with all relevant information and materials about the design and implementation of the previously attempted project. We would like to acknowledge that we use previous implementation and design as reference and our starting point for our own implementation. The following is the list of links with the relevant materials that we have used for better project understanding, determining pros and cons of previously proposed changes, and establishing our design strategy and implementation:&lt;br /&gt;
&lt;br /&gt;
# [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1873_Specialized_rubics_for_different_topic_types Wiki]&lt;br /&gt;
# [https://github.com/expertiza/expertiza/pull/1327 Pull Request]&lt;br /&gt;
# [https://drive.google.com/file/d/1UrLb0Ula_Lb_F4MOrdC-s6xng6B08VYu/view Video Demo]&lt;br /&gt;
&lt;br /&gt;
After reviewing all relevant materials above, we concluded that the project implementation was incomplete and proposed design had significant flaw. &lt;br /&gt;
We identified main drawbacks and flaw as follows:&lt;br /&gt;
&lt;br /&gt;
* Establishing incorrect ''many-to-one'' relationship between ''sign_up_topics'' and ''questionnaires'' tables:&lt;br /&gt;
** Creating a DB migration to add ''questionnaire_id'' in the ''sign_up_topics'' table to store the dropdown data presumes ''one-to-one'' or ''many-to-one'' relationship between ''sign_up_topics'' and ''questionnaires'' tables&lt;br /&gt;
** Correct relationship between ''sign_up_topics'' and ''questionnaires'' tables is ''many-to-many''. For example, each project topic may have various rubrics depending on the round it is used (e.g., for round 1, topic may have one rubric; but for round 2, the same topic may have different rubric)&lt;br /&gt;
** Proposed previous migration changes would break DB design and would not allow to store correctly topic and its associated rubric per different round.&lt;br /&gt;
* Per project requirement specifications, &amp;quot;''The dropdown box should appear only if 'Vary rubric by topic' is selected in the Rubrics tab.''&amp;quot; This requirement was not met and ''Vary rubric by topic'' checkbox in the Rubrics tab was not implemented. Therefore, dropdown box with the list of rubrics appears regardless of whether &amp;quot;''Vary rubric by topic''&amp;quot; is selected or not.&lt;br /&gt;
* The dropdown box includes the list of all possible rubrics including default value. However, this condition can be improved. The dropdown box should list the rubrics that were created by the current user (professor who is logged in). This would allow to shorten the list of possible rubrics dramatically and help to avoid any misunderstanding and confusion while user selects desired rubric for the course project.&lt;br /&gt;
&lt;br /&gt;
We found no further issues with the rest implementation and in other project materials. Wiki page is very useful for understanding design of proposed changes, finding drawbacks and the flaw. Considering all the pros and cons, and taking into account drawbacks of the proposed changes, our team evolved different approach that should successfully solve the problem stated for the project without without creating additional issues. Please see our [http://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics#Project_Implementation Project Implementation] for more details.&lt;br /&gt;
&lt;br /&gt;
== Previous Project Requirements ==&lt;br /&gt;
&lt;br /&gt;
The project requirements originally specified how to alter the databases to support varying rubrics by topic.&lt;br /&gt;
&lt;br /&gt;
''Create a new table named topic_questionnaires with field:''&lt;br /&gt;
* ''id''&lt;br /&gt;
* ''topic_id''&lt;br /&gt;
* ''questionnaire_id''&lt;br /&gt;
* ''used_in_round''&lt;br /&gt;
&lt;br /&gt;
However, the E1936 team successfully petitioned for this requirement to change to give us more freedom in the implementation.  The original suggestion had a flaw.  There is already an existing table in the Expertiza project called ''assignment_questionnaires'', which has columns including ''assignment_id'', ''questionnaire_id'', and ''used_in_round''.  It is this table that maintains the knowledge of which rubric is used in which round of an assignment.  If we were to add a new table to maintains the knowledge of which rubric is used in which topic of an assignment as originally suggested, then we would have a big problem.  Knowledge of round-rubric relationship is duplicated.  This would lead (best case scenario) to extra work, and (worst case scenario) to lots of bugs caused by inconsistencies in how these tables are handled with CRUD operations throughout the code.  In other words, this is not a DRY solution.&lt;br /&gt;
&lt;br /&gt;
== Project Implementation ==&lt;br /&gt;
&lt;br /&gt;
In this section, we propose our solution to the problem, discuss implementation techniques and details, and list the goals we achieved.&lt;br /&gt;
&lt;br /&gt;
We start by analyzing Entity Relationship Diagram where we state the solution to the problem. Further we discuss design strategy by breaking project problem into multiple staged sub-problems and provide solutions for each of these sub-problems. We also discuss some implementation details and provide the list of involved files. Finally, we demonstrate how the implemented feature can be used by providing a ''How To'' sub-section.&lt;br /&gt;
&lt;br /&gt;
=== Diagrams ===&lt;br /&gt;
&lt;br /&gt;
Our solution and implementation of the project can be easily shown by discussing Use Case, Entity Relationship, and Class diagrams. First, for simplicity we discuss in general possible sequence of interactions between a user (in this case instructor) and the system (Expertiza) via presenting Use Case Diagram. Then we plan to show proposed database modification via Entity Relationship Diagram.&lt;br /&gt;
&lt;br /&gt;
==== User Case Diagram ====&lt;br /&gt;
&lt;br /&gt;
[[File: use_case_diagram.png]]&lt;br /&gt;
&lt;br /&gt;
The above Use Case Diagram shows general sequence of interactions between an instructor and the system (Expertiza) that defines where and how the feature can be utilized. Note that highlighted use cases are objects of our interest and work. Also please note that all of the shown use cases already exist in the system and we simply adding new feature into the system with existing use cases. Particularly, the rubric for each assignment and newly added ''Review rubric varies by topic'' checkbox with which instructor may choose to vary assignment by topic or not by checking and unchecking the checkbox is displayed in the ''Rubrics'' tab. Hence, we show how instructor can get to the ''Rubrics'' tab of the assignments. Similarly, ''Topics'' tab of assignments has additional ''Questionnaires'' column for each topic, where instructor may specify which rubric associates with the topic. To perform such sequence of iterations and utilize the new feature, instructor must choose ''Edit'' any assignment from the list of all assignments displayed to him/her in the ''Manage Assignments'' boundary, which can be navigated by instructor by selecting it from the header of the page.&lt;br /&gt;
&lt;br /&gt;
==== Entity Relationship Diagram ====&lt;br /&gt;
&lt;br /&gt;
[[File: HW04_ERD.png]]&lt;br /&gt;
&lt;br /&gt;
The sections of the diagram highlighted in yellow show newly introduced items.  That is, we are adding a new column called ''topic_id'' to ''assignment_questionnaires'', in order to link ''assignment_questionnaires'' to ''sign_up_topics''.&lt;br /&gt;
&lt;br /&gt;
Any assignment, topic, or questionnaire may be represented by multiple records within ''assignment_questionnaires'', but each record within ''assignment_questionnaires'' refers to just one assignment, topic, or questionnaire.  It is the ability to have an assignment represented by multiple records, and the new relationship to ''sign_up_topics'', that allows us to support all of the required scenarios:&lt;br /&gt;
&lt;br /&gt;
* Rubric does not vary by round or by topic.&lt;br /&gt;
* Rubric varies by round, but not by topic.&lt;br /&gt;
* Rubric varies by topic, but not by round.&lt;br /&gt;
* Rubric varies by both round and topic.&lt;br /&gt;
&lt;br /&gt;
[[File: HW04_table.PNG]]&lt;br /&gt;
&lt;br /&gt;
This table illustrates the possibilities that the system may have.&lt;br /&gt;
&lt;br /&gt;
* Assignment 1 does not vary by round or by topic.&lt;br /&gt;
* Assignment 2 varies by round, but not by topic.&lt;br /&gt;
* Assignment 3 varies by topic, but not by round.&lt;br /&gt;
* Assignment 4 varies by both round and topic.&lt;br /&gt;
&lt;br /&gt;
This change is done via database migration by running the following commands:&lt;br /&gt;
&lt;br /&gt;
  rails generate migration AddTopicIdToAssignmentQuestionnaires&lt;br /&gt;
&lt;br /&gt;
Above command adds the ''topic_id'' column to the ''AssignmentQuestionnaires'' table and generates new migration file:&lt;br /&gt;
&lt;br /&gt;
[[File: db_migration.png]]&lt;br /&gt;
&lt;br /&gt;
To see the details of the entire database change please check this [https://github.com/gabalmat/expertiza/commit/d46dd57d35a21ab43efb82c28d3f14b75c695f2e commit].&lt;br /&gt;
&lt;br /&gt;
==== Class Diagram ====&lt;br /&gt;
&lt;br /&gt;
This is Class Class diagram.&lt;br /&gt;
&lt;br /&gt;
=== Design Strategy ===&lt;br /&gt;
&lt;br /&gt;
As we have concrete understanding of the problem and proposed solution, we would like break this problem into multiple more manageable sub-problems with specific tasks and well-defined solutions to these tasks. Generally, each sub-problem requires modification of one or more files. We would like to propose our Design Strategy as follows:&lt;br /&gt;
&lt;br /&gt;
==== Preparation ====&lt;br /&gt;
&lt;br /&gt;
* Clean up code that our implementation will use&lt;br /&gt;
** PROBLEM: We need to add/change content to the edit assignment Topics tab, but unlike other tabs in the views, it does not have its own partial view to work with&lt;br /&gt;
*** SOLUTION: Refactor and move the code dealing with topics into separate ''app/views/assignments/edit/_topics.html.erb'' file&lt;br /&gt;
*** File: ''app/views/assignments/edit.html.erb''&lt;br /&gt;
** PROBLEM: In a section below, we discuss the need to modify existing methods to also accept an optional argument ''topic_id''.  In many cases these existing method use confusing variable names or lack sufficient comments.&lt;br /&gt;
*** SOLUTION: Clean up methods that we plan to modify&lt;br /&gt;
*** FILE: (many)&lt;br /&gt;
&lt;br /&gt;
==== Implementation ====&lt;br /&gt;
&lt;br /&gt;
* Allow an instructor to indicate that rubric should vary by topic&lt;br /&gt;
** PROBLEM: There is no way for an instructor to indicate that an assignments' rubric should vary by topic&lt;br /&gt;
*** SOLUTION: Add a new checkbox in the edit assignment Rubrics tab to indicate this preference&lt;br /&gt;
*** FILE: ''app/views/assignments/edit/_rubrics.html.erb''&lt;br /&gt;
** PROBLEM: If the user changes the &amp;quot;Review rubric varies by round?&amp;quot; or &amp;quot;Review rubric varies by topic?&amp;quot; checkbox on the Rubrics tab, but leaves the page in an inappropriate state before leaving the tab (e.g. rubric weights that do not add up to 0% or 100%), then the user does not get feedback that they made a mistake.  They only get such feedback when explicitly performing a &amp;quot;Save&amp;quot;.  Switching from tab to tab on the assignments edit page attempts to perform an implicit save, but there is no mechanism to update the flash messages onscreen if anything goes wrong.  This becomes more problematic now that the Topics tab appearance depends on choices made on the Rubrics tab.  &lt;br /&gt;
*** SOLUTION: Provide a route to an assignments controller method that can return a render of the flash messages.  Add an AJAX call on the assignments edit view that can update the flash messages onscreen.&lt;br /&gt;
*** FILE: app/controllers/assignments_controller.rb&lt;br /&gt;
*** FILE: app/views/assignments/edit.html.erb&lt;br /&gt;
&lt;br /&gt;
* Allow an instructor to choose different rubrics for different topics&lt;br /&gt;
** PROBLEM: There is no way for an instructor to choose different rubrics for different topics&lt;br /&gt;
*** SOLUTION: Add a new column in the edit assignment Topics tab for choosing rubric(s)&lt;br /&gt;
**** New column only visible if rubrics vary by topic, per Rubrics tab&lt;br /&gt;
**** New column has multiple rounds per topic only if rubrics vary by round, per Rubrics tab&lt;br /&gt;
**** Default value for any rubric is that rubric which is shown on Rubrics tab&lt;br /&gt;
**** Rubric(s) in the dropdown list is/are only those that were created by the currently logged in instructor&lt;br /&gt;
*** FILE: ''app/views/assignments/edit/_topics.html.erb''&lt;br /&gt;
** PROBLEM: The code in ''app/views/assignments/edit/_rubrics.html.erb'' includes dropdowns like the ones we need to add for topics, but that code is way too complex for its functionality (too heavy for a view, uses JavaScript)&lt;br /&gt;
*** SOLUTION: Use the code in ''app/views/assignments/edit/_rubrics.html.erb'' for inspiration only&lt;br /&gt;
**** Refactor and move as much actual work as possible out into helper methods that are simply called from this view&lt;br /&gt;
**** Views are not intended to do heavy lifting&lt;br /&gt;
**** Use as little JavaScript as possible, since this is a Ruby On Rails project, not a JS project&lt;br /&gt;
*** FILE: ''app/views/assignments/edit/_topics.html.erb''&lt;br /&gt;
** PROBLEM: The drop-downs for selecting rubrics should show only those rubrics created by the currently-logged in instructor (per project mentor).  They currently include those created by the instructor of the relevant assignment.&lt;br /&gt;
*** SOLUTION: Change the filtering in the ''questionnaire_options'' method to reflect the desired filtering.&lt;br /&gt;
*** FILE: app/helpers/assignment_helper.rb&lt;br /&gt;
&lt;br /&gt;
* Support the ability of the database to link rubrics to topics&lt;br /&gt;
** PROBLEM: There is no relationship in the database that can link together rubrics with topics&lt;br /&gt;
*** SOLUTION: Add a new migration that adds topic_id field to existing assignment_questionnaires table&lt;br /&gt;
**** This new field will reference the id field in the sign_up_topics table&lt;br /&gt;
*** FILE: ''db/migrate/[timestamp]_add_topic_id_to_assignment_questionnaires_table.rb''&lt;br /&gt;
** PROBLEM: The AssignmentQuestionnaire model does not have any knowledge of topics&lt;br /&gt;
*** SOLUTION: Add a new belongs_to reference in the model, to sign_up_topic&lt;br /&gt;
*** FILE: ''app/models/assignment_questionnaire.rb''&lt;br /&gt;
** PROBLEM: The SignUpTopic model does not have any knowledge of assignment_questionnaire records&lt;br /&gt;
*** SOLUTION: Add a new has_many reference in the model, to assignment_questionnaires&lt;br /&gt;
*** FILE: ''app/models/sign_up_topic.rb''&lt;br /&gt;
&lt;br /&gt;
* React to an instructor saving an assignment after altering the rubrics-vary-by-topic checkbox&lt;br /&gt;
** PROBLEM: There is nothing in place to remember when an instructor chooses to vary rubrics by topic, or chooses to not vary rubrics by topic&lt;br /&gt;
*** SOLUTION: Modify existing method ''update_assignment_questionnaires()''.  This method executes upon assignment save (explicit or via tab-change).  This method deletes all ''AssignmentQuestionnaire'' records before creating new correct records reflecting the user's selections in the edit assignment form.  Modify such that this method can create multiple records reflecting multiple topics, in the case where rubric should vary by topic.  With this modification, the correct records (with default rubrics) are present when the user goes to the Topics tab, so that the Topics tab can display properly.&lt;br /&gt;
*** FILE: app\models\assignment_form.rb&lt;br /&gt;
** PROBLEM: There is no way to refresh the Topics tab to show / hide drop-downs after the instructor changes checkbox on Rubrics tab&lt;br /&gt;
*** SOLUTION: Make use of existing &amp;quot;Save&amp;quot;-like functionality when changing tabs on the edit assignment page.  When updating due to tab-change, cause a fresh render of the Topics tab.  When updating due to &amp;quot;Save&amp;quot; button, keep functionality as-is.&lt;br /&gt;
*** FILE: ''app/controllers/assignments_controller.rb''&lt;br /&gt;
*** FILE: ''app/views/assignments/edit.html.erb''&lt;br /&gt;
&lt;br /&gt;
* Support the ability to find the correct rubric for a particular topic&lt;br /&gt;
** PROBLEM: The existing methods allow us to find the correct rubric for a particular round, but not a particular topic&lt;br /&gt;
*** SOLUTION: Modify the existing method questionnaire(assignment, type, round_number) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/helpers/assignment_helper.rb''&lt;br /&gt;
*** SOLUTION: Modify the existing method assignment_questionnaire(assignment, type, number) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/helpers/assignment_helper.rb''&lt;br /&gt;
*** SOLUTION: Modify the existing method questionnaire(round = nil) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/models/review_response_map.rb''&lt;br /&gt;
*** SOLUTION: Modify the existing method questionnaire(round) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/models/self_review_response_map.rb''&lt;br /&gt;
*** SOLUTION: Modify the existing method review_questionnaire_id(round = nil) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/models/assignment.rb''&lt;br /&gt;
&lt;br /&gt;
* Use the correct rubric for a particular topic&lt;br /&gt;
** PROBLEM: When finding rubrics to display, save results from, calculate scores from, etc. round may be used but topic is not&lt;br /&gt;
*** SOLUTION: Examine all callers of methods modified in the previous section and pass in ''topic_id'' where appropriate to grab the correct rubric&lt;br /&gt;
*** FILE: (many)&lt;br /&gt;
&lt;br /&gt;
* Support the ability to determine if an assignment has rubrics that vary by topic&lt;br /&gt;
** PROBLEM: There is no handy method to call that can tell us if an assignment has rubrics that vary by topic&lt;br /&gt;
*** SOLUTION: Add a new method ''varying_rubrics_by_topic?'' based on the existing method ''varying_rubrics_by_round?''&lt;br /&gt;
*** FILE: ''app/models/assignment.rb''&lt;br /&gt;
&lt;br /&gt;
=== Q&amp;amp;A ===&lt;br /&gt;
&lt;br /&gt;
Here we paraphrase some questions we received during round 1 of the documentation review.&lt;br /&gt;
&lt;br /&gt;
* Q: How will the new logic for varying rubric by topic tie in with the existing logic?&lt;br /&gt;
** A: We will add a new field ''topic_id'' into the existing table ''assignment_questionnaires'', as noted in the [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Entity_Relationship_Diagram E/R Diagram].  We will update methods that find questionnaires to allow these methods to also accept a ''topic_id'' argument, as noted in [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Implementation Implementation].&lt;br /&gt;
* Q: How will the &amp;quot;Rubric varies by topic&amp;quot; selection be stored?&lt;br /&gt;
** A: Indirectly, by saving records in the ''assignment_questionnaires'' table which either reference a ''topic_id'' or leave this field nil.  For more details please see the [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Entity_Relationship_Diagram E/R Diagram] discussion.&lt;br /&gt;
* Q: What will happen if an instructor selects &amp;quot;Rubric varies by topic&amp;quot;, makes selections on the &amp;quot;Topics&amp;quot; tab, and then deselects &amp;quot;Rubric varies by topic&amp;quot;?&lt;br /&gt;
** A: The Topics tab, when next visited, will no longer show dropdowns for selecting rubrics by topic.  When the assignment is saved, the appropriate not-varying-by-topic records will be saved in the ''assignment_questionnaires'' table.  For more details please see [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Implementation Implementation].&lt;br /&gt;
* Q: What will happen after an instructor selects &amp;quot;Rubric varies by topic&amp;quot;?&lt;br /&gt;
** A: The Topics tab, when next visited, will now show dropdowns for selecting rubrics by topic.  These rubrics will default to those shown on the Rubrics tab.  When the assignment is saved, the appropriate varying-by-topic records will be saved in the ''assignment_questionnaires'' table.  For more details please see [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Implementation Implementation].&lt;br /&gt;
* Q: How will the appropriate list of questionnaires for the new dropdowns on the Topics tab be determined?&lt;br /&gt;
** A: In the same way that the appropriate list of questionnaires for the existing dropdowns on the Rubrics tab is determined.  Namely, by the ''questionnaire_options'' method in the file ''expertiza/app/helpers/assignment_helper.rb''.&lt;br /&gt;
&lt;br /&gt;
=== (Selected) Modified Code ===&lt;br /&gt;
&lt;br /&gt;
In this section, we provide ''selected portions'' of modified code to illustrate how we implemented the new feature.&lt;br /&gt;
&lt;br /&gt;
Allow an instructor to indicate that rubric should vary by topic&lt;br /&gt;
&lt;br /&gt;
''app\views\assignments\edit\_rubrics.html.erb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;lt;input name=&amp;quot;vary_by_topic&amp;quot; type=&amp;quot;hidden&amp;quot; value=&amp;quot;false&amp;quot; /&amp;gt;&lt;br /&gt;
  &amp;lt;%= check_box_tag('vary_by_topic', 'true', @review_vary_by_topic_check) %&amp;gt;&lt;br /&gt;
  &amp;lt;%= label_tag('vary_by_topic', 'Review rubric varies by topic?') %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Allow an instructor to choose different rubrics for different topics&lt;br /&gt;
&lt;br /&gt;
''app\views\sign_up_sheet\_table_line.html.erb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;lt;% if @assignment_form.assignment.varying_rubrics_by_topic? %&amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;table id = &amp;lt;%=table_id %&amp;gt;&amp;gt;&lt;br /&gt;
        &amp;lt;tr&amp;gt;&lt;br /&gt;
          &amp;lt;script&amp;gt;&lt;br /&gt;
              ...&lt;br /&gt;
              &amp;lt;% if @assignment_form.assignment.varying_rubrics_by_round? %&amp;gt;&lt;br /&gt;
                &amp;lt;% for round in 1..@assignment_form.assignment.rounds_of_reviews %&amp;gt;&lt;br /&gt;
                  ...&lt;br /&gt;
                &amp;lt;% end %&amp;gt;&lt;br /&gt;
              &amp;lt;% else %&amp;gt;&lt;br /&gt;
                ...&lt;br /&gt;
              &amp;lt;% end %&amp;gt;&lt;br /&gt;
          &amp;lt;/script&amp;gt;&lt;br /&gt;
        &amp;lt;/tr&amp;gt;&lt;br /&gt;
      &amp;lt;/table&amp;gt;&lt;br /&gt;
    &amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Support the ability of the database to link rubrics to topics&lt;br /&gt;
&lt;br /&gt;
''app\models\sign_up_topic.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  class SignUpTopic &amp;lt; ActiveRecord::Base&lt;br /&gt;
    ...&lt;br /&gt;
    has_many :assignment_questionnaires, class_name: 'AssignmentQuestionnaire', foreign_key: 'topic_id', dependent: :destroy&lt;br /&gt;
    ...&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
React to an instructor saving an assignment after altering the rubrics-vary-by-topic checkbox&lt;br /&gt;
&lt;br /&gt;
''app/controllers/assignments_controller.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def update&lt;br /&gt;
    ...&lt;br /&gt;
    # What to do next depends on how we got here&lt;br /&gt;
    if params['button'].nil?&lt;br /&gt;
      # REFRESH the topics tab after changing tabs&lt;br /&gt;
      ...&lt;br /&gt;
      render :partial =&amp;gt; &amp;quot;assignments/edit/topics&amp;quot;&lt;br /&gt;
    else&lt;br /&gt;
      # SAVE button was used (do a redirect)&lt;br /&gt;
      redirect_to edit_assignment_path @assignment_form.assignment.id&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Support the ability to find the correct rubric for a particular topic&lt;br /&gt;
&lt;br /&gt;
''app/helpers/assignment_helper.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def assignment_questionnaire(assignment, questionnaire_type, round_number = nil, topic_id = nil)&lt;br /&gt;
    q_by_type = assignment.questionnaires.find_by(type: questionnaire_type)&lt;br /&gt;
    if q_by_type.nil?&lt;br /&gt;
      ...&lt;br /&gt;
    else&lt;br /&gt;
      ...&lt;br /&gt;
      aq_by_type = assignment.assignment_questionnaires.find_by(questionnaire_id: q_by_type.id)&lt;br /&gt;
      if round_number.nil? &amp;amp;&amp;amp; topic_id.nil?&lt;br /&gt;
        # Find by type&lt;br /&gt;
        aq = aq_by_type&lt;br /&gt;
      elsif topic_id.nil?&lt;br /&gt;
        # Find by round&lt;br /&gt;
        aq = assignment.assignment_questionnaires.find_by(used_in_round: round_number)&lt;br /&gt;
      elsif round_number.nil?&lt;br /&gt;
        # Find by topic&lt;br /&gt;
        aq = assignment.assignment_questionnaires.find_by(topic_id: topic_id)&lt;br /&gt;
      else&lt;br /&gt;
        # Find by round and topic&lt;br /&gt;
        aq = assignment.assignment_questionnaires.where(used_in_round: round_number, topic_id: topic_id).first&lt;br /&gt;
      end&lt;br /&gt;
      aq.nil? ? aq_by_type : aq&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use the correct rubric for a particular topic&lt;br /&gt;
&lt;br /&gt;
''app\controllers\response_controller.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def set_questionnaire_for_new_response&lt;br /&gt;
    case @map.type&lt;br /&gt;
    when &amp;quot;ReviewResponseMap&amp;quot;, &amp;quot;SelfReviewResponseMap&amp;quot;&lt;br /&gt;
      reviewees_topic = SignedUpTeam.topic_id_by_team_id(@contributor.id)&lt;br /&gt;
      @current_round = @assignment.number_of_current_round(reviewees_topic)&lt;br /&gt;
      @questionnaire = @map.questionnaire(@current_round, reviewees_topic)&lt;br /&gt;
    when&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Support the ability to determine if an assignment has rubrics that vary by topic&lt;br /&gt;
&lt;br /&gt;
''app\models\assignment.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def varying_rubrics_by_topic?&lt;br /&gt;
    aq_no_topic_id = AssignmentQuestionnaire.where(assignment_id: self.id, topic_id: nil).size &amp;gt;= 1&lt;br /&gt;
    aq_with_topic_id = AssignmentQuestionnaire.where(assignment_id: self.id).where.not(topic_id: nil).size &amp;gt;= 1&lt;br /&gt;
    if !aq_no_topic_id &amp;amp;&amp;amp; !aq_with_topic_id&lt;br /&gt;
      return false&lt;br /&gt;
    elsif aq_no_topic_id &amp;amp;&amp;amp; !aq_with_topic_id&lt;br /&gt;
      return false&lt;br /&gt;
    elsif !aq_no_topic_id &amp;amp;&amp;amp; aq_with_topic_id&lt;br /&gt;
      return true&lt;br /&gt;
    else&lt;br /&gt;
      raise StandardError.new(&amp;quot;Assignment with id &amp;quot; + self.id.to_s + &amp;quot; has a conflict about whether or not it varies by topic&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== How To ==&lt;br /&gt;
&lt;br /&gt;
In this section, we describe how to use the newly implemented feature.&lt;br /&gt;
&lt;br /&gt;
=== Add a New Rubric ===&lt;br /&gt;
&lt;br /&gt;
* [to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
=== Select a Rubric for a Topic ===&lt;br /&gt;
&lt;br /&gt;
* [to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
== Project Testing ==&lt;br /&gt;
&lt;br /&gt;
=== Strategy ===&lt;br /&gt;
&lt;br /&gt;
To test code implementation, correctness of the added feature, verify that the team did not break any existing functionalities in the Expertiza, and ensure that no bugs were introduced in the code, we developed the following Test Strategy:&lt;br /&gt;
&lt;br /&gt;
# Code inspection&lt;br /&gt;
# Run and pass existing RSpec Tests&lt;br /&gt;
# Develop New RSpec Tests&lt;br /&gt;
# Run through live UI to test a feature using Expertiza instance&lt;br /&gt;
&lt;br /&gt;
=== Rspec Testing ===&lt;br /&gt;
&lt;br /&gt;
==== Existing Tests ====&lt;br /&gt;
&lt;br /&gt;
Run all existing RSpec tests on any changed files, after our changes, to ensure that we have not introduced any failures.&lt;br /&gt;
The commands and results are shown below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
e@ubuntu:~/Desktop/CSC517_HW04/expertiza$ bundle exec rspec spec/helpers/ spec/controllers/ spec/models/&lt;br /&gt;
[Coveralls] Set up the SimpleCov formatter.&lt;br /&gt;
[Coveralls] Using SimpleCov's 'rails' settings.&lt;br /&gt;
&lt;br /&gt;
Randomized with seed 6978&lt;br /&gt;
[...]&lt;br /&gt;
&lt;br /&gt;
Finished in 8 minutes 10 seconds (files took 12.32 seconds to load)&lt;br /&gt;
900 examples, 0 failures, 16 pending&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The features tests were extremely time-consuming so we did not routinely run them during development.  However TravisCI results on our [https://github.com/expertiza/expertiza/pull/1444 Pull Request] demonstrate the passing status of all tests.&lt;br /&gt;
&lt;br /&gt;
==== New Tests ====&lt;br /&gt;
&lt;br /&gt;
Write comprehensive RSpec tests, for all new or modified methods.&lt;br /&gt;
* FILE: ''spec/helpers/assignment_helper_spec.rb''&lt;br /&gt;
** METHODS TO TEST: &lt;br /&gt;
*** questionnaire(assignment, type, round_number, topic_id)&lt;br /&gt;
*** assignment_questionnaire(assignment, type, number, topic_id)&lt;br /&gt;
* FILE: ''spec/models/review_response_map_spec.rb''&lt;br /&gt;
*** METHODS TO TEST:&lt;br /&gt;
**** questionnaire(round, topic_id)&lt;br /&gt;
* FILE: ''spec/models/self_review_response_map_spec.rb''&lt;br /&gt;
*** METHODS TO TEST:&lt;br /&gt;
**** questionnaire(round, topic_id)&lt;br /&gt;
* FILE: ''spec/models/assignment_spec.rb''&lt;br /&gt;
*** METHODS TO TEST:&lt;br /&gt;
**** review_questionnaire_id(round, topic_id)&lt;br /&gt;
**** varying_rubrics_by_topic?()&lt;br /&gt;
&lt;br /&gt;
Run these tests, to ensure that the new code works as intended.&lt;br /&gt;
The commands and results are shown below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
e@ubuntu:~/Desktop/CSC517_HW04/expertiza$ bundle exec rspec spec/helpers/assignment_helper_spec.rb spec/models/review_response_map_spec.rb spec/models/self_review_response_map_spec.rb spec/models/assignment_spec.rb &lt;br /&gt;
[Coveralls] Set up the SimpleCov formatter.&lt;br /&gt;
[Coveralls] Using SimpleCov's 'rails' settings.&lt;br /&gt;
&lt;br /&gt;
Randomized with seed 47508&lt;br /&gt;
....................................................................................................................&lt;br /&gt;
&lt;br /&gt;
Finished in 1 minute 7.94 seconds (files took 10.85 seconds to load)&lt;br /&gt;
116 examples, 0 failures&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The test suite for a single new method is shown below.&lt;br /&gt;
* There are many such suites added in expertiza/spec  &lt;br /&gt;
* This example illustrates our general strategy:&lt;br /&gt;
** test missing input&lt;br /&gt;
** test bad input&lt;br /&gt;
** test various acceptable forms of input&lt;br /&gt;
** test scenarios that lead to various return values&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  describe &amp;quot;#questionnaire&amp;quot; do&lt;br /&gt;
&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;throws exception if assignment argument nil&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;throws exception if all arguments nil except for assignment&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;finds by type if round number &amp;amp; topic id not given&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;throws exception if round number &amp;amp; topic id not given, no luck finding by type&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;finds by round number alone if round number alone is given&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;creates new questionnaire of given type if round number alone is given, no luck finding by round&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;finds by topic id alone if topic id alone is given&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;creates new questionnaire of given type if topic id alone is given, no luck finding by topic&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;finds by round number and topic id if both are given&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;creates new questionnaire of given type if round and topic are given, no luck finding by round and topic&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== UI Testing ===&lt;br /&gt;
&lt;br /&gt;
Here we describe manual UI Testing that was performed.&lt;br /&gt;
&lt;br /&gt;
==== Rubric does not vary by round or by topic ====&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
==== Rubric varies by round, but not by topic ====&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
==== Rubric varies by topic, but not by round ====&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
==== Rubric varies by both round and topic ====&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
In CSC/ECE 517, there are several types of topics that could be covered in a single class assignment.  However, currently we can only specify one kind of rubric for an assignment. This means that teams working on different topics will be evaluated using the same rubric. With this setup, it's not possible to fine-tune rubrics for different topics - rubrics tend to be overly general.&lt;br /&gt;
&lt;br /&gt;
In this project, we have solved this issue, by allowing rubrics to vary not only by round, but also by topic. This allows more flexibility to the instructor when setting up an assignment, so that they can use rubrics better suited to the tasks that students are performing in an assignment.  The following scenarios will be possible, and the instructor will be the judge of which scenario is the best fit to the assignment:&lt;br /&gt;
&lt;br /&gt;
* Rubric does not vary by round or by topic.&lt;br /&gt;
* Rubric varies by round, but not by topic.&lt;br /&gt;
* Rubric varies by topic, but not by round.&lt;br /&gt;
* Rubric varies by both round and topic.&lt;br /&gt;
&lt;br /&gt;
The instructor may use the Rubrics tab of the assignments edit page to make changes to the &amp;quot;Review rubric varies by round?&amp;quot; and &amp;quot;Review rubric varies by topic?&amp;quot; checkboxes.  The instructor may then use the Topics tab to select the appropriate rubric(s) for every topic in the assignment.&lt;br /&gt;
&lt;br /&gt;
Various other Expertiza code has been updated to retrieve the correct rubric depending on round and topic after the instructor has made these selections.&lt;br /&gt;
&lt;br /&gt;
== Future Work ==&lt;br /&gt;
&lt;br /&gt;
This section discusses possible future work for another CSC 517 team to take on.  Such a team can search the Expertiza codebase for &amp;quot;TODO E1936 (future work)&amp;quot; to find most of the places in the code that the notes below refer to.&lt;br /&gt;
&lt;br /&gt;
* Reduce the delay between changing the state of the &amp;quot;Review rubric varies by topic?&amp;quot; checkbox on the Rubrics tab, and the show / hide of rubric drop-downs on the Topics tab.&lt;br /&gt;
* Redesign UI for tone analysis, heatmaps, and review scores pop-up.  These areas are designed around the assumption that reviews do NOT vary by topic.  For example, in the review scores pop-up, a reviewer can see the reviews they have given, arranged by question, across multiple reviewees.&lt;br /&gt;
* Consider whether the questionnaire options available for selection in drop-downs on the Topics and Rubrics tabs should include ''only'' those questionnaires created by the currently-logged-in instructor.  Our work in this project changed the filtering from instructor-owning-assignment to currently-logged-in instructor - but left in place all non-private questionnaires.  ''Consider'' whether non-private questionnaires should be excluded.  This may result in some drop-downs not having any available questionnaires.&lt;br /&gt;
&lt;br /&gt;
== Useful Links ==&lt;br /&gt;
In this section we provide useful links related to the work that has been completed by our team.&lt;br /&gt;
# [https://github.com/gabalmat/expertiza Forked Project Repository]&lt;br /&gt;
# [https://github.com/expertiza/expertiza/pull/1444 Pull Request]&lt;br /&gt;
# [(add link here) Video Demonstration of Specialized Rubrics]&lt;br /&gt;
# [(add link here) Video Demonstration of Passing Rspec Tests]&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Contacts ===&lt;br /&gt;
We have 4 (four) members in our team and 1 (one) mentor was also assigned to us. For any project-related questions/concerns please contact us:&lt;br /&gt;
* Aurora Tiffany-Davis - attiffan@ncsu.edu&lt;br /&gt;
* Ginger Balmat - gabalmat@ncsu.edu&lt;br /&gt;
* Joe Hutchinson - jehutch3@ncsu.edu&lt;br /&gt;
* Nikolay Titov - ngtitov@ncsu.edu&lt;br /&gt;
* Zhewei Hu (mentor) - zhu6@ncsu.edu&lt;br /&gt;
&lt;br /&gt;
=== Contribution Based Inquiry ===&lt;br /&gt;
For any questions or concerns related to the project design, implementation, testing of the feature developed by our team, please contact an engineer who worked closely on the topic of your interest based on the [https://docs.google.com/spreadsheets/d/11uxuI_5gaC-FQDwIOxtCaN3HZ9bfWDJgIjFemtYV5jE/edit?ts=5ca222f3#gid=0 Contribution Assignment Grid] we created to keep track of our progress and contribution. Please carbon copy all team members and our mentor in the email.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* Expertiza Web [https://github.com/expertiza/expertiza#expertiza]&lt;br /&gt;
* Expertiza on GitHub [https://github.com/expertiza/expertiza]&lt;br /&gt;
* Expertiza Wiki [http://wikis.lib.ncsu.edu/index.php/Expertiza]&lt;br /&gt;
* Rspec Documentation [https://relishapp.com/rspec]&lt;br /&gt;
* Wiki with Previous Work [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1873_Specialized_rubics_for_different_topic_types]&lt;br /&gt;
* Pull Request of the Previous Work [https://github.com/expertiza/expertiza/pull/1327]&lt;/div&gt;</summary>
		<author><name>Ngtitov</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics&amp;diff=124339</id>
		<title>E1936 Specialized Rubrics</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics&amp;diff=124339"/>
		<updated>2019-04-26T02:56:43Z</updated>

		<summary type="html">&lt;p&gt;Ngtitov: /* User Case Diagram */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page describes the work and goals that have been completed and achieved while implementing Expertiza Project &amp;quot;''E1936. Specialized Rubrics for Different Topic Types (e.g., Servo project, refactoring project)''&amp;quot; for the CSC/ECE 517 &amp;quot;Object-Oriented Design and Development&amp;quot; class, in the Spring semester of the 2019.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This Wiki page is created per CSC/ECE 517: &amp;quot;Object-Oriented Design and Development&amp;quot;, Expertiza Project requirements (Spring, 2019).&lt;br /&gt;
&lt;br /&gt;
Our [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Team team] was assigned the project &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936. Specialized rubrics for different topic types (e.g., Servo project, refactoring project)]&amp;quot;.  This is an Expertiza project.&lt;br /&gt;
&lt;br /&gt;
In this wiki page we describe the problem to be solved, how we solve that problem, and how we test our solution.  We also provide helpful links and contact information for our team.&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
In this section, we discuss the problem we need to solve, the Expertiza feature this problem is related to, what needs to be done to solve the problem (at a high level), and the previous attempt to solve this problem.&lt;br /&gt;
&lt;br /&gt;
=== Problem Statement ===&lt;br /&gt;
&lt;br /&gt;
This problem statement summarizes the problem as described in the project description &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936. Specialized rubrics for different topic types (e.g., Servo project, refactoring project)]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
In CSC/ECE 517, there are several types of topics that could be covered in a single class assignment.&lt;br /&gt;
* Code base&lt;br /&gt;
** Expertiza&lt;br /&gt;
** Mozilla&lt;br /&gt;
** etc.&lt;br /&gt;
* Goal&lt;br /&gt;
** Refactoring&lt;br /&gt;
** Testing&lt;br /&gt;
** etc.&lt;br /&gt;
However, currently we can only specify one kind of rubric for an assignment.  This means that teams working on different topics will be evaluated using the same rubric.  With this setup, it's not possible to fine-tune rubrics for different topics - rubrics tend to be overly general.&lt;br /&gt;
&lt;br /&gt;
=== Feature Description ===&lt;br /&gt;
&lt;br /&gt;
The Expertiza project already has a feature that allows rubrics to vary by project phase or &amp;quot;round&amp;quot;.  The feature we will add in this project is a feature to allow rubrics to vary not only by round, but also by topic.  This allows more flexibility to the instructor when setting up an assignment, so that they can use rubrics better suited to the tasks that students are performing in an assignment.&lt;br /&gt;
&lt;br /&gt;
When this feature is complete, the following scenarios will be possible, and the instructor will be the judge of which scenario is the best fit to the assignment:&lt;br /&gt;
&lt;br /&gt;
* Rubric does not vary by round or by topic.&lt;br /&gt;
* Rubric varies by round, but not by topic.&lt;br /&gt;
* Rubric varies by topic, but not by round.&lt;br /&gt;
* Rubric varies by both round and topic.&lt;br /&gt;
&lt;br /&gt;
=== What Needs to be Done ===&lt;br /&gt;
&lt;br /&gt;
This section summarizes the work as described in the project description &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936. Specialized rubrics for different topic types (e.g., Servo project, refactoring project)]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* In assignment#edit page &amp;quot;Rubrics&amp;quot; tab, add a checkbox to specify whether rubric should vary by topic.&lt;br /&gt;
* In assignment#edit page &amp;quot;Topics&amp;quot; tab, add dropdown(s) next to each topic to specify which rubric(s) are associated with the topic.&lt;br /&gt;
** The dropdown(s) should appear only if rubric should vary by topic, per the Rubrics tab.&lt;br /&gt;
** The topic should have a multiple dropdowns (one for each round) only if rubrics vary by round, per the Rubrics tab.&lt;br /&gt;
** By default, the rubric(s) for each course project will be the one(s) specified in “Rubrics” tab.&lt;br /&gt;
** The dropdown value can overwrite the default rubric.&lt;br /&gt;
* Be careful when making changes to the code&lt;br /&gt;
** The signup_sheet_controller should have as little to do as possible with the selection of rubrics.&lt;br /&gt;
** Anything not germane to selecting topics should be in another controller or (more probably) a helper.&lt;br /&gt;
* Create a DB migration to allow rubric to vary by topic as well as by round.&lt;br /&gt;
&lt;br /&gt;
==== Screenshots ====&lt;br /&gt;
'''Current screenshot of Rubrics tab for an Assignment'''&lt;br /&gt;
(need to add a checkbox to indicate that rubric should vary by topic)&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Screenshot Assignment Edit Rubrics.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Current screenshot of Topics tab for an Assignment'''&lt;br /&gt;
(need to add a way to select rubrics for particular topics)&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Screenshot Assignment Edit Topics.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Proposed screenshot of Rubrics tab for an Assignment'''&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Specialized Rubric rubric checkbox.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Proposed screenshot of Topics tab for an Assignment'''&lt;br /&gt;
&lt;br /&gt;
(drop down shown for only one topic here, but final product will have one for each topic)&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Specialized Rubric dropdown menu.png]]&lt;br /&gt;
&lt;br /&gt;
== Previous Work ==&lt;br /&gt;
&lt;br /&gt;
There was previous attempt to implement this project in the Fall of 2018 semester by different team, but it was rejected due to several reasons. Our team was provided with all relevant information and materials about the design and implementation of the previously attempted project. We would like to acknowledge that we use previous implementation and design as reference and our starting point for our own implementation. The following is the list of links with the relevant materials that we have used for better project understanding, determining pros and cons of previously proposed changes, and establishing our design strategy and implementation:&lt;br /&gt;
&lt;br /&gt;
# [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1873_Specialized_rubics_for_different_topic_types Wiki]&lt;br /&gt;
# [https://github.com/expertiza/expertiza/pull/1327 Pull Request]&lt;br /&gt;
# [https://drive.google.com/file/d/1UrLb0Ula_Lb_F4MOrdC-s6xng6B08VYu/view Video Demo]&lt;br /&gt;
&lt;br /&gt;
After reviewing all relevant materials above, we concluded that the project implementation was incomplete and proposed design had significant flaw. &lt;br /&gt;
We identified main drawbacks and flaw as follows:&lt;br /&gt;
&lt;br /&gt;
* Establishing incorrect ''many-to-one'' relationship between ''sign_up_topics'' and ''questionnaires'' tables:&lt;br /&gt;
** Creating a DB migration to add ''questionnaire_id'' in the ''sign_up_topics'' table to store the dropdown data presumes ''one-to-one'' or ''many-to-one'' relationship between ''sign_up_topics'' and ''questionnaires'' tables&lt;br /&gt;
** Correct relationship between ''sign_up_topics'' and ''questionnaires'' tables is ''many-to-many''. For example, each project topic may have various rubrics depending on the round it is used (e.g., for round 1, topic may have one rubric; but for round 2, the same topic may have different rubric)&lt;br /&gt;
** Proposed previous migration changes would break DB design and would not allow to store correctly topic and its associated rubric per different round.&lt;br /&gt;
* Per project requirement specifications, &amp;quot;''The dropdown box should appear only if 'Vary rubric by topic' is selected in the Rubrics tab.''&amp;quot; This requirement was not met and ''Vary rubric by topic'' checkbox in the Rubrics tab was not implemented. Therefore, dropdown box with the list of rubrics appears regardless of whether &amp;quot;''Vary rubric by topic''&amp;quot; is selected or not.&lt;br /&gt;
* The dropdown box includes the list of all possible rubrics including default value. However, this condition can be improved. The dropdown box should list the rubrics that were created by the current user (professor who is logged in). This would allow to shorten the list of possible rubrics dramatically and help to avoid any misunderstanding and confusion while user selects desired rubric for the course project.&lt;br /&gt;
&lt;br /&gt;
We found no further issues with the rest implementation and in other project materials. Wiki page is very useful for understanding design of proposed changes, finding drawbacks and the flaw. Considering all the pros and cons, and taking into account drawbacks of the proposed changes, our team evolved different approach that should successfully solve the problem stated for the project without without creating additional issues. Please see our [http://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics#Project_Implementation Project Implementation] for more details.&lt;br /&gt;
&lt;br /&gt;
== Previous Project Requirements ==&lt;br /&gt;
&lt;br /&gt;
The project requirements originally specified how to alter the databases to support varying rubrics by topic.&lt;br /&gt;
&lt;br /&gt;
''Create a new table named topic_questionnaires with field:''&lt;br /&gt;
* ''id''&lt;br /&gt;
* ''topic_id''&lt;br /&gt;
* ''questionnaire_id''&lt;br /&gt;
* ''used_in_round''&lt;br /&gt;
&lt;br /&gt;
However, the E1936 team successfully petitioned for this requirement to change to give us more freedom in the implementation.  The original suggestion had a flaw.  There is already an existing table in the Expertiza project called ''assignment_questionnaires'', which has columns including ''assignment_id'', ''questionnaire_id'', and ''used_in_round''.  It is this table that maintains the knowledge of which rubric is used in which round of an assignment.  If we were to add a new table to maintains the knowledge of which rubric is used in which topic of an assignment as originally suggested, then we would have a big problem.  Knowledge of round-rubric relationship is duplicated.  This would lead (best case scenario) to extra work, and (worst case scenario) to lots of bugs caused by inconsistencies in how these tables are handled with CRUD operations throughout the code.  In other words, this is not a DRY solution.&lt;br /&gt;
&lt;br /&gt;
== Project Implementation ==&lt;br /&gt;
&lt;br /&gt;
In this section, we propose our solution to the problem, discuss implementation techniques and details, and list the goals we achieved.&lt;br /&gt;
&lt;br /&gt;
We start by analyzing Entity Relationship Diagram where we state the solution to the problem. Further we discuss design strategy by breaking project problem into multiple staged sub-problems and provide solutions for each of these sub-problems. We also discuss some implementation details and provide the list of involved files. Finally, we demonstrate how the implemented feature can be used by providing a ''How To'' sub-section.&lt;br /&gt;
&lt;br /&gt;
=== Diagrams ===&lt;br /&gt;
&lt;br /&gt;
Our solution and implementation of the project can be easily shown by discussing Use Case, Entity Relationship, and Class diagrams. First, for simplicity we discuss in general possible sequence of interactions between a user (in this case instructor) and the system (Expertiza) via presenting Use Case Diagram. Then we plan to show proposed database modification via Entity Relationship Diagram.&lt;br /&gt;
&lt;br /&gt;
==== User Case Diagram ====&lt;br /&gt;
&lt;br /&gt;
[[File: use_case_diagram.png]]&lt;br /&gt;
&lt;br /&gt;
The above Use Case Diagram shows general sequence of interactions between an instructor and the system (Expertiza) that defines where and how the feature can be utilized. Note that highlighted use cases are objects of our interest and work. Also please note that all of the shown use cases already exist in the system and we simply adding new feature into the system with existing use cases. Particularly, the rubric for each assignment and newly added ''Review rubric varies by topic'' checkbox with which instructor may choose to vary assignment by topic or not by checking and unchecking the checkbox is displayed in the ''Rubrics'' tab. Hence, we show how instructor can get to the ''Rubrics'' tab of the assignments. Similarly, ''Topics'' tab of assignments has additional ''Questionnaires'' column for each topic, where instructor may specify which rubric associates with the topic. To perform such sequence of iterations and utilize the new feature, instructor must choose ''Edit'' any assignment from the list of all assignments displayed to him/her in the ''Manage Assignments'' boundary, which can be navigated by instructor by selecting it from the header of the page.&lt;br /&gt;
&lt;br /&gt;
==== Entity Relationship Diagram ====&lt;br /&gt;
&lt;br /&gt;
[[File: HW04_ERD.png]]&lt;br /&gt;
&lt;br /&gt;
The sections of the diagram highlighted in yellow show newly introduced items.  That is, we are adding a new column called ''topic_id'' to ''assignment_questionnaires'', in order to link ''assignment_questionnaires'' to ''sign_up_topics''.&lt;br /&gt;
&lt;br /&gt;
Any assignment, topic, or questionnaire may be represented by multiple records within ''assignment_questionnaires'', but each record within ''assignment_questionnaires'' refers to just one assignment, topic, or questionnaire.  It is the ability to have an assignment represented by multiple records, and the new relationship to ''sign_up_topics'', that allows us to support all of the required scenarios:&lt;br /&gt;
&lt;br /&gt;
* Rubric does not vary by round or by topic.&lt;br /&gt;
* Rubric varies by round, but not by topic.&lt;br /&gt;
* Rubric varies by topic, but not by round.&lt;br /&gt;
* Rubric varies by both round and topic.&lt;br /&gt;
&lt;br /&gt;
[[File: HW04_table.PNG]]&lt;br /&gt;
&lt;br /&gt;
This table illustrates the possibilities that the system may have.&lt;br /&gt;
&lt;br /&gt;
* Assignment 1 does not vary by round or by topic.&lt;br /&gt;
* Assignment 2 varies by round, but not by topic.&lt;br /&gt;
* Assignment 3 varies by topic, but not by round.&lt;br /&gt;
* Assignment 4 varies by both round and topic.&lt;br /&gt;
&lt;br /&gt;
This change is done via database migration by running the following commands:&lt;br /&gt;
&lt;br /&gt;
  rails generate migration AddTopicIdToAssignmentQuestionnaires&lt;br /&gt;
  rb db:migrate&lt;br /&gt;
&lt;br /&gt;
Above command adds the ''topic_id'' column to the ''AssignmentQuestionnaires'' table and generates new migration file:&lt;br /&gt;
&lt;br /&gt;
[[File: db_migration.png]]&lt;br /&gt;
&lt;br /&gt;
To see the details of the entire database change please check this [https://github.com/gabalmat/expertiza/commit/d46dd57d35a21ab43efb82c28d3f14b75c695f2e commit].&lt;br /&gt;
&lt;br /&gt;
==== Class Diagram ====&lt;br /&gt;
&lt;br /&gt;
This is Class Class diagram.&lt;br /&gt;
&lt;br /&gt;
=== Design Strategy ===&lt;br /&gt;
&lt;br /&gt;
As we have concrete understanding of the problem and proposed solution, we would like break this problem into multiple more manageable sub-problems with specific tasks and well-defined solutions to these tasks. Generally, each sub-problem requires modification of one or more files. We would like to propose our Design Strategy as follows:&lt;br /&gt;
&lt;br /&gt;
==== Preparation ====&lt;br /&gt;
&lt;br /&gt;
* Clean up code that our implementation will use&lt;br /&gt;
** PROBLEM: We need to add/change content to the edit assignment Topics tab, but unlike other tabs in the views, it does not have its own partial view to work with&lt;br /&gt;
*** SOLUTION: Refactor and move the code dealing with topics into separate ''app/views/assignments/edit/_topics.html.erb'' file&lt;br /&gt;
*** File: ''app/views/assignments/edit.html.erb''&lt;br /&gt;
** PROBLEM: In a section below, we discuss the need to modify existing methods to also accept an optional argument ''topic_id''.  In many cases these existing method use confusing variable names or lack sufficient comments.&lt;br /&gt;
*** SOLUTION: Clean up methods that we plan to modify&lt;br /&gt;
*** FILE: (many)&lt;br /&gt;
&lt;br /&gt;
==== Implementation ====&lt;br /&gt;
&lt;br /&gt;
* Allow an instructor to indicate that rubric should vary by topic&lt;br /&gt;
** PROBLEM: There is no way for an instructor to indicate that an assignments' rubric should vary by topic&lt;br /&gt;
*** SOLUTION: Add a new checkbox in the edit assignment Rubric tab to indicate this preference&lt;br /&gt;
*** FILE: ''app/views/assignments/edit/_rubrics.html.erb''&lt;br /&gt;
&lt;br /&gt;
* Allow an instructor to choose different rubrics for different topics&lt;br /&gt;
** PROBLEM: There is no way for an instructor to choose different rubrics for different topics&lt;br /&gt;
*** SOLUTION: Add a new column in the edit assignment Topics tab for choosing rubric(s)&lt;br /&gt;
**** New column only visible if rubrics vary by topic, per Rubrics tab&lt;br /&gt;
**** New column has multiple rounds per topic only if rubrics vary by round, per Rubrics tab&lt;br /&gt;
**** Default value for any rubric is that rubric which is shown on Rubrics tab&lt;br /&gt;
**** Rubric(s) in the dropdown list is/are only those that were created by the currently logged in instructor&lt;br /&gt;
*** FILE: ''app/views/assignments/edit/_topics.html.erb''&lt;br /&gt;
** PROBLEM: The code in ''app/views/assignments/edit/_rubrics.html.erb'' includes dropdowns like the ones we need to add for topics, but that code is way too complex for its functionality (too heavy for a view, uses JavaScript)&lt;br /&gt;
*** SOLUTION: Use the code in ''app/views/assignments/edit/_rubrics.html.erb'' for inspiration only&lt;br /&gt;
**** Refactor and move as much actual work as possible out into helper methods that are simply called from this view&lt;br /&gt;
**** Views are not intended to do heavy lifting&lt;br /&gt;
**** Use as little JavaScript as possible, since this is a Ruby On Rails project, not a JS project&lt;br /&gt;
*** FILE: ''app/views/assignments/edit/_topics.html.erb''&lt;br /&gt;
&lt;br /&gt;
* Support the ability of the database to link rubrics to topics&lt;br /&gt;
** PROBLEM: There is no relationship in the database that can link together rubrics with topics&lt;br /&gt;
*** SOLUTION: Add a new migration that adds topic_id field to existing assignment_questionnaires table&lt;br /&gt;
**** This new field will reference the id field in the sign_up_topics table&lt;br /&gt;
*** FILE: ''db/migrate/[timestamp]_add_topic_id_to_assignment_questionnaires_table.rb''&lt;br /&gt;
** PROBLEM: The AssignmentQuestionnaire model does not have any knowledge of topics&lt;br /&gt;
*** SOLUTION: Add a new belongs_to reference in the model, to sign_up_topic&lt;br /&gt;
*** FILE: ''app/models/assignment_questionnaire.rb''&lt;br /&gt;
** PROBLEM: The SignUpTopic model does not have any knowledge of assignment_questionnaire records&lt;br /&gt;
*** SOLUTION: Add a new has_many reference in the model, to assignment_questionnaires&lt;br /&gt;
*** FILE: ''app/models/sign_up_topic.rb''&lt;br /&gt;
&lt;br /&gt;
* React to an instructor saving an assignment after altering the rubrics-vary-by-topic checkbox&lt;br /&gt;
** PROBLEM: There is nothing in place to remember when an instructor chooses to vary rubrics by topic, or chooses to not vary rubrics by topic&lt;br /&gt;
*** SOLUTION: Modify existing method ''update_assignment_questionnaires()''.  This method executes upon assignment save (explicit or via tab-change).  This method deletes all ''AssignmentQuestionnaire'' records before creating new correct records reflecting the user's selections in the edit assignment form.  Modify such that this method can create multiple records reflecting multiple topics, in the case where rubric should vary by topic.  With this modification, the correct records (with default rubrics) are present when the user goes to the Topics tab, so that the Topics tab can display properly.&lt;br /&gt;
*** FILE: app\models\assignment_form.rb&lt;br /&gt;
** PROBLEM: There is no way to refresh the Topics tab to show / hide drop-downs after the instructor changes checkbox on Rubrics tab&lt;br /&gt;
*** SOLUTION: Make use of existing &amp;quot;Save&amp;quot;-like functionality when changing tabs on the edit assignment page.  When updating due to tab-change, cause a fresh render of the Topics tab.  When updating due to &amp;quot;Save&amp;quot; button, keep functionality as-is.&lt;br /&gt;
*** FILE: ''app/controllers/assignments_controller.rb''&lt;br /&gt;
*** FILE: ''app/views/assignments/edit.html.erb''&lt;br /&gt;
&lt;br /&gt;
* Support the ability to find the correct rubric for a particular topic&lt;br /&gt;
** PROBLEM: The existing methods allow us to find the correct rubric for a particular round, but not a particular topic&lt;br /&gt;
*** SOLUTION: Modify the existing method questionnaire(assignment, type, round_number) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/helpers/assignment_helper.rb''&lt;br /&gt;
*** SOLUTION: Modify the existing method assignment_questionnaire(assignment, type, number) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/helpers/assignment_helper.rb''&lt;br /&gt;
*** SOLUTION: Modify the existing method questionnaire(round = nil) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/models/review_response_map.rb''&lt;br /&gt;
*** SOLUTION: Modify the existing method questionnaire(round) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/models/self_review_response_map.rb''&lt;br /&gt;
*** SOLUTION: Modify the existing method review_questionnaire_id(round = nil) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/models/assignment.rb''&lt;br /&gt;
&lt;br /&gt;
* Use the correct rubric for a particular topic&lt;br /&gt;
** PROBLEM: When finding rubrics to display, save results from, calculate scores from, etc. round may be used but topic is not&lt;br /&gt;
*** SOLUTION: Examine all callers of methods modified in the previous section and pass in ''topic_id'' where appropriate to grab the correct rubric&lt;br /&gt;
*** FILE: (many)&lt;br /&gt;
&lt;br /&gt;
* Support the ability to determine if an assignment has rubrics that vary by topic&lt;br /&gt;
** PROBLEM: There is no handy method to call that can tell us if an assignment has rubrics that vary by topic&lt;br /&gt;
*** SOLUTION: Add a new method ''varying_rubrics_by_topic?'' based on the existing method ''varying_rubrics_by_round?''&lt;br /&gt;
*** FILE: ''app/models/assignment.rb''&lt;br /&gt;
&lt;br /&gt;
=== Q&amp;amp;A ===&lt;br /&gt;
&lt;br /&gt;
Here we paraphrase some questions we received during round 1 of the documentation review.&lt;br /&gt;
&lt;br /&gt;
* Q: How will the new logic for varying rubric by topic tie in with the existing logic?&lt;br /&gt;
** A: We will add a new field ''topic_id'' into the existing table ''assignment_questionnaires'', as noted in the [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Entity_Relationship_Diagram E/R Diagram].  We will update methods that find questionnaires to allow these methods to also accept a ''topic_id'' argument, as noted in [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Implementation Implementation].&lt;br /&gt;
* Q: How will the &amp;quot;Rubric varies by topic&amp;quot; selection be stored?&lt;br /&gt;
** A: Indirectly, by saving records in the ''assignment_questionnaires'' table which either reference a ''topic_id'' or leave this field nil.  For more details please see the [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Entity_Relationship_Diagram E/R Diagram] discussion.&lt;br /&gt;
* Q: What will happen if an instructor selects &amp;quot;Rubric varies by topic&amp;quot;, makes selections on the &amp;quot;Topics&amp;quot; tab, and then deselects &amp;quot;Rubric varies by topic&amp;quot;?&lt;br /&gt;
** A: The Topics tab, when next visited, will no longer show dropdowns for selecting rubrics by topic.  When the assignment is saved, the appropriate not-varying-by-topic records will be saved in the ''assignment_questionnaires'' table.  For more details please see [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Implementation Implementation].&lt;br /&gt;
* Q: What will happen after an instructor selects &amp;quot;Rubric varies by topic&amp;quot;?&lt;br /&gt;
** A: The Topics tab, when next visited, will now show dropdowns for selecting rubrics by topic.  These rubrics will default to those shown on the Rubrics tab.  When the assignment is saved, the appropriate varying-by-topic records will be saved in the ''assignment_questionnaires'' table.  For more details please see [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Implementation Implementation].&lt;br /&gt;
* Q: How will the appropriate list of questionnaires for the new dropdowns on the Topics tab be determined?&lt;br /&gt;
** A: In the same way that the appropriate list of questionnaires for the existing dropdowns on the Rubrics tab is determined.  Namely, by the ''questionnaire_options'' method in the file ''expertiza/app/helpers/assignment_helper.rb''.&lt;br /&gt;
&lt;br /&gt;
=== (Selected) Modified Code ===&lt;br /&gt;
&lt;br /&gt;
In this section, we provide ''selected portions'' of modified code to illustrate how we implemented the new feature.&lt;br /&gt;
&lt;br /&gt;
Allow an instructor to indicate that rubric should vary by topic&lt;br /&gt;
&lt;br /&gt;
''app\views\assignments\edit\_rubrics.html.erb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;lt;input name=&amp;quot;vary_by_topic&amp;quot; type=&amp;quot;hidden&amp;quot; value=&amp;quot;false&amp;quot; /&amp;gt;&lt;br /&gt;
  &amp;lt;%= check_box_tag('vary_by_topic', 'true', @review_vary_by_topic_check) %&amp;gt;&lt;br /&gt;
  &amp;lt;%= label_tag('vary_by_topic', 'Review rubric varies by topic?') %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Allow an instructor to choose different rubrics for different topics&lt;br /&gt;
&lt;br /&gt;
''app\views\sign_up_sheet\_table_line.html.erb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;lt;% if @assignment_form.assignment.varying_rubrics_by_topic? %&amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;table id = &amp;lt;%=table_id %&amp;gt;&amp;gt;&lt;br /&gt;
        &amp;lt;tr&amp;gt;&lt;br /&gt;
          &amp;lt;script&amp;gt;&lt;br /&gt;
              ...&lt;br /&gt;
              &amp;lt;% if @assignment_form.assignment.varying_rubrics_by_round? %&amp;gt;&lt;br /&gt;
                &amp;lt;% for round in 1..@assignment_form.assignment.rounds_of_reviews %&amp;gt;&lt;br /&gt;
                  ...&lt;br /&gt;
                &amp;lt;% end %&amp;gt;&lt;br /&gt;
              &amp;lt;% else %&amp;gt;&lt;br /&gt;
                ...&lt;br /&gt;
              &amp;lt;% end %&amp;gt;&lt;br /&gt;
          &amp;lt;/script&amp;gt;&lt;br /&gt;
        &amp;lt;/tr&amp;gt;&lt;br /&gt;
      &amp;lt;/table&amp;gt;&lt;br /&gt;
    &amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Support the ability of the database to link rubrics to topics&lt;br /&gt;
&lt;br /&gt;
''app\models\sign_up_topic.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  class SignUpTopic &amp;lt; ActiveRecord::Base&lt;br /&gt;
    ...&lt;br /&gt;
    has_many :assignment_questionnaires, class_name: 'AssignmentQuestionnaire', foreign_key: 'topic_id', dependent: :destroy&lt;br /&gt;
    ...&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
React to an instructor saving an assignment after altering the rubrics-vary-by-topic checkbox&lt;br /&gt;
&lt;br /&gt;
''app/controllers/assignments_controller.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def update&lt;br /&gt;
    ...&lt;br /&gt;
    # What to do next depends on how we got here&lt;br /&gt;
    if params['button'].nil?&lt;br /&gt;
      # REFRESH the topics tab after changing tabs&lt;br /&gt;
      ...&lt;br /&gt;
      render :partial =&amp;gt; &amp;quot;assignments/edit/topics&amp;quot;&lt;br /&gt;
    else&lt;br /&gt;
      # SAVE button was used (do a redirect)&lt;br /&gt;
      redirect_to edit_assignment_path @assignment_form.assignment.id&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Support the ability to find the correct rubric for a particular topic&lt;br /&gt;
&lt;br /&gt;
''app/helpers/assignment_helper.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def assignment_questionnaire(assignment, questionnaire_type, round_number = nil, topic_id = nil)&lt;br /&gt;
    q_by_type = assignment.questionnaires.find_by(type: questionnaire_type)&lt;br /&gt;
    if q_by_type.nil?&lt;br /&gt;
      ...&lt;br /&gt;
    else&lt;br /&gt;
      ...&lt;br /&gt;
      aq_by_type = assignment.assignment_questionnaires.find_by(questionnaire_id: q_by_type.id)&lt;br /&gt;
      if round_number.nil? &amp;amp;&amp;amp; topic_id.nil?&lt;br /&gt;
        # Find by type&lt;br /&gt;
        aq = aq_by_type&lt;br /&gt;
      elsif topic_id.nil?&lt;br /&gt;
        # Find by round&lt;br /&gt;
        aq = assignment.assignment_questionnaires.find_by(used_in_round: round_number)&lt;br /&gt;
      elsif round_number.nil?&lt;br /&gt;
        # Find by topic&lt;br /&gt;
        aq = assignment.assignment_questionnaires.find_by(topic_id: topic_id)&lt;br /&gt;
      else&lt;br /&gt;
        # Find by round and topic&lt;br /&gt;
        aq = assignment.assignment_questionnaires.where(used_in_round: round_number, topic_id: topic_id).first&lt;br /&gt;
      end&lt;br /&gt;
      aq.nil? ? aq_by_type : aq&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use the correct rubric for a particular topic&lt;br /&gt;
&lt;br /&gt;
''app\controllers\response_controller.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def set_questionnaire_for_new_response&lt;br /&gt;
    case @map.type&lt;br /&gt;
    when &amp;quot;ReviewResponseMap&amp;quot;, &amp;quot;SelfReviewResponseMap&amp;quot;&lt;br /&gt;
      reviewees_topic = SignedUpTeam.topic_id_by_team_id(@contributor.id)&lt;br /&gt;
      @current_round = @assignment.number_of_current_round(reviewees_topic)&lt;br /&gt;
      @questionnaire = @map.questionnaire(@current_round, reviewees_topic)&lt;br /&gt;
    when&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Support the ability to determine if an assignment has rubrics that vary by topic&lt;br /&gt;
&lt;br /&gt;
''app\models\assignment.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def varying_rubrics_by_topic?&lt;br /&gt;
    aq_no_topic_id = AssignmentQuestionnaire.where(assignment_id: self.id, topic_id: nil).size &amp;gt;= 1&lt;br /&gt;
    aq_with_topic_id = AssignmentQuestionnaire.where(assignment_id: self.id).where.not(topic_id: nil).size &amp;gt;= 1&lt;br /&gt;
    if !aq_no_topic_id &amp;amp;&amp;amp; !aq_with_topic_id&lt;br /&gt;
      return false&lt;br /&gt;
    elsif aq_no_topic_id &amp;amp;&amp;amp; !aq_with_topic_id&lt;br /&gt;
      return false&lt;br /&gt;
    elsif !aq_no_topic_id &amp;amp;&amp;amp; aq_with_topic_id&lt;br /&gt;
      return true&lt;br /&gt;
    else&lt;br /&gt;
      raise StandardError.new(&amp;quot;Assignment with id &amp;quot; + self.id.to_s + &amp;quot; has a conflict about whether or not it varies by topic&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== How To ==&lt;br /&gt;
&lt;br /&gt;
In this section, we describe how to use the newly implemented feature.&lt;br /&gt;
&lt;br /&gt;
=== Add a New Rubric ===&lt;br /&gt;
&lt;br /&gt;
* [to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
=== Select a Rubric for a Topic ===&lt;br /&gt;
&lt;br /&gt;
* [to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
== Project Testing ==&lt;br /&gt;
&lt;br /&gt;
=== Strategy ===&lt;br /&gt;
&lt;br /&gt;
To test code implementation, correctness of the added feature, verify that the team did not break any existing functionalities in the Expertiza, and ensure that no bugs were introduced in the code, we developed the following Test Strategy:&lt;br /&gt;
&lt;br /&gt;
# Code inspection&lt;br /&gt;
# Run and pass existing RSpec Tests&lt;br /&gt;
# Develop New RSpec Tests&lt;br /&gt;
# Run through live UI to test a feature using Expertiza instance&lt;br /&gt;
&lt;br /&gt;
=== Rspec Testing ===&lt;br /&gt;
&lt;br /&gt;
==== Existing Tests ====&lt;br /&gt;
&lt;br /&gt;
Run all existing RSpec tests on any changed files, after our changes, to ensure that we have not introduced any failures.&lt;br /&gt;
The commands and results are shown below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  [to be populated after coding is complete]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== New Tests ====&lt;br /&gt;
&lt;br /&gt;
Write comprehensive RSpec tests, for all new or modified methods.&lt;br /&gt;
* FILE: ''spec/helpers/assignment_helper_spec.rb''&lt;br /&gt;
** METHODS TO TEST: &lt;br /&gt;
*** questionnaire(assignment, type, round_number, topic_id)&lt;br /&gt;
*** assignment_questionnaire(assignment, type, number, topic_id)&lt;br /&gt;
* FILE: ''spec/models/review_response_map_spec.rb''&lt;br /&gt;
*** METHODS TO TEST:&lt;br /&gt;
**** questionnaire(round, topic_id)&lt;br /&gt;
* FILE: ''spec/models/self_review_response_map_spec.rb''&lt;br /&gt;
*** METHODS TO TEST:&lt;br /&gt;
**** questionnaire(round, topic_id)&lt;br /&gt;
* FILE: ''spec/models/assignment_spec.rb''&lt;br /&gt;
*** METHODS TO TEST:&lt;br /&gt;
**** review_questionnaire_id(round, topic_id)&lt;br /&gt;
**** varying_rubrics_by_topic?()&lt;br /&gt;
&lt;br /&gt;
Run these tests, to ensure that the new code works as intended.&lt;br /&gt;
The commands and results are shown below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  [to be populated after coding is complete]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The test suite for a single new method is shown below.&lt;br /&gt;
* There are many such suites added in expertiza/spec  &lt;br /&gt;
* This example illustrates our general strategy:&lt;br /&gt;
** test missing input&lt;br /&gt;
** test bad input&lt;br /&gt;
** test various acceptable forms of input&lt;br /&gt;
** test scenarios that lead to various return values&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  describe &amp;quot;#questionnaire&amp;quot; do&lt;br /&gt;
&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;throws exception if assignment argument nil&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;throws exception if all arguments nil except for assignment&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;finds by type if round number &amp;amp; topic id not given&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;throws exception if round number &amp;amp; topic id not given, no luck finding by type&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;finds by round number alone if round number alone is given&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;creates new questionnaire of given type if round number alone is given, no luck finding by round&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;finds by topic id alone if topic id alone is given&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;creates new questionnaire of given type if topic id alone is given, no luck finding by topic&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;finds by round number and topic id if both are given&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;creates new questionnaire of given type if round and topic are given, no luck finding by round and topic&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== UI Testing ===&lt;br /&gt;
&lt;br /&gt;
Here we describe manual UI Testing that was performed.&lt;br /&gt;
&lt;br /&gt;
==== Rubric does not vary by round or by topic ====&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
==== Rubric varies by round, but not by topic ====&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
==== Rubric varies by topic, but not by round ====&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
==== Rubric varies by both round and topic ====&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
== Future Work ==&lt;br /&gt;
&lt;br /&gt;
This section discusses possible future work for another CSC 517 team to take on.  Such a team can search the Expertiza codebase for &amp;quot;TODO E1936 (future work)&amp;quot; to find the places in the code that the notes below refer to.&lt;br /&gt;
&lt;br /&gt;
* Reduce the delay between changing the state of the &amp;quot;Review rubric varies by topic?&amp;quot; checkbox on the Rubrics tab, and the show / hide of rubric drop-downs on the Topics tab.&lt;br /&gt;
* Redesign UI for tone analysis, heatmaps, and review scores pop-up.  These areas are designed around the assumption that reviews do NOT vary by topic.  For example, in the review scores pop-up, a reviewer can see the reviews they have given, arranged by question, across multiple reviewees.&lt;br /&gt;
&lt;br /&gt;
== Useful Links ==&lt;br /&gt;
In this section we provide useful links related to the work that has been completed by our team.&lt;br /&gt;
# [https://github.com/gabalmat/expertiza Forked Project Repository]&lt;br /&gt;
# [https://github.com/expertiza/expertiza/pull/1444 Pull Request]&lt;br /&gt;
# [(add link here) Video Demonstration of Specialized Rubrics]&lt;br /&gt;
# [(add link here) Video Demonstration of Passing Rspec Tests]&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Contacts ===&lt;br /&gt;
We have 4 (four) members in our team and 1 (one) mentor was also assigned to us. For any project-related questions/concerns please contact us:&lt;br /&gt;
* Aurora Tiffany-Davis - attiffan@ncsu.edu&lt;br /&gt;
* Ginger Balmat - gabalmat@ncsu.edu&lt;br /&gt;
* Joe Hutchinson - jehutch3@ncsu.edu&lt;br /&gt;
* Nikolay Titov - ngtitov@ncsu.edu&lt;br /&gt;
* Zhewei Hu (mentor) - zhu6@ncsu.edu&lt;br /&gt;
&lt;br /&gt;
=== Contribution Based Inquiry ===&lt;br /&gt;
For any questions or concerns related to the project design, implementation, testing of the feature developed by our team, please contact an engineer who worked closely on the topic of your interest based on the [https://docs.google.com/spreadsheets/d/11uxuI_5gaC-FQDwIOxtCaN3HZ9bfWDJgIjFemtYV5jE/edit?ts=5ca222f3#gid=0 Contribution Assignment Grid] we created to keep track of our progress and contribution. Please carbon copy all team members and our mentor in the email.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* Expertiza Web [https://github.com/expertiza/expertiza#expertiza]&lt;br /&gt;
* Expertiza on GitHub [https://github.com/expertiza/expertiza]&lt;br /&gt;
* Expertiza Wiki [http://wikis.lib.ncsu.edu/index.php/Expertiza]&lt;br /&gt;
* Rspec Documentation [https://relishapp.com/rspec]&lt;br /&gt;
* Wiki with Previous Work [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1873_Specialized_rubics_for_different_topic_types]&lt;br /&gt;
* Pull Request of the Previous Work [https://github.com/expertiza/expertiza/pull/1327]&lt;/div&gt;</summary>
		<author><name>Ngtitov</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Use_case_diagram.png&amp;diff=124338</id>
		<title>File:Use case diagram.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Use_case_diagram.png&amp;diff=124338"/>
		<updated>2019-04-26T02:50:16Z</updated>

		<summary type="html">&lt;p&gt;Ngtitov: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Ngtitov</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics&amp;diff=124337</id>
		<title>E1936 Specialized Rubrics</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics&amp;diff=124337"/>
		<updated>2019-04-26T02:49:40Z</updated>

		<summary type="html">&lt;p&gt;Ngtitov: /* User Case Diagram */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page describes the work and goals that have been completed and achieved while implementing Expertiza Project &amp;quot;''E1936. Specialized Rubrics for Different Topic Types (e.g., Servo project, refactoring project)''&amp;quot; for the CSC/ECE 517 &amp;quot;Object-Oriented Design and Development&amp;quot; class, in the Spring semester of the 2019.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This Wiki page is created per CSC/ECE 517: &amp;quot;Object-Oriented Design and Development&amp;quot;, Expertiza Project requirements (Spring, 2019).&lt;br /&gt;
&lt;br /&gt;
Our [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Team team] was assigned the project &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936. Specialized rubrics for different topic types (e.g., Servo project, refactoring project)]&amp;quot;.  This is an Expertiza project.&lt;br /&gt;
&lt;br /&gt;
In this wiki page we describe the problem to be solved, how we solve that problem, and how we test our solution.  We also provide helpful links and contact information for our team.&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
In this section, we discuss the problem we need to solve, the Expertiza feature this problem is related to, what needs to be done to solve the problem (at a high level), and the previous attempt to solve this problem.&lt;br /&gt;
&lt;br /&gt;
=== Problem Statement ===&lt;br /&gt;
&lt;br /&gt;
This problem statement summarizes the problem as described in the project description &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936. Specialized rubrics for different topic types (e.g., Servo project, refactoring project)]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
In CSC/ECE 517, there are several types of topics that could be covered in a single class assignment.&lt;br /&gt;
* Code base&lt;br /&gt;
** Expertiza&lt;br /&gt;
** Mozilla&lt;br /&gt;
** etc.&lt;br /&gt;
* Goal&lt;br /&gt;
** Refactoring&lt;br /&gt;
** Testing&lt;br /&gt;
** etc.&lt;br /&gt;
However, currently we can only specify one kind of rubric for an assignment.  This means that teams working on different topics will be evaluated using the same rubric.  With this setup, it's not possible to fine-tune rubrics for different topics - rubrics tend to be overly general.&lt;br /&gt;
&lt;br /&gt;
=== Feature Description ===&lt;br /&gt;
&lt;br /&gt;
The Expertiza project already has a feature that allows rubrics to vary by project phase or &amp;quot;round&amp;quot;.  The feature we will add in this project is a feature to allow rubrics to vary not only by round, but also by topic.  This allows more flexibility to the instructor when setting up an assignment, so that they can use rubrics better suited to the tasks that students are performing in an assignment.&lt;br /&gt;
&lt;br /&gt;
When this feature is complete, the following scenarios will be possible, and the instructor will be the judge of which scenario is the best fit to the assignment:&lt;br /&gt;
&lt;br /&gt;
* Rubric does not vary by round or by topic.&lt;br /&gt;
* Rubric varies by round, but not by topic.&lt;br /&gt;
* Rubric varies by topic, but not by round.&lt;br /&gt;
* Rubric varies by both round and topic.&lt;br /&gt;
&lt;br /&gt;
=== What Needs to be Done ===&lt;br /&gt;
&lt;br /&gt;
This section summarizes the work as described in the project description &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936. Specialized rubrics for different topic types (e.g., Servo project, refactoring project)]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* In assignment#edit page &amp;quot;Rubrics&amp;quot; tab, add a checkbox to specify whether rubric should vary by topic.&lt;br /&gt;
* In assignment#edit page &amp;quot;Topics&amp;quot; tab, add dropdown(s) next to each topic to specify which rubric(s) are associated with the topic.&lt;br /&gt;
** The dropdown(s) should appear only if rubric should vary by topic, per the Rubrics tab.&lt;br /&gt;
** The topic should have a multiple dropdowns (one for each round) only if rubrics vary by round, per the Rubrics tab.&lt;br /&gt;
** By default, the rubric(s) for each course project will be the one(s) specified in “Rubrics” tab.&lt;br /&gt;
** The dropdown value can overwrite the default rubric.&lt;br /&gt;
* Be careful when making changes to the code&lt;br /&gt;
** The signup_sheet_controller should have as little to do as possible with the selection of rubrics.&lt;br /&gt;
** Anything not germane to selecting topics should be in another controller or (more probably) a helper.&lt;br /&gt;
* Create a DB migration to allow rubric to vary by topic as well as by round.&lt;br /&gt;
&lt;br /&gt;
==== Screenshots ====&lt;br /&gt;
'''Current screenshot of Rubrics tab for an Assignment'''&lt;br /&gt;
(need to add a checkbox to indicate that rubric should vary by topic)&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Screenshot Assignment Edit Rubrics.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Current screenshot of Topics tab for an Assignment'''&lt;br /&gt;
(need to add a way to select rubrics for particular topics)&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Screenshot Assignment Edit Topics.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Proposed screenshot of Rubrics tab for an Assignment'''&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Specialized Rubric rubric checkbox.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Proposed screenshot of Topics tab for an Assignment'''&lt;br /&gt;
&lt;br /&gt;
(drop down shown for only one topic here, but final product will have one for each topic)&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Specialized Rubric dropdown menu.png]]&lt;br /&gt;
&lt;br /&gt;
== Previous Work ==&lt;br /&gt;
&lt;br /&gt;
There was previous attempt to implement this project in the Fall of 2018 semester by different team, but it was rejected due to several reasons. Our team was provided with all relevant information and materials about the design and implementation of the previously attempted project. We would like to acknowledge that we use previous implementation and design as reference and our starting point for our own implementation. The following is the list of links with the relevant materials that we have used for better project understanding, determining pros and cons of previously proposed changes, and establishing our design strategy and implementation:&lt;br /&gt;
&lt;br /&gt;
# [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1873_Specialized_rubics_for_different_topic_types Wiki]&lt;br /&gt;
# [https://github.com/expertiza/expertiza/pull/1327 Pull Request]&lt;br /&gt;
# [https://drive.google.com/file/d/1UrLb0Ula_Lb_F4MOrdC-s6xng6B08VYu/view Video Demo]&lt;br /&gt;
&lt;br /&gt;
After reviewing all relevant materials above, we concluded that the project implementation was incomplete and proposed design had significant flaw. &lt;br /&gt;
We identified main drawbacks and flaw as follows:&lt;br /&gt;
&lt;br /&gt;
* Establishing incorrect ''many-to-one'' relationship between ''sign_up_topics'' and ''questionnaires'' tables:&lt;br /&gt;
** Creating a DB migration to add ''questionnaire_id'' in the ''sign_up_topics'' table to store the dropdown data presumes ''one-to-one'' or ''many-to-one'' relationship between ''sign_up_topics'' and ''questionnaires'' tables&lt;br /&gt;
** Correct relationship between ''sign_up_topics'' and ''questionnaires'' tables is ''many-to-many''. For example, each project topic may have various rubrics depending on the round it is used (e.g., for round 1, topic may have one rubric; but for round 2, the same topic may have different rubric)&lt;br /&gt;
** Proposed previous migration changes would break DB design and would not allow to store correctly topic and its associated rubric per different round.&lt;br /&gt;
* Per project requirement specifications, &amp;quot;''The dropdown box should appear only if 'Vary rubric by topic' is selected in the Rubrics tab.''&amp;quot; This requirement was not met and ''Vary rubric by topic'' checkbox in the Rubrics tab was not implemented. Therefore, dropdown box with the list of rubrics appears regardless of whether &amp;quot;''Vary rubric by topic''&amp;quot; is selected or not.&lt;br /&gt;
* The dropdown box includes the list of all possible rubrics including default value. However, this condition can be improved. The dropdown box should list the rubrics that were created by the current user (professor who is logged in). This would allow to shorten the list of possible rubrics dramatically and help to avoid any misunderstanding and confusion while user selects desired rubric for the course project.&lt;br /&gt;
&lt;br /&gt;
We found no further issues with the rest implementation and in other project materials. Wiki page is very useful for understanding design of proposed changes, finding drawbacks and the flaw. Considering all the pros and cons, and taking into account drawbacks of the proposed changes, our team evolved different approach that should successfully solve the problem stated for the project without without creating additional issues. Please see our [http://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics#Project_Implementation Project Implementation] for more details.&lt;br /&gt;
&lt;br /&gt;
== Previous Project Requirements ==&lt;br /&gt;
&lt;br /&gt;
The project requirements originally specified how to alter the databases to support varying rubrics by topic.&lt;br /&gt;
&lt;br /&gt;
''Create a new table named topic_questionnaires with field:''&lt;br /&gt;
* ''id''&lt;br /&gt;
* ''topic_id''&lt;br /&gt;
* ''questionnaire_id''&lt;br /&gt;
* ''used_in_round''&lt;br /&gt;
&lt;br /&gt;
However, the E1936 team successfully petitioned for this requirement to change to give us more freedom in the implementation.  The original suggestion had a flaw.  There is already an existing table in the Expertiza project called ''assignment_questionnaires'', which has columns including ''assignment_id'', ''questionnaire_id'', and ''used_in_round''.  It is this table that maintains the knowledge of which rubric is used in which round of an assignment.  If we were to add a new table to maintains the knowledge of which rubric is used in which topic of an assignment as originally suggested, then we would have a big problem.  Knowledge of round-rubric relationship is duplicated.  This would lead (best case scenario) to extra work, and (worst case scenario) to lots of bugs caused by inconsistencies in how these tables are handled with CRUD operations throughout the code.  In other words, this is not a DRY solution.&lt;br /&gt;
&lt;br /&gt;
== Project Implementation ==&lt;br /&gt;
&lt;br /&gt;
In this section, we propose our solution to the problem, discuss implementation techniques and details, and list the goals we achieved.&lt;br /&gt;
&lt;br /&gt;
We start by analyzing Entity Relationship Diagram where we state the solution to the problem. Further we discuss design strategy by breaking project problem into multiple staged sub-problems and provide solutions for each of these sub-problems. We also discuss some implementation details and provide the list of involved files. Finally, we demonstrate how the implemented feature can be used by providing a ''How To'' sub-section.&lt;br /&gt;
&lt;br /&gt;
=== Diagrams ===&lt;br /&gt;
&lt;br /&gt;
Our solution and implementation of the project can be easily shown by discussing Use Case, Entity Relationship, and Class diagrams. First, for simplicity we discuss in general possible sequence of interactions between a user (in this case instructor) and the system (Expertiza) via presenting Use Case Diagram. Then we plan to show proposed database modification via Entity Relationship Diagram.&lt;br /&gt;
&lt;br /&gt;
==== User Case Diagram ====&lt;br /&gt;
&lt;br /&gt;
[[File: use_case_diagram.png]]&lt;br /&gt;
&lt;br /&gt;
The above Use Case Diagram shows general sequence of interactions between an instructor and the system (Expertiza) that defines where and how the feature is implemented. Note that highlighted use cases are objects of our interest and work. Also please note that all of the shown use cases already exist in the system and we simply adding new feature into the system. Particularly, the rubric for each assignment and newly added ''Review rubric varies by topic'' checkbox with which instructor may choose to vary assignment by topic or not by checking and unchecking the checkbox is displayed in the ''Rubrics'' tab. Hence, we show how instructor can get to the ''Rubrics'' tab of the assignments. Similarly, ''Topics'' tab of assignments has additional ''Questionnaires'' column for each topic, where instructor may specify which rubric associates with the topic. To perform such sequence of iterations, instructor must choose ''Edit'' any assignment from the list of all assignments displayed to him/her.&lt;br /&gt;
&lt;br /&gt;
==== Entity Relationship Diagram ====&lt;br /&gt;
&lt;br /&gt;
[[File: HW04_ERD.png]]&lt;br /&gt;
&lt;br /&gt;
The sections of the diagram highlighted in yellow show newly introduced items.  That is, we are adding a new column called ''topic_id'' to ''assignment_questionnaires'', in order to link ''assignment_questionnaires'' to ''sign_up_topics''.&lt;br /&gt;
&lt;br /&gt;
Any assignment, topic, or questionnaire may be represented by multiple records within ''assignment_questionnaires'', but each record within ''assignment_questionnaires'' refers to just one assignment, topic, or questionnaire.  It is the ability to have an assignment represented by multiple records, and the new relationship to ''sign_up_topics'', that allows us to support all of the required scenarios:&lt;br /&gt;
&lt;br /&gt;
* Rubric does not vary by round or by topic.&lt;br /&gt;
* Rubric varies by round, but not by topic.&lt;br /&gt;
* Rubric varies by topic, but not by round.&lt;br /&gt;
* Rubric varies by both round and topic.&lt;br /&gt;
&lt;br /&gt;
[[File: HW04_table.PNG]]&lt;br /&gt;
&lt;br /&gt;
This table illustrates the possibilities that the system may have.&lt;br /&gt;
&lt;br /&gt;
* Assignment 1 does not vary by round or by topic.&lt;br /&gt;
* Assignment 2 varies by round, but not by topic.&lt;br /&gt;
* Assignment 3 varies by topic, but not by round.&lt;br /&gt;
* Assignment 4 varies by both round and topic.&lt;br /&gt;
&lt;br /&gt;
This change is done via database migration by running the following commands:&lt;br /&gt;
&lt;br /&gt;
  rails generate migration AddTopicIdToAssignmentQuestionnaires&lt;br /&gt;
  rb db:migrate&lt;br /&gt;
&lt;br /&gt;
Above command adds the ''topic_id'' column to the ''AssignmentQuestionnaires'' table and generates new migration file:&lt;br /&gt;
&lt;br /&gt;
[[File: db_migration.png]]&lt;br /&gt;
&lt;br /&gt;
To see the details of the entire database change please check this [https://github.com/gabalmat/expertiza/commit/d46dd57d35a21ab43efb82c28d3f14b75c695f2e commit].&lt;br /&gt;
&lt;br /&gt;
==== Class Diagram ====&lt;br /&gt;
&lt;br /&gt;
This is Class Class diagram.&lt;br /&gt;
&lt;br /&gt;
=== Design Strategy ===&lt;br /&gt;
&lt;br /&gt;
As we have concrete understanding of the problem and proposed solution, we would like break this problem into multiple more manageable sub-problems with specific tasks and well-defined solutions to these tasks. Generally, each sub-problem requires modification of one or more files. We would like to propose our Design Strategy as follows:&lt;br /&gt;
&lt;br /&gt;
==== Preparation ====&lt;br /&gt;
&lt;br /&gt;
* Clean up code that our implementation will use&lt;br /&gt;
** PROBLEM: We need to add/change content to the edit assignment Topics tab, but unlike other tabs in the views, it does not have its own partial view to work with&lt;br /&gt;
*** SOLUTION: Refactor and move the code dealing with topics into separate ''app/views/assignments/edit/_topics.html.erb'' file&lt;br /&gt;
*** File: ''app/views/assignments/edit.html.erb''&lt;br /&gt;
** PROBLEM: In a section below, we discuss the need to modify existing methods to also accept an optional argument ''topic_id''.  In many cases these existing method use confusing variable names or lack sufficient comments.&lt;br /&gt;
*** SOLUTION: Clean up methods that we plan to modify&lt;br /&gt;
*** FILE: (many)&lt;br /&gt;
&lt;br /&gt;
==== Implementation ====&lt;br /&gt;
&lt;br /&gt;
* Allow an instructor to indicate that rubric should vary by topic&lt;br /&gt;
** PROBLEM: There is no way for an instructor to indicate that an assignments' rubric should vary by topic&lt;br /&gt;
*** SOLUTION: Add a new checkbox in the edit assignment Rubric tab to indicate this preference&lt;br /&gt;
*** FILE: ''app/views/assignments/edit/_rubrics.html.erb''&lt;br /&gt;
&lt;br /&gt;
* Allow an instructor to choose different rubrics for different topics&lt;br /&gt;
** PROBLEM: There is no way for an instructor to choose different rubrics for different topics&lt;br /&gt;
*** SOLUTION: Add a new column in the edit assignment Topics tab for choosing rubric(s)&lt;br /&gt;
**** New column only visible if rubrics vary by topic, per Rubrics tab&lt;br /&gt;
**** New column has multiple rounds per topic only if rubrics vary by round, per Rubrics tab&lt;br /&gt;
**** Default value for any rubric is that rubric which is shown on Rubrics tab&lt;br /&gt;
**** Rubric(s) in the dropdown list is/are only those that were created by the currently logged in instructor&lt;br /&gt;
*** FILE: ''app/views/assignments/edit/_topics.html.erb''&lt;br /&gt;
** PROBLEM: The code in ''app/views/assignments/edit/_rubrics.html.erb'' includes dropdowns like the ones we need to add for topics, but that code is way too complex for its functionality (too heavy for a view, uses JavaScript)&lt;br /&gt;
*** SOLUTION: Use the code in ''app/views/assignments/edit/_rubrics.html.erb'' for inspiration only&lt;br /&gt;
**** Refactor and move as much actual work as possible out into helper methods that are simply called from this view&lt;br /&gt;
**** Views are not intended to do heavy lifting&lt;br /&gt;
**** Use as little JavaScript as possible, since this is a Ruby On Rails project, not a JS project&lt;br /&gt;
*** FILE: ''app/views/assignments/edit/_topics.html.erb''&lt;br /&gt;
&lt;br /&gt;
* Support the ability of the database to link rubrics to topics&lt;br /&gt;
** PROBLEM: There is no relationship in the database that can link together rubrics with topics&lt;br /&gt;
*** SOLUTION: Add a new migration that adds topic_id field to existing assignment_questionnaires table&lt;br /&gt;
**** This new field will reference the id field in the sign_up_topics table&lt;br /&gt;
*** FILE: ''db/migrate/[timestamp]_add_topic_id_to_assignment_questionnaires_table.rb''&lt;br /&gt;
** PROBLEM: The AssignmentQuestionnaire model does not have any knowledge of topics&lt;br /&gt;
*** SOLUTION: Add a new belongs_to reference in the model, to sign_up_topic&lt;br /&gt;
*** FILE: ''app/models/assignment_questionnaire.rb''&lt;br /&gt;
** PROBLEM: The SignUpTopic model does not have any knowledge of assignment_questionnaire records&lt;br /&gt;
*** SOLUTION: Add a new has_many reference in the model, to assignment_questionnaires&lt;br /&gt;
*** FILE: ''app/models/sign_up_topic.rb''&lt;br /&gt;
&lt;br /&gt;
* React to an instructor saving an assignment after altering the rubrics-vary-by-topic checkbox&lt;br /&gt;
** PROBLEM: There is nothing in place to remember when an instructor chooses to vary rubrics by topic, or chooses to not vary rubrics by topic&lt;br /&gt;
*** SOLUTION: Modify existing method ''update_assignment_questionnaires()''.  This method executes upon assignment save (explicit or via tab-change).  This method deletes all ''AssignmentQuestionnaire'' records before creating new correct records reflecting the user's selections in the edit assignment form.  Modify such that this method can create multiple records reflecting multiple topics, in the case where rubric should vary by topic.  With this modification, the correct records (with default rubrics) are present when the user goes to the Topics tab, so that the Topics tab can display properly.&lt;br /&gt;
*** FILE: app\models\assignment_form.rb&lt;br /&gt;
** PROBLEM: There is no way to refresh the Topics tab to show / hide drop-downs after the instructor changes checkbox on Rubrics tab&lt;br /&gt;
*** SOLUTION: Make use of existing &amp;quot;Save&amp;quot;-like functionality when changing tabs on the edit assignment page.  When updating due to tab-change, cause a fresh render of the Topics tab.  When updating due to &amp;quot;Save&amp;quot; button, keep functionality as-is.&lt;br /&gt;
*** FILE: ''app/controllers/assignments_controller.rb''&lt;br /&gt;
*** FILE: ''app/views/assignments/edit.html.erb''&lt;br /&gt;
&lt;br /&gt;
* Support the ability to find the correct rubric for a particular topic&lt;br /&gt;
** PROBLEM: The existing methods allow us to find the correct rubric for a particular round, but not a particular topic&lt;br /&gt;
*** SOLUTION: Modify the existing method questionnaire(assignment, type, round_number) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/helpers/assignment_helper.rb''&lt;br /&gt;
*** SOLUTION: Modify the existing method assignment_questionnaire(assignment, type, number) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/helpers/assignment_helper.rb''&lt;br /&gt;
*** SOLUTION: Modify the existing method questionnaire(round = nil) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/models/review_response_map.rb''&lt;br /&gt;
*** SOLUTION: Modify the existing method questionnaire(round) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/models/self_review_response_map.rb''&lt;br /&gt;
*** SOLUTION: Modify the existing method review_questionnaire_id(round = nil) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/models/assignment.rb''&lt;br /&gt;
&lt;br /&gt;
* Use the correct rubric for a particular topic&lt;br /&gt;
** PROBLEM: When finding rubrics to display, save results from, calculate scores from, etc. round may be used but topic is not&lt;br /&gt;
*** SOLUTION: Examine all callers of methods modified in the previous section and pass in ''topic_id'' where appropriate to grab the correct rubric&lt;br /&gt;
*** FILE: (many)&lt;br /&gt;
&lt;br /&gt;
* Support the ability to determine if an assignment has rubrics that vary by topic&lt;br /&gt;
** PROBLEM: There is no handy method to call that can tell us if an assignment has rubrics that vary by topic&lt;br /&gt;
*** SOLUTION: Add a new method ''varying_rubrics_by_topic?'' based on the existing method ''varying_rubrics_by_round?''&lt;br /&gt;
*** FILE: ''app/models/assignment.rb''&lt;br /&gt;
&lt;br /&gt;
=== Q&amp;amp;A ===&lt;br /&gt;
&lt;br /&gt;
Here we paraphrase some questions we received during round 1 of the documentation review.&lt;br /&gt;
&lt;br /&gt;
* Q: How will the new logic for varying rubric by topic tie in with the existing logic?&lt;br /&gt;
** A: We will add a new field ''topic_id'' into the existing table ''assignment_questionnaires'', as noted in the [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Entity_Relationship_Diagram E/R Diagram].  We will update methods that find questionnaires to allow these methods to also accept a ''topic_id'' argument, as noted in [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Implementation Implementation].&lt;br /&gt;
* Q: How will the &amp;quot;Rubric varies by topic&amp;quot; selection be stored?&lt;br /&gt;
** A: Indirectly, by saving records in the ''assignment_questionnaires'' table which either reference a ''topic_id'' or leave this field nil.  For more details please see the [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Entity_Relationship_Diagram E/R Diagram] discussion.&lt;br /&gt;
* Q: What will happen if an instructor selects &amp;quot;Rubric varies by topic&amp;quot;, makes selections on the &amp;quot;Topics&amp;quot; tab, and then deselects &amp;quot;Rubric varies by topic&amp;quot;?&lt;br /&gt;
** A: The Topics tab, when next visited, will no longer show dropdowns for selecting rubrics by topic.  When the assignment is saved, the appropriate not-varying-by-topic records will be saved in the ''assignment_questionnaires'' table.  For more details please see [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Implementation Implementation].&lt;br /&gt;
* Q: What will happen after an instructor selects &amp;quot;Rubric varies by topic&amp;quot;?&lt;br /&gt;
** A: The Topics tab, when next visited, will now show dropdowns for selecting rubrics by topic.  These rubrics will default to those shown on the Rubrics tab.  When the assignment is saved, the appropriate varying-by-topic records will be saved in the ''assignment_questionnaires'' table.  For more details please see [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Implementation Implementation].&lt;br /&gt;
* Q: How will the appropriate list of questionnaires for the new dropdowns on the Topics tab be determined?&lt;br /&gt;
** A: In the same way that the appropriate list of questionnaires for the existing dropdowns on the Rubrics tab is determined.  Namely, by the ''questionnaire_options'' method in the file ''expertiza/app/helpers/assignment_helper.rb''.&lt;br /&gt;
&lt;br /&gt;
=== (Selected) Modified Code ===&lt;br /&gt;
&lt;br /&gt;
In this section, we provide ''selected portions'' of modified code to illustrate how we implemented the new feature.&lt;br /&gt;
&lt;br /&gt;
Allow an instructor to indicate that rubric should vary by topic&lt;br /&gt;
&lt;br /&gt;
''app\views\assignments\edit\_rubrics.html.erb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;lt;input name=&amp;quot;vary_by_topic&amp;quot; type=&amp;quot;hidden&amp;quot; value=&amp;quot;false&amp;quot; /&amp;gt;&lt;br /&gt;
  &amp;lt;%= check_box_tag('vary_by_topic', 'true', @review_vary_by_topic_check) %&amp;gt;&lt;br /&gt;
  &amp;lt;%= label_tag('vary_by_topic', 'Review rubric varies by topic?') %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Allow an instructor to choose different rubrics for different topics&lt;br /&gt;
&lt;br /&gt;
''app\views\sign_up_sheet\_table_line.html.erb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;lt;% if @assignment_form.assignment.varying_rubrics_by_topic? %&amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;table id = &amp;lt;%=table_id %&amp;gt;&amp;gt;&lt;br /&gt;
        &amp;lt;tr&amp;gt;&lt;br /&gt;
          &amp;lt;script&amp;gt;&lt;br /&gt;
              ...&lt;br /&gt;
              &amp;lt;% if @assignment_form.assignment.varying_rubrics_by_round? %&amp;gt;&lt;br /&gt;
                &amp;lt;% for round in 1..@assignment_form.assignment.rounds_of_reviews %&amp;gt;&lt;br /&gt;
                  ...&lt;br /&gt;
                &amp;lt;% end %&amp;gt;&lt;br /&gt;
              &amp;lt;% else %&amp;gt;&lt;br /&gt;
                ...&lt;br /&gt;
              &amp;lt;% end %&amp;gt;&lt;br /&gt;
          &amp;lt;/script&amp;gt;&lt;br /&gt;
        &amp;lt;/tr&amp;gt;&lt;br /&gt;
      &amp;lt;/table&amp;gt;&lt;br /&gt;
    &amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Support the ability of the database to link rubrics to topics&lt;br /&gt;
&lt;br /&gt;
''app\models\sign_up_topic.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  class SignUpTopic &amp;lt; ActiveRecord::Base&lt;br /&gt;
    ...&lt;br /&gt;
    has_many :assignment_questionnaires, class_name: 'AssignmentQuestionnaire', foreign_key: 'topic_id', dependent: :destroy&lt;br /&gt;
    ...&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
React to an instructor saving an assignment after altering the rubrics-vary-by-topic checkbox&lt;br /&gt;
&lt;br /&gt;
''app/controllers/assignments_controller.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def update&lt;br /&gt;
    ...&lt;br /&gt;
    # What to do next depends on how we got here&lt;br /&gt;
    if params['button'].nil?&lt;br /&gt;
      # REFRESH the topics tab after changing tabs&lt;br /&gt;
      ...&lt;br /&gt;
      render :partial =&amp;gt; &amp;quot;assignments/edit/topics&amp;quot;&lt;br /&gt;
    else&lt;br /&gt;
      # SAVE button was used (do a redirect)&lt;br /&gt;
      redirect_to edit_assignment_path @assignment_form.assignment.id&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Support the ability to find the correct rubric for a particular topic&lt;br /&gt;
&lt;br /&gt;
''app/helpers/assignment_helper.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def assignment_questionnaire(assignment, questionnaire_type, round_number = nil, topic_id = nil)&lt;br /&gt;
    q_by_type = assignment.questionnaires.find_by(type: questionnaire_type)&lt;br /&gt;
    if q_by_type.nil?&lt;br /&gt;
      ...&lt;br /&gt;
    else&lt;br /&gt;
      ...&lt;br /&gt;
      aq_by_type = assignment.assignment_questionnaires.find_by(questionnaire_id: q_by_type.id)&lt;br /&gt;
      if round_number.nil? &amp;amp;&amp;amp; topic_id.nil?&lt;br /&gt;
        # Find by type&lt;br /&gt;
        aq = aq_by_type&lt;br /&gt;
      elsif topic_id.nil?&lt;br /&gt;
        # Find by round&lt;br /&gt;
        aq = assignment.assignment_questionnaires.find_by(used_in_round: round_number)&lt;br /&gt;
      elsif round_number.nil?&lt;br /&gt;
        # Find by topic&lt;br /&gt;
        aq = assignment.assignment_questionnaires.find_by(topic_id: topic_id)&lt;br /&gt;
      else&lt;br /&gt;
        # Find by round and topic&lt;br /&gt;
        aq = assignment.assignment_questionnaires.where(used_in_round: round_number, topic_id: topic_id).first&lt;br /&gt;
      end&lt;br /&gt;
      aq.nil? ? aq_by_type : aq&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use the correct rubric for a particular topic&lt;br /&gt;
&lt;br /&gt;
''app\controllers\response_controller.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def set_questionnaire_for_new_response&lt;br /&gt;
    case @map.type&lt;br /&gt;
    when &amp;quot;ReviewResponseMap&amp;quot;, &amp;quot;SelfReviewResponseMap&amp;quot;&lt;br /&gt;
      reviewees_topic = SignedUpTeam.topic_id_by_team_id(@contributor.id)&lt;br /&gt;
      @current_round = @assignment.number_of_current_round(reviewees_topic)&lt;br /&gt;
      @questionnaire = @map.questionnaire(@current_round, reviewees_topic)&lt;br /&gt;
    when&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Support the ability to determine if an assignment has rubrics that vary by topic&lt;br /&gt;
&lt;br /&gt;
''app\models\assignment.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def varying_rubrics_by_topic?&lt;br /&gt;
    aq_no_topic_id = AssignmentQuestionnaire.where(assignment_id: self.id, topic_id: nil).size &amp;gt;= 1&lt;br /&gt;
    aq_with_topic_id = AssignmentQuestionnaire.where(assignment_id: self.id).where.not(topic_id: nil).size &amp;gt;= 1&lt;br /&gt;
    if !aq_no_topic_id &amp;amp;&amp;amp; !aq_with_topic_id&lt;br /&gt;
      return false&lt;br /&gt;
    elsif aq_no_topic_id &amp;amp;&amp;amp; !aq_with_topic_id&lt;br /&gt;
      return false&lt;br /&gt;
    elsif !aq_no_topic_id &amp;amp;&amp;amp; aq_with_topic_id&lt;br /&gt;
      return true&lt;br /&gt;
    else&lt;br /&gt;
      raise StandardError.new(&amp;quot;Assignment with id &amp;quot; + self.id.to_s + &amp;quot; has a conflict about whether or not it varies by topic&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== How To ==&lt;br /&gt;
&lt;br /&gt;
In this section, we describe how to use the newly implemented feature.&lt;br /&gt;
&lt;br /&gt;
=== Add a New Rubric ===&lt;br /&gt;
&lt;br /&gt;
* [to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
=== Select a Rubric for a Topic ===&lt;br /&gt;
&lt;br /&gt;
* [to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
== Project Testing ==&lt;br /&gt;
&lt;br /&gt;
=== Strategy ===&lt;br /&gt;
&lt;br /&gt;
To test code implementation, correctness of the added feature, verify that the team did not break any existing functionalities in the Expertiza, and ensure that no bugs were introduced in the code, we developed the following Test Strategy:&lt;br /&gt;
&lt;br /&gt;
# Code inspection&lt;br /&gt;
# Run and pass existing RSpec Tests&lt;br /&gt;
# Develop New RSpec Tests&lt;br /&gt;
# Run through live UI to test a feature using Expertiza instance&lt;br /&gt;
&lt;br /&gt;
=== Rspec Testing ===&lt;br /&gt;
&lt;br /&gt;
==== Existing Tests ====&lt;br /&gt;
&lt;br /&gt;
Run all existing RSpec tests on any changed files, after our changes, to ensure that we have not introduced any failures.&lt;br /&gt;
The commands and results are shown below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  [to be populated after coding is complete]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== New Tests ====&lt;br /&gt;
&lt;br /&gt;
Write comprehensive RSpec tests, for all new or modified methods.&lt;br /&gt;
* FILE: ''spec/helpers/assignment_helper_spec.rb''&lt;br /&gt;
** METHODS TO TEST: &lt;br /&gt;
*** questionnaire(assignment, type, round_number, topic_id)&lt;br /&gt;
*** assignment_questionnaire(assignment, type, number, topic_id)&lt;br /&gt;
* FILE: ''spec/models/review_response_map_spec.rb''&lt;br /&gt;
*** METHODS TO TEST:&lt;br /&gt;
**** questionnaire(round, topic_id)&lt;br /&gt;
* FILE: ''spec/models/self_review_response_map_spec.rb''&lt;br /&gt;
*** METHODS TO TEST:&lt;br /&gt;
**** questionnaire(round, topic_id)&lt;br /&gt;
* FILE: ''spec/models/assignment_spec.rb''&lt;br /&gt;
*** METHODS TO TEST:&lt;br /&gt;
**** review_questionnaire_id(round, topic_id)&lt;br /&gt;
**** varying_rubrics_by_topic?()&lt;br /&gt;
&lt;br /&gt;
Run these tests, to ensure that the new code works as intended.&lt;br /&gt;
The commands and results are shown below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  [to be populated after coding is complete]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The test suite for a single new method is shown below.&lt;br /&gt;
* There are many such suites added in expertiza/spec  &lt;br /&gt;
* This example illustrates our general strategy:&lt;br /&gt;
** test missing input&lt;br /&gt;
** test bad input&lt;br /&gt;
** test various acceptable forms of input&lt;br /&gt;
** test scenarios that lead to various return values&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  describe &amp;quot;#questionnaire&amp;quot; do&lt;br /&gt;
&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;throws exception if assignment argument nil&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;throws exception if all arguments nil except for assignment&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;finds by type if round number &amp;amp; topic id not given&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;throws exception if round number &amp;amp; topic id not given, no luck finding by type&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;finds by round number alone if round number alone is given&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;creates new questionnaire of given type if round number alone is given, no luck finding by round&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;finds by topic id alone if topic id alone is given&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;creates new questionnaire of given type if topic id alone is given, no luck finding by topic&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;finds by round number and topic id if both are given&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;creates new questionnaire of given type if round and topic are given, no luck finding by round and topic&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== UI Testing ===&lt;br /&gt;
&lt;br /&gt;
Here we describe manual UI Testing that was performed.&lt;br /&gt;
&lt;br /&gt;
==== Rubric does not vary by round or by topic ====&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
==== Rubric varies by round, but not by topic ====&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
==== Rubric varies by topic, but not by round ====&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
==== Rubric varies by both round and topic ====&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
== Future Work ==&lt;br /&gt;
&lt;br /&gt;
This section discusses possible future work for another CSC 517 team to take on.  Such a team can search the Expertiza codebase for &amp;quot;TODO E1936 (future work)&amp;quot; to find the places in the code that the notes below refer to.&lt;br /&gt;
&lt;br /&gt;
* Reduce the delay between changing the state of the &amp;quot;Review rubric varies by topic?&amp;quot; checkbox on the Rubrics tab, and the show / hide of rubric drop-downs on the Topics tab.&lt;br /&gt;
* Redesign UI for tone analysis, heatmaps, and review scores pop-up.  These areas are designed around the assumption that reviews do NOT vary by topic.  For example, in the review scores pop-up, a reviewer can see the reviews they have given, arranged by question, across multiple reviewees.&lt;br /&gt;
&lt;br /&gt;
== Useful Links ==&lt;br /&gt;
In this section we provide useful links related to the work that has been completed by our team.&lt;br /&gt;
# [https://github.com/gabalmat/expertiza Forked Project Repository]&lt;br /&gt;
# [https://github.com/expertiza/expertiza/pull/1444 Pull Request]&lt;br /&gt;
# [(add link here) Video Demonstration of Specialized Rubrics]&lt;br /&gt;
# [(add link here) Video Demonstration of Passing Rspec Tests]&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Contacts ===&lt;br /&gt;
We have 4 (four) members in our team and 1 (one) mentor was also assigned to us. For any project-related questions/concerns please contact us:&lt;br /&gt;
* Aurora Tiffany-Davis - attiffan@ncsu.edu&lt;br /&gt;
* Ginger Balmat - gabalmat@ncsu.edu&lt;br /&gt;
* Joe Hutchinson - jehutch3@ncsu.edu&lt;br /&gt;
* Nikolay Titov - ngtitov@ncsu.edu&lt;br /&gt;
* Zhewei Hu (mentor) - zhu6@ncsu.edu&lt;br /&gt;
&lt;br /&gt;
=== Contribution Based Inquiry ===&lt;br /&gt;
For any questions or concerns related to the project design, implementation, testing of the feature developed by our team, please contact an engineer who worked closely on the topic of your interest based on the [https://docs.google.com/spreadsheets/d/11uxuI_5gaC-FQDwIOxtCaN3HZ9bfWDJgIjFemtYV5jE/edit?ts=5ca222f3#gid=0 Contribution Assignment Grid] we created to keep track of our progress and contribution. Please carbon copy all team members and our mentor in the email.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* Expertiza Web [https://github.com/expertiza/expertiza#expertiza]&lt;br /&gt;
* Expertiza on GitHub [https://github.com/expertiza/expertiza]&lt;br /&gt;
* Expertiza Wiki [http://wikis.lib.ncsu.edu/index.php/Expertiza]&lt;br /&gt;
* Rspec Documentation [https://relishapp.com/rspec]&lt;br /&gt;
* Wiki with Previous Work [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1873_Specialized_rubics_for_different_topic_types]&lt;br /&gt;
* Pull Request of the Previous Work [https://github.com/expertiza/expertiza/pull/1327]&lt;/div&gt;</summary>
		<author><name>Ngtitov</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics&amp;diff=124336</id>
		<title>E1936 Specialized Rubrics</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics&amp;diff=124336"/>
		<updated>2019-04-26T02:15:52Z</updated>

		<summary type="html">&lt;p&gt;Ngtitov: /* Project Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page describes the work and goals that have been completed and achieved while implementing Expertiza Project &amp;quot;''E1936. Specialized Rubrics for Different Topic Types (e.g., Servo project, refactoring project)''&amp;quot; for the CSC/ECE 517 &amp;quot;Object-Oriented Design and Development&amp;quot; class, in the Spring semester of the 2019.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This Wiki page is created per CSC/ECE 517: &amp;quot;Object-Oriented Design and Development&amp;quot;, Expertiza Project requirements (Spring, 2019).&lt;br /&gt;
&lt;br /&gt;
Our [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Team team] was assigned the project &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936. Specialized rubrics for different topic types (e.g., Servo project, refactoring project)]&amp;quot;.  This is an Expertiza project.&lt;br /&gt;
&lt;br /&gt;
In this wiki page we describe the problem to be solved, how we solve that problem, and how we test our solution.  We also provide helpful links and contact information for our team.&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
In this section, we discuss the problem we need to solve, the Expertiza feature this problem is related to, what needs to be done to solve the problem (at a high level), and the previous attempt to solve this problem.&lt;br /&gt;
&lt;br /&gt;
=== Problem Statement ===&lt;br /&gt;
&lt;br /&gt;
This problem statement summarizes the problem as described in the project description &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936. Specialized rubrics for different topic types (e.g., Servo project, refactoring project)]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
In CSC/ECE 517, there are several types of topics that could be covered in a single class assignment.&lt;br /&gt;
* Code base&lt;br /&gt;
** Expertiza&lt;br /&gt;
** Mozilla&lt;br /&gt;
** etc.&lt;br /&gt;
* Goal&lt;br /&gt;
** Refactoring&lt;br /&gt;
** Testing&lt;br /&gt;
** etc.&lt;br /&gt;
However, currently we can only specify one kind of rubric for an assignment.  This means that teams working on different topics will be evaluated using the same rubric.  With this setup, it's not possible to fine-tune rubrics for different topics - rubrics tend to be overly general.&lt;br /&gt;
&lt;br /&gt;
=== Feature Description ===&lt;br /&gt;
&lt;br /&gt;
The Expertiza project already has a feature that allows rubrics to vary by project phase or &amp;quot;round&amp;quot;.  The feature we will add in this project is a feature to allow rubrics to vary not only by round, but also by topic.  This allows more flexibility to the instructor when setting up an assignment, so that they can use rubrics better suited to the tasks that students are performing in an assignment.&lt;br /&gt;
&lt;br /&gt;
When this feature is complete, the following scenarios will be possible, and the instructor will be the judge of which scenario is the best fit to the assignment:&lt;br /&gt;
&lt;br /&gt;
* Rubric does not vary by round or by topic.&lt;br /&gt;
* Rubric varies by round, but not by topic.&lt;br /&gt;
* Rubric varies by topic, but not by round.&lt;br /&gt;
* Rubric varies by both round and topic.&lt;br /&gt;
&lt;br /&gt;
=== What Needs to be Done ===&lt;br /&gt;
&lt;br /&gt;
This section summarizes the work as described in the project description &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936. Specialized rubrics for different topic types (e.g., Servo project, refactoring project)]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* In assignment#edit page &amp;quot;Rubrics&amp;quot; tab, add a checkbox to specify whether rubric should vary by topic.&lt;br /&gt;
* In assignment#edit page &amp;quot;Topics&amp;quot; tab, add dropdown(s) next to each topic to specify which rubric(s) are associated with the topic.&lt;br /&gt;
** The dropdown(s) should appear only if rubric should vary by topic, per the Rubrics tab.&lt;br /&gt;
** The topic should have a multiple dropdowns (one for each round) only if rubrics vary by round, per the Rubrics tab.&lt;br /&gt;
** By default, the rubric(s) for each course project will be the one(s) specified in “Rubrics” tab.&lt;br /&gt;
** The dropdown value can overwrite the default rubric.&lt;br /&gt;
* Be careful when making changes to the code&lt;br /&gt;
** The signup_sheet_controller should have as little to do as possible with the selection of rubrics.&lt;br /&gt;
** Anything not germane to selecting topics should be in another controller or (more probably) a helper.&lt;br /&gt;
* Create a DB migration to allow rubric to vary by topic as well as by round.&lt;br /&gt;
&lt;br /&gt;
==== Screenshots ====&lt;br /&gt;
'''Current screenshot of Rubrics tab for an Assignment'''&lt;br /&gt;
(need to add a checkbox to indicate that rubric should vary by topic)&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Screenshot Assignment Edit Rubrics.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Current screenshot of Topics tab for an Assignment'''&lt;br /&gt;
(need to add a way to select rubrics for particular topics)&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Screenshot Assignment Edit Topics.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Proposed screenshot of Rubrics tab for an Assignment'''&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Specialized Rubric rubric checkbox.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Proposed screenshot of Topics tab for an Assignment'''&lt;br /&gt;
&lt;br /&gt;
(drop down shown for only one topic here, but final product will have one for each topic)&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Specialized Rubric dropdown menu.png]]&lt;br /&gt;
&lt;br /&gt;
== Previous Work ==&lt;br /&gt;
&lt;br /&gt;
There was previous attempt to implement this project in the Fall of 2018 semester by different team, but it was rejected due to several reasons. Our team was provided with all relevant information and materials about the design and implementation of the previously attempted project. We would like to acknowledge that we use previous implementation and design as reference and our starting point for our own implementation. The following is the list of links with the relevant materials that we have used for better project understanding, determining pros and cons of previously proposed changes, and establishing our design strategy and implementation:&lt;br /&gt;
&lt;br /&gt;
# [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1873_Specialized_rubics_for_different_topic_types Wiki]&lt;br /&gt;
# [https://github.com/expertiza/expertiza/pull/1327 Pull Request]&lt;br /&gt;
# [https://drive.google.com/file/d/1UrLb0Ula_Lb_F4MOrdC-s6xng6B08VYu/view Video Demo]&lt;br /&gt;
&lt;br /&gt;
After reviewing all relevant materials above, we concluded that the project implementation was incomplete and proposed design had significant flaw. &lt;br /&gt;
We identified main drawbacks and flaw as follows:&lt;br /&gt;
&lt;br /&gt;
* Establishing incorrect ''many-to-one'' relationship between ''sign_up_topics'' and ''questionnaires'' tables:&lt;br /&gt;
** Creating a DB migration to add ''questionnaire_id'' in the ''sign_up_topics'' table to store the dropdown data presumes ''one-to-one'' or ''many-to-one'' relationship between ''sign_up_topics'' and ''questionnaires'' tables&lt;br /&gt;
** Correct relationship between ''sign_up_topics'' and ''questionnaires'' tables is ''many-to-many''. For example, each project topic may have various rubrics depending on the round it is used (e.g., for round 1, topic may have one rubric; but for round 2, the same topic may have different rubric)&lt;br /&gt;
** Proposed previous migration changes would break DB design and would not allow to store correctly topic and its associated rubric per different round.&lt;br /&gt;
* Per project requirement specifications, &amp;quot;''The dropdown box should appear only if 'Vary rubric by topic' is selected in the Rubrics tab.''&amp;quot; This requirement was not met and ''Vary rubric by topic'' checkbox in the Rubrics tab was not implemented. Therefore, dropdown box with the list of rubrics appears regardless of whether &amp;quot;''Vary rubric by topic''&amp;quot; is selected or not.&lt;br /&gt;
* The dropdown box includes the list of all possible rubrics including default value. However, this condition can be improved. The dropdown box should list the rubrics that were created by the current user (professor who is logged in). This would allow to shorten the list of possible rubrics dramatically and help to avoid any misunderstanding and confusion while user selects desired rubric for the course project.&lt;br /&gt;
&lt;br /&gt;
We found no further issues with the rest implementation and in other project materials. Wiki page is very useful for understanding design of proposed changes, finding drawbacks and the flaw. Considering all the pros and cons, and taking into account drawbacks of the proposed changes, our team evolved different approach that should successfully solve the problem stated for the project without without creating additional issues. Please see our [http://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics#Project_Implementation Project Implementation] for more details.&lt;br /&gt;
&lt;br /&gt;
== Previous Project Requirements ==&lt;br /&gt;
&lt;br /&gt;
The project requirements originally specified how to alter the databases to support varying rubrics by topic.&lt;br /&gt;
&lt;br /&gt;
''Create a new table named topic_questionnaires with field:''&lt;br /&gt;
* ''id''&lt;br /&gt;
* ''topic_id''&lt;br /&gt;
* ''questionnaire_id''&lt;br /&gt;
* ''used_in_round''&lt;br /&gt;
&lt;br /&gt;
However, the E1936 team successfully petitioned for this requirement to change to give us more freedom in the implementation.  The original suggestion had a flaw.  There is already an existing table in the Expertiza project called ''assignment_questionnaires'', which has columns including ''assignment_id'', ''questionnaire_id'', and ''used_in_round''.  It is this table that maintains the knowledge of which rubric is used in which round of an assignment.  If we were to add a new table to maintains the knowledge of which rubric is used in which topic of an assignment as originally suggested, then we would have a big problem.  Knowledge of round-rubric relationship is duplicated.  This would lead (best case scenario) to extra work, and (worst case scenario) to lots of bugs caused by inconsistencies in how these tables are handled with CRUD operations throughout the code.  In other words, this is not a DRY solution.&lt;br /&gt;
&lt;br /&gt;
== Project Implementation ==&lt;br /&gt;
&lt;br /&gt;
In this section, we propose our solution to the problem, discuss implementation techniques and details, and list the goals we achieved.&lt;br /&gt;
&lt;br /&gt;
We start by analyzing Entity Relationship Diagram where we state the solution to the problem. Further we discuss design strategy by breaking project problem into multiple staged sub-problems and provide solutions for each of these sub-problems. We also discuss some implementation details and provide the list of involved files. Finally, we demonstrate how the implemented feature can be used by providing a ''How To'' sub-section.&lt;br /&gt;
&lt;br /&gt;
=== Diagrams ===&lt;br /&gt;
&lt;br /&gt;
Our solution and implementation of the project can be easily shown by discussing Use Case, Entity Relationship, and Class diagrams. First, for simplicity we discuss in general possible sequence of interactions between a user (in this case instructor) and the system (Expertiza) via presenting Use Case Diagram. Then we plan to show proposed database modification via Entity Relationship Diagram.&lt;br /&gt;
&lt;br /&gt;
==== User Case Diagram ====&lt;br /&gt;
&lt;br /&gt;
This is User Case Diagram. &lt;br /&gt;
&lt;br /&gt;
==== Entity Relationship Diagram ====&lt;br /&gt;
&lt;br /&gt;
[[File: HW04_ERD.png]]&lt;br /&gt;
&lt;br /&gt;
The sections of the diagram highlighted in yellow show newly introduced items.  That is, we are adding a new column called ''topic_id'' to ''assignment_questionnaires'', in order to link ''assignment_questionnaires'' to ''sign_up_topics''.&lt;br /&gt;
&lt;br /&gt;
Any assignment, topic, or questionnaire may be represented by multiple records within ''assignment_questionnaires'', but each record within ''assignment_questionnaires'' refers to just one assignment, topic, or questionnaire.  It is the ability to have an assignment represented by multiple records, and the new relationship to ''sign_up_topics'', that allows us to support all of the required scenarios:&lt;br /&gt;
&lt;br /&gt;
* Rubric does not vary by round or by topic.&lt;br /&gt;
* Rubric varies by round, but not by topic.&lt;br /&gt;
* Rubric varies by topic, but not by round.&lt;br /&gt;
* Rubric varies by both round and topic.&lt;br /&gt;
&lt;br /&gt;
[[File: HW04_table.PNG]]&lt;br /&gt;
&lt;br /&gt;
This table illustrates the possibilities that the system may have.&lt;br /&gt;
&lt;br /&gt;
* Assignment 1 does not vary by round or by topic.&lt;br /&gt;
* Assignment 2 varies by round, but not by topic.&lt;br /&gt;
* Assignment 3 varies by topic, but not by round.&lt;br /&gt;
* Assignment 4 varies by both round and topic.&lt;br /&gt;
&lt;br /&gt;
This change is done via database migration by running the following commands:&lt;br /&gt;
&lt;br /&gt;
  rails generate migration AddTopicIdToAssignmentQuestionnaires&lt;br /&gt;
  rb db:migrate&lt;br /&gt;
&lt;br /&gt;
Above command adds the ''topic_id'' column to the ''AssignmentQuestionnaires'' table and generates new migration file:&lt;br /&gt;
&lt;br /&gt;
[[File: db_migration.png]]&lt;br /&gt;
&lt;br /&gt;
To see the details of the entire database change please check this [https://github.com/gabalmat/expertiza/commit/d46dd57d35a21ab43efb82c28d3f14b75c695f2e commit].&lt;br /&gt;
&lt;br /&gt;
==== Class Diagram ====&lt;br /&gt;
&lt;br /&gt;
This is Class Class diagram.&lt;br /&gt;
&lt;br /&gt;
=== Design Strategy ===&lt;br /&gt;
&lt;br /&gt;
As we have concrete understanding of the problem and proposed solution, we would like break this problem into multiple more manageable sub-problems with specific tasks and well-defined solutions to these tasks. Generally, each sub-problem requires modification of one or more files. We would like to propose our Design Strategy as follows:&lt;br /&gt;
&lt;br /&gt;
==== Preparation ====&lt;br /&gt;
&lt;br /&gt;
* Clean up code that our implementation will use&lt;br /&gt;
** PROBLEM: We need to add/change content to the edit assignment Topics tab, but unlike other tabs in the views, it does not have its own partial view to work with&lt;br /&gt;
*** SOLUTION: Refactor and move the code dealing with topics into separate ''app/views/assignments/edit/_topics.html.erb'' file&lt;br /&gt;
*** File: ''app/views/assignments/edit.html.erb''&lt;br /&gt;
** PROBLEM: In a section below, we discuss the need to modify existing methods to also accept an optional argument ''topic_id''.  In many cases these existing method use confusing variable names or lack sufficient comments.&lt;br /&gt;
*** SOLUTION: Clean up methods that we plan to modify&lt;br /&gt;
*** FILE: (many)&lt;br /&gt;
&lt;br /&gt;
==== Implementation ====&lt;br /&gt;
&lt;br /&gt;
* Allow an instructor to indicate that rubric should vary by topic&lt;br /&gt;
** PROBLEM: There is no way for an instructor to indicate that an assignments' rubric should vary by topic&lt;br /&gt;
*** SOLUTION: Add a new checkbox in the edit assignment Rubric tab to indicate this preference&lt;br /&gt;
*** FILE: ''app/views/assignments/edit/_rubrics.html.erb''&lt;br /&gt;
&lt;br /&gt;
* Allow an instructor to choose different rubrics for different topics&lt;br /&gt;
** PROBLEM: There is no way for an instructor to choose different rubrics for different topics&lt;br /&gt;
*** SOLUTION: Add a new column in the edit assignment Topics tab for choosing rubric(s)&lt;br /&gt;
**** New column only visible if rubrics vary by topic, per Rubrics tab&lt;br /&gt;
**** New column has multiple rounds per topic only if rubrics vary by round, per Rubrics tab&lt;br /&gt;
**** Default value for any rubric is that rubric which is shown on Rubrics tab&lt;br /&gt;
**** Rubric(s) in the dropdown list is/are only those that were created by the currently logged in instructor&lt;br /&gt;
*** FILE: ''app/views/assignments/edit/_topics.html.erb''&lt;br /&gt;
** PROBLEM: The code in ''app/views/assignments/edit/_rubrics.html.erb'' includes dropdowns like the ones we need to add for topics, but that code is way too complex for its functionality (too heavy for a view, uses JavaScript)&lt;br /&gt;
*** SOLUTION: Use the code in ''app/views/assignments/edit/_rubrics.html.erb'' for inspiration only&lt;br /&gt;
**** Refactor and move as much actual work as possible out into helper methods that are simply called from this view&lt;br /&gt;
**** Views are not intended to do heavy lifting&lt;br /&gt;
**** Use as little JavaScript as possible, since this is a Ruby On Rails project, not a JS project&lt;br /&gt;
*** FILE: ''app/views/assignments/edit/_topics.html.erb''&lt;br /&gt;
&lt;br /&gt;
* Support the ability of the database to link rubrics to topics&lt;br /&gt;
** PROBLEM: There is no relationship in the database that can link together rubrics with topics&lt;br /&gt;
*** SOLUTION: Add a new migration that adds topic_id field to existing assignment_questionnaires table&lt;br /&gt;
**** This new field will reference the id field in the sign_up_topics table&lt;br /&gt;
*** FILE: ''db/migrate/[timestamp]_add_topic_id_to_assignment_questionnaires_table.rb''&lt;br /&gt;
** PROBLEM: The AssignmentQuestionnaire model does not have any knowledge of topics&lt;br /&gt;
*** SOLUTION: Add a new belongs_to reference in the model, to sign_up_topic&lt;br /&gt;
*** FILE: ''app/models/assignment_questionnaire.rb''&lt;br /&gt;
** PROBLEM: The SignUpTopic model does not have any knowledge of assignment_questionnaire records&lt;br /&gt;
*** SOLUTION: Add a new has_many reference in the model, to assignment_questionnaires&lt;br /&gt;
*** FILE: ''app/models/sign_up_topic.rb''&lt;br /&gt;
&lt;br /&gt;
* React to an instructor saving an assignment after altering the rubrics-vary-by-topic checkbox&lt;br /&gt;
** PROBLEM: There is nothing in place to remember when an instructor chooses to vary rubrics by topic, or chooses to not vary rubrics by topic&lt;br /&gt;
*** SOLUTION: Modify existing method ''update_assignment_questionnaires()''.  This method executes upon assignment save (explicit or via tab-change).  This method deletes all ''AssignmentQuestionnaire'' records before creating new correct records reflecting the user's selections in the edit assignment form.  Modify such that this method can create multiple records reflecting multiple topics, in the case where rubric should vary by topic.  With this modification, the correct records (with default rubrics) are present when the user goes to the Topics tab, so that the Topics tab can display properly.&lt;br /&gt;
*** FILE: app\models\assignment_form.rb&lt;br /&gt;
** PROBLEM: There is no way to refresh the Topics tab to show / hide drop-downs after the instructor changes checkbox on Rubrics tab&lt;br /&gt;
*** SOLUTION: Make use of existing &amp;quot;Save&amp;quot;-like functionality when changing tabs on the edit assignment page.  When updating due to tab-change, cause a fresh render of the Topics tab.  When updating due to &amp;quot;Save&amp;quot; button, keep functionality as-is.&lt;br /&gt;
*** FILE: ''app/controllers/assignments_controller.rb''&lt;br /&gt;
*** FILE: ''app/views/assignments/edit.html.erb''&lt;br /&gt;
&lt;br /&gt;
* Support the ability to find the correct rubric for a particular topic&lt;br /&gt;
** PROBLEM: The existing methods allow us to find the correct rubric for a particular round, but not a particular topic&lt;br /&gt;
*** SOLUTION: Modify the existing method questionnaire(assignment, type, round_number) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/helpers/assignment_helper.rb''&lt;br /&gt;
*** SOLUTION: Modify the existing method assignment_questionnaire(assignment, type, number) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/helpers/assignment_helper.rb''&lt;br /&gt;
*** SOLUTION: Modify the existing method questionnaire(round = nil) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/models/review_response_map.rb''&lt;br /&gt;
*** SOLUTION: Modify the existing method questionnaire(round) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/models/self_review_response_map.rb''&lt;br /&gt;
*** SOLUTION: Modify the existing method review_questionnaire_id(round = nil) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/models/assignment.rb''&lt;br /&gt;
&lt;br /&gt;
* Use the correct rubric for a particular topic&lt;br /&gt;
** PROBLEM: When finding rubrics to display, save results from, calculate scores from, etc. round may be used but topic is not&lt;br /&gt;
*** SOLUTION: Examine all callers of methods modified in the previous section and pass in ''topic_id'' where appropriate to grab the correct rubric&lt;br /&gt;
*** FILE: (many)&lt;br /&gt;
&lt;br /&gt;
* Support the ability to determine if an assignment has rubrics that vary by topic&lt;br /&gt;
** PROBLEM: There is no handy method to call that can tell us if an assignment has rubrics that vary by topic&lt;br /&gt;
*** SOLUTION: Add a new method ''varying_rubrics_by_topic?'' based on the existing method ''varying_rubrics_by_round?''&lt;br /&gt;
*** FILE: ''app/models/assignment.rb''&lt;br /&gt;
&lt;br /&gt;
=== Q&amp;amp;A ===&lt;br /&gt;
&lt;br /&gt;
Here we paraphrase some questions we received during round 1 of the documentation review.&lt;br /&gt;
&lt;br /&gt;
* Q: How will the new logic for varying rubric by topic tie in with the existing logic?&lt;br /&gt;
** A: We will add a new field ''topic_id'' into the existing table ''assignment_questionnaires'', as noted in the [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Entity_Relationship_Diagram E/R Diagram].  We will update methods that find questionnaires to allow these methods to also accept a ''topic_id'' argument, as noted in [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Implementation Implementation].&lt;br /&gt;
* Q: How will the &amp;quot;Rubric varies by topic&amp;quot; selection be stored?&lt;br /&gt;
** A: Indirectly, by saving records in the ''assignment_questionnaires'' table which either reference a ''topic_id'' or leave this field nil.  For more details please see the [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Entity_Relationship_Diagram E/R Diagram] discussion.&lt;br /&gt;
* Q: What will happen if an instructor selects &amp;quot;Rubric varies by topic&amp;quot;, makes selections on the &amp;quot;Topics&amp;quot; tab, and then deselects &amp;quot;Rubric varies by topic&amp;quot;?&lt;br /&gt;
** A: The Topics tab, when next visited, will no longer show dropdowns for selecting rubrics by topic.  When the assignment is saved, the appropriate not-varying-by-topic records will be saved in the ''assignment_questionnaires'' table.  For more details please see [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Implementation Implementation].&lt;br /&gt;
* Q: What will happen after an instructor selects &amp;quot;Rubric varies by topic&amp;quot;?&lt;br /&gt;
** A: The Topics tab, when next visited, will now show dropdowns for selecting rubrics by topic.  These rubrics will default to those shown on the Rubrics tab.  When the assignment is saved, the appropriate varying-by-topic records will be saved in the ''assignment_questionnaires'' table.  For more details please see [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Implementation Implementation].&lt;br /&gt;
* Q: How will the appropriate list of questionnaires for the new dropdowns on the Topics tab be determined?&lt;br /&gt;
** A: In the same way that the appropriate list of questionnaires for the existing dropdowns on the Rubrics tab is determined.  Namely, by the ''questionnaire_options'' method in the file ''expertiza/app/helpers/assignment_helper.rb''.&lt;br /&gt;
&lt;br /&gt;
=== (Selected) Modified Code ===&lt;br /&gt;
&lt;br /&gt;
In this section, we provide ''selected portions'' of modified code to illustrate how we implemented the new feature.&lt;br /&gt;
&lt;br /&gt;
Allow an instructor to indicate that rubric should vary by topic&lt;br /&gt;
&lt;br /&gt;
''app\views\assignments\edit\_rubrics.html.erb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;lt;input name=&amp;quot;vary_by_topic&amp;quot; type=&amp;quot;hidden&amp;quot; value=&amp;quot;false&amp;quot; /&amp;gt;&lt;br /&gt;
  &amp;lt;%= check_box_tag('vary_by_topic', 'true', @review_vary_by_topic_check) %&amp;gt;&lt;br /&gt;
  &amp;lt;%= label_tag('vary_by_topic', 'Review rubric varies by topic?') %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Allow an instructor to choose different rubrics for different topics&lt;br /&gt;
&lt;br /&gt;
''app\views\sign_up_sheet\_table_line.html.erb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;lt;% if @assignment_form.assignment.varying_rubrics_by_topic? %&amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;table id = &amp;lt;%=table_id %&amp;gt;&amp;gt;&lt;br /&gt;
        &amp;lt;tr&amp;gt;&lt;br /&gt;
          &amp;lt;script&amp;gt;&lt;br /&gt;
              ...&lt;br /&gt;
              &amp;lt;% if @assignment_form.assignment.varying_rubrics_by_round? %&amp;gt;&lt;br /&gt;
                &amp;lt;% for round in 1..@assignment_form.assignment.rounds_of_reviews %&amp;gt;&lt;br /&gt;
                  ...&lt;br /&gt;
                &amp;lt;% end %&amp;gt;&lt;br /&gt;
              &amp;lt;% else %&amp;gt;&lt;br /&gt;
                ...&lt;br /&gt;
              &amp;lt;% end %&amp;gt;&lt;br /&gt;
          &amp;lt;/script&amp;gt;&lt;br /&gt;
        &amp;lt;/tr&amp;gt;&lt;br /&gt;
      &amp;lt;/table&amp;gt;&lt;br /&gt;
    &amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Support the ability of the database to link rubrics to topics&lt;br /&gt;
&lt;br /&gt;
''app\models\sign_up_topic.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  class SignUpTopic &amp;lt; ActiveRecord::Base&lt;br /&gt;
    ...&lt;br /&gt;
    has_many :assignment_questionnaires, class_name: 'AssignmentQuestionnaire', foreign_key: 'topic_id', dependent: :destroy&lt;br /&gt;
    ...&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
React to an instructor saving an assignment after altering the rubrics-vary-by-topic checkbox&lt;br /&gt;
&lt;br /&gt;
''app/controllers/assignments_controller.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def update&lt;br /&gt;
    ...&lt;br /&gt;
    # What to do next depends on how we got here&lt;br /&gt;
    if params['button'].nil?&lt;br /&gt;
      # REFRESH the topics tab after changing tabs&lt;br /&gt;
      ...&lt;br /&gt;
      render :partial =&amp;gt; &amp;quot;assignments/edit/topics&amp;quot;&lt;br /&gt;
    else&lt;br /&gt;
      # SAVE button was used (do a redirect)&lt;br /&gt;
      redirect_to edit_assignment_path @assignment_form.assignment.id&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Support the ability to find the correct rubric for a particular topic&lt;br /&gt;
&lt;br /&gt;
''app/helpers/assignment_helper.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def assignment_questionnaire(assignment, questionnaire_type, round_number = nil, topic_id = nil)&lt;br /&gt;
    q_by_type = assignment.questionnaires.find_by(type: questionnaire_type)&lt;br /&gt;
    if q_by_type.nil?&lt;br /&gt;
      ...&lt;br /&gt;
    else&lt;br /&gt;
      ...&lt;br /&gt;
      aq_by_type = assignment.assignment_questionnaires.find_by(questionnaire_id: q_by_type.id)&lt;br /&gt;
      if round_number.nil? &amp;amp;&amp;amp; topic_id.nil?&lt;br /&gt;
        # Find by type&lt;br /&gt;
        aq = aq_by_type&lt;br /&gt;
      elsif topic_id.nil?&lt;br /&gt;
        # Find by round&lt;br /&gt;
        aq = assignment.assignment_questionnaires.find_by(used_in_round: round_number)&lt;br /&gt;
      elsif round_number.nil?&lt;br /&gt;
        # Find by topic&lt;br /&gt;
        aq = assignment.assignment_questionnaires.find_by(topic_id: topic_id)&lt;br /&gt;
      else&lt;br /&gt;
        # Find by round and topic&lt;br /&gt;
        aq = assignment.assignment_questionnaires.where(used_in_round: round_number, topic_id: topic_id).first&lt;br /&gt;
      end&lt;br /&gt;
      aq.nil? ? aq_by_type : aq&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use the correct rubric for a particular topic&lt;br /&gt;
&lt;br /&gt;
''app\controllers\response_controller.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def set_questionnaire_for_new_response&lt;br /&gt;
    case @map.type&lt;br /&gt;
    when &amp;quot;ReviewResponseMap&amp;quot;, &amp;quot;SelfReviewResponseMap&amp;quot;&lt;br /&gt;
      reviewees_topic = SignedUpTeam.topic_id_by_team_id(@contributor.id)&lt;br /&gt;
      @current_round = @assignment.number_of_current_round(reviewees_topic)&lt;br /&gt;
      @questionnaire = @map.questionnaire(@current_round, reviewees_topic)&lt;br /&gt;
    when&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Support the ability to determine if an assignment has rubrics that vary by topic&lt;br /&gt;
&lt;br /&gt;
''app\models\assignment.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def varying_rubrics_by_topic?&lt;br /&gt;
    aq_no_topic_id = AssignmentQuestionnaire.where(assignment_id: self.id, topic_id: nil).size &amp;gt;= 1&lt;br /&gt;
    aq_with_topic_id = AssignmentQuestionnaire.where(assignment_id: self.id).where.not(topic_id: nil).size &amp;gt;= 1&lt;br /&gt;
    if !aq_no_topic_id &amp;amp;&amp;amp; !aq_with_topic_id&lt;br /&gt;
      return false&lt;br /&gt;
    elsif aq_no_topic_id &amp;amp;&amp;amp; !aq_with_topic_id&lt;br /&gt;
      return false&lt;br /&gt;
    elsif !aq_no_topic_id &amp;amp;&amp;amp; aq_with_topic_id&lt;br /&gt;
      return true&lt;br /&gt;
    else&lt;br /&gt;
      raise StandardError.new(&amp;quot;Assignment with id &amp;quot; + self.id.to_s + &amp;quot; has a conflict about whether or not it varies by topic&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== How To ==&lt;br /&gt;
&lt;br /&gt;
In this section, we describe how to use the newly implemented feature.&lt;br /&gt;
&lt;br /&gt;
=== Add a New Rubric ===&lt;br /&gt;
&lt;br /&gt;
* [to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
=== Select a Rubric for a Topic ===&lt;br /&gt;
&lt;br /&gt;
* [to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
== Project Testing ==&lt;br /&gt;
&lt;br /&gt;
=== Strategy ===&lt;br /&gt;
&lt;br /&gt;
To test code implementation, correctness of the added feature, verify that the team did not break any existing functionalities in the Expertiza, and ensure that no bugs were introduced in the code, we developed the following Test Strategy:&lt;br /&gt;
&lt;br /&gt;
# Code inspection&lt;br /&gt;
# Run and pass existing RSpec Tests&lt;br /&gt;
# Develop New RSpec Tests&lt;br /&gt;
# Run through live UI to test a feature using Expertiza instance&lt;br /&gt;
&lt;br /&gt;
=== Rspec Testing ===&lt;br /&gt;
&lt;br /&gt;
==== Existing Tests ====&lt;br /&gt;
&lt;br /&gt;
Run all existing RSpec tests on any changed files, after our changes, to ensure that we have not introduced any failures.&lt;br /&gt;
The commands and results are shown below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  [to be populated after coding is complete]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== New Tests ====&lt;br /&gt;
&lt;br /&gt;
Write comprehensive RSpec tests, for all new or modified methods.&lt;br /&gt;
* FILE: ''spec/helpers/assignment_helper_spec.rb''&lt;br /&gt;
** METHODS TO TEST: &lt;br /&gt;
*** questionnaire(assignment, type, round_number, topic_id)&lt;br /&gt;
*** assignment_questionnaire(assignment, type, number, topic_id)&lt;br /&gt;
* FILE: ''spec/models/review_response_map_spec.rb''&lt;br /&gt;
*** METHODS TO TEST:&lt;br /&gt;
**** questionnaire(round, topic_id)&lt;br /&gt;
* FILE: ''spec/models/self_review_response_map_spec.rb''&lt;br /&gt;
*** METHODS TO TEST:&lt;br /&gt;
**** questionnaire(round, topic_id)&lt;br /&gt;
* FILE: ''spec/models/assignment_spec.rb''&lt;br /&gt;
*** METHODS TO TEST:&lt;br /&gt;
**** review_questionnaire_id(round, topic_id)&lt;br /&gt;
**** varying_rubrics_by_topic?()&lt;br /&gt;
&lt;br /&gt;
Run these tests, to ensure that the new code works as intended.&lt;br /&gt;
The commands and results are shown below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  [to be populated after coding is complete]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The test suite for a single new method is shown below.&lt;br /&gt;
* There are many such suites added in expertiza/spec  &lt;br /&gt;
* This example illustrates our general strategy:&lt;br /&gt;
** test missing input&lt;br /&gt;
** test bad input&lt;br /&gt;
** test various acceptable forms of input&lt;br /&gt;
** test scenarios that lead to various return values&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  describe &amp;quot;#questionnaire&amp;quot; do&lt;br /&gt;
&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;throws exception if assignment argument nil&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;throws exception if all arguments nil except for assignment&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;finds by type if round number &amp;amp; topic id not given&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;throws exception if round number &amp;amp; topic id not given, no luck finding by type&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;finds by round number alone if round number alone is given&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;creates new questionnaire of given type if round number alone is given, no luck finding by round&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;finds by topic id alone if topic id alone is given&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;creates new questionnaire of given type if topic id alone is given, no luck finding by topic&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;finds by round number and topic id if both are given&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;creates new questionnaire of given type if round and topic are given, no luck finding by round and topic&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== UI Testing ===&lt;br /&gt;
&lt;br /&gt;
Here we describe manual UI Testing that was performed.&lt;br /&gt;
&lt;br /&gt;
==== Rubric does not vary by round or by topic ====&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
==== Rubric varies by round, but not by topic ====&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
==== Rubric varies by topic, but not by round ====&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
==== Rubric varies by both round and topic ====&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
== Future Work ==&lt;br /&gt;
&lt;br /&gt;
This section discusses possible future work for another CSC 517 team to take on.  Such a team can search the Expertiza codebase for &amp;quot;TODO E1936 (future work)&amp;quot; to find the places in the code that the notes below refer to.&lt;br /&gt;
&lt;br /&gt;
* Reduce the delay between changing the state of the &amp;quot;Review rubric varies by topic?&amp;quot; checkbox on the Rubrics tab, and the show / hide of rubric drop-downs on the Topics tab.&lt;br /&gt;
* Redesign UI for tone analysis, heatmaps, and review scores pop-up.  These areas are designed around the assumption that reviews do NOT vary by topic.  For example, in the review scores pop-up, a reviewer can see the reviews they have given, arranged by question, across multiple reviewees.&lt;br /&gt;
&lt;br /&gt;
== Useful Links ==&lt;br /&gt;
In this section we provide useful links related to the work that has been completed by our team.&lt;br /&gt;
# [https://github.com/gabalmat/expertiza Forked Project Repository]&lt;br /&gt;
# [https://github.com/expertiza/expertiza/pull/1444 Pull Request]&lt;br /&gt;
# [(add link here) Video Demonstration of Specialized Rubrics]&lt;br /&gt;
# [(add link here) Video Demonstration of Passing Rspec Tests]&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Contacts ===&lt;br /&gt;
We have 4 (four) members in our team and 1 (one) mentor was also assigned to us. For any project-related questions/concerns please contact us:&lt;br /&gt;
* Aurora Tiffany-Davis - attiffan@ncsu.edu&lt;br /&gt;
* Ginger Balmat - gabalmat@ncsu.edu&lt;br /&gt;
* Joe Hutchinson - jehutch3@ncsu.edu&lt;br /&gt;
* Nikolay Titov - ngtitov@ncsu.edu&lt;br /&gt;
* Zhewei Hu (mentor) - zhu6@ncsu.edu&lt;br /&gt;
&lt;br /&gt;
=== Contribution Based Inquiry ===&lt;br /&gt;
For any questions or concerns related to the project design, implementation, testing of the feature developed by our team, please contact an engineer who worked closely on the topic of your interest based on the [https://docs.google.com/spreadsheets/d/11uxuI_5gaC-FQDwIOxtCaN3HZ9bfWDJgIjFemtYV5jE/edit?ts=5ca222f3#gid=0 Contribution Assignment Grid] we created to keep track of our progress and contribution. Please carbon copy all team members and our mentor in the email.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* Expertiza Web [https://github.com/expertiza/expertiza#expertiza]&lt;br /&gt;
* Expertiza on GitHub [https://github.com/expertiza/expertiza]&lt;br /&gt;
* Expertiza Wiki [http://wikis.lib.ncsu.edu/index.php/Expertiza]&lt;br /&gt;
* Rspec Documentation [https://relishapp.com/rspec]&lt;br /&gt;
* Wiki with Previous Work [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1873_Specialized_rubics_for_different_topic_types]&lt;br /&gt;
* Pull Request of the Previous Work [https://github.com/expertiza/expertiza/pull/1327]&lt;/div&gt;</summary>
		<author><name>Ngtitov</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Db_migration.png&amp;diff=124332</id>
		<title>File:Db migration.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Db_migration.png&amp;diff=124332"/>
		<updated>2019-04-26T02:12:19Z</updated>

		<summary type="html">&lt;p&gt;Ngtitov: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Ngtitov</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics&amp;diff=124331</id>
		<title>E1936 Specialized Rubrics</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics&amp;diff=124331"/>
		<updated>2019-04-26T02:11:58Z</updated>

		<summary type="html">&lt;p&gt;Ngtitov: /* Entity Relationship Diagram */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page describes the work and goals that have been completed and achieved while implementing Expertiza Project &amp;quot;''E1936. Specialized Rubrics for Different Topic Types (e.g., Servo project, refactoring project)''&amp;quot; for the CSC/ECE 517 &amp;quot;Object-Oriented Design and Development&amp;quot; class, in the Spring semester of the 2019.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This Wiki page is created per CSC/ECE 517: &amp;quot;Object-Oriented Design and Development&amp;quot;, Expertiza Project requirements (Spring, 2019).&lt;br /&gt;
&lt;br /&gt;
Our [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Team team] was assigned the project &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936. Specialized rubrics for different topic types (e.g., Servo project, refactoring project)]&amp;quot;.  This is an Expertiza project.&lt;br /&gt;
&lt;br /&gt;
In this wiki page we describe the problem to be solved, how we solve that problem, and how we test our solution.  We also provide helpful links and contact information for our team.&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
In this section, we discuss the problem we need to solve, the Expertiza feature this problem is related to, what needs to be done to solve the problem (at a high level), and the previous attempt to solve this problem.&lt;br /&gt;
&lt;br /&gt;
=== Problem Statement ===&lt;br /&gt;
&lt;br /&gt;
This problem statement summarizes the problem as described in the project description &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936. Specialized rubrics for different topic types (e.g., Servo project, refactoring project)]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
In CSC/ECE 517, there are several types of topics that could be covered in a single class assignment.&lt;br /&gt;
* Code base&lt;br /&gt;
** Expertiza&lt;br /&gt;
** Mozilla&lt;br /&gt;
** etc.&lt;br /&gt;
* Goal&lt;br /&gt;
** Refactoring&lt;br /&gt;
** Testing&lt;br /&gt;
** etc.&lt;br /&gt;
However, currently we can only specify one kind of rubric for an assignment.  This means that teams working on different topics will be evaluated using the same rubric.  With this setup, it's not possible to fine-tune rubrics for different topics - rubrics tend to be overly general.&lt;br /&gt;
&lt;br /&gt;
=== Feature Description ===&lt;br /&gt;
&lt;br /&gt;
The Expertiza project already has a feature that allows rubrics to vary by project phase or &amp;quot;round&amp;quot;.  The feature we will add in this project is a feature to allow rubrics to vary not only by round, but also by topic.  This allows more flexibility to the instructor when setting up an assignment, so that they can use rubrics better suited to the tasks that students are performing in an assignment.&lt;br /&gt;
&lt;br /&gt;
When this feature is complete, the following scenarios will be possible, and the instructor will be the judge of which scenario is the best fit to the assignment:&lt;br /&gt;
&lt;br /&gt;
* Rubric does not vary by round or by topic.&lt;br /&gt;
* Rubric varies by round, but not by topic.&lt;br /&gt;
* Rubric varies by topic, but not by round.&lt;br /&gt;
* Rubric varies by both round and topic.&lt;br /&gt;
&lt;br /&gt;
=== What Needs to be Done ===&lt;br /&gt;
&lt;br /&gt;
This section summarizes the work as described in the project description &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936. Specialized rubrics for different topic types (e.g., Servo project, refactoring project)]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* In assignment#edit page &amp;quot;Rubrics&amp;quot; tab, add a checkbox to specify whether rubric should vary by topic.&lt;br /&gt;
* In assignment#edit page &amp;quot;Topics&amp;quot; tab, add dropdown(s) next to each topic to specify which rubric(s) are associated with the topic.&lt;br /&gt;
** The dropdown(s) should appear only if rubric should vary by topic, per the Rubrics tab.&lt;br /&gt;
** The topic should have a multiple dropdowns (one for each round) only if rubrics vary by round, per the Rubrics tab.&lt;br /&gt;
** By default, the rubric(s) for each course project will be the one(s) specified in “Rubrics” tab.&lt;br /&gt;
** The dropdown value can overwrite the default rubric.&lt;br /&gt;
* Be careful when making changes to the code&lt;br /&gt;
** The signup_sheet_controller should have as little to do as possible with the selection of rubrics.&lt;br /&gt;
** Anything not germane to selecting topics should be in another controller or (more probably) a helper.&lt;br /&gt;
* Create a DB migration to allow rubric to vary by topic as well as by round.&lt;br /&gt;
&lt;br /&gt;
==== Screenshots ====&lt;br /&gt;
'''Current screenshot of Rubrics tab for an Assignment'''&lt;br /&gt;
(need to add a checkbox to indicate that rubric should vary by topic)&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Screenshot Assignment Edit Rubrics.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Current screenshot of Topics tab for an Assignment'''&lt;br /&gt;
(need to add a way to select rubrics for particular topics)&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Screenshot Assignment Edit Topics.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Proposed screenshot of Rubrics tab for an Assignment'''&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Specialized Rubric rubric checkbox.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Proposed screenshot of Topics tab for an Assignment'''&lt;br /&gt;
&lt;br /&gt;
(drop down shown for only one topic here, but final product will have one for each topic)&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Specialized Rubric dropdown menu.png]]&lt;br /&gt;
&lt;br /&gt;
== Previous Work ==&lt;br /&gt;
&lt;br /&gt;
There was previous attempt to implement this project in the Fall of 2018 semester by different team, but it was rejected due to several reasons. Our team was provided with all relevant information and materials about the design and implementation of the previously attempted project. We would like to acknowledge that we use previous implementation and design as reference and our starting point for our own implementation. The following is the list of links with the relevant materials that we have used for better project understanding, determining pros and cons of previously proposed changes, and establishing our design strategy and implementation:&lt;br /&gt;
&lt;br /&gt;
# [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1873_Specialized_rubics_for_different_topic_types Wiki]&lt;br /&gt;
# [https://github.com/expertiza/expertiza/pull/1327 Pull Request]&lt;br /&gt;
# [https://drive.google.com/file/d/1UrLb0Ula_Lb_F4MOrdC-s6xng6B08VYu/view Video Demo]&lt;br /&gt;
&lt;br /&gt;
After reviewing all relevant materials above, we concluded that the project implementation was incomplete and proposed design had significant flaw. &lt;br /&gt;
We identified main drawbacks and flaw as follows:&lt;br /&gt;
&lt;br /&gt;
* Establishing incorrect ''many-to-one'' relationship between ''sign_up_topics'' and ''questionnaires'' tables:&lt;br /&gt;
** Creating a DB migration to add ''questionnaire_id'' in the ''sign_up_topics'' table to store the dropdown data presumes ''one-to-one'' or ''many-to-one'' relationship between ''sign_up_topics'' and ''questionnaires'' tables&lt;br /&gt;
** Correct relationship between ''sign_up_topics'' and ''questionnaires'' tables is ''many-to-many''. For example, each project topic may have various rubrics depending on the round it is used (e.g., for round 1, topic may have one rubric; but for round 2, the same topic may have different rubric)&lt;br /&gt;
** Proposed previous migration changes would break DB design and would not allow to store correctly topic and its associated rubric per different round.&lt;br /&gt;
* Per project requirement specifications, &amp;quot;''The dropdown box should appear only if 'Vary rubric by topic' is selected in the Rubrics tab.''&amp;quot; This requirement was not met and ''Vary rubric by topic'' checkbox in the Rubrics tab was not implemented. Therefore, dropdown box with the list of rubrics appears regardless of whether &amp;quot;''Vary rubric by topic''&amp;quot; is selected or not.&lt;br /&gt;
* The dropdown box includes the list of all possible rubrics including default value. However, this condition can be improved. The dropdown box should list the rubrics that were created by the current user (professor who is logged in). This would allow to shorten the list of possible rubrics dramatically and help to avoid any misunderstanding and confusion while user selects desired rubric for the course project.&lt;br /&gt;
&lt;br /&gt;
We found no further issues with the rest implementation and in other project materials. Wiki page is very useful for understanding design of proposed changes, finding drawbacks and the flaw. Considering all the pros and cons, and taking into account drawbacks of the proposed changes, our team evolved different approach that should successfully solve the problem stated for the project without without creating additional issues. Please see our [http://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics#Project_Implementation Project Implementation] for more details.&lt;br /&gt;
&lt;br /&gt;
== Previous Project Requirements ==&lt;br /&gt;
&lt;br /&gt;
The project requirements originally specified how to alter the databases to support varying rubrics by topic.&lt;br /&gt;
&lt;br /&gt;
''Create a new table named topic_questionnaires with field:''&lt;br /&gt;
* ''id''&lt;br /&gt;
* ''topic_id''&lt;br /&gt;
* ''questionnaire_id''&lt;br /&gt;
* ''used_in_round''&lt;br /&gt;
&lt;br /&gt;
However, the E1936 team successfully petitioned for this requirement to change to give us more freedom in the implementation.  The original suggestion had a flaw.  There is already an existing table in the Expertiza project called ''assignment_questionnaires'', which has columns including ''assignment_id'', ''questionnaire_id'', and ''used_in_round''.  It is this table that maintains the knowledge of which rubric is used in which round of an assignment.  If we were to add a new table to maintains the knowledge of which rubric is used in which topic of an assignment as originally suggested, then we would have a big problem.  Knowledge of round-rubric relationship is duplicated.  This would lead (best case scenario) to extra work, and (worst case scenario) to lots of bugs caused by inconsistencies in how these tables are handled with CRUD operations throughout the code.  In other words, this is not a DRY solution.&lt;br /&gt;
&lt;br /&gt;
== Project Implementation ==&lt;br /&gt;
&lt;br /&gt;
In this section, we propose our solution to the problem, discuss implementation techniques and details, and list the goals we achieved.&lt;br /&gt;
&lt;br /&gt;
We start by analyzing Entity Relationship Diagram where we state the solution to the problem. Further we discuss design strategy by breaking project problem into multiple staged sub-problems and provide solutions for each of these sub-problems. We also discuss some implementation details and provide the list of involved files. Finally, we demonstrate how the implemented feature can be used by providing a ''How To'' sub-section.&lt;br /&gt;
&lt;br /&gt;
=== Diagrams ===&lt;br /&gt;
&lt;br /&gt;
Our solution and implementation of the project can be easily shown by discussing Use Case, Entity Relationship, and UML diagrams. First, for simplicity we discuss in general possible sequence of interactions between a user (in this case instructor) and the system (Expertiza) via presenting Use Case Diagram. Then we plan to show proposed database modification via Entity Relationship Diagram.&lt;br /&gt;
&lt;br /&gt;
==== User Case Diagram ====&lt;br /&gt;
&lt;br /&gt;
This is User Case Diagram. &lt;br /&gt;
&lt;br /&gt;
==== Entity Relationship Diagram ====&lt;br /&gt;
&lt;br /&gt;
[[File: HW04_ERD.png]]&lt;br /&gt;
&lt;br /&gt;
The sections of the diagram highlighted in yellow show newly introduced items.  That is, we are adding a new column called ''topic_id'' to ''assignment_questionnaires'', in order to link ''assignment_questionnaires'' to ''sign_up_topics''.&lt;br /&gt;
&lt;br /&gt;
Any assignment, topic, or questionnaire may be represented by multiple records within ''assignment_questionnaires'', but each record within ''assignment_questionnaires'' refers to just one assignment, topic, or questionnaire.  It is the ability to have an assignment represented by multiple records, and the new relationship to ''sign_up_topics'', that allows us to support all of the required scenarios:&lt;br /&gt;
&lt;br /&gt;
* Rubric does not vary by round or by topic.&lt;br /&gt;
* Rubric varies by round, but not by topic.&lt;br /&gt;
* Rubric varies by topic, but not by round.&lt;br /&gt;
* Rubric varies by both round and topic.&lt;br /&gt;
&lt;br /&gt;
[[File: HW04_table.PNG]]&lt;br /&gt;
&lt;br /&gt;
This table illustrates the possibilities that the system may have.&lt;br /&gt;
&lt;br /&gt;
* Assignment 1 does not vary by round or by topic.&lt;br /&gt;
* Assignment 2 varies by round, but not by topic.&lt;br /&gt;
* Assignment 3 varies by topic, but not by round.&lt;br /&gt;
* Assignment 4 varies by both round and topic.&lt;br /&gt;
&lt;br /&gt;
This change is done via database migration by running the following commands:&lt;br /&gt;
&lt;br /&gt;
  rails generate migration AddTopicIdToAssignmentQuestionnaires&lt;br /&gt;
  rb db:migrate&lt;br /&gt;
&lt;br /&gt;
Above command adds the ''topic_id'' column to the ''AssignmentQuestionnaires'' table and generates new migration file:&lt;br /&gt;
&lt;br /&gt;
[[File: db_migration.png]]&lt;br /&gt;
&lt;br /&gt;
To see the details of the entire database change please check this [https://github.com/gabalmat/expertiza/commit/d46dd57d35a21ab43efb82c28d3f14b75c695f2e commit].&lt;br /&gt;
&lt;br /&gt;
==== UML Diagram ====&lt;br /&gt;
&lt;br /&gt;
This is UML Class diagram.&lt;br /&gt;
&lt;br /&gt;
=== Design Strategy ===&lt;br /&gt;
&lt;br /&gt;
As we have concrete understanding of the problem and proposed solution, we would like break this problem into multiple more manageable sub-problems with specific tasks and well-defined solutions to these tasks. Generally, each sub-problem requires modification of one or more files. We would like to propose our Design Strategy as follows:&lt;br /&gt;
&lt;br /&gt;
==== Preparation ====&lt;br /&gt;
&lt;br /&gt;
* Clean up code that our implementation will use&lt;br /&gt;
** PROBLEM: We need to add/change content to the edit assignment Topics tab, but unlike other tabs in the views, it does not have its own partial view to work with&lt;br /&gt;
*** SOLUTION: Refactor and move the code dealing with topics into separate ''app/views/assignments/edit/_topics.html.erb'' file&lt;br /&gt;
*** File: ''app/views/assignments/edit.html.erb''&lt;br /&gt;
** PROBLEM: In a section below, we discuss the need to modify existing methods to also accept an optional argument ''topic_id''.  In many cases these existing method use confusing variable names or lack sufficient comments.&lt;br /&gt;
*** SOLUTION: Clean up methods that we plan to modify&lt;br /&gt;
*** FILE: (many)&lt;br /&gt;
&lt;br /&gt;
==== Implementation ====&lt;br /&gt;
&lt;br /&gt;
* Allow an instructor to indicate that rubric should vary by topic&lt;br /&gt;
** PROBLEM: There is no way for an instructor to indicate that an assignments' rubric should vary by topic&lt;br /&gt;
*** SOLUTION: Add a new checkbox in the edit assignment Rubric tab to indicate this preference&lt;br /&gt;
*** FILE: ''app/views/assignments/edit/_rubrics.html.erb''&lt;br /&gt;
&lt;br /&gt;
* Allow an instructor to choose different rubrics for different topics&lt;br /&gt;
** PROBLEM: There is no way for an instructor to choose different rubrics for different topics&lt;br /&gt;
*** SOLUTION: Add a new column in the edit assignment Topics tab for choosing rubric(s)&lt;br /&gt;
**** New column only visible if rubrics vary by topic, per Rubrics tab&lt;br /&gt;
**** New column has multiple rounds per topic only if rubrics vary by round, per Rubrics tab&lt;br /&gt;
**** Default value for any rubric is that rubric which is shown on Rubrics tab&lt;br /&gt;
**** Rubric(s) in the dropdown list is/are only those that were created by the currently logged in instructor&lt;br /&gt;
*** FILE: ''app/views/assignments/edit/_topics.html.erb''&lt;br /&gt;
** PROBLEM: The code in ''app/views/assignments/edit/_rubrics.html.erb'' includes dropdowns like the ones we need to add for topics, but that code is way too complex for its functionality (too heavy for a view, uses JavaScript)&lt;br /&gt;
*** SOLUTION: Use the code in ''app/views/assignments/edit/_rubrics.html.erb'' for inspiration only&lt;br /&gt;
**** Refactor and move as much actual work as possible out into helper methods that are simply called from this view&lt;br /&gt;
**** Views are not intended to do heavy lifting&lt;br /&gt;
**** Use as little JavaScript as possible, since this is a Ruby On Rails project, not a JS project&lt;br /&gt;
*** FILE: ''app/views/assignments/edit/_topics.html.erb''&lt;br /&gt;
&lt;br /&gt;
* Support the ability of the database to link rubrics to topics&lt;br /&gt;
** PROBLEM: There is no relationship in the database that can link together rubrics with topics&lt;br /&gt;
*** SOLUTION: Add a new migration that adds topic_id field to existing assignment_questionnaires table&lt;br /&gt;
**** This new field will reference the id field in the sign_up_topics table&lt;br /&gt;
*** FILE: ''db/migrate/[timestamp]_add_topic_id_to_assignment_questionnaires_table.rb''&lt;br /&gt;
** PROBLEM: The AssignmentQuestionnaire model does not have any knowledge of topics&lt;br /&gt;
*** SOLUTION: Add a new belongs_to reference in the model, to sign_up_topic&lt;br /&gt;
*** FILE: ''app/models/assignment_questionnaire.rb''&lt;br /&gt;
** PROBLEM: The SignUpTopic model does not have any knowledge of assignment_questionnaire records&lt;br /&gt;
*** SOLUTION: Add a new has_many reference in the model, to assignment_questionnaires&lt;br /&gt;
*** FILE: ''app/models/sign_up_topic.rb''&lt;br /&gt;
&lt;br /&gt;
* React to an instructor saving an assignment after altering the rubrics-vary-by-topic checkbox&lt;br /&gt;
** PROBLEM: There is nothing in place to remember when an instructor chooses to vary rubrics by topic, or chooses to not vary rubrics by topic&lt;br /&gt;
*** SOLUTION: Modify existing method ''update_assignment_questionnaires()''.  This method executes upon assignment save (explicit or via tab-change).  This method deletes all ''AssignmentQuestionnaire'' records before creating new correct records reflecting the user's selections in the edit assignment form.  Modify such that this method can create multiple records reflecting multiple topics, in the case where rubric should vary by topic.  With this modification, the correct records (with default rubrics) are present when the user goes to the Topics tab, so that the Topics tab can display properly.&lt;br /&gt;
*** FILE: app\models\assignment_form.rb&lt;br /&gt;
** PROBLEM: There is no way to refresh the Topics tab to show / hide drop-downs after the instructor changes checkbox on Rubrics tab&lt;br /&gt;
*** SOLUTION: Make use of existing &amp;quot;Save&amp;quot;-like functionality when changing tabs on the edit assignment page.  When updating due to tab-change, cause a fresh render of the Topics tab.  When updating due to &amp;quot;Save&amp;quot; button, keep functionality as-is.&lt;br /&gt;
*** FILE: ''app/controllers/assignments_controller.rb''&lt;br /&gt;
*** FILE: ''app/views/assignments/edit.html.erb''&lt;br /&gt;
&lt;br /&gt;
* Support the ability to find the correct rubric for a particular topic&lt;br /&gt;
** PROBLEM: The existing methods allow us to find the correct rubric for a particular round, but not a particular topic&lt;br /&gt;
*** SOLUTION: Modify the existing method questionnaire(assignment, type, round_number) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/helpers/assignment_helper.rb''&lt;br /&gt;
*** SOLUTION: Modify the existing method assignment_questionnaire(assignment, type, number) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/helpers/assignment_helper.rb''&lt;br /&gt;
*** SOLUTION: Modify the existing method questionnaire(round = nil) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/models/review_response_map.rb''&lt;br /&gt;
*** SOLUTION: Modify the existing method questionnaire(round) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/models/self_review_response_map.rb''&lt;br /&gt;
*** SOLUTION: Modify the existing method review_questionnaire_id(round = nil) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/models/assignment.rb''&lt;br /&gt;
&lt;br /&gt;
* Use the correct rubric for a particular topic&lt;br /&gt;
** PROBLEM: When finding rubrics to display, save results from, calculate scores from, etc. round may be used but topic is not&lt;br /&gt;
*** SOLUTION: Examine all callers of methods modified in the previous section and pass in ''topic_id'' where appropriate to grab the correct rubric&lt;br /&gt;
*** FILE: (many)&lt;br /&gt;
&lt;br /&gt;
* Support the ability to determine if an assignment has rubrics that vary by topic&lt;br /&gt;
** PROBLEM: There is no handy method to call that can tell us if an assignment has rubrics that vary by topic&lt;br /&gt;
*** SOLUTION: Add a new method ''varying_rubrics_by_topic?'' based on the existing method ''varying_rubrics_by_round?''&lt;br /&gt;
*** FILE: ''app/models/assignment.rb''&lt;br /&gt;
&lt;br /&gt;
=== Q&amp;amp;A ===&lt;br /&gt;
&lt;br /&gt;
Here we paraphrase some questions we received during round 1 of the documentation review.&lt;br /&gt;
&lt;br /&gt;
* Q: How will the new logic for varying rubric by topic tie in with the existing logic?&lt;br /&gt;
** A: We will add a new field ''topic_id'' into the existing table ''assignment_questionnaires'', as noted in the [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Entity_Relationship_Diagram E/R Diagram].  We will update methods that find questionnaires to allow these methods to also accept a ''topic_id'' argument, as noted in [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Implementation Implementation].&lt;br /&gt;
* Q: How will the &amp;quot;Rubric varies by topic&amp;quot; selection be stored?&lt;br /&gt;
** A: Indirectly, by saving records in the ''assignment_questionnaires'' table which either reference a ''topic_id'' or leave this field nil.  For more details please see the [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Entity_Relationship_Diagram E/R Diagram] discussion.&lt;br /&gt;
* Q: What will happen if an instructor selects &amp;quot;Rubric varies by topic&amp;quot;, makes selections on the &amp;quot;Topics&amp;quot; tab, and then deselects &amp;quot;Rubric varies by topic&amp;quot;?&lt;br /&gt;
** A: The Topics tab, when next visited, will no longer show dropdowns for selecting rubrics by topic.  When the assignment is saved, the appropriate not-varying-by-topic records will be saved in the ''assignment_questionnaires'' table.  For more details please see [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Implementation Implementation].&lt;br /&gt;
* Q: What will happen after an instructor selects &amp;quot;Rubric varies by topic&amp;quot;?&lt;br /&gt;
** A: The Topics tab, when next visited, will now show dropdowns for selecting rubrics by topic.  These rubrics will default to those shown on the Rubrics tab.  When the assignment is saved, the appropriate varying-by-topic records will be saved in the ''assignment_questionnaires'' table.  For more details please see [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Implementation Implementation].&lt;br /&gt;
* Q: How will the appropriate list of questionnaires for the new dropdowns on the Topics tab be determined?&lt;br /&gt;
** A: In the same way that the appropriate list of questionnaires for the existing dropdowns on the Rubrics tab is determined.  Namely, by the ''questionnaire_options'' method in the file ''expertiza/app/helpers/assignment_helper.rb''.&lt;br /&gt;
&lt;br /&gt;
=== (Selected) Modified Code ===&lt;br /&gt;
&lt;br /&gt;
In this section, we provide ''selected portions'' of modified code to illustrate how we implemented the new feature.&lt;br /&gt;
&lt;br /&gt;
Allow an instructor to indicate that rubric should vary by topic&lt;br /&gt;
&lt;br /&gt;
''app\views\assignments\edit\_rubrics.html.erb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;lt;input name=&amp;quot;vary_by_topic&amp;quot; type=&amp;quot;hidden&amp;quot; value=&amp;quot;false&amp;quot; /&amp;gt;&lt;br /&gt;
  &amp;lt;%= check_box_tag('vary_by_topic', 'true', @review_vary_by_topic_check) %&amp;gt;&lt;br /&gt;
  &amp;lt;%= label_tag('vary_by_topic', 'Review rubric varies by topic?') %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Allow an instructor to choose different rubrics for different topics&lt;br /&gt;
&lt;br /&gt;
''app\views\sign_up_sheet\_table_line.html.erb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;lt;% if @assignment_form.assignment.varying_rubrics_by_topic? %&amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;table id = &amp;lt;%=table_id %&amp;gt;&amp;gt;&lt;br /&gt;
        &amp;lt;tr&amp;gt;&lt;br /&gt;
          &amp;lt;script&amp;gt;&lt;br /&gt;
              ...&lt;br /&gt;
              &amp;lt;% if @assignment_form.assignment.varying_rubrics_by_round? %&amp;gt;&lt;br /&gt;
                &amp;lt;% for round in 1..@assignment_form.assignment.rounds_of_reviews %&amp;gt;&lt;br /&gt;
                  ...&lt;br /&gt;
                &amp;lt;% end %&amp;gt;&lt;br /&gt;
              &amp;lt;% else %&amp;gt;&lt;br /&gt;
                ...&lt;br /&gt;
              &amp;lt;% end %&amp;gt;&lt;br /&gt;
          &amp;lt;/script&amp;gt;&lt;br /&gt;
        &amp;lt;/tr&amp;gt;&lt;br /&gt;
      &amp;lt;/table&amp;gt;&lt;br /&gt;
    &amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Support the ability of the database to link rubrics to topics&lt;br /&gt;
&lt;br /&gt;
''app\models\sign_up_topic.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  class SignUpTopic &amp;lt; ActiveRecord::Base&lt;br /&gt;
    ...&lt;br /&gt;
    has_many :assignment_questionnaires, class_name: 'AssignmentQuestionnaire', foreign_key: 'topic_id', dependent: :destroy&lt;br /&gt;
    ...&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
React to an instructor saving an assignment after altering the rubrics-vary-by-topic checkbox&lt;br /&gt;
&lt;br /&gt;
''app/controllers/assignments_controller.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def update&lt;br /&gt;
    ...&lt;br /&gt;
    # What to do next depends on how we got here&lt;br /&gt;
    if params['button'].nil?&lt;br /&gt;
      # REFRESH the topics tab after changing tabs&lt;br /&gt;
      ...&lt;br /&gt;
      render :partial =&amp;gt; &amp;quot;assignments/edit/topics&amp;quot;&lt;br /&gt;
    else&lt;br /&gt;
      # SAVE button was used (do a redirect)&lt;br /&gt;
      redirect_to edit_assignment_path @assignment_form.assignment.id&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Support the ability to find the correct rubric for a particular topic&lt;br /&gt;
&lt;br /&gt;
''app/helpers/assignment_helper.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def assignment_questionnaire(assignment, questionnaire_type, round_number = nil, topic_id = nil)&lt;br /&gt;
    q_by_type = assignment.questionnaires.find_by(type: questionnaire_type)&lt;br /&gt;
    if q_by_type.nil?&lt;br /&gt;
      ...&lt;br /&gt;
    else&lt;br /&gt;
      ...&lt;br /&gt;
      aq_by_type = assignment.assignment_questionnaires.find_by(questionnaire_id: q_by_type.id)&lt;br /&gt;
      if round_number.nil? &amp;amp;&amp;amp; topic_id.nil?&lt;br /&gt;
        # Find by type&lt;br /&gt;
        aq = aq_by_type&lt;br /&gt;
      elsif topic_id.nil?&lt;br /&gt;
        # Find by round&lt;br /&gt;
        aq = assignment.assignment_questionnaires.find_by(used_in_round: round_number)&lt;br /&gt;
      elsif round_number.nil?&lt;br /&gt;
        # Find by topic&lt;br /&gt;
        aq = assignment.assignment_questionnaires.find_by(topic_id: topic_id)&lt;br /&gt;
      else&lt;br /&gt;
        # Find by round and topic&lt;br /&gt;
        aq = assignment.assignment_questionnaires.where(used_in_round: round_number, topic_id: topic_id).first&lt;br /&gt;
      end&lt;br /&gt;
      aq.nil? ? aq_by_type : aq&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use the correct rubric for a particular topic&lt;br /&gt;
&lt;br /&gt;
''app\controllers\response_controller.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def set_questionnaire_for_new_response&lt;br /&gt;
    case @map.type&lt;br /&gt;
    when &amp;quot;ReviewResponseMap&amp;quot;, &amp;quot;SelfReviewResponseMap&amp;quot;&lt;br /&gt;
      reviewees_topic = SignedUpTeam.topic_id_by_team_id(@contributor.id)&lt;br /&gt;
      @current_round = @assignment.number_of_current_round(reviewees_topic)&lt;br /&gt;
      @questionnaire = @map.questionnaire(@current_round, reviewees_topic)&lt;br /&gt;
    when&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Support the ability to determine if an assignment has rubrics that vary by topic&lt;br /&gt;
&lt;br /&gt;
''app\models\assignment.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def varying_rubrics_by_topic?&lt;br /&gt;
    aq_no_topic_id = AssignmentQuestionnaire.where(assignment_id: self.id, topic_id: nil).size &amp;gt;= 1&lt;br /&gt;
    aq_with_topic_id = AssignmentQuestionnaire.where(assignment_id: self.id).where.not(topic_id: nil).size &amp;gt;= 1&lt;br /&gt;
    if !aq_no_topic_id &amp;amp;&amp;amp; !aq_with_topic_id&lt;br /&gt;
      return false&lt;br /&gt;
    elsif aq_no_topic_id &amp;amp;&amp;amp; !aq_with_topic_id&lt;br /&gt;
      return false&lt;br /&gt;
    elsif !aq_no_topic_id &amp;amp;&amp;amp; aq_with_topic_id&lt;br /&gt;
      return true&lt;br /&gt;
    else&lt;br /&gt;
      raise StandardError.new(&amp;quot;Assignment with id &amp;quot; + self.id.to_s + &amp;quot; has a conflict about whether or not it varies by topic&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== How To ==&lt;br /&gt;
&lt;br /&gt;
In this section, we describe how to use the newly implemented feature.&lt;br /&gt;
&lt;br /&gt;
=== Add a New Rubric ===&lt;br /&gt;
&lt;br /&gt;
* [to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
=== Select a Rubric for a Topic ===&lt;br /&gt;
&lt;br /&gt;
* [to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
== Project Testing ==&lt;br /&gt;
&lt;br /&gt;
=== Strategy ===&lt;br /&gt;
&lt;br /&gt;
To test code implementation, correctness of the added feature, verify that the team did not break any existing functionalities in the Expertiza, and ensure that no bugs were introduced in the code, we developed the following Test Strategy:&lt;br /&gt;
&lt;br /&gt;
# Code inspection&lt;br /&gt;
# Run and pass existing RSpec Tests&lt;br /&gt;
# Develop New RSpec Tests&lt;br /&gt;
# Run through live UI to test a feature using Expertiza instance&lt;br /&gt;
&lt;br /&gt;
=== Rspec Testing ===&lt;br /&gt;
&lt;br /&gt;
==== Existing Tests ====&lt;br /&gt;
&lt;br /&gt;
Run all existing RSpec tests on any changed files, after our changes, to ensure that we have not introduced any failures.&lt;br /&gt;
The commands and results are shown below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  [to be populated after coding is complete]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== New Tests ====&lt;br /&gt;
&lt;br /&gt;
Write comprehensive RSpec tests, for all new or modified methods.&lt;br /&gt;
* FILE: ''spec/helpers/assignment_helper_spec.rb''&lt;br /&gt;
** METHODS TO TEST: &lt;br /&gt;
*** questionnaire(assignment, type, round_number, topic_id)&lt;br /&gt;
*** assignment_questionnaire(assignment, type, number, topic_id)&lt;br /&gt;
* FILE: ''spec/models/review_response_map_spec.rb''&lt;br /&gt;
*** METHODS TO TEST:&lt;br /&gt;
**** questionnaire(round, topic_id)&lt;br /&gt;
* FILE: ''spec/models/self_review_response_map_spec.rb''&lt;br /&gt;
*** METHODS TO TEST:&lt;br /&gt;
**** questionnaire(round, topic_id)&lt;br /&gt;
* FILE: ''spec/models/assignment_spec.rb''&lt;br /&gt;
*** METHODS TO TEST:&lt;br /&gt;
**** review_questionnaire_id(round, topic_id)&lt;br /&gt;
**** varying_rubrics_by_topic?()&lt;br /&gt;
&lt;br /&gt;
Run these tests, to ensure that the new code works as intended.&lt;br /&gt;
The commands and results are shown below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  [to be populated after coding is complete]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The test suite for a single new method is shown below.&lt;br /&gt;
* There are many such suites added in expertiza/spec  &lt;br /&gt;
* This example illustrates our general strategy:&lt;br /&gt;
** test missing input&lt;br /&gt;
** test bad input&lt;br /&gt;
** test various acceptable forms of input&lt;br /&gt;
** test scenarios that lead to various return values&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  describe &amp;quot;#questionnaire&amp;quot; do&lt;br /&gt;
&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;throws exception if assignment argument nil&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;throws exception if all arguments nil except for assignment&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;finds by type if round number &amp;amp; topic id not given&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;throws exception if round number &amp;amp; topic id not given, no luck finding by type&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;finds by round number alone if round number alone is given&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;creates new questionnaire of given type if round number alone is given, no luck finding by round&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;finds by topic id alone if topic id alone is given&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;creates new questionnaire of given type if topic id alone is given, no luck finding by topic&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;finds by round number and topic id if both are given&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;creates new questionnaire of given type if round and topic are given, no luck finding by round and topic&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== UI Testing ===&lt;br /&gt;
&lt;br /&gt;
Here we describe manual UI Testing that was performed.&lt;br /&gt;
&lt;br /&gt;
==== Rubric does not vary by round or by topic ====&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
==== Rubric varies by round, but not by topic ====&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
==== Rubric varies by topic, but not by round ====&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
==== Rubric varies by both round and topic ====&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
== Future Work ==&lt;br /&gt;
&lt;br /&gt;
This section discusses possible future work for another CSC 517 team to take on.  Such a team can search the Expertiza codebase for &amp;quot;TODO E1936 (future work)&amp;quot; to find the places in the code that the notes below refer to.&lt;br /&gt;
&lt;br /&gt;
* Reduce the delay between changing the state of the &amp;quot;Review rubric varies by topic?&amp;quot; checkbox on the Rubrics tab, and the show / hide of rubric drop-downs on the Topics tab.&lt;br /&gt;
* Redesign UI for tone analysis, heatmaps, and review scores pop-up.  These areas are designed around the assumption that reviews do NOT vary by topic.  For example, in the review scores pop-up, a reviewer can see the reviews they have given, arranged by question, across multiple reviewees.&lt;br /&gt;
&lt;br /&gt;
== Useful Links ==&lt;br /&gt;
In this section we provide useful links related to the work that has been completed by our team.&lt;br /&gt;
# [https://github.com/gabalmat/expertiza Forked Project Repository]&lt;br /&gt;
# [https://github.com/expertiza/expertiza/pull/1444 Pull Request]&lt;br /&gt;
# [(add link here) Video Demonstration of Specialized Rubrics]&lt;br /&gt;
# [(add link here) Video Demonstration of Passing Rspec Tests]&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Contacts ===&lt;br /&gt;
We have 4 (four) members in our team and 1 (one) mentor was also assigned to us. For any project-related questions/concerns please contact us:&lt;br /&gt;
* Aurora Tiffany-Davis - attiffan@ncsu.edu&lt;br /&gt;
* Ginger Balmat - gabalmat@ncsu.edu&lt;br /&gt;
* Joe Hutchinson - jehutch3@ncsu.edu&lt;br /&gt;
* Nikolay Titov - ngtitov@ncsu.edu&lt;br /&gt;
* Zhewei Hu (mentor) - zhu6@ncsu.edu&lt;br /&gt;
&lt;br /&gt;
=== Contribution Based Inquiry ===&lt;br /&gt;
For any questions or concerns related to the project design, implementation, testing of the feature developed by our team, please contact an engineer who worked closely on the topic of your interest based on the [https://docs.google.com/spreadsheets/d/11uxuI_5gaC-FQDwIOxtCaN3HZ9bfWDJgIjFemtYV5jE/edit?ts=5ca222f3#gid=0 Contribution Assignment Grid] we created to keep track of our progress and contribution. Please carbon copy all team members and our mentor in the email.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* Expertiza Web [https://github.com/expertiza/expertiza#expertiza]&lt;br /&gt;
* Expertiza on GitHub [https://github.com/expertiza/expertiza]&lt;br /&gt;
* Expertiza Wiki [http://wikis.lib.ncsu.edu/index.php/Expertiza]&lt;br /&gt;
* Rspec Documentation [https://relishapp.com/rspec]&lt;br /&gt;
* Wiki with Previous Work [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1873_Specialized_rubics_for_different_topic_types]&lt;br /&gt;
* Pull Request of the Previous Work [https://github.com/expertiza/expertiza/pull/1327]&lt;/div&gt;</summary>
		<author><name>Ngtitov</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics&amp;diff=124329</id>
		<title>E1936 Specialized Rubrics</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics&amp;diff=124329"/>
		<updated>2019-04-26T02:02:13Z</updated>

		<summary type="html">&lt;p&gt;Ngtitov: /* Project Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page describes the work and goals that have been completed and achieved while implementing Expertiza Project &amp;quot;''E1936. Specialized Rubrics for Different Topic Types (e.g., Servo project, refactoring project)''&amp;quot; for the CSC/ECE 517 &amp;quot;Object-Oriented Design and Development&amp;quot; class, in the Spring semester of the 2019.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This Wiki page is created per CSC/ECE 517: &amp;quot;Object-Oriented Design and Development&amp;quot;, Expertiza Project requirements (Spring, 2019).&lt;br /&gt;
&lt;br /&gt;
Our [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Team team] was assigned the project &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936. Specialized rubrics for different topic types (e.g., Servo project, refactoring project)]&amp;quot;.  This is an Expertiza project.&lt;br /&gt;
&lt;br /&gt;
In this wiki page we describe the problem to be solved, how we solve that problem, and how we test our solution.  We also provide helpful links and contact information for our team.&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
In this section, we discuss the problem we need to solve, the Expertiza feature this problem is related to, what needs to be done to solve the problem (at a high level), and the previous attempt to solve this problem.&lt;br /&gt;
&lt;br /&gt;
=== Problem Statement ===&lt;br /&gt;
&lt;br /&gt;
This problem statement summarizes the problem as described in the project description &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936. Specialized rubrics for different topic types (e.g., Servo project, refactoring project)]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
In CSC/ECE 517, there are several types of topics that could be covered in a single class assignment.&lt;br /&gt;
* Code base&lt;br /&gt;
** Expertiza&lt;br /&gt;
** Mozilla&lt;br /&gt;
** etc.&lt;br /&gt;
* Goal&lt;br /&gt;
** Refactoring&lt;br /&gt;
** Testing&lt;br /&gt;
** etc.&lt;br /&gt;
However, currently we can only specify one kind of rubric for an assignment.  This means that teams working on different topics will be evaluated using the same rubric.  With this setup, it's not possible to fine-tune rubrics for different topics - rubrics tend to be overly general.&lt;br /&gt;
&lt;br /&gt;
=== Feature Description ===&lt;br /&gt;
&lt;br /&gt;
The Expertiza project already has a feature that allows rubrics to vary by project phase or &amp;quot;round&amp;quot;.  The feature we will add in this project is a feature to allow rubrics to vary not only by round, but also by topic.  This allows more flexibility to the instructor when setting up an assignment, so that they can use rubrics better suited to the tasks that students are performing in an assignment.&lt;br /&gt;
&lt;br /&gt;
When this feature is complete, the following scenarios will be possible, and the instructor will be the judge of which scenario is the best fit to the assignment:&lt;br /&gt;
&lt;br /&gt;
* Rubric does not vary by round or by topic.&lt;br /&gt;
* Rubric varies by round, but not by topic.&lt;br /&gt;
* Rubric varies by topic, but not by round.&lt;br /&gt;
* Rubric varies by both round and topic.&lt;br /&gt;
&lt;br /&gt;
=== What Needs to be Done ===&lt;br /&gt;
&lt;br /&gt;
This section summarizes the work as described in the project description &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936. Specialized rubrics for different topic types (e.g., Servo project, refactoring project)]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* In assignment#edit page &amp;quot;Rubrics&amp;quot; tab, add a checkbox to specify whether rubric should vary by topic.&lt;br /&gt;
* In assignment#edit page &amp;quot;Topics&amp;quot; tab, add dropdown(s) next to each topic to specify which rubric(s) are associated with the topic.&lt;br /&gt;
** The dropdown(s) should appear only if rubric should vary by topic, per the Rubrics tab.&lt;br /&gt;
** The topic should have a multiple dropdowns (one for each round) only if rubrics vary by round, per the Rubrics tab.&lt;br /&gt;
** By default, the rubric(s) for each course project will be the one(s) specified in “Rubrics” tab.&lt;br /&gt;
** The dropdown value can overwrite the default rubric.&lt;br /&gt;
* Be careful when making changes to the code&lt;br /&gt;
** The signup_sheet_controller should have as little to do as possible with the selection of rubrics.&lt;br /&gt;
** Anything not germane to selecting topics should be in another controller or (more probably) a helper.&lt;br /&gt;
* Create a DB migration to allow rubric to vary by topic as well as by round.&lt;br /&gt;
&lt;br /&gt;
==== Screenshots ====&lt;br /&gt;
'''Current screenshot of Rubrics tab for an Assignment'''&lt;br /&gt;
(need to add a checkbox to indicate that rubric should vary by topic)&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Screenshot Assignment Edit Rubrics.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Current screenshot of Topics tab for an Assignment'''&lt;br /&gt;
(need to add a way to select rubrics for particular topics)&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Screenshot Assignment Edit Topics.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Proposed screenshot of Rubrics tab for an Assignment'''&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Specialized Rubric rubric checkbox.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Proposed screenshot of Topics tab for an Assignment'''&lt;br /&gt;
&lt;br /&gt;
(drop down shown for only one topic here, but final product will have one for each topic)&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Specialized Rubric dropdown menu.png]]&lt;br /&gt;
&lt;br /&gt;
== Previous Work ==&lt;br /&gt;
&lt;br /&gt;
There was previous attempt to implement this project in the Fall of 2018 semester by different team, but it was rejected due to several reasons. Our team was provided with all relevant information and materials about the design and implementation of the previously attempted project. We would like to acknowledge that we use previous implementation and design as reference and our starting point for our own implementation. The following is the list of links with the relevant materials that we have used for better project understanding, determining pros and cons of previously proposed changes, and establishing our design strategy and implementation:&lt;br /&gt;
&lt;br /&gt;
# [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1873_Specialized_rubics_for_different_topic_types Wiki]&lt;br /&gt;
# [https://github.com/expertiza/expertiza/pull/1327 Pull Request]&lt;br /&gt;
# [https://drive.google.com/file/d/1UrLb0Ula_Lb_F4MOrdC-s6xng6B08VYu/view Video Demo]&lt;br /&gt;
&lt;br /&gt;
After reviewing all relevant materials above, we concluded that the project implementation was incomplete and proposed design had significant flaw. &lt;br /&gt;
We identified main drawbacks and flaw as follows:&lt;br /&gt;
&lt;br /&gt;
* Establishing incorrect ''many-to-one'' relationship between ''sign_up_topics'' and ''questionnaires'' tables:&lt;br /&gt;
** Creating a DB migration to add ''questionnaire_id'' in the ''sign_up_topics'' table to store the dropdown data presumes ''one-to-one'' or ''many-to-one'' relationship between ''sign_up_topics'' and ''questionnaires'' tables&lt;br /&gt;
** Correct relationship between ''sign_up_topics'' and ''questionnaires'' tables is ''many-to-many''. For example, each project topic may have various rubrics depending on the round it is used (e.g., for round 1, topic may have one rubric; but for round 2, the same topic may have different rubric)&lt;br /&gt;
** Proposed previous migration changes would break DB design and would not allow to store correctly topic and its associated rubric per different round.&lt;br /&gt;
* Per project requirement specifications, &amp;quot;''The dropdown box should appear only if 'Vary rubric by topic' is selected in the Rubrics tab.''&amp;quot; This requirement was not met and ''Vary rubric by topic'' checkbox in the Rubrics tab was not implemented. Therefore, dropdown box with the list of rubrics appears regardless of whether &amp;quot;''Vary rubric by topic''&amp;quot; is selected or not.&lt;br /&gt;
* The dropdown box includes the list of all possible rubrics including default value. However, this condition can be improved. The dropdown box should list the rubrics that were created by the current user (professor who is logged in). This would allow to shorten the list of possible rubrics dramatically and help to avoid any misunderstanding and confusion while user selects desired rubric for the course project.&lt;br /&gt;
&lt;br /&gt;
We found no further issues with the rest implementation and in other project materials. Wiki page is very useful for understanding design of proposed changes, finding drawbacks and the flaw. Considering all the pros and cons, and taking into account drawbacks of the proposed changes, our team evolved different approach that should successfully solve the problem stated for the project without without creating additional issues. Please see our [http://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics#Project_Implementation Project Implementation] for more details.&lt;br /&gt;
&lt;br /&gt;
== Previous Project Requirements ==&lt;br /&gt;
&lt;br /&gt;
The project requirements originally specified how to alter the databases to support varying rubrics by topic.&lt;br /&gt;
&lt;br /&gt;
''Create a new table named topic_questionnaires with field:''&lt;br /&gt;
* ''id''&lt;br /&gt;
* ''topic_id''&lt;br /&gt;
* ''questionnaire_id''&lt;br /&gt;
* ''used_in_round''&lt;br /&gt;
&lt;br /&gt;
However, the E1936 team successfully petitioned for this requirement to change to give us more freedom in the implementation.  The original suggestion had a flaw.  There is already an existing table in the Expertiza project called ''assignment_questionnaires'', which has columns including ''assignment_id'', ''questionnaire_id'', and ''used_in_round''.  It is this table that maintains the knowledge of which rubric is used in which round of an assignment.  If we were to add a new table to maintains the knowledge of which rubric is used in which topic of an assignment as originally suggested, then we would have a big problem.  Knowledge of round-rubric relationship is duplicated.  This would lead (best case scenario) to extra work, and (worst case scenario) to lots of bugs caused by inconsistencies in how these tables are handled with CRUD operations throughout the code.  In other words, this is not a DRY solution.&lt;br /&gt;
&lt;br /&gt;
== Project Implementation ==&lt;br /&gt;
&lt;br /&gt;
In this section, we propose our solution to the problem, discuss implementation techniques and details, and list the goals we achieved.&lt;br /&gt;
&lt;br /&gt;
We start by analyzing Entity Relationship Diagram where we state the solution to the problem. Further we discuss design strategy by breaking project problem into multiple staged sub-problems and provide solutions for each of these sub-problems. We also discuss some implementation details and provide the list of involved files. Finally, we demonstrate how the implemented feature can be used by providing a ''How To'' sub-section.&lt;br /&gt;
&lt;br /&gt;
=== Diagrams ===&lt;br /&gt;
&lt;br /&gt;
Our solution and implementation of the project can be easily shown by discussing Use Case, Entity Relationship, and UML diagrams. First, for simplicity we discuss in general possible sequence of interactions between a user (in this case instructor) and the system (Expertiza) via presenting Use Case Diagram. Then we plan to show proposed database modification via Entity Relationship Diagram.&lt;br /&gt;
&lt;br /&gt;
==== User Case Diagram ====&lt;br /&gt;
&lt;br /&gt;
This is User Case Diagram. &lt;br /&gt;
&lt;br /&gt;
==== Entity Relationship Diagram ====&lt;br /&gt;
&lt;br /&gt;
[[File: HW04_ERD.png]]&lt;br /&gt;
&lt;br /&gt;
The sections of the diagram highlighted in yellow show newly introduced items.  That is, we are adding a new column called ''topic_id'' to ''assignment_questionnaires'', in order to link ''assignment_questionnaires'' to ''sign_up_topics''.&lt;br /&gt;
&lt;br /&gt;
Any assignment, topic, or questionnaire may be represented by multiple records within ''assignment_questionnaires'', but each record within ''assignment_questionnaires'' refers to just one assignment, topic, or questionnaire.  It is the ability to have an assignment represented by multiple records, and the new relationship to ''sign_up_topics'', that allows us to support all of the required scenarios:&lt;br /&gt;
&lt;br /&gt;
* Rubric does not vary by round or by topic.&lt;br /&gt;
* Rubric varies by round, but not by topic.&lt;br /&gt;
* Rubric varies by topic, but not by round.&lt;br /&gt;
* Rubric varies by both round and topic.&lt;br /&gt;
&lt;br /&gt;
[[File: HW04_table.PNG]]&lt;br /&gt;
&lt;br /&gt;
This table illustrates the possibilities that the system may have.&lt;br /&gt;
&lt;br /&gt;
* Assignment 1 does not vary by round or by topic.&lt;br /&gt;
* Assignment 2 varies by round, but not by topic.&lt;br /&gt;
* Assignment 3 varies by topic, but not by round.&lt;br /&gt;
* Assignment 4 varies by both round and topic.&lt;br /&gt;
&lt;br /&gt;
This change is done via database migration by running the following commands:&lt;br /&gt;
&lt;br /&gt;
  rails generate migration AddTopicIdToAssignmentQuestionnaires&lt;br /&gt;
  rb db:migrate&lt;br /&gt;
&lt;br /&gt;
Above command adds the ''topic_id'' column to the ''AssignmentQuestionnaires'' table and generates new migration file:&lt;br /&gt;
&lt;br /&gt;
  class AddTopicIdToAssignmentQuestionnaires &amp;lt; ActiveRecord::Migration&lt;br /&gt;
    def change&lt;br /&gt;
      add_column :assignment_questionnaires, :topic_id, :integer&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
To see the details of the entire database change please check this [https://github.com/gabalmat/expertiza/commit/d46dd57d35a21ab43efb82c28d3f14b75c695f2e commit].&lt;br /&gt;
&lt;br /&gt;
==== UML Diagram ====&lt;br /&gt;
&lt;br /&gt;
This is UML Class diagram.&lt;br /&gt;
&lt;br /&gt;
=== Design Strategy ===&lt;br /&gt;
&lt;br /&gt;
As we have concrete understanding of the problem and proposed solution, we would like break this problem into multiple more manageable sub-problems with specific tasks and well-defined solutions to these tasks. Generally, each sub-problem requires modification of one or more files. We would like to propose our Design Strategy as follows:&lt;br /&gt;
&lt;br /&gt;
==== Preparation ====&lt;br /&gt;
&lt;br /&gt;
* Clean up code that our implementation will use&lt;br /&gt;
** PROBLEM: We need to add/change content to the edit assignment Topics tab, but unlike other tabs in the views, it does not have its own partial view to work with&lt;br /&gt;
*** SOLUTION: Refactor and move the code dealing with topics into separate ''app/views/assignments/edit/_topics.html.erb'' file&lt;br /&gt;
*** File: ''app/views/assignments/edit.html.erb''&lt;br /&gt;
** PROBLEM: In a section below, we discuss the need to modify existing methods to also accept an optional argument ''topic_id''.  In many cases these existing method use confusing variable names or lack sufficient comments.&lt;br /&gt;
*** SOLUTION: Clean up methods that we plan to modify&lt;br /&gt;
*** FILE: (many)&lt;br /&gt;
&lt;br /&gt;
==== Implementation ====&lt;br /&gt;
&lt;br /&gt;
* Allow an instructor to indicate that rubric should vary by topic&lt;br /&gt;
** PROBLEM: There is no way for an instructor to indicate that an assignments' rubric should vary by topic&lt;br /&gt;
*** SOLUTION: Add a new checkbox in the edit assignment Rubric tab to indicate this preference&lt;br /&gt;
*** FILE: ''app/views/assignments/edit/_rubrics.html.erb''&lt;br /&gt;
&lt;br /&gt;
* Allow an instructor to choose different rubrics for different topics&lt;br /&gt;
** PROBLEM: There is no way for an instructor to choose different rubrics for different topics&lt;br /&gt;
*** SOLUTION: Add a new column in the edit assignment Topics tab for choosing rubric(s)&lt;br /&gt;
**** New column only visible if rubrics vary by topic, per Rubrics tab&lt;br /&gt;
**** New column has multiple rounds per topic only if rubrics vary by round, per Rubrics tab&lt;br /&gt;
**** Default value for any rubric is that rubric which is shown on Rubrics tab&lt;br /&gt;
**** Rubric(s) in the dropdown list is/are only those that were created by the currently logged in instructor&lt;br /&gt;
*** FILE: ''app/views/assignments/edit/_topics.html.erb''&lt;br /&gt;
** PROBLEM: The code in ''app/views/assignments/edit/_rubrics.html.erb'' includes dropdowns like the ones we need to add for topics, but that code is way too complex for its functionality (too heavy for a view, uses JavaScript)&lt;br /&gt;
*** SOLUTION: Use the code in ''app/views/assignments/edit/_rubrics.html.erb'' for inspiration only&lt;br /&gt;
**** Refactor and move as much actual work as possible out into helper methods that are simply called from this view&lt;br /&gt;
**** Views are not intended to do heavy lifting&lt;br /&gt;
**** Use as little JavaScript as possible, since this is a Ruby On Rails project, not a JS project&lt;br /&gt;
*** FILE: ''app/views/assignments/edit/_topics.html.erb''&lt;br /&gt;
&lt;br /&gt;
* Support the ability of the database to link rubrics to topics&lt;br /&gt;
** PROBLEM: There is no relationship in the database that can link together rubrics with topics&lt;br /&gt;
*** SOLUTION: Add a new migration that adds topic_id field to existing assignment_questionnaires table&lt;br /&gt;
**** This new field will reference the id field in the sign_up_topics table&lt;br /&gt;
*** FILE: ''db/migrate/[timestamp]_add_topic_id_to_assignment_questionnaires_table.rb''&lt;br /&gt;
** PROBLEM: The AssignmentQuestionnaire model does not have any knowledge of topics&lt;br /&gt;
*** SOLUTION: Add a new belongs_to reference in the model, to sign_up_topic&lt;br /&gt;
*** FILE: ''app/models/assignment_questionnaire.rb''&lt;br /&gt;
** PROBLEM: The SignUpTopic model does not have any knowledge of assignment_questionnaire records&lt;br /&gt;
*** SOLUTION: Add a new has_many reference in the model, to assignment_questionnaires&lt;br /&gt;
*** FILE: ''app/models/sign_up_topic.rb''&lt;br /&gt;
&lt;br /&gt;
* React to an instructor saving an assignment after altering the rubrics-vary-by-topic checkbox&lt;br /&gt;
** PROBLEM: There is nothing in place to remember when an instructor chooses to vary rubrics by topic, or chooses to not vary rubrics by topic&lt;br /&gt;
*** SOLUTION: Modify existing method ''update_assignment_questionnaires()''.  This method executes upon assignment save (explicit or via tab-change).  This method deletes all ''AssignmentQuestionnaire'' records before creating new correct records reflecting the user's selections in the edit assignment form.  Modify such that this method can create multiple records reflecting multiple topics, in the case where rubric should vary by topic.  With this modification, the correct records (with default rubrics) are present when the user goes to the Topics tab, so that the Topics tab can display properly.&lt;br /&gt;
*** FILE: app\models\assignment_form.rb&lt;br /&gt;
** PROBLEM: There is no way to refresh the Topics tab to show / hide drop-downs after the instructor changes checkbox on Rubrics tab&lt;br /&gt;
*** SOLUTION: Make use of existing &amp;quot;Save&amp;quot;-like functionality when changing tabs on the edit assignment page.  When updating due to tab-change, cause a fresh render of the Topics tab.  When updating due to &amp;quot;Save&amp;quot; button, keep functionality as-is.&lt;br /&gt;
*** FILE: ''app/controllers/assignments_controller.rb''&lt;br /&gt;
*** FILE: ''app/views/assignments/edit.html.erb''&lt;br /&gt;
&lt;br /&gt;
* Support the ability to find the correct rubric for a particular topic&lt;br /&gt;
** PROBLEM: The existing methods allow us to find the correct rubric for a particular round, but not a particular topic&lt;br /&gt;
*** SOLUTION: Modify the existing method questionnaire(assignment, type, round_number) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/helpers/assignment_helper.rb''&lt;br /&gt;
*** SOLUTION: Modify the existing method assignment_questionnaire(assignment, type, number) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/helpers/assignment_helper.rb''&lt;br /&gt;
*** SOLUTION: Modify the existing method questionnaire(round = nil) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/models/review_response_map.rb''&lt;br /&gt;
*** SOLUTION: Modify the existing method questionnaire(round) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/models/self_review_response_map.rb''&lt;br /&gt;
*** SOLUTION: Modify the existing method review_questionnaire_id(round = nil) to also accept an optional argument ''topic_id''&lt;br /&gt;
*** FILE: ''app/models/assignment.rb''&lt;br /&gt;
&lt;br /&gt;
* Use the correct rubric for a particular topic&lt;br /&gt;
** PROBLEM: When finding rubrics to display, save results from, calculate scores from, etc. round may be used but topic is not&lt;br /&gt;
*** SOLUTION: Examine all callers of methods modified in the previous section and pass in ''topic_id'' where appropriate to grab the correct rubric&lt;br /&gt;
*** FILE: (many)&lt;br /&gt;
&lt;br /&gt;
* Support the ability to determine if an assignment has rubrics that vary by topic&lt;br /&gt;
** PROBLEM: There is no handy method to call that can tell us if an assignment has rubrics that vary by topic&lt;br /&gt;
*** SOLUTION: Add a new method ''varying_rubrics_by_topic?'' based on the existing method ''varying_rubrics_by_round?''&lt;br /&gt;
*** FILE: ''app/models/assignment.rb''&lt;br /&gt;
&lt;br /&gt;
=== Q&amp;amp;A ===&lt;br /&gt;
&lt;br /&gt;
Here we paraphrase some questions we received during round 1 of the documentation review.&lt;br /&gt;
&lt;br /&gt;
* Q: How will the new logic for varying rubric by topic tie in with the existing logic?&lt;br /&gt;
** A: We will add a new field ''topic_id'' into the existing table ''assignment_questionnaires'', as noted in the [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Entity_Relationship_Diagram E/R Diagram].  We will update methods that find questionnaires to allow these methods to also accept a ''topic_id'' argument, as noted in [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Implementation Implementation].&lt;br /&gt;
* Q: How will the &amp;quot;Rubric varies by topic&amp;quot; selection be stored?&lt;br /&gt;
** A: Indirectly, by saving records in the ''assignment_questionnaires'' table which either reference a ''topic_id'' or leave this field nil.  For more details please see the [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Entity_Relationship_Diagram E/R Diagram] discussion.&lt;br /&gt;
* Q: What will happen if an instructor selects &amp;quot;Rubric varies by topic&amp;quot;, makes selections on the &amp;quot;Topics&amp;quot; tab, and then deselects &amp;quot;Rubric varies by topic&amp;quot;?&lt;br /&gt;
** A: The Topics tab, when next visited, will no longer show dropdowns for selecting rubrics by topic.  When the assignment is saved, the appropriate not-varying-by-topic records will be saved in the ''assignment_questionnaires'' table.  For more details please see [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Implementation Implementation].&lt;br /&gt;
* Q: What will happen after an instructor selects &amp;quot;Rubric varies by topic&amp;quot;?&lt;br /&gt;
** A: The Topics tab, when next visited, will now show dropdowns for selecting rubrics by topic.  These rubrics will default to those shown on the Rubrics tab.  When the assignment is saved, the appropriate varying-by-topic records will be saved in the ''assignment_questionnaires'' table.  For more details please see [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Implementation Implementation].&lt;br /&gt;
* Q: How will the appropriate list of questionnaires for the new dropdowns on the Topics tab be determined?&lt;br /&gt;
** A: In the same way that the appropriate list of questionnaires for the existing dropdowns on the Rubrics tab is determined.  Namely, by the ''questionnaire_options'' method in the file ''expertiza/app/helpers/assignment_helper.rb''.&lt;br /&gt;
&lt;br /&gt;
=== (Selected) Modified Code ===&lt;br /&gt;
&lt;br /&gt;
In this section, we provide ''selected portions'' of modified code to illustrate how we implemented the new feature.&lt;br /&gt;
&lt;br /&gt;
Allow an instructor to indicate that rubric should vary by topic&lt;br /&gt;
&lt;br /&gt;
''app\views\assignments\edit\_rubrics.html.erb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;lt;input name=&amp;quot;vary_by_topic&amp;quot; type=&amp;quot;hidden&amp;quot; value=&amp;quot;false&amp;quot; /&amp;gt;&lt;br /&gt;
  &amp;lt;%= check_box_tag('vary_by_topic', 'true', @review_vary_by_topic_check) %&amp;gt;&lt;br /&gt;
  &amp;lt;%= label_tag('vary_by_topic', 'Review rubric varies by topic?') %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Allow an instructor to choose different rubrics for different topics&lt;br /&gt;
&lt;br /&gt;
''app\views\sign_up_sheet\_table_line.html.erb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;lt;% if @assignment_form.assignment.varying_rubrics_by_topic? %&amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;table id = &amp;lt;%=table_id %&amp;gt;&amp;gt;&lt;br /&gt;
        &amp;lt;tr&amp;gt;&lt;br /&gt;
          &amp;lt;script&amp;gt;&lt;br /&gt;
              ...&lt;br /&gt;
              &amp;lt;% if @assignment_form.assignment.varying_rubrics_by_round? %&amp;gt;&lt;br /&gt;
                &amp;lt;% for round in 1..@assignment_form.assignment.rounds_of_reviews %&amp;gt;&lt;br /&gt;
                  ...&lt;br /&gt;
                &amp;lt;% end %&amp;gt;&lt;br /&gt;
              &amp;lt;% else %&amp;gt;&lt;br /&gt;
                ...&lt;br /&gt;
              &amp;lt;% end %&amp;gt;&lt;br /&gt;
          &amp;lt;/script&amp;gt;&lt;br /&gt;
        &amp;lt;/tr&amp;gt;&lt;br /&gt;
      &amp;lt;/table&amp;gt;&lt;br /&gt;
    &amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Support the ability of the database to link rubrics to topics&lt;br /&gt;
&lt;br /&gt;
''app\models\sign_up_topic.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  class SignUpTopic &amp;lt; ActiveRecord::Base&lt;br /&gt;
    ...&lt;br /&gt;
    has_many :assignment_questionnaires, class_name: 'AssignmentQuestionnaire', foreign_key: 'topic_id', dependent: :destroy&lt;br /&gt;
    ...&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
React to an instructor saving an assignment after altering the rubrics-vary-by-topic checkbox&lt;br /&gt;
&lt;br /&gt;
''app/controllers/assignments_controller.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def update&lt;br /&gt;
    ...&lt;br /&gt;
    # What to do next depends on how we got here&lt;br /&gt;
    if params['button'].nil?&lt;br /&gt;
      # REFRESH the topics tab after changing tabs&lt;br /&gt;
      ...&lt;br /&gt;
      render :partial =&amp;gt; &amp;quot;assignments/edit/topics&amp;quot;&lt;br /&gt;
    else&lt;br /&gt;
      # SAVE button was used (do a redirect)&lt;br /&gt;
      redirect_to edit_assignment_path @assignment_form.assignment.id&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Support the ability to find the correct rubric for a particular topic&lt;br /&gt;
&lt;br /&gt;
''app/helpers/assignment_helper.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def assignment_questionnaire(assignment, questionnaire_type, round_number = nil, topic_id = nil)&lt;br /&gt;
    q_by_type = assignment.questionnaires.find_by(type: questionnaire_type)&lt;br /&gt;
    if q_by_type.nil?&lt;br /&gt;
      ...&lt;br /&gt;
    else&lt;br /&gt;
      ...&lt;br /&gt;
      aq_by_type = assignment.assignment_questionnaires.find_by(questionnaire_id: q_by_type.id)&lt;br /&gt;
      if round_number.nil? &amp;amp;&amp;amp; topic_id.nil?&lt;br /&gt;
        # Find by type&lt;br /&gt;
        aq = aq_by_type&lt;br /&gt;
      elsif topic_id.nil?&lt;br /&gt;
        # Find by round&lt;br /&gt;
        aq = assignment.assignment_questionnaires.find_by(used_in_round: round_number)&lt;br /&gt;
      elsif round_number.nil?&lt;br /&gt;
        # Find by topic&lt;br /&gt;
        aq = assignment.assignment_questionnaires.find_by(topic_id: topic_id)&lt;br /&gt;
      else&lt;br /&gt;
        # Find by round and topic&lt;br /&gt;
        aq = assignment.assignment_questionnaires.where(used_in_round: round_number, topic_id: topic_id).first&lt;br /&gt;
      end&lt;br /&gt;
      aq.nil? ? aq_by_type : aq&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use the correct rubric for a particular topic&lt;br /&gt;
&lt;br /&gt;
''app\controllers\response_controller.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def set_questionnaire_for_new_response&lt;br /&gt;
    case @map.type&lt;br /&gt;
    when &amp;quot;ReviewResponseMap&amp;quot;, &amp;quot;SelfReviewResponseMap&amp;quot;&lt;br /&gt;
      reviewees_topic = SignedUpTeam.topic_id_by_team_id(@contributor.id)&lt;br /&gt;
      @current_round = @assignment.number_of_current_round(reviewees_topic)&lt;br /&gt;
      @questionnaire = @map.questionnaire(@current_round, reviewees_topic)&lt;br /&gt;
    when&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Support the ability to determine if an assignment has rubrics that vary by topic&lt;br /&gt;
&lt;br /&gt;
''app\models\assignment.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def varying_rubrics_by_topic?&lt;br /&gt;
    aq_no_topic_id = AssignmentQuestionnaire.where(assignment_id: self.id, topic_id: nil).size &amp;gt;= 1&lt;br /&gt;
    aq_with_topic_id = AssignmentQuestionnaire.where(assignment_id: self.id).where.not(topic_id: nil).size &amp;gt;= 1&lt;br /&gt;
    if !aq_no_topic_id &amp;amp;&amp;amp; !aq_with_topic_id&lt;br /&gt;
      return false&lt;br /&gt;
    elsif aq_no_topic_id &amp;amp;&amp;amp; !aq_with_topic_id&lt;br /&gt;
      return false&lt;br /&gt;
    elsif !aq_no_topic_id &amp;amp;&amp;amp; aq_with_topic_id&lt;br /&gt;
      return true&lt;br /&gt;
    else&lt;br /&gt;
      raise StandardError.new(&amp;quot;Assignment with id &amp;quot; + self.id.to_s + &amp;quot; has a conflict about whether or not it varies by topic&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== How To ==&lt;br /&gt;
&lt;br /&gt;
In this section, we describe how to use the newly implemented feature.&lt;br /&gt;
&lt;br /&gt;
=== Add a New Rubric ===&lt;br /&gt;
&lt;br /&gt;
* [to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
=== Select a Rubric for a Topic ===&lt;br /&gt;
&lt;br /&gt;
* [to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
== Project Testing ==&lt;br /&gt;
&lt;br /&gt;
=== Strategy ===&lt;br /&gt;
&lt;br /&gt;
To test code implementation, correctness of the added feature, verify that the team did not break any existing functionalities in the Expertiza, and ensure that no bugs were introduced in the code, we developed the following Test Strategy:&lt;br /&gt;
&lt;br /&gt;
# Code inspection&lt;br /&gt;
# Run and pass existing RSpec Tests&lt;br /&gt;
# Develop New RSpec Tests&lt;br /&gt;
# Run through live UI to test a feature using Expertiza instance&lt;br /&gt;
&lt;br /&gt;
=== Rspec Testing ===&lt;br /&gt;
&lt;br /&gt;
==== Existing Tests ====&lt;br /&gt;
&lt;br /&gt;
Run all existing RSpec tests on any changed files, after our changes, to ensure that we have not introduced any failures.&lt;br /&gt;
The commands and results are shown below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  [to be populated after coding is complete]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== New Tests ====&lt;br /&gt;
&lt;br /&gt;
Write comprehensive RSpec tests, for all new or modified methods.&lt;br /&gt;
* FILE: ''spec/helpers/assignment_helper_spec.rb''&lt;br /&gt;
** METHODS TO TEST: &lt;br /&gt;
*** questionnaire(assignment, type, round_number, topic_id)&lt;br /&gt;
*** assignment_questionnaire(assignment, type, number, topic_id)&lt;br /&gt;
* FILE: ''spec/models/review_response_map_spec.rb''&lt;br /&gt;
*** METHODS TO TEST:&lt;br /&gt;
**** questionnaire(round, topic_id)&lt;br /&gt;
* FILE: ''spec/models/self_review_response_map_spec.rb''&lt;br /&gt;
*** METHODS TO TEST:&lt;br /&gt;
**** questionnaire(round, topic_id)&lt;br /&gt;
* FILE: ''spec/models/assignment_spec.rb''&lt;br /&gt;
*** METHODS TO TEST:&lt;br /&gt;
**** review_questionnaire_id(round, topic_id)&lt;br /&gt;
**** varying_rubrics_by_topic?()&lt;br /&gt;
&lt;br /&gt;
Run these tests, to ensure that the new code works as intended.&lt;br /&gt;
The commands and results are shown below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  [to be populated after coding is complete]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The test suite for a single new method is shown below.&lt;br /&gt;
* There are many such suites added in expertiza/spec  &lt;br /&gt;
* This example illustrates our general strategy:&lt;br /&gt;
** test missing input&lt;br /&gt;
** test bad input&lt;br /&gt;
** test various acceptable forms of input&lt;br /&gt;
** test scenarios that lead to various return values&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  describe &amp;quot;#questionnaire&amp;quot; do&lt;br /&gt;
&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;throws exception if assignment argument nil&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;throws exception if all arguments nil except for assignment&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;finds by type if round number &amp;amp; topic id not given&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;throws exception if round number &amp;amp; topic id not given, no luck finding by type&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;finds by round number alone if round number alone is given&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;creates new questionnaire of given type if round number alone is given, no luck finding by round&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;finds by topic id alone if topic id alone is given&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;creates new questionnaire of given type if topic id alone is given, no luck finding by topic&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;finds by round number and topic id if both are given&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;creates new questionnaire of given type if round and topic are given, no luck finding by round and topic&amp;quot; do&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== UI Testing ===&lt;br /&gt;
&lt;br /&gt;
Here we describe manual UI Testing that was performed.&lt;br /&gt;
&lt;br /&gt;
==== Rubric does not vary by round or by topic ====&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
==== Rubric varies by round, but not by topic ====&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
==== Rubric varies by topic, but not by round ====&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
==== Rubric varies by both round and topic ====&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
== Future Work ==&lt;br /&gt;
&lt;br /&gt;
This section discusses possible future work for another CSC 517 team to take on.  Such a team can search the Expertiza codebase for &amp;quot;TODO E1936 (future work)&amp;quot; to find the places in the code that the notes below refer to.&lt;br /&gt;
&lt;br /&gt;
* Reduce the delay between changing the state of the &amp;quot;Review rubric varies by topic?&amp;quot; checkbox on the Rubrics tab, and the show / hide of rubric drop-downs on the Topics tab.&lt;br /&gt;
* Redesign UI for tone analysis, heatmaps, and review scores pop-up.  These areas are designed around the assumption that reviews do NOT vary by topic.  For example, in the review scores pop-up, a reviewer can see the reviews they have given, arranged by question, across multiple reviewees.&lt;br /&gt;
&lt;br /&gt;
== Useful Links ==&lt;br /&gt;
In this section we provide useful links related to the work that has been completed by our team.&lt;br /&gt;
# [https://github.com/gabalmat/expertiza Forked Project Repository]&lt;br /&gt;
# [https://github.com/expertiza/expertiza/pull/1444 Pull Request]&lt;br /&gt;
# [(add link here) Video Demonstration of Specialized Rubrics]&lt;br /&gt;
# [(add link here) Video Demonstration of Passing Rspec Tests]&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Contacts ===&lt;br /&gt;
We have 4 (four) members in our team and 1 (one) mentor was also assigned to us. For any project-related questions/concerns please contact us:&lt;br /&gt;
* Aurora Tiffany-Davis - attiffan@ncsu.edu&lt;br /&gt;
* Ginger Balmat - gabalmat@ncsu.edu&lt;br /&gt;
* Joe Hutchinson - jehutch3@ncsu.edu&lt;br /&gt;
* Nikolay Titov - ngtitov@ncsu.edu&lt;br /&gt;
* Zhewei Hu (mentor) - zhu6@ncsu.edu&lt;br /&gt;
&lt;br /&gt;
=== Contribution Based Inquiry ===&lt;br /&gt;
For any questions or concerns related to the project design, implementation, testing of the feature developed by our team, please contact an engineer who worked closely on the topic of your interest based on the [https://docs.google.com/spreadsheets/d/11uxuI_5gaC-FQDwIOxtCaN3HZ9bfWDJgIjFemtYV5jE/edit?ts=5ca222f3#gid=0 Contribution Assignment Grid] we created to keep track of our progress and contribution. Please carbon copy all team members and our mentor in the email.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* Expertiza Web [https://github.com/expertiza/expertiza#expertiza]&lt;br /&gt;
* Expertiza on GitHub [https://github.com/expertiza/expertiza]&lt;br /&gt;
* Expertiza Wiki [http://wikis.lib.ncsu.edu/index.php/Expertiza]&lt;br /&gt;
* Rspec Documentation [https://relishapp.com/rspec]&lt;br /&gt;
* Wiki with Previous Work [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1873_Specialized_rubics_for_different_topic_types]&lt;br /&gt;
* Pull Request of the Previous Work [https://github.com/expertiza/expertiza/pull/1327]&lt;/div&gt;</summary>
		<author><name>Ngtitov</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics&amp;diff=123587</id>
		<title>E1936 Specialized Rubrics</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics&amp;diff=123587"/>
		<updated>2019-04-08T09:02:52Z</updated>

		<summary type="html">&lt;p&gt;Ngtitov: /* Entity Relationship Diagram */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page describes the work and goals that have been completed and achieved while implementing Expertiza Project &amp;quot;E1936. Specialized Rubrics for Different Topic Types (e.g., Servo project, refactoring project)&amp;quot; for the CSC/ECE 517 &amp;quot;Object-Oriented Design and Development&amp;quot; class, in the Spring semester of the 2019.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This Wiki page is created per CSC/ECE 517: &amp;quot;Object-Oriented Design and Development&amp;quot;, Expertiza Project requirements (Spring, 2019).&lt;br /&gt;
&lt;br /&gt;
Our [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Team team] was assigned the project &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936. Specialized rubrics for different topic types (e.g., Servo project, refactoring project)]&amp;quot;.  This is an Expertiza project.&lt;br /&gt;
&lt;br /&gt;
In this wiki page we describe the problem to be solved, how we solve that problem, and how we test our solution.  We also provide helpful links and contact information for our team.&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
In this section, we discuss the problem we need to solve, the Expertiza feature this problem is related to, what needs to be done to solve the problem (at a high level), and the previous attempt to solve this problem.&lt;br /&gt;
&lt;br /&gt;
=== Problem Statement ===&lt;br /&gt;
&lt;br /&gt;
This problem statement summarizes the problem as described in the project description &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936. Specialized rubrics for different topic types (e.g., Servo project, refactoring project)]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
In CSC/ECE 517, there are several types of topics that could be covered in a single class assignment.&lt;br /&gt;
* Code base&lt;br /&gt;
** Expertiza&lt;br /&gt;
** Mozilla&lt;br /&gt;
** etc.&lt;br /&gt;
* Goal&lt;br /&gt;
** Refactoring&lt;br /&gt;
** Testing&lt;br /&gt;
** etc.&lt;br /&gt;
However, currently we can only specify one kind of rubric for an assignment.  This means that teams working on different topics will be evaluated using the same rubric.  With this setup, it's not possible to fine-tune rubrics for different topics - rubrics tend to be overly general.&lt;br /&gt;
&lt;br /&gt;
=== Feature Description ===&lt;br /&gt;
&lt;br /&gt;
The feature we will add in this project is a feature to allow rubrics to vary not only by project phase, but also by topic.  This allows more flexibility to the instructor when setting up an assignment, so that they can use rubrics better suited to the tasks that students are performing in an assignment.&lt;br /&gt;
&lt;br /&gt;
When this feature is complete, the following scenarios will be possible, and the instructor will be the judge of which scenario is the best fit to the assignment:&lt;br /&gt;
&lt;br /&gt;
* One rubric for the assignment, period.&lt;br /&gt;
* A different rubric for each phase of the assignment, regardless of what topic different students are working on.&lt;br /&gt;
* A different rubric for each topic, regardless of the phases in the assignment.&lt;br /&gt;
* A different rubric for each phase of the assignment, and within a phase, a different rubric for each topic.&lt;br /&gt;
&lt;br /&gt;
=== What Needs to be Done ===&lt;br /&gt;
&lt;br /&gt;
This section summarizes the work as described in the project description &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936. Specialized rubrics for different topic types (e.g., Servo project, refactoring project)]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* In assignment#edit page &amp;quot;Rubrics&amp;quot; tab, add a checkbox to specify whether rubric should vary by topic.&lt;br /&gt;
* In assignment#edit page &amp;quot;Topics&amp;quot; tab, add dropdown(s) next to each topic to specify which rubric(s) are associated with the topic.&lt;br /&gt;
** The dropdown(s) should appear only if rubric should vary by topic, per the Rubrics tab.&lt;br /&gt;
** The topic should have a multiple dropdowns (one for each round) only if rubrics vary by round, per the Rubrics tab.&lt;br /&gt;
** By default, the rubric(s) for each course project will be the one(s) specified in “Rubrics” tab.&lt;br /&gt;
** The dropdown value can overwrite the default rubric.&lt;br /&gt;
* Be careful when making changes to the code&lt;br /&gt;
** The signup_sheet_controller should have as little to do as possible with the selection of rubrics.&lt;br /&gt;
** Anything not germane to selecting topics should be in another controller or (more probably) a helper.&lt;br /&gt;
* Create a DB migration to allow rubric to vary by topic as well as by round.&lt;br /&gt;
&lt;br /&gt;
==== Screenshots ====&lt;br /&gt;
'''Current screenshot of Rubrics tab for an Assignment'''&lt;br /&gt;
(need to add a checkbox to indicate that rubric should vary by topic)&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Screenshot Assignment Edit Rubrics.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Current screenshot of Topics tab for an Assignment'''&lt;br /&gt;
(need to add a way to select rubrics for particular topics)&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Screenshot Assignment Edit Topics.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Proposed screenshot of Rubrics tab for an Assignment'''&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Specialized Rubric rubric checkbox.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Proposed screenshot of Topics tab for an Assignment'''&lt;br /&gt;
&lt;br /&gt;
(drop down shown for only one topic here, but final product will have one for each topic)&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Specialized Rubric dropdown menu.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Previous Work ===&lt;br /&gt;
There was previous attempt to implement this project in the Fall of 2018 semester by different team, but it was rejected due to several reasons. Our team was provided with all relevant information and materials about the design and implementation of the previously attempted project. We would like to acknowledge that we use previous implementation and design as reference and our starting point for our own implementation. The following is the list of links with the relevant materials that we have used for better project understanding, determining pros and cons of previously proposed changes, and establishing our design strategy and implementation:&lt;br /&gt;
&lt;br /&gt;
# [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1873_Specialized_rubics_for_different_topic_types Wiki]&lt;br /&gt;
# [https://github.com/expertiza/expertiza/pull/1327 Pull Request]&lt;br /&gt;
# [https://drive.google.com/file/d/1UrLb0Ula_Lb_F4MOrdC-s6xng6B08VYu/view Video Demo]&lt;br /&gt;
&lt;br /&gt;
After reviewing all relevant materials above, we concluded that the project implementation was incomplete and proposed design had significant flaw. &lt;br /&gt;
We identified main drawbacks and flaw as follows:&lt;br /&gt;
&lt;br /&gt;
* Establishing incorrect ''many-to-one'' relationship between ''sign_up_topics'' and ''questionnaires'' tables:&lt;br /&gt;
** Creating a DB migration to add ''questionnaire_id'' in the ''sign_up_topics'' table to store the dropdown data presumes ''one-to-one'' or ''many-to-one'' relationship between ''sign_up_topics'' and ''questionnaires'' tables&lt;br /&gt;
** Correct relationship between ''sign_up_topics'' and ''questionnaires'' tables is ''many-to-many''. For example, each project topic may have various rubrics depending on the round it is used (e.g., for round 1, topic may have one rubric; but for round 2, the same topic may have different rubric)&lt;br /&gt;
** Proposed previous migration changes would break DB design and would not allow to store correctly topic and its associated rubric per different round.&lt;br /&gt;
* Per project requirement specifications, &amp;quot;''The dropdown box should appear only if 'Vary rubric by topic' is selected in the Rubrics tab.''&amp;quot; This requirement was not met and ''Vary rubric by topic'' checkbox in the Rubrics tab was not implemented. Therefore, dropdown box with the list of rubrics appears regardless of whether &amp;quot;''Vary rubric by topic''&amp;quot; is selected or not.&lt;br /&gt;
* The dropdown box includes the list of all possible rubrics including default value. However, this condition can be improved. The dropdown box should list the rubrics that were created by the current user (professor who is logged in). This would allow to shorten the list of possible rubrics dramatically and help to avoid any misunderstanding and confusion while user selects desired rubric for the course project.&lt;br /&gt;
&lt;br /&gt;
We found no further issues with the rest implementation and in other project materials. Wiki page is very useful for understanding design of proposed changes, finding drawbacks and the flaw. Considering all the pros and cons, and taking into account drawbacks of the proposed changes, our team evolved different approach that should successfully solve the problem stated for the project without without creating additional issues. Please see our [http://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics#Project_Implementation Project Implementation] for more details.&lt;br /&gt;
&lt;br /&gt;
== Project Implementation ==&lt;br /&gt;
In this section, we propose our solution to the problem, discuss implementation techniques and details, and list the goals we achieved.&lt;br /&gt;
&lt;br /&gt;
We start by analyzing Entity Relationship Diagram where we state the solution to the problem. Further we discuss design strategy by breaking project problem into multiple staged sub-problems and provide solution for each of these sub-problems. We also discuss some implementation details and provide the list of involved files. Finally, we demonstrate how implemented feature can be used by providing ''How To'' sub-section.&lt;br /&gt;
&lt;br /&gt;
=== Entity Relationship Diagram ===&lt;br /&gt;
We would like to propose our solution to the problem by representing Entity Relationship Diagram and discussing how relationship between ''sign_up_topics'' and ''questionnaires'' tables can be established to associate project's topic with a rubric.&lt;br /&gt;
&lt;br /&gt;
''Note'' that in the existing implementation neither ''sign_up_topics'' nor ''questionnaires'' tables have relation with each other. Meaning ''sign_up_topics'' table has no foreign key that points to the ''questionnaires'' table, and equivalently for the ''questionnaires'' table, it has no foreign key that points to the ''sign_up_topics'' table. This problem would easily be solved if the ''sign_up_topics'' and ''questionnaires'' tables have ''many-to-one'' relationship (which seems to be an appropriate approach since each topic has exactly one rubric). In this case we would create a DB migration to add ''questionnaire_id'' in the ''sign_up_topics''. However, this solution is incorrect as we stated in the [http://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics#Previous_Work Previous Work] section.&lt;br /&gt;
&lt;br /&gt;
The problem is that each topic has exactly one rubric per specific round. The same topic may have different rubric with various rounds. Therefore, ''many-to-one'' relationship would break DB design and would limit to have only one rubric per topic for each round. Hence, the correct is ''many-to-many'' relationship between the tables.&lt;br /&gt;
&lt;br /&gt;
To solve this dilemma and properly establish ''many-to-many'' relationship between ''sign_up_topics'' nor ''questionnaires'' tables, we came to the conclusion and can state solution to the core problem of the project:&lt;br /&gt;
* Create new ''topic_questionnaire'' table with foreign keys to each of the ''sign_up_topics'' and ''questionnaires'' tables.&lt;br /&gt;
&lt;br /&gt;
By adding new such table we create ''many-to-many'' relationship between ''sign_up_topics'' nor ''questionnaires'' tables and this would allow project topic to record multiple rubrics per each round. In the following Entity Relationship Diagram, we show existing DB design (in black) and proposed DB design changes (depicted in blue):&lt;br /&gt;
&lt;br /&gt;
[[File: CSC520_Project_4_Diagram.PNG]]&lt;br /&gt;
&lt;br /&gt;
Above Entity Relationship Diagram can be interpreted as follows:&lt;br /&gt;
* ''sign_up_topics'' table is connected with ''topic_questionnaire'' table through ''many-to-many'' relationship (i.e., project's topic may have multiple topic questionnaires per each round)&lt;br /&gt;
* ''topic_questionnaire'' table is connected with ''questionnaires'' tables via ''many-to-one'' relationship (i.e., topic questionnaire belongs to exactly one questionnaire)&lt;br /&gt;
&lt;br /&gt;
To illustrate this we can use the following table that reflects new ''topic_questionnaire'' table at any point in time:&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
  &amp;lt;tr&amp;gt;&lt;br /&gt;
    &amp;lt;th&amp;gt;id&amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;th&amp;gt;topic_id&amp;lt;/th&amp;gt; &lt;br /&gt;
    &amp;lt;th&amp;gt;questionnaire_id&amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;th&amp;gt;used_in_round&amp;lt;/th&amp;gt;&lt;br /&gt;
  &amp;lt;/tr&amp;gt;&lt;br /&gt;
  &amp;lt;tr&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;/tr&amp;gt;&lt;br /&gt;
  &amp;lt;tr&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;2&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;2&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;2&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;/tr&amp;gt;&lt;br /&gt;
  &amp;lt;tr&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;3&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;3&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;3&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Above table demonstrates that the same topic with id=1 may have various questionnaires (id's=1, 2, 3) depending on the round (round 1, 2, 3 and etc).&lt;br /&gt;
&lt;br /&gt;
=== Design Strategy ===&lt;br /&gt;
As we have concrete understanding of the problem and proposed solution, we would like break this problem into multiple more manageable sub-problems with specific tasks and well-defined solutions to these tasks. Generally, each sub-problem requires modification of one or more files. We would like to propose our Design Strategy as follows:&lt;br /&gt;
* Rubrics tab with &amp;quot;''Vary rubric by topic''&amp;quot; checkbox&lt;br /&gt;
** File: ''app/views/assignments/edit/_rubrics.html.erb''&lt;br /&gt;
** PROBLEM: There is no way for the user to indicate that rubrics should vary by topic&lt;br /&gt;
** SOLUTION: Add a new checkbox in the rubric tab to indicate whether rubrics vary by topic or not&lt;br /&gt;
&lt;br /&gt;
* Preparation of the Topics tab&lt;br /&gt;
** File: ''app/views/assignments/edit.html.erb''&lt;br /&gt;
** PROBLEM: We need to add/change content to the Topics tab, but unlike other tabs in the views, it does not have its own partial view to work with&lt;br /&gt;
** SOLUTION: Refactor and move the code dealing with topics into separate ''app/views/assignments/edit/_topics.html.erb'' file&lt;br /&gt;
&lt;br /&gt;
* Topics tab with &amp;quot;''Questionnaire''&amp;quot; column and review dropdown content&lt;br /&gt;
** File: ''app/views/assignments/edit/_topics.html.erb''&lt;br /&gt;
** PROBLEM: There is no way for the user to select rubric(s) for a particular topic&lt;br /&gt;
** SOLUTION: Add a new column in the topics table for choosing rubric(s)&lt;br /&gt;
*** New column only visible if rubrics vary by topic, per Rubrics tab&lt;br /&gt;
*** New column has multiple rounds per topic only if rubrics vary by round, per Rubrics tab&lt;br /&gt;
*** Default value for any rubric is that rubric which is shown on Rubrics tab&lt;br /&gt;
*** Rubric(s) in the dropdown list is/are only those that were created by the currently logged in instructor&lt;br /&gt;
** PROBLEM: The code in ''app/views/assignments/edit/_rubrics.html.erb'' includes dropdowns like the ones we need to add for topics, but that code is way too complex for its functionality (too heavy for a view, uses JavaScript)&lt;br /&gt;
** SOLUTION: Use the code in ''app/views/assignments/edit/_rubrics.html.erb'' for inspiration and as a base line only&lt;br /&gt;
*** Refactor and move as much actual work as possible out into helper methods that are simply called from this view&lt;br /&gt;
*** Views are not intended to do heavy lifting&lt;br /&gt;
*** Use as little JavaScript as possible, since this is a Ruby On Rails project, not a JS project&lt;br /&gt;
&lt;br /&gt;
* Find questionnaire for a given assignment/round/topic&lt;br /&gt;
* File: ''app/helpers/assignment_helper.rb''&lt;br /&gt;
** PROBLEM: The ''assignment_questionnaire'' method finds a questionnaire for a given assignment/round, and would be a great place to include code to find a questionnaire for a given assignment/round/topic, however the method is not easy to work with&lt;br /&gt;
** SOLUTION: Improve readability of teh ''assignment_questionnaire'' method&lt;br /&gt;
*** Add comment block at the top describing the purpose and basic strategy of the method&lt;br /&gt;
*** Rename 'number' parameter to clarify the purpose of the parameter&lt;br /&gt;
** SOLUTION: Expand functionality of the ''assignment_questionnaire'' method&lt;br /&gt;
*** Add ability to get assignment questionnaires by topic as well as by round&lt;br /&gt;
*** Like round, topic parameter should be optional&lt;br /&gt;
&lt;br /&gt;
* Test all of the required helpers&lt;br /&gt;
* File: ''spec/helpers''&lt;br /&gt;
** PROBLEM: We are going to add code to the ''app/helpers/assignment_helper.rb'', but this helper does not have an RSpec test suite yet&lt;br /&gt;
** SOLUTION: Add ''spec/helpers/assignment_helper_spec.rb'' file&lt;br /&gt;
*** Thoroughly test ''assignment_questionnaire'' method in the ''app/helpers/assignment_helper.rb''&lt;br /&gt;
** PROBLEM: We may also need to create other helpers or helper methods as we get into the code&lt;br /&gt;
** SOLUTION: Add tests for any newly created helpers or helper methods&lt;br /&gt;
&lt;br /&gt;
* Core Problem: create relationship between ''sign_up_topics'' and ''questionnaires'' table through ''topic_questionnaires'' table&lt;br /&gt;
* File: ''db/migrate''&lt;br /&gt;
** PROBLEM: Questionnaires (of which rubrics are one type) are not linked to assignment topics&lt;br /&gt;
** SOLUTION: Create a new migration to link rubrics to topics&lt;br /&gt;
*** Create a new table named topic_questionnaire with the following fields:&lt;br /&gt;
**** ''id''&lt;br /&gt;
**** ''topic_id''&lt;br /&gt;
**** ''questionnaire_id''&lt;br /&gt;
**** ''used_in_round''&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
&lt;br /&gt;
In this section, we provide selected portions of modified code to illustrate how we implemented the new feature.&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
In this section, we list all files that were modified while implementing the new feature.&lt;br /&gt;
&lt;br /&gt;
* [to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
=== How To ===&lt;br /&gt;
&lt;br /&gt;
In this section, we describe how to use the newly implemented feature.&lt;br /&gt;
&lt;br /&gt;
==== Add a New Rubric ====&lt;br /&gt;
&lt;br /&gt;
* [to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
==== Select a Rubric for a Topic ====&lt;br /&gt;
&lt;br /&gt;
* [to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
== Project Testing ==&lt;br /&gt;
To test code implementation, correctness of the added feature, verify that the team did not break any existing functionalities in the Expertiza, and ensure that no bugs were introduced in the code, we utilized the following Test Strategy:&lt;br /&gt;
# Code inspection&lt;br /&gt;
# Run and pass existing RSpec Tests&lt;br /&gt;
# Develop New RSpec Tests&lt;br /&gt;
# Run through live UI to test a feature using Expertiza instance&lt;br /&gt;
&lt;br /&gt;
=== Rspec Testing ===&lt;br /&gt;
&lt;br /&gt;
Our strategy for gaining confidence that our code changes did not break anything was as follows:&lt;br /&gt;
* Run all existing RSpec tests on any changed files, after our changes, to ensure that we have not introduced any failures.&lt;br /&gt;
* The commands and results are shown below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  [to be populated after coding is complete]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Write new comprehensive RSpec tests, for all new methods.&lt;br /&gt;
* Run these tests, to ensure that the new code works as intended.&lt;br /&gt;
* The commands and results are shown below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  [to be populated after coding is complete]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The test suite for a single new method is below.&lt;br /&gt;
* There are many such suites in (TODO add filename(s)).  &lt;br /&gt;
* This example illustrates our general strategy:&lt;br /&gt;
** test missing input&lt;br /&gt;
** test bad input&lt;br /&gt;
** test various acceptable forms of input&lt;br /&gt;
** test scenarios that lead to &amp;quot;true&amp;quot; and to &amp;quot;false&amp;quot; return values&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  [to be populated after coding is complete]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== UI Testing ===&lt;br /&gt;
Here we describe UI Testing that has performed. Include Screenshots maybe?&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
== Useful Links ==&lt;br /&gt;
In this section we provide useful links related to the work that has been completed by our team.&lt;br /&gt;
# [https://github.com/gabalmat/expertiza Forked Project Repository]&lt;br /&gt;
# [(add link here) Pull Request]&lt;br /&gt;
# [(add link here) Video Demonstration of Specialized Rubrics]&lt;br /&gt;
# [(add link here) Video Demonstration of Passing Rspec Tests]&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Contacts ===&lt;br /&gt;
We have 4 (four) members in our team and 1 (one) mentor was also assigned to us. For any project-related questions/concerns please contact us:&lt;br /&gt;
* Aurora Tiffany-Davis - attiffan@ncsu.edu&lt;br /&gt;
* Ginger Balmat - gabalmat@ncsu.edu&lt;br /&gt;
* Joe Hutchinson - jehutch3@ncsu.edu&lt;br /&gt;
* Nikolay Titov - ngtitov@ncsu.edu&lt;br /&gt;
* Zhewei Hu (mentor) - zhu6@ncsu.edu&lt;br /&gt;
&lt;br /&gt;
=== Contribution Based Inquiry ===&lt;br /&gt;
For any questions or concerns related to the project design, implementation, testing of the feature developed by our team, please contact an engineer who worked closely on the topic of your interest based on the [https://docs.google.com/spreadsheets/d/11uxuI_5gaC-FQDwIOxtCaN3HZ9bfWDJgIjFemtYV5jE/edit?ts=5ca222f3#gid=0 Contribution Assignment Grid] we created to keep track of our progress and contribution. Please carbon copy all team members and our mentor in the email.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* Expertiza Web [https://github.com/expertiza/expertiza#expertiza]&lt;br /&gt;
* Expertiza on GitHub [https://github.com/expertiza/expertiza]&lt;br /&gt;
* Expertiza Wiki [http://wikis.lib.ncsu.edu/index.php/Expertiza]&lt;br /&gt;
* Rspec Documentation [https://relishapp.com/rspec]&lt;br /&gt;
* Wiki with Previous Work [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1873_Specialized_rubics_for_different_topic_types]&lt;br /&gt;
* Pull Request of the Previous Work [https://github.com/expertiza/expertiza/pull/1327]&lt;/div&gt;</summary>
		<author><name>Ngtitov</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics&amp;diff=123586</id>
		<title>E1936 Specialized Rubrics</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics&amp;diff=123586"/>
		<updated>2019-04-08T08:56:49Z</updated>

		<summary type="html">&lt;p&gt;Ngtitov: /* Entity Relationship Diagram */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page describes the work and goals that have been completed and achieved while implementing Expertiza Project &amp;quot;E1936. Specialized Rubrics for Different Topic Types (e.g., Servo project, refactoring project)&amp;quot; for the CSC/ECE 517 &amp;quot;Object-Oriented Design and Development&amp;quot; class, in the Spring semester of the 2019.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This Wiki page is created per CSC/ECE 517: &amp;quot;Object-Oriented Design and Development&amp;quot;, Expertiza Project requirements (Spring, 2019).&lt;br /&gt;
&lt;br /&gt;
Our [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Team team] was assigned the project &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936. Specialized rubrics for different topic types (e.g., Servo project, refactoring project)]&amp;quot;.  This is an Expertiza project.&lt;br /&gt;
&lt;br /&gt;
In this wiki page we describe the problem to be solved, how we solve that problem, and how we test our solution.  We also provide helpful links and contact information for our team.&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
In this section, we discuss the problem we need to solve, the Expertiza feature this problem is related to, what needs to be done to solve the problem (at a high level), and the previous attempt to solve this problem.&lt;br /&gt;
&lt;br /&gt;
=== Problem Statement ===&lt;br /&gt;
&lt;br /&gt;
This problem statement summarizes the problem as described in the project description &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936. Specialized rubrics for different topic types (e.g., Servo project, refactoring project)]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
In CSC/ECE 517, there are several types of topics that could be covered in a single class assignment.&lt;br /&gt;
* Code base&lt;br /&gt;
** Expertiza&lt;br /&gt;
** Mozilla&lt;br /&gt;
** etc.&lt;br /&gt;
* Goal&lt;br /&gt;
** Refactoring&lt;br /&gt;
** Testing&lt;br /&gt;
** etc.&lt;br /&gt;
However, currently we can only specify one kind of rubric for an assignment.  This means that teams working on different topics will be evaluated using the same rubric.  With this setup, it's not possible to fine-tune rubrics for different topics - rubrics tend to be overly general.&lt;br /&gt;
&lt;br /&gt;
=== Feature Description ===&lt;br /&gt;
&lt;br /&gt;
The feature we will add in this project is a feature to allow rubrics to vary not only by project phase, but also by topic.  This allows more flexibility to the instructor when setting up an assignment, so that they can use rubrics better suited to the tasks that students are performing in an assignment.&lt;br /&gt;
&lt;br /&gt;
When this feature is complete, the following scenarios will be possible, and the instructor will be the judge of which scenario is the best fit to the assignment:&lt;br /&gt;
&lt;br /&gt;
* One rubric for the assignment, period.&lt;br /&gt;
* A different rubric for each phase of the assignment, regardless of what topic different students are working on.&lt;br /&gt;
* A different rubric for each topic, regardless of the phases in the assignment.&lt;br /&gt;
* A different rubric for each phase of the assignment, and within a phase, a different rubric for each topic.&lt;br /&gt;
&lt;br /&gt;
=== What Needs to be Done ===&lt;br /&gt;
&lt;br /&gt;
This section summarizes the work as described in the project description &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936. Specialized rubrics for different topic types (e.g., Servo project, refactoring project)]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* In assignment#edit page &amp;quot;Rubrics&amp;quot; tab, add a checkbox to specify whether rubric should vary by topic.&lt;br /&gt;
* In assignment#edit page &amp;quot;Topics&amp;quot; tab, add dropdown(s) next to each topic to specify which rubric(s) are associated with the topic.&lt;br /&gt;
** The dropdown(s) should appear only if rubric should vary by topic, per the Rubrics tab.&lt;br /&gt;
** The topic should have a multiple dropdowns (one for each round) only if rubrics vary by round, per the Rubrics tab.&lt;br /&gt;
** By default, the rubric(s) for each course project will be the one(s) specified in “Rubrics” tab.&lt;br /&gt;
** The dropdown value can overwrite the default rubric.&lt;br /&gt;
* Be careful when making changes to the code&lt;br /&gt;
** The signup_sheet_controller should have as little to do as possible with the selection of rubrics.&lt;br /&gt;
** Anything not germane to selecting topics should be in another controller or (more probably) a helper.&lt;br /&gt;
* Create a DB migration to allow rubric to vary by topic as well as by round.&lt;br /&gt;
&lt;br /&gt;
==== Screenshots ====&lt;br /&gt;
'''Current screenshot of Rubrics tab for an Assignment'''&lt;br /&gt;
(need to add a checkbox to indicate that rubric should vary by topic)&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Screenshot Assignment Edit Rubrics.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Current screenshot of Topics tab for an Assignment'''&lt;br /&gt;
(need to add a way to select rubrics for particular topics)&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Screenshot Assignment Edit Topics.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Proposed screenshot of Rubrics tab for an Assignment'''&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Specialized Rubric rubric checkbox.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Proposed screenshot of Topics tab for an Assignment'''&lt;br /&gt;
&lt;br /&gt;
(drop down shown for only one topic here, but final product will have one for each topic)&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Specialized Rubric dropdown menu.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Previous Work ===&lt;br /&gt;
There was previous attempt to implement this project in the Fall of 2018 semester by different team, but it was rejected due to several reasons. Our team was provided with all relevant information and materials about the design and implementation of the previously attempted project. We would like to acknowledge that we use previous implementation and design as reference and our starting point for our own implementation. The following is the list of links with the relevant materials that we have used for better project understanding, determining pros and cons of previously proposed changes, and establishing our design strategy and implementation:&lt;br /&gt;
&lt;br /&gt;
# [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1873_Specialized_rubics_for_different_topic_types Wiki]&lt;br /&gt;
# [https://github.com/expertiza/expertiza/pull/1327 Pull Request]&lt;br /&gt;
# [https://drive.google.com/file/d/1UrLb0Ula_Lb_F4MOrdC-s6xng6B08VYu/view Video Demo]&lt;br /&gt;
&lt;br /&gt;
After reviewing all relevant materials above, we concluded that the project implementation was incomplete and proposed design had significant flaw. &lt;br /&gt;
We identified main drawbacks and flaw as follows:&lt;br /&gt;
&lt;br /&gt;
* Establishing incorrect ''many-to-one'' relationship between ''sign_up_topics'' and ''questionnaires'' tables:&lt;br /&gt;
** Creating a DB migration to add ''questionnaire_id'' in the ''sign_up_topics'' table to store the dropdown data presumes ''one-to-one'' or ''many-to-one'' relationship between ''sign_up_topics'' and ''questionnaires'' tables&lt;br /&gt;
** Correct relationship between ''sign_up_topics'' and ''questionnaires'' tables is ''many-to-many''. For example, each project topic may have various rubrics depending on the round it is used (e.g., for round 1, topic may have one rubric; but for round 2, the same topic may have different rubric)&lt;br /&gt;
** Proposed previous migration changes would break DB design and would not allow to store correctly topic and its associated rubric per different round.&lt;br /&gt;
* Per project requirement specifications, &amp;quot;''The dropdown box should appear only if 'Vary rubric by topic' is selected in the Rubrics tab.''&amp;quot; This requirement was not met and ''Vary rubric by topic'' checkbox in the Rubrics tab was not implemented. Therefore, dropdown box with the list of rubrics appears regardless of whether &amp;quot;''Vary rubric by topic''&amp;quot; is selected or not.&lt;br /&gt;
* The dropdown box includes the list of all possible rubrics including default value. However, this condition can be improved. The dropdown box should list the rubrics that were created by the current user (professor who is logged in). This would allow to shorten the list of possible rubrics dramatically and help to avoid any misunderstanding and confusion while user selects desired rubric for the course project.&lt;br /&gt;
&lt;br /&gt;
We found no further issues with the rest implementation and in other project materials. Wiki page is very useful for understanding design of proposed changes, finding drawbacks and the flaw. Considering all the pros and cons, and taking into account drawbacks of the proposed changes, our team evolved different approach that should successfully solve the problem stated for the project without without creating additional issues. Please see our [http://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics#Project_Implementation Project Implementation] for more details.&lt;br /&gt;
&lt;br /&gt;
== Project Implementation ==&lt;br /&gt;
In this section, we propose our solution to the problem, discuss implementation techniques and details, and list the goals we achieved.&lt;br /&gt;
&lt;br /&gt;
We start by analyzing Entity Relationship Diagram where we state the solution to the problem. Further we discuss design strategy by breaking project problem into multiple staged sub-problems and provide solution for each of these sub-problems. We also discuss some implementation details and provide the list of involved files. Finally, we demonstrate how implemented feature can be used by providing ''How To'' sub-section.&lt;br /&gt;
&lt;br /&gt;
=== Entity Relationship Diagram ===&lt;br /&gt;
We would like to propose our solution to the problem by representing Entity Relationship Diagram and discussing how relationship between ''sign_up_topics'' and ''questionnaires'' tables can be established to associate project's topic with a rubric.&lt;br /&gt;
&lt;br /&gt;
''Note'' that in the existing implementation neither ''sign_up_topics'' nor ''questionnaires'' tables have relation with each other. Meaning ''sign_up_topics'' table has no foreign key that points to the ''questionnaires'' table, and equivalently for the ''questionnaires'' table, it has no foreign key that points to the ''sign_up_topics'' table. This problem would easily be solved if the ''sign_up_topics'' and ''questionnaires'' tables have ''many-to-one'' relationship (which seems to be an appropriate approach since each topic has exactly one rubric). In this case we would create a DB migration to add ''questionnaire_id'' in the ''sign_up_topics''. However, this solution is incorrect as we stated in the [http://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics#Previous_Work Previous Work] section.&lt;br /&gt;
&lt;br /&gt;
The problem is that each topic has exactly one rubric per specific round. The same topic may have different rubric with various rounds. Therefore, ''many-to-one'' relationship would break DB design and would limit to have only one rubric per topic for each round. Hence, the correct is ''many-to-many'' relationship between the tables.&lt;br /&gt;
&lt;br /&gt;
To solve this dilemma and properly establish ''many-to-many'' relationship between ''sign_up_topics'' nor ''questionnaires'' tables, we came to the conclusion and can state solution to the core problem of the project:&lt;br /&gt;
* Create new ''topic_questionnaire'' table with foreign keys to each of the ''sign_up_topics'' and ''questionnaires'' tables.&lt;br /&gt;
&lt;br /&gt;
By adding new such table we create ''many-to-many'' relationship between ''sign_up_topics'' nor ''questionnaires'' tables and this would allow project topic to record multiple rubrics per each round. In the following Entity Relationship Diagram, we show existing DB design (in black) and proposed DB design changes (depicted in blue):&lt;br /&gt;
&lt;br /&gt;
[[File: CSC520_Project_4_Diagram.PNG]]&lt;br /&gt;
&lt;br /&gt;
Above Entity Relationship Diagram can be interpreted as follows:&lt;br /&gt;
* ''sign_up_topics'' table is connected with ''topic_questionnaire'' table through ''many-to-many'' relationship (i.e., project's topic may have multiple topic questionnaires per each round)&lt;br /&gt;
* ''topic_questionnaire'' table is connected with ''questionnaires'' tables via ''many-to-one'' relationship (i.e., topic questionnaire belongs to exactly one questionnaire)&lt;br /&gt;
&lt;br /&gt;
To illustrate this we can use the following table that reflects new ''topic_questionnaire'' table at any point in time:&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
  &amp;lt;tr&amp;gt;&lt;br /&gt;
    &amp;lt;th&amp;gt;id&amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;th&amp;gt;topic_id&amp;lt;/th&amp;gt; &lt;br /&gt;
    &amp;lt;th&amp;gt;questionnaire_id&amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;th&amp;gt;used_in_round&amp;lt;/th&amp;gt;&lt;br /&gt;
  &amp;lt;/tr&amp;gt;&lt;br /&gt;
  &amp;lt;tr&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;/tr&amp;gt;&lt;br /&gt;
  &amp;lt;tr&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;2&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;2&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;2&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;/tr&amp;gt;&lt;br /&gt;
  &amp;lt;tr&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;3&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;3&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;3&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Above table demonstrates that the same topic with id=1 may have multiple different questionnaires (with id's=1, 2, 3) depending on the round (round 1, 2, 3 and etc).&lt;br /&gt;
&lt;br /&gt;
=== Design Strategy ===&lt;br /&gt;
As we have concrete understanding of the problem and proposed solution, we would like break this problem into multiple more manageable sub-problems with specific tasks and well-defined solutions to these tasks. Generally, each sub-problem requires modification of one or more files. We would like to propose our Design Strategy as follows:&lt;br /&gt;
* Rubrics tab with &amp;quot;''Vary rubric by topic''&amp;quot; checkbox&lt;br /&gt;
** File: ''app/views/assignments/edit/_rubrics.html.erb''&lt;br /&gt;
** PROBLEM: There is no way for the user to indicate that rubrics should vary by topic&lt;br /&gt;
** SOLUTION: Add a new checkbox in the rubric tab to indicate whether rubrics vary by topic or not&lt;br /&gt;
&lt;br /&gt;
* Preparation of the Topics tab&lt;br /&gt;
** File: ''app/views/assignments/edit.html.erb''&lt;br /&gt;
** PROBLEM: We need to add/change content to the Topics tab, but unlike other tabs in the views, it does not have its own partial view to work with&lt;br /&gt;
** SOLUTION: Refactor and move the code dealing with topics into separate ''app/views/assignments/edit/_topics.html.erb'' file&lt;br /&gt;
&lt;br /&gt;
* Topics tab with &amp;quot;''Questionnaire''&amp;quot; column and review dropdown content&lt;br /&gt;
** File: ''app/views/assignments/edit/_topics.html.erb''&lt;br /&gt;
** PROBLEM: There is no way for the user to select rubric(s) for a particular topic&lt;br /&gt;
** SOLUTION: Add a new column in the topics table for choosing rubric(s)&lt;br /&gt;
*** New column only visible if rubrics vary by topic, per Rubrics tab&lt;br /&gt;
*** New column has multiple rounds per topic only if rubrics vary by round, per Rubrics tab&lt;br /&gt;
*** Default value for any rubric is that rubric which is shown on Rubrics tab&lt;br /&gt;
*** Rubric(s) in the dropdown list is/are only those that were created by the currently logged in instructor&lt;br /&gt;
** PROBLEM: The code in ''app/views/assignments/edit/_rubrics.html.erb'' includes dropdowns like the ones we need to add for topics, but that code is way too complex for its functionality (too heavy for a view, uses JavaScript)&lt;br /&gt;
** SOLUTION: Use the code in ''app/views/assignments/edit/_rubrics.html.erb'' for inspiration and as a base line only&lt;br /&gt;
*** Refactor and move as much actual work as possible out into helper methods that are simply called from this view&lt;br /&gt;
*** Views are not intended to do heavy lifting&lt;br /&gt;
*** Use as little JavaScript as possible, since this is a Ruby On Rails project, not a JS project&lt;br /&gt;
&lt;br /&gt;
* Find questionnaire for a given assignment/round/topic&lt;br /&gt;
* File: ''app/helpers/assignment_helper.rb''&lt;br /&gt;
** PROBLEM: The ''assignment_questionnaire'' method finds a questionnaire for a given assignment/round, and would be a great place to include code to find a questionnaire for a given assignment/round/topic, however the method is not easy to work with&lt;br /&gt;
** SOLUTION: Improve readability of teh ''assignment_questionnaire'' method&lt;br /&gt;
*** Add comment block at the top describing the purpose and basic strategy of the method&lt;br /&gt;
*** Rename 'number' parameter to clarify the purpose of the parameter&lt;br /&gt;
** SOLUTION: Expand functionality of the ''assignment_questionnaire'' method&lt;br /&gt;
*** Add ability to get assignment questionnaires by topic as well as by round&lt;br /&gt;
*** Like round, topic parameter should be optional&lt;br /&gt;
&lt;br /&gt;
* Test all of the required helpers&lt;br /&gt;
* File: ''spec/helpers''&lt;br /&gt;
** PROBLEM: We are going to add code to the ''app/helpers/assignment_helper.rb'', but this helper does not have an RSpec test suite yet&lt;br /&gt;
** SOLUTION: Add ''spec/helpers/assignment_helper_spec.rb'' file&lt;br /&gt;
*** Thoroughly test ''assignment_questionnaire'' method in the ''app/helpers/assignment_helper.rb''&lt;br /&gt;
** PROBLEM: We may also need to create other helpers or helper methods as we get into the code&lt;br /&gt;
** SOLUTION: Add tests for any newly created helpers or helper methods&lt;br /&gt;
&lt;br /&gt;
* Core Problem: create relationship between ''sign_up_topics'' and ''questionnaires'' table through ''topic_questionnaires'' table&lt;br /&gt;
* File: ''db/migrate''&lt;br /&gt;
** PROBLEM: Questionnaires (of which rubrics are one type) are not linked to assignment topics&lt;br /&gt;
** SOLUTION: Create a new migration to link rubrics to topics&lt;br /&gt;
*** Create a new table named topic_questionnaire with the following fields:&lt;br /&gt;
**** ''id''&lt;br /&gt;
**** ''topic_id''&lt;br /&gt;
**** ''questionnaire_id''&lt;br /&gt;
**** ''used_in_round''&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
&lt;br /&gt;
In this section, we provide selected portions of modified code to illustrate how we implemented the new feature.&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
In this section, we list all files that were modified while implementing the new feature.&lt;br /&gt;
&lt;br /&gt;
* [to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
=== How To ===&lt;br /&gt;
&lt;br /&gt;
In this section, we describe how to use the newly implemented feature.&lt;br /&gt;
&lt;br /&gt;
==== Add a New Rubric ====&lt;br /&gt;
&lt;br /&gt;
* [to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
==== Select a Rubric for a Topic ====&lt;br /&gt;
&lt;br /&gt;
* [to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
== Project Testing ==&lt;br /&gt;
To test code implementation, correctness of the added feature, verify that the team did not break any existing functionalities in the Expertiza, and ensure that no bugs were introduced in the code, we utilized the following Test Strategy:&lt;br /&gt;
# Code inspection&lt;br /&gt;
# Run and pass existing RSpec Tests&lt;br /&gt;
# Develop New RSpec Tests&lt;br /&gt;
# Run through live UI to test a feature using Expertiza instance&lt;br /&gt;
&lt;br /&gt;
=== Rspec Testing ===&lt;br /&gt;
&lt;br /&gt;
Our strategy for gaining confidence that our code changes did not break anything was as follows:&lt;br /&gt;
* Run all existing RSpec tests on any changed files, after our changes, to ensure that we have not introduced any failures.&lt;br /&gt;
* The commands and results are shown below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  [to be populated after coding is complete]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Write new comprehensive RSpec tests, for all new methods.&lt;br /&gt;
* Run these tests, to ensure that the new code works as intended.&lt;br /&gt;
* The commands and results are shown below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  [to be populated after coding is complete]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The test suite for a single new method is below.&lt;br /&gt;
* There are many such suites in (TODO add filename(s)).  &lt;br /&gt;
* This example illustrates our general strategy:&lt;br /&gt;
** test missing input&lt;br /&gt;
** test bad input&lt;br /&gt;
** test various acceptable forms of input&lt;br /&gt;
** test scenarios that lead to &amp;quot;true&amp;quot; and to &amp;quot;false&amp;quot; return values&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  [to be populated after coding is complete]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== UI Testing ===&lt;br /&gt;
Here we describe UI Testing that has performed. Include Screenshots maybe?&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
== Useful Links ==&lt;br /&gt;
In this section we provide useful links related to the work that has been completed by our team.&lt;br /&gt;
# [https://github.com/gabalmat/expertiza Forked Project Repository]&lt;br /&gt;
# [(add link here) Pull Request]&lt;br /&gt;
# [(add link here) Video Demonstration of Specialized Rubrics]&lt;br /&gt;
# [(add link here) Video Demonstration of Passing Rspec Tests]&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Contacts ===&lt;br /&gt;
We have 4 (four) members in our team and 1 (one) mentor was also assigned to us. For any project-related questions/concerns please contact us:&lt;br /&gt;
* Aurora Tiffany-Davis - attiffan@ncsu.edu&lt;br /&gt;
* Ginger Balmat - gabalmat@ncsu.edu&lt;br /&gt;
* Joe Hutchinson - jehutch3@ncsu.edu&lt;br /&gt;
* Nikolay Titov - ngtitov@ncsu.edu&lt;br /&gt;
* Zhewei Hu (mentor) - zhu6@ncsu.edu&lt;br /&gt;
&lt;br /&gt;
=== Contribution Based Inquiry ===&lt;br /&gt;
For any questions or concerns related to the project design, implementation, testing of the feature developed by our team, please contact an engineer who worked closely on the topic of your interest based on the [https://docs.google.com/spreadsheets/d/11uxuI_5gaC-FQDwIOxtCaN3HZ9bfWDJgIjFemtYV5jE/edit?ts=5ca222f3#gid=0 Contribution Assignment Grid] we created to keep track of our progress and contribution. Please carbon copy all team members and our mentor in the email.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* Expertiza Web [https://github.com/expertiza/expertiza#expertiza]&lt;br /&gt;
* Expertiza on GitHub [https://github.com/expertiza/expertiza]&lt;br /&gt;
* Expertiza Wiki [http://wikis.lib.ncsu.edu/index.php/Expertiza]&lt;br /&gt;
* Rspec Documentation [https://relishapp.com/rspec]&lt;br /&gt;
* Wiki with Previous Work [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1873_Specialized_rubics_for_different_topic_types]&lt;br /&gt;
* Pull Request of the Previous Work [https://github.com/expertiza/expertiza/pull/1327]&lt;/div&gt;</summary>
		<author><name>Ngtitov</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics&amp;diff=123585</id>
		<title>E1936 Specialized Rubrics</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics&amp;diff=123585"/>
		<updated>2019-04-08T08:51:40Z</updated>

		<summary type="html">&lt;p&gt;Ngtitov: /* Previous Work */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page describes the work and goals that have been completed and achieved while implementing Expertiza Project &amp;quot;E1936. Specialized Rubrics for Different Topic Types (e.g., Servo project, refactoring project)&amp;quot; for the CSC/ECE 517 &amp;quot;Object-Oriented Design and Development&amp;quot; class, in the Spring semester of the 2019.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This Wiki page is created per CSC/ECE 517: &amp;quot;Object-Oriented Design and Development&amp;quot;, Expertiza Project requirements (Spring, 2019).&lt;br /&gt;
&lt;br /&gt;
Our [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Team team] was assigned the project &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936. Specialized rubrics for different topic types (e.g., Servo project, refactoring project)]&amp;quot;.  This is an Expertiza project.&lt;br /&gt;
&lt;br /&gt;
In this wiki page we describe the problem to be solved, how we solve that problem, and how we test our solution.  We also provide helpful links and contact information for our team.&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
In this section, we discuss the problem we need to solve, the Expertiza feature this problem is related to, what needs to be done to solve the problem (at a high level), and the previous attempt to solve this problem.&lt;br /&gt;
&lt;br /&gt;
=== Problem Statement ===&lt;br /&gt;
&lt;br /&gt;
This problem statement summarizes the problem as described in the project description &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936. Specialized rubrics for different topic types (e.g., Servo project, refactoring project)]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
In CSC/ECE 517, there are several types of topics that could be covered in a single class assignment.&lt;br /&gt;
* Code base&lt;br /&gt;
** Expertiza&lt;br /&gt;
** Mozilla&lt;br /&gt;
** etc.&lt;br /&gt;
* Goal&lt;br /&gt;
** Refactoring&lt;br /&gt;
** Testing&lt;br /&gt;
** etc.&lt;br /&gt;
However, currently we can only specify one kind of rubric for an assignment.  This means that teams working on different topics will be evaluated using the same rubric.  With this setup, it's not possible to fine-tune rubrics for different topics - rubrics tend to be overly general.&lt;br /&gt;
&lt;br /&gt;
=== Feature Description ===&lt;br /&gt;
&lt;br /&gt;
The feature we will add in this project is a feature to allow rubrics to vary not only by project phase, but also by topic.  This allows more flexibility to the instructor when setting up an assignment, so that they can use rubrics better suited to the tasks that students are performing in an assignment.&lt;br /&gt;
&lt;br /&gt;
When this feature is complete, the following scenarios will be possible, and the instructor will be the judge of which scenario is the best fit to the assignment:&lt;br /&gt;
&lt;br /&gt;
* One rubric for the assignment, period.&lt;br /&gt;
* A different rubric for each phase of the assignment, regardless of what topic different students are working on.&lt;br /&gt;
* A different rubric for each topic, regardless of the phases in the assignment.&lt;br /&gt;
* A different rubric for each phase of the assignment, and within a phase, a different rubric for each topic.&lt;br /&gt;
&lt;br /&gt;
=== What Needs to be Done ===&lt;br /&gt;
&lt;br /&gt;
This section summarizes the work as described in the project description &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936. Specialized rubrics for different topic types (e.g., Servo project, refactoring project)]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* In assignment#edit page &amp;quot;Rubrics&amp;quot; tab, add a checkbox to specify whether rubric should vary by topic.&lt;br /&gt;
* In assignment#edit page &amp;quot;Topics&amp;quot; tab, add dropdown(s) next to each topic to specify which rubric(s) are associated with the topic.&lt;br /&gt;
** The dropdown(s) should appear only if rubric should vary by topic, per the Rubrics tab.&lt;br /&gt;
** The topic should have a multiple dropdowns (one for each round) only if rubrics vary by round, per the Rubrics tab.&lt;br /&gt;
** By default, the rubric(s) for each course project will be the one(s) specified in “Rubrics” tab.&lt;br /&gt;
** The dropdown value can overwrite the default rubric.&lt;br /&gt;
* Be careful when making changes to the code&lt;br /&gt;
** The signup_sheet_controller should have as little to do as possible with the selection of rubrics.&lt;br /&gt;
** Anything not germane to selecting topics should be in another controller or (more probably) a helper.&lt;br /&gt;
* Create a DB migration to allow rubric to vary by topic as well as by round.&lt;br /&gt;
&lt;br /&gt;
==== Screenshots ====&lt;br /&gt;
'''Current screenshot of Rubrics tab for an Assignment'''&lt;br /&gt;
(need to add a checkbox to indicate that rubric should vary by topic)&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Screenshot Assignment Edit Rubrics.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Current screenshot of Topics tab for an Assignment'''&lt;br /&gt;
(need to add a way to select rubrics for particular topics)&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Screenshot Assignment Edit Topics.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Proposed screenshot of Rubrics tab for an Assignment'''&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Specialized Rubric rubric checkbox.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Proposed screenshot of Topics tab for an Assignment'''&lt;br /&gt;
&lt;br /&gt;
(drop down shown for only one topic here, but final product will have one for each topic)&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Specialized Rubric dropdown menu.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Previous Work ===&lt;br /&gt;
There was previous attempt to implement this project in the Fall of 2018 semester by different team, but it was rejected due to several reasons. Our team was provided with all relevant information and materials about the design and implementation of the previously attempted project. We would like to acknowledge that we use previous implementation and design as reference and our starting point for our own implementation. The following is the list of links with the relevant materials that we have used for better project understanding, determining pros and cons of previously proposed changes, and establishing our design strategy and implementation:&lt;br /&gt;
&lt;br /&gt;
# [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1873_Specialized_rubics_for_different_topic_types Wiki]&lt;br /&gt;
# [https://github.com/expertiza/expertiza/pull/1327 Pull Request]&lt;br /&gt;
# [https://drive.google.com/file/d/1UrLb0Ula_Lb_F4MOrdC-s6xng6B08VYu/view Video Demo]&lt;br /&gt;
&lt;br /&gt;
After reviewing all relevant materials above, we concluded that the project implementation was incomplete and proposed design had significant flaw. &lt;br /&gt;
We identified main drawbacks and flaw as follows:&lt;br /&gt;
&lt;br /&gt;
* Establishing incorrect ''many-to-one'' relationship between ''sign_up_topics'' and ''questionnaires'' tables:&lt;br /&gt;
** Creating a DB migration to add ''questionnaire_id'' in the ''sign_up_topics'' table to store the dropdown data presumes ''one-to-one'' or ''many-to-one'' relationship between ''sign_up_topics'' and ''questionnaires'' tables&lt;br /&gt;
** Correct relationship between ''sign_up_topics'' and ''questionnaires'' tables is ''many-to-many''. For example, each project topic may have various rubrics depending on the round it is used (e.g., for round 1, topic may have one rubric; but for round 2, the same topic may have different rubric)&lt;br /&gt;
** Proposed previous migration changes would break DB design and would not allow to store correctly topic and its associated rubric per different round.&lt;br /&gt;
* Per project requirement specifications, &amp;quot;''The dropdown box should appear only if 'Vary rubric by topic' is selected in the Rubrics tab.''&amp;quot; This requirement was not met and ''Vary rubric by topic'' checkbox in the Rubrics tab was not implemented. Therefore, dropdown box with the list of rubrics appears regardless of whether &amp;quot;''Vary rubric by topic''&amp;quot; is selected or not.&lt;br /&gt;
* The dropdown box includes the list of all possible rubrics including default value. However, this condition can be improved. The dropdown box should list the rubrics that were created by the current user (professor who is logged in). This would allow to shorten the list of possible rubrics dramatically and help to avoid any misunderstanding and confusion while user selects desired rubric for the course project.&lt;br /&gt;
&lt;br /&gt;
We found no further issues with the rest implementation and in other project materials. Wiki page is very useful for understanding design of proposed changes, finding drawbacks and the flaw. Considering all the pros and cons, and taking into account drawbacks of the proposed changes, our team evolved different approach that should successfully solve the problem stated for the project without without creating additional issues. Please see our [http://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics#Project_Implementation Project Implementation] for more details.&lt;br /&gt;
&lt;br /&gt;
== Project Implementation ==&lt;br /&gt;
In this section, we propose our solution to the problem, discuss implementation techniques and details, and list the goals we achieved.&lt;br /&gt;
&lt;br /&gt;
We start by analyzing Entity Relationship Diagram where we state the solution to the problem. Further we discuss design strategy by breaking project problem into multiple staged sub-problems and provide solution for each of these sub-problems. We also discuss some implementation details and provide the list of involved files. Finally, we demonstrate how implemented feature can be used by providing ''How To'' sub-section.&lt;br /&gt;
&lt;br /&gt;
=== Entity Relationship Diagram ===&lt;br /&gt;
We would like to propose our solution to the problem by representing Entity Relationship Diagram and discussing how relationship between ''sign_up_topics'' and ''questionnaires'' tables can be established to associate project's topic with a rubric.&lt;br /&gt;
&lt;br /&gt;
''Note'' that in the existing implementation neither ''sign_up_topics'' nor ''questionnaires'' tables have relation with each other. Meaning ''sign_up_topics'' table has no foreign key that points to the ''questionnaires'' table, and equivalently for the ''questionnaires'' table, it has no foreign key that points to the ''sign_up_topics'' table. This problem would easily be solved if the ''sign_up_topics'' and ''questionnaires'' tables have ''many-to-one'' relationship (which seems to be an appropriate approach since each topic has exactly one rubric). In this case we would create a DB migration to add ''questionnaire_id'' in the ''sign_up_topics''. However, this solution is incorrect as we stated in the [http://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics#Previous_Work Previous Work] section.&lt;br /&gt;
&lt;br /&gt;
The problem is that each topic has exactly one rubric per specific round. The same topic may have different rubric with various rounds. Therefore, ''many-to-one'' relationship would break DB design and would limit to have only one rubric per topic for each round. Hence, the correct is ''many-to-many'' relationship between the tables.&lt;br /&gt;
&lt;br /&gt;
To solve this dilemma and properly establish ''many-to-many'' relationship between ''sign_up_topics'' nor ''questionnaires'' tables, we came to the conclusion and can state solution to the core problem of the project:&lt;br /&gt;
* Create new ''topic_questionnaire'' table with foreign keys to each of the ''sign_up_topics'' and ''questionnaires'' tables.&lt;br /&gt;
&lt;br /&gt;
By adding new such table we create ''many-to-many'' relationship between ''sign_up_topics'' nor ''questionnaires'' tables and this would allow project topic to record multiple rubrics per each round. In the following Entity Relationship Diagram we show existing DB design and proposed changes in blue:&lt;br /&gt;
&lt;br /&gt;
[[File: CSC520_Project_4_Diagram.PNG]]&lt;br /&gt;
&lt;br /&gt;
Above Entity Relationship Diagram can be interpreted as follows:&lt;br /&gt;
* ''sign_up_topics'' table is connected with ''topic_questionnaire'' table through ''many-to-many'' relationship (i.e., project's topic may have multiple topic questionnaires per each round)&lt;br /&gt;
* ''topic_questionnaire'' table is connected with ''questionnaires'' tables via ''many-to-one'' relationship (i.e., topic questionnaire belongs to exactly one questionnaire)&lt;br /&gt;
&lt;br /&gt;
To illustrate this we can use the following table that reflects new ''topic_questionnaire'' table at any point in time:&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
  &amp;lt;tr&amp;gt;&lt;br /&gt;
    &amp;lt;th&amp;gt;id&amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;th&amp;gt;topic_id&amp;lt;/th&amp;gt; &lt;br /&gt;
    &amp;lt;th&amp;gt;questionnaire_id&amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;th&amp;gt;used_in_round&amp;lt;/th&amp;gt;&lt;br /&gt;
  &amp;lt;/tr&amp;gt;&lt;br /&gt;
  &amp;lt;tr&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;/tr&amp;gt;&lt;br /&gt;
  &amp;lt;tr&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;2&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;2&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;2&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;/tr&amp;gt;&lt;br /&gt;
  &amp;lt;tr&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;3&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;3&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;3&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Above table demonstrates that the same topic with id=1 may have multiple different questionnaires (with id's=1, 2, 3) depending on the round (round 1, 2, 3 and etc).&lt;br /&gt;
&lt;br /&gt;
=== Design Strategy ===&lt;br /&gt;
As we have concrete understanding of the problem and proposed solution, we would like break this problem into multiple more manageable sub-problems with specific tasks and well-defined solutions to these tasks. Generally, each sub-problem requires modification of one or more files. We would like to propose our Design Strategy as follows:&lt;br /&gt;
* Rubrics tab with &amp;quot;''Vary rubric by topic''&amp;quot; checkbox&lt;br /&gt;
** File: ''app/views/assignments/edit/_rubrics.html.erb''&lt;br /&gt;
** PROBLEM: There is no way for the user to indicate that rubrics should vary by topic&lt;br /&gt;
** SOLUTION: Add a new checkbox in the rubric tab to indicate whether rubrics vary by topic or not&lt;br /&gt;
&lt;br /&gt;
* Preparation of the Topics tab&lt;br /&gt;
** File: ''app/views/assignments/edit.html.erb''&lt;br /&gt;
** PROBLEM: We need to add/change content to the Topics tab, but unlike other tabs in the views, it does not have its own partial view to work with&lt;br /&gt;
** SOLUTION: Refactor and move the code dealing with topics into separate ''app/views/assignments/edit/_topics.html.erb'' file&lt;br /&gt;
&lt;br /&gt;
* Topics tab with &amp;quot;''Questionnaire''&amp;quot; column and review dropdown content&lt;br /&gt;
** File: ''app/views/assignments/edit/_topics.html.erb''&lt;br /&gt;
** PROBLEM: There is no way for the user to select rubric(s) for a particular topic&lt;br /&gt;
** SOLUTION: Add a new column in the topics table for choosing rubric(s)&lt;br /&gt;
*** New column only visible if rubrics vary by topic, per Rubrics tab&lt;br /&gt;
*** New column has multiple rounds per topic only if rubrics vary by round, per Rubrics tab&lt;br /&gt;
*** Default value for any rubric is that rubric which is shown on Rubrics tab&lt;br /&gt;
*** Rubric(s) in the dropdown list is/are only those that were created by the currently logged in instructor&lt;br /&gt;
** PROBLEM: The code in ''app/views/assignments/edit/_rubrics.html.erb'' includes dropdowns like the ones we need to add for topics, but that code is way too complex for its functionality (too heavy for a view, uses JavaScript)&lt;br /&gt;
** SOLUTION: Use the code in ''app/views/assignments/edit/_rubrics.html.erb'' for inspiration and as a base line only&lt;br /&gt;
*** Refactor and move as much actual work as possible out into helper methods that are simply called from this view&lt;br /&gt;
*** Views are not intended to do heavy lifting&lt;br /&gt;
*** Use as little JavaScript as possible, since this is a Ruby On Rails project, not a JS project&lt;br /&gt;
&lt;br /&gt;
* Find questionnaire for a given assignment/round/topic&lt;br /&gt;
* File: ''app/helpers/assignment_helper.rb''&lt;br /&gt;
** PROBLEM: The ''assignment_questionnaire'' method finds a questionnaire for a given assignment/round, and would be a great place to include code to find a questionnaire for a given assignment/round/topic, however the method is not easy to work with&lt;br /&gt;
** SOLUTION: Improve readability of teh ''assignment_questionnaire'' method&lt;br /&gt;
*** Add comment block at the top describing the purpose and basic strategy of the method&lt;br /&gt;
*** Rename 'number' parameter to clarify the purpose of the parameter&lt;br /&gt;
** SOLUTION: Expand functionality of the ''assignment_questionnaire'' method&lt;br /&gt;
*** Add ability to get assignment questionnaires by topic as well as by round&lt;br /&gt;
*** Like round, topic parameter should be optional&lt;br /&gt;
&lt;br /&gt;
* Test all of the required helpers&lt;br /&gt;
* File: ''spec/helpers''&lt;br /&gt;
** PROBLEM: We are going to add code to the ''app/helpers/assignment_helper.rb'', but this helper does not have an RSpec test suite yet&lt;br /&gt;
** SOLUTION: Add ''spec/helpers/assignment_helper_spec.rb'' file&lt;br /&gt;
*** Thoroughly test ''assignment_questionnaire'' method in the ''app/helpers/assignment_helper.rb''&lt;br /&gt;
** PROBLEM: We may also need to create other helpers or helper methods as we get into the code&lt;br /&gt;
** SOLUTION: Add tests for any newly created helpers or helper methods&lt;br /&gt;
&lt;br /&gt;
* Core Problem: create relationship between ''sign_up_topics'' and ''questionnaires'' table through ''topic_questionnaires'' table&lt;br /&gt;
* File: ''db/migrate''&lt;br /&gt;
** PROBLEM: Questionnaires (of which rubrics are one type) are not linked to assignment topics&lt;br /&gt;
** SOLUTION: Create a new migration to link rubrics to topics&lt;br /&gt;
*** Create a new table named topic_questionnaire with the following fields:&lt;br /&gt;
**** ''id''&lt;br /&gt;
**** ''topic_id''&lt;br /&gt;
**** ''questionnaire_id''&lt;br /&gt;
**** ''used_in_round''&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
&lt;br /&gt;
In this section, we provide selected portions of modified code to illustrate how we implemented the new feature.&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
In this section, we list all files that were modified while implementing the new feature.&lt;br /&gt;
&lt;br /&gt;
* [to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
=== How To ===&lt;br /&gt;
&lt;br /&gt;
In this section, we describe how to use the newly implemented feature.&lt;br /&gt;
&lt;br /&gt;
==== Add a New Rubric ====&lt;br /&gt;
&lt;br /&gt;
* [to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
==== Select a Rubric for a Topic ====&lt;br /&gt;
&lt;br /&gt;
* [to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
== Project Testing ==&lt;br /&gt;
To test code implementation, correctness of the added feature, verify that the team did not break any existing functionalities in the Expertiza, and ensure that no bugs were introduced in the code, we utilized the following Test Strategy:&lt;br /&gt;
# Code inspection&lt;br /&gt;
# Run and pass existing RSpec Tests&lt;br /&gt;
# Develop New RSpec Tests&lt;br /&gt;
# Run through live UI to test a feature using Expertiza instance&lt;br /&gt;
&lt;br /&gt;
=== Rspec Testing ===&lt;br /&gt;
&lt;br /&gt;
Our strategy for gaining confidence that our code changes did not break anything was as follows:&lt;br /&gt;
* Run all existing RSpec tests on any changed files, after our changes, to ensure that we have not introduced any failures.&lt;br /&gt;
* The commands and results are shown below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  [to be populated after coding is complete]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Write new comprehensive RSpec tests, for all new methods.&lt;br /&gt;
* Run these tests, to ensure that the new code works as intended.&lt;br /&gt;
* The commands and results are shown below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  [to be populated after coding is complete]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The test suite for a single new method is below.&lt;br /&gt;
* There are many such suites in (TODO add filename(s)).  &lt;br /&gt;
* This example illustrates our general strategy:&lt;br /&gt;
** test missing input&lt;br /&gt;
** test bad input&lt;br /&gt;
** test various acceptable forms of input&lt;br /&gt;
** test scenarios that lead to &amp;quot;true&amp;quot; and to &amp;quot;false&amp;quot; return values&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  [to be populated after coding is complete]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== UI Testing ===&lt;br /&gt;
Here we describe UI Testing that has performed. Include Screenshots maybe?&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
== Useful Links ==&lt;br /&gt;
In this section we provide useful links related to the work that has been completed by our team.&lt;br /&gt;
# [https://github.com/gabalmat/expertiza Forked Project Repository]&lt;br /&gt;
# [(add link here) Pull Request]&lt;br /&gt;
# [(add link here) Video Demonstration of Specialized Rubrics]&lt;br /&gt;
# [(add link here) Video Demonstration of Passing Rspec Tests]&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Contacts ===&lt;br /&gt;
We have 4 (four) members in our team and 1 (one) mentor was also assigned to us. For any project-related questions/concerns please contact us:&lt;br /&gt;
* Aurora Tiffany-Davis - attiffan@ncsu.edu&lt;br /&gt;
* Ginger Balmat - gabalmat@ncsu.edu&lt;br /&gt;
* Joe Hutchinson - jehutch3@ncsu.edu&lt;br /&gt;
* Nikolay Titov - ngtitov@ncsu.edu&lt;br /&gt;
* Zhewei Hu (mentor) - zhu6@ncsu.edu&lt;br /&gt;
&lt;br /&gt;
=== Contribution Based Inquiry ===&lt;br /&gt;
For any questions or concerns related to the project design, implementation, testing of the feature developed by our team, please contact an engineer who worked closely on the topic of your interest based on the [https://docs.google.com/spreadsheets/d/11uxuI_5gaC-FQDwIOxtCaN3HZ9bfWDJgIjFemtYV5jE/edit?ts=5ca222f3#gid=0 Contribution Assignment Grid] we created to keep track of our progress and contribution. Please carbon copy all team members and our mentor in the email.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* Expertiza Web [https://github.com/expertiza/expertiza#expertiza]&lt;br /&gt;
* Expertiza on GitHub [https://github.com/expertiza/expertiza]&lt;br /&gt;
* Expertiza Wiki [http://wikis.lib.ncsu.edu/index.php/Expertiza]&lt;br /&gt;
* Rspec Documentation [https://relishapp.com/rspec]&lt;br /&gt;
* Wiki with Previous Work [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1873_Specialized_rubics_for_different_topic_types]&lt;br /&gt;
* Pull Request of the Previous Work [https://github.com/expertiza/expertiza/pull/1327]&lt;/div&gt;</summary>
		<author><name>Ngtitov</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics&amp;diff=123577</id>
		<title>E1936 Specialized Rubrics</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics&amp;diff=123577"/>
		<updated>2019-04-08T08:18:38Z</updated>

		<summary type="html">&lt;p&gt;Ngtitov: /* Design Strategy */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page describes the work and goals that have been completed and achieved while implementing Expertiza Project &amp;quot;E1936. Specialized Rubrics for Different Topic Types (e.g., Servo project, refactoring project)&amp;quot; for the CSC/ECE 517 &amp;quot;Object-Oriented Design and Development&amp;quot; class, in the Spring semester of the 2019.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This Wiki page is created per CSC/ECE 517: &amp;quot;Object-Oriented Design and Development&amp;quot;, Expertiza Project requirements (Spring, 2019).&lt;br /&gt;
&lt;br /&gt;
Our [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Team team] was assigned the project &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936. Specialized rubrics for different topic types (e.g., Servo project, refactoring project)]&amp;quot;.  This is an Expertiza project.&lt;br /&gt;
&lt;br /&gt;
In this wiki page we describe the problem to be solved, how we solve that problem, and how we test our solution.  We also provide helpful links and contact information for our team.&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
In this section, we discuss the problem we need to solve, the Expertiza feature this problem is related to, what needs to be done to solve the problem (at a high level), and the previous attempt to solve this problem.&lt;br /&gt;
&lt;br /&gt;
=== Problem Statement ===&lt;br /&gt;
&lt;br /&gt;
This problem statement summarizes the problem as described in the project description &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936. Specialized rubrics for different topic types (e.g., Servo project, refactoring project)]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
In CSC/ECE 517, there are several types of topics that could be covered in a single class assignment.&lt;br /&gt;
* Code base&lt;br /&gt;
** Expertiza&lt;br /&gt;
** Mozilla&lt;br /&gt;
** etc.&lt;br /&gt;
* Goal&lt;br /&gt;
** Refactoring&lt;br /&gt;
** Testing&lt;br /&gt;
** etc.&lt;br /&gt;
However, currently we can only specify one kind of rubric for an assignment.  This means that teams working on different topics will be evaluated using the same rubric.  With this setup, it's not possible to fine-tune rubrics for different topics - rubrics tend to be overly general.&lt;br /&gt;
&lt;br /&gt;
=== Feature Description ===&lt;br /&gt;
&lt;br /&gt;
The feature we will add in this project is a feature to allow rubrics to vary not only by project phase, but also by topic.  This allows more flexibility to the instructor when setting up an assignment, so that they can use rubrics better suited to the tasks that students are performing in an assignment.&lt;br /&gt;
&lt;br /&gt;
When this feature is complete, the following scenarios will be possible, and the instructor will be the judge of which scenario is the best fit to the assignment:&lt;br /&gt;
&lt;br /&gt;
* One rubric for the assignment, period.&lt;br /&gt;
* A different rubric for each phase of the assignment, regardless of what topic different students are working on.&lt;br /&gt;
* A different rubric for each topic, regardless of the phases in the assignment.&lt;br /&gt;
* A different rubric for each phase of the assignment, and within a phase, a different rubric for each topic.&lt;br /&gt;
&lt;br /&gt;
=== What Needs to be Done ===&lt;br /&gt;
&lt;br /&gt;
This section summarizes the work as described in the project description &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936. Specialized rubrics for different topic types (e.g., Servo project, refactoring project)]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* In assignment#edit page &amp;quot;Rubrics&amp;quot; tab, add a checkbox to specify whether rubric should vary by topic.&lt;br /&gt;
* In assignment#edit page &amp;quot;Topics&amp;quot; tab, add dropdown(s) next to each topic to specify which rubric(s) are associated with the topic.&lt;br /&gt;
** The dropdown(s) should appear only if rubric should vary by topic, per the Rubrics tab.&lt;br /&gt;
** The topic should have a multiple dropdowns (one for each round) only if rubrics vary by round, per the Rubrics tab.&lt;br /&gt;
** By default, the rubric(s) for each course project will be the one(s) specified in “Rubrics” tab.&lt;br /&gt;
** The dropdown value can overwrite the default rubric.&lt;br /&gt;
* Be careful when making changes to the code&lt;br /&gt;
** The signup_sheet_controller should have as little to do as possible with the selection of rubrics.&lt;br /&gt;
** Anything not germane to selecting topics should be in another controller or (more probably) a helper.&lt;br /&gt;
* Create a DB migration to allow rubric to vary by topic as well as by round.&lt;br /&gt;
&lt;br /&gt;
==== Screenshots ====&lt;br /&gt;
'''Current screenshot of Rubrics tab for an Assignment'''&lt;br /&gt;
(need to add a checkbox to indicate that rubric should vary by topic)&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Screenshot Assignment Edit Rubrics.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Current screenshot of Topics tab for an Assignment'''&lt;br /&gt;
(need to add a way to select rubrics for particular topics)&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Screenshot Assignment Edit Topics.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Proposed screenshot of Rubrics tab for an Assignment'''&lt;br /&gt;
(changes highlighted in red box)&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Specialized Rubric rubric checkbox.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Proposed screenshot of Topics tab for an Assignment'''&lt;br /&gt;
(changes highlighted in red box)&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Specialized Rubric dropdown menu.png]]&lt;br /&gt;
&lt;br /&gt;
=== Previous Work ===&lt;br /&gt;
There was previous attempt to implement this project in the Fall of 2018 semester by different team, but it was rejected due to several reasons. Our team was provided with all relevant information about the design and implementation of the previously attempted project. The following is the list of links with the relevant materials that we have used for better project understanding, determining pros and cons of proposed changes, and identifying any improvements:&lt;br /&gt;
&lt;br /&gt;
# [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1873_Specialized_rubics_for_different_topic_types Wiki]&lt;br /&gt;
# [https://github.com/expertiza/expertiza/pull/1327 Pull Request]&lt;br /&gt;
# [https://drive.google.com/file/d/1UrLb0Ula_Lb_F4MOrdC-s6xng6B08VYu/view Video Demo]&lt;br /&gt;
&lt;br /&gt;
After reviewing all relevant materials, we concluded that implementation of the project was incomplete and we found two main drawbacks that can be improved:&lt;br /&gt;
&lt;br /&gt;
* Per project requirement specifications, &amp;quot;''The dropdown box should appear only if 'Vary rubric by topic' is selected in the Rubrics tab.''&amp;quot; This requirement was not met and ''Vary rubric by topic'' checkbox in the Rubrics tab was not implemented at all. Therefore, dropdown box with the list of rubrics appears regardless of whether &amp;quot;''Vary rubric by topic''&amp;quot; is selected or not.&lt;br /&gt;
* The dropdown box includes the list of all possible rubrics including default value. However, this condition can be improved. The dropdown box should list the rubrics that were created by the current user (professor who is logged in). This would allow to shorten the list of possible rubrics dramatically and help to avoid any misunderstanding and confusion while user selects desired rubric for the course project.&lt;br /&gt;
&lt;br /&gt;
We found no further issues with the rest implementation and other project materials. Wiki page is very useful for understading design of proposed changes. However, our team decided to use slightly different approach than adding ''questionnaire_id'' in the ''sign_up_topics'' table to specify project's topic and its associated rubrics. Please see our [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Design_Strategy Design Strategy] for our proposed changes.&lt;br /&gt;
&lt;br /&gt;
== Project Implementation ==&lt;br /&gt;
In this section, we propose our solution to the problem, discuss implementation techniques and details, and list the goals we achieved.&lt;br /&gt;
&lt;br /&gt;
We start by analyzing Entity Relationship Diagram where we state the solution to the problem. Further we discuss design strategy by breaking project problem into multiple staged sub-problems and provide solution for each of these sub-problems. We also discuss some implementation details and provide the list of involved files. Finally, we demonstrate how implemented feature can be used by providing ''How To'' sub-section.&lt;br /&gt;
&lt;br /&gt;
=== Entity Relationship Diagram ===&lt;br /&gt;
We would like to propose our solution to the problem by representing Entity Relationship Diagram and discussing how relationship between ''sign_up_topics'' and ''questionnaires'' tables can be established to associate project's topic with a rubric.&lt;br /&gt;
&lt;br /&gt;
''Note'' that in the existing implementation neither ''sign_up_topics'' nor ''questionnaires'' tables have relation with each other. Meaning ''sign_up_topics'' table has no foreign key that points to the ''questionnaires'' table, and equivalently for the ''questionnaires'' table, it has no foreign key that points to the ''sign_up_topics'' table. This problem would easily be solved if the ''sign_up_topics'' and ''questionnaires'' tables have ''many-to-one'' relationship (which seems to be an appropriate approach since each topic has exactly one rubric). In this case we would create a DB migration to add ''questionnaire_id'' in the ''sign_up_topics''. However, this solution is incorrect as we stated in the [http://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics#Previous_Work Previous Work] section.&lt;br /&gt;
&lt;br /&gt;
The problem is that each topic has exactly one rubric per specific round. The same topic may have different rubric with various rounds. Therefore, ''many-to-one'' relationship would break DB design and would limit to have only one rubric per topic for each round. Hence, the correct is ''many-to-many'' relationship between the tables.&lt;br /&gt;
&lt;br /&gt;
To solve this dilemma and properly establish ''many-to-many'' relationship between ''sign_up_topics'' nor ''questionnaires'' tables, we came to the conclusion and can state solution to the core problem of the project:&lt;br /&gt;
* Create new ''topic_questionnaire'' table with foreign keys to each of the ''sign_up_topics'' and ''questionnaires'' tables.&lt;br /&gt;
&lt;br /&gt;
By adding new such table we create ''many-to-many'' relationship between ''sign_up_topics'' nor ''questionnaires'' tables and this would allow project topic to record multiple rubrics per each round. In the following Entity Relationship Diagram we show existing DB design and proposed changes in blue:&lt;br /&gt;
&lt;br /&gt;
[[File: CSC520_Project_4_Diagram.PNG]]&lt;br /&gt;
&lt;br /&gt;
Above Entity Relationship Diagram can be interpreted as follows:&lt;br /&gt;
* ''sign_up_topics'' table is connected with ''topic_questionnaire'' table through ''many-to-many'' relationship (i.e., project's topic may have multiple topic questionnaires per each round)&lt;br /&gt;
* ''topic_questionnaire'' table is connected with ''questionnaires'' tables via ''many-to-one'' relationship (i.e., topic questionnaire belongs to exactly one questionnaire)&lt;br /&gt;
&lt;br /&gt;
To illustrate this we can use the following table that reflects new ''topic_questionnaire'' table at any point in time:&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
  &amp;lt;tr&amp;gt;&lt;br /&gt;
    &amp;lt;th&amp;gt;id&amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;th&amp;gt;topic_id&amp;lt;/th&amp;gt; &lt;br /&gt;
    &amp;lt;th&amp;gt;questionnaire_id&amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;th&amp;gt;used_in_round&amp;lt;/th&amp;gt;&lt;br /&gt;
  &amp;lt;/tr&amp;gt;&lt;br /&gt;
  &amp;lt;tr&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;/tr&amp;gt;&lt;br /&gt;
  &amp;lt;tr&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;2&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;2&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;2&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;/tr&amp;gt;&lt;br /&gt;
  &amp;lt;tr&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;3&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;3&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;3&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Above table demonstrates that the same topic with id=1 may have multiple different questionnaires (with id's=1, 2, 3) depending on the round (round 1, 2, 3 and etc).&lt;br /&gt;
&lt;br /&gt;
=== Design Strategy ===&lt;br /&gt;
As we have concrete understanding of the problem and proposed solution, we would like break this problem into multiple more manageable sub-problems with specific tasks and well-defined solutions to these tasks. Generally, each sub-problem requires modification of one or more files. We would like to propose our Design Strategy as follows:&lt;br /&gt;
* Rubrics tab with &amp;quot;''Vary rubric by topic''&amp;quot; checkbox&lt;br /&gt;
** File: ''app/views/assignments/edit/_rubrics.html.erb''&lt;br /&gt;
** PROBLEM: There is no way for the user to indicate that rubrics should vary by topic&lt;br /&gt;
** SOLUTION: Add a new checkbox in the rubric tab to indicate whether rubrics vary by topic or not&lt;br /&gt;
&lt;br /&gt;
* Preparation of the Topics tab&lt;br /&gt;
** File: ''app/views/assignments/edit.html.erb''&lt;br /&gt;
** PROBLEM: We need to add/change content to the Topics tab, but unlike other tabs in the views, it does not have its own partial view to work with&lt;br /&gt;
** SOLUTION: Refactor and move the code dealing with topics into separate ''app/views/assignments/edit/_topics.html.erb'' file&lt;br /&gt;
&lt;br /&gt;
* Topics tab with &amp;quot;''Questionnaire''&amp;quot; column and review dropdown content&lt;br /&gt;
** File: ''app/views/assignments/edit/_topics.html.erb''&lt;br /&gt;
** PROBLEM: There is no way for the user to select rubric(s) for a particular topic&lt;br /&gt;
** SOLUTION: Add a new column in the topics table for choosing rubric(s)&lt;br /&gt;
*** New column only visible if rubrics vary by topic, per Rubrics tab&lt;br /&gt;
*** New column has multiple rounds per topic only if rubrics vary by round, per Rubrics tab&lt;br /&gt;
*** Default value for any rubric is that rubric which is shown on Rubrics tab&lt;br /&gt;
*** Rubric(s) in the dropdown list is/are only those that were created by the currently logged in instructor&lt;br /&gt;
** PROBLEM: The code in ''app/views/assignments/edit/_rubrics.html.erb'' includes dropdowns like the ones we need to add for topics, but that code is way too complex for its functionality (too heavy for a view, uses JavaScript)&lt;br /&gt;
** SOLUTION: Use the code in ''app/views/assignments/edit/_rubrics.html.erb'' for inspiration and as a base line only&lt;br /&gt;
*** Refactor and move as much actual work as possible out into helper methods that are simply called from this view&lt;br /&gt;
*** Views are not intended to do heavy lifting&lt;br /&gt;
*** Use as little JavaScript as possible, since this is a Ruby On Rails project, not a JS project&lt;br /&gt;
&lt;br /&gt;
* Find questionnaire for a given assignment/round/topic&lt;br /&gt;
* File: ''app/helpers/assignment_helper.rb''&lt;br /&gt;
** PROBLEM: The ''assignment_questionnaire'' method finds a questionnaire for a given assignment/round, and would be a great place to include code to find a questionnaire for a given assignment/round/topic, however the method is not easy to work with&lt;br /&gt;
** SOLUTION: Improve readability of teh ''assignment_questionnaire'' method&lt;br /&gt;
*** Add comment block at the top describing the purpose and basic strategy of the method&lt;br /&gt;
*** Rename 'number' parameter to clarify the purpose of the parameter&lt;br /&gt;
** SOLUTION: Expand functionality of the ''assignment_questionnaire'' method&lt;br /&gt;
*** Add ability to get assignment questionnaires by topic as well as by round&lt;br /&gt;
*** Like round, topic parameter should be optional&lt;br /&gt;
&lt;br /&gt;
* Test all of the required helpers&lt;br /&gt;
* File: ''spec/helpers''&lt;br /&gt;
** PROBLEM: We are going to add code to the ''app/helpers/assignment_helper.rb'', but this helper does not have an RSpec test suite yet&lt;br /&gt;
** SOLUTION: Add ''spec/helpers/assignment_helper_spec.rb'' file&lt;br /&gt;
*** Thoroughly test ''assignment_questionnaire'' method in the ''app/helpers/assignment_helper.rb''&lt;br /&gt;
** PROBLEM: We may also need to create other helpers or helper methods as we get into the code&lt;br /&gt;
** SOLUTION: Add tests for any newly created helpers or helper methods&lt;br /&gt;
&lt;br /&gt;
* Core Problem: create relationship between ''sign_up_topics'' and ''questionnaires'' table through ''topic_questionnaires'' table&lt;br /&gt;
* File: ''db/migrate''&lt;br /&gt;
** PROBLEM: Questionnaires (of which rubrics are one type) are not linked to assignment topics&lt;br /&gt;
** SOLUTION: Create a new migration to link rubrics to topics&lt;br /&gt;
*** Create a new table named topic_questionnaire with the following fields:&lt;br /&gt;
**** ''id''&lt;br /&gt;
**** ''topic_id''&lt;br /&gt;
**** ''questionnaire_id''&lt;br /&gt;
**** ''used_in_round''&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
&lt;br /&gt;
In this section, we provide selected portions of modified code to illustrate how we implemented the new feature.&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
In this section, we list all files that were modified while implementing the new feature.&lt;br /&gt;
&lt;br /&gt;
* [to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
=== How To ===&lt;br /&gt;
&lt;br /&gt;
In this section, we describe how to use the newly implemented feature.&lt;br /&gt;
&lt;br /&gt;
==== Add a New Rubric ====&lt;br /&gt;
&lt;br /&gt;
* [to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
==== Select a Rubric for a Topic ====&lt;br /&gt;
&lt;br /&gt;
* [to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
== Project Testing ==&lt;br /&gt;
To test code implementation, correctness of the added feature, verify that the team did not break any existing functionalities in the Expertiza, and ensure that no bugs were introduced in the code, we utilized the following Test Strategy:&lt;br /&gt;
# Code inspection&lt;br /&gt;
# Run and pass existing RSpec Tests&lt;br /&gt;
# Develop New RSpec Tests&lt;br /&gt;
# Run through live UI to test a feature using Expertiza instance&lt;br /&gt;
&lt;br /&gt;
=== Rspec Testing ===&lt;br /&gt;
&lt;br /&gt;
Our strategy for gaining confidence that our code changes did not break anything was as follows:&lt;br /&gt;
* Run all existing RSpec tests on any changed files, after our changes, to ensure that we have not introduced any failures.&lt;br /&gt;
* The commands and results are shown below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  [to be populated after coding is complete]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Write new comprehensive RSpec tests, for all new methods.&lt;br /&gt;
* Run these tests, to ensure that the new code works as intended.&lt;br /&gt;
* The commands and results are shown below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  [to be populated after coding is complete]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The test suite for a single new method is below.&lt;br /&gt;
* There are many such suites in (TODO add filename(s)).  &lt;br /&gt;
* This example illustrates our general strategy:&lt;br /&gt;
** test missing input&lt;br /&gt;
** test bad input&lt;br /&gt;
** test various acceptable forms of input&lt;br /&gt;
** test scenarios that lead to &amp;quot;true&amp;quot; and to &amp;quot;false&amp;quot; return values&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  [to be populated after coding is complete]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== UI Testing ===&lt;br /&gt;
Here we describe UI Testing that has performed. Include Screenshots maybe?&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
== Useful Links ==&lt;br /&gt;
In this section we provide useful links related to the work that has been completed by our team.&lt;br /&gt;
# [https://github.com/gabalmat/expertiza Forked Project Repository]&lt;br /&gt;
# [(add link here) Pull Request]&lt;br /&gt;
# [(add link here) Video Demonstration of Specialized Rubrics]&lt;br /&gt;
# [(add link here) Video Demonstration of Passing Rspec Tests]&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Contacts ===&lt;br /&gt;
We have 4 (four) members in our team and 1 (one) mentor was also assigned to us. For any project-related questions/concerns please contact us:&lt;br /&gt;
* Aurora Tiffany-Davis - attiffan@ncsu.edu&lt;br /&gt;
* Ginger Balmat - gabalmat@ncsu.edu&lt;br /&gt;
* Joe Hutchinson - jehutch3@ncsu.edu&lt;br /&gt;
* Nikolay Titov - ngtitov@ncsu.edu&lt;br /&gt;
* Zhewei Hu (mentor) - zhu6@ncsu.edu&lt;br /&gt;
&lt;br /&gt;
=== Contribution Based Inquiry ===&lt;br /&gt;
For any questions or concerns related to the project design, implementation, testing of the feature developed by our team, please contact an engineer who worked closely on the topic of your interest based on the [https://docs.google.com/spreadsheets/d/11uxuI_5gaC-FQDwIOxtCaN3HZ9bfWDJgIjFemtYV5jE/edit?ts=5ca222f3#gid=0 Contribution Assignment Grid] we created to keep track of our progress and contribution. Please carbon copy all team members and our mentor in the email.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* Expertiza Web [https://github.com/expertiza/expertiza#expertiza]&lt;br /&gt;
* Expertiza on GitHub [https://github.com/expertiza/expertiza]&lt;br /&gt;
* Expertiza Wiki [http://wikis.lib.ncsu.edu/index.php/Expertiza]&lt;br /&gt;
* Rspec Documentation [https://relishapp.com/rspec]&lt;br /&gt;
* Wiki with Previous Work [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1873_Specialized_rubics_for_different_topic_types]&lt;br /&gt;
* Pull Request of the Previous Work [https://github.com/expertiza/expertiza/pull/1327]&lt;/div&gt;</summary>
		<author><name>Ngtitov</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics&amp;diff=123576</id>
		<title>E1936 Specialized Rubrics</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics&amp;diff=123576"/>
		<updated>2019-04-08T07:39:21Z</updated>

		<summary type="html">&lt;p&gt;Ngtitov: /* Entity Relationship Diagram */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page describes the work and goals that have been completed and achieved while implementing Expertiza Project &amp;quot;E1936. Specialized Rubrics for Different Topic Types (e.g., Servo project, refactoring project)&amp;quot; for the CSC/ECE 517 &amp;quot;Object-Oriented Design and Development&amp;quot; class, in the Spring semester of the 2019.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This Wiki page is created per CSC/ECE 517: &amp;quot;Object-Oriented Design and Development&amp;quot;, Expertiza Project requirements (Spring, 2019).&lt;br /&gt;
&lt;br /&gt;
Our [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Team team] was assigned the project &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936. Specialized rubrics for different topic types (e.g., Servo project, refactoring project)]&amp;quot;.  This is an Expertiza project.&lt;br /&gt;
&lt;br /&gt;
In this wiki page we describe the problem to be solved, how we solve that problem, and how we test our solution.  We also provide helpful links and contact information for our team.&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
In this section, we discuss the problem we need to solve, the Expertiza feature this problem is related to, what needs to be done to solve the problem (at a high level), and the previous attempt to solve this problem.&lt;br /&gt;
&lt;br /&gt;
=== Problem Statement ===&lt;br /&gt;
&lt;br /&gt;
This problem statement summarizes the problem as described in the project description &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936. Specialized rubrics for different topic types (e.g., Servo project, refactoring project)]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
In CSC/ECE 517, there are several types of topics that could be covered in a single class assignment.&lt;br /&gt;
* Code base&lt;br /&gt;
** Expertiza&lt;br /&gt;
** Mozilla&lt;br /&gt;
** etc.&lt;br /&gt;
* Goal&lt;br /&gt;
** Refactoring&lt;br /&gt;
** Testing&lt;br /&gt;
** etc.&lt;br /&gt;
However, currently we can only specify one kind of rubric for an assignment.  This means that teams working on different topics will be evaluated using the same rubric.  With this setup, it's not possible to fine-tune rubrics for different topics - rubrics tend to be overly general.&lt;br /&gt;
&lt;br /&gt;
=== Feature Description ===&lt;br /&gt;
&lt;br /&gt;
The feature we will add in this project is a feature to allow rubrics to vary not only by project phase, but also by topic.  This allows more flexibility to the instructor when setting up an assignment, so that they can use rubrics better suited to the tasks that students are performing in an assignment.&lt;br /&gt;
&lt;br /&gt;
When this feature is complete, the following scenarios will be possible, and the instructor will be the judge of which scenario is the best fit to the assignment:&lt;br /&gt;
&lt;br /&gt;
* One rubric for the assignment, period.&lt;br /&gt;
* A different rubric for each phase of the assignment, regardless of what topic different students are working on.&lt;br /&gt;
* A different rubric for each topic, regardless of the phases in the assignment.&lt;br /&gt;
* A different rubric for each phase of the assignment, and within a phase, a different rubric for each topic.&lt;br /&gt;
&lt;br /&gt;
=== What Needs to be Done ===&lt;br /&gt;
&lt;br /&gt;
This section summarizes the work as described in the project description &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936. Specialized rubrics for different topic types (e.g., Servo project, refactoring project)]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* In assignment#edit page &amp;quot;Rubrics&amp;quot; tab, add a checkbox to specify whether rubric should vary by topic.&lt;br /&gt;
* In assignment#edit page &amp;quot;Topics&amp;quot; tab, add dropdown(s) next to each topic to specify which rubric(s) are associated with the topic.&lt;br /&gt;
** The dropdown(s) should appear only if rubric should vary by topic, per the Rubrics tab.&lt;br /&gt;
** The topic should have a multiple dropdowns (one for each round) only if rubrics vary by round, per the Rubrics tab.&lt;br /&gt;
** By default, the rubric(s) for each course project will be the one(s) specified in “Rubrics” tab.&lt;br /&gt;
** The dropdown value can overwrite the default rubric.&lt;br /&gt;
* Be careful when making changes to the code&lt;br /&gt;
** The signup_sheet_controller should have as little to do as possible with the selection of rubrics.&lt;br /&gt;
** Anything not germane to selecting topics should be in another controller or (more probably) a helper.&lt;br /&gt;
* Create a DB migration to allow rubric to vary by topic as well as by round.&lt;br /&gt;
&lt;br /&gt;
==== Screenshots ====&lt;br /&gt;
'''Current screenshot of Rubrics tab for an Assignment'''&lt;br /&gt;
(need to add a checkbox to indicate that rubric should vary by topic)&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Screenshot Assignment Edit Rubrics.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Current screenshot of Topics tab for an Assignment'''&lt;br /&gt;
(need to add a way to select rubrics for particular topics)&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Screenshot Assignment Edit Topics.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Proposed screenshot of Rubrics tab for an Assignment'''&lt;br /&gt;
(changes highlighted in red box)&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Specialized Rubric rubric checkbox.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Proposed screenshot of Topics tab for an Assignment'''&lt;br /&gt;
(changes highlighted in red box)&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Specialized Rubric dropdown menu.png]]&lt;br /&gt;
&lt;br /&gt;
=== Previous Work ===&lt;br /&gt;
There was previous attempt to implement this project in the Fall of 2018 semester by different team, but it was rejected due to several reasons. Our team was provided with all relevant information about the design and implementation of the previously attempted project. The following is the list of links with the relevant materials that we have used for better project understanding, determining pros and cons of proposed changes, and identifying any improvements:&lt;br /&gt;
&lt;br /&gt;
# [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1873_Specialized_rubics_for_different_topic_types Wiki]&lt;br /&gt;
# [https://github.com/expertiza/expertiza/pull/1327 Pull Request]&lt;br /&gt;
# [https://drive.google.com/file/d/1UrLb0Ula_Lb_F4MOrdC-s6xng6B08VYu/view Video Demo]&lt;br /&gt;
&lt;br /&gt;
After reviewing all relevant materials, we concluded that implementation of the project was incomplete and we found two main drawbacks that can be improved:&lt;br /&gt;
&lt;br /&gt;
* Per project requirement specifications, &amp;quot;''The dropdown box should appear only if 'Vary rubric by topic' is selected in the Rubrics tab.''&amp;quot; This requirement was not met and ''Vary rubric by topic'' checkbox in the Rubrics tab was not implemented at all. Therefore, dropdown box with the list of rubrics appears regardless of whether &amp;quot;''Vary rubric by topic''&amp;quot; is selected or not.&lt;br /&gt;
* The dropdown box includes the list of all possible rubrics including default value. However, this condition can be improved. The dropdown box should list the rubrics that were created by the current user (professor who is logged in). This would allow to shorten the list of possible rubrics dramatically and help to avoid any misunderstanding and confusion while user selects desired rubric for the course project.&lt;br /&gt;
&lt;br /&gt;
We found no further issues with the rest implementation and other project materials. Wiki page is very useful for understading design of proposed changes. However, our team decided to use slightly different approach than adding ''questionnaire_id'' in the ''sign_up_topics'' table to specify project's topic and its associated rubrics. Please see our [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Design_Strategy Design Strategy] for our proposed changes.&lt;br /&gt;
&lt;br /&gt;
== Project Implementation ==&lt;br /&gt;
In this section, we propose our solution to the problem, discuss implementation techniques and details, and list the goals we achieved.&lt;br /&gt;
&lt;br /&gt;
We start by analyzing Entity Relationship Diagram where we state the solution to the problem. Further we discuss design strategy by breaking project problem into multiple staged sub-problems and provide solution for each of these sub-problems. We also discuss some implementation details and provide the list of involved files. Finally, we demonstrate how implemented feature can be used by providing ''How To'' sub-section.&lt;br /&gt;
&lt;br /&gt;
=== Entity Relationship Diagram ===&lt;br /&gt;
We would like to propose our solution to the problem by representing Entity Relationship Diagram and discussing how relationship between ''sign_up_topics'' and ''questionnaires'' tables can be established to associate project's topic with a rubric.&lt;br /&gt;
&lt;br /&gt;
''Note'' that in the existing implementation neither ''sign_up_topics'' nor ''questionnaires'' tables have relation with each other. Meaning ''sign_up_topics'' table has no foreign key that points to the ''questionnaires'' table, and equivalently for the ''questionnaires'' table, it has no foreign key that points to the ''sign_up_topics'' table. This problem would easily be solved if the ''sign_up_topics'' and ''questionnaires'' tables have ''many-to-one'' relationship (which seems to be an appropriate approach since each topic has exactly one rubric). In this case we would create a DB migration to add ''questionnaire_id'' in the ''sign_up_topics''. However, this solution is incorrect as we stated in the [http://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics#Previous_Work Previous Work] section.&lt;br /&gt;
&lt;br /&gt;
The problem is that each topic has exactly one rubric per specific round. The same topic may have different rubric with various rounds. Therefore, ''many-to-one'' relationship would break DB design and would limit to have only one rubric per topic for each round. Hence, the correct is ''many-to-many'' relationship between the tables.&lt;br /&gt;
&lt;br /&gt;
To solve this dilemma and properly establish ''many-to-many'' relationship between ''sign_up_topics'' nor ''questionnaires'' tables, we came to the conclusion and can state solution to the core problem of the project:&lt;br /&gt;
* Create new ''topic_questionnaire'' table with foreign keys to each of the ''sign_up_topics'' and ''questionnaires'' tables.&lt;br /&gt;
&lt;br /&gt;
By adding new such table we create ''many-to-many'' relationship between ''sign_up_topics'' nor ''questionnaires'' tables and this would allow project topic to record multiple rubrics per each round. In the following Entity Relationship Diagram we show existing DB design and proposed changes in blue:&lt;br /&gt;
&lt;br /&gt;
[[File: CSC520_Project_4_Diagram.PNG]]&lt;br /&gt;
&lt;br /&gt;
Above Entity Relationship Diagram can be interpreted as follows:&lt;br /&gt;
* ''sign_up_topics'' table is connected with ''topic_questionnaire'' table through ''many-to-many'' relationship (i.e., project's topic may have multiple topic questionnaires per each round)&lt;br /&gt;
* ''topic_questionnaire'' table is connected with ''questionnaires'' tables via ''many-to-one'' relationship (i.e., topic questionnaire belongs to exactly one questionnaire)&lt;br /&gt;
&lt;br /&gt;
To illustrate this we can use the following table that reflects new ''topic_questionnaire'' table at any point in time:&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
  &amp;lt;tr&amp;gt;&lt;br /&gt;
    &amp;lt;th&amp;gt;id&amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;th&amp;gt;topic_id&amp;lt;/th&amp;gt; &lt;br /&gt;
    &amp;lt;th&amp;gt;questionnaire_id&amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;th&amp;gt;used_in_round&amp;lt;/th&amp;gt;&lt;br /&gt;
  &amp;lt;/tr&amp;gt;&lt;br /&gt;
  &amp;lt;tr&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;/tr&amp;gt;&lt;br /&gt;
  &amp;lt;tr&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;2&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;2&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;2&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;/tr&amp;gt;&lt;br /&gt;
  &amp;lt;tr&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;3&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;3&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;3&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Above table demonstrates that the same topic with id=1 may have multiple different questionnaires (with id's=1, 2, 3) depending on the round (round 1, 2, 3 and etc).&lt;br /&gt;
&lt;br /&gt;
=== Design Strategy ===&lt;br /&gt;
* app/views/assignments/edit/_rubrics.html.erb&lt;br /&gt;
** PROBLEM: There is no way for the user to indicate that rubrics should vary by topic&lt;br /&gt;
*** SOLUTION: Add a new checkbox for whether or not rubrics vary by topic&lt;br /&gt;
&lt;br /&gt;
* app/views/assignments/edit.html.erb&lt;br /&gt;
** PROBLEM: We need to add content to the Topics tab, but unlike other tabs, this doesn't have it's own partial view to work with&lt;br /&gt;
*** SOLUTION: Break out code dealing with topics into app/views/assignments/edit/_topics.html.erb&lt;br /&gt;
&lt;br /&gt;
* app/views/assignments/edit/_topics.html.erb&lt;br /&gt;
** PROBLEM: There is no way for the user to select rubric(s) for a particular topic&lt;br /&gt;
*** SOLUTION: Add a new column in the topics table for choosing rubric(s)&lt;br /&gt;
**** New column only visible if rubrics vary by topic, per Rubrics tab&lt;br /&gt;
**** New column has multiple rounds per topic only if rubrics vary by round, per Rubrics tab&lt;br /&gt;
**** Default value for any rubric is that rubric which is shown on Rubrics tab&lt;br /&gt;
**** Rubrics in the dropdown(s) will be only those created by the currently logged in instructor&lt;br /&gt;
** PROBLEM: The code in app/views/assignments/edit/_rubrics.html.erb includes dropdowns like the ones we'll need to add for topics, but that code is not easy to work with (too heavy for a view, uses JavaScript)&lt;br /&gt;
*** SOLUTION: Use the code in app/views/assignments/edit/_rubrics.html.erb for inspiration only&lt;br /&gt;
**** Break as much actual work as possible out into helper methods that are simply called from this view&lt;br /&gt;
**** Views are not intended to do heavy lifting&lt;br /&gt;
**** Use as little JavaScript as possible&lt;br /&gt;
**** This is a Ruby On Rails project, not a JS project&lt;br /&gt;
&lt;br /&gt;
* app/helpers/assignment_helper.rb&lt;br /&gt;
** PROBLEM: The assignment_questionnaire method finds a questionnaire for a given assignment/round, and would be a great place to include code to find a questionnaire for a given assignment/round/topic, however the method is not easy to work with&lt;br /&gt;
*** SOLUTION: Improve readability of assignment_questionnaire method&lt;br /&gt;
**** Add comment block at the top describing the purpose and basic strategy of the method&lt;br /&gt;
**** Rename 'number' parameter to clarify the purpose of the parameter&lt;br /&gt;
*** SOLUTION: Expand functionality of assignment_questionnaire method&lt;br /&gt;
**** Add ability to get assignment questionnaires by topic as well as by round&lt;br /&gt;
**** Like round, topic parameter should be optional&lt;br /&gt;
&lt;br /&gt;
* spec/helpers&lt;br /&gt;
** PROBLEM: We are going to add code to app/helpers/assignment_helper.rb, but this helper does not have an RSpec test suite yet&lt;br /&gt;
*** SOLUTION: Add spec/helpers/assignment_helper_spec.rb file&lt;br /&gt;
**** Thoroughly test app/helpers/assignment_helper.rb assignment_questionnaire method&lt;br /&gt;
** PROBLEM: We may also need to create other helpers or helper methods as we get into the code&lt;br /&gt;
*** SOLUTION: Add tests for any newly created helpers or helper methods&lt;br /&gt;
&lt;br /&gt;
* db/migrate&lt;br /&gt;
** PROBLEM: Questionnaires (of which rubrics are one type) are not linked to assignment topics&lt;br /&gt;
*** SOLUTION: Create a new migration to link rubrics to topics&lt;br /&gt;
**** Create a new table named topic_questionnaire with fields:&lt;br /&gt;
***** id&lt;br /&gt;
***** topic_id&lt;br /&gt;
***** questionnaire_id&lt;br /&gt;
***** used_in_round&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
&lt;br /&gt;
In this section, we provide selected portions of modified code to illustrate how we implemented the new feature.&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
In this section, we list all files that were modified while implementing the new feature.&lt;br /&gt;
&lt;br /&gt;
* [to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
=== How To ===&lt;br /&gt;
&lt;br /&gt;
In this section, we describe how to use the newly implemented feature.&lt;br /&gt;
&lt;br /&gt;
==== Add a New Rubric ====&lt;br /&gt;
&lt;br /&gt;
* [to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
==== Select a Rubric for a Topic ====&lt;br /&gt;
&lt;br /&gt;
* [to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
== Project Testing ==&lt;br /&gt;
To test code implementation, correctness of the added feature, verify that the team did not break any existing functionalities in the Expertiza, and ensure that no bugs were introduced in the code, we utilized the following Test Strategy:&lt;br /&gt;
# Code inspection&lt;br /&gt;
# Run and pass existing RSpec Tests&lt;br /&gt;
# Develop New RSpec Tests&lt;br /&gt;
# Run through live UI to test a feature using Expertiza instance&lt;br /&gt;
&lt;br /&gt;
=== Rspec Testing ===&lt;br /&gt;
&lt;br /&gt;
Our strategy for gaining confidence that our code changes did not break anything was as follows:&lt;br /&gt;
* Run all existing RSpec tests on any changed files, after our changes, to ensure that we have not introduced any failures.&lt;br /&gt;
* The commands and results are shown below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  [to be populated after coding is complete]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Write new comprehensive RSpec tests, for all new methods.&lt;br /&gt;
* Run these tests, to ensure that the new code works as intended.&lt;br /&gt;
* The commands and results are shown below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  [to be populated after coding is complete]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The test suite for a single new method is below.&lt;br /&gt;
* There are many such suites in (TODO add filename(s)).  &lt;br /&gt;
* This example illustrates our general strategy:&lt;br /&gt;
** test missing input&lt;br /&gt;
** test bad input&lt;br /&gt;
** test various acceptable forms of input&lt;br /&gt;
** test scenarios that lead to &amp;quot;true&amp;quot; and to &amp;quot;false&amp;quot; return values&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  [to be populated after coding is complete]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== UI Testing ===&lt;br /&gt;
Here we describe UI Testing that has performed. Include Screenshots maybe?&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
== Useful Links ==&lt;br /&gt;
In this section we provide useful links related to the work that has been completed by our team.&lt;br /&gt;
# [https://github.com/gabalmat/expertiza Forked Project Repository]&lt;br /&gt;
# [(add link here) Pull Request]&lt;br /&gt;
# [(add link here) Video Demonstration of Specialized Rubrics]&lt;br /&gt;
# [(add link here) Video Demonstration of Passing Rspec Tests]&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Contacts ===&lt;br /&gt;
We have 4 (four) members in our team and 1 (one) mentor was also assigned to us. For any project-related questions/concerns please contact us:&lt;br /&gt;
* Aurora Tiffany-Davis - attiffan@ncsu.edu&lt;br /&gt;
* Ginger Balmat - gabalmat@ncsu.edu&lt;br /&gt;
* Joe Hutchinson - jehutch3@ncsu.edu&lt;br /&gt;
* Nikolay Titov - ngtitov@ncsu.edu&lt;br /&gt;
* Zhewei Hu (mentor) - zhu6@ncsu.edu&lt;br /&gt;
&lt;br /&gt;
=== Contribution Based Inquiry ===&lt;br /&gt;
For any questions or concerns related to the project design, implementation, testing of the feature developed by our team, please contact an engineer who worked closely on the topic of your interest based on the [https://docs.google.com/spreadsheets/d/11uxuI_5gaC-FQDwIOxtCaN3HZ9bfWDJgIjFemtYV5jE/edit?ts=5ca222f3#gid=0 Contribution Assignment Grid] we created to keep track of our progress and contribution. Please carbon copy all team members and our mentor in the email.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* Expertiza Web [https://github.com/expertiza/expertiza#expertiza]&lt;br /&gt;
* Expertiza on GitHub [https://github.com/expertiza/expertiza]&lt;br /&gt;
* Expertiza Wiki [http://wikis.lib.ncsu.edu/index.php/Expertiza]&lt;br /&gt;
* Rspec Documentation [https://relishapp.com/rspec]&lt;br /&gt;
* Wiki with Previous Work [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1873_Specialized_rubics_for_different_topic_types]&lt;br /&gt;
* Pull Request of the Previous Work [https://github.com/expertiza/expertiza/pull/1327]&lt;/div&gt;</summary>
		<author><name>Ngtitov</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:CSC520_Project_4_Diagram.PNG&amp;diff=123575</id>
		<title>File:CSC520 Project 4 Diagram.PNG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:CSC520_Project_4_Diagram.PNG&amp;diff=123575"/>
		<updated>2019-04-08T07:05:38Z</updated>

		<summary type="html">&lt;p&gt;Ngtitov: uploaded a new version of &amp;amp;quot;File:CSC520 Project 4 Diagram.PNG&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Ngtitov</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:CSC520_Project_4_Diagram.PNG&amp;diff=123574</id>
		<title>File:CSC520 Project 4 Diagram.PNG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:CSC520_Project_4_Diagram.PNG&amp;diff=123574"/>
		<updated>2019-04-08T07:01:45Z</updated>

		<summary type="html">&lt;p&gt;Ngtitov: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Ngtitov</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics&amp;diff=123573</id>
		<title>E1936 Specialized Rubrics</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics&amp;diff=123573"/>
		<updated>2019-04-08T07:01:20Z</updated>

		<summary type="html">&lt;p&gt;Ngtitov: /* Project Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page describes the work and goals that have been completed and achieved while implementing Expertiza Project &amp;quot;E1936. Specialized Rubrics for Different Topic Types (e.g., Servo project, refactoring project)&amp;quot; for the CSC/ECE 517 &amp;quot;Object-Oriented Design and Development&amp;quot; class, in the Spring semester of the 2019.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This Wiki page is created per CSC/ECE 517: &amp;quot;Object-Oriented Design and Development&amp;quot;, Expertiza Project requirements (Spring, 2019).&lt;br /&gt;
&lt;br /&gt;
Our [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Team team] was assigned the project &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936. Specialized rubrics for different topic types (e.g., Servo project, refactoring project)]&amp;quot;.  This is an Expertiza project.&lt;br /&gt;
&lt;br /&gt;
In this wiki page we describe the problem to be solved, how we solve that problem, and how we test our solution.  We also provide helpful links and contact information for our team.&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
In this section, we discuss the problem we need to solve, the Expertiza feature this problem is related to, what needs to be done to solve the problem (at a high level), and the previous attempt to solve this problem.&lt;br /&gt;
&lt;br /&gt;
=== Problem Statement ===&lt;br /&gt;
&lt;br /&gt;
This problem statement summarizes the problem as described in the project description &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936. Specialized rubrics for different topic types (e.g., Servo project, refactoring project)]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
In CSC/ECE 517, there are several types of topics that could be covered in a single class assignment.&lt;br /&gt;
* Code base&lt;br /&gt;
** Expertiza&lt;br /&gt;
** Mozilla&lt;br /&gt;
** etc.&lt;br /&gt;
* Goal&lt;br /&gt;
** Refactoring&lt;br /&gt;
** Testing&lt;br /&gt;
** etc.&lt;br /&gt;
However, currently we can only specify one kind of rubric for an assignment.  This means that teams working on different topics will be evaluated using the same rubric.  With this setup, it's not possible to fine-tune rubrics for different topics - rubrics tend to be overly general.&lt;br /&gt;
&lt;br /&gt;
=== Feature Description ===&lt;br /&gt;
&lt;br /&gt;
The feature we will add in this project is a feature to allow rubrics to vary not only by project phase, but also by topic.  This allows more flexibility to the instructor when setting up an assignment, so that they can use rubrics better suited to the tasks that students are performing in an assignment.&lt;br /&gt;
&lt;br /&gt;
When this feature is complete, the following scenarios will be possible, and the instructor will be the judge of which scenario is the best fit to the assignment:&lt;br /&gt;
&lt;br /&gt;
* One rubric for the assignment, period.&lt;br /&gt;
* A different rubric for each phase of the assignment, regardless of what topic different students are working on.&lt;br /&gt;
* A different rubric for each topic, regardless of the phases in the assignment.&lt;br /&gt;
* A different rubric for each phase of the assignment, and within a phase, a different rubric for each topic.&lt;br /&gt;
&lt;br /&gt;
=== What Needs to be Done ===&lt;br /&gt;
&lt;br /&gt;
This section summarizes the work as described in the project description &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936. Specialized rubrics for different topic types (e.g., Servo project, refactoring project)]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* In assignment#edit page &amp;quot;Rubrics&amp;quot; tab, add a checkbox to specify whether rubric should vary by topic.&lt;br /&gt;
* In assignment#edit page &amp;quot;Topics&amp;quot; tab, add dropdown(s) next to each topic to specify which rubric(s) are associated with the topic.&lt;br /&gt;
** The dropdown(s) should appear only if rubric should vary by topic, per the Rubrics tab.&lt;br /&gt;
** The topic should have a multiple dropdowns (one for each round) only if rubrics vary by round, per the Rubrics tab.&lt;br /&gt;
** By default, the rubric(s) for each course project will be the one(s) specified in “Rubrics” tab.&lt;br /&gt;
** The dropdown value can overwrite the default rubric.&lt;br /&gt;
* Be careful when making changes to the code&lt;br /&gt;
** The signup_sheet_controller should have as little to do as possible with the selection of rubrics.&lt;br /&gt;
** Anything not germane to selecting topics should be in another controller or (more probably) a helper.&lt;br /&gt;
* Create a DB migration to allow rubric to vary by topic as well as by round.&lt;br /&gt;
&lt;br /&gt;
==== Screenshots ====&lt;br /&gt;
'''Current screenshot of Rubrics tab for an Assignment'''&lt;br /&gt;
(need to add a checkbox to indicate that rubric should vary by topic)&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Screenshot Assignment Edit Rubrics.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Current screenshot of Topics tab for an Assignment'''&lt;br /&gt;
(need to add a way to select rubrics for particular topics)&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Screenshot Assignment Edit Topics.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Proposed screenshot of Rubrics tab for an Assignment'''&lt;br /&gt;
(changes highlighted in red box)&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Specialized Rubric rubric checkbox.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Proposed screenshot of Topics tab for an Assignment'''&lt;br /&gt;
(changes highlighted in red box)&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Specialized Rubric dropdown menu.png]]&lt;br /&gt;
&lt;br /&gt;
=== Previous Work ===&lt;br /&gt;
There was previous attempt to implement this project in the Fall of 2018 semester by different team, but it was rejected due to several reasons. Our team was provided with all relevant information about the design and implementation of the previously attempted project. The following is the list of links with the relevant materials that we have used for better project understanding, determining pros and cons of proposed changes, and identifying any improvements:&lt;br /&gt;
&lt;br /&gt;
# [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1873_Specialized_rubics_for_different_topic_types Wiki]&lt;br /&gt;
# [https://github.com/expertiza/expertiza/pull/1327 Pull Request]&lt;br /&gt;
# [https://drive.google.com/file/d/1UrLb0Ula_Lb_F4MOrdC-s6xng6B08VYu/view Video Demo]&lt;br /&gt;
&lt;br /&gt;
After reviewing all relevant materials, we concluded that implementation of the project was incomplete and we found two main drawbacks that can be improved:&lt;br /&gt;
&lt;br /&gt;
* Per project requirement specifications, &amp;quot;''The dropdown box should appear only if 'Vary rubric by topic' is selected in the Rubrics tab.''&amp;quot; This requirement was not met and ''Vary rubric by topic'' checkbox in the Rubrics tab was not implemented at all. Therefore, dropdown box with the list of rubrics appears regardless of whether &amp;quot;''Vary rubric by topic''&amp;quot; is selected or not.&lt;br /&gt;
* The dropdown box includes the list of all possible rubrics including default value. However, this condition can be improved. The dropdown box should list the rubrics that were created by the current user (professor who is logged in). This would allow to shorten the list of possible rubrics dramatically and help to avoid any misunderstanding and confusion while user selects desired rubric for the course project.&lt;br /&gt;
&lt;br /&gt;
We found no further issues with the rest implementation and other project materials. Wiki page is very useful for understading design of proposed changes. However, our team decided to use slightly different approach than adding ''questionnaire_id'' in the ''sign_up_topics'' table to specify project's topic and its associated rubrics. Please see our [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Design_Strategy Design Strategy] for our proposed changes.&lt;br /&gt;
&lt;br /&gt;
== Project Implementation ==&lt;br /&gt;
In this section, we propose our solution to the problem, discuss implementation techniques and details, and list the goals we achieved.&lt;br /&gt;
&lt;br /&gt;
We start by analyzing Entity Relationship Diagram where we state the solution to the problem. Further we discuss design strategy by breaking project problem into multiple staged sub-problems and provide solution for each of these sub-problems. We also discuss some implementation details and provide the list of involved files. Finally, we demonstrate how implemented feature can be used by providing ''How To'' sub-section.&lt;br /&gt;
&lt;br /&gt;
=== Entity Relationship Diagram ===&lt;br /&gt;
We would like to propose our solution to the problem by representing Entity Relationship Diagram and discussing how relationship between ''sign_up_topics'' and ''questionnaires'' tables can be established to associate project's topic with a rubric.&lt;br /&gt;
&lt;br /&gt;
''Note'' that in the existing implementation neither ''sign_up_topics'' nor ''questionnaires'' tables have relation with each other. Meaning ''sign_up_topics'' table has no foreign key that points to the ''questionnaires'' table, and equivalently for the ''questionnaires'' table, it has no foreign key that points to the ''sign_up_topics'' table. This problem would easily be solved if the ''sign_up_topics'' and ''questionnaires'' tables have ''many-to-one'' relationship (which seems to be an appropriate approach since each topic has exactly one rubric). In this case we would create a DB migration to add ''questionnaire_id'' in the ''sign_up_topics''. However, this solution is incorrect as we stated in the [http://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics#Previous_Work Previous Work] section.&lt;br /&gt;
&lt;br /&gt;
The problem is that each topic has exactly one rubric per specific round. The same topic may have different rubric with various rounds. Therefore, ''many-to-one'' relationship would break DB design and would limit to have only one rubric per topic for each round. Hence, the correct is ''many-to-many'' relationship between the tables.&lt;br /&gt;
&lt;br /&gt;
To solve this dilemma and properly establish ''many-to-many'' relationship between ''sign_up_topics'' nor ''questionnaires'' tables, we came to the conclusion and can state solution to the core problem of the project:&lt;br /&gt;
* Create new ''topic_questionnaire'' table with foreign keys to each of the ''sign_up_topics'' and ''questionnaires'' tables.&lt;br /&gt;
&lt;br /&gt;
By adding new such table we create ''many-to-many'' relationship between ''sign_up_topics'' nor ''questionnaires'' tables and this would allow project topic to record multiple rubrics per each round. In the following Entity Relationship Diagram we show existing DB design and proposed changes in blue:&lt;br /&gt;
&lt;br /&gt;
[[File: CSC520_Project_4_Diagram.PNG]]&lt;br /&gt;
&lt;br /&gt;
=== Design Strategy ===&lt;br /&gt;
* app/views/assignments/edit/_rubrics.html.erb&lt;br /&gt;
** PROBLEM: There is no way for the user to indicate that rubrics should vary by topic&lt;br /&gt;
*** SOLUTION: Add a new checkbox for whether or not rubrics vary by topic&lt;br /&gt;
&lt;br /&gt;
* app/views/assignments/edit.html.erb&lt;br /&gt;
** PROBLEM: We need to add content to the Topics tab, but unlike other tabs, this doesn't have it's own partial view to work with&lt;br /&gt;
*** SOLUTION: Break out code dealing with topics into app/views/assignments/edit/_topics.html.erb&lt;br /&gt;
&lt;br /&gt;
* app/views/assignments/edit/_topics.html.erb&lt;br /&gt;
** PROBLEM: There is no way for the user to select rubric(s) for a particular topic&lt;br /&gt;
*** SOLUTION: Add a new column in the topics table for choosing rubric(s)&lt;br /&gt;
**** New column only visible if rubrics vary by topic, per Rubrics tab&lt;br /&gt;
**** New column has multiple rounds per topic only if rubrics vary by round, per Rubrics tab&lt;br /&gt;
**** Default value for any rubric is that rubric which is shown on Rubrics tab&lt;br /&gt;
**** Rubrics in the dropdown(s) will be only those created by the currently logged in instructor&lt;br /&gt;
** PROBLEM: The code in app/views/assignments/edit/_rubrics.html.erb includes dropdowns like the ones we'll need to add for topics, but that code is not easy to work with (too heavy for a view, uses JavaScript)&lt;br /&gt;
*** SOLUTION: Use the code in app/views/assignments/edit/_rubrics.html.erb for inspiration only&lt;br /&gt;
**** Break as much actual work as possible out into helper methods that are simply called from this view&lt;br /&gt;
**** Views are not intended to do heavy lifting&lt;br /&gt;
**** Use as little JavaScript as possible&lt;br /&gt;
**** This is a Ruby On Rails project, not a JS project&lt;br /&gt;
&lt;br /&gt;
* app/helpers/assignment_helper.rb&lt;br /&gt;
** PROBLEM: The assignment_questionnaire method finds a questionnaire for a given assignment/round, and would be a great place to include code to find a questionnaire for a given assignment/round/topic, however the method is not easy to work with&lt;br /&gt;
*** SOLUTION: Improve readability of assignment_questionnaire method&lt;br /&gt;
**** Add comment block at the top describing the purpose and basic strategy of the method&lt;br /&gt;
**** Rename 'number' parameter to clarify the purpose of the parameter&lt;br /&gt;
*** SOLUTION: Expand functionality of assignment_questionnaire method&lt;br /&gt;
**** Add ability to get assignment questionnaires by topic as well as by round&lt;br /&gt;
**** Like round, topic parameter should be optional&lt;br /&gt;
&lt;br /&gt;
* spec/helpers&lt;br /&gt;
** PROBLEM: We are going to add code to app/helpers/assignment_helper.rb, but this helper does not have an RSpec test suite yet&lt;br /&gt;
*** SOLUTION: Add spec/helpers/assignment_helper_spec.rb file&lt;br /&gt;
**** Thoroughly test app/helpers/assignment_helper.rb assignment_questionnaire method&lt;br /&gt;
** PROBLEM: We may also need to create other helpers or helper methods as we get into the code&lt;br /&gt;
*** SOLUTION: Add tests for any newly created helpers or helper methods&lt;br /&gt;
&lt;br /&gt;
* db/migrate&lt;br /&gt;
** PROBLEM: Questionnaires (of which rubrics are one type) are not linked to assignment topics&lt;br /&gt;
*** SOLUTION: Create a new migration to link rubrics to topics&lt;br /&gt;
**** Create a new table named topic_questionnaire with fields:&lt;br /&gt;
***** id&lt;br /&gt;
***** topic_id&lt;br /&gt;
***** questionnaire_id&lt;br /&gt;
***** used_in_round&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
&lt;br /&gt;
In this section, we provide selected portions of modified code to illustrate how we implemented the new feature.&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
In this section, we list all files that were modified while implementing the new feature.&lt;br /&gt;
&lt;br /&gt;
* [to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
=== How To ===&lt;br /&gt;
&lt;br /&gt;
In this section, we describe how to use the newly implemented feature.&lt;br /&gt;
&lt;br /&gt;
==== Add a New Rubric ====&lt;br /&gt;
&lt;br /&gt;
* [to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
==== Select a Rubric for a Topic ====&lt;br /&gt;
&lt;br /&gt;
* [to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
== Project Testing ==&lt;br /&gt;
To test code implementation, correctness of the added feature, verify that the team did not break any existing functionalities in the Expertiza, and ensure that no bugs were introduced in the code, we utilized the following Test Strategy:&lt;br /&gt;
# Code inspection&lt;br /&gt;
# Run and pass existing RSpec Tests&lt;br /&gt;
# Develop New RSpec Tests&lt;br /&gt;
# Run through live UI to test a feature using Expertiza instance&lt;br /&gt;
&lt;br /&gt;
=== Rspec Testing ===&lt;br /&gt;
&lt;br /&gt;
Our strategy for gaining confidence that our code changes did not break anything was as follows:&lt;br /&gt;
* Run all existing RSpec tests on any changed files, after our changes, to ensure that we have not introduced any failures.&lt;br /&gt;
* The commands and results are shown below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  [to be populated after coding is complete]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Write new comprehensive RSpec tests, for all new methods.&lt;br /&gt;
* Run these tests, to ensure that the new code works as intended.&lt;br /&gt;
* The commands and results are shown below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  [to be populated after coding is complete]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The test suite for a single new method is below.&lt;br /&gt;
* There are many such suites in (TODO add filename(s)).  &lt;br /&gt;
* This example illustrates our general strategy:&lt;br /&gt;
** test missing input&lt;br /&gt;
** test bad input&lt;br /&gt;
** test various acceptable forms of input&lt;br /&gt;
** test scenarios that lead to &amp;quot;true&amp;quot; and to &amp;quot;false&amp;quot; return values&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  [to be populated after coding is complete]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== UI Testing ===&lt;br /&gt;
Here we describe UI Testing that has performed. Include Screenshots maybe?&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
== Useful Links ==&lt;br /&gt;
In this section we provide useful links related to the work that has been completed by our team.&lt;br /&gt;
# [https://github.com/gabalmat/expertiza Forked Project Repository]&lt;br /&gt;
# [(add link here) Pull Request]&lt;br /&gt;
# [(add link here) Video Demonstration of Specialized Rubrics]&lt;br /&gt;
# [(add link here) Video Demonstration of Passing Rspec Tests]&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Contacts ===&lt;br /&gt;
We have 4 (four) members in our team and 1 (one) mentor was also assigned to us. For any project-related questions/concerns please contact us:&lt;br /&gt;
* Aurora Tiffany-Davis - attiffan@ncsu.edu&lt;br /&gt;
* Ginger Balmat - gabalmat@ncsu.edu&lt;br /&gt;
* Joe Hutchinson - jehutch3@ncsu.edu&lt;br /&gt;
* Nikolay Titov - ngtitov@ncsu.edu&lt;br /&gt;
* Zhewei Hu (mentor) - zhu6@ncsu.edu&lt;br /&gt;
&lt;br /&gt;
=== Contribution Based Inquiry ===&lt;br /&gt;
For any questions or concerns related to the project design, implementation, testing of the feature developed by our team, please contact an engineer who worked closely on the topic of your interest based on the [https://docs.google.com/spreadsheets/d/11uxuI_5gaC-FQDwIOxtCaN3HZ9bfWDJgIjFemtYV5jE/edit?ts=5ca222f3#gid=0 Contribution Assignment Grid] we created to keep track of our progress and contribution. Please carbon copy all team members and our mentor in the email.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* Expertiza Web [https://github.com/expertiza/expertiza#expertiza]&lt;br /&gt;
* Expertiza on GitHub [https://github.com/expertiza/expertiza]&lt;br /&gt;
* Expertiza Wiki [http://wikis.lib.ncsu.edu/index.php/Expertiza]&lt;br /&gt;
* Rspec Documentation [https://relishapp.com/rspec]&lt;br /&gt;
* Wiki with Previous Work [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1873_Specialized_rubics_for_different_topic_types]&lt;br /&gt;
* Pull Request of the Previous Work [https://github.com/expertiza/expertiza/pull/1327]&lt;/div&gt;</summary>
		<author><name>Ngtitov</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics&amp;diff=123502</id>
		<title>E1936 Specialized Rubrics</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics&amp;diff=123502"/>
		<updated>2019-04-08T02:11:57Z</updated>

		<summary type="html">&lt;p&gt;Ngtitov: /* Previous Work */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page describes the work and goals that have been completed and achieved while implementing Expertiza Project &amp;quot;E1936. Specialized Rubrics for Different Topic Types (e.g., Servo project, refactoring project)&amp;quot; for the CSC/ECE 517 &amp;quot;Object-Oriented Design and Development&amp;quot; class, in the Spring semester of the 2019.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This Wiki page is created per CSC/ECE 517: &amp;quot;Object-Oriented Design and Development&amp;quot;, Expertiza Project requirements (Spring, 2019).&lt;br /&gt;
&lt;br /&gt;
Our [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Team team] was assigned the project &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936. Specialized rubrics for different topic types (e.g., Servo project, refactoring project)]&amp;quot;.  This is an Expertiza project.&lt;br /&gt;
&lt;br /&gt;
In this wiki page we describe the problem to be solved, how we solve that problem, and how we test our solution.  We also provide helpful links and contact information for our team.&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
In this section, we discuss the problem we need to solve, the Expertiza feature this problem is related to, what needs to be done to solve the problem (at a high level), and the previous attempt to solve this problem.&lt;br /&gt;
&lt;br /&gt;
=== Problem Statement ===&lt;br /&gt;
&lt;br /&gt;
This problem statement summarizes the problem as described in the project description &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936. Specialized rubrics for different topic types (e.g., Servo project, refactoring project)]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
In CSC/ECE 517, there are several types of topics that could be covered in a single class assignment.&lt;br /&gt;
* Code base&lt;br /&gt;
** Expertiza&lt;br /&gt;
** Mozilla&lt;br /&gt;
** etc.&lt;br /&gt;
* Goal&lt;br /&gt;
** Refactoring&lt;br /&gt;
** Testing&lt;br /&gt;
** etc.&lt;br /&gt;
However, currently we can only specify one kind of rubric for an assignment.  This means that teams working on different topics will be evaluated using the same rubric.  With this setup, it's not possible to fine-tune rubrics for different topics - rubrics tend to be overly general.&lt;br /&gt;
&lt;br /&gt;
=== Feature Description ===&lt;br /&gt;
&lt;br /&gt;
The feature we will add in this project is a feature to allow rubrics to vary not only by project phase, but also by topic.  This allows more flexibility to the instructor when setting up an assignment, so that they can use rubrics better suited to the tasks that students are performing in an assignment.&lt;br /&gt;
&lt;br /&gt;
When this feature is complete, the following scenarios will be possible, and the instructor will be the judge of which scenario is the best fit to the assignment:&lt;br /&gt;
&lt;br /&gt;
* One rubric for the assignment, period.&lt;br /&gt;
* A different rubric for each phase of the assignment, regardless of what topic different students are working on.&lt;br /&gt;
* A different rubric for each topic, regardless of the phases in the assignment.&lt;br /&gt;
* A different rubric for each phase of the assignment, and within a phase, a different rubric for each topic.&lt;br /&gt;
&lt;br /&gt;
=== What Needs to be Done ===&lt;br /&gt;
&lt;br /&gt;
This section summarizes the work as described in the project description &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936. Specialized rubrics for different topic types (e.g., Servo project, refactoring project)]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* In assignment#edit page &amp;quot;Rubrics&amp;quot; tab, add a checkbox to specify whether rubric should vary by topic.&lt;br /&gt;
* In assignment#edit page &amp;quot;Topics&amp;quot; tab, add dropdown(s) next to each topic to specify which rubric(s) are associated with the topic.&lt;br /&gt;
** The dropdown(s) should appear only if rubric should vary by topic, per the Rubrics tab.&lt;br /&gt;
** The topic should have a multiple dropdowns (one for each round) only if rubrics vary by round, per the Rubrics tab.&lt;br /&gt;
** By default, the rubric(s) for each course project will be the one(s) specified in “Rubrics” tab.&lt;br /&gt;
** The dropdown value can overwrite the default rubric.&lt;br /&gt;
* Be careful when making changes to the code&lt;br /&gt;
** The signup_sheet_controller should have as little to do as possible with the selection of rubrics.&lt;br /&gt;
** Anything not germane to selecting topics should be in another controller or (more probably) a helper.&lt;br /&gt;
* Create a DB migration to allow rubric to vary by topic as well as by round.&lt;br /&gt;
&lt;br /&gt;
==== Screenshots ====&lt;br /&gt;
'''Current screenshot of Rubrics tab for an Assignment'''&lt;br /&gt;
(need to add a checkbox to indicate that rubric should vary by topic)&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Screenshot Assignment Edit Rubrics.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Current screenshot of Topics tab for an Assignment'''&lt;br /&gt;
(need to add a way to select rubrics for particular topics)&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Screenshot Assignment Edit Topics.png]]&lt;br /&gt;
&lt;br /&gt;
=== Previous Work ===&lt;br /&gt;
There was previous attempt to implement this project in the Fall of 2018 semester by different team, but it was rejected due to several reasons. Our team was provided with all relevant information about the design and implementation of the previously attempted project. The following is the list of links with the relevant materials that we have used for better project understanding, determining pros and cons of proposed changes, and identifying any improvements:&lt;br /&gt;
&lt;br /&gt;
# [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1873_Specialized_rubics_for_different_topic_types Wiki]&lt;br /&gt;
# [https://github.com/expertiza/expertiza/pull/1327 Pull Request]&lt;br /&gt;
# [https://drive.google.com/file/d/1UrLb0Ula_Lb_F4MOrdC-s6xng6B08VYu/view Video Demo]&lt;br /&gt;
&lt;br /&gt;
After reviewing all relevant materials, we concluded that implementation of the project was incomplete and we found two main drawbacks that can be improved:&lt;br /&gt;
&lt;br /&gt;
* Per project requirement specifications, &amp;quot;''The dropdown box should appear only if 'Vary rubric by topic' is selected in the Rubrics tab.''&amp;quot; This requirement was not met and ''Vary rubric by topic'' checkbox in the Rubrics tab was not implemented at all. Therefore, dropdown box with the list of rubrics appears regardless of whether &amp;quot;''Vary rubric by topic''&amp;quot; is selected or not.&lt;br /&gt;
* The dropdown box includes the list of all possible rubrics including default value. However, this condition can be improved. The dropdown box should list the rubrics that were created by the current user (professor who is logged in). This would allow to shorten the list of possible rubrics dramatically and help to avoid any misunderstanding and confusion while user selects desired rubric for the course project.&lt;br /&gt;
&lt;br /&gt;
We found no further issues with the rest implementation and other project materials. Wiki page is very useful for understading design of proposed changes. However, our team decided to use slightly different approach than adding ''questionnaire_id'' in the ''sign_up_topics'' table to specify project's topic and its associated rubrics. Please see our [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Design_Strategy Design Strategy] for our proposed changes.&lt;br /&gt;
&lt;br /&gt;
== Project Implementation ==&lt;br /&gt;
&lt;br /&gt;
In this section, we discuss how we plan to implement our solution to the problem. &lt;br /&gt;
&lt;br /&gt;
=== Design Strategy ===&lt;br /&gt;
&lt;br /&gt;
* app/views/assignments/edit/_rubrics.html.erb&lt;br /&gt;
** PROBLEM: There is no way for the user to indicate that rubrics should vary by topic&lt;br /&gt;
*** SOLUTION: Add a new checkbox for whether or not rubrics vary by topic&lt;br /&gt;
&lt;br /&gt;
* app/views/assignments/edit.html.erb&lt;br /&gt;
** PROBLEM: We need to add content to the Topics tab, but unlike other tabs, this doesn't have it's own partial view to work with&lt;br /&gt;
*** SOLUTION: Break out code dealing with topics into app/views/assignments/edit/_topics.html.erb&lt;br /&gt;
&lt;br /&gt;
* app/views/assignments/edit/_topics.html.erb&lt;br /&gt;
** PROBLEM: There is no way for the user to select rubric(s) for a particular topic&lt;br /&gt;
*** SOLUTION: Add a new column in the topics table for choosing rubric(s)&lt;br /&gt;
**** New column only visible if rubrics vary by topic, per Rubrics tab&lt;br /&gt;
**** New column has multiple rounds per topic only if rubrics vary by round, per Rubrics tab&lt;br /&gt;
**** Default value for any rubric is that rubric which is shown on Rubrics tab&lt;br /&gt;
**** Rubrics in the dropdown(s) will be only those created by the currently logged in instructor&lt;br /&gt;
** PROBLEM: The code in app/views/assignments/edit/_rubrics.html.erb includes dropdowns like the ones we'll need to add for topics, but that code is not easy to work with (too heavy for a view, uses JavaScript)&lt;br /&gt;
*** SOLUTION: Use the code in app/views/assignments/edit/_rubrics.html.erb for inspiration only&lt;br /&gt;
**** Break as much actual work as possible out into helper methods that are simply called from this view&lt;br /&gt;
**** Views are not intended to do heavy lifting&lt;br /&gt;
**** Use as little JavaScript as possible&lt;br /&gt;
**** This is a Ruby On Rails project, not a JS project&lt;br /&gt;
&lt;br /&gt;
* app/helpers/assignment_helper.rb&lt;br /&gt;
** PROBLEM: The assignment_questionnaire method finds a questionnaire for a given assignment/round, and would be a great place to include code to find a questionnaire for a given assignment/round/topic, however the method is not easy to work with&lt;br /&gt;
*** SOLUTION: Improve readability of assignment_questionnaire method&lt;br /&gt;
**** Add comment block at the top describing the purpose and basic strategy of the method&lt;br /&gt;
**** Rename 'number' parameter to clarify the purpose of the parameter&lt;br /&gt;
*** SOLUTION: Expand functionality of assignment_questionnaire method&lt;br /&gt;
**** Add ability to get assignment questionnaires by topic as well as by round&lt;br /&gt;
**** Like round, topic parameter should be optional&lt;br /&gt;
&lt;br /&gt;
* spec/helpers&lt;br /&gt;
** PROBLEM: We are going to add code to app/helpers/assignment_helper.rb, but this helper does not have an RSpec test suite yet&lt;br /&gt;
*** SOLUTION: Add spec/helpers/assignment_helper_spec.rb file&lt;br /&gt;
**** Thoroughly test app/helpers/assignment_helper.rb assignment_questionnaire method&lt;br /&gt;
** PROBLEM: We may also need to create other helpers or helper methods as we get into the code&lt;br /&gt;
*** SOLUTION: Add tests for any newly created helpers or helper methods&lt;br /&gt;
&lt;br /&gt;
* db/migrate&lt;br /&gt;
** PROBLEM: Questionnaires (of which rubrics are one type) are not linked to assignment topics&lt;br /&gt;
*** SOLUTION: Create a new migration to link rubrics to topics&lt;br /&gt;
**** Create a new table named topic_questionnaire with fields:&lt;br /&gt;
***** id&lt;br /&gt;
***** topic_id&lt;br /&gt;
***** questionnaire_id&lt;br /&gt;
***** used_in_round&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
&lt;br /&gt;
In this section, we provide selected portions of modified code to illustrate how we implemented the new feature.&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
In this section, we list all files that were modified while implementing the new feature.&lt;br /&gt;
&lt;br /&gt;
* [to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
=== How To ===&lt;br /&gt;
&lt;br /&gt;
In this section, we describe how to use the newly implemented feature.&lt;br /&gt;
&lt;br /&gt;
==== Add a New Rubric ====&lt;br /&gt;
&lt;br /&gt;
* [to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
==== Select a Rubric for a Topic ====&lt;br /&gt;
&lt;br /&gt;
* [to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
== Project Testing ==&lt;br /&gt;
To test code implementation, correctness of the added feature, verify that the team did not break any existing functionalities in the Expertiza, and ensure that no bugs were introduced in the code, we utilized the following Test Strategy:&lt;br /&gt;
# Code inspection&lt;br /&gt;
# Run and pass existing RSpec Tests&lt;br /&gt;
# Develop New RSpec Tests&lt;br /&gt;
# Run through live UI to test a feature using Expertiza instance&lt;br /&gt;
&lt;br /&gt;
=== Rspec Testing ===&lt;br /&gt;
&lt;br /&gt;
Our strategy for gaining confidence that our code changes did not break anything was as follows:&lt;br /&gt;
* Run all existing RSpec tests on any changed files, after our changes, to ensure that we have not introduced any failures.&lt;br /&gt;
* The commands and results are shown below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  [to be populated after coding is complete]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Write new comprehensive RSpec tests, for all new methods.&lt;br /&gt;
* Run these tests, to ensure that the new code works as intended.&lt;br /&gt;
* The commands and results are shown below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  [to be populated after coding is complete]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The test suite for a single new method is below.&lt;br /&gt;
* There are many such suites in (TODO add filename(s)).  &lt;br /&gt;
* This example illustrates our general strategy:&lt;br /&gt;
** test missing input&lt;br /&gt;
** test bad input&lt;br /&gt;
** test various acceptable forms of input&lt;br /&gt;
** test scenarios that lead to &amp;quot;true&amp;quot; and to &amp;quot;false&amp;quot; return values&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  [to be populated after coding is complete]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== UI Testing ===&lt;br /&gt;
Here we describe UI Testing that has performed. Include Screenshots maybe?&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
== Useful Links ==&lt;br /&gt;
In this section we provide useful links related to the work that has been completed by our team.&lt;br /&gt;
# [https://github.com/gabalmat/expertiza Forked Project Repository]&lt;br /&gt;
# [(add link here) Pull Request]&lt;br /&gt;
# [(add link here) Video Demonstration of Specialized Rubrics]&lt;br /&gt;
# [(add link here) Video Demonstration of Passing Rspec Tests]&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Contacts ===&lt;br /&gt;
We have 4 (four) members in our team and 1 (one) mentor was also assigned to us. For any project-related questions/concerns please contact us:&lt;br /&gt;
* Aurora Tiffany-Davis - attiffan@ncsu.edu&lt;br /&gt;
* Ginger Balmat - gabalmat@ncsu.edu&lt;br /&gt;
* Joe Hutchinson - jehutch3@ncsu.edu&lt;br /&gt;
* Nikolay Titov - ngtitov@ncsu.edu&lt;br /&gt;
* Zhewei Hu (mentor) - zhu6@ncsu.edu&lt;br /&gt;
&lt;br /&gt;
=== Contribution Based Inquiry ===&lt;br /&gt;
For any questions or concerns related to the project design, implementation, testing of the feature developed by our team, please contact an engineer who worked closely on the topic of your interest based on the [https://docs.google.com/spreadsheets/d/11uxuI_5gaC-FQDwIOxtCaN3HZ9bfWDJgIjFemtYV5jE/edit?ts=5ca222f3#gid=0 Contribution Assignment Grid] we created to keep track of our progress and contribution. Please carbon copy all team members and our mentor in the email.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* Expertiza Web [https://github.com/expertiza/expertiza#expertiza]&lt;br /&gt;
* Expertiza on GitHub [https://github.com/expertiza/expertiza]&lt;br /&gt;
* Expertiza Wiki [http://wikis.lib.ncsu.edu/index.php/Expertiza]&lt;br /&gt;
* Rspec Documentation [https://relishapp.com/rspec]&lt;br /&gt;
* Wiki with Previous Work [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1873_Specialized_rubics_for_different_topic_types]&lt;br /&gt;
* Pull Request of the Previous Work [https://github.com/expertiza/expertiza/pull/1327]&lt;/div&gt;</summary>
		<author><name>Ngtitov</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics&amp;diff=123487</id>
		<title>E1936 Specialized Rubrics</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics&amp;diff=123487"/>
		<updated>2019-04-08T01:59:57Z</updated>

		<summary type="html">&lt;p&gt;Ngtitov: /* Previous Work */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page describes the work and goals that have been completed and achieved while implementing Expertiza Project &amp;quot;E1936. Specialized Rubrics for Different Topic Types (e.g., Servo project, refactoring project)&amp;quot; for the CSC/ECE 517 &amp;quot;Object-Oriented Design and Development&amp;quot; class, in the Spring semester of the 2019.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This Wiki page is created per CSC/ECE 517: &amp;quot;Object-Oriented Design and Development&amp;quot;, Expertiza Project requirements (Spring, 2019).&lt;br /&gt;
&lt;br /&gt;
Our [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Team team] was assigned the project &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936. Specialized rubrics for different topic types (e.g., Servo project, refactoring project)]&amp;quot;.  This is an Expertiza project.&lt;br /&gt;
&lt;br /&gt;
In this wiki page we describe the problem to be solved, how we solve that problem, and how we test our solution.  We also provide helpful links and contact information for our team.&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
In this section, we discuss the problem we need to solve, the Expertiza feature this problem is related to, what needs to be done to solve the problem (at a high level), and the previous attempt to solve this problem.&lt;br /&gt;
&lt;br /&gt;
=== Problem Statement ===&lt;br /&gt;
&lt;br /&gt;
This problem statement summarizes the problem as described in the project description &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936. Specialized rubrics for different topic types (e.g., Servo project, refactoring project)]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
In CSC/ECE 517, there are several types of topics that could be covered in a single class assignment.&lt;br /&gt;
* Code base&lt;br /&gt;
** Expertiza&lt;br /&gt;
** Mozilla&lt;br /&gt;
** etc.&lt;br /&gt;
* Goal&lt;br /&gt;
** Refactoring&lt;br /&gt;
** Testing&lt;br /&gt;
** etc.&lt;br /&gt;
However, currently we can only specify one kind of rubric for an assignment.  This means that teams working on different topics will be evaluated using the same rubric.  With this setup, it's not possible to fine-tune rubrics for different topics - rubrics tend to be overly general.&lt;br /&gt;
&lt;br /&gt;
=== Feature Description ===&lt;br /&gt;
&lt;br /&gt;
The feature we will add in this project is a feature to allow rubrics to vary not only by project phase, but also by topic.  This allows more flexibility to the instructor when setting up an assignment, so that they can use rubrics better suited to the tasks that students are performing in an assignment.&lt;br /&gt;
&lt;br /&gt;
When this feature is complete, the following scenarios will be possible, and the instructor will be the judge of which scenario is the best fit to the assignment:&lt;br /&gt;
&lt;br /&gt;
* One rubric for the assignment, period.&lt;br /&gt;
* A different rubric for each phase of the assignment, regardless of what topic different students are working on.&lt;br /&gt;
* A different rubric for each topic, regardless of the phases in the assignment.&lt;br /&gt;
* A different rubric for each phase of the assignment, and within a phase, a different rubric for each topic.&lt;br /&gt;
&lt;br /&gt;
=== What Needs to be Done ===&lt;br /&gt;
&lt;br /&gt;
This section summarizes the work as described in the project description &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936. Specialized rubrics for different topic types (e.g., Servo project, refactoring project)]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* In assignment#edit page &amp;quot;Rubrics&amp;quot; tab, add a checkbox to specify whether rubric should vary by topic.&lt;br /&gt;
* In assignment#edit page &amp;quot;Topics&amp;quot; tab, add dropdown(s) next to each topic to specify which rubric(s) are associated with the topic.&lt;br /&gt;
** The dropdown(s) should appear only if rubric should vary by topic, per the Rubrics tab.&lt;br /&gt;
** The topic should have a multiple dropdowns (one for each round) only if rubrics vary by round, per the Rubrics tab.&lt;br /&gt;
** By default, the rubric(s) for each course project will be the one(s) specified in “Rubrics” tab.&lt;br /&gt;
** The dropdown value can overwrite the default rubric.&lt;br /&gt;
* Be careful when making changes to the code&lt;br /&gt;
** The signup_sheet_controller should have as little to do as possible with the selection of rubrics.&lt;br /&gt;
** Anything not germane to selecting topics should be in another controller or (more probably) a helper.&lt;br /&gt;
* Create a DB migration to allow rubric to vary by topic as well as by round.&lt;br /&gt;
&lt;br /&gt;
==== Screenshots ====&lt;br /&gt;
'''Current screenshot of Rubrics tab for an Assignment'''&lt;br /&gt;
(need to add a checkbox to indicate that rubric should vary by topic)&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Screenshot Assignment Edit Rubrics.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Current screenshot of Topics tab for an Assignment'''&lt;br /&gt;
(need to add a way to select rubrics for particular topics)&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Screenshot Assignment Edit Topics.png]]&lt;br /&gt;
&lt;br /&gt;
=== Previous Work ===&lt;br /&gt;
There was previous attempt to implement this project in the Fall of 2018 semester by different team, but it was rejected due to several reasons. Our team was provided with all relevant information about the design and implementation of the previously attempted project. The following is the list of links with the relevant materials that we have used for better project understanding, determining pros and cons of proposed changes, and identifying any improvements:&lt;br /&gt;
&lt;br /&gt;
# [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1873_Specialized_rubics_for_different_topic_types Wiki]&lt;br /&gt;
# [https://github.com/expertiza/expertiza/pull/1327 Pull Request]&lt;br /&gt;
# [https://drive.google.com/file/d/1UrLb0Ula_Lb_F4MOrdC-s6xng6B08VYu/view Video Demo]&lt;br /&gt;
&lt;br /&gt;
After reviewing all relevant materials, we concluded that implementation of the project was incomplete and we found two main drawbacks that can be improved:&lt;br /&gt;
&lt;br /&gt;
* Per project requirement specifications, &amp;quot;''The dropdown box should appear only if 'Vary rubric by topic' is selected in the Rubrics tab.''&amp;quot; This requirement was not met and dropdown box with the list of rubrics appears regardless of whether &amp;quot;''Vary rubric by topic''&amp;quot; checkbox is selected or not.&lt;br /&gt;
* The dropdown box includes the list of all possible rubrics including default value. However, this condition can be improved. The dropdown box should list the rubrics that were created by the current user (professor who is logged in). This would allow to shorten the list of possible rubrics dramatically and help to avoid any misunderstanding and confusion while user selects desired rubric for the course project.&lt;br /&gt;
&lt;br /&gt;
We found no further issues with the rest implementation and other project materials. Wiki page is very useful for understading design of proposed changes. However, our team decided to use slightly different approach than adding ''questionnaire_id'' in the ''sign_up_topics'' table to specify project's topic and its associated rubrics. Please see our [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Design_Strategy Design Strategy] for our proposed changes.&lt;br /&gt;
&lt;br /&gt;
== Project Implementation ==&lt;br /&gt;
&lt;br /&gt;
In this section, we discuss how we plan to implement our solution to the problem. &lt;br /&gt;
&lt;br /&gt;
=== Design Strategy ===&lt;br /&gt;
&lt;br /&gt;
* app/views/assignments/edit/_rubrics.html.erb&lt;br /&gt;
** PROBLEM: There is no way for the user to indicate that rubrics should vary by topic&lt;br /&gt;
*** SOLUTION: Add a new checkbox for whether or not rubrics vary by topic&lt;br /&gt;
&lt;br /&gt;
* app/views/assignments/edit.html.erb&lt;br /&gt;
** PROBLEM: We need to add content to the Topics tab, but unlike other tabs, this doesn't have it's own partial view to work with&lt;br /&gt;
*** SOLUTION: Break out code dealing with topics into app/views/assignments/edit/_topics.html.erb&lt;br /&gt;
&lt;br /&gt;
* app/views/assignments/edit/_topics.html.erb&lt;br /&gt;
** PROBLEM: There is no way for the user to select rubric(s) for a particular topic&lt;br /&gt;
*** SOLUTION: Add a new column in the topics table for choosing rubric(s)&lt;br /&gt;
**** New column only visible if rubrics vary by topic, per Rubrics tab&lt;br /&gt;
**** New column has multiple rounds per topic only if rubrics vary by round, per Rubrics tab&lt;br /&gt;
**** Default value for any rubric is that rubric which is shown on Rubrics tab&lt;br /&gt;
**** Rubrics in the dropdown(s) will be only those created by the currently logged in instructor&lt;br /&gt;
** PROBLEM: The code in app/views/assignments/edit/_rubrics.html.erb includes dropdowns like the ones we'll need to add for topics, but that code is not easy to work with (too heavy for a view, uses JavaScript)&lt;br /&gt;
*** SOLUTION: Use the code in app/views/assignments/edit/_rubrics.html.erb for inspiration only&lt;br /&gt;
**** Break as much actual work as possible out into helper methods that are simply called from this view&lt;br /&gt;
**** Views are not intended to do heavy lifting&lt;br /&gt;
**** Use as little JavaScript as possible&lt;br /&gt;
**** This is a Ruby On Rails project, not a JS project&lt;br /&gt;
&lt;br /&gt;
* app/helpers/assignment_helper.rb&lt;br /&gt;
** PROBLEM: The assignment_questionnaire method finds a questionnaire for a given assignment/round, and would be a great place to include code to find a questionnaire for a given assignment/round/topic, however the method is not easy to work with&lt;br /&gt;
*** SOLUTION: Improve readability of assignment_questionnaire method&lt;br /&gt;
**** Add comment block at the top describing the purpose and basic strategy of the method&lt;br /&gt;
**** Rename 'number' parameter to clarify the purpose of the parameter&lt;br /&gt;
*** SOLUTION: Expand functionality of assignment_questionnaire method&lt;br /&gt;
**** Add ability to get assignment questionnaires by topic as well as by round&lt;br /&gt;
**** Like round, topic parameter should be optional&lt;br /&gt;
&lt;br /&gt;
* spec/helpers&lt;br /&gt;
** PROBLEM: We are going to add code to app/helpers/assignment_helper.rb, but this helper does not have an RSpec test suite yet&lt;br /&gt;
*** SOLUTION: Add spec/helpers/assignment_helper_spec.rb file&lt;br /&gt;
**** Thoroughly test app/helpers/assignment_helper.rb assignment_questionnaire method&lt;br /&gt;
** PROBLEM: We may also need to create other helpers or helper methods as we get into the code&lt;br /&gt;
*** SOLUTION: Add tests for any newly created helpers or helper methods&lt;br /&gt;
&lt;br /&gt;
* db/migrate&lt;br /&gt;
** PROBLEM: Questionnaires (of which rubrics are one type) are not linked to assignment topics&lt;br /&gt;
*** SOLUTION: Create a new migration to link rubrics to topics&lt;br /&gt;
**** Create a new table named topic_questionnaire with fields:&lt;br /&gt;
***** id&lt;br /&gt;
***** topic_id&lt;br /&gt;
***** questionnaire_id&lt;br /&gt;
***** used_in_round&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
&lt;br /&gt;
In this section, we provide selected portions of modified code to illustrate how we implemented the new feature.&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
In this section, we list all files that were modified while implementing the new feature.&lt;br /&gt;
&lt;br /&gt;
* [to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
=== How To ===&lt;br /&gt;
&lt;br /&gt;
In this section, we describe how to use the newly implemented feature.&lt;br /&gt;
&lt;br /&gt;
==== Add a New Rubric ====&lt;br /&gt;
&lt;br /&gt;
* [to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
==== Select a Rubric for a Topic ====&lt;br /&gt;
&lt;br /&gt;
* [to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
== Project Testing ==&lt;br /&gt;
To test code implementation, correctness of the added feature, verify that the team did not break any existing functionalities in the Expertiza, and ensure that no bugs were introduced in the code, we utilized the following Test Strategy:&lt;br /&gt;
# Code inspection&lt;br /&gt;
# Run and pass existing RSpec Tests&lt;br /&gt;
# Develop New RSpec Tests&lt;br /&gt;
# Run through live UI to test a feature using Expertiza instance&lt;br /&gt;
&lt;br /&gt;
=== Rspec Testing ===&lt;br /&gt;
&lt;br /&gt;
Our strategy for gaining confidence that our code changes did not break anything was as follows:&lt;br /&gt;
* Run all existing RSpec tests on any changed files, after our changes, to ensure that we have not introduced any failures.&lt;br /&gt;
* The commands and results are shown below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  [to be populated after coding is complete]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Write new comprehensive RSpec tests, for all new methods.&lt;br /&gt;
* Run these tests, to ensure that the new code works as intended.&lt;br /&gt;
* The commands and results are shown below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  [to be populated after coding is complete]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The test suite for a single new method is below.&lt;br /&gt;
* There are many such suites in (TODO add filename(s)).  &lt;br /&gt;
* This example illustrates our general strategy:&lt;br /&gt;
** test missing input&lt;br /&gt;
** test bad input&lt;br /&gt;
** test various acceptable forms of input&lt;br /&gt;
** test scenarios that lead to &amp;quot;true&amp;quot; and to &amp;quot;false&amp;quot; return values&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  [to be populated after coding is complete]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== UI Testing ===&lt;br /&gt;
Here we describe UI Testing that has performed. Include Screenshots maybe?&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
== Useful Links ==&lt;br /&gt;
In this section we provide useful links related to the work that has been completed by our team.&lt;br /&gt;
# [https://github.com/gabalmat/expertiza Forked Project Repository]&lt;br /&gt;
# [(add link here) Pull Request]&lt;br /&gt;
# [(add link here) Video Demonstration of Specialized Rubrics]&lt;br /&gt;
# [(add link here) Video Demonstration of Passing Rspec Tests]&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Contacts ===&lt;br /&gt;
We have 4 (four) members in our team and 1 (one) mentor was also assigned to us. For any project-related questions/concerns please contact us:&lt;br /&gt;
* Aurora Tiffany-Davis - attiffan@ncsu.edu&lt;br /&gt;
* Ginger Balmat - gabalmat@ncsu.edu&lt;br /&gt;
* Joe Hutchinson - jehutch3@ncsu.edu&lt;br /&gt;
* Nikolay Titov - ngtitov@ncsu.edu&lt;br /&gt;
* Zhewei Hu (mentor) - zhu6@ncsu.edu&lt;br /&gt;
&lt;br /&gt;
=== Contribution Based Inquiry ===&lt;br /&gt;
For any questions or concerns related to the project design, implementation, testing of the feature developed by our team, please contact an engineer who worked closely on the topic of your interest based on the [https://docs.google.com/spreadsheets/d/11uxuI_5gaC-FQDwIOxtCaN3HZ9bfWDJgIjFemtYV5jE/edit?ts=5ca222f3#gid=0 Contribution Assignment Grid] we created to keep track of our progress and contribution. Please carbon copy all team members and our mentor in the email.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* Expertiza Web [https://github.com/expertiza/expertiza#expertiza]&lt;br /&gt;
* Expertiza on GitHub [https://github.com/expertiza/expertiza]&lt;br /&gt;
* Expertiza Wiki [http://wikis.lib.ncsu.edu/index.php/Expertiza]&lt;br /&gt;
* Rspec Documentation [https://relishapp.com/rspec]&lt;br /&gt;
* Wiki with Previous Work [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1873_Specialized_rubics_for_different_topic_types]&lt;br /&gt;
* Pull Request of the Previous Work [https://github.com/expertiza/expertiza/pull/1327]&lt;/div&gt;</summary>
		<author><name>Ngtitov</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics&amp;diff=123485</id>
		<title>E1936 Specialized Rubrics</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics&amp;diff=123485"/>
		<updated>2019-04-08T01:51:10Z</updated>

		<summary type="html">&lt;p&gt;Ngtitov: /* Previous Work */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page describes the work and goals that have been completed and achieved while implementing Expertiza Project &amp;quot;E1936. Specialized Rubrics for Different Topic Types (e.g., Servo project, refactoring project)&amp;quot; for the CSC/ECE 517 &amp;quot;Object-Oriented Design and Development&amp;quot; class, in the Spring semester of the 2019.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This Wiki page is created per CSC/ECE 517: &amp;quot;Object-Oriented Design and Development&amp;quot;, Expertiza Project requirements (Spring, 2019).&lt;br /&gt;
&lt;br /&gt;
Our [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Team team] was assigned the project &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936. Specialized rubrics for different topic types (e.g., Servo project, refactoring project)]&amp;quot;.  This is an Expertiza project.&lt;br /&gt;
&lt;br /&gt;
In this wiki page we describe the problem to be solved, how we solve that problem, and how we test our solution.  We also provide helpful links and contact information for our team.&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
In this section, we discuss the problem we need to solve, the Expertiza feature this problem is related to, what needs to be done to solve the problem (at a high level), and the previous attempt to solve this problem.&lt;br /&gt;
&lt;br /&gt;
=== Problem Statement ===&lt;br /&gt;
&lt;br /&gt;
This problem statement summarizes the problem as described in the project description &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936. Specialized rubrics for different topic types (e.g., Servo project, refactoring project)]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
In CSC/ECE 517, there are several types of topics that could be covered in a single class assignment.&lt;br /&gt;
* Code base&lt;br /&gt;
** Expertiza&lt;br /&gt;
** Mozilla&lt;br /&gt;
** etc.&lt;br /&gt;
* Goal&lt;br /&gt;
** Refactoring&lt;br /&gt;
** Testing&lt;br /&gt;
** etc.&lt;br /&gt;
However, currently we can only specify one kind of rubric for an assignment.  This means that teams working on different topics will be evaluated using the same rubric.  With this setup, it's not possible to fine-tune rubrics for different topics - rubrics tend to be overly general.&lt;br /&gt;
&lt;br /&gt;
=== Feature Description ===&lt;br /&gt;
&lt;br /&gt;
The feature we will add in this project is a feature to allow rubrics to vary not only by project phase, but also by topic.  This allows more flexibility to the instructor when setting up an assignment, so that they can use rubrics better suited to the tasks that students are performing in an assignment.&lt;br /&gt;
&lt;br /&gt;
When this feature is complete, the following scenarios will be possible, and the instructor will be the judge of which scenario is the best fit to the assignment:&lt;br /&gt;
&lt;br /&gt;
* One rubric for the assignment, period.&lt;br /&gt;
* A different rubric for each phase of the assignment, regardless of what topic different students are working on.&lt;br /&gt;
* A different rubric for each topic, regardless of the phases in the assignment.&lt;br /&gt;
* A different rubric for each phase of the assignment, and within a phase, a different rubric for each topic.&lt;br /&gt;
&lt;br /&gt;
=== What Needs to be Done ===&lt;br /&gt;
&lt;br /&gt;
This section summarizes the work as described in the project description &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936. Specialized rubrics for different topic types (e.g., Servo project, refactoring project)]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* In assignment#edit page &amp;quot;Rubrics&amp;quot; tab, add a checkbox to specify whether rubric should vary by topic.&lt;br /&gt;
* In assignment#edit page &amp;quot;Topics&amp;quot; tab, add dropdown(s) next to each topic to specify which rubric(s) are associated with the topic.&lt;br /&gt;
** The dropdown(s) should appear only if rubric should vary by topic, per the Rubrics tab.&lt;br /&gt;
** The topic should have a multiple dropdowns (one for each round) only if rubrics vary by round, per the Rubrics tab.&lt;br /&gt;
** By default, the rubric(s) for each course project will be the one(s) specified in “Rubrics” tab.&lt;br /&gt;
** The dropdown value can overwrite the default rubric.&lt;br /&gt;
* Be careful when making changes to the code&lt;br /&gt;
** The signup_sheet_controller should have as little to do as possible with the selection of rubrics.&lt;br /&gt;
** Anything not germane to selecting topics should be in another controller or (more probably) a helper.&lt;br /&gt;
* Create a DB migration to allow rubric to vary by topic as well as by round.&lt;br /&gt;
&lt;br /&gt;
==== Screenshots ====&lt;br /&gt;
'''Current screenshot of Rubrics tab for an Assignment'''&lt;br /&gt;
(need to add a checkbox to indicate that rubric should vary by topic)&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Screenshot Assignment Edit Rubrics.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Current screenshot of Topics tab for an Assignment'''&lt;br /&gt;
(need to add a way to select rubrics for particular topics)&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Screenshot Assignment Edit Topics.png]]&lt;br /&gt;
&lt;br /&gt;
=== Previous Work ===&lt;br /&gt;
There was previous attempt to implement this project in the Fall of 2018 semester by different team, but it was rejected due to several reasons. Our team was provided with all relevant information about the design and implementation of the previously attempted project. The following is the list of links with the relevant materials that we have used for better project understanding, determining pros and cons of proposed changes, and identifying any improvements:&lt;br /&gt;
&lt;br /&gt;
# [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1873_Specialized_rubics_for_different_topic_types Wiki]&lt;br /&gt;
# [https://github.com/expertiza/expertiza/pull/1327 Pull Request]&lt;br /&gt;
# [https://drive.google.com/file/d/1UrLb0Ula_Lb_F4MOrdC-s6xng6B08VYu/view Video Demo]&lt;br /&gt;
&lt;br /&gt;
After reviewing all relevant materials, we concluded that implementation of the project was incomplete and we found two main drawbacks that we can improve:&lt;br /&gt;
&lt;br /&gt;
* Per project requirement specifications, &amp;quot;''The dropdown box should appear only if 'Vary rubric by topic' is selected in the Rubrics tab.''&amp;quot; This requirement was not met and dropdown box with the list of rubrics appears regardless of whether &amp;quot;''Vary rubric by topic''&amp;quot; checkbox is selected or not.&lt;br /&gt;
* The dropdown box includes the list of all possible rubrics including default value. However, this condition can be improved. The dropdown box should list the rubrics that were created by the current user (professor who is logged in). This would allow to shorten the list of possible rubrics dramatically and help to avoid any misunderstanding and confusion while user selects desired rubric for the course project.&lt;br /&gt;
&lt;br /&gt;
We found no further issues with the rest implementation and other project materials. Wiki page is very useful for understading design of proposed changes. However, our team decided to use slightly different approach than adding ''questionnaire_id'' in the ''sign_up_topics'' table to specify project's topic and its associated rubrics. Please see our [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Design_Strategy Design Strategy] for our proposed changes.&lt;br /&gt;
&lt;br /&gt;
== Project Implementation ==&lt;br /&gt;
&lt;br /&gt;
In this section, we discuss how we plan to implement our solution to the problem. &lt;br /&gt;
&lt;br /&gt;
=== Design Strategy ===&lt;br /&gt;
&lt;br /&gt;
* app/views/assignments/edit/_rubrics.html.erb&lt;br /&gt;
** PROBLEM: There is no way for the user to indicate that rubrics should vary by topic&lt;br /&gt;
*** SOLUTION: Add a new checkbox for whether or not rubrics vary by topic&lt;br /&gt;
&lt;br /&gt;
* app/views/assignments/edit.html.erb&lt;br /&gt;
** PROBLEM: We need to add content to the Topics tab, but unlike other tabs, this doesn't have it's own partial view to work with&lt;br /&gt;
*** SOLUTION: Break out code dealing with topics into app/views/assignments/edit/_topics.html.erb&lt;br /&gt;
&lt;br /&gt;
* app/views/assignments/edit/_topics.html.erb&lt;br /&gt;
** PROBLEM: There is no way for the user to select rubric(s) for a particular topic&lt;br /&gt;
*** SOLUTION: Add a new column in the topics table for choosing rubric(s)&lt;br /&gt;
**** New column only visible if rubrics vary by topic, per Rubrics tab&lt;br /&gt;
**** New column has multiple rounds per topic only if rubrics vary by round, per Rubrics tab&lt;br /&gt;
**** Default value for any rubric is that rubric which is shown on Rubrics tab&lt;br /&gt;
**** Rubrics in the dropdown(s) will be only those created by the currently logged in instructor&lt;br /&gt;
** PROBLEM: The code in app/views/assignments/edit/_rubrics.html.erb includes dropdowns like the ones we'll need to add for topics, but that code is not easy to work with (too heavy for a view, uses JavaScript)&lt;br /&gt;
*** SOLUTION: Use the code in app/views/assignments/edit/_rubrics.html.erb for inspiration only&lt;br /&gt;
**** Break as much actual work as possible out into helper methods that are simply called from this view&lt;br /&gt;
**** Views are not intended to do heavy lifting&lt;br /&gt;
**** Use as little JavaScript as possible&lt;br /&gt;
**** This is a Ruby On Rails project, not a JS project&lt;br /&gt;
&lt;br /&gt;
* app/helpers/assignment_helper.rb&lt;br /&gt;
** PROBLEM: The assignment_questionnaire method finds a questionnaire for a given assignment/round, and would be a great place to include code to find a questionnaire for a given assignment/round/topic, however the method is not easy to work with&lt;br /&gt;
*** SOLUTION: Improve readability of assignment_questionnaire method&lt;br /&gt;
**** Add comment block at the top describing the purpose and basic strategy of the method&lt;br /&gt;
**** Rename 'number' parameter to clarify the purpose of the parameter&lt;br /&gt;
*** SOLUTION: Expand functionality of assignment_questionnaire method&lt;br /&gt;
**** Add ability to get assignment questionnaires by topic as well as by round&lt;br /&gt;
**** Like round, topic parameter should be optional&lt;br /&gt;
&lt;br /&gt;
* spec/helpers&lt;br /&gt;
** PROBLEM: We are going to add code to app/helpers/assignment_helper.rb, but this helper does not have an RSpec test suite yet&lt;br /&gt;
*** SOLUTION: Add spec/helpers/assignment_helper_spec.rb file&lt;br /&gt;
**** Thoroughly test app/helpers/assignment_helper.rb assignment_questionnaire method&lt;br /&gt;
** PROBLEM: We may also need to create other helpers or helper methods as we get into the code&lt;br /&gt;
*** SOLUTION: Add tests for any newly created helpers or helper methods&lt;br /&gt;
&lt;br /&gt;
* db/migrate&lt;br /&gt;
** PROBLEM: Questionnaires (of which rubrics are one type) are not linked to assignment topics&lt;br /&gt;
*** SOLUTION: Create a new migration to link rubrics to topics&lt;br /&gt;
**** Create a new table named topic_questionnaire with fields:&lt;br /&gt;
***** id&lt;br /&gt;
***** topic_id&lt;br /&gt;
***** questionnaire_id&lt;br /&gt;
***** used_in_round&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
&lt;br /&gt;
In this section, we provide selected portions of modified code to illustrate how we implemented the new feature.&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
In this section, we list all files that were modified while implementing the new feature.&lt;br /&gt;
&lt;br /&gt;
* [to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
=== How To ===&lt;br /&gt;
&lt;br /&gt;
In this section, we describe how to use the newly implemented feature.&lt;br /&gt;
&lt;br /&gt;
==== Add a New Rubric ====&lt;br /&gt;
&lt;br /&gt;
* [to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
==== Select a Rubric for a Topic ====&lt;br /&gt;
&lt;br /&gt;
* [to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
== Project Testing ==&lt;br /&gt;
To test code implementation, correctness of the added feature, verify that the team did not break any existing functionalities in the Expertiza, and ensure that no bugs were introduced in the code, we utilized the following Test Strategy:&lt;br /&gt;
# Code inspection&lt;br /&gt;
# Run and pass existing RSpec Tests&lt;br /&gt;
# Develop New RSpec Tests&lt;br /&gt;
# Run through live UI to test a feature using Expertiza instance&lt;br /&gt;
&lt;br /&gt;
=== Rspec Testing ===&lt;br /&gt;
&lt;br /&gt;
Our strategy for gaining confidence that our code changes did not break anything was as follows:&lt;br /&gt;
* Run all existing RSpec tests on any changed files, after our changes, to ensure that we have not introduced any failures.&lt;br /&gt;
* The commands and results are shown below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  [to be populated after coding is complete]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Write new comprehensive RSpec tests, for all new methods.&lt;br /&gt;
* Run these tests, to ensure that the new code works as intended.&lt;br /&gt;
* The commands and results are shown below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  [to be populated after coding is complete]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The test suite for a single new method is below.&lt;br /&gt;
* There are many such suites in (TODO add filename(s)).  &lt;br /&gt;
* This example illustrates our general strategy:&lt;br /&gt;
** test missing input&lt;br /&gt;
** test bad input&lt;br /&gt;
** test various acceptable forms of input&lt;br /&gt;
** test scenarios that lead to &amp;quot;true&amp;quot; and to &amp;quot;false&amp;quot; return values&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  [to be populated after coding is complete]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== UI Testing ===&lt;br /&gt;
Here we describe UI Testing that has performed. Include Screenshots maybe?&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
== Useful Links ==&lt;br /&gt;
In this section we provide useful links related to the work that has been completed by our team.&lt;br /&gt;
# [https://github.com/gabalmat/expertiza Forked Project Repository]&lt;br /&gt;
# [(add link here) Pull Request]&lt;br /&gt;
# [(add link here) Video Demonstration of Specialized Rubrics]&lt;br /&gt;
# [(add link here) Video Demonstration of Passing Rspec Tests]&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Contacts ===&lt;br /&gt;
We have 4 (four) members in our team and 1 (one) mentor was also assigned to us. For any project-related questions/concerns please contact us:&lt;br /&gt;
* Aurora Tiffany-Davis - attiffan@ncsu.edu&lt;br /&gt;
* Ginger Balmat - gabalmat@ncsu.edu&lt;br /&gt;
* Joe Hutchinson - jehutch3@ncsu.edu&lt;br /&gt;
* Nikolay Titov - ngtitov@ncsu.edu&lt;br /&gt;
* Zhewei Hu (mentor) - zhu6@ncsu.edu&lt;br /&gt;
&lt;br /&gt;
=== Contribution Based Inquiry ===&lt;br /&gt;
For any questions or concerns related to the project design, implementation, testing of the feature developed by our team, please contact an engineer who worked closely on the topic of your interest based on the [https://docs.google.com/spreadsheets/d/11uxuI_5gaC-FQDwIOxtCaN3HZ9bfWDJgIjFemtYV5jE/edit?ts=5ca222f3#gid=0 Contribution Assignment Grid] we created to keep track of our progress and contribution. Please carbon copy all team members and our mentor in the email.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* Expertiza Web [https://github.com/expertiza/expertiza#expertiza]&lt;br /&gt;
* Expertiza on GitHub [https://github.com/expertiza/expertiza]&lt;br /&gt;
* Expertiza Wiki [http://wikis.lib.ncsu.edu/index.php/Expertiza]&lt;br /&gt;
* Rspec Documentation [https://relishapp.com/rspec]&lt;br /&gt;
* Wiki with Previous Work [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1873_Specialized_rubics_for_different_topic_types]&lt;br /&gt;
* Pull Request of the Previous Work [https://github.com/expertiza/expertiza/pull/1327]&lt;/div&gt;</summary>
		<author><name>Ngtitov</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics&amp;diff=123480</id>
		<title>E1936 Specialized Rubrics</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics&amp;diff=123480"/>
		<updated>2019-04-08T01:49:28Z</updated>

		<summary type="html">&lt;p&gt;Ngtitov: /* Previous Work */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page describes the work and goals that have been completed and achieved while implementing Expertiza Project &amp;quot;E1936. Specialized Rubrics for Different Topic Types (e.g., Servo project, refactoring project)&amp;quot; for the CSC/ECE 517 &amp;quot;Object-Oriented Design and Development&amp;quot; class, in the Spring semester of the 2019.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This Wiki page is created per CSC/ECE 517: &amp;quot;Object-Oriented Design and Development&amp;quot;, Expertiza Project requirements (Spring, 2019).&lt;br /&gt;
&lt;br /&gt;
Our [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Team team] was assigned the project &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936. Specialized rubrics for different topic types (e.g., Servo project, refactoring project)]&amp;quot;.  This is an Expertiza project.&lt;br /&gt;
&lt;br /&gt;
In this wiki page we describe the problem to be solved, how we solve that problem, and how we test our solution.  We also provide helpful links and contact information for our team.&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
In this section, we discuss the problem we need to solve, the Expertiza feature this problem is related to, what needs to be done to solve the problem (at a high level), and the previous attempt to solve this problem.&lt;br /&gt;
&lt;br /&gt;
=== Problem Statement ===&lt;br /&gt;
&lt;br /&gt;
This problem statement summarizes the problem as described in the project description &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936. Specialized rubrics for different topic types (e.g., Servo project, refactoring project)]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
In CSC/ECE 517, there are several types of topics that could be covered in a single class assignment.&lt;br /&gt;
* Code base&lt;br /&gt;
** Expertiza&lt;br /&gt;
** Mozilla&lt;br /&gt;
** etc.&lt;br /&gt;
* Goal&lt;br /&gt;
** Refactoring&lt;br /&gt;
** Testing&lt;br /&gt;
** etc.&lt;br /&gt;
However, currently we can only specify one kind of rubric for an assignment.  This means that teams working on different topics will be evaluated using the same rubric.  With this setup, it's not possible to fine-tune rubrics for different topics - rubrics tend to be overly general.&lt;br /&gt;
&lt;br /&gt;
=== Feature Description ===&lt;br /&gt;
&lt;br /&gt;
The feature we will add in this project is a feature to allow rubrics to vary not only by project phase, but also by topic.  This allows more flexibility to the instructor when setting up an assignment, so that they can use rubrics better suited to the tasks that students are performing in an assignment.&lt;br /&gt;
&lt;br /&gt;
When this feature is complete, the following scenarios will be possible, and the instructor will be the judge of which scenario is the best fit to the assignment:&lt;br /&gt;
&lt;br /&gt;
* One rubric for the assignment, period.&lt;br /&gt;
* A different rubric for each phase of the assignment, regardless of what topic different students are working on.&lt;br /&gt;
* A different rubric for each topic, regardless of the phases in the assignment.&lt;br /&gt;
* A different rubric for each phase of the assignment, and within a phase, a different rubric for each topic.&lt;br /&gt;
&lt;br /&gt;
=== What Needs to be Done ===&lt;br /&gt;
&lt;br /&gt;
This section summarizes the work as described in the project description &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936. Specialized rubrics for different topic types (e.g., Servo project, refactoring project)]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* In assignment#edit page &amp;quot;Rubrics&amp;quot; tab, add a checkbox to specify whether rubric should vary by topic.&lt;br /&gt;
* In assignment#edit page &amp;quot;Topics&amp;quot; tab, add dropdown(s) next to each topic to specify which rubric(s) are associated with the topic.&lt;br /&gt;
** The dropdown(s) should appear only if rubric should vary by topic, per the Rubrics tab.&lt;br /&gt;
** The topic should have a multiple dropdowns (one for each round) only if rubrics vary by round, per the Rubrics tab.&lt;br /&gt;
** By default, the rubric(s) for each course project will be the one(s) specified in “Rubrics” tab.&lt;br /&gt;
** The dropdown value can overwrite the default rubric.&lt;br /&gt;
* Be careful when making changes to the code&lt;br /&gt;
** The signup_sheet_controller should have as little to do as possible with the selection of rubrics.&lt;br /&gt;
** Anything not germane to selecting topics should be in another controller or (more probably) a helper.&lt;br /&gt;
* Create a DB migration to allow rubric to vary by topic as well as by round.&lt;br /&gt;
&lt;br /&gt;
==== Screenshots ====&lt;br /&gt;
'''Current screenshot of Rubrics tab for an Assignment'''&lt;br /&gt;
(need to add a checkbox to indicate that rubric should vary by topic)&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Screenshot Assignment Edit Rubrics.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Current screenshot of Topics tab for an Assignment'''&lt;br /&gt;
(need to add a way to select rubrics for particular topics)&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Screenshot Assignment Edit Topics.png]]&lt;br /&gt;
&lt;br /&gt;
=== Previous Work ===&lt;br /&gt;
There was previous attempt to implement this project in the Fall of 2018 semester by different team, but it was rejected due to several reasons. Our team was provided with all relevant information about the design and implementation of the previously attempted project. The following is the list of links with the relevant materials that we have used for better project understanding, determining pros and cons of proposed changes, and identifying any improvements:&lt;br /&gt;
&lt;br /&gt;
# [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1873_Specialized_rubics_for_different_topic_types Wiki]&lt;br /&gt;
# [https://github.com/expertiza/expertiza/pull/1327 Pull Request]&lt;br /&gt;
# [https://drive.google.com/file/d/1UrLb0Ula_Lb_F4MOrdC-s6xng6B08VYu/view Video Demo]&lt;br /&gt;
&lt;br /&gt;
After reviewing all relevant materials, we concluded that implementation of the project was incomplete and we found two main drawbacks that we can improve:&lt;br /&gt;
&lt;br /&gt;
* Per project requirement specifications, &amp;quot;''The dropdown box should appear only if 'Vary rubric by topic' is selected in the Rubrics tab.''&amp;quot; This requirement was not met and dropdown box with the list of rubrics appears regardless of whether &amp;quot;''Vary rubric by topic''&amp;quot; checkbox is selected or not.&lt;br /&gt;
* The dropdown box includes the list of all possible rubrics including default value. However, this condition can be improved. The dropdown box should list the rubrics that were created by the current user (professor who is logged in). This would allow to shorten the list of possible rubrics dramatically and help to avoid any misunderstanding and confusion while user selects desired rubric for the course project.&lt;br /&gt;
&lt;br /&gt;
We found no further issues with the rest implementation and other project materials. Wiki page is very useful for understading design of proposed changes. However, our team decided to use slightly different approach than adding ''questionnaire_id'' in the ''sign_up_topics'' table to specify project's topic and its associated rubrics. Please see our [Design Strategy] for our proposed changes.&lt;br /&gt;
&lt;br /&gt;
== Project Implementation ==&lt;br /&gt;
&lt;br /&gt;
In this section, we discuss how we plan to implement our solution to the problem. &lt;br /&gt;
&lt;br /&gt;
=== Design Strategy ===&lt;br /&gt;
&lt;br /&gt;
* app/views/assignments/edit/_rubrics.html.erb&lt;br /&gt;
** PROBLEM: There is no way for the user to indicate that rubrics should vary by topic&lt;br /&gt;
*** SOLUTION: Add a new checkbox for whether or not rubrics vary by topic&lt;br /&gt;
&lt;br /&gt;
* app/views/assignments/edit.html.erb&lt;br /&gt;
** PROBLEM: We need to add content to the Topics tab, but unlike other tabs, this doesn't have it's own partial view to work with&lt;br /&gt;
*** SOLUTION: Break out code dealing with topics into app/views/assignments/edit/_topics.html.erb&lt;br /&gt;
&lt;br /&gt;
* app/views/assignments/edit/_topics.html.erb&lt;br /&gt;
** PROBLEM: There is no way for the user to select rubric(s) for a particular topic&lt;br /&gt;
*** SOLUTION: Add a new column in the topics table for choosing rubric(s)&lt;br /&gt;
**** New column only visible if rubrics vary by topic, per Rubrics tab&lt;br /&gt;
**** New column has multiple rounds per topic only if rubrics vary by round, per Rubrics tab&lt;br /&gt;
**** Default value for any rubric is that rubric which is shown on Rubrics tab&lt;br /&gt;
**** Rubrics in the dropdown(s) will be only those created by the currently logged in instructor&lt;br /&gt;
** PROBLEM: The code in app/views/assignments/edit/_rubrics.html.erb includes dropdowns like the ones we'll need to add for topics, but that code is not easy to work with (too heavy for a view, uses JavaScript)&lt;br /&gt;
*** SOLUTION: Use the code in app/views/assignments/edit/_rubrics.html.erb for inspiration only&lt;br /&gt;
**** Break as much actual work as possible out into helper methods that are simply called from this view&lt;br /&gt;
**** Views are not intended to do heavy lifting&lt;br /&gt;
**** Use as little JavaScript as possible&lt;br /&gt;
**** This is a Ruby On Rails project, not a JS project&lt;br /&gt;
&lt;br /&gt;
* app/helpers/assignment_helper.rb&lt;br /&gt;
** PROBLEM: The assignment_questionnaire method finds a questionnaire for a given assignment/round, and would be a great place to include code to find a questionnaire for a given assignment/round/topic, however the method is not easy to work with&lt;br /&gt;
*** SOLUTION: Improve readability of assignment_questionnaire method&lt;br /&gt;
**** Add comment block at the top describing the purpose and basic strategy of the method&lt;br /&gt;
**** Rename 'number' parameter to clarify the purpose of the parameter&lt;br /&gt;
*** SOLUTION: Expand functionality of assignment_questionnaire method&lt;br /&gt;
**** Add ability to get assignment questionnaires by topic as well as by round&lt;br /&gt;
**** Like round, topic parameter should be optional&lt;br /&gt;
&lt;br /&gt;
* spec/helpers&lt;br /&gt;
** PROBLEM: We are going to add code to app/helpers/assignment_helper.rb, but this helper does not have an RSpec test suite yet&lt;br /&gt;
*** SOLUTION: Add spec/helpers/assignment_helper_spec.rb file&lt;br /&gt;
**** Thoroughly test app/helpers/assignment_helper.rb assignment_questionnaire method&lt;br /&gt;
** PROBLEM: We may also need to create other helpers or helper methods as we get into the code&lt;br /&gt;
*** SOLUTION: Add tests for any newly created helpers or helper methods&lt;br /&gt;
&lt;br /&gt;
* db/migrate&lt;br /&gt;
** PROBLEM: Questionnaires (of which rubrics are one type) are not linked to assignment topics&lt;br /&gt;
*** SOLUTION: Create a new migration to link rubrics to topics&lt;br /&gt;
**** Create a new table named topic_questionnaire with fields:&lt;br /&gt;
***** id&lt;br /&gt;
***** topic_id&lt;br /&gt;
***** questionnaire_id&lt;br /&gt;
***** used_in_round&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
&lt;br /&gt;
In this section, we provide selected portions of modified code to illustrate how we implemented the new feature.&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
In this section, we list all files that were modified while implementing the new feature.&lt;br /&gt;
&lt;br /&gt;
* [to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
=== How To ===&lt;br /&gt;
&lt;br /&gt;
In this section, we describe how to use the newly implemented feature.&lt;br /&gt;
&lt;br /&gt;
==== Add a New Rubric ====&lt;br /&gt;
&lt;br /&gt;
* [to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
==== Select a Rubric for a Topic ====&lt;br /&gt;
&lt;br /&gt;
* [to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
== Project Testing ==&lt;br /&gt;
To test code implementation, correctness of the added feature, verify that the team did not break any existing functionalities in the Expertiza, and ensure that no bugs were introduced in the code, we utilized the following Test Strategy:&lt;br /&gt;
# Code inspection&lt;br /&gt;
# Run and pass existing RSpec Tests&lt;br /&gt;
# Develop New RSpec Tests&lt;br /&gt;
# Run through live UI to test a feature using Expertiza instance&lt;br /&gt;
&lt;br /&gt;
=== Rspec Testing ===&lt;br /&gt;
&lt;br /&gt;
Our strategy for gaining confidence that our code changes did not break anything was as follows:&lt;br /&gt;
* Run all existing RSpec tests on any changed files, after our changes, to ensure that we have not introduced any failures.&lt;br /&gt;
* The commands and results are shown below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  [to be populated after coding is complete]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Write new comprehensive RSpec tests, for all new methods.&lt;br /&gt;
* Run these tests, to ensure that the new code works as intended.&lt;br /&gt;
* The commands and results are shown below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  [to be populated after coding is complete]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The test suite for a single new method is below.&lt;br /&gt;
* There are many such suites in (TODO add filename(s)).  &lt;br /&gt;
* This example illustrates our general strategy:&lt;br /&gt;
** test missing input&lt;br /&gt;
** test bad input&lt;br /&gt;
** test various acceptable forms of input&lt;br /&gt;
** test scenarios that lead to &amp;quot;true&amp;quot; and to &amp;quot;false&amp;quot; return values&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  [to be populated after coding is complete]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== UI Testing ===&lt;br /&gt;
Here we describe UI Testing that has performed. Include Screenshots maybe?&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
== Useful Links ==&lt;br /&gt;
In this section we provide useful links related to the work that has been completed by our team.&lt;br /&gt;
# [https://github.com/gabalmat/expertiza Forked Project Repository]&lt;br /&gt;
# [(add link here) Pull Request]&lt;br /&gt;
# [(add link here) Video Demonstration of Specialized Rubrics]&lt;br /&gt;
# [(add link here) Video Demonstration of Passing Rspec Tests]&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Contacts ===&lt;br /&gt;
We have 4 (four) members in our team and 1 (one) mentor was also assigned to us. For any project-related questions/concerns please contact us:&lt;br /&gt;
* Aurora Tiffany-Davis - attiffan@ncsu.edu&lt;br /&gt;
* Ginger Balmat - gabalmat@ncsu.edu&lt;br /&gt;
* Joe Hutchinson - jehutch3@ncsu.edu&lt;br /&gt;
* Nikolay Titov - ngtitov@ncsu.edu&lt;br /&gt;
* Zhewei Hu (mentor) - zhu6@ncsu.edu&lt;br /&gt;
&lt;br /&gt;
=== Contribution Based Inquiry ===&lt;br /&gt;
For any questions or concerns related to the project design, implementation, testing of the feature developed by our team, please contact an engineer who worked closely on the topic of your interest based on the [https://docs.google.com/spreadsheets/d/11uxuI_5gaC-FQDwIOxtCaN3HZ9bfWDJgIjFemtYV5jE/edit?ts=5ca222f3#gid=0 Contribution Assignment Grid] we created to keep track of our progress and contribution. Please carbon copy all team members and our mentor in the email.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* Expertiza Web [https://github.com/expertiza/expertiza#expertiza]&lt;br /&gt;
* Expertiza on GitHub [https://github.com/expertiza/expertiza]&lt;br /&gt;
* Expertiza Wiki [http://wikis.lib.ncsu.edu/index.php/Expertiza]&lt;br /&gt;
* Rspec Documentation [https://relishapp.com/rspec]&lt;br /&gt;
* Wiki with Previous Work [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1873_Specialized_rubics_for_different_topic_types]&lt;br /&gt;
* Pull Request of the Previous Work [https://github.com/expertiza/expertiza/pull/1327]&lt;/div&gt;</summary>
		<author><name>Ngtitov</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics&amp;diff=123461</id>
		<title>E1936 Specialized Rubrics</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics&amp;diff=123461"/>
		<updated>2019-04-08T01:19:40Z</updated>

		<summary type="html">&lt;p&gt;Ngtitov: /* Previous Work */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page describes the work and goals that have been completed and achieved while implementing Expertiza Project &amp;quot;E1936. Specialized Rubrics for Different Topic Types (e.g., Servo project, refactoring project)&amp;quot; for the CSC/ECE 517 &amp;quot;Object-Oriented Design and Development&amp;quot; class, in the Spring semester of the 2019.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This Wiki page is created per CSC/ECE 517: &amp;quot;Object-Oriented Design and Development&amp;quot;, Expertiza Project requirements (Spring, 2019).&lt;br /&gt;
&lt;br /&gt;
Our [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Team team] was assigned the project &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936. Specialized rubrics for different topic types (e.g., Servo project, refactoring project)]&amp;quot;.  This is an Expertiza project.&lt;br /&gt;
&lt;br /&gt;
In this wiki page we describe the problem to be solved, how we solve that problem, and how we test our solution.  We also provide helpful links and contact information for our team.&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
In this section, we discuss the problem we need to solve, the Expertiza feature this problem is related to, what needs to be done to solve the problem (at a high level), and the previous attempt to solve this problem.&lt;br /&gt;
&lt;br /&gt;
=== Problem Statement ===&lt;br /&gt;
&lt;br /&gt;
This problem statement summarizes the problem as described in the project description &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936. Specialized rubrics for different topic types (e.g., Servo project, refactoring project)]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
In CSC/ECE 517, there are several types of topics that could be covered in a single class assignment.&lt;br /&gt;
* Code base&lt;br /&gt;
** Expertiza&lt;br /&gt;
** Mozilla&lt;br /&gt;
** etc.&lt;br /&gt;
* Goal&lt;br /&gt;
** Refactoring&lt;br /&gt;
** Testing&lt;br /&gt;
** etc.&lt;br /&gt;
However, currently we can only specify one kind of rubric for an assignment.  This means that teams working on different topics will be evaluated using the same rubric.  With this setup, it's not possible to fine-tune rubrics for different topics - rubrics tend to be overly general.&lt;br /&gt;
&lt;br /&gt;
=== Feature Description ===&lt;br /&gt;
&lt;br /&gt;
The feature we will add in this project is a feature to allow rubrics to vary not only by project phase, but also by topic.  This allows more flexibility to the instructor when setting up an assignment, so that they can use rubrics better suited to the tasks that students are performing in an assignment.&lt;br /&gt;
&lt;br /&gt;
When this feature is complete, the following scenarios will be possible, and the instructor will be the judge of which scenario is the best fit to the assignment:&lt;br /&gt;
&lt;br /&gt;
* One rubric for the assignment, period.&lt;br /&gt;
* A different rubric for each phase of the assignment, regardless of what topic different students are working on.&lt;br /&gt;
* A different rubric for each topic, regardless of the phases in the assignment.&lt;br /&gt;
* A different rubric for each phase of the assignment, and within a phase, a different rubric for each topic.&lt;br /&gt;
&lt;br /&gt;
=== What Needs to be Done ===&lt;br /&gt;
&lt;br /&gt;
This section summarizes the work as described in the project description &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936. Specialized rubrics for different topic types (e.g., Servo project, refactoring project)]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* In assignment#edit page &amp;quot;Rubrics&amp;quot; tab, add a checkbox to specify whether rubric should vary by topic.&lt;br /&gt;
* In assignment#edit page &amp;quot;Topics&amp;quot; tab, add dropdown(s) next to each topic to specify which rubric(s) are associated with the topic.&lt;br /&gt;
** The dropdown(s) should appear only if rubric should vary by topic, per the Rubrics tab.&lt;br /&gt;
** The topic should have a multiple dropdowns (one for each round) only if rubrics vary by round, per the Rubrics tab.&lt;br /&gt;
** By default, the rubric(s) for each course project will be the one(s) specified in “Rubrics” tab.&lt;br /&gt;
** The dropdown value can overwrite the default rubric.&lt;br /&gt;
* Be careful when making changes to the code&lt;br /&gt;
** The signup_sheet_controller should have as little to do as possible with the selection of rubrics.&lt;br /&gt;
** Anything not germane to selecting topics should be in another controller or (more probably) a helper.&lt;br /&gt;
* Create a DB migration to allow rubric to vary by topic as well as by round.&lt;br /&gt;
&lt;br /&gt;
==== Screenshots ====&lt;br /&gt;
'''Current screenshot of Rubrics tab for an Assignment'''&lt;br /&gt;
(need to add a checkbox to indicate that rubric should vary by topic)&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Screenshot Assignment Edit Rubrics.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Current screenshot of Topics tab for an Assignment'''&lt;br /&gt;
(need to add a way to select rubrics for particular topics)&lt;br /&gt;
&lt;br /&gt;
[[File:E1936 Screenshot Assignment Edit Topics.png]]&lt;br /&gt;
&lt;br /&gt;
=== Previous Work ===&lt;br /&gt;
There was previous attempt to implement this project in the Fall of 2018 semester by different team, but it was rejected due to several reasons. Our team was provided with all relevant information about the design and implementation of the previously attempted project. The following is the list of link with the relevant information that we have used for better understanding of the project, determining pros and cons of proposed changes and identifying any improvements:&lt;br /&gt;
&lt;br /&gt;
# [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1873_Specialized_rubics_for_different_topic_types Wiki]&lt;br /&gt;
# [https://github.com/expertiza/expertiza/pull/1327 Pull Request]&lt;br /&gt;
# [https://drive.google.com/file/d/1UrLb0Ula_Lb_F4MOrdC-s6xng6B08VYu/view Video Demo]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[we should talk about what we LIKE and DISLIKE about their solution, to set the reader up to understand our proposed solution]&lt;br /&gt;
&lt;br /&gt;
== Project Implementation ==&lt;br /&gt;
&lt;br /&gt;
In this section, we discuss how we plan to implement our solution to the problem. &lt;br /&gt;
&lt;br /&gt;
=== Design Strategy ===&lt;br /&gt;
&lt;br /&gt;
* app/views/assignments/edit/_rubrics.html.erb&lt;br /&gt;
** PROBLEM: There is no way for the user to indicate that rubrics should vary by topic&lt;br /&gt;
*** SOLUTION: Add a new checkbox for whether or not rubrics vary by topic&lt;br /&gt;
&lt;br /&gt;
* app/views/assignments/edit.html.erb&lt;br /&gt;
** PROBLEM: We need to add content to the Topics tab, but unlike other tabs, this doesn't have it's own partial view to work with&lt;br /&gt;
*** SOLUTION: Break out code dealing with topics into app/views/assignments/edit/_topics.html.erb&lt;br /&gt;
&lt;br /&gt;
* app/views/assignments/edit/_topics.html.erb&lt;br /&gt;
** PROBLEM: There is no way for the user to select rubric(s) for a particular topic&lt;br /&gt;
*** SOLUTION: Add a new column in the topics table for choosing rubric(s)&lt;br /&gt;
**** New column only visible if rubrics vary by topic, per Rubrics tab&lt;br /&gt;
**** New column has multiple rounds per topic only if rubrics vary by round, per Rubrics tab&lt;br /&gt;
**** Default value for any rubric is that rubric which is shown on Rubrics tab&lt;br /&gt;
**** Rubrics in the dropdown(s) will be only those created by the currently logged in instructor&lt;br /&gt;
** PROBLEM: The code in app/views/assignments/edit/_rubrics.html.erb includes dropdowns like the ones we'll need to add for topics, but that code is not easy to work with (too heavy for a view, uses JavaScript)&lt;br /&gt;
*** SOLUTION: Use the code in app/views/assignments/edit/_rubrics.html.erb for inspiration only&lt;br /&gt;
**** Break as much actual work as possible out into helper methods that are simply called from this view&lt;br /&gt;
**** Views are not intended to do heavy lifting&lt;br /&gt;
**** Use as little JavaScript as possible&lt;br /&gt;
**** This is a Ruby On Rails project, not a JS project&lt;br /&gt;
&lt;br /&gt;
* app/helpers/assignment_helper.rb&lt;br /&gt;
** PROBLEM: The assignment_questionnaire method finds a questionnaire for a given assignment/round, and would be a great place to include code to find a questionnaire for a given assignment/round/topic, however the method is not easy to work with&lt;br /&gt;
*** SOLUTION: Improve readability of assignment_questionnaire method&lt;br /&gt;
**** Add comment block at the top describing the purpose and basic strategy of the method&lt;br /&gt;
**** Rename 'number' parameter to clarify the purpose of the parameter&lt;br /&gt;
*** SOLUTION: Expand functionality of assignment_questionnaire method&lt;br /&gt;
**** Add ability to get assignment questionnaires by topic as well as by round&lt;br /&gt;
**** Like round, topic parameter should be optional&lt;br /&gt;
&lt;br /&gt;
* spec/helpers&lt;br /&gt;
** PROBLEM: We are going to add code to app/helpers/assignment_helper.rb, but this helper does not have an RSpec test suite yet&lt;br /&gt;
*** SOLUTION: Add spec/helpers/assignment_helper_spec.rb file&lt;br /&gt;
**** Thoroughly test app/helpers/assignment_helper.rb assignment_questionnaire method&lt;br /&gt;
** PROBLEM: We may also need to create other helpers or helper methods as we get into the code&lt;br /&gt;
*** SOLUTION: Add tests for any newly created helpers or helper methods&lt;br /&gt;
&lt;br /&gt;
* db/migrate&lt;br /&gt;
** PROBLEM: Questionnaires (of which rubrics are one type) are not linked to assignment topics&lt;br /&gt;
*** SOLUTION: Create a new migration to link rubrics to topics&lt;br /&gt;
**** Create a new table named topic_questionnaire with fields:&lt;br /&gt;
***** id&lt;br /&gt;
***** topic_id&lt;br /&gt;
***** questionnaire_id&lt;br /&gt;
***** used_in_round&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
&lt;br /&gt;
In this section, we provide selected portions of modified code to illustrate how we implemented the new feature.&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
In this section, we list all files that were modified while implementing the new feature.&lt;br /&gt;
&lt;br /&gt;
* [to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
=== How To ===&lt;br /&gt;
&lt;br /&gt;
In this section, we describe how to use the newly implemented feature.&lt;br /&gt;
&lt;br /&gt;
==== Add a New Rubric ====&lt;br /&gt;
&lt;br /&gt;
* [to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
==== Select a Rubric for a Topic ====&lt;br /&gt;
&lt;br /&gt;
* [to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
== Project Testing ==&lt;br /&gt;
To test code implementation, correctness of the added feature, verify that the team did not break any existing functionalities in the Expertiza, and ensure that no bugs were introduced in the code, we utilized the following Test Strategy:&lt;br /&gt;
# Code inspection&lt;br /&gt;
# Run and pass existing RSpec Tests&lt;br /&gt;
# Develop New RSpec Tests&lt;br /&gt;
# Run through live UI to test a feature using Expertiza instance&lt;br /&gt;
&lt;br /&gt;
=== Rspec Testing ===&lt;br /&gt;
&lt;br /&gt;
Our strategy for gaining confidence that our code changes did not break anything was as follows:&lt;br /&gt;
* Run all existing RSpec tests on any changed files, after our changes, to ensure that we have not introduced any failures.&lt;br /&gt;
* The commands and results are shown below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  [to be populated after coding is complete]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Write new comprehensive RSpec tests, for all new methods.&lt;br /&gt;
* Run these tests, to ensure that the new code works as intended.&lt;br /&gt;
* The commands and results are shown below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  [to be populated after coding is complete]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The test suite for a single new method is below.&lt;br /&gt;
* There are many such suites in (TODO add filename(s)).  &lt;br /&gt;
* This example illustrates our general strategy:&lt;br /&gt;
** test missing input&lt;br /&gt;
** test bad input&lt;br /&gt;
** test various acceptable forms of input&lt;br /&gt;
** test scenarios that lead to &amp;quot;true&amp;quot; and to &amp;quot;false&amp;quot; return values&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  [to be populated after coding is complete]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== UI Testing ===&lt;br /&gt;
Here we describe UI Testing that has performed. Include Screenshots maybe?&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
[to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
== Useful Links ==&lt;br /&gt;
In this section we provide useful links related to the work that has been completed by our team.&lt;br /&gt;
# [https://github.com/gabalmat/expertiza Forked Project Repository]&lt;br /&gt;
# [(add link here) Pull Request]&lt;br /&gt;
# [(add link here) Video Demonstration of Specialized Rubrics]&lt;br /&gt;
# [(add link here) Video Demonstration of Passing Rspec Tests]&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Contacts ===&lt;br /&gt;
We have 4 (four) members in our team and 1 (one) mentor was also assigned to us. For any project-related questions/concerns please contact us:&lt;br /&gt;
* Aurora Tiffany-Davis - attiffan@ncsu.edu&lt;br /&gt;
* Ginger Balmat - gabalmat@ncsu.edu&lt;br /&gt;
* Joe Hutchinson - jehutch3@ncsu.edu&lt;br /&gt;
* Nikolay Titov - ngtitov@ncsu.edu&lt;br /&gt;
* Zhewei Hu (mentor) - zhu6@ncsu.edu&lt;br /&gt;
&lt;br /&gt;
=== Contribution Based Inquiry ===&lt;br /&gt;
For any questions or concerns related to the project design, implementation, testing of the feature developed by our team, please contact an engineer who worked closely on the topic of your interest based on the [https://docs.google.com/spreadsheets/d/11uxuI_5gaC-FQDwIOxtCaN3HZ9bfWDJgIjFemtYV5jE/edit?ts=5ca222f3#gid=0 Contribution Assignment Grid] we created to keep track of our progress and contribution. Please carbon copy all team members and our mentor in the email.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* Expertiza Web [https://github.com/expertiza/expertiza#expertiza]&lt;br /&gt;
* Expertiza on GitHub [https://github.com/expertiza/expertiza]&lt;br /&gt;
* Expertiza Wiki [http://wikis.lib.ncsu.edu/index.php/Expertiza]&lt;br /&gt;
* Rspec Documentation [https://relishapp.com/rspec]&lt;br /&gt;
* Wiki with Previous Work [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1873_Specialized_rubics_for_different_topic_types]&lt;br /&gt;
* Pull Request of the Previous Work [https://github.com/expertiza/expertiza/pull/1327]&lt;/div&gt;</summary>
		<author><name>Ngtitov</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics&amp;diff=123210</id>
		<title>E1936 Specialized Rubrics</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics&amp;diff=123210"/>
		<updated>2019-04-05T19:23:05Z</updated>

		<summary type="html">&lt;p&gt;Ngtitov: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page describes the work and goals that have been completed and achieved while implementing Expertiza Project &amp;quot;E1936. Specialized Rubrics for Different Topic Types (e.g., Servo project, refactoring project)&amp;quot; for the CSC/ECE 517 &amp;quot;Object-Oriented Design and Development&amp;quot; class, in the Spring semester of the 2019.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This Wiki page is created per CSC/ECE 517: &amp;quot;Object-Oriented Design and Development&amp;quot;, Expertiza Project requirements (Spring, 2019).&lt;br /&gt;
&lt;br /&gt;
Our [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Team team] was assigned to &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936]. Specialized Rubrics for Different Topic Types (e.g., Servo project, refactoring project)&amp;quot; Expertiza Project. In this page we describe what work has been completed by our team to ... Each section below provides clear and descriptive review on the subject we cover.&lt;br /&gt;
&lt;br /&gt;
We start with introduction to Expertiza application. We describe how and why Expertiza is used by students and teaching staff for CSC/ECE 517 class.&lt;br /&gt;
&lt;br /&gt;
=== Expertiza ===&lt;br /&gt;
[https://expertiza.ncsu.edu/ Expertiza] is a ...&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
Here we describe project details starting with Problem statement, description of what needs to be done, previous work that was done ... &lt;br /&gt;
&lt;br /&gt;
=== Problem Statement ===&lt;br /&gt;
In CSC/ECE 517, there are several types of topics that could be covered in a single class assignment.&lt;br /&gt;
* Code base&lt;br /&gt;
** Expertiza&lt;br /&gt;
** Mozilla&lt;br /&gt;
** etc.&lt;br /&gt;
* Goal&lt;br /&gt;
** Refactoring&lt;br /&gt;
** Testing&lt;br /&gt;
** etc.&lt;br /&gt;
However, currently we can only specify one kind of rubric for an assignment.  This means that teams working on different topics will be evaluated using the same rubric.  With this setup, it's not possible to fine-tune rubrics for different topics - rubrics tend to be overly general.&lt;br /&gt;
&lt;br /&gt;
=== Feature Description ===&lt;br /&gt;
I feel like we need to talk about what that feature enables us or teaching staff to do here...&lt;br /&gt;
&lt;br /&gt;
=== What Needs to be Done ===&lt;br /&gt;
* In assignment#edit page &amp;quot;Rubrics&amp;quot; tab, add a checkbox to specify whether rubric should vary by topic.&lt;br /&gt;
* In assignment#edit page &amp;quot;Topics&amp;quot; tab, add a dropdown next to each topic to specify which rubric is associated with the topic.&lt;br /&gt;
** This dropdown should appear only if rubric should vary by topic, per the Rubrics tab.&lt;br /&gt;
** By default, the rubric for each course project will be the one specified in “Rubrics” tab.&lt;br /&gt;
** The dropdown value can overwrite the default rubric.&lt;br /&gt;
* Be careful when making changes to the code&lt;br /&gt;
** The signup_sheet_controller should have as little to do as possible with the selection of rubrics.&lt;br /&gt;
** Anything not germane to selecting topics should be in another controller or (more probably) a helper.&lt;br /&gt;
* Create a DB migration to allow rubric to vary by topic as well as by round.&lt;br /&gt;
&lt;br /&gt;
=== Previous Work ===&lt;br /&gt;
Here we describe what has been done by other team...&lt;br /&gt;
# [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1873_Specialized_rubics_for_different_topic_types Wiki]&lt;br /&gt;
# [https://github.com/expertiza/expertiza/pull/1327 Pull Request]&lt;br /&gt;
# [https://drive.google.com/file/d/1UrLb0Ula_Lb_F4MOrdC-s6xng6B08VYu/view Video Demo]&lt;br /&gt;
&lt;br /&gt;
== Project Implementation ==&lt;br /&gt;
&lt;br /&gt;
Here is the project implementation. &lt;br /&gt;
&lt;br /&gt;
=== Design Strategy ===&lt;br /&gt;
&lt;br /&gt;
* app/views/assignments/edit/_rubrics.html.erb&lt;br /&gt;
** Add a new checkbox for whether or not rubrics vary by topic&lt;br /&gt;
&lt;br /&gt;
* app/views/assignments/edit.html.erb&lt;br /&gt;
** Break out code dealing with topics into app/views/assignments/edit/_topics.html.erb&lt;br /&gt;
&lt;br /&gt;
* app/views/assignments/edit/_topics.html.erb&lt;br /&gt;
** Add a new column in the topics table for choosing rubric(s)&lt;br /&gt;
*** New column only visible if rubrics vary by topic, per Rubrics tab&lt;br /&gt;
*** New column has multiple rounds per topic only if rubrics vary by round, per Rubrics tab&lt;br /&gt;
** Default value for any rubric is that rubric which is shown on Rubrics tab&lt;br /&gt;
** Use the code in app/views/assignments/edit/_rubrics.html.erb for inspiration only&lt;br /&gt;
*** Break as much actual work as possible out into helper methods that are simply called from this view&lt;br /&gt;
*** Views are not intended to do heavy lifting&lt;br /&gt;
*** Use as little JavaScript as possible&lt;br /&gt;
*** This is a Ruby On Rails project, not a JS project&lt;br /&gt;
&lt;br /&gt;
* app/helpers/assignment_helper.rb&lt;br /&gt;
** Improve readability of assignment_questionnaire method&lt;br /&gt;
*** Add comment block at the top describing the purpose and basic strategy of the method&lt;br /&gt;
*** Rename 'number' parameter to clarify the purpose of the parameter&lt;br /&gt;
** Expand functionality of assignment_questionnaire method&lt;br /&gt;
*** Add ability to get assignment questionnaires by topic as well as by round&lt;br /&gt;
*** Like round, topic parameter should be optional&lt;br /&gt;
&lt;br /&gt;
* spec/helpers&lt;br /&gt;
** Add spec/helpers/assignment_helper_spec.rb file&lt;br /&gt;
*** Thoroughly test app/helpers/assignment_helper.rb assignment_questionnaire method&lt;br /&gt;
** Add tests for any newly created helpers or helper methods&lt;br /&gt;
&lt;br /&gt;
* db/migrate&lt;br /&gt;
** Create a new migration to link topics to rubrics&lt;br /&gt;
*** This migration will add a column to the table &amp;quot;assignment_questionnaires&amp;quot;&lt;br /&gt;
*** This table keeps track of which questionnaires are used for which assignments&lt;br /&gt;
**** questionnaire_id links to a questionnaire&lt;br /&gt;
**** assignment_id links to an assignment&lt;br /&gt;
**** used_in_round links to a particular round of an assignment&lt;br /&gt;
**** the migration will add &amp;quot;topic_id&amp;quot; to link also to a particular topic within an assignment&lt;br /&gt;
** The original suggestion was to &amp;quot;add questionnaire_id in sign_up_topics table&amp;quot;&lt;br /&gt;
*** This suggestion would allow the rubric to vary by topic but NOT by round of assignment&lt;br /&gt;
*** As the current implementation supports rubric varying by round of assignment, we should keep this support&lt;br /&gt;
** The previous submission for this feature added a new table &amp;quot;topic_questionnaires&amp;quot;&lt;br /&gt;
*** This is not necessary as we already have a table which associates questionnaires with assignments and rounds&lt;br /&gt;
*** We are better off associating questionnaires with topics in this existing table to limit code changes and enhance code readability&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
More of the code part section. With some code snippets.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
Here may be list the files that were involved to implement the project. &lt;br /&gt;
&lt;br /&gt;
=== How To ===&lt;br /&gt;
Here give descriptions on how to use new feature.&lt;br /&gt;
&lt;br /&gt;
==== Add a New Rubric ====&lt;br /&gt;
&lt;br /&gt;
* [to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
==== Select a Rubric for a Topic ====&lt;br /&gt;
&lt;br /&gt;
* [to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
== Project Testing ==&lt;br /&gt;
To test code implementation, correctness of the added feature, verify that the team did not break any existing functionalities in the Expertiza, and ensure that no bugs were introduced in the code, we utilized the following Test Strategy:&lt;br /&gt;
# Code inspection&lt;br /&gt;
# Run and pass existing RSpec Tests&lt;br /&gt;
# Develop New RSpec Tests&lt;br /&gt;
# Run through live UI to test a feature using Expertiza instance&lt;br /&gt;
&lt;br /&gt;
=== Rspec Testing ===&lt;br /&gt;
&lt;br /&gt;
Our strategy for gaining confidence that our code changes did not break anything was as follows:&lt;br /&gt;
* Run all existing RSpec tests on any changed files, after our changes, to ensure that we have not introduced any failures.&lt;br /&gt;
* The commands and results are shown below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  [to be populated after coding is complete]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Write new comprehensive RSpec tests, for all new methods.&lt;br /&gt;
* Run these tests, to ensure that the new code works as intended.&lt;br /&gt;
* The commands and results are shown below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  [to be populated after coding is complete]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The test suite for a single new method is below.&lt;br /&gt;
* There are many such suites in (TODO add filename(s)).  &lt;br /&gt;
* This example illustrates our general strategy:&lt;br /&gt;
** test missing input&lt;br /&gt;
** test bad input&lt;br /&gt;
** test various acceptable forms of input&lt;br /&gt;
** test scenarios that lead to &amp;quot;true&amp;quot; and to &amp;quot;false&amp;quot; return values&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  [to be populated after coding is complete]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== UI Testing ===&lt;br /&gt;
Here we describe UI Testing that has performed. Include Screenshots maybe?&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
Conclude on the project (anything your want to add).&lt;br /&gt;
&lt;br /&gt;
== Useful Links ==&lt;br /&gt;
In this section we provide useful links related to the work that has been completed by our team.&lt;br /&gt;
# [https://github.com/gabalmat/expertiza Forked Project Repository]&lt;br /&gt;
# [(add link here) Pull Request]&lt;br /&gt;
# [(add link here) Video Demonstration of Specialized Rubrics]&lt;br /&gt;
# [(add link here) Video Demonstration of Passing Rspec Tests]&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Contacts ===&lt;br /&gt;
We have 4 (four) members in our team and 1 (one) mentor was also assigned to us. For any project-related questions/concerns please contact us:&lt;br /&gt;
* Aurora Tiffany-Davis - attiffan@ncsu.edu&lt;br /&gt;
* Ginger Balmat - gabalmat@ncsu.edu&lt;br /&gt;
* Joe Hutchinson - jehutch3@ncsu.edu&lt;br /&gt;
* Nikolay Titov - ngtitov@ncsu.edu&lt;br /&gt;
* Zhewei Hu (mentor) - zhu6@ncsu.edu&lt;br /&gt;
&lt;br /&gt;
=== Contribution Based Inquiry ===&lt;br /&gt;
For any questions or concerns related to the project design, implementation, testing of the feature developed by our team, please contact an engineer who worked closely on the topic of your interest based on the [https://docs.google.com/spreadsheets/d/11uxuI_5gaC-FQDwIOxtCaN3HZ9bfWDJgIjFemtYV5jE/edit?ts=5ca222f3#gid=0 Contribution Assignment Grid] we created to keep track of our progress and contribution. Please carbon copy all team members and our mentor in the email.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* Expertiza Web [https://github.com/expertiza/expertiza#expertiza]&lt;br /&gt;
* Expertiza on GitHub [https://github.com/expertiza/expertiza]&lt;br /&gt;
* Expertiza Wiki [http://wikis.lib.ncsu.edu/index.php/Expertiza]&lt;br /&gt;
* Rspec Documentation [https://relishapp.com/rspec]&lt;br /&gt;
* Wiki with Previous Work [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1873_Specialized_rubics_for_different_topic_types]&lt;br /&gt;
* Pull Request of the Previous Work [https://github.com/expertiza/expertiza/pull/1327]&lt;/div&gt;</summary>
		<author><name>Ngtitov</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics&amp;diff=123203</id>
		<title>E1936 Specialized Rubrics</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics&amp;diff=123203"/>
		<updated>2019-04-05T18:07:45Z</updated>

		<summary type="html">&lt;p&gt;Ngtitov: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page describes the work and goals that have been completed and achieved while implementing Expertiza Project &amp;quot;E1936. Specialized Rubrics for Different Topic Types (e.g., Servo project, refactoring project)&amp;quot; for the CSC/ECE 517 &amp;quot;Object-Oriented Design and Development&amp;quot; class, in the Spring semester of the 2019.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This Wiki page is created per CSC/ECE 517: &amp;quot;Object-Oriented Design and Development&amp;quot;, Expertiza Project requirements (Spring, 2019).&lt;br /&gt;
&lt;br /&gt;
Our [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Team team] was assigned to &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936]. Specialized Rubrics for Different Topic Types (e.g., Servo project, refactoring project)&amp;quot; Expertiza Project. In this page we describe what work has been completed by our team to ... Each section below provides clear and descriptive review on the subject we cover.&lt;br /&gt;
&lt;br /&gt;
We start with introduction to Expertiza application. We describe how and why Expertiza is used by students and teaching staff for CSC/ECE 517 class.&lt;br /&gt;
&lt;br /&gt;
=== Expertiza ===&lt;br /&gt;
[https://expertiza.ncsu.edu/ Expertiza] is a ...&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
Here we describe project details starting with Problem statement, description of what needs to be done, previous work that was done ... &lt;br /&gt;
&lt;br /&gt;
=== Problem Statement ===&lt;br /&gt;
In CSC/ECE 517, there are several types of topics that could be covered in a single class assignment.&lt;br /&gt;
* Code base&lt;br /&gt;
** Expertiza&lt;br /&gt;
** Mozilla&lt;br /&gt;
** etc.&lt;br /&gt;
* Goal&lt;br /&gt;
** Refactoring&lt;br /&gt;
** Testing&lt;br /&gt;
** etc.&lt;br /&gt;
However, currently we can only specify one kind of rubric for an assignment.  This means that teams working on different topics will be evaluated using the same rubric.  With this setup, it's not possible to fine-tune rubrics for different topics - rubrics tend to be overly general.&lt;br /&gt;
&lt;br /&gt;
=== Feature Description ===&lt;br /&gt;
I feel like we need to talk about what that feature enables us or teaching staff to do here...&lt;br /&gt;
&lt;br /&gt;
=== What Needs to be Done ===&lt;br /&gt;
* In assignment#edit page &amp;quot;Rubrics&amp;quot; tab, add a checkbox to specify whether rubric should vary by topic.&lt;br /&gt;
* In assignment#edit page &amp;quot;Topics&amp;quot; tab, add a dropdown next to each topic to specify which rubric is associated with the topic.&lt;br /&gt;
** This dropdown should appear only if rubric should vary by topic, per the Rubrics tab.&lt;br /&gt;
** By default, the rubric for each course project will be the one specified in “Rubrics” tab.&lt;br /&gt;
** The dropdown value can overwrite the default rubric.&lt;br /&gt;
* Be careful when making changes to the code&lt;br /&gt;
** The signup_sheet_controller should have as little to do as possible with the selection of rubrics.&lt;br /&gt;
** Anything not germane to selecting topics should be in another controller or (more probably) a helper.&lt;br /&gt;
* Create a DB migration to allow rubric to vary by topic as well as by round.&lt;br /&gt;
&lt;br /&gt;
=== Previous Work ===&lt;br /&gt;
Here we describe what has been done by other team...&lt;br /&gt;
# [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1873_Specialized_rubics_for_different_topic_types Wiki]&lt;br /&gt;
# [https://github.com/expertiza/expertiza/pull/1327 Pull Request]&lt;br /&gt;
# [https://drive.google.com/file/d/1UrLb0Ula_Lb_F4MOrdC-s6xng6B08VYu/view Video Demo]&lt;br /&gt;
&lt;br /&gt;
== Project Implementation ==&lt;br /&gt;
&lt;br /&gt;
Here is the project implementation. &lt;br /&gt;
&lt;br /&gt;
=== Design Strategy ===&lt;br /&gt;
&lt;br /&gt;
* app/views/assignments/edit/_rubrics.html.erb&lt;br /&gt;
** Add a new checkbox for whether or not rubrics vary by topic&lt;br /&gt;
&lt;br /&gt;
* app/views/assignments/edit.html.erb&lt;br /&gt;
** Break out code dealing with topics into app/views/assignments/edit/_topics.html.erb&lt;br /&gt;
&lt;br /&gt;
* app/views/assignments/edit/_topics.html.erb&lt;br /&gt;
** Add a new column in the topics table for choosing rubric(s)&lt;br /&gt;
*** New column only visible if rubrics vary by topic, per Rubrics tab&lt;br /&gt;
*** New column has multiple rounds per topic only if rubrics vary by round, per Rubrics tab&lt;br /&gt;
** Default value for any rubric is that rubric which is shown on Rubrics tab&lt;br /&gt;
** Use the code in app/views/assignments/edit/_rubrics.html.erb for inspiration only&lt;br /&gt;
*** Break as much actual work as possible out into helper methods that are simply called from this view&lt;br /&gt;
*** Views are not intended to do heavy lifting&lt;br /&gt;
*** Use as little JavaScript as possible&lt;br /&gt;
*** This is a Ruby On Rails project, not a JS project&lt;br /&gt;
&lt;br /&gt;
* app/helpers/assignment_helper.rb&lt;br /&gt;
** Improve readability of assignment_questionnaire method&lt;br /&gt;
*** Add comment block at the top describing the purpose and basic strategy of the method&lt;br /&gt;
*** Rename 'number' parameter to clarify the purpose of the parameter&lt;br /&gt;
** Expand functionality of assignment_questionnaire method&lt;br /&gt;
*** Add ability to get assignment questionnaires by topic as well as by round&lt;br /&gt;
*** Like round, topic parameter should be optional&lt;br /&gt;
&lt;br /&gt;
* spec/helpers&lt;br /&gt;
** Add spec/helpers/assignment_helper_spec.rb file&lt;br /&gt;
*** Thoroughly test app/helpers/assignment_helper.rb assignment_questionnaire method&lt;br /&gt;
** Add tests for any newly created helpers or helper methods&lt;br /&gt;
&lt;br /&gt;
* db/migrate&lt;br /&gt;
** Create a new migration to link topics to rubrics&lt;br /&gt;
*** This migration will add a column to the table &amp;quot;assignment_questionnaires&amp;quot;&lt;br /&gt;
*** This table keeps track of which questionnaires are used for which assignments&lt;br /&gt;
**** questionnaire_id links to a questionnaire&lt;br /&gt;
**** assignment_id links to an assignment&lt;br /&gt;
**** used_in_round links to a particular round of an assignment&lt;br /&gt;
**** the migration will add &amp;quot;topic_id&amp;quot; to link also to a particular topic within an assignment&lt;br /&gt;
** The original suggestion was to &amp;quot;add questionnaire_id in sign_up_topics table&amp;quot;&lt;br /&gt;
*** This suggestion would allow the rubric to vary by topic but NOT by round of assignment&lt;br /&gt;
*** As the current implementation supports rubric varying by round of assignment, we should keep this support&lt;br /&gt;
** The previous submission for this feature added a new table &amp;quot;topic_questionnaires&amp;quot;&lt;br /&gt;
*** This is not necessary as we already have a table which associates questionnaires with assignments and rounds&lt;br /&gt;
*** We are better off associating questionnaires with topics in this existing table to limit code changes and enhance code readability&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
More of the code part section. With some code snippets.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
Here may be list the files that were involved to implement the project. &lt;br /&gt;
&lt;br /&gt;
== How To ==&lt;br /&gt;
Here give descriptions on how to use new feature.&lt;br /&gt;
&lt;br /&gt;
=== Add a New Rubric ===&lt;br /&gt;
&lt;br /&gt;
* [to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
=== Select a Rubric for a Topic ===&lt;br /&gt;
&lt;br /&gt;
* [to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
== Project Testing ==&lt;br /&gt;
To test code implementation, correctness of the added feature, verify that the team did not break any existing functionalities in the Expertiza, and ensure that no bugs were introduced in the code, we utilized the following Test Strategy:&lt;br /&gt;
# Code inspection&lt;br /&gt;
# Run and pass existing RSpec Tests&lt;br /&gt;
# Develop New RSpec Tests&lt;br /&gt;
# Run through live UI to test a feature using Expertiza instance&lt;br /&gt;
&lt;br /&gt;
=== Rspec Testing ===&lt;br /&gt;
&lt;br /&gt;
Our strategy for gaining confidence that our code changes did not break anything was as follows:&lt;br /&gt;
* Run all existing RSpec tests on any changed files, after our changes, to ensure that we have not introduced any failures.&lt;br /&gt;
* The commands and results are shown below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  [to be populated after coding is complete]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Write new comprehensive RSpec tests, for all new methods.&lt;br /&gt;
* Run these tests, to ensure that the new code works as intended.&lt;br /&gt;
* The commands and results are shown below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  [to be populated after coding is complete]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The test suite for a single new method is below.&lt;br /&gt;
* There are many such suites in (TODO add filename(s)).  &lt;br /&gt;
* This example illustrates our general strategy:&lt;br /&gt;
** test missing input&lt;br /&gt;
** test bad input&lt;br /&gt;
** test various acceptable forms of input&lt;br /&gt;
** test scenarios that lead to &amp;quot;true&amp;quot; and to &amp;quot;false&amp;quot; return values&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  [to be populated after coding is complete]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== UI Testing ===&lt;br /&gt;
Here we describe UI Testing that has performed. Include Screenshots maybe?&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
Conclude on the project (anything your want to add).&lt;br /&gt;
&lt;br /&gt;
== Useful Links ==&lt;br /&gt;
In this section we provide useful links related to the work that has been completed by our team.&lt;br /&gt;
# [https://github.com/gabalmat/expertiza Forked Project Repository]&lt;br /&gt;
# [(add link here) Pull Request]&lt;br /&gt;
# [(add link here) Video Demonstration of Specialized Rubrics]&lt;br /&gt;
# [(add link here) Video Demonstration of Passing Rspec Tests]&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Contacts ===&lt;br /&gt;
We have 4 (four) members in our team and 1 (one) mentor was also assigned to us. For any project-related questions/concerns please contact us:&lt;br /&gt;
* Aurora Tiffany-Davis - attiffan@ncsu.edu&lt;br /&gt;
* Ginger Balmat - gabalmat@ncsu.edu&lt;br /&gt;
* Joe Hutchinson - jehutch3@ncsu.edu&lt;br /&gt;
* Nikolay Titov - ngtitov@ncsu.edu&lt;br /&gt;
* Zhewei Hu (mentor) - zhu6@ncsu.edu&lt;br /&gt;
&lt;br /&gt;
=== Contribution Based Inquiry ===&lt;br /&gt;
For any questions or concerns related to the project design, implementation, testing of the feature developed by our team, please contact an engineer who worked closely on the topic of your interest based on the [https://docs.google.com/spreadsheets/d/11uxuI_5gaC-FQDwIOxtCaN3HZ9bfWDJgIjFemtYV5jE/edit?ts=5ca222f3#gid=0 Contribution Assignment Grid] we created to keep track of our progress and contribution. Please carbon copy all team members and our mentor in the email.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* Expertiza Web [https://github.com/expertiza/expertiza#expertiza]&lt;br /&gt;
* Expertiza on GitHub [https://github.com/expertiza/expertiza]&lt;br /&gt;
* Expertiza Wiki [http://wikis.lib.ncsu.edu/index.php/Expertiza]&lt;br /&gt;
* Rspec Documentation [https://relishapp.com/rspec]&lt;br /&gt;
* Wiki with Previous Work [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1873_Specialized_rubics_for_different_topic_types]&lt;br /&gt;
* Pull Request of the Previous Work [https://github.com/expertiza/expertiza/pull/1327]&lt;/div&gt;</summary>
		<author><name>Ngtitov</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics&amp;diff=123202</id>
		<title>E1936 Specialized Rubrics</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics&amp;diff=123202"/>
		<updated>2019-04-05T18:07:05Z</updated>

		<summary type="html">&lt;p&gt;Ngtitov: /* Team Contacts and Contribution */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page describes the work and goals that have been completed and achieved while implementing Expertiza Project &amp;quot;E1936. Specialized Rubrics for Different Topic Types (e.g., Servo project, refactoring project)&amp;quot; for the CSC/ECE 517 &amp;quot;Object-Oriented Design and Development&amp;quot; class, in the Spring semester of the 2019.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This Wiki page is created per CSC/ECE 517: &amp;quot;Object-Oriented Design and Development&amp;quot;, Expertiza Project requirements (Spring, 2019).&lt;br /&gt;
&lt;br /&gt;
Our [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Team_Contacts_and_Contribution team] was assigned to &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936]. Specialized Rubrics for Different Topic Types (e.g., Servo project, refactoring project)&amp;quot; Expertiza Project. In this page we describe what work has been completed by our team to ... Each section below provides clear and descriptive review on the subject we cover.&lt;br /&gt;
&lt;br /&gt;
We start with introduction to Expertiza application. We describe how and why Expertiza is used by students and teaching staff for CSC/ECE 517 class.&lt;br /&gt;
&lt;br /&gt;
=== Expertiza ===&lt;br /&gt;
[https://expertiza.ncsu.edu/ Expertiza] is a ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
Here we describe project details starting with Problem statement, description of what needs to be done, previous work that was done ... &lt;br /&gt;
&lt;br /&gt;
=== Problem Statement ===&lt;br /&gt;
In CSC/ECE 517, there are several types of topics that could be covered in a single class assignment.&lt;br /&gt;
* Code base&lt;br /&gt;
** Expertiza&lt;br /&gt;
** Mozilla&lt;br /&gt;
** etc.&lt;br /&gt;
* Goal&lt;br /&gt;
** Refactoring&lt;br /&gt;
** Testing&lt;br /&gt;
** etc.&lt;br /&gt;
However, currently we can only specify one kind of rubric for an assignment.  This means that teams working on different topics will be evaluated using the same rubric.  With this setup, it's not possible to fine-tune rubrics for different topics - rubrics tend to be overly general.&lt;br /&gt;
&lt;br /&gt;
=== Feature Description ===&lt;br /&gt;
I feel like we need to talk about what that feature enables us or teaching staff to do here...&lt;br /&gt;
&lt;br /&gt;
=== What Needs to be Done ===&lt;br /&gt;
* In assignment#edit page &amp;quot;Rubrics&amp;quot; tab, add a checkbox to specify whether rubric should vary by topic.&lt;br /&gt;
* In assignment#edit page &amp;quot;Topics&amp;quot; tab, add a dropdown next to each topic to specify which rubric is associated with the topic.&lt;br /&gt;
** This dropdown should appear only if rubric should vary by topic, per the Rubrics tab.&lt;br /&gt;
** By default, the rubric for each course project will be the one specified in “Rubrics” tab.&lt;br /&gt;
** The dropdown value can overwrite the default rubric.&lt;br /&gt;
* Be careful when making changes to the code&lt;br /&gt;
** The signup_sheet_controller should have as little to do as possible with the selection of rubrics.&lt;br /&gt;
** Anything not germane to selecting topics should be in another controller or (more probably) a helper.&lt;br /&gt;
* Create a DB migration to allow rubric to vary by topic as well as by round.&lt;br /&gt;
&lt;br /&gt;
=== Previous Work ===&lt;br /&gt;
Here we describe what has been done by other team...&lt;br /&gt;
# [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1873_Specialized_rubics_for_different_topic_types Wiki]&lt;br /&gt;
# [https://github.com/expertiza/expertiza/pull/1327 Pull Request]&lt;br /&gt;
# [https://drive.google.com/file/d/1UrLb0Ula_Lb_F4MOrdC-s6xng6B08VYu/view Video Demo]&lt;br /&gt;
&lt;br /&gt;
== Project Implementation ==&lt;br /&gt;
&lt;br /&gt;
Here is the project implementation. &lt;br /&gt;
&lt;br /&gt;
=== Design Strategy ===&lt;br /&gt;
&lt;br /&gt;
* app/views/assignments/edit/_rubrics.html.erb&lt;br /&gt;
** Add a new checkbox for whether or not rubrics vary by topic&lt;br /&gt;
&lt;br /&gt;
* app/views/assignments/edit.html.erb&lt;br /&gt;
** Break out code dealing with topics into app/views/assignments/edit/_topics.html.erb&lt;br /&gt;
&lt;br /&gt;
* app/views/assignments/edit/_topics.html.erb&lt;br /&gt;
** Add a new column in the topics table for choosing rubric(s)&lt;br /&gt;
*** New column only visible if rubrics vary by topic, per Rubrics tab&lt;br /&gt;
*** New column has multiple rounds per topic only if rubrics vary by round, per Rubrics tab&lt;br /&gt;
** Default value for any rubric is that rubric which is shown on Rubrics tab&lt;br /&gt;
** Use the code in app/views/assignments/edit/_rubrics.html.erb for inspiration only&lt;br /&gt;
*** Break as much actual work as possible out into helper methods that are simply called from this view&lt;br /&gt;
*** Views are not intended to do heavy lifting&lt;br /&gt;
*** Use as little JavaScript as possible&lt;br /&gt;
*** This is a Ruby On Rails project, not a JS project&lt;br /&gt;
&lt;br /&gt;
* app/helpers/assignment_helper.rb&lt;br /&gt;
** Improve readability of assignment_questionnaire method&lt;br /&gt;
*** Add comment block at the top describing the purpose and basic strategy of the method&lt;br /&gt;
*** Rename 'number' parameter to clarify the purpose of the parameter&lt;br /&gt;
** Expand functionality of assignment_questionnaire method&lt;br /&gt;
*** Add ability to get assignment questionnaires by topic as well as by round&lt;br /&gt;
*** Like round, topic parameter should be optional&lt;br /&gt;
&lt;br /&gt;
* spec/helpers&lt;br /&gt;
** Add spec/helpers/assignment_helper_spec.rb file&lt;br /&gt;
*** Thoroughly test app/helpers/assignment_helper.rb assignment_questionnaire method&lt;br /&gt;
** Add tests for any newly created helpers or helper methods&lt;br /&gt;
&lt;br /&gt;
* db/migrate&lt;br /&gt;
** Create a new migration to link topics to rubrics&lt;br /&gt;
*** This migration will add a column to the table &amp;quot;assignment_questionnaires&amp;quot;&lt;br /&gt;
*** This table keeps track of which questionnaires are used for which assignments&lt;br /&gt;
**** questionnaire_id links to a questionnaire&lt;br /&gt;
**** assignment_id links to an assignment&lt;br /&gt;
**** used_in_round links to a particular round of an assignment&lt;br /&gt;
**** the migration will add &amp;quot;topic_id&amp;quot; to link also to a particular topic within an assignment&lt;br /&gt;
** The original suggestion was to &amp;quot;add questionnaire_id in sign_up_topics table&amp;quot;&lt;br /&gt;
*** This suggestion would allow the rubric to vary by topic but NOT by round of assignment&lt;br /&gt;
*** As the current implementation supports rubric varying by round of assignment, we should keep this support&lt;br /&gt;
** The previous submission for this feature added a new table &amp;quot;topic_questionnaires&amp;quot;&lt;br /&gt;
*** This is not necessary as we already have a table which associates questionnaires with assignments and rounds&lt;br /&gt;
*** We are better off associating questionnaires with topics in this existing table to limit code changes and enhance code readability&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
More of the code part section. With some code snippets.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
Here may be list the files that were involved to implement the project. &lt;br /&gt;
&lt;br /&gt;
== How To ==&lt;br /&gt;
Here give descriptions on how to use new feature.&lt;br /&gt;
&lt;br /&gt;
=== Add a New Rubric ===&lt;br /&gt;
&lt;br /&gt;
* [to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
=== Select a Rubric for a Topic ===&lt;br /&gt;
&lt;br /&gt;
* [to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
== Project Testing ==&lt;br /&gt;
To test code implementation, correctness of the added feature, verify that the team did not break any existing functionalities in the Expertiza, and ensure that no bugs were introduced in the code, we utilized the following Test Strategy:&lt;br /&gt;
# Code inspection&lt;br /&gt;
# Run and pass existing RSpec Tests&lt;br /&gt;
# Develop New RSpec Tests&lt;br /&gt;
# Run through live UI to test a feature using Expertiza instance&lt;br /&gt;
&lt;br /&gt;
=== Rspec Testing ===&lt;br /&gt;
&lt;br /&gt;
Our strategy for gaining confidence that our code changes did not break anything was as follows:&lt;br /&gt;
* Run all existing RSpec tests on any changed files, after our changes, to ensure that we have not introduced any failures.&lt;br /&gt;
* The commands and results are shown below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  [to be populated after coding is complete]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Write new comprehensive RSpec tests, for all new methods.&lt;br /&gt;
* Run these tests, to ensure that the new code works as intended.&lt;br /&gt;
* The commands and results are shown below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  [to be populated after coding is complete]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The test suite for a single new method is below.&lt;br /&gt;
* There are many such suites in (TODO add filename(s)).  &lt;br /&gt;
* This example illustrates our general strategy:&lt;br /&gt;
** test missing input&lt;br /&gt;
** test bad input&lt;br /&gt;
** test various acceptable forms of input&lt;br /&gt;
** test scenarios that lead to &amp;quot;true&amp;quot; and to &amp;quot;false&amp;quot; return values&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  [to be populated after coding is complete]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== UI Testing ===&lt;br /&gt;
Here we describe UI Testing that has performed. Include Screenshots maybe?&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
Conclude on the project (anything your want to add).&lt;br /&gt;
&lt;br /&gt;
== Useful Links ==&lt;br /&gt;
In this section we provide useful links related to the work that has been completed by our team.&lt;br /&gt;
# [https://github.com/gabalmat/expertiza Forked Project Repository]&lt;br /&gt;
# [(add link here) Pull Request]&lt;br /&gt;
# [(add link here) Video Demonstration of Specialized Rubrics]&lt;br /&gt;
# [(add link here) Video Demonstration of Passing Rspec Tests]&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Contacts ===&lt;br /&gt;
We have 4 (four) members in our team and 1 (one) mentor was also assigned to us. For any project-related questions/concerns please contact us:&lt;br /&gt;
* Aurora Tiffany-Davis - attiffan@ncsu.edu&lt;br /&gt;
* Ginger Balmat - gabalmat@ncsu.edu&lt;br /&gt;
* Joe Hutchinson - jehutch3@ncsu.edu&lt;br /&gt;
* Nikolay Titov - ngtitov@ncsu.edu&lt;br /&gt;
* Zhewei Hu (mentor) - zhu6@ncsu.edu&lt;br /&gt;
&lt;br /&gt;
=== Contribution Based Inquiry ===&lt;br /&gt;
For any questions or concerns related to the project design, implementation, testing of the feature developed by our team, please contact an engineer who worked closely on the topic of your interest based on the [https://docs.google.com/spreadsheets/d/11uxuI_5gaC-FQDwIOxtCaN3HZ9bfWDJgIjFemtYV5jE/edit?ts=5ca222f3#gid=0 Contribution Assignment Grid] we created to keep track of our progress and contribution. Please carbon copy all team members and our mentor in the email.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* Expertiza Web [https://github.com/expertiza/expertiza#expertiza]&lt;br /&gt;
* Expertiza on GitHub [https://github.com/expertiza/expertiza]&lt;br /&gt;
* Expertiza Wiki [http://wikis.lib.ncsu.edu/index.php/Expertiza]&lt;br /&gt;
* Rspec Documentation [https://relishapp.com/rspec]&lt;br /&gt;
* Wiki with Previous Work [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1873_Specialized_rubics_for_different_topic_types]&lt;br /&gt;
* Pull Request of the Previous Work [https://github.com/expertiza/expertiza/pull/1327]&lt;/div&gt;</summary>
		<author><name>Ngtitov</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics&amp;diff=123201</id>
		<title>E1936 Specialized Rubrics</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics&amp;diff=123201"/>
		<updated>2019-04-05T18:04:30Z</updated>

		<summary type="html">&lt;p&gt;Ngtitov: /* How To */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page describes the work and goals that have been completed and achieved while implementing Expertiza Project &amp;quot;E1936. Specialized Rubrics for Different Topic Types (e.g., Servo project, refactoring project)&amp;quot; for the CSC/ECE 517 &amp;quot;Object-Oriented Design and Development&amp;quot; class, in the Spring semester of the 2019.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This Wiki page is created per CSC/ECE 517: &amp;quot;Object-Oriented Design and Development&amp;quot;, Expertiza Project requirements (Spring, 2019).&lt;br /&gt;
&lt;br /&gt;
Our [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Team_Contacts_and_Contribution team] was assigned to &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936]. Specialized Rubrics for Different Topic Types (e.g., Servo project, refactoring project)&amp;quot; Expertiza Project. In this page we describe what work has been completed by our team to ... Each section below provides clear and descriptive review on the subject we cover.&lt;br /&gt;
&lt;br /&gt;
We start with introduction to Expertiza application. We describe how and why Expertiza is used by students and teaching staff for CSC/ECE 517 class.&lt;br /&gt;
&lt;br /&gt;
=== Expertiza ===&lt;br /&gt;
[https://expertiza.ncsu.edu/ Expertiza] is a ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
Here we describe project details starting with Problem statement, description of what needs to be done, previous work that was done ... &lt;br /&gt;
&lt;br /&gt;
=== Problem Statement ===&lt;br /&gt;
In CSC/ECE 517, there are several types of topics that could be covered in a single class assignment.&lt;br /&gt;
* Code base&lt;br /&gt;
** Expertiza&lt;br /&gt;
** Mozilla&lt;br /&gt;
** etc.&lt;br /&gt;
* Goal&lt;br /&gt;
** Refactoring&lt;br /&gt;
** Testing&lt;br /&gt;
** etc.&lt;br /&gt;
However, currently we can only specify one kind of rubric for an assignment.  This means that teams working on different topics will be evaluated using the same rubric.  With this setup, it's not possible to fine-tune rubrics for different topics - rubrics tend to be overly general.&lt;br /&gt;
&lt;br /&gt;
=== Feature Description ===&lt;br /&gt;
I feel like we need to talk about what that feature enables us or teaching staff to do here...&lt;br /&gt;
&lt;br /&gt;
=== What Needs to be Done ===&lt;br /&gt;
* In assignment#edit page &amp;quot;Rubrics&amp;quot; tab, add a checkbox to specify whether rubric should vary by topic.&lt;br /&gt;
* In assignment#edit page &amp;quot;Topics&amp;quot; tab, add a dropdown next to each topic to specify which rubric is associated with the topic.&lt;br /&gt;
** This dropdown should appear only if rubric should vary by topic, per the Rubrics tab.&lt;br /&gt;
** By default, the rubric for each course project will be the one specified in “Rubrics” tab.&lt;br /&gt;
** The dropdown value can overwrite the default rubric.&lt;br /&gt;
* Be careful when making changes to the code&lt;br /&gt;
** The signup_sheet_controller should have as little to do as possible with the selection of rubrics.&lt;br /&gt;
** Anything not germane to selecting topics should be in another controller or (more probably) a helper.&lt;br /&gt;
* Create a DB migration to allow rubric to vary by topic as well as by round.&lt;br /&gt;
&lt;br /&gt;
=== Previous Work ===&lt;br /&gt;
Here we describe what has been done by other team...&lt;br /&gt;
# [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1873_Specialized_rubics_for_different_topic_types Wiki]&lt;br /&gt;
# [https://github.com/expertiza/expertiza/pull/1327 Pull Request]&lt;br /&gt;
# [https://drive.google.com/file/d/1UrLb0Ula_Lb_F4MOrdC-s6xng6B08VYu/view Video Demo]&lt;br /&gt;
&lt;br /&gt;
== Project Implementation ==&lt;br /&gt;
&lt;br /&gt;
Here is the project implementation. &lt;br /&gt;
&lt;br /&gt;
=== Design Strategy ===&lt;br /&gt;
&lt;br /&gt;
* app/views/assignments/edit/_rubrics.html.erb&lt;br /&gt;
** Add a new checkbox for whether or not rubrics vary by topic&lt;br /&gt;
&lt;br /&gt;
* app/views/assignments/edit.html.erb&lt;br /&gt;
** Break out code dealing with topics into app/views/assignments/edit/_topics.html.erb&lt;br /&gt;
&lt;br /&gt;
* app/views/assignments/edit/_topics.html.erb&lt;br /&gt;
** Add a new column in the topics table for choosing rubric(s)&lt;br /&gt;
*** New column only visible if rubrics vary by topic, per Rubrics tab&lt;br /&gt;
*** New column has multiple rounds per topic only if rubrics vary by round, per Rubrics tab&lt;br /&gt;
** Default value for any rubric is that rubric which is shown on Rubrics tab&lt;br /&gt;
** Use the code in app/views/assignments/edit/_rubrics.html.erb for inspiration only&lt;br /&gt;
*** Break as much actual work as possible out into helper methods that are simply called from this view&lt;br /&gt;
*** Views are not intended to do heavy lifting&lt;br /&gt;
*** Use as little JavaScript as possible&lt;br /&gt;
*** This is a Ruby On Rails project, not a JS project&lt;br /&gt;
&lt;br /&gt;
* app/helpers/assignment_helper.rb&lt;br /&gt;
** Improve readability of assignment_questionnaire method&lt;br /&gt;
*** Add comment block at the top describing the purpose and basic strategy of the method&lt;br /&gt;
*** Rename 'number' parameter to clarify the purpose of the parameter&lt;br /&gt;
** Expand functionality of assignment_questionnaire method&lt;br /&gt;
*** Add ability to get assignment questionnaires by topic as well as by round&lt;br /&gt;
*** Like round, topic parameter should be optional&lt;br /&gt;
&lt;br /&gt;
* spec/helpers&lt;br /&gt;
** Add spec/helpers/assignment_helper_spec.rb file&lt;br /&gt;
*** Thoroughly test app/helpers/assignment_helper.rb assignment_questionnaire method&lt;br /&gt;
** Add tests for any newly created helpers or helper methods&lt;br /&gt;
&lt;br /&gt;
* db/migrate&lt;br /&gt;
** Create a new migration to link topics to rubrics&lt;br /&gt;
*** This migration will add a column to the table &amp;quot;assignment_questionnaires&amp;quot;&lt;br /&gt;
*** This table keeps track of which questionnaires are used for which assignments&lt;br /&gt;
**** questionnaire_id links to a questionnaire&lt;br /&gt;
**** assignment_id links to an assignment&lt;br /&gt;
**** used_in_round links to a particular round of an assignment&lt;br /&gt;
**** the migration will add &amp;quot;topic_id&amp;quot; to link also to a particular topic within an assignment&lt;br /&gt;
** The original suggestion was to &amp;quot;add questionnaire_id in sign_up_topics table&amp;quot;&lt;br /&gt;
*** This suggestion would allow the rubric to vary by topic but NOT by round of assignment&lt;br /&gt;
*** As the current implementation supports rubric varying by round of assignment, we should keep this support&lt;br /&gt;
** The previous submission for this feature added a new table &amp;quot;topic_questionnaires&amp;quot;&lt;br /&gt;
*** This is not necessary as we already have a table which associates questionnaires with assignments and rounds&lt;br /&gt;
*** We are better off associating questionnaires with topics in this existing table to limit code changes and enhance code readability&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
More of the code part section. With some code snippets.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
Here may be list the files that were involved to implement the project. &lt;br /&gt;
&lt;br /&gt;
== How To ==&lt;br /&gt;
Here give descriptions on how to use new feature.&lt;br /&gt;
&lt;br /&gt;
=== Add a New Rubric ===&lt;br /&gt;
&lt;br /&gt;
* [to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
=== Select a Rubric for a Topic ===&lt;br /&gt;
&lt;br /&gt;
* [to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
== Project Testing ==&lt;br /&gt;
To test code implementation, correctness of the added feature, verify that the team did not break any existing functionalities in the Expertiza, and ensure that no bugs were introduced in the code, we utilized the following Test Strategy:&lt;br /&gt;
# Code inspection&lt;br /&gt;
# Run and pass existing RSpec Tests&lt;br /&gt;
# Develop New RSpec Tests&lt;br /&gt;
# Run through live UI to test a feature using Expertiza instance&lt;br /&gt;
&lt;br /&gt;
=== Rspec Testing ===&lt;br /&gt;
&lt;br /&gt;
Our strategy for gaining confidence that our code changes did not break anything was as follows:&lt;br /&gt;
* Run all existing RSpec tests on any changed files, after our changes, to ensure that we have not introduced any failures.&lt;br /&gt;
* The commands and results are shown below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  [to be populated after coding is complete]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Write new comprehensive RSpec tests, for all new methods.&lt;br /&gt;
* Run these tests, to ensure that the new code works as intended.&lt;br /&gt;
* The commands and results are shown below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  [to be populated after coding is complete]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The test suite for a single new method is below.&lt;br /&gt;
* There are many such suites in (TODO add filename(s)).  &lt;br /&gt;
* This example illustrates our general strategy:&lt;br /&gt;
** test missing input&lt;br /&gt;
** test bad input&lt;br /&gt;
** test various acceptable forms of input&lt;br /&gt;
** test scenarios that lead to &amp;quot;true&amp;quot; and to &amp;quot;false&amp;quot; return values&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  [to be populated after coding is complete]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== UI Testing ===&lt;br /&gt;
Here we describe UI Testing that has performed. Include Screenshots maybe?&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
Conclude on the project (anything your want to add).&lt;br /&gt;
&lt;br /&gt;
== Useful Links ==&lt;br /&gt;
In this section we provide useful links related to the work that has been completed by our team.&lt;br /&gt;
# [https://github.com/gabalmat/expertiza Forked Project Repository]&lt;br /&gt;
# [(add link here) Pull Request]&lt;br /&gt;
# [(add link here) Video Demonstration of Specialized Rubrics]&lt;br /&gt;
# [(add link here) Video Demonstration of Passing Rspec Tests]&lt;br /&gt;
&lt;br /&gt;
== Team Contacts and Contribution ==&lt;br /&gt;
&lt;br /&gt;
We have 4 (four) members in our team and 1 (one) mentor was also assigned to us. For any project-related questions/concerns please contact us:&lt;br /&gt;
* Aurora Tiffany-Davis - attiffan@ncsu.edu&lt;br /&gt;
* Ginger Balmat - gabalmat@ncsu.edu&lt;br /&gt;
* Joe Hutchinson - jehutch3@ncsu.edu&lt;br /&gt;
* Nikolay Titov - ngtitov@ncsu.edu&lt;br /&gt;
* Zhewei Hu (mentor) - zhu6@ncsu.edu&lt;br /&gt;
&lt;br /&gt;
For any questions or concerns related to the project design, implementation, testing of the feature developed by our team, please contact an engineer who worked closely on the topic of your interest based on the [https://docs.google.com/spreadsheets/d/11uxuI_5gaC-FQDwIOxtCaN3HZ9bfWDJgIjFemtYV5jE/edit?ts=5ca222f3#gid=0 Contribution Assignment Grid] we created to keep track of our progress and contribution. Please carbon copy all team members and our mentor in the email.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* Expertiza Web [https://github.com/expertiza/expertiza#expertiza]&lt;br /&gt;
* Expertiza on GitHub [https://github.com/expertiza/expertiza]&lt;br /&gt;
* Expertiza Wiki [http://wikis.lib.ncsu.edu/index.php/Expertiza]&lt;br /&gt;
* Rspec Documentation [https://relishapp.com/rspec]&lt;br /&gt;
* Wiki with Previous Work [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1873_Specialized_rubics_for_different_topic_types]&lt;br /&gt;
* Pull Request of the Previous Work [https://github.com/expertiza/expertiza/pull/1327]&lt;/div&gt;</summary>
		<author><name>Ngtitov</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics&amp;diff=123200</id>
		<title>E1936 Specialized Rubrics</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics&amp;diff=123200"/>
		<updated>2019-04-05T18:03:44Z</updated>

		<summary type="html">&lt;p&gt;Ngtitov: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page describes the work and goals that have been completed and achieved while implementing Expertiza Project &amp;quot;E1936. Specialized Rubrics for Different Topic Types (e.g., Servo project, refactoring project)&amp;quot; for the CSC/ECE 517 &amp;quot;Object-Oriented Design and Development&amp;quot; class, in the Spring semester of the 2019.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This Wiki page is created per CSC/ECE 517: &amp;quot;Object-Oriented Design and Development&amp;quot;, Expertiza Project requirements (Spring, 2019).&lt;br /&gt;
&lt;br /&gt;
Our [http://wiki.expertiza.ncsu.edu/index.php/E1936_Specialized_Rubrics#Team_Contacts_and_Contribution team] was assigned to &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936]. Specialized Rubrics for Different Topic Types (e.g., Servo project, refactoring project)&amp;quot; Expertiza Project. In this page we describe what work has been completed by our team to ... Each section below provides clear and descriptive review on the subject we cover.&lt;br /&gt;
&lt;br /&gt;
We start with introduction to Expertiza application. We describe how and why Expertiza is used by students and teaching staff for CSC/ECE 517 class.&lt;br /&gt;
&lt;br /&gt;
=== Expertiza ===&lt;br /&gt;
[https://expertiza.ncsu.edu/ Expertiza] is a ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
Here we describe project details starting with Problem statement, description of what needs to be done, previous work that was done ... &lt;br /&gt;
&lt;br /&gt;
=== Problem Statement ===&lt;br /&gt;
In CSC/ECE 517, there are several types of topics that could be covered in a single class assignment.&lt;br /&gt;
* Code base&lt;br /&gt;
** Expertiza&lt;br /&gt;
** Mozilla&lt;br /&gt;
** etc.&lt;br /&gt;
* Goal&lt;br /&gt;
** Refactoring&lt;br /&gt;
** Testing&lt;br /&gt;
** etc.&lt;br /&gt;
However, currently we can only specify one kind of rubric for an assignment.  This means that teams working on different topics will be evaluated using the same rubric.  With this setup, it's not possible to fine-tune rubrics for different topics - rubrics tend to be overly general.&lt;br /&gt;
&lt;br /&gt;
=== Feature Description ===&lt;br /&gt;
I feel like we need to talk about what that feature enables us or teaching staff to do here...&lt;br /&gt;
&lt;br /&gt;
=== What Needs to be Done ===&lt;br /&gt;
* In assignment#edit page &amp;quot;Rubrics&amp;quot; tab, add a checkbox to specify whether rubric should vary by topic.&lt;br /&gt;
* In assignment#edit page &amp;quot;Topics&amp;quot; tab, add a dropdown next to each topic to specify which rubric is associated with the topic.&lt;br /&gt;
** This dropdown should appear only if rubric should vary by topic, per the Rubrics tab.&lt;br /&gt;
** By default, the rubric for each course project will be the one specified in “Rubrics” tab.&lt;br /&gt;
** The dropdown value can overwrite the default rubric.&lt;br /&gt;
* Be careful when making changes to the code&lt;br /&gt;
** The signup_sheet_controller should have as little to do as possible with the selection of rubrics.&lt;br /&gt;
** Anything not germane to selecting topics should be in another controller or (more probably) a helper.&lt;br /&gt;
* Create a DB migration to allow rubric to vary by topic as well as by round.&lt;br /&gt;
&lt;br /&gt;
=== Previous Work ===&lt;br /&gt;
Here we describe what has been done by other team...&lt;br /&gt;
# [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1873_Specialized_rubics_for_different_topic_types Wiki]&lt;br /&gt;
# [https://github.com/expertiza/expertiza/pull/1327 Pull Request]&lt;br /&gt;
# [https://drive.google.com/file/d/1UrLb0Ula_Lb_F4MOrdC-s6xng6B08VYu/view Video Demo]&lt;br /&gt;
&lt;br /&gt;
== Project Implementation ==&lt;br /&gt;
&lt;br /&gt;
Here is the project implementation. &lt;br /&gt;
&lt;br /&gt;
=== Design Strategy ===&lt;br /&gt;
&lt;br /&gt;
* app/views/assignments/edit/_rubrics.html.erb&lt;br /&gt;
** Add a new checkbox for whether or not rubrics vary by topic&lt;br /&gt;
&lt;br /&gt;
* app/views/assignments/edit.html.erb&lt;br /&gt;
** Break out code dealing with topics into app/views/assignments/edit/_topics.html.erb&lt;br /&gt;
&lt;br /&gt;
* app/views/assignments/edit/_topics.html.erb&lt;br /&gt;
** Add a new column in the topics table for choosing rubric(s)&lt;br /&gt;
*** New column only visible if rubrics vary by topic, per Rubrics tab&lt;br /&gt;
*** New column has multiple rounds per topic only if rubrics vary by round, per Rubrics tab&lt;br /&gt;
** Default value for any rubric is that rubric which is shown on Rubrics tab&lt;br /&gt;
** Use the code in app/views/assignments/edit/_rubrics.html.erb for inspiration only&lt;br /&gt;
*** Break as much actual work as possible out into helper methods that are simply called from this view&lt;br /&gt;
*** Views are not intended to do heavy lifting&lt;br /&gt;
*** Use as little JavaScript as possible&lt;br /&gt;
*** This is a Ruby On Rails project, not a JS project&lt;br /&gt;
&lt;br /&gt;
* app/helpers/assignment_helper.rb&lt;br /&gt;
** Improve readability of assignment_questionnaire method&lt;br /&gt;
*** Add comment block at the top describing the purpose and basic strategy of the method&lt;br /&gt;
*** Rename 'number' parameter to clarify the purpose of the parameter&lt;br /&gt;
** Expand functionality of assignment_questionnaire method&lt;br /&gt;
*** Add ability to get assignment questionnaires by topic as well as by round&lt;br /&gt;
*** Like round, topic parameter should be optional&lt;br /&gt;
&lt;br /&gt;
* spec/helpers&lt;br /&gt;
** Add spec/helpers/assignment_helper_spec.rb file&lt;br /&gt;
*** Thoroughly test app/helpers/assignment_helper.rb assignment_questionnaire method&lt;br /&gt;
** Add tests for any newly created helpers or helper methods&lt;br /&gt;
&lt;br /&gt;
* db/migrate&lt;br /&gt;
** Create a new migration to link topics to rubrics&lt;br /&gt;
*** This migration will add a column to the table &amp;quot;assignment_questionnaires&amp;quot;&lt;br /&gt;
*** This table keeps track of which questionnaires are used for which assignments&lt;br /&gt;
**** questionnaire_id links to a questionnaire&lt;br /&gt;
**** assignment_id links to an assignment&lt;br /&gt;
**** used_in_round links to a particular round of an assignment&lt;br /&gt;
**** the migration will add &amp;quot;topic_id&amp;quot; to link also to a particular topic within an assignment&lt;br /&gt;
** The original suggestion was to &amp;quot;add questionnaire_id in sign_up_topics table&amp;quot;&lt;br /&gt;
*** This suggestion would allow the rubric to vary by topic but NOT by round of assignment&lt;br /&gt;
*** As the current implementation supports rubric varying by round of assignment, we should keep this support&lt;br /&gt;
** The previous submission for this feature added a new table &amp;quot;topic_questionnaires&amp;quot;&lt;br /&gt;
*** This is not necessary as we already have a table which associates questionnaires with assignments and rounds&lt;br /&gt;
*** We are better off associating questionnaires with topics in this existing table to limit code changes and enhance code readability&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
More of the code part section. With some code snippets.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
Here may be list the files that were involved to implement the project. &lt;br /&gt;
&lt;br /&gt;
== How To ==&lt;br /&gt;
Here we can give descriptions on how to use new feature.&lt;br /&gt;
&lt;br /&gt;
=== Adding a New Rubric ===&lt;br /&gt;
&lt;br /&gt;
* [to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
=== Selecting a Rubric for a Topic ===&lt;br /&gt;
&lt;br /&gt;
* [to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
== Project Testing ==&lt;br /&gt;
To test code implementation, correctness of the added feature, verify that the team did not break any existing functionalities in the Expertiza, and ensure that no bugs were introduced in the code, we utilized the following Test Strategy:&lt;br /&gt;
# Code inspection&lt;br /&gt;
# Run and pass existing RSpec Tests&lt;br /&gt;
# Develop New RSpec Tests&lt;br /&gt;
# Run through live UI to test a feature using Expertiza instance&lt;br /&gt;
&lt;br /&gt;
=== Rspec Testing ===&lt;br /&gt;
&lt;br /&gt;
Our strategy for gaining confidence that our code changes did not break anything was as follows:&lt;br /&gt;
* Run all existing RSpec tests on any changed files, after our changes, to ensure that we have not introduced any failures.&lt;br /&gt;
* The commands and results are shown below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  [to be populated after coding is complete]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Write new comprehensive RSpec tests, for all new methods.&lt;br /&gt;
* Run these tests, to ensure that the new code works as intended.&lt;br /&gt;
* The commands and results are shown below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  [to be populated after coding is complete]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The test suite for a single new method is below.&lt;br /&gt;
* There are many such suites in (TODO add filename(s)).  &lt;br /&gt;
* This example illustrates our general strategy:&lt;br /&gt;
** test missing input&lt;br /&gt;
** test bad input&lt;br /&gt;
** test various acceptable forms of input&lt;br /&gt;
** test scenarios that lead to &amp;quot;true&amp;quot; and to &amp;quot;false&amp;quot; return values&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  [to be populated after coding is complete]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== UI Testing ===&lt;br /&gt;
Here we describe UI Testing that has performed. Include Screenshots maybe?&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
Conclude on the project (anything your want to add).&lt;br /&gt;
&lt;br /&gt;
== Useful Links ==&lt;br /&gt;
In this section we provide useful links related to the work that has been completed by our team.&lt;br /&gt;
# [https://github.com/gabalmat/expertiza Forked Project Repository]&lt;br /&gt;
# [(add link here) Pull Request]&lt;br /&gt;
# [(add link here) Video Demonstration of Specialized Rubrics]&lt;br /&gt;
# [(add link here) Video Demonstration of Passing Rspec Tests]&lt;br /&gt;
&lt;br /&gt;
== Team Contacts and Contribution ==&lt;br /&gt;
&lt;br /&gt;
We have 4 (four) members in our team and 1 (one) mentor was also assigned to us. For any project-related questions/concerns please contact us:&lt;br /&gt;
* Aurora Tiffany-Davis - attiffan@ncsu.edu&lt;br /&gt;
* Ginger Balmat - gabalmat@ncsu.edu&lt;br /&gt;
* Joe Hutchinson - jehutch3@ncsu.edu&lt;br /&gt;
* Nikolay Titov - ngtitov@ncsu.edu&lt;br /&gt;
* Zhewei Hu (mentor) - zhu6@ncsu.edu&lt;br /&gt;
&lt;br /&gt;
For any questions or concerns related to the project design, implementation, testing of the feature developed by our team, please contact an engineer who worked closely on the topic of your interest based on the [https://docs.google.com/spreadsheets/d/11uxuI_5gaC-FQDwIOxtCaN3HZ9bfWDJgIjFemtYV5jE/edit?ts=5ca222f3#gid=0 Contribution Assignment Grid] we created to keep track of our progress and contribution. Please carbon copy all team members and our mentor in the email.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* Expertiza Web [https://github.com/expertiza/expertiza#expertiza]&lt;br /&gt;
* Expertiza on GitHub [https://github.com/expertiza/expertiza]&lt;br /&gt;
* Expertiza Wiki [http://wikis.lib.ncsu.edu/index.php/Expertiza]&lt;br /&gt;
* Rspec Documentation [https://relishapp.com/rspec]&lt;br /&gt;
* Wiki with Previous Work [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1873_Specialized_rubics_for_different_topic_types]&lt;br /&gt;
* Pull Request of the Previous Work [https://github.com/expertiza/expertiza/pull/1327]&lt;/div&gt;</summary>
		<author><name>Ngtitov</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics&amp;diff=123199</id>
		<title>E1936 Specialized Rubrics</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1936_Specialized_Rubrics&amp;diff=123199"/>
		<updated>2019-04-05T17:51:35Z</updated>

		<summary type="html">&lt;p&gt;Ngtitov: /* E1936. Specialized Rubrics for Different Topic Types */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page describes the work that has been completed and goals achieved while implementing Expertiza Project &amp;quot;E1936. Specialized Rubrics for Different Topic Types (e.g., Servo project, refactoring project)&amp;quot; for the CSC/ECE 517 &amp;quot;Object-Oriented Design and Development&amp;quot; class, in the Spring semester of the 2019.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
This Wiki page is created per CSC/ECE 517: &amp;quot;Object-Oriented Design and Development&amp;quot;, Expertiza Project requirements (Spring, 2019).&lt;br /&gt;
&lt;br /&gt;
Our team was assigned to &amp;quot;[https://docs.google.com/document/d/1Ozw2Bj2u_LyeKUdDqAyQtz1stEIKrxkmRnwmNyUgmzw/edit#heading=h.z86zstcoj6u7 E1936]. Specialized Rubrics for Different Topic Types (e.g., Servo project, refactoring project)&amp;quot; Expertiza Project. In this page we describe what work has been completed by our team to ... Each section below provides clear and descriptive review on the subject we cover.&lt;br /&gt;
&lt;br /&gt;
We start with introduction to Expertiza application. We describe how and why Expertiza is used by students and teaching staff for CSC/ECE 517 class.&lt;br /&gt;
&lt;br /&gt;
=== Expertiza ===&lt;br /&gt;
&lt;br /&gt;
[https://expertiza.ncsu.edu/ Expertiza] is a ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
Here we describe project details starting with Problem statement, description of what needs to be done, previous work that was done ... &lt;br /&gt;
&lt;br /&gt;
=== Problem Statement ===&lt;br /&gt;
&lt;br /&gt;
In CSC/ECE 517, there are several types of topics that could be covered in a single class assignment.&lt;br /&gt;
* Code base&lt;br /&gt;
** Expertiza&lt;br /&gt;
** Mozilla&lt;br /&gt;
** etc.&lt;br /&gt;
* Goal&lt;br /&gt;
** Refactoring&lt;br /&gt;
** Testing&lt;br /&gt;
** etc.&lt;br /&gt;
However, currently we can only specify one kind of rubric for an assignment.  This means that teams working on different topics will be evaluated using the same rubric.  With this setup, it's not possible to fine-tune rubrics for different topics - rubrics tend to be overly general.&lt;br /&gt;
&lt;br /&gt;
=== Feature Description ===&lt;br /&gt;
I feel like we need to talk about what that feature enables us or teaching staff to do here...&lt;br /&gt;
&lt;br /&gt;
=== What Needs to be Done ===&lt;br /&gt;
&lt;br /&gt;
* In assignment#edit page &amp;quot;Rubrics&amp;quot; tab, add a checkbox to specify whether rubric should vary by topic.&lt;br /&gt;
* In assignment#edit page &amp;quot;Topics&amp;quot; tab, add a dropdown next to each topic to specify which rubric is associated with the topic.&lt;br /&gt;
** This dropdown should appear only if rubric should vary by topic, per the Rubrics tab.&lt;br /&gt;
** By default, the rubric for each course project will be the one specified in “Rubrics” tab.&lt;br /&gt;
** The dropdown value can overwrite the default rubric.&lt;br /&gt;
* Be careful when making changes to the code&lt;br /&gt;
** The signup_sheet_controller should have as little to do as possible with the selection of rubrics.&lt;br /&gt;
** Anything not germane to selecting topics should be in another controller or (more probably) a helper.&lt;br /&gt;
* Create a DB migration to allow rubric to vary by topic as well as by round.&lt;br /&gt;
&lt;br /&gt;
=== Previous Work ===&lt;br /&gt;
&lt;br /&gt;
Here we describe what has been done by other team...&lt;br /&gt;
&lt;br /&gt;
== Project Implementation ==&lt;br /&gt;
&lt;br /&gt;
Here is the project implementation. &lt;br /&gt;
&lt;br /&gt;
=== Design Strategy ===&lt;br /&gt;
&lt;br /&gt;
* app/views/assignments/edit/_rubrics.html.erb&lt;br /&gt;
** Add a new checkbox for whether or not rubrics vary by topic&lt;br /&gt;
&lt;br /&gt;
* app/views/assignments/edit.html.erb&lt;br /&gt;
** Break out code dealing with topics into app/views/assignments/edit/_topics.html.erb&lt;br /&gt;
&lt;br /&gt;
* app/views/assignments/edit/_topics.html.erb&lt;br /&gt;
** Add a new column in the topics table for choosing rubric(s)&lt;br /&gt;
*** New column only visible if rubrics vary by topic, per Rubrics tab&lt;br /&gt;
*** New column has multiple rounds per topic only if rubrics vary by round, per Rubrics tab&lt;br /&gt;
** Default value for any rubric is that rubric which is shown on Rubrics tab&lt;br /&gt;
** Use the code in app/views/assignments/edit/_rubrics.html.erb for inspiration only&lt;br /&gt;
*** Break as much actual work as possible out into helper methods that are simply called from this view&lt;br /&gt;
*** Views are not intended to do heavy lifting&lt;br /&gt;
*** Use as little JavaScript as possible&lt;br /&gt;
*** This is a Ruby On Rails project, not a JS project&lt;br /&gt;
&lt;br /&gt;
* app/helpers/assignment_helper.rb&lt;br /&gt;
** Improve readability of assignment_questionnaire method&lt;br /&gt;
*** Add comment block at the top describing the purpose and basic strategy of the method&lt;br /&gt;
*** Rename 'number' parameter to clarify the purpose of the parameter&lt;br /&gt;
** Expand functionality of assignment_questionnaire method&lt;br /&gt;
*** Add ability to get assignment questionnaires by topic as well as by round&lt;br /&gt;
*** Like round, topic parameter should be optional&lt;br /&gt;
&lt;br /&gt;
* spec/helpers&lt;br /&gt;
** Add spec/helpers/assignment_helper_spec.rb file&lt;br /&gt;
*** Thoroughly test app/helpers/assignment_helper.rb assignment_questionnaire method&lt;br /&gt;
** Add tests for any newly created helpers or helper methods&lt;br /&gt;
&lt;br /&gt;
* db/migrate&lt;br /&gt;
** Create a new migration to link topics to rubrics&lt;br /&gt;
*** This migration will add a column to the table &amp;quot;assignment_questionnaires&amp;quot;&lt;br /&gt;
*** This table keeps track of which questionnaires are used for which assignments&lt;br /&gt;
**** questionnaire_id links to a questionnaire&lt;br /&gt;
**** assignment_id links to an assignment&lt;br /&gt;
**** used_in_round links to a particular round of an assignment&lt;br /&gt;
**** the migration will add &amp;quot;topic_id&amp;quot; to link also to a particular topic within an assignment&lt;br /&gt;
** The original suggestion was to &amp;quot;add questionnaire_id in sign_up_topics table&amp;quot;&lt;br /&gt;
*** This suggestion would allow the rubric to vary by topic but NOT by round of assignment&lt;br /&gt;
*** As the current implementation supports rubric varying by round of assignment, we should keep this support&lt;br /&gt;
** The previous submission for this feature added a new table &amp;quot;topic_questionnaires&amp;quot;&lt;br /&gt;
*** This is not necessary as we already have a table which associates questionnaires with assignments and rounds&lt;br /&gt;
*** We are better off associating questionnaires with topics in this existing table to limit code changes and enhance code readability&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
More of the code part section. With some code snippets.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
Here may be list the files that were involved to implement the project. &lt;br /&gt;
&lt;br /&gt;
== How To ==&lt;br /&gt;
Here we can give descriptions on how to use new feature.&lt;br /&gt;
&lt;br /&gt;
=== Adding a New Rubric ===&lt;br /&gt;
&lt;br /&gt;
* [to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
=== Selecting a Rubric for a Topic ===&lt;br /&gt;
&lt;br /&gt;
* [to be populated after coding is complete]&lt;br /&gt;
&lt;br /&gt;
== Project Testing ==&lt;br /&gt;
To test code implementation, correctness of the added feature, verify that the team did not break any existing functionalities in the Expertiza, and ensure that no bugs were introduced in the code, we utilized the following Test Strategy:&lt;br /&gt;
# Code inspection&lt;br /&gt;
# Run and pass existing RSpec Tests&lt;br /&gt;
# Develop New RSpec Tests&lt;br /&gt;
# Run through live UI to test a feature using Expertiza instance&lt;br /&gt;
&lt;br /&gt;
=== Rspec Testing ===&lt;br /&gt;
&lt;br /&gt;
Our strategy for gaining confidence that our code changes did not break anything was as follows:&lt;br /&gt;
* Run all existing RSpec tests on any changed files, after our changes, to ensure that we have not introduced any failures.&lt;br /&gt;
* The commands and results are shown below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  [to be populated after coding is complete]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Write new comprehensive RSpec tests, for all new methods.&lt;br /&gt;
* Run these tests, to ensure that the new code works as intended.&lt;br /&gt;
* The commands and results are shown below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  [to be populated after coding is complete]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The test suite for a single new method is below.&lt;br /&gt;
* There are many such suites in (TODO add filename(s)).  &lt;br /&gt;
* This example illustrates our general strategy:&lt;br /&gt;
** test missing input&lt;br /&gt;
** test bad input&lt;br /&gt;
** test various acceptable forms of input&lt;br /&gt;
** test scenarios that lead to &amp;quot;true&amp;quot; and to &amp;quot;false&amp;quot; return values&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  [to be populated after coding is complete]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== UI Testing ===&lt;br /&gt;
Here we describe UI Testing that has performed. Include Screenshots maybe?&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
Conclude on the project (anything your want to add).&lt;br /&gt;
&lt;br /&gt;
== Useful Links ==&lt;br /&gt;
In this section we provide useful links related to the work that has been completed by our team.&lt;br /&gt;
# [https://github.com/gabalmat/expertiza Forked Project Repository]&lt;br /&gt;
# [(add link here) Pull Request]&lt;br /&gt;
# [(add link here) Video Demonstration of Specialized Rubrics]&lt;br /&gt;
# [(add link here) Video Demonstration of Passing Rspec Tests]&lt;br /&gt;
&lt;br /&gt;
== Team Contacts and Contribution ==&lt;br /&gt;
&lt;br /&gt;
We have 4 (four) members in our team and 1 (one) mentor was also assigned to us. For any project-related questions/concerns please contact us:&lt;br /&gt;
* Aurora Tiffany-Davis - attiffan@ncsu.edu&lt;br /&gt;
* Ginger Balmat - gabalmat@ncsu.edu&lt;br /&gt;
* Joe Hutchinson - jehutch3@ncsu.edu&lt;br /&gt;
* Nikolay Titov - ngtitov@ncsu.edu&lt;br /&gt;
* Zhewei Hu (mentor) - zhu6@ncsu.edu&lt;br /&gt;
&lt;br /&gt;
For any questions or concerns related to the project design, implementation, testing of the feature developed by our team, please contact an engineer who worked closely on the topic of your interest based on the [https://docs.google.com/spreadsheets/d/11uxuI_5gaC-FQDwIOxtCaN3HZ9bfWDJgIjFemtYV5jE/edit?ts=5ca222f3#gid=0 Contribution Assignment Grid] we created to keep track of our progress and contribution. Please carbon copy all team members and our mentor in the email.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* Expertiza Web [https://github.com/expertiza/expertiza#expertiza]&lt;br /&gt;
* Expertiza on GitHub [https://github.com/expertiza/expertiza]&lt;br /&gt;
* Expertiza Wiki [http://wikis.lib.ncsu.edu/index.php/Expertiza]&lt;br /&gt;
* Rspec Documentation [https://relishapp.com/rspec]&lt;/div&gt;</summary>
		<author><name>Ngtitov</name></author>
	</entry>
</feed>