<?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=Psvaidya</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=Psvaidya"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Psvaidya"/>
	<updated>2026-06-09T16:22:02Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/E1731_Improve_Score_Calculation&amp;diff=108830</id>
		<title>CSC/ECE 517 Spring 2017/E1731 Improve Score Calculation</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/E1731_Improve_Score_Calculation&amp;diff=108830"/>
		<updated>2017-05-01T23:56:41Z</updated>

		<summary type="html">&lt;p&gt;Psvaidya: /* Future Work */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;nowiki&amp;gt;  Expertiza is an opensource web based platform developed to assist students in educational institutions to perform peer reviews and group projects. The reviewing is done through a mechanism where students will be sent request to review work and the system will analyze and publish a summarized report. The software is designed in MVC (Model-View-Controller) architecture using Ruby on Rails.&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Problem Description==&lt;br /&gt;
===Current Scenario===&lt;br /&gt;
Today, Expertiza stores the scores based on each response to each criterion, but no holistic scores are stored. The &amp;quot;answers&amp;quot; table only contains the scores that user A has given user B on each criterion. This means that if we need to know what score A has given B based on 100, we have to rely on the code to calculate it every time the score is requested. This design slows down Expertiza as every time an instructor clicks on &amp;quot;View Scores&amp;quot;, all the calculations are done to display the score. The situation is even worse if we want to weight the scores by the reputation of each reviewer, which is a measure of how closely that reviewer's scores match other reviewers. In this case, the system potentially has to do thousands of arithmetic calculations to display the score for a particular assignment.&lt;br /&gt;
&lt;br /&gt;
===Proposed Solution===&lt;br /&gt;
We propose that we have two mechanisms to handle the holistic scores, depending on the current state of the assignment: This new approach will take the responses and the database will act as a storage environment. &lt;br /&gt;
* OnTheFlyCalc: &lt;br /&gt;
** Calculates holistic scores over a set of data: A set of records in answers table, namely the responses from user A to user B on each criterion.&lt;br /&gt;
** When an assignment is still ongoing, the reputations for each reviewer will be calculated and handled by OnTheFlyCalc&lt;br /&gt;
** This is similar to the current scenario&lt;br /&gt;
* LocalDBCalc: &lt;br /&gt;
** Calculates the holistic score over a single db query: &amp;quot;get the score that user A gives user B on assignment 999 on round 2&amp;quot;&lt;br /&gt;
** When an asignment has finished, all the reputations will be calculated by LocalDBCalc and stored, since they are finalized. So, when the scores are requested, they will be fetched using a single db query and displayed&lt;br /&gt;
** This will be a new addition to the code as currently there is no class. &lt;br /&gt;
&lt;br /&gt;
In this project, our goal is to make the OnTheFlyCalc and LocalDBCalc work only for peer-review scores.  As future projects will introduce other types of scores, the solution must be extensible.&lt;br /&gt;
&lt;br /&gt;
==Design Plan==&lt;br /&gt;
* A new database table &amp;quot;local_db_scores&amp;quot; with following columns will be created to store the holistic scores:&lt;br /&gt;
** id: int&lt;br /&gt;
** score_type: string&lt;br /&gt;
** round: int&lt;br /&gt;
** score: int&lt;br /&gt;
** response_map_id: int (this will be reference to the response_map table)&lt;br /&gt;
* A new column &amp;quot;local_scores_calculated&amp;quot; with boolean type will be added to &amp;quot;assignments&amp;quot; table&lt;br /&gt;
** This has the default value false&lt;br /&gt;
** The value will change to true when the holistic scores for that assignment are stored in local_db_scores table&lt;br /&gt;
* A new icon will be added to the list of Assignments on the Manage Assignments page for instructor&lt;br /&gt;
** When this icon is clicked, the holistic scores will be calculated using store_total_score method in LocalDBCalc class and then inserted in this new table &amp;quot;local_db_score&amp;quot; &lt;br /&gt;
*** If the record to be inserted is a finalized peer-review score, the type stored in the database will be &amp;quot;ReviewLocalDBScore&amp;quot; and the reference_id will be the response_map id&lt;br /&gt;
*** The peer-review scores will be calculated and stored for each of the review rounds because it is possible that user A only reviews user B in one out of several rounds&lt;br /&gt;
* When a request is made to view the total scores, depending on whether local_scores_calculated column of the assignment is false or true, either OnTheFlyCalc or LocalDBCalc will be called to calculate the total score&lt;br /&gt;
&lt;br /&gt;
To achieve this functionality, following classes will be created:&lt;br /&gt;
* OnTheFlyCalc:&lt;br /&gt;
** This class will contain a method &amp;quot;compute_total_scores&amp;quot; which will compute the total score for an assignment by summing the scores given on all questionnaires and return this total score when an instructor tries to view scores for an ongoing assignment&lt;br /&gt;
** It will also contain methods to calculate the average score and score range (min, max) for each reviewee(team) for peer-review&lt;br /&gt;
** Currently OnTheFlyCalc already exists as a module. As it is only used by assignments, we plan to change it into a class and change all its methods into static methods&lt;br /&gt;
* LocalDBCalc:&lt;br /&gt;
** This class will also contain a method &amp;quot;compute_total_scores&amp;quot;. But this method will compute the total score by querying and summing the scores saved in local_db_scores table instead of summing the scores given on all questionnaires&lt;br /&gt;
** It will also contain a method &amp;quot;store_total_scores&amp;quot; which will be called when an instructor clicks on &amp;quot;Save Scores to db&amp;quot; icon for an assignment&lt;br /&gt;
*** This method will compute and save the total scores for all the response maps (reviewer -&amp;gt; reviewee) in the assignment for each round in local_db_scores table.&lt;br /&gt;
&lt;br /&gt;
[[File:Design.png|frame|center]]&lt;br /&gt;
As seen in the above image, when a user A reviews another user B (or team), a response map is created containing individual scores and responses to questionnaires. When an instructor clicks on &amp;quot;Save Scores to DB&amp;quot; icon for an assignment, &amp;quot;store_total_scores&amp;quot; method is called in LocalDBCalc class which calculates the holistic scores for each response map from the individual scores and saves it in local_db_scores table. This also sets the &amp;quot;local_scores_calculated&amp;quot; attribute to true for the assignment. Now, the next time someone tries to view these scores, they are computed using the scores saved in local_db_scores.&lt;br /&gt;
&lt;br /&gt;
[[File:Mechanism.png|frame|center]]&lt;br /&gt;
The above image shows the mechanism which will be followed. When an instructor tries to view scores for an assignment, 1st it will be checked if the local_scores_calculated attribute is true or false for the assignment. If it is false, compute_total_scores from OnTheFlyCalc class is called which will add the scores from the questionnaires. However, if it is true, compute_total_scores from LocalDbCalc class is called which will add the corresponding scores from local_db_scores table.&lt;br /&gt;
&lt;br /&gt;
==Changes Done==&lt;br /&gt;
&lt;br /&gt;
* Created a new table local_db_scores with columns id, score_type, round, score, response_map_id (foreign key to response_map table)&lt;br /&gt;
&lt;br /&gt;
* Added a new boolean type column named &amp;quot;local_scores_calculated&amp;quot; with default value false to assignments table&lt;br /&gt;
&lt;br /&gt;
* OnTheFlyCalc class:&lt;br /&gt;
** Changed &amp;quot;OnTheFlyCalc&amp;quot; module from on_the_fly_calc.rb file into a class&lt;br /&gt;
** Changed all its methods into static methods and passed assignment as a parameter for all the methods&lt;br /&gt;
** Removed the line &amp;quot;include OnTheFlyCalc&amp;quot; from assignment.rb file&lt;br /&gt;
** Made changes in all the places (eg. review_mapping_controller.rb) where any method of OnTheFlyCalc was called, so that the corresponding static method gets called now with assignment as a parameter&lt;br /&gt;
&lt;br /&gt;
* LocalDbCalc class:&lt;br /&gt;
** Created a new file local_db_calc.rb with a new class &amp;quot;LocalDbCalc&amp;quot;&lt;br /&gt;
** Created a static method &amp;quot;compute_total_score&amp;quot; with assignment as parameter&lt;br /&gt;
*** This method calculates the total score by adding all the scores of the given assignment stored in local_db_scores table&lt;br /&gt;
** Created a static method &amp;quot;store_total_scores&amp;quot; with assignment as parameter&lt;br /&gt;
*** This method saves the total score of each response map of the given assignment for each round in local_db_scores table&lt;br /&gt;
&lt;br /&gt;
* Condition for choosing LocalDbCalc/OnTheFlyCalc&lt;br /&gt;
** compute_total_scores is called from 3 files namely &amp;quot;assignment_team.rb&amp;quot;, &amp;quot;assignment_participant.rb&amp;quot; and &amp;quot;participant.rb&amp;quot;&lt;br /&gt;
** Added a new condition in the scores method in these files which checks if the &amp;quot;local_scores_calculated&amp;quot; attribute is set (true) for the given assignment&lt;br /&gt;
*** If it is set (true), compute_total_scores from LocalDbCalc class is called&lt;br /&gt;
*** If it is not set (false), compute_total_scores from OnTheFlyCalc class is called&lt;br /&gt;
&lt;br /&gt;
* Manage Assignments UI&lt;br /&gt;
** Created a new icon for each assignment. Clicking this icon stores the total scores for each response map of the assignment for each round in local_db_scores table. It then sets the local_scores_calculated attribute of the assignment to true&lt;br /&gt;
** The code for this is in assets/javascripts/tree_display.jsx&lt;br /&gt;
** Created a new method in assignments_controller.rb named &amp;quot;store_scores_to_db&amp;quot; which gets called when the above mentioned icon is clicked&lt;br /&gt;
** This method calls the &amp;quot;store_total_scores&amp;quot; method in LocalDbCalc class&lt;br /&gt;
** A route is also created for this newly created store_scores_to_db method&lt;br /&gt;
** Note: Clicking on the icon twice for the same assignment saves the latest scores again, and while viewing the scores, only the latest entries from the local_db_scores table are considered&lt;br /&gt;
&lt;br /&gt;
====Some of these code snippets are attached below====&lt;br /&gt;
The newly created LocalDbCalc class in models/local_db_calc.rb file with 2 static methods &amp;quot;compute_total_score&amp;quot; and &amp;quot;store_total_scores&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[File:S1.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:S2.png]]&lt;br /&gt;
&lt;br /&gt;
Some of the changes to models/on_the_fly_calc.rb. Changing model to class and methods to static methods by passing assignment parameter.&lt;br /&gt;
&lt;br /&gt;
[[File:S3.png]]&lt;br /&gt;
&lt;br /&gt;
The addition of the new icon on Manage Assignments page to save the scores to database. Filename: assets/javascripts/tree_display.jsx&lt;br /&gt;
&lt;br /&gt;
[[File:S4.png]]&lt;br /&gt;
&lt;br /&gt;
The new method in assignment_controller.rb which gets called when the newly created icon is clicked.&lt;br /&gt;
&lt;br /&gt;
[[File:S5.png]]&lt;br /&gt;
&lt;br /&gt;
The condition used for calling either OnTheFlyCalc or LocalDbCalc. This is similar in assignment_team.rb, assignment_participant.rb and participant.rb&lt;br /&gt;
&lt;br /&gt;
[[File:S6.png]]&lt;br /&gt;
&lt;br /&gt;
==Use Cases==&lt;br /&gt;
&lt;br /&gt;
The project can be broken down into below use cases:&lt;br /&gt;
&lt;br /&gt;
* Instructor wants to store the total scores for each response map, round for an assignment in the database. Instructor clicks on &amp;quot;save scores to db&amp;quot; icon and the scores are stored&lt;br /&gt;
* Instructor/User wants to view the scores for an assignment before storing the local scores. Total scores are calculated &amp;quot;on the fly&amp;quot; by adding score given for each question by each reviewer&lt;br /&gt;
* Instructor/user wants to view the scores for an assignment after storing the local scores. Scores are calculated by using the values stored in local_db_calc database&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
The above use cases can then be translated into three major scenarios that we need to test. The following table contains the main scenarios we will cover when testing our project.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Scenario Number&lt;br /&gt;
! Description&lt;br /&gt;
! Expected Result for Pass&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| Instructor clicks on &amp;quot;save scores to db&amp;quot; for an assignment. The scores are calculated correctly and placed into the local_db_score table. First, set up an assignment with some review questions. Let a student answer the review questions. Call the store_total_scores method in LocalDbCalc and check if a new record has been added to local_db_scores table.&lt;br /&gt;
| Query the database and verify that a new record has been added to local_db_scores table&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| Local scores are not stored and user wants to view scores. For an assignment for which the scores are not calculated, click on View Scores as an instructor, or Your Scores as a student. The score displayed should be calculated correctly on the fly using OnTheFlyCalc.&lt;br /&gt;
| Click on view scores for an assignment whose local scores are not stored and verify that the page displays the expected scores.&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| Local scores are stored and user wants to view scores. For an assignment, first click on save scores to db icon to store the total scores. Then click on View Scores as an instructor, or Your Scores as a student. The score displayed should be calculated correctly on the fly using LocalDbCalc. This test will mainly be a check if clicking view scores on the UI will result in the expected value showing up on the UI.  The interaction in getting the information in the database is already tested in Scenario 1.&lt;br /&gt;
| Click on view scores for an assignment whose local scores are stored and verify that the page displays the expected scores.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Future Work==&lt;br /&gt;
* Currently OnTheFlyCalc and LocalDbCalc are used to compute the total score for an assignment. More functionalities as below can be added to calculate/display the total scores for a team in an assignment or the total score given by each reviewer. The below mentioned additions/changes will heavily improve the response time.&lt;br /&gt;
** LocalDbCalc stores the total score for each response map for each round&lt;br /&gt;
*** These stored values in local_db_scores table can be used directly every time a student wants to view the total score they received from a particular reviewer in a particular round or when an instructor wants to see the total scores by each reviewer given to each team.&lt;br /&gt;
*** These stored values in local_db_scores table can also be used to calculate the total score received by each team, every time a team wants to view their total score or an instructor wants to view the total scores received by each team.&lt;br /&gt;
* Adding conditions to show the &amp;quot;save scores to db&amp;quot; icon only when an assignment has finished, and stop showing it again once the scores are stored.&lt;br /&gt;
** Currently this icon is present all the time and can be clicked on multiple times, even when an assignment is ongoing. So clicking on this adds the same/updated entries to the database. While viewing the scores, only the latest scores saved in database are considered.&lt;br /&gt;
** So, as a future work, this can be modified such that the icon is seen only when an assignment has finished and the scores are not yet stored. This will prevent the scores being stored multiple times or before an assignment has finished.&lt;br /&gt;
* Adding the functionality to remove the scores stored in the database. This will especially be useful after implementing the above mentioned future work because after the above future work functionality, the icon to store the scores will not be shown and if scores are updated somehow, they can't be stored again.&lt;br /&gt;
** In our current functionality, if the scores are updated, the latest scores can be stored again because the icon is always present.&lt;br /&gt;
* Add functionality to call OnTheFlyCalc to compute the scores of an assignment whose scores are already stored (if required).&lt;br /&gt;
** Currently, once the scores are stored in database for an assignment, every time LocalDbCalc will be used to view the scores of that assignment.&lt;/div&gt;</summary>
		<author><name>Psvaidya</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/E1731_Improve_Score_Calculation&amp;diff=108780</id>
		<title>CSC/ECE 517 Spring 2017/E1731 Improve Score Calculation</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/E1731_Improve_Score_Calculation&amp;diff=108780"/>
		<updated>2017-04-29T21:54:23Z</updated>

		<summary type="html">&lt;p&gt;Psvaidya: /* Changes Done */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;nowiki&amp;gt;  Expertiza is an opensource web based platform developed to assist students in educational institutions to perform peer reviews and group projects. The reviewing is done through a mechanism where students will be sent request to review work and the system will analyze and publish a summarized report. The software is designed in MVC (Model-View-Controller) architecture using Ruby on Rails.&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Problem Description==&lt;br /&gt;
===Current Scenario===&lt;br /&gt;
Today, Expertiza stores the scores based on each response to each criterion, but no holistic scores are stored. The &amp;quot;answers&amp;quot; table only contains the scores that user A has given user B on each criterion. This means that if we need to know what score A has given B based on 100, we have to rely on the code to calculate it every time the score is requested. This design slows down Expertiza as every time an instructor clicks on &amp;quot;View Scores&amp;quot;, all the calculations are done to display the score. The situation is even worse if we want to weight the scores by the reputation of each reviewer, which is a measure of how closely that reviewer's scores match other reviewers. In this case, the system potentially has to do thousands of arithmetic calculations to display the score for a particular assignment.&lt;br /&gt;
&lt;br /&gt;
===Proposed Solution===&lt;br /&gt;
We propose that we have two mechanisms to handle the holistic scores, depending on the current state of the assignment: This new approach will take the responses and the database will act as a storage environment. &lt;br /&gt;
* OnTheFlyCalc: &lt;br /&gt;
** Calculates holistic scores over a set of data: A set of records in answers table, namely the responses from user A to user B on each criterion.&lt;br /&gt;
** When an assignment is still ongoing, the reputations for each reviewer will be calculated and handled by OnTheFlyCalc&lt;br /&gt;
** This is similar to the current scenario&lt;br /&gt;
* LocalDBCalc: &lt;br /&gt;
** Calculates the holistic score over a single db query: &amp;quot;get the score that user A gives user B on assignment 999 on round 2&amp;quot;&lt;br /&gt;
** When an asignment has finished, all the reputations will be calculated by LocalDBCalc and stored, since they are finalized. So, when the scores are requested, they will be fetched using a single db query and displayed&lt;br /&gt;
** This will be a new addition to the code as currently there is no class. &lt;br /&gt;
&lt;br /&gt;
In this project, our goal is to make the OnTheFlyCalc and LocalDBCalc work only for peer-review scores.  As future projects will introduce other types of scores, the solution must be extensible.&lt;br /&gt;
&lt;br /&gt;
==Design Plan==&lt;br /&gt;
* A new database table &amp;quot;local_db_scores&amp;quot; with following columns will be created to store the holistic scores:&lt;br /&gt;
** id: int&lt;br /&gt;
** score_type: string&lt;br /&gt;
** round: int&lt;br /&gt;
** score: int&lt;br /&gt;
** response_map_id: int (this will be reference to the response_map table)&lt;br /&gt;
* A new column &amp;quot;local_scores_calculated&amp;quot; with boolean type will be added to &amp;quot;assignments&amp;quot; table&lt;br /&gt;
** This has the default value false&lt;br /&gt;
** The value will change to true when the holistic scores for that assignment are stored in local_db_scores table&lt;br /&gt;
* A new icon will be added to the list of Assignments on the Manage Assignments page for instructor&lt;br /&gt;
** When this icon is clicked, the holistic scores will be calculated using store_total_score method in LocalDBCalc class and then inserted in this new table &amp;quot;local_db_score&amp;quot; &lt;br /&gt;
*** If the record to be inserted is a finalized peer-review score, the type stored in the database will be &amp;quot;ReviewLocalDBScore&amp;quot; and the reference_id will be the response_map id&lt;br /&gt;
*** The peer-review scores will be calculated and stored for each of the review rounds because it is possible that user A only reviews user B in one out of several rounds&lt;br /&gt;
* When a request is made to view the total scores, depending on whether local_scores_calculated column of the assignment is false or true, either OnTheFlyCalc or LocalDBCalc will be called to calculate the total score&lt;br /&gt;
&lt;br /&gt;
To achieve this functionality, following classes will be created:&lt;br /&gt;
* OnTheFlyCalc:&lt;br /&gt;
** This class will contain a method &amp;quot;compute_total_scores&amp;quot; which will compute the total score for an assignment by summing the scores given on all questionnaires and return this total score when an instructor tries to view scores for an ongoing assignment&lt;br /&gt;
** It will also contain methods to calculate the average score and score range (min, max) for each reviewee(team) for peer-review&lt;br /&gt;
** Currently OnTheFlyCalc already exists as a module. As it is only used by assignments, we plan to change it into a class and change all its methods into static methods&lt;br /&gt;
* LocalDBCalc:&lt;br /&gt;
** This class will also contain a method &amp;quot;compute_total_scores&amp;quot;. But this method will compute the total score by querying and summing the scores saved in local_db_scores table instead of summing the scores given on all questionnaires&lt;br /&gt;
** It will also contain a method &amp;quot;store_total_scores&amp;quot; which will be called when an instructor clicks on &amp;quot;Save Scores to db&amp;quot; icon for an assignment&lt;br /&gt;
*** This method will compute and save the total scores for all the response maps (reviewer -&amp;gt; reviewee) in the assignment for each round in local_db_scores table.&lt;br /&gt;
&lt;br /&gt;
[[File:Design.png|frame|center]]&lt;br /&gt;
As seen in the above image, when a user A reviews another user B (or team), a response map is created containing individual scores and responses to questionnaires. When an instructor clicks on &amp;quot;Save Scores to DB&amp;quot; icon for an assignment, &amp;quot;store_total_scores&amp;quot; method is called in LocalDBCalc class which calculates the holistic scores for each response map from the individual scores and saves it in local_db_scores table. This also sets the &amp;quot;local_scores_calculated&amp;quot; attribute to true for the assignment. Now, the next time someone tries to view these scores, they are computed using the scores saved in local_db_scores.&lt;br /&gt;
&lt;br /&gt;
[[File:Mechanism.png|frame|center]]&lt;br /&gt;
The above image shows the mechanism which will be followed. When an instructor tries to view scores for an assignment, 1st it will be checked if the local_scores_calculated attribute is true or false for the assignment. If it is false, compute_total_scores from OnTheFlyCalc class is called which will add the scores from the questionnaires. However, if it is true, compute_total_scores from LocalDbCalc class is called which will add the corresponding scores from local_db_scores table.&lt;br /&gt;
&lt;br /&gt;
==Changes Done==&lt;br /&gt;
&lt;br /&gt;
* Created a new table local_db_scores with columns id, score_type, round, score, response_map_id (foreign key to response_map table)&lt;br /&gt;
&lt;br /&gt;
* Added a new boolean type column named &amp;quot;local_scores_calculated&amp;quot; with default value false to assignments table&lt;br /&gt;
&lt;br /&gt;
* OnTheFlyCalc class:&lt;br /&gt;
** Changed &amp;quot;OnTheFlyCalc&amp;quot; module from on_the_fly_calc.rb file into a class&lt;br /&gt;
** Changed all its methods into static methods and passed assignment as a parameter for all the methods&lt;br /&gt;
** Removed the line &amp;quot;include OnTheFlyCalc&amp;quot; from assignment.rb file&lt;br /&gt;
** Made changes in all the places (eg. review_mapping_controller.rb) where any method of OnTheFlyCalc was called, so that the corresponding static method gets called now with assignment as a parameter&lt;br /&gt;
&lt;br /&gt;
* LocalDbCalc class:&lt;br /&gt;
** Created a new file local_db_calc.rb with a new class &amp;quot;LocalDbCalc&amp;quot;&lt;br /&gt;
** Created a static method &amp;quot;compute_total_score&amp;quot; with assignment as parameter&lt;br /&gt;
*** This method calculates the total score by adding all the scores of the given assignment stored in local_db_scores table&lt;br /&gt;
** Created a static method &amp;quot;store_total_scores&amp;quot; with assignment as parameter&lt;br /&gt;
*** This method saves the total score of each response map of the given assignment for each round in local_db_scores table&lt;br /&gt;
&lt;br /&gt;
* Condition for choosing LocalDbCalc/OnTheFlyCalc&lt;br /&gt;
** compute_total_scores is called from 3 files namely &amp;quot;assignment_team.rb&amp;quot;, &amp;quot;assignment_participant.rb&amp;quot; and &amp;quot;participant.rb&amp;quot;&lt;br /&gt;
** Added a new condition in the scores method in these files which checks if the &amp;quot;local_scores_calculated&amp;quot; attribute is set (true) for the given assignment&lt;br /&gt;
*** If it is set (true), compute_total_scores from LocalDbCalc class is called&lt;br /&gt;
*** If it is not set (false), compute_total_scores from OnTheFlyCalc class is called&lt;br /&gt;
&lt;br /&gt;
* Manage Assignments UI&lt;br /&gt;
** Created a new icon for each assignment. Clicking this icon stores the total scores for each response map of the assignment for each round in local_db_scores table. It then sets the local_scores_calculated attribute of the assignment to true&lt;br /&gt;
** The code for this is in assets/javascripts/tree_display.jsx&lt;br /&gt;
** Created a new method in assignments_controller.rb named &amp;quot;store_scores_to_db&amp;quot; which gets called when the above mentioned icon is clicked&lt;br /&gt;
** This method calls the &amp;quot;store_total_scores&amp;quot; method in LocalDbCalc class&lt;br /&gt;
** A route is also created for this newly created store_scores_to_db method&lt;br /&gt;
** Note: Clicking on the icon twice for the same assignment saves the latest scores again, and while viewing the scores, only the latest entries from the local_db_scores table are considered&lt;br /&gt;
&lt;br /&gt;
====Some of these code snippets are attached below====&lt;br /&gt;
The newly created LocalDbCalc class in models/local_db_calc.rb file with 2 static methods &amp;quot;compute_total_score&amp;quot; and &amp;quot;store_total_scores&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[File:S1.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:S2.png]]&lt;br /&gt;
&lt;br /&gt;
Some of the changes to models/on_the_fly_calc.rb. Changing model to class and methods to static methods by passing assignment parameter.&lt;br /&gt;
&lt;br /&gt;
[[File:S3.png]]&lt;br /&gt;
&lt;br /&gt;
The addition of the new icon on Manage Assignments page to save the scores to database. Filename: assets/javascripts/tree_display.jsx&lt;br /&gt;
&lt;br /&gt;
[[File:S4.png]]&lt;br /&gt;
&lt;br /&gt;
The new method in assignment_controller.rb which gets called when the newly created icon is clicked.&lt;br /&gt;
&lt;br /&gt;
[[File:S5.png]]&lt;br /&gt;
&lt;br /&gt;
The condition used for calling either OnTheFlyCalc or LocalDbCalc. This is similar in assignment_team.rb, assignment_participant.rb and participant.rb&lt;br /&gt;
&lt;br /&gt;
[[File:S6.png]]&lt;br /&gt;
&lt;br /&gt;
==Use Cases==&lt;br /&gt;
&lt;br /&gt;
The project can be broken down into below use cases:&lt;br /&gt;
&lt;br /&gt;
* Instructor wants to store the total scores for each response map, round for an assignment in the database. Instructor clicks on &amp;quot;save scores to db&amp;quot; icon and the scores are stored&lt;br /&gt;
* Instructor/User wants to view the scores for an assignment before storing the local scores. Total scores are calculated &amp;quot;on the fly&amp;quot; by adding score given for each question by each reviewer&lt;br /&gt;
* Instructor/user wants to view the scores for an assignment after storing the local scores. Scores are calculated by using the values stored in local_db_calc database&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
The above use cases can then be translated into three major scenarios that we need to test. The following table contains the main scenarios we will cover when testing our project.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Scenario Number&lt;br /&gt;
! Description&lt;br /&gt;
! Expected Result for Pass&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| Instructor clicks on &amp;quot;save scores to db&amp;quot; for an assignment. The scores are calculated correctly and placed into the local_db_score table. First, set up an assignment with some review questions. Let a student answer the review questions. Call the store_total_scores method in LocalDbCalc and check if a new record has been added to local_db_scores table.&lt;br /&gt;
| Query the database and verify that a new record has been added to local_db_scores table&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| Local scores are not stored and user wants to view scores. For an assignment for which the scores are not calculated, click on View Scores as an instructor, or Your Scores as a student. The score displayed should be calculated correctly on the fly using OnTheFlyCalc.&lt;br /&gt;
| Click on view scores for an assignment whose local scores are not stored and verify that the page displays the expected scores.&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| Local scores are stored and user wants to view scores. For an assignment, first click on save scores to db icon to store the total scores. Then click on View Scores as an instructor, or Your Scores as a student. The score displayed should be calculated correctly on the fly using LocalDbCalc. This test will mainly be a check if clicking view scores on the UI will result in the expected value showing up on the UI.  The interaction in getting the information in the database is already tested in Scenario 1.&lt;br /&gt;
| Click on view scores for an assignment whose local scores are stored and verify that the page displays the expected scores.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Future Work==&lt;br /&gt;
* Adding conditions to show the &amp;quot;save scores to db&amp;quot; icon only when an assignment has finished, and stop showing it again once the scores are stored.&lt;br /&gt;
** Currently this icon is present all the time and can be clicked on multiple times, even when an assignment is ongoing. So clicking on this adds the same/updated entries to the database. While viewing the scores, only the latest scores saved in database are considered.&lt;br /&gt;
** So, as a future work, this can be modified such that the icon is seen only when an assignment has finished and the scores are not yet stored. This will prevent the scores being stored multiple times or before an assignment has finished.&lt;br /&gt;
* Adding the functionality to remove the scores stored in the database. This will especially be useful after implementing the above mentioned future work because after the above future work functionality, the icon to store the scores will not be shown and if scores are updated somehow, they can't be stored again.&lt;br /&gt;
** In our current functionality, if the scores are updated, the latest scores can be stored again because the icon is always present.&lt;br /&gt;
* Add functionality to call OnTheFlyCalc to compute the scores of an assignment whose scores are already stored (if required).&lt;br /&gt;
** Currently, once the scores are stored in database for an assignment, every time LocalDbCalc will be used to view the scores of that assignment.&lt;/div&gt;</summary>
		<author><name>Psvaidya</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:S3.png&amp;diff=108779</id>
		<title>File:S3.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:S3.png&amp;diff=108779"/>
		<updated>2017-04-29T21:50:08Z</updated>

		<summary type="html">&lt;p&gt;Psvaidya: uploaded a new version of &amp;amp;quot;File:S3.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Amazon S3 Logo&lt;/div&gt;</summary>
		<author><name>Psvaidya</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:S6.png&amp;diff=108778</id>
		<title>File:S6.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:S6.png&amp;diff=108778"/>
		<updated>2017-04-29T21:47:25Z</updated>

		<summary type="html">&lt;p&gt;Psvaidya: uploaded a new version of &amp;amp;quot;File:S6.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Psvaidya</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:S5.png&amp;diff=108777</id>
		<title>File:S5.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:S5.png&amp;diff=108777"/>
		<updated>2017-04-29T21:45:57Z</updated>

		<summary type="html">&lt;p&gt;Psvaidya: uploaded a new version of &amp;amp;quot;File:S5.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Psvaidya</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:S2.png&amp;diff=108776</id>
		<title>File:S2.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:S2.png&amp;diff=108776"/>
		<updated>2017-04-29T21:44:44Z</updated>

		<summary type="html">&lt;p&gt;Psvaidya: uploaded a new version of &amp;amp;quot;File:S2.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;s2&lt;/div&gt;</summary>
		<author><name>Psvaidya</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:S1.png&amp;diff=108775</id>
		<title>File:S1.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:S1.png&amp;diff=108775"/>
		<updated>2017-04-29T21:44:23Z</updated>

		<summary type="html">&lt;p&gt;Psvaidya: uploaded a new version of &amp;amp;quot;File:S1.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;s1&lt;/div&gt;</summary>
		<author><name>Psvaidya</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/E1731_Improve_Score_Calculation&amp;diff=108706</id>
		<title>CSC/ECE 517 Spring 2017/E1731 Improve Score Calculation</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/E1731_Improve_Score_Calculation&amp;diff=108706"/>
		<updated>2017-04-29T01:46:49Z</updated>

		<summary type="html">&lt;p&gt;Psvaidya: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;nowiki&amp;gt;  Expertiza is an opensource web based platform developed to assist students in educational institutions to perform peer reviews and group projects. The reviewing is done through a mechanism where students will be sent request to review work and the system will analyze and publish a summarized report. The software is designed in MVC (Model-View-Controller) architecture using Ruby on Rails.&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Problem Description==&lt;br /&gt;
===Current Scenario===&lt;br /&gt;
Today, Expertiza stores the scores based on each response to each criterion, but no holistic scores are stored. The &amp;quot;answers&amp;quot; table only contains the scores that user A has given user B on each criterion. This means that if we need to know what score A has given B based on 100, we have to rely on the code to calculate it every time the score is requested. This design slows down Expertiza as every time an instructor clicks on &amp;quot;View Scores&amp;quot;, all the calculations are done to display the score. The situation is even worse if we want to weight the scores by the reputation of each reviewer, which is a measure of how closely that reviewer's scores match other reviewers. In this case, the system potentially has to do thousands of arithmetic calculations to display the score for a particular assignment.&lt;br /&gt;
&lt;br /&gt;
===Proposed Solution===&lt;br /&gt;
We propose that we have two mechanisms to handle the holistic scores, depending on the current state of the assignment: This new approach will take the responses and the database will act as a storage environment. &lt;br /&gt;
* OnTheFlyCalc: &lt;br /&gt;
** Calculates holistic scores over a set of data: A set of records in answers table, namely the responses from user A to user B on each criterion.&lt;br /&gt;
** When an assignment is still ongoing, the reputations for each reviewer will be calculated and handled by OnTheFlyCalc&lt;br /&gt;
** This is similar to the current scenario&lt;br /&gt;
* LocalDBCalc: &lt;br /&gt;
** Calculates the holistic score over a single db query: &amp;quot;get the score that user A gives user B on assignment 999 on round 2&amp;quot;&lt;br /&gt;
** When an asignment has finished, all the reputations will be calculated by LocalDBCalc and stored, since they are finalized. So, when the scores are requested, they will be fetched using a single db query and displayed&lt;br /&gt;
** This will be a new addition to the code as currently there is no class. &lt;br /&gt;
&lt;br /&gt;
In this project, our goal is to make the OnTheFlyCalc and LocalDBCalc work only for peer-review scores.  As future projects will introduce other types of scores, the solution must be extensible.&lt;br /&gt;
&lt;br /&gt;
==Design Plan==&lt;br /&gt;
* A new database table &amp;quot;local_db_scores&amp;quot; with following columns will be created to store the holistic scores:&lt;br /&gt;
** id: int&lt;br /&gt;
** score_type: string&lt;br /&gt;
** round: int&lt;br /&gt;
** score: int&lt;br /&gt;
** response_map_id: int (this will be reference to the response_map table)&lt;br /&gt;
* A new column &amp;quot;local_scores_calculated&amp;quot; with boolean type will be added to &amp;quot;assignments&amp;quot; table&lt;br /&gt;
** This has the default value false&lt;br /&gt;
** The value will change to true when the holistic scores for that assignment are stored in local_db_scores table&lt;br /&gt;
* A new icon will be added to the list of Assignments on the Manage Assignments page for instructor&lt;br /&gt;
** When this icon is clicked, the holistic scores will be calculated using store_total_score method in LocalDBCalc class and then inserted in this new table &amp;quot;local_db_score&amp;quot; &lt;br /&gt;
*** If the record to be inserted is a finalized peer-review score, the type stored in the database will be &amp;quot;ReviewLocalDBScore&amp;quot; and the reference_id will be the response_map id&lt;br /&gt;
*** The peer-review scores will be calculated and stored for each of the review rounds because it is possible that user A only reviews user B in one out of several rounds&lt;br /&gt;
* When a request is made to view the total scores, depending on whether local_scores_calculated column of the assignment is false or true, either OnTheFlyCalc or LocalDBCalc will be called to calculate the total score&lt;br /&gt;
&lt;br /&gt;
To achieve this functionality, following classes will be created:&lt;br /&gt;
* OnTheFlyCalc:&lt;br /&gt;
** This class will contain a method &amp;quot;compute_total_scores&amp;quot; which will compute the total score for an assignment by summing the scores given on all questionnaires and return this total score when an instructor tries to view scores for an ongoing assignment&lt;br /&gt;
** It will also contain methods to calculate the average score and score range (min, max) for each reviewee(team) for peer-review&lt;br /&gt;
** Currently OnTheFlyCalc already exists as a module. As it is only used by assignments, we plan to change it into a class and change all its methods into static methods&lt;br /&gt;
* LocalDBCalc:&lt;br /&gt;
** This class will also contain a method &amp;quot;compute_total_scores&amp;quot;. But this method will compute the total score by querying and summing the scores saved in local_db_scores table instead of summing the scores given on all questionnaires&lt;br /&gt;
** It will also contain a method &amp;quot;store_total_scores&amp;quot; which will be called when an instructor clicks on &amp;quot;Save Scores to db&amp;quot; icon for an assignment&lt;br /&gt;
*** This method will compute and save the total scores for all the response maps (reviewer -&amp;gt; reviewee) in the assignment for each round in local_db_scores table.&lt;br /&gt;
&lt;br /&gt;
[[File:Design.png|frame|center]]&lt;br /&gt;
As seen in the above image, when a user A reviews another user B (or team), a response map is created containing individual scores and responses to questionnaires. When an instructor clicks on &amp;quot;Save Scores to DB&amp;quot; icon for an assignment, &amp;quot;store_total_scores&amp;quot; method is called in LocalDBCalc class which calculates the holistic scores for each response map from the individual scores and saves it in local_db_scores table. This also sets the &amp;quot;local_scores_calculated&amp;quot; attribute to true for the assignment. Now, the next time someone tries to view these scores, they are computed using the scores saved in local_db_scores.&lt;br /&gt;
&lt;br /&gt;
[[File:Mechanism.png|frame|center]]&lt;br /&gt;
The above image shows the mechanism which will be followed. When an instructor tries to view scores for an assignment, 1st it will be checked if the local_scores_calculated attribute is true or false for the assignment. If it is false, compute_total_scores from OnTheFlyCalc class is called which will add the scores from the questionnaires. However, if it is true, compute_total_scores from LocalDbCalc class is called which will add the corresponding scores from local_db_scores table.&lt;br /&gt;
&lt;br /&gt;
==Changes Done==&lt;br /&gt;
&lt;br /&gt;
* Created a new table local_db_scores with columns id, score_type, round, score, response_map_id (foreign key to response_map table)&lt;br /&gt;
&lt;br /&gt;
* Added a new boolean type column named &amp;quot;local_scores_calculated&amp;quot; with default value false to assignments table&lt;br /&gt;
&lt;br /&gt;
* OnTheFlyCalc class:&lt;br /&gt;
** Changed &amp;quot;OnTheFlyCalc&amp;quot; module from on_the_fly_calc.rb file into a class&lt;br /&gt;
** Changed all its methods into static methods and passed assignment as a parameter for all the methods&lt;br /&gt;
** Removed the line &amp;quot;include OnTheFlyCalc&amp;quot; from assignment.rb file&lt;br /&gt;
** Made changes in all the places (eg. review_mapping_controller.rb) where any method of OnTheFlyCalc was called, so that the corresponding static method gets called now with assignment as a parameter&lt;br /&gt;
&lt;br /&gt;
* LocalDbCalc class:&lt;br /&gt;
** Created a new file local_db_calc.rb with a new class &amp;quot;LocalDbCalc&amp;quot;&lt;br /&gt;
** Created a static method &amp;quot;compute_total_score&amp;quot; with assignment as parameter&lt;br /&gt;
*** This method calculates the total score by adding all the scores of the given assignment stored in local_db_scores table&lt;br /&gt;
** Created a static method &amp;quot;store_total_scores&amp;quot; with assignment as parameter&lt;br /&gt;
*** This method saves the total score of each response map of the given assignment for each round in local_db_scores table&lt;br /&gt;
&lt;br /&gt;
* Logic for choosing LocalDbCalc/OnTheFlyCalc&lt;br /&gt;
** compute_total_scores is called from 3 files namely &amp;quot;assignment_team.rb&amp;quot;, &amp;quot;assignment_participant.rb&amp;quot; and &amp;quot;participant.rb&amp;quot;&lt;br /&gt;
** Added a new condition in the scores method in these files which checks if the &amp;quot;local_scores_calculated&amp;quot; attribute is set (true) for the given assignment&lt;br /&gt;
*** If it is set (true), compute_total_scores from LocalDbCalc class is called&lt;br /&gt;
*** If it is not set (false), compute_total_scores from OnTheFlyCalc class is called&lt;br /&gt;
&lt;br /&gt;
* Manage Assignments UI&lt;br /&gt;
** Created a new icon for each assignment. Clicking this icon stores the total scores for each response map of the assignment for each round in local_db_scores table. It then sets the local_scores_calculated attribute of the assignment to true&lt;br /&gt;
** The code for this is in assets/javascripts/tree_display.jsx&lt;br /&gt;
** Created a new method in assignments_controller.rb named local_db_cal which gets called when the above mentioned icon is clicked&lt;br /&gt;
** This method calls another newly created method &amp;quot;save_score_in_db&amp;quot; in assignment.rb which in turn calls the &amp;quot;store_total_scores&amp;quot; method in LocalDbCalc class&lt;br /&gt;
** A route is also created for this newly created local_db_cal method&lt;br /&gt;
** Note: Clicking on the icon twice for the same assignment saves the latest scores again, and while viewing the scores, only the latest entries from the local_db_scores table are considered&lt;br /&gt;
&lt;br /&gt;
====Some of these code snippets are attached below====&lt;br /&gt;
The newly created LocalDbCalc class in models/local_db_calc.rb file with 2 static methods &amp;quot;compute_total_score&amp;quot; and &amp;quot;store_total_scores&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[File:S1.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:S2.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:S3.png]]&lt;br /&gt;
&lt;br /&gt;
The addition of the new icon on Manage Assignments page to save the scores to database. Filename: assets/javascripts/tree_display.jsx&lt;br /&gt;
&lt;br /&gt;
[[File:S4.png]]&lt;br /&gt;
&lt;br /&gt;
The new method in assignment_controller.rb which gets called when the newly created icon is clicked.&lt;br /&gt;
&lt;br /&gt;
[[File:S5.png]]&lt;br /&gt;
&lt;br /&gt;
The new method in assignment.rb which gets called from the above local_db_cal method in assignment controller&lt;br /&gt;
&lt;br /&gt;
[[File:S6.png]]&lt;br /&gt;
&lt;br /&gt;
==Use Cases==&lt;br /&gt;
&lt;br /&gt;
The project can be broken down into below use cases:&lt;br /&gt;
&lt;br /&gt;
* Instructor wants to store the total scores for each response map, round for an assignment in the database. Instructor clicks on &amp;quot;save scores to db&amp;quot; icon and the scores are stored&lt;br /&gt;
* Instructor/User wants to view the scores for an assignment before storing the local scores. Total scores are calculated &amp;quot;on the fly&amp;quot; by adding score given for each question by each reviewer&lt;br /&gt;
* Instructor/user wants to view the scores for an assignment after storing the local scores. Scores are calculated by using the values stored in local_db_calc database&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
The above use cases can then be translated into three major scenarios that we need to test. The following table contains the main scenarios we will cover when testing our project.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Scenario Number&lt;br /&gt;
! Description&lt;br /&gt;
! Expected Result for Pass&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| Instructor clicks on &amp;quot;save scores to db&amp;quot; for an assignment. The scores are calculated correctly and placed into the local_db_score table. First, set up an assignment with some review questions. Let a student answer the review questions. Call the store_total_scores method in LocalDbCalc and check if a new record has been added to local_db_scores table.&lt;br /&gt;
| Query the database and verify that a new record has been added to local_db_scores table&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| Local scores are not stored and user wants to view scores. For an assignment for which the scores are not calculated, click on View Scores as an instructor, or Your Scores as a student. The score displayed should be calculated correctly on the fly using OnTheFlyCalc.&lt;br /&gt;
| Click on view scores for an assignment whose local scores are not stored and verify that the page displays the expected scores.&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| Local scores are stored and user wants to view scores. For an assignment, first click on save scores to db icon to store the total scores. Then click on View Scores as an instructor, or Your Scores as a student. The score displayed should be calculated correctly on the fly using LocalDbCalc. This test will mainly be a check if clicking view scores on the UI will result in the expected value showing up on the UI.  The interaction in getting the information in the database is already tested in Scenario 1.&lt;br /&gt;
| Click on view scores for an assignment whose local scores are stored and verify that the page displays the expected scores.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Future Work==&lt;br /&gt;
* Adding conditions to show the &amp;quot;save scores to db&amp;quot; icon only when an assignment has finished, and stop showing it again once the scores are stored.&lt;br /&gt;
** Currently this icon is present all the time and can be clicked on multiple times, even when an assignment is ongoing. So clicking on this adds the same/updated entries to the database. While viewing the scores, only the latest scores saved in database are considered.&lt;br /&gt;
** So, as a future work, this can be modified such that the icon is seen only when an assignment has finished and the scores are not yet stored. This will prevent the scores being stored multiple times or before an assignment has finished.&lt;br /&gt;
* Adding the functionality to remove the scores stored in the database. This will especially be useful after implementing the above mentioned future work because after the above future work functionality, the icon to store the scores will not be shown and if scores are updated somehow, they can't be stored again.&lt;br /&gt;
** In our current functionality, if the scores are updated, the latest scores can be stored again because the icon is always present.&lt;br /&gt;
* Add functionality to call OnTheFlyCalc to compute the scores of an assignment whose scores are already stored (if required).&lt;br /&gt;
** Currently, once the scores are stored in database for an assignment, every time LocalDbCalc will be used to view the scores of that assignment.&lt;/div&gt;</summary>
		<author><name>Psvaidya</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/E1731_Improve_Score_Calculation&amp;diff=108656</id>
		<title>CSC/ECE 517 Spring 2017/E1731 Improve Score Calculation</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/E1731_Improve_Score_Calculation&amp;diff=108656"/>
		<updated>2017-04-28T07:02:54Z</updated>

		<summary type="html">&lt;p&gt;Psvaidya: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;nowiki&amp;gt;  Expertiza is an opensource web based platform developed to assist students in educational institutions to perform peer reviews and group projects. The reviewing is done through a mechanism where students will be sent request to review work and the system will analyze and publish a summarized report. The software is designed in MVC (Model-View-Controller) architecture using Ruby on Rails.&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Problem Description==&lt;br /&gt;
===Current Scenario===&lt;br /&gt;
Today, Expertiza stores the scores based on each response to each criterion, but no holistic scores are stored. The &amp;quot;answers&amp;quot; table only contains the scores that user A has given user B on each criterion. This means that if we need to know what score A has given B based on 100, we have to rely on the code to calculate it every time the score is requested. This design slows down Expertiza as every time an instructor clicks on &amp;quot;View Scores&amp;quot;, all the calculations are done to display the score. The situation is even worse if we want to weight the scores by the reputation of each reviewer, which is a measure of how closely that reviewer's scores match other reviewers. In this case, the system potentially has to do thousands of arithmetic calculations to display the score for a particular assignment.&lt;br /&gt;
&lt;br /&gt;
===Proposed Solution===&lt;br /&gt;
We propose that we have two mechanisms to handle the holistic scores, depending on the current state of the assignment: This new approach will take the responses and the database will act as a storage environment. &lt;br /&gt;
* OnTheFlyCalc: &lt;br /&gt;
** Calculates holistic scores over a set of data: A set of records in answers table, namely the responses from user A to user B on each criterion.&lt;br /&gt;
** When an assignment is still ongoing, the reputations for each reviewer will be calculated and handled by OnTheFlyCalc&lt;br /&gt;
** This is similar to the current scenario&lt;br /&gt;
* LocalDBCalc: &lt;br /&gt;
** Calculates the holistic score over a single db query: &amp;quot;get the score that user A gives user B on assignment 999 on round 2&amp;quot;&lt;br /&gt;
** When an asignment has finished, all the reputations will be calculated by LocalDBCalc and stored, since they are finalized. So, when the scores are requested, they will be fetched using a single db query and displayed&lt;br /&gt;
** This will be a new addition to the code as currently there is no class. &lt;br /&gt;
&lt;br /&gt;
In this project, our goal is to make the OnTheFlyCalc and LocalDBCalc work only for peer-review scores.  As future projects will introduce other types of scores, the solution must be extensible.&lt;br /&gt;
&lt;br /&gt;
==Design Plan==&lt;br /&gt;
* A new database table &amp;quot;local_db_scores&amp;quot; with following columns will be created to store the holistic scores:&lt;br /&gt;
** id: int&lt;br /&gt;
** score_type: string&lt;br /&gt;
** round: int&lt;br /&gt;
** score: int&lt;br /&gt;
** response_map_id: int (this will be reference to the response_map table)&lt;br /&gt;
* A new column &amp;quot;local_scores_calculated&amp;quot; with boolean type will be added to &amp;quot;assignments&amp;quot; table&lt;br /&gt;
** This has the default value false&lt;br /&gt;
** The value will change to true when the holistic scores for that assignment are stored in local_db_scores table&lt;br /&gt;
* A new icon will be added to the list of Assignments on the Manage Assignments page for instructor&lt;br /&gt;
** When this icon is clicked, the holistic scores will be calculated using store_total_score method in LocalDBCalc class and then inserted in this new table &amp;quot;local_db_score&amp;quot; &lt;br /&gt;
*** If the record to be inserted is a finalized peer-review score, the type stored in the database will be &amp;quot;ReviewLocalDBScore&amp;quot; and the reference_id will be the response_map id&lt;br /&gt;
*** The peer-review scores will be calculated and stored for each of the review rounds because it is possible that user A only reviews user B in one out of several rounds&lt;br /&gt;
* When a request is made to view the total scores, depending on whether local_scores_calculated column of the assignment is false or true, either OnTheFlyCalc or LocalDBCalc will be called to calculate the total score&lt;br /&gt;
&lt;br /&gt;
To achieve this functionality, following classes will be created:&lt;br /&gt;
* OnTheFlyCalc:&lt;br /&gt;
** This class will contain a method &amp;quot;compute_total_scores&amp;quot; which will compute the total score for an assignment by summing the scores given on all questionnaires and return this total score when an instructor tries to view scores for an ongoing assignment&lt;br /&gt;
** It will also contain methods to calculate the average score and score range (min, max) for each reviewee(team) for peer-review&lt;br /&gt;
** Currently OnTheFlyCalc already exists as a module. As it is only used by assignments, we plan to change it into a class and change all its methods into static methods&lt;br /&gt;
* LocalDBCalc:&lt;br /&gt;
** This class will also contain a method &amp;quot;compute_total_scores&amp;quot;. But this method will compute the total score by querying and summing the scores saved in local_db_scores table instead of summing the scores given on all questionnaires&lt;br /&gt;
** It will also contain a method &amp;quot;store_total_scores&amp;quot; which will be called when an instructor clicks on &amp;quot;Save Scores to db&amp;quot; icon for an assignment&lt;br /&gt;
*** This method will compute and save the total scores for all the response maps (reviewer -&amp;gt; reviewee) in the assignment for each round in local_db_scores table.&lt;br /&gt;
&lt;br /&gt;
[[File:Design.png|frame|center]]&lt;br /&gt;
As seen in the above image, when a user A reviews another user B (or team), a response map is created containing individual scores and responses to questionnaires. When an instructor clicks on &amp;quot;Save Scores to DB&amp;quot; icon for an assignment, &amp;quot;store_total_scores&amp;quot; method is called in LocalDBCalc class which calculates the holistic scores for each response map from the individual scores and saves it in local_db_scores table. This also sets the &amp;quot;local_scores_calculated&amp;quot; attribute to true for the assignment. Now, the next time someone tries to view these scores, they are computed using the scores saved in local_db_scores.&lt;br /&gt;
&lt;br /&gt;
[[File:Mechanism.png|frame|center]]&lt;br /&gt;
The above image shows the mechanism which will be followed. When an instructor tries to view scores for an assignment, 1st it will be checked if the local_scores_calculated attribute is true or false for the assignment. If it is false, compute_total_scores from OnTheFlyCalc class is called which will add the scores from the questionnaires. However, if it is true, compute_total_scores from LocalDbCalc class is called which will add the corresponding scores from local_db_scores table.&lt;br /&gt;
&lt;br /&gt;
==Changes Done==&lt;br /&gt;
&lt;br /&gt;
* Created a new table local_db_scores with columns id, score_type, round, score, response_map_id (foreign key to response_map table)&lt;br /&gt;
&lt;br /&gt;
* Added a new boolean type column named &amp;quot;local_scores_calculated&amp;quot; with default value false to assignments table&lt;br /&gt;
&lt;br /&gt;
* OnTheFlyCalc class:&lt;br /&gt;
** Changed &amp;quot;OnTheFlyCalc&amp;quot; module from on_the_fly_calc.rb file into a class&lt;br /&gt;
** Changed all its methods into static methods and passed assignment as a parameter for all the methods&lt;br /&gt;
** Removed the line &amp;quot;include OnTheFlyCalc&amp;quot; from assignment.rb file&lt;br /&gt;
** Made changes in all the places (eg. review_mapping_controller.rb) where any method of OnTheFlyCalc was called, so that the corresponding static method gets called now with assignment as a parameter&lt;br /&gt;
&lt;br /&gt;
* LocalDbCalc class:&lt;br /&gt;
** Created a new file local_db_calc.rb with a new class &amp;quot;LocalDbCalc&amp;quot;&lt;br /&gt;
** Created a static method &amp;quot;compute_total_score&amp;quot; with assignment as parameter&lt;br /&gt;
*** This method calculates the total score by adding all the scores of the given assignment stored in local_db_scores table&lt;br /&gt;
** Created a static method &amp;quot;store_total_scores&amp;quot; with assignment as parameter&lt;br /&gt;
*** This method saves the total score of each response map of the given assignment for each round in local_db_scores table&lt;br /&gt;
&lt;br /&gt;
* Logic for choosing LocalDbCalc/OnTheFlyCalc&lt;br /&gt;
** compute_total_scores is called from 3 files namely &amp;quot;assignment_team.rb&amp;quot;, &amp;quot;assignment_participant.rb&amp;quot; and &amp;quot;participant.rb&amp;quot;&lt;br /&gt;
** Added a new condition in the scores method in these files which checks if the &amp;quot;local_scores_calculated&amp;quot; attribute is set (true) for the given assignment&lt;br /&gt;
*** If it is set (true), compute_total_scores from LocalDbCalc class is called&lt;br /&gt;
*** If it is not set (false), compute_total_scores from OnTheFlyCalc class is called&lt;br /&gt;
&lt;br /&gt;
* Manage Assignments UI&lt;br /&gt;
** Created a new icon for each assignment. Clicking this icon stores the total scores for each response map of the assignment for each round in local_db_scores table. It then sets the local_scores_calculated attribute of the assignment to true&lt;br /&gt;
** The code for this is in assets/javascripts/tree_display.jsx&lt;br /&gt;
** Created a new method in assignments_controller.rb named local_db_cal which gets called when the above mentioned icon is clicked&lt;br /&gt;
** This method calls another newly created method &amp;quot;save_score_in_db&amp;quot; in assignment.rb which in turn calls the &amp;quot;store_total_scores&amp;quot; method in LocalDbCalc class&lt;br /&gt;
** A route is also created for this newly created local_db_cal method&lt;br /&gt;
** Note: Clicking on the icon twice for the same assignment saves the latest scores again, and while viewing the scores, only the latest entries from the local_db_scores table are considered&lt;br /&gt;
&lt;br /&gt;
====Some of these code snippets are attached below====&lt;br /&gt;
The newly created LocalDbCalc class in models/local_db_calc.rb file with 2 static methods &amp;quot;compute_total_score&amp;quot; and &amp;quot;store_total_scores&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[File:S1.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:S2.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:S3.png]]&lt;br /&gt;
&lt;br /&gt;
The addition of the new icon on Manage Assignments page to save the scores to database. Filename: assets/javascripts/tree_display.jsx&lt;br /&gt;
&lt;br /&gt;
[[File:S4.png]]&lt;br /&gt;
&lt;br /&gt;
The new method in assignment_controller.rb which gets called when the newly created icon is clicked.&lt;br /&gt;
&lt;br /&gt;
[[File:S5.png]]&lt;br /&gt;
&lt;br /&gt;
The new method in assignment.rb which gets called from the above local_db_cal method in assignment controller&lt;br /&gt;
&lt;br /&gt;
[[File:S6.png]]&lt;br /&gt;
&lt;br /&gt;
==Use Cases==&lt;br /&gt;
&lt;br /&gt;
The project can be broken down into two primary use cases.&lt;br /&gt;
&lt;br /&gt;
*  The user wants to view the scores before the assignment is finished.  Scores are calculated &amp;quot;on the fly&amp;quot; and presented to the user.&lt;br /&gt;
*  The user wants to view the scores after the assignment is finished.  Scores are calculated on assignment completion and stored in the database for quick retrieval.&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
The above two use cases can then be translated into three major scenarios we need to test.  The use case where the assignment is completed and scores are stored into the database is broken down into two scenarios to test the data input and data retrieval parts separately.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The following table contains the main scenarios we will cover when testing our project.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Scenario Number&lt;br /&gt;
! Description&lt;br /&gt;
! Expected Result for Pass&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| An assignment is finished and a score is calculated correctly and placed into the local_db_score table using the scheduled task feature.  First, set up an assignment with some score information.  Create a scheduled task to calculate the score and insert the score into the database upon assignment completion.&lt;br /&gt;
| Query the database and verify score is correct&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| Assignment is NOT finished and user wants to view scores.  First, set up an assignment with a deadline in the future.  Put in some score information.   The score should be calculated correctly on the fly using OnTheFlyCalc.&lt;br /&gt;
| After the assignment is created, this test will run on the UI.  The user will click the view scores link and the page should display the expected score.&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| Assignment is finished and the user wants to view scores.  This test will mainly just be a check if clicking view scores on the UI will result in the expected value showing up on the UI.  The interaction in getting the information in the database is already tested in Scenario 1.&lt;br /&gt;
| User clicks on view scores on a past assignment and sees the expected score on the UI&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The following diagrams show how the chosen scenarios above map to functionality.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:E1731-scenario-1.jpg|frame|center]]  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:E1731-scenario-2-3.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Future Work==&lt;br /&gt;
* We have created a new icon which saves the scores to database. This icon is present all the time and can be clicked on multiple times or even when an assignment is ongoing. So clicking on this causes the same entries to be added to the database more than once.&lt;br /&gt;
** So, one future work could be to show this icon only when an assignment has finished and remove it as soon as the local scores are calculated for this assignment. This will prevent the scores being scored multiple times or before an assignment has finished.&lt;br /&gt;
** Currently, if the icon is clicked again, it will store the latest scores in the database and use these latest entries while viewing the scores.&lt;br /&gt;
* Currently, once the scores are stored in the database, while computing the scores, always LocalDbCalc will get called.&lt;br /&gt;
** A future work could be to have a way to remove the scores from the database when required or a way to call OnTheFlyCalc instead of LocalDbCalc whenever the instructor wants.&lt;/div&gt;</summary>
		<author><name>Psvaidya</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/E1731_Improve_Score_Calculation&amp;diff=108652</id>
		<title>CSC/ECE 517 Spring 2017/E1731 Improve Score Calculation</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/E1731_Improve_Score_Calculation&amp;diff=108652"/>
		<updated>2017-04-28T03:44:35Z</updated>

		<summary type="html">&lt;p&gt;Psvaidya: Future Work section added&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;nowiki&amp;gt;  Expertiza is an opensource web based platform developed to assist students in educational institutions to perform peer reviews and group projects. The reviewing is done through a mechanism where students will be sent request to review work and the system will analyze and publish a summarized report. The software is designed in MVC (Model-View-Controller) architecture using Ruby on Rails.&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Problem Description==&lt;br /&gt;
===Current Scenario===&lt;br /&gt;
Today, Expertiza stores the scores based on each response to each criterion, but no holistic scores are stored. The &amp;quot;answers&amp;quot; table only contains the scores that user A has given user B on each criterion. This means that if we need to know what score A has given B based on 100, we have to rely on the code to calculate it every time the score is requested. This design slows down Expertiza as every time an instructor clicks on &amp;quot;View Scores&amp;quot;, all the calculations are done to display the score. The situation is even worse if we want to weight the scores by the reputation of each reviewer, which is a measure of how closely that reviewer's scores match other reviewers. In this case, the system potentially has to do thousands of arithmetic calculations to display the score for a particular assignment.&lt;br /&gt;
&lt;br /&gt;
===Proposed Solution===&lt;br /&gt;
We propose that we have two mechanisms to handle the holistic scores, depending on the current state of the assignment: This new approach will take the responses and the database will act as a storage environment. &lt;br /&gt;
* OnTheFlyCalc: &lt;br /&gt;
** Calculates holistic scores over a set of data: A set of records in answers table, namely the responses from user A to user B on each criterion.&lt;br /&gt;
** When an assignment is still ongoing, the reputations for each reviewer will be calculated and handled by OnTheFlyCalc&lt;br /&gt;
** This is similar to the current scenario&lt;br /&gt;
* LocalDBCalc: &lt;br /&gt;
** Calculates the holistic score over a single db query: &amp;quot;get the score that user A gives user B on assignment 999 on round 2&amp;quot;&lt;br /&gt;
** When an asignment has finished, all the reputations will be calculated by LocalDBCalc and stored, since they are finalized. So, when the scores are requested, they will be fetched using a single db query and displayed&lt;br /&gt;
** This will be a new addition to the code as currently there is no class. &lt;br /&gt;
&lt;br /&gt;
In this project, our goal is to make the OnTheFlyCalc and LocalDBCalc work only for peer-review scores.  As future projects will introduce other types of scores, the solution must be extensible.&lt;br /&gt;
&lt;br /&gt;
==Design Plan==&lt;br /&gt;
* A new database table &amp;quot;local_db_scores&amp;quot; with following columns will be created to store the holistic scores:&lt;br /&gt;
** id: int&lt;br /&gt;
** score_type: string&lt;br /&gt;
** round: int&lt;br /&gt;
** score: int&lt;br /&gt;
** response_map_id: int (this will be reference to the response_map table)&lt;br /&gt;
* A new column &amp;quot;local_scores_calculated&amp;quot; with boolean type will be added to &amp;quot;assignments&amp;quot; table&lt;br /&gt;
** This has the default value false&lt;br /&gt;
** The value will change to true when the holistic scores for that assignment are stored in local_db_scores table&lt;br /&gt;
* A new icon will be added to the list of Assignments on the Manage Assignments page for instructor&lt;br /&gt;
** When this icon is clicked, the holistic scores will be calculated using store_total_score method in LocalDBCalc class and then inserted in this new table &amp;quot;local_db_score&amp;quot; &lt;br /&gt;
*** If the record to be inserted is a finalized peer-review score, the type stored in the database will be &amp;quot;ReviewLocalDBScore&amp;quot; and the reference_id will be the response_map id&lt;br /&gt;
*** The peer-review scores will be calculated and stored for each of the review rounds because it is possible that user A only reviews user B in one out of several rounds&lt;br /&gt;
* When a request is made to view the total scores, depending on whether local_scores_calculated column of the assignment is false or true, either OnTheFlyCalc or LocalDBCalc will be called to calculate the total score&lt;br /&gt;
&lt;br /&gt;
To achieve this functionality, following classes will be created:&lt;br /&gt;
* OnTheFlyCalc:&lt;br /&gt;
** This class will contain a method &amp;quot;compute_total_scores&amp;quot; which will compute the total score for an assignment by summing the scores given on all questionnaires and return this total score when an instructor tries to view scores for an ongoing assignment&lt;br /&gt;
** It will also contain methods to calculate the average score and score range (min, max) for each reviewee(team) for peer-review&lt;br /&gt;
** Currently OnTheFlyCalc already exists as a module. As it is only used by assignments, we plan to change it into a class and change all its methods into static methods&lt;br /&gt;
* LocalDBCalc:&lt;br /&gt;
** This class will also contain a method &amp;quot;compute_total_scores&amp;quot;. But this method will compute the total score by querying and summing the scores saved in local_db_scores table instead of summing the scores given on all questionnaires&lt;br /&gt;
** It will also contain a method &amp;quot;store_total_scores&amp;quot; which will be called when an instructor clicks on &amp;quot;Save Scores to db&amp;quot; icon for an assignment&lt;br /&gt;
*** This method will compute and save the total scores for all the response maps (reviewer -&amp;gt; reviewee) in the assignment for each round in local_db_scores table.&lt;br /&gt;
&lt;br /&gt;
[[File:Design.png|frame|center]]&lt;br /&gt;
As seen in the above image, when a user A reviews another user B (or team), a response map is created containing individual scores and responses to questionnaires. When an instructor clicks on &amp;quot;Save Scores to DB&amp;quot; icon for an assignment, &amp;quot;store_total_scores&amp;quot; method is called in LocalDBCalc class which calculates the holistic scores for each response map from the individual scores and saves it in local_db_scores table. This also sets the &amp;quot;local_scores_calculated&amp;quot; attribute to true for the assignment. Now, the next time someone tries to view these scores, they are computed using the scores saved in local_db_scores.&lt;br /&gt;
&lt;br /&gt;
[[File:Mechanism.png|frame|center]]&lt;br /&gt;
The above image shows the mechanism which will be followed. When an instructor tries to view scores for an assignment, 1st it will be checked if the local_scores_calculated attribute is true or false for the assignment. If it is false, compute_total_scores from OnTheFlyCalc class is called which will add the scores from the questionnaires. However, if it is true, compute_total_scores from LocalDbCalc class is called which will add the corresponding scores from local_db_scores table.&lt;br /&gt;
&lt;br /&gt;
==Changes Done==&lt;br /&gt;
&lt;br /&gt;
* Created a new table local_db_scores with columns id, score_type, round, score, response_map_id (foreign key to response_map table)&lt;br /&gt;
&lt;br /&gt;
* Added a new boolean type column named &amp;quot;local_scores_calculated&amp;quot; with default value false to assignments table&lt;br /&gt;
&lt;br /&gt;
* OnTheFlyCalc class:&lt;br /&gt;
** Changed &amp;quot;OnTheFlyCalc&amp;quot; module from on_the_fly_calc.rb file into a class&lt;br /&gt;
** Changed all its methods into static methods and passed assignment as a parameter for all the methods&lt;br /&gt;
** Removed the line &amp;quot;include OnTheFlyCalc&amp;quot; from assignment.rb file&lt;br /&gt;
** Made changes in all the places (eg. review_mapping_controller.rb) where any method of OnTheFlyCalc was called, so that the corresponding static method gets called now with assignment as a parameter&lt;br /&gt;
&lt;br /&gt;
* LocalDbCalc class:&lt;br /&gt;
** Created a new file local_db_calc.rb with a new class &amp;quot;LocalDbCalc&amp;quot;&lt;br /&gt;
** Created a static method &amp;quot;compute_total_score&amp;quot; with assignment as parameter&lt;br /&gt;
*** This method calculates the total score by adding all the scores of the given assignment stored in local_db_scores table&lt;br /&gt;
** Created a static method &amp;quot;store_total_scores&amp;quot; with assignment as parameter&lt;br /&gt;
*** This method saves the total score of each response map of the given assignment for each round in local_db_scores table&lt;br /&gt;
&lt;br /&gt;
* Logic for choosing LocalDbCalc/OnTheFlyCalc&lt;br /&gt;
** compute_total_scores is called from 3 files namely &amp;quot;assignment_team.rb&amp;quot;, &amp;quot;assignment_participant.rb&amp;quot; and &amp;quot;participant.rb&amp;quot;&lt;br /&gt;
** Added a new condition in the scores method in these files which checks if the &amp;quot;local_scores_calculated&amp;quot; attribute is set (true) for the given assignment&lt;br /&gt;
*** If it is set (true), compute_total_scores from LocalDbCalc class is called&lt;br /&gt;
*** If it is not set (false), compute_total_scores from OnTheFlyCalc class is called&lt;br /&gt;
&lt;br /&gt;
* Manage Assignments UI&lt;br /&gt;
** Created a new icon for each assignment. Clicking this icon stores the total scores for each response map of the assignment for each round in local_db_scores table. It then sets the local_scores_calculated attribute of the assignment to true&lt;br /&gt;
** The code for this is in assets/javascripts/tree_display.jsx&lt;br /&gt;
** Created a new method in assignments_controller.rb named local_db_cal which gets called when the above mentioned icon is clicked&lt;br /&gt;
** This method calls another newly created method &amp;quot;save_score_in_db&amp;quot; in assignment.rb which in turn calls the &amp;quot;store_total_scores&amp;quot; method in LocalDbCalc class&lt;br /&gt;
** A route is also created for this newly created local_db_cal method&lt;br /&gt;
&lt;br /&gt;
====Some of these code snippets are attached below====&lt;br /&gt;
The newly created LocalDbCalc class in models/local_db_calc.rb file with 2 static methods &amp;quot;compute_total_score&amp;quot; and &amp;quot;store_total_scores&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[File:S1.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:S2.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:S3.png]]&lt;br /&gt;
&lt;br /&gt;
The addition of the new icon on Manage Assignments page to save the scores to database. Filename: assets/javascripts/tree_display.jsx&lt;br /&gt;
&lt;br /&gt;
[[File:S4.png]]&lt;br /&gt;
&lt;br /&gt;
The new method in assignment_controller.rb which gets called when the newly created icon is clicked.&lt;br /&gt;
&lt;br /&gt;
[[File:S5.png]]&lt;br /&gt;
&lt;br /&gt;
The new method in assignment.rb which gets called from the above local_db_cal method in assignment controller&lt;br /&gt;
&lt;br /&gt;
[[File:S6.png]]&lt;br /&gt;
&lt;br /&gt;
==Use Cases==&lt;br /&gt;
&lt;br /&gt;
The project can be broken down into two primary use cases.&lt;br /&gt;
&lt;br /&gt;
*  The user wants to view the scores before the assignment is finished.  Scores are calculated &amp;quot;on the fly&amp;quot; and presented to the user.&lt;br /&gt;
*  The user wants to view the scores after the assignment is finished.  Scores are calculated on assignment completion and stored in the database for quick retrieval.&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
The above two use cases can then be translated into three major scenarios we need to test.  The use case where the assignment is completed and scores are stored into the database is broken down into two scenarios to test the data input and data retrieval parts separately.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The following table contains the main scenarios we will cover when testing our project.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Scenario Number&lt;br /&gt;
! Description&lt;br /&gt;
! Expected Result for Pass&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| An assignment is finished and a score is calculated correctly and placed into the local_db_score table using the scheduled task feature.  First, set up an assignment with some score information.  Create a scheduled task to calculate the score and insert the score into the database upon assignment completion.&lt;br /&gt;
| Query the database and verify score is correct&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| Assignment is NOT finished and user wants to view scores.  First, set up an assignment with a deadline in the future.  Put in some score information.   The score should be calculated correctly on the fly using OnTheFlyCalc.&lt;br /&gt;
| After the assignment is created, this test will run on the UI.  The user will click the view scores link and the page should display the expected score.&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| Assignment is finished and the user wants to view scores.  This test will mainly just be a check if clicking view scores on the UI will result in the expected value showing up on the UI.  The interaction in getting the information in the database is already tested in Scenario 1.&lt;br /&gt;
| User clicks on view scores on a past assignment and sees the expected score on the UI&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The following diagrams show how the chosen scenarios above map to functionality.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:E1731-scenario-1.jpg|frame|center]]  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:E1731-scenario-2-3.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Future Work==&lt;br /&gt;
* We have created a new icon which saves the scores to database. This icon is present all the time and can be clicked on multiple times or even when an assignment is ongoing. So clicking on this causes the same entries to be added to the database more than once.&lt;br /&gt;
** So, one future work could be to show this icon only when an assignment has finished and remove it as soon as the local scores are calculated for this assignment. This will prevent the scores being scored multiple times or before an assignment has finished.&lt;br /&gt;
* Currently, once the scores are stored in the database, while computing the scores, always LocalDbCalc will get called.&lt;br /&gt;
** A future work could be to have a way to remove the scores from the database when required or a way to call OnTheFlyCalc instead of LocalDbCalc whenever the instructor wants.&lt;/div&gt;</summary>
		<author><name>Psvaidya</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:S4.png&amp;diff=108651</id>
		<title>File:S4.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:S4.png&amp;diff=108651"/>
		<updated>2017-04-28T03:36:34Z</updated>

		<summary type="html">&lt;p&gt;Psvaidya: uploaded a new version of &amp;amp;quot;File:S4.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Psvaidya</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/E1731_Improve_Score_Calculation&amp;diff=108650</id>
		<title>CSC/ECE 517 Spring 2017/E1731 Improve Score Calculation</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/E1731_Improve_Score_Calculation&amp;diff=108650"/>
		<updated>2017-04-28T03:35:13Z</updated>

		<summary type="html">&lt;p&gt;Psvaidya: /* Some of these code snippets are attached below */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;nowiki&amp;gt;  Expertiza is an opensource web based platform developed to assist students in educational institutions to perform peer reviews and group projects. The reviewing is done through a mechanism where students will be sent request to review work and the system will analyze and publish a summarized report. The software is designed in MVC (Model-View-Controller) architecture using Ruby on Rails.&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Problem Description==&lt;br /&gt;
===Current Scenario===&lt;br /&gt;
Today, Expertiza stores the scores based on each response to each criterion, but no holistic scores are stored. The &amp;quot;answers&amp;quot; table only contains the scores that user A has given user B on each criterion. This means that if we need to know what score A has given B based on 100, we have to rely on the code to calculate it every time the score is requested. This design slows down Expertiza as every time an instructor clicks on &amp;quot;View Scores&amp;quot;, all the calculations are done to display the score. The situation is even worse if we want to weight the scores by the reputation of each reviewer, which is a measure of how closely that reviewer's scores match other reviewers. In this case, the system potentially has to do thousands of arithmetic calculations to display the score for a particular assignment.&lt;br /&gt;
&lt;br /&gt;
===Proposed Solution===&lt;br /&gt;
We propose that we have two mechanisms to handle the holistic scores, depending on the current state of the assignment: This new approach will take the responses and the database will act as a storage environment. &lt;br /&gt;
* OnTheFlyCalc: &lt;br /&gt;
** Calculates holistic scores over a set of data: A set of records in answers table, namely the responses from user A to user B on each criterion.&lt;br /&gt;
** When an assignment is still ongoing, the reputations for each reviewer will be calculated and handled by OnTheFlyCalc&lt;br /&gt;
** This is similar to the current scenario&lt;br /&gt;
* LocalDBCalc: &lt;br /&gt;
** Calculates the holistic score over a single db query: &amp;quot;get the score that user A gives user B on assignment 999 on round 2&amp;quot;&lt;br /&gt;
** When an asignment has finished, all the reputations will be calculated by LocalDBCalc and stored, since they are finalized. So, when the scores are requested, they will be fetched using a single db query and displayed&lt;br /&gt;
** This will be a new addition to the code as currently there is no class. &lt;br /&gt;
&lt;br /&gt;
In this project, our goal is to make the OnTheFlyCalc and LocalDBCalc work only for peer-review scores.  As future projects will introduce other types of scores, the solution must be extensible.&lt;br /&gt;
&lt;br /&gt;
==Design Plan==&lt;br /&gt;
* A new database table &amp;quot;local_db_scores&amp;quot; with following columns will be created to store the holistic scores:&lt;br /&gt;
** id: int&lt;br /&gt;
** score_type: string&lt;br /&gt;
** round: int&lt;br /&gt;
** score: int&lt;br /&gt;
** response_map_id: int (this will be reference to the response_map table)&lt;br /&gt;
* A new column &amp;quot;local_scores_calculated&amp;quot; with boolean type will be added to &amp;quot;assignments&amp;quot; table&lt;br /&gt;
** This has the default value false&lt;br /&gt;
** The value will change to true when the holistic scores for that assignment are stored in local_db_scores table&lt;br /&gt;
* A new icon will be added to the list of Assignments on the Manage Assignments page for instructor&lt;br /&gt;
** When this icon is clicked, the holistic scores will be calculated using store_total_score method in LocalDBCalc class and then inserted in this new table &amp;quot;local_db_score&amp;quot; &lt;br /&gt;
*** If the record to be inserted is a finalized peer-review score, the type stored in the database will be &amp;quot;ReviewLocalDBScore&amp;quot; and the reference_id will be the response_map id&lt;br /&gt;
*** The peer-review scores will be calculated and stored for each of the review rounds because it is possible that user A only reviews user B in one out of several rounds&lt;br /&gt;
* When a request is made to view the total scores, depending on whether local_scores_calculated column of the assignment is false or true, either OnTheFlyCalc or LocalDBCalc will be called to calculate the total score&lt;br /&gt;
&lt;br /&gt;
To achieve this functionality, following classes will be created:&lt;br /&gt;
* OnTheFlyCalc:&lt;br /&gt;
** This class will contain a method &amp;quot;compute_total_scores&amp;quot; which will compute the total score for an assignment by summing the scores given on all questionnaires and return this total score when an instructor tries to view scores for an ongoing assignment&lt;br /&gt;
** It will also contain methods to calculate the average score and score range (min, max) for each reviewee(team) for peer-review&lt;br /&gt;
** Currently OnTheFlyCalc already exists as a module. As it is only used by assignments, we plan to change it into a class and change all its methods into static methods&lt;br /&gt;
* LocalDBCalc:&lt;br /&gt;
** This class will also contain a method &amp;quot;compute_total_scores&amp;quot;. But this method will compute the total score by querying and summing the scores saved in local_db_scores table instead of summing the scores given on all questionnaires&lt;br /&gt;
** It will also contain a method &amp;quot;store_total_scores&amp;quot; which will be called when an instructor clicks on &amp;quot;Save Scores to db&amp;quot; icon for an assignment&lt;br /&gt;
*** This method will compute and save the total scores for all the response maps (reviewer -&amp;gt; reviewee) in the assignment for each round in local_db_scores table.&lt;br /&gt;
&lt;br /&gt;
[[File:Design.png|frame|center]]&lt;br /&gt;
As seen in the above image, when a user A reviews another user B (or team), a response map is created containing individual scores and responses to questionnaires. When an instructor clicks on &amp;quot;Save Scores to DB&amp;quot; icon for an assignment, &amp;quot;store_total_scores&amp;quot; method is called in LocalDBCalc class which calculates the holistic scores for each response map from the individual scores and saves it in local_db_scores table. This also sets the &amp;quot;local_scores_calculated&amp;quot; attribute to true for the assignment. Now, the next time someone tries to view these scores, they are computed using the scores saved in local_db_scores.&lt;br /&gt;
&lt;br /&gt;
[[File:Mechanism.png|frame|center]]&lt;br /&gt;
The above image shows the mechanism which will be followed. When an instructor tries to view scores for an assignment, 1st it will be checked if the local_scores_calculated attribute is true or false for the assignment. If it is false, compute_total_scores from OnTheFlyCalc class is called which will add the scores from the questionnaires. However, if it is true, compute_total_scores from LocalDbCalc class is called which will add the corresponding scores from local_db_scores table.&lt;br /&gt;
&lt;br /&gt;
==Changes Done==&lt;br /&gt;
&lt;br /&gt;
* Created a new table local_db_scores with columns id, score_type, round, score, response_map_id (foreign key to response_map table)&lt;br /&gt;
&lt;br /&gt;
* Added a new boolean type column named &amp;quot;local_scores_calculated&amp;quot; with default value false to assignments table&lt;br /&gt;
&lt;br /&gt;
* OnTheFlyCalc class:&lt;br /&gt;
** Changed &amp;quot;OnTheFlyCalc&amp;quot; module from on_the_fly_calc.rb file into a class&lt;br /&gt;
** Changed all its methods into static methods and passed assignment as a parameter for all the methods&lt;br /&gt;
** Removed the line &amp;quot;include OnTheFlyCalc&amp;quot; from assignment.rb file&lt;br /&gt;
** Made changes in all the places (eg. review_mapping_controller.rb) where any method of OnTheFlyCalc was called, so that the corresponding static method gets called now with assignment as a parameter&lt;br /&gt;
&lt;br /&gt;
* LocalDbCalc class:&lt;br /&gt;
** Created a new file local_db_calc.rb with a new class &amp;quot;LocalDbCalc&amp;quot;&lt;br /&gt;
** Created a static method &amp;quot;compute_total_score&amp;quot; with assignment as parameter&lt;br /&gt;
*** This method calculates the total score by adding all the scores of the given assignment stored in local_db_scores table&lt;br /&gt;
** Created a static method &amp;quot;store_total_scores&amp;quot; with assignment as parameter&lt;br /&gt;
*** This method saves the total score of each response map of the given assignment for each round in local_db_scores table&lt;br /&gt;
&lt;br /&gt;
* Logic for choosing LocalDbCalc/OnTheFlyCalc&lt;br /&gt;
** compute_total_scores is called from 3 files namely &amp;quot;assignment_team.rb&amp;quot;, &amp;quot;assignment_participant.rb&amp;quot; and &amp;quot;participant.rb&amp;quot;&lt;br /&gt;
** Added a new condition in the scores method in these files which checks if the &amp;quot;local_scores_calculated&amp;quot; attribute is set (true) for the given assignment&lt;br /&gt;
*** If it is set (true), compute_total_scores from LocalDbCalc class is called&lt;br /&gt;
*** If it is not set (false), compute_total_scores from OnTheFlyCalc class is called&lt;br /&gt;
&lt;br /&gt;
* Manage Assignments UI&lt;br /&gt;
** Created a new icon for each assignment. Clicking this icon stores the total scores for each response map of the assignment for each round in local_db_scores table. It then sets the local_scores_calculated attribute of the assignment to true&lt;br /&gt;
** The code for this is in assets/javascripts/tree_display.jsx&lt;br /&gt;
** Created a new method in assignments_controller.rb named local_db_cal which gets called when the above mentioned icon is clicked&lt;br /&gt;
** This method calls another newly created method &amp;quot;save_score_in_db&amp;quot; in assignment.rb which in turn calls the &amp;quot;store_total_scores&amp;quot; method in LocalDbCalc class&lt;br /&gt;
** A route is also created for this newly created local_db_cal method&lt;br /&gt;
&lt;br /&gt;
====Some of these code snippets are attached below====&lt;br /&gt;
The newly created LocalDbCalc class in models/local_db_calc.rb file with 2 static methods &amp;quot;compute_total_score&amp;quot; and &amp;quot;store_total_scores&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[File:S1.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:S2.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:S3.png]]&lt;br /&gt;
&lt;br /&gt;
The addition of the new icon on Manage Assignments page to save the scores to database. Filename: assets/javascripts/tree_display.jsx&lt;br /&gt;
&lt;br /&gt;
[[File:S4.png]]&lt;br /&gt;
&lt;br /&gt;
The new method in assignment_controller.rb which gets called when the newly created icon is clicked.&lt;br /&gt;
&lt;br /&gt;
[[File:S5.png]]&lt;br /&gt;
&lt;br /&gt;
The new method in assignment.rb which gets called from the above local_db_cal method in assignment controller&lt;br /&gt;
&lt;br /&gt;
[[File:S6.png]]&lt;br /&gt;
&lt;br /&gt;
==Use Cases==&lt;br /&gt;
&lt;br /&gt;
The project can be broken down into two primary use cases.&lt;br /&gt;
&lt;br /&gt;
*  The user wants to view the scores before the assignment is finished.  Scores are calculated &amp;quot;on the fly&amp;quot; and presented to the user.&lt;br /&gt;
*  The user wants to view the scores after the assignment is finished.  Scores are calculated on assignment completion and stored in the database for quick retrieval.&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
The above two use cases can then be translated into three major scenarios we need to test.  The use case where the assignment is completed and scores are stored into the database is broken down into two scenarios to test the data input and data retrieval parts separately.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The following table contains the main scenarios we will cover when testing our project.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Scenario Number&lt;br /&gt;
! Description&lt;br /&gt;
! Expected Result for Pass&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| An assignment is finished and a score is calculated correctly and placed into the local_db_score table using the scheduled task feature.  First, set up an assignment with some score information.  Create a scheduled task to calculate the score and insert the score into the database upon assignment completion.&lt;br /&gt;
| Query the database and verify score is correct&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| Assignment is NOT finished and user wants to view scores.  First, set up an assignment with a deadline in the future.  Put in some score information.   The score should be calculated correctly on the fly using OnTheFlyCalc.&lt;br /&gt;
| After the assignment is created, this test will run on the UI.  The user will click the view scores link and the page should display the expected score.&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| Assignment is finished and the user wants to view scores.  This test will mainly just be a check if clicking view scores on the UI will result in the expected value showing up on the UI.  The interaction in getting the information in the database is already tested in Scenario 1.&lt;br /&gt;
| User clicks on view scores on a past assignment and sees the expected score on the UI&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The following diagrams show how the chosen scenarios above map to functionality.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:E1731-scenario-1.jpg|frame|center]]  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:E1731-scenario-2-3.jpg|frame|center]]&lt;/div&gt;</summary>
		<author><name>Psvaidya</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/E1731_Improve_Score_Calculation&amp;diff=108649</id>
		<title>CSC/ECE 517 Spring 2017/E1731 Improve Score Calculation</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/E1731_Improve_Score_Calculation&amp;diff=108649"/>
		<updated>2017-04-28T03:34:31Z</updated>

		<summary type="html">&lt;p&gt;Psvaidya: /* Changes Done */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;nowiki&amp;gt;  Expertiza is an opensource web based platform developed to assist students in educational institutions to perform peer reviews and group projects. The reviewing is done through a mechanism where students will be sent request to review work and the system will analyze and publish a summarized report. The software is designed in MVC (Model-View-Controller) architecture using Ruby on Rails.&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Problem Description==&lt;br /&gt;
===Current Scenario===&lt;br /&gt;
Today, Expertiza stores the scores based on each response to each criterion, but no holistic scores are stored. The &amp;quot;answers&amp;quot; table only contains the scores that user A has given user B on each criterion. This means that if we need to know what score A has given B based on 100, we have to rely on the code to calculate it every time the score is requested. This design slows down Expertiza as every time an instructor clicks on &amp;quot;View Scores&amp;quot;, all the calculations are done to display the score. The situation is even worse if we want to weight the scores by the reputation of each reviewer, which is a measure of how closely that reviewer's scores match other reviewers. In this case, the system potentially has to do thousands of arithmetic calculations to display the score for a particular assignment.&lt;br /&gt;
&lt;br /&gt;
===Proposed Solution===&lt;br /&gt;
We propose that we have two mechanisms to handle the holistic scores, depending on the current state of the assignment: This new approach will take the responses and the database will act as a storage environment. &lt;br /&gt;
* OnTheFlyCalc: &lt;br /&gt;
** Calculates holistic scores over a set of data: A set of records in answers table, namely the responses from user A to user B on each criterion.&lt;br /&gt;
** When an assignment is still ongoing, the reputations for each reviewer will be calculated and handled by OnTheFlyCalc&lt;br /&gt;
** This is similar to the current scenario&lt;br /&gt;
* LocalDBCalc: &lt;br /&gt;
** Calculates the holistic score over a single db query: &amp;quot;get the score that user A gives user B on assignment 999 on round 2&amp;quot;&lt;br /&gt;
** When an asignment has finished, all the reputations will be calculated by LocalDBCalc and stored, since they are finalized. So, when the scores are requested, they will be fetched using a single db query and displayed&lt;br /&gt;
** This will be a new addition to the code as currently there is no class. &lt;br /&gt;
&lt;br /&gt;
In this project, our goal is to make the OnTheFlyCalc and LocalDBCalc work only for peer-review scores.  As future projects will introduce other types of scores, the solution must be extensible.&lt;br /&gt;
&lt;br /&gt;
==Design Plan==&lt;br /&gt;
* A new database table &amp;quot;local_db_scores&amp;quot; with following columns will be created to store the holistic scores:&lt;br /&gt;
** id: int&lt;br /&gt;
** score_type: string&lt;br /&gt;
** round: int&lt;br /&gt;
** score: int&lt;br /&gt;
** response_map_id: int (this will be reference to the response_map table)&lt;br /&gt;
* A new column &amp;quot;local_scores_calculated&amp;quot; with boolean type will be added to &amp;quot;assignments&amp;quot; table&lt;br /&gt;
** This has the default value false&lt;br /&gt;
** The value will change to true when the holistic scores for that assignment are stored in local_db_scores table&lt;br /&gt;
* A new icon will be added to the list of Assignments on the Manage Assignments page for instructor&lt;br /&gt;
** When this icon is clicked, the holistic scores will be calculated using store_total_score method in LocalDBCalc class and then inserted in this new table &amp;quot;local_db_score&amp;quot; &lt;br /&gt;
*** If the record to be inserted is a finalized peer-review score, the type stored in the database will be &amp;quot;ReviewLocalDBScore&amp;quot; and the reference_id will be the response_map id&lt;br /&gt;
*** The peer-review scores will be calculated and stored for each of the review rounds because it is possible that user A only reviews user B in one out of several rounds&lt;br /&gt;
* When a request is made to view the total scores, depending on whether local_scores_calculated column of the assignment is false or true, either OnTheFlyCalc or LocalDBCalc will be called to calculate the total score&lt;br /&gt;
&lt;br /&gt;
To achieve this functionality, following classes will be created:&lt;br /&gt;
* OnTheFlyCalc:&lt;br /&gt;
** This class will contain a method &amp;quot;compute_total_scores&amp;quot; which will compute the total score for an assignment by summing the scores given on all questionnaires and return this total score when an instructor tries to view scores for an ongoing assignment&lt;br /&gt;
** It will also contain methods to calculate the average score and score range (min, max) for each reviewee(team) for peer-review&lt;br /&gt;
** Currently OnTheFlyCalc already exists as a module. As it is only used by assignments, we plan to change it into a class and change all its methods into static methods&lt;br /&gt;
* LocalDBCalc:&lt;br /&gt;
** This class will also contain a method &amp;quot;compute_total_scores&amp;quot;. But this method will compute the total score by querying and summing the scores saved in local_db_scores table instead of summing the scores given on all questionnaires&lt;br /&gt;
** It will also contain a method &amp;quot;store_total_scores&amp;quot; which will be called when an instructor clicks on &amp;quot;Save Scores to db&amp;quot; icon for an assignment&lt;br /&gt;
*** This method will compute and save the total scores for all the response maps (reviewer -&amp;gt; reviewee) in the assignment for each round in local_db_scores table.&lt;br /&gt;
&lt;br /&gt;
[[File:Design.png|frame|center]]&lt;br /&gt;
As seen in the above image, when a user A reviews another user B (or team), a response map is created containing individual scores and responses to questionnaires. When an instructor clicks on &amp;quot;Save Scores to DB&amp;quot; icon for an assignment, &amp;quot;store_total_scores&amp;quot; method is called in LocalDBCalc class which calculates the holistic scores for each response map from the individual scores and saves it in local_db_scores table. This also sets the &amp;quot;local_scores_calculated&amp;quot; attribute to true for the assignment. Now, the next time someone tries to view these scores, they are computed using the scores saved in local_db_scores.&lt;br /&gt;
&lt;br /&gt;
[[File:Mechanism.png|frame|center]]&lt;br /&gt;
The above image shows the mechanism which will be followed. When an instructor tries to view scores for an assignment, 1st it will be checked if the local_scores_calculated attribute is true or false for the assignment. If it is false, compute_total_scores from OnTheFlyCalc class is called which will add the scores from the questionnaires. However, if it is true, compute_total_scores from LocalDbCalc class is called which will add the corresponding scores from local_db_scores table.&lt;br /&gt;
&lt;br /&gt;
==Changes Done==&lt;br /&gt;
&lt;br /&gt;
* Created a new table local_db_scores with columns id, score_type, round, score, response_map_id (foreign key to response_map table)&lt;br /&gt;
&lt;br /&gt;
* Added a new boolean type column named &amp;quot;local_scores_calculated&amp;quot; with default value false to assignments table&lt;br /&gt;
&lt;br /&gt;
* OnTheFlyCalc class:&lt;br /&gt;
** Changed &amp;quot;OnTheFlyCalc&amp;quot; module from on_the_fly_calc.rb file into a class&lt;br /&gt;
** Changed all its methods into static methods and passed assignment as a parameter for all the methods&lt;br /&gt;
** Removed the line &amp;quot;include OnTheFlyCalc&amp;quot; from assignment.rb file&lt;br /&gt;
** Made changes in all the places (eg. review_mapping_controller.rb) where any method of OnTheFlyCalc was called, so that the corresponding static method gets called now with assignment as a parameter&lt;br /&gt;
&lt;br /&gt;
* LocalDbCalc class:&lt;br /&gt;
** Created a new file local_db_calc.rb with a new class &amp;quot;LocalDbCalc&amp;quot;&lt;br /&gt;
** Created a static method &amp;quot;compute_total_score&amp;quot; with assignment as parameter&lt;br /&gt;
*** This method calculates the total score by adding all the scores of the given assignment stored in local_db_scores table&lt;br /&gt;
** Created a static method &amp;quot;store_total_scores&amp;quot; with assignment as parameter&lt;br /&gt;
*** This method saves the total score of each response map of the given assignment for each round in local_db_scores table&lt;br /&gt;
&lt;br /&gt;
* Logic for choosing LocalDbCalc/OnTheFlyCalc&lt;br /&gt;
** compute_total_scores is called from 3 files namely &amp;quot;assignment_team.rb&amp;quot;, &amp;quot;assignment_participant.rb&amp;quot; and &amp;quot;participant.rb&amp;quot;&lt;br /&gt;
** Added a new condition in the scores method in these files which checks if the &amp;quot;local_scores_calculated&amp;quot; attribute is set (true) for the given assignment&lt;br /&gt;
*** If it is set (true), compute_total_scores from LocalDbCalc class is called&lt;br /&gt;
*** If it is not set (false), compute_total_scores from OnTheFlyCalc class is called&lt;br /&gt;
&lt;br /&gt;
* Manage Assignments UI&lt;br /&gt;
** Created a new icon for each assignment. Clicking this icon stores the total scores for each response map of the assignment for each round in local_db_scores table. It then sets the local_scores_calculated attribute of the assignment to true&lt;br /&gt;
** The code for this is in assets/javascripts/tree_display.jsx&lt;br /&gt;
** Created a new method in assignments_controller.rb named local_db_cal which gets called when the above mentioned icon is clicked&lt;br /&gt;
** This method calls another newly created method &amp;quot;save_score_in_db&amp;quot; in assignment.rb which in turn calls the &amp;quot;store_total_scores&amp;quot; method in LocalDbCalc class&lt;br /&gt;
** A route is also created for this newly created local_db_cal method&lt;br /&gt;
&lt;br /&gt;
====Some of these code snippets are attached below====&lt;br /&gt;
The newly created LocalDbCalc class in models/local_db_calc.rb file with 2 static methods &amp;quot;compute_total_score&amp;quot; and &amp;quot;store_total_scores&amp;quot;&lt;br /&gt;
[[File:S1.png]]&lt;br /&gt;
[[File:S2.png]]&lt;br /&gt;
[[File:S3.png]]&lt;br /&gt;
&lt;br /&gt;
The addition of the new icon on Manage Assignments page to save the scores to database. Filename: assets/javascripts/tree_display.jsx&lt;br /&gt;
[[File:S4.png]]&lt;br /&gt;
&lt;br /&gt;
The new method in assignment_controller.rb which gets called when the newly created icon is clicked.&lt;br /&gt;
[[File:S5.png]]&lt;br /&gt;
&lt;br /&gt;
The new method in assignment.rb which gets called from the above local_db_cal method in assignment controller&lt;br /&gt;
[[File:S6.png]]&lt;br /&gt;
&lt;br /&gt;
==Use Cases==&lt;br /&gt;
&lt;br /&gt;
The project can be broken down into two primary use cases.&lt;br /&gt;
&lt;br /&gt;
*  The user wants to view the scores before the assignment is finished.  Scores are calculated &amp;quot;on the fly&amp;quot; and presented to the user.&lt;br /&gt;
*  The user wants to view the scores after the assignment is finished.  Scores are calculated on assignment completion and stored in the database for quick retrieval.&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
The above two use cases can then be translated into three major scenarios we need to test.  The use case where the assignment is completed and scores are stored into the database is broken down into two scenarios to test the data input and data retrieval parts separately.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The following table contains the main scenarios we will cover when testing our project.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Scenario Number&lt;br /&gt;
! Description&lt;br /&gt;
! Expected Result for Pass&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| An assignment is finished and a score is calculated correctly and placed into the local_db_score table using the scheduled task feature.  First, set up an assignment with some score information.  Create a scheduled task to calculate the score and insert the score into the database upon assignment completion.&lt;br /&gt;
| Query the database and verify score is correct&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| Assignment is NOT finished and user wants to view scores.  First, set up an assignment with a deadline in the future.  Put in some score information.   The score should be calculated correctly on the fly using OnTheFlyCalc.&lt;br /&gt;
| After the assignment is created, this test will run on the UI.  The user will click the view scores link and the page should display the expected score.&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| Assignment is finished and the user wants to view scores.  This test will mainly just be a check if clicking view scores on the UI will result in the expected value showing up on the UI.  The interaction in getting the information in the database is already tested in Scenario 1.&lt;br /&gt;
| User clicks on view scores on a past assignment and sees the expected score on the UI&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The following diagrams show how the chosen scenarios above map to functionality.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:E1731-scenario-1.jpg|frame|center]]  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:E1731-scenario-2-3.jpg|frame|center]]&lt;/div&gt;</summary>
		<author><name>Psvaidya</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/E1731_Improve_Score_Calculation&amp;diff=108648</id>
		<title>CSC/ECE 517 Spring 2017/E1731 Improve Score Calculation</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/E1731_Improve_Score_Calculation&amp;diff=108648"/>
		<updated>2017-04-28T03:29:52Z</updated>

		<summary type="html">&lt;p&gt;Psvaidya: /* Changes */ Added description of changes done&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;nowiki&amp;gt;  Expertiza is an opensource web based platform developed to assist students in educational institutions to perform peer reviews and group projects. The reviewing is done through a mechanism where students will be sent request to review work and the system will analyze and publish a summarized report. The software is designed in MVC (Model-View-Controller) architecture using Ruby on Rails.&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Problem Description==&lt;br /&gt;
===Current Scenario===&lt;br /&gt;
Today, Expertiza stores the scores based on each response to each criterion, but no holistic scores are stored. The &amp;quot;answers&amp;quot; table only contains the scores that user A has given user B on each criterion. This means that if we need to know what score A has given B based on 100, we have to rely on the code to calculate it every time the score is requested. This design slows down Expertiza as every time an instructor clicks on &amp;quot;View Scores&amp;quot;, all the calculations are done to display the score. The situation is even worse if we want to weight the scores by the reputation of each reviewer, which is a measure of how closely that reviewer's scores match other reviewers. In this case, the system potentially has to do thousands of arithmetic calculations to display the score for a particular assignment.&lt;br /&gt;
&lt;br /&gt;
===Proposed Solution===&lt;br /&gt;
We propose that we have two mechanisms to handle the holistic scores, depending on the current state of the assignment: This new approach will take the responses and the database will act as a storage environment. &lt;br /&gt;
* OnTheFlyCalc: &lt;br /&gt;
** Calculates holistic scores over a set of data: A set of records in answers table, namely the responses from user A to user B on each criterion.&lt;br /&gt;
** When an assignment is still ongoing, the reputations for each reviewer will be calculated and handled by OnTheFlyCalc&lt;br /&gt;
** This is similar to the current scenario&lt;br /&gt;
* LocalDBCalc: &lt;br /&gt;
** Calculates the holistic score over a single db query: &amp;quot;get the score that user A gives user B on assignment 999 on round 2&amp;quot;&lt;br /&gt;
** When an asignment has finished, all the reputations will be calculated by LocalDBCalc and stored, since they are finalized. So, when the scores are requested, they will be fetched using a single db query and displayed&lt;br /&gt;
** This will be a new addition to the code as currently there is no class. &lt;br /&gt;
&lt;br /&gt;
In this project, our goal is to make the OnTheFlyCalc and LocalDBCalc work only for peer-review scores.  As future projects will introduce other types of scores, the solution must be extensible.&lt;br /&gt;
&lt;br /&gt;
==Design Plan==&lt;br /&gt;
* A new database table &amp;quot;local_db_scores&amp;quot; with following columns will be created to store the holistic scores:&lt;br /&gt;
** id: int&lt;br /&gt;
** score_type: string&lt;br /&gt;
** round: int&lt;br /&gt;
** score: int&lt;br /&gt;
** response_map_id: int (this will be reference to the response_map table)&lt;br /&gt;
* A new column &amp;quot;local_scores_calculated&amp;quot; with boolean type will be added to &amp;quot;assignments&amp;quot; table&lt;br /&gt;
** This has the default value false&lt;br /&gt;
** The value will change to true when the holistic scores for that assignment are stored in local_db_scores table&lt;br /&gt;
* A new icon will be added to the list of Assignments on the Manage Assignments page for instructor&lt;br /&gt;
** When this icon is clicked, the holistic scores will be calculated using store_total_score method in LocalDBCalc class and then inserted in this new table &amp;quot;local_db_score&amp;quot; &lt;br /&gt;
*** If the record to be inserted is a finalized peer-review score, the type stored in the database will be &amp;quot;ReviewLocalDBScore&amp;quot; and the reference_id will be the response_map id&lt;br /&gt;
*** The peer-review scores will be calculated and stored for each of the review rounds because it is possible that user A only reviews user B in one out of several rounds&lt;br /&gt;
* When a request is made to view the total scores, depending on whether local_scores_calculated column of the assignment is false or true, either OnTheFlyCalc or LocalDBCalc will be called to calculate the total score&lt;br /&gt;
&lt;br /&gt;
To achieve this functionality, following classes will be created:&lt;br /&gt;
* OnTheFlyCalc:&lt;br /&gt;
** This class will contain a method &amp;quot;compute_total_scores&amp;quot; which will compute the total score for an assignment by summing the scores given on all questionnaires and return this total score when an instructor tries to view scores for an ongoing assignment&lt;br /&gt;
** It will also contain methods to calculate the average score and score range (min, max) for each reviewee(team) for peer-review&lt;br /&gt;
** Currently OnTheFlyCalc already exists as a module. As it is only used by assignments, we plan to change it into a class and change all its methods into static methods&lt;br /&gt;
* LocalDBCalc:&lt;br /&gt;
** This class will also contain a method &amp;quot;compute_total_scores&amp;quot;. But this method will compute the total score by querying and summing the scores saved in local_db_scores table instead of summing the scores given on all questionnaires&lt;br /&gt;
** It will also contain a method &amp;quot;store_total_scores&amp;quot; which will be called when an instructor clicks on &amp;quot;Save Scores to db&amp;quot; icon for an assignment&lt;br /&gt;
*** This method will compute and save the total scores for all the response maps (reviewer -&amp;gt; reviewee) in the assignment for each round in local_db_scores table.&lt;br /&gt;
&lt;br /&gt;
[[File:Design.png|frame|center]]&lt;br /&gt;
As seen in the above image, when a user A reviews another user B (or team), a response map is created containing individual scores and responses to questionnaires. When an instructor clicks on &amp;quot;Save Scores to DB&amp;quot; icon for an assignment, &amp;quot;store_total_scores&amp;quot; method is called in LocalDBCalc class which calculates the holistic scores for each response map from the individual scores and saves it in local_db_scores table. This also sets the &amp;quot;local_scores_calculated&amp;quot; attribute to true for the assignment. Now, the next time someone tries to view these scores, they are computed using the scores saved in local_db_scores.&lt;br /&gt;
&lt;br /&gt;
[[File:Mechanism.png|frame|center]]&lt;br /&gt;
The above image shows the mechanism which will be followed. When an instructor tries to view scores for an assignment, 1st it will be checked if the local_scores_calculated attribute is true or false for the assignment. If it is false, compute_total_scores from OnTheFlyCalc class is called which will add the scores from the questionnaires. However, if it is true, compute_total_scores from LocalDbCalc class is called which will add the corresponding scores from local_db_scores table.&lt;br /&gt;
&lt;br /&gt;
==Changes Done==&lt;br /&gt;
&lt;br /&gt;
* Created a new table local_db_scores with columns id, score_type, round, score, response_map_id (foreign key to response_map table)&lt;br /&gt;
&lt;br /&gt;
* Added a new boolean type column named &amp;quot;local_scores_calculated&amp;quot; with default value false to assignments table&lt;br /&gt;
&lt;br /&gt;
* OnTheFlyCalc class:&lt;br /&gt;
** Changed &amp;quot;OnTheFlyCalc&amp;quot; module from on_the_fly_calc.rb file into a class&lt;br /&gt;
** Changed all its methods into static methods and passed assignment as a parameter for all the methods&lt;br /&gt;
** Removed the line &amp;quot;include OnTheFlyCalc&amp;quot; from assignment.rb file&lt;br /&gt;
** Made changes in all the places (eg. review_mapping_controller.rb) where any method of OnTheFlyCalc was called, so that the corresponding static method gets called now with assignment as a parameter&lt;br /&gt;
&lt;br /&gt;
* LocalDbCalc class:&lt;br /&gt;
** Created a new file local_db_calc.rb with a new class &amp;quot;LocalDbCalc&amp;quot;&lt;br /&gt;
** Created a static method &amp;quot;compute_total_score&amp;quot; with assignment as parameter&lt;br /&gt;
*** This method calculates the total score by adding all the scores of the given assignment stored in local_db_scores table&lt;br /&gt;
** Created a static method &amp;quot;store_total_scores&amp;quot; with assignment as parameter&lt;br /&gt;
*** This method saves the total score of each response map of the given assignment for each round in local_db_scores table&lt;br /&gt;
&lt;br /&gt;
* Logic for choosing LocalDbCalc/OnTheFlyCalc&lt;br /&gt;
** compute_total_scores is called from 3 files namely &amp;quot;assignment_team.rb&amp;quot;, &amp;quot;assignment_participant.rb&amp;quot; and &amp;quot;participant.rb&amp;quot;&lt;br /&gt;
** Added a new condition in the scores method in these files which checks if the &amp;quot;local_scores_calculated&amp;quot; attribute is set (true) for the given assignment&lt;br /&gt;
*** If it is set (true), compute_total_scores from LocalDbCalc class is called&lt;br /&gt;
*** If it is not set (false), compute_total_scores from OnTheFlyCalc class is called&lt;br /&gt;
&lt;br /&gt;
* Manage Assignments UI&lt;br /&gt;
** Created a new icon for each assignment. Clicking this icon stores the total scores for each response map of the assignment for each round in local_db_scores table. It then sets the local_scores_calculated attribute of the assignment to true&lt;br /&gt;
** The code for this is in assets/javascripts/tree_display.jsx&lt;br /&gt;
** Created a new method in assignments_controller.rb named local_db_cal which gets called when the above mentioned icon is clicked&lt;br /&gt;
** This method calls another newly created method &amp;quot;save_score_in_db&amp;quot; in assignment.rb which in turn calls the &amp;quot;store_total_scores&amp;quot; method in LocalDbCalc class&lt;br /&gt;
** A route is also created for this newly created local_db_cal method&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:S1.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:S2.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:S3.png]]&lt;br /&gt;
&lt;br /&gt;
Icon added for storing into db:&lt;br /&gt;
&lt;br /&gt;
[[File:S4.png]]&lt;br /&gt;
&lt;br /&gt;
Storing into db:&lt;br /&gt;
&lt;br /&gt;
[[File:S5.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:S6.png]]&lt;br /&gt;
&lt;br /&gt;
==Use Cases==&lt;br /&gt;
&lt;br /&gt;
The project can be broken down into two primary use cases.&lt;br /&gt;
&lt;br /&gt;
*  The user wants to view the scores before the assignment is finished.  Scores are calculated &amp;quot;on the fly&amp;quot; and presented to the user.&lt;br /&gt;
*  The user wants to view the scores after the assignment is finished.  Scores are calculated on assignment completion and stored in the database for quick retrieval.&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
The above two use cases can then be translated into three major scenarios we need to test.  The use case where the assignment is completed and scores are stored into the database is broken down into two scenarios to test the data input and data retrieval parts separately.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The following table contains the main scenarios we will cover when testing our project.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Scenario Number&lt;br /&gt;
! Description&lt;br /&gt;
! Expected Result for Pass&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| An assignment is finished and a score is calculated correctly and placed into the local_db_score table using the scheduled task feature.  First, set up an assignment with some score information.  Create a scheduled task to calculate the score and insert the score into the database upon assignment completion.&lt;br /&gt;
| Query the database and verify score is correct&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| Assignment is NOT finished and user wants to view scores.  First, set up an assignment with a deadline in the future.  Put in some score information.   The score should be calculated correctly on the fly using OnTheFlyCalc.&lt;br /&gt;
| After the assignment is created, this test will run on the UI.  The user will click the view scores link and the page should display the expected score.&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| Assignment is finished and the user wants to view scores.  This test will mainly just be a check if clicking view scores on the UI will result in the expected value showing up on the UI.  The interaction in getting the information in the database is already tested in Scenario 1.&lt;br /&gt;
| User clicks on view scores on a past assignment and sees the expected score on the UI&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The following diagrams show how the chosen scenarios above map to functionality.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:E1731-scenario-1.jpg|frame|center]]  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:E1731-scenario-2-3.jpg|frame|center]]&lt;/div&gt;</summary>
		<author><name>Psvaidya</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/E1731_Improve_Score_Calculation&amp;diff=108635</id>
		<title>CSC/ECE 517 Spring 2017/E1731 Improve Score Calculation</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/E1731_Improve_Score_Calculation&amp;diff=108635"/>
		<updated>2017-04-27T00:10:33Z</updated>

		<summary type="html">&lt;p&gt;Psvaidya: /* Design Plan */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;nowiki&amp;gt;  Expertiza is an opensource web based platform developed to assist students in educational institutions to perform peer reviews and group projects. The reviewing is done through a mechanism where students will be sent request to review work and the system will analyze and publish a summarized report. The software is designed in MVC (Model-View-Controller) architecture using Ruby on Rails.&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Problem Description==&lt;br /&gt;
===Current Scenario===&lt;br /&gt;
Today, Expertiza stores the scores based on each response to each criterion, but no holistic scores are stored. The &amp;quot;answers&amp;quot; table only contains the scores that user A has given user B on each criterion. This means that if we need to know what score A has given B based on 100, we have to rely on the code to calculate it every time the score is requested. This design slows down Expertiza as every time an instructor clicks on &amp;quot;View Scores&amp;quot;, all the calculations are done to display the score. The situation is even worse if we want to weight the scores by the reputation of each reviewer, which is a measure of how closely that reviewer's scores match other reviewers. In this case, the system potentially has to do thousands of arithmetic calculations to display the score for a particular assignment.&lt;br /&gt;
&lt;br /&gt;
===Proposed Solution===&lt;br /&gt;
We propose that we have two mechanisms to handle the holistic scores, depending on the current state of the assignment: This new approach will take the responses and the database will act as a storage environment. &lt;br /&gt;
* OnTheFlyCalc: &lt;br /&gt;
** Calculates holistic scores over a set of data: A set of records in answers table, namely the responses from user A to user B on each criterion.&lt;br /&gt;
** When an assignment is still ongoing, the reputations for each reviewer will be calculated and handled by OnTheFlyCalc&lt;br /&gt;
** This is similar to the current scenario&lt;br /&gt;
* LocalDBCalc: &lt;br /&gt;
** Calculates the holistic score over a single db query: &amp;quot;get the score that user A gives user B on assignment 999 on round 2&amp;quot;&lt;br /&gt;
** When an asignment has finished, all the reputations will be calculated by LocalDBCalc and stored, since they are finalized. So, when the scores are requested, they will be fetched using a single db query and displayed&lt;br /&gt;
** This will be a new addition to the code as currently there is no class. &lt;br /&gt;
&lt;br /&gt;
In this project, our goal is to make the OnTheFlyCalc and LocalDBCalc work only for peer-review scores.  As future projects will introduce other types of scores, the solution must be extensible.&lt;br /&gt;
&lt;br /&gt;
==Design Plan==&lt;br /&gt;
* A new database table &amp;quot;local_db_scores&amp;quot; with following columns will be created to store the holistic scores:&lt;br /&gt;
** id: int&lt;br /&gt;
** score_type: string&lt;br /&gt;
** round: int&lt;br /&gt;
** score: int&lt;br /&gt;
** response_map_id: int (this will be reference to the response_map table)&lt;br /&gt;
* A new column &amp;quot;local_scores_calculated&amp;quot; with boolean type will be added to &amp;quot;assignments&amp;quot; table&lt;br /&gt;
** This has the default value false&lt;br /&gt;
** The value will change to true when the holistic scores for that assignment are stored in local_db_scores table&lt;br /&gt;
* A new icon will be added to the list of Assignments on the Manage Assignments page for instructor&lt;br /&gt;
** When this icon is clicked, the holistic scores will be calculated using store_total_score method in LocalDBCalc class and then inserted in this new table &amp;quot;local_db_score&amp;quot; &lt;br /&gt;
*** If the record to be inserted is a finalized peer-review score, the type stored in the database will be &amp;quot;ReviewLocalDBScore&amp;quot; and the reference_id will be the response_map id&lt;br /&gt;
*** The peer-review scores will be calculated and stored for each of the review rounds because it is possible that user A only reviews user B in one out of several rounds&lt;br /&gt;
* When a request is made to view the total scores, depending on whether local_scores_calculated column of the assignment is false or true, either OnTheFlyCalc or LocalDBCalc will be called to calculate the total score&lt;br /&gt;
&lt;br /&gt;
To achieve this functionality, following classes will be created:&lt;br /&gt;
* OnTheFlyCalc:&lt;br /&gt;
** This class will contain a method &amp;quot;compute_total_scores&amp;quot; which will compute the total score for an assignment by summing the scores given on all questionnaires and return this total score when an instructor tries to view scores for an ongoing assignment&lt;br /&gt;
** It will also contain methods to calculate the average score and score range (min, max) for each reviewee(team) for peer-review&lt;br /&gt;
** Currently OnTheFlyCalc already exists as a module. As it is only used by assignments, we plan to change it into a class and change all its methods into static methods&lt;br /&gt;
* LocalDBCalc:&lt;br /&gt;
** This class will also contain a method &amp;quot;compute_total_scores&amp;quot;. But this method will compute the total score by querying and summing the scores saved in local_db_scores table instead of summing the scores given on all questionnaires&lt;br /&gt;
** It will also contain a method &amp;quot;store_total_scores&amp;quot; which will be called when an instructor clicks on &amp;quot;Save Scores to db&amp;quot; icon for an assignment&lt;br /&gt;
*** This method will compute and save the total scores for all the response maps (reviewer -&amp;gt; reviewee) in the assignment for each round in local_db_scores table.&lt;br /&gt;
&lt;br /&gt;
[[File:Design.png|frame|center]]&lt;br /&gt;
As seen in the above image, when a user A reviews another user B (or team), a response map is created containing individual scores and responses to questionnaires. When an instructor clicks on &amp;quot;Save Scores to DB&amp;quot; icon for an assignment, &amp;quot;store_total_scores&amp;quot; method is called in LocalDBCalc class which calculates the holistic scores for each response map from the individual scores and saves it in local_db_scores table. This also sets the &amp;quot;local_scores_calculated&amp;quot; attribute to true for the assignment. Now, the next time someone tries to view these scores, they are computed using the scores saved in local_db_scores.&lt;br /&gt;
&lt;br /&gt;
[[File:Mechanism.png|frame|center]]&lt;br /&gt;
The above image shows the mechanism which will be followed. When an instructor tries to view scores for an assignment, 1st it will be checked if the local_scores_calculated attribute is true or false for the assignment. If it is false, compute_total_scores from OnTheFlyCalc class is called which will add the scores from the questionnaires. However, if it is true, compute_total_scores from LocalDbCalc class is called which will add the corresponding scores from local_db_scores table.&lt;br /&gt;
&lt;br /&gt;
==Changes==&lt;br /&gt;
&lt;br /&gt;
Code snippets including:&lt;br /&gt;
&lt;br /&gt;
[[File:S1.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:S2.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:S3.png]]&lt;br /&gt;
&lt;br /&gt;
Icon added for storing into db:&lt;br /&gt;
&lt;br /&gt;
[[File:S4.png]]&lt;br /&gt;
&lt;br /&gt;
Storing into db:&lt;br /&gt;
&lt;br /&gt;
[[File:S5.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:S6.png]]&lt;br /&gt;
&lt;br /&gt;
==Use Cases==&lt;br /&gt;
&lt;br /&gt;
The project can be broken down into two primary use cases.&lt;br /&gt;
&lt;br /&gt;
*  The user wants to view the scores before the assignment is finished.  Scores are calculated &amp;quot;on the fly&amp;quot; and presented to the user.&lt;br /&gt;
*  The user wants to view the scores after the assignment is finished.  Scores are calculated on assignment completion and stored in the database for quick retrieval.&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
The above two use cases can then be translated into three major scenarios we need to test.  The use case where the assignment is completed and scores are stored into the database is broken down into two scenarios to test the data input and data retrieval parts separately.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The following table contains the main scenarios we will cover when testing our project.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Scenario Number&lt;br /&gt;
! Description&lt;br /&gt;
! Expected Result for Pass&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| An assignment is finished and a score is calculated correctly and placed into the local_db_score table using the scheduled task feature.  First, set up an assignment with some score information.  Create a scheduled task to calculate the score and insert the score into the database upon assignment completion.&lt;br /&gt;
| Query the database and verify score is correct&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| Assignment is NOT finished and user wants to view scores.  First, set up an assignment with a deadline in the future.  Put in some score information.   The score should be calculated correctly on the fly using OnTheFlyCalc.&lt;br /&gt;
| After the assignment is created, this test will run on the UI.  The user will click the view scores link and the page should display the expected score.&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| Assignment is finished and the user wants to view scores.  This test will mainly just be a check if clicking view scores on the UI will result in the expected value showing up on the UI.  The interaction in getting the information in the database is already tested in Scenario 1.&lt;br /&gt;
| User clicks on view scores on a past assignment and sees the expected score on the UI&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The following diagrams show how the chosen scenarios above map to functionality.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:E1731-scenario-1.jpg|frame|center]]  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:E1731-scenario-2-3.jpg|frame|center]]&lt;/div&gt;</summary>
		<author><name>Psvaidya</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Mechanism.png&amp;diff=108627</id>
		<title>File:Mechanism.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Mechanism.png&amp;diff=108627"/>
		<updated>2017-04-26T23:46:20Z</updated>

		<summary type="html">&lt;p&gt;Psvaidya: uploaded a new version of &amp;amp;quot;File:Mechanism.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Psvaidya</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Design.png&amp;diff=108622</id>
		<title>File:Design.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Design.png&amp;diff=108622"/>
		<updated>2017-04-26T23:36:04Z</updated>

		<summary type="html">&lt;p&gt;Psvaidya: uploaded a new version of &amp;amp;quot;File:Design.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Psvaidya</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/E1731_Improve_Score_Calculation&amp;diff=108619</id>
		<title>CSC/ECE 517 Spring 2017/E1731 Improve Score Calculation</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/E1731_Improve_Score_Calculation&amp;diff=108619"/>
		<updated>2017-04-26T22:54:29Z</updated>

		<summary type="html">&lt;p&gt;Psvaidya: /* Design Plan */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;nowiki&amp;gt;  Expertiza is an opensource web based platform developed to assist students in educational institutions to perform peer reviews and group projects. The reviewing is done through a mechanism where students will be sent request to review work and the system will analyze and publish a summarized report. The software is designed in MVC (Model-View-Controller) architecture using Ruby on Rails.&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Problem Description==&lt;br /&gt;
===Current Scenario===&lt;br /&gt;
Today, Expertiza stores the scores based on each response to each criterion, but no holistic scores are stored. The &amp;quot;answers&amp;quot; table only contains the scores that user A has given user B on each criterion. This means that if we need to know what score A has given B based on 100, we have to rely on the code to calculate it every time the score is requested. This design slows down Expertiza as every time an instructor clicks on &amp;quot;View Scores&amp;quot;, all the calculations are done to display the score. The situation is even worse if we want to weight the scores by the reputation of each reviewer, which is a measure of how closely that reviewer's scores match other reviewers. In this case, the system potentially has to do thousands of arithmetic calculations to display the score for a particular assignment.&lt;br /&gt;
&lt;br /&gt;
===Proposed Solution===&lt;br /&gt;
We propose that we have two mechanisms to handle the holistic scores, depending on the current state of the assignment: This new approach will take the responses and the database will act as a storage environment. &lt;br /&gt;
* OnTheFlyCalc: &lt;br /&gt;
** Calculates holistic scores over a set of data: A set of records in answers table, namely the responses from user A to user B on each criterion.&lt;br /&gt;
** When an assignment is still ongoing, the reputations for each reviewer will be calculated and handled by OnTheFlyCalc&lt;br /&gt;
** This is similar to the current scenario&lt;br /&gt;
* LocalDBCalc: &lt;br /&gt;
** Calculates the holistic score over a single db query: &amp;quot;get the score that user A gives user B on assignment 999 on round 2&amp;quot;&lt;br /&gt;
** When an asignment has finished, all the reputations will be calculated by LocalDBCalc and stored, since they are finalized. So, when the scores are requested, they will be fetched using a single db query and displayed&lt;br /&gt;
** This will be a new addition to the code as currently there is no class. &lt;br /&gt;
&lt;br /&gt;
In this project, our goal is to make the OnTheFlyCalc and LocalDBCalc work only for peer-review scores.  As future projects will introduce other types of scores, the solution must be extensible.&lt;br /&gt;
&lt;br /&gt;
==Design Plan==&lt;br /&gt;
* A new database table &amp;quot;local_db_scores&amp;quot; with following columns will be created to store the holistic scores:&lt;br /&gt;
** id: int&lt;br /&gt;
** score_type: string&lt;br /&gt;
** round: int&lt;br /&gt;
** score: int&lt;br /&gt;
** response_map_id: int (this will be reference to the response_map table)&lt;br /&gt;
* A new column &amp;quot;local_scores_calculated&amp;quot; with boolean type will be added to &amp;quot;assignments&amp;quot; table&lt;br /&gt;
** This has the default value false&lt;br /&gt;
** The value will change to true when the holistic scores for that assignment are stored in local_db_scores table&lt;br /&gt;
* A new icon will be added to the list of Assignments on the Manage Assignments page for instructor&lt;br /&gt;
** When this icon is clicked, the holistic scores will be calculated using store_total_score method in LocalDBCalc class and then inserted in this new table &amp;quot;local_db_score&amp;quot; &lt;br /&gt;
*** If the record to be inserted is a finalized peer-review score, the type stored in the database will be &amp;quot;ReviewLocalDBScore&amp;quot; and the reference_id will be the response_map id&lt;br /&gt;
*** The peer-review scores will be calculated and stored for each of the review rounds because it is possible that user A only reviews user B in one out of several rounds&lt;br /&gt;
* When a request is made to view the total scores, depending on whether local_scores_calculated column of the assignment is false or true, either OnTheFlyCalc or LocalDBCalc will be called to calculate the total score&lt;br /&gt;
&lt;br /&gt;
To achieve this functionality, following classes will be created:&lt;br /&gt;
* OnTheFlyCalc:&lt;br /&gt;
** This class will contain a method &amp;quot;compute_total_scores&amp;quot; which will compute the total score for an assignment by summing the scores given on all questionnaires and return this total score when an instructor tries to view scores for an ongoing assignment&lt;br /&gt;
** It will also contain methods to calculate the average score and score range (min, max) for each reviewee(team) for peer-review&lt;br /&gt;
** Currently OnTheFlyCalc already exists as a module. As it is only used by assignments, we plan to change it into a class and change all its methods into static methods&lt;br /&gt;
* LocalDBCalc:&lt;br /&gt;
** This class will also contain a method &amp;quot;compute_total_scores&amp;quot;. But this method will compute the total score by querying and summing the scores saved in local_db_scores table instead of summing the scores given on all questionnaires&lt;br /&gt;
** It will also contain a method &amp;quot;store_total_scores&amp;quot; which will be called when an instructor clicks on &amp;quot;Save Scores to db&amp;quot; icon for an assignment&lt;br /&gt;
*** This method will compute and save the total scores for all the response maps (reviewer -&amp;gt; reviewee) in the assignment for each round in local_db_scores table.&lt;br /&gt;
&lt;br /&gt;
[[File:Design.png|frame|center]]&lt;br /&gt;
As seen in the above image, when a user A reviews another user B (or team), a response map is created containing individual scores and responses to questionnaires. When an assignment is finished, LocalDBCalc class calculates the holistic scores from the individual scores and saves it in local_db_scores table, so that next time someone tries to view the scores, they can be immediately queried and returned without any calculations.&lt;br /&gt;
&lt;br /&gt;
[[File:Mechanism.png|frame|center]]&lt;br /&gt;
The above image shows the mechanism which will be followed. When an instructor tries to view scores for an assignment, 1st it will be checked if the assignment is ongoing or completed. If it is an ongoing assignment, the holistic scores are calculated and returned. However, if it is a finished assignment, no calculations are done. The holistic scores are directly returned from the local_db_scores table where they are stored.&lt;br /&gt;
&lt;br /&gt;
==Use Cases==&lt;br /&gt;
&lt;br /&gt;
The project can be broken down into two primary use cases.&lt;br /&gt;
&lt;br /&gt;
*  The user wants to view the scores before the assignment is finished.  Scores are calculated &amp;quot;on the fly&amp;quot; and presented to the user.&lt;br /&gt;
*  The user wants to view the scores after the assignment is finished.  Scores are calculated on assignment completion and stored in the database for quick retrieval.&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
The above two use cases can then be translated into three major scenarios we need to test.  The use case where the assignment is completed and scores are stored into the database is broken down into two scenarios to test the data input and data retrieval parts separately.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The following table contains the main scenarios we will cover when testing our project.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Scenario Number&lt;br /&gt;
! Description&lt;br /&gt;
! Expected Result for Pass&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| An assignment is finished and a score is calculated correctly and placed into the local_db_score table using the scheduled task feature.  First, set up an assignment with some score information.  Create a scheduled task to calculate the score and insert the score into the database upon assignment completion.&lt;br /&gt;
| Query the database and verify score is correct&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| Assignment is NOT finished and user wants to view scores.  First, set up an assignment with a deadline in the future.  Put in some score information.   The score should be calculated correctly on the fly using OnTheFlyCalc.&lt;br /&gt;
| After the assignment is created, this test will run on the UI.  The user will click the view scores link and the page should display the expected score.&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| Assignment is finished and the user wants to view scores.  This test will mainly just be a check if clicking view scores on the UI will result in the expected value showing up on the UI.  The interaction in getting the information in the database is already tested in Scenario 1.&lt;br /&gt;
| User clicks on view scores on a past assignment and sees the expected score on the UI&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The following diagrams show how the chosen scenarios above map to functionality.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:E1731-scenario-1.jpg|frame|center]]  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:E1731-scenario-2-3.jpg|frame|center]]&lt;/div&gt;</summary>
		<author><name>Psvaidya</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/E1731_Improve_Score_Calculation&amp;diff=108318</id>
		<title>CSC/ECE 517 Spring 2017/E1731 Improve Score Calculation</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/E1731_Improve_Score_Calculation&amp;diff=108318"/>
		<updated>2017-04-12T19:29:35Z</updated>

		<summary type="html">&lt;p&gt;Psvaidya: /* Design Plan */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;nowiki&amp;gt;  Expertiza is an opensource web based platform developed to assist students in educational institutions to perform peer reviews and group projects. The reviewing is done through a mechanism where students will be sent request to review work and the system will analyze and publish a summarized report. The software is designed in MVC (Model-View-Controller) architecture using Ruby on Rails.&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Problem Description==&lt;br /&gt;
===Current Scenario===&lt;br /&gt;
Today, Expertiza stores the scores based on each response to each criterion, but no holistic scores are stored. The &amp;quot;answers&amp;quot; table only contains the scores that user A has given user B on each criterion. This means that if we need to know what score A has given B based on 100, we have to rely on the code to calculate it every time the score is requested. This design slows down Expertiza as every time an instructor clicks on &amp;quot;View Scores&amp;quot;, all the calculations are done to display the score. The situation is even worse if we want to weight the scores by the reputation of each reviewer, which is a measure of how closely that reviewer's scores match other reviewers. In this case, the system potentially has to do thousands of arithmetic calculations to display the score for a particular assignment.&lt;br /&gt;
&lt;br /&gt;
===Proposed Solution===&lt;br /&gt;
We propose that we have two mechanisms to handle the holistic scores, depending on the current state of the assignment: This new approach will take the responses and the database will act as a storage environment. &lt;br /&gt;
* OnTheFlyCalc: &lt;br /&gt;
** Calculates holistic scores over a set of data: A set of records in answers table, namely the responses from user A to user B on each criterion.&lt;br /&gt;
** When an assignment is still ongoing, the reputations for each reviewer will be calculated and handled by OnTheFlyCalc&lt;br /&gt;
** This is similar to the current scenario&lt;br /&gt;
* LocalDBCalc: &lt;br /&gt;
** Calculates the holistic score over a single db query: &amp;quot;get the score that user A gives user B on assignment 999 on round 2&amp;quot;&lt;br /&gt;
** When an asignment has finished, all the reputations will be calculated by LocalDBCalc and stored, since they are finalized. So, when the scores are requested, they will be fetched using a single db query and displayed&lt;br /&gt;
** This will be a new addition to the code as currently there is no class. &lt;br /&gt;
&lt;br /&gt;
In this project, our goal is to make the OnTheFlyCalc and LocalDBCalc work only for peer-review scores.  As future projects will introduce other types of scores, the solution must be extensible.&lt;br /&gt;
&lt;br /&gt;
==Design Plan==&lt;br /&gt;
* A new database table &amp;quot;local_db_scores&amp;quot; with following columns will be created to store the holistic scores:&lt;br /&gt;
** id: int&lt;br /&gt;
** type: string&lt;br /&gt;
** round: int&lt;br /&gt;
** score: int&lt;br /&gt;
** reference_id: int (this will be reference to the response_map table)&lt;br /&gt;
* When an assignment finishes (that is when the deadline has passed), holistic scores will be calculated using LocalDBCalc class and then inserted in this new table &amp;quot;local_db_score&amp;quot; &lt;br /&gt;
** This will be done using scheduled tasks feature&lt;br /&gt;
** If the record to be inserted is a finalized peer-review score, the type stored in the database will be &amp;quot;ReviewLocalDBScore&amp;quot; and the reference_id will be the response_map id&lt;br /&gt;
** The peer-review scores will be calculated and stored for each of the review rounds because it is possible that user A only reviews user B in one out of several rounds.&lt;br /&gt;
* When a request is made to view the scores, depending on whether the assignment is ongoing or finished, either OnTheFlyCalc or LocalDBCalc will be called to calculate the score or query the score from the &amp;quot;local_db_scores&amp;quot; table&lt;br /&gt;
&lt;br /&gt;
To achieve this functionality, following classes will be created:&lt;br /&gt;
* ScoreCalc:&lt;br /&gt;
** This class will be a general class acting as an interface used by OnTheFlyCalc and LocalDBCalc&lt;br /&gt;
** It will contain most of the functionality from currently existing OnTheFlyCalc class&lt;br /&gt;
** It will compute the total score for an assignment by summing the scores given on all questionnaires&lt;br /&gt;
** It will also calculate the average score and score range (min, max) for each reviewee(team) for peer-review&lt;br /&gt;
* OnTheFlyCalc:&lt;br /&gt;
** This class will be a subclass of ScoreCalc&lt;br /&gt;
** It will calculate the holistic scores using its superclass methods and return these scores when an instructor tries to view scores for an ongoing assignment&lt;br /&gt;
* LocalDBCalc:&lt;br /&gt;
** This class will be a subclass of ScoreCalc&lt;br /&gt;
** It will also calculate the holistic scores using its superclass methods, but instead of returning them, the holistic scores will be stored in the database. These methods will be called when an assignment has finished (reached the deadline)&lt;br /&gt;
** In addition, this class will contain another method which will be called when an instructor tries to view scores for a finished assignment. It will query the database where the holistic scores are stored and immediately return the value without performing any calculations&lt;br /&gt;
&lt;br /&gt;
[[File:Design.png|frame|center]]&lt;br /&gt;
As seen in the above image, when a user A reviews another user B (or team), a response map is created containing individual scores and responses to questionnaires. When an assignment is finished, LocalDBCalc class calculates the holistic scores from the individual scores and saves it in local_db_scores table, so that next time someone tries to view the scores, they can be immediately queried and returned without any calculations.&lt;br /&gt;
&lt;br /&gt;
[[File:Mechanism.png|frame|center]]&lt;br /&gt;
The above image shows the mechanism which will be followed. When an instructor tries to view scores for an assignment, 1st it will be checked if the assignment is ongoing or completed. If it is an ongoing assignment, the holistic scores are calculated and returned. However, if it is a finished assignment, no calculations are done. The holistic scores are directly returned from the local_db_scores table where they are stored.&lt;br /&gt;
&lt;br /&gt;
==Use Cases==&lt;br /&gt;
&lt;br /&gt;
The project can be broken down into two primary use cases.&lt;br /&gt;
&lt;br /&gt;
*  The user wants to view the scores before the assignment is finished.  Scores are calculated &amp;quot;on the fly&amp;quot; and presented to the user.&lt;br /&gt;
*  The user wants to view the scores after the assignment is finished.  Scores are calculated on assignment completion and stored in the database for quick retrieval.&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
The above two use cases can then be translated into three major scenarios we need to test.  The use case where the assignment is completed and scores are stored into the database is broken down into two scenarios to test the data input and data retrieval parts separately.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The following table contains the main scenarios we will cover when testing our project.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Scenario Number&lt;br /&gt;
! Description&lt;br /&gt;
! Expected Result for Pass&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| An assignment is finished and a score is calculated correctly and placed into the local_db_score table using the scheduled task feature.  First, set up an assignment with some score information.  Create a scheduled task to calculate the score and insert the score into the database upon assignment completion.&lt;br /&gt;
| Query the database and verify score is correct&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| Assignment is NOT finished and user wants to view scores.  First, set up an assignment with a deadline in the future.  Put in some score information.   The score should be calculated correctly on the fly using OnTheFlyCalc.&lt;br /&gt;
| After the assignment is created, this test will run on the UI.  The user will click the view scores link and the page should display the expected score.&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| Assignment is finished and the user wants to view scores.  This test will mainly just be a check if clicking view scores on the UI will result in the expected value showing up on the UI.  The interaction in getting the information in the database is already tested in Scenario 1.&lt;br /&gt;
| User clicks on view scores on a past assignment and sees the expected score on the UI&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The following diagrams show how the chosen scenarios above map to functionality.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:E1731-scenario-1.jpg|frame|center]]  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:E1731-scenario-2-3.jpg|frame|center]]&lt;/div&gt;</summary>
		<author><name>Psvaidya</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/E1731_Improve_Score_Calculation&amp;diff=108317</id>
		<title>CSC/ECE 517 Spring 2017/E1731 Improve Score Calculation</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/E1731_Improve_Score_Calculation&amp;diff=108317"/>
		<updated>2017-04-12T19:21:52Z</updated>

		<summary type="html">&lt;p&gt;Psvaidya: /* Design Plan */ Updated Design Plan&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;nowiki&amp;gt;  Expertiza is an opensource web based platform developed to assist students in educational institutions to perform peer reviews and group projects. The reviewing is done through a mechanism where students will be sent request to review work and the system will analyze and publish a summarized report. The software is designed in MVC (Model-View-Controller) architecture using Ruby on Rails.&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Problem Description==&lt;br /&gt;
===Current Scenario===&lt;br /&gt;
Today, Expertiza stores the scores based on each response to each criterion, but no holistic scores are stored. The &amp;quot;answers&amp;quot; table only contains the scores that user A has given user B on each criterion. This means that if we need to know what score A has given B based on 100, we have to rely on the code to calculate it every time the score is requested. This design slows down Expertiza as every time an instructor clicks on &amp;quot;View Scores&amp;quot;, all the calculations are done to display the score. The situation is even worse if we want to weight the scores by the reputation of each reviewer, which is a measure of how closely that reviewer's scores match other reviewers. In this case, the system potentially has to do thousands of arithmetic calculations to display the score for a particular assignment.&lt;br /&gt;
&lt;br /&gt;
===Proposed Solution===&lt;br /&gt;
We propose that we have two mechanisms to handle the holistic scores, depending on the current state of the assignment: This new approach will take the responses and the database will act as a storage environment. &lt;br /&gt;
* OnTheFlyCalc: &lt;br /&gt;
** Calculates holistic scores over a set of data: A set of records in answers table, namely the responses from user A to user B on each criterion.&lt;br /&gt;
** When an assignment is still ongoing, the reputations for each reviewer will be calculated and handled by OnTheFlyCalc&lt;br /&gt;
** This is similar to the current scenario&lt;br /&gt;
* LocalDBCalc: &lt;br /&gt;
** Calculates the holistic score over a single db query: &amp;quot;get the score that user A gives user B on assignment 999 on round 2&amp;quot;&lt;br /&gt;
** When an asignment has finished, all the reputations will be calculated by LocalDBCalc and stored, since they are finalized. So, when the scores are requested, they will be fetched using a single db query and displayed&lt;br /&gt;
** This will be a new addition to the code as currently there is no class. &lt;br /&gt;
&lt;br /&gt;
In this project, our goal is to make the OnTheFlyCalc and LocalDBCalc work only for peer-review scores.  As future projects will introduce other types of scores, the solution must be extensible.&lt;br /&gt;
&lt;br /&gt;
==Design Plan==&lt;br /&gt;
* A new database table &amp;quot;local_db_scores&amp;quot; with following columns will be created to store the holistic scores:&lt;br /&gt;
** id: int&lt;br /&gt;
** type: string&lt;br /&gt;
** round: int&lt;br /&gt;
** score: int&lt;br /&gt;
** reference_id: int (this will be reference to the response_map table)&lt;br /&gt;
* When an assignment finishes (that is when the deadline has passed), holistic scores will be calculated in LocalDBCalc and then inserted in the table &amp;quot;local_db_score&amp;quot; &lt;br /&gt;
** This will be done using scheduled tasks feature&lt;br /&gt;
** If the record to be inserted is a finalized peer-review score, the type stored in the database will be &amp;quot;ReviewLocalDBScore&amp;quot; and the reference_id will be the response_map id&lt;br /&gt;
** The peer-review scores will be calculated and stored for each of the review rounds because it is possible that user A only reviews user B in one out of several rounds.&lt;br /&gt;
* When a request is made to view the scores, depending on whether the assignment is ongoing or finished, either OnTheFlyCalc or LocalDBCalc will be called to calculate the score or query the score from the &amp;quot;local_db_scores&amp;quot; table&lt;br /&gt;
&lt;br /&gt;
To achieve this functionality, following classes will be created:&lt;br /&gt;
* ScoreCalc:&lt;br /&gt;
** This class will be general class acting as an interface used by OnTheFlyCalc and LocalDBCalc to calculate and store or return holistic scores&lt;br /&gt;
** It will contain most of the functionality from currently existing OnTheFlyCalc class&lt;br /&gt;
** It will compute the total score for an assignment by summing the scores given on all questionnaires&lt;br /&gt;
** It will also calculate the average score and score range (min, max) for each reviewee(team) for peer-review&lt;br /&gt;
* OnTheFlyCalc:&lt;br /&gt;
** This class will be a subclass of ScoreCalc&lt;br /&gt;
** It will calculate the holistic scores using its superclass methods and return these scores when an instructor tries to view scores for an ongoing assignment&lt;br /&gt;
* LocalDBCalc:&lt;br /&gt;
** This class will be a subclass of ScoreCalc&lt;br /&gt;
** It will also calculate the holistic scores using its superclass methods, but instead of returning them, the holistic scores will be stored in the database. These methods will be called when an assignment has finished (reached the deadline)&lt;br /&gt;
** In addition, this class will contain another method which will be called when an instructor tries to view scores for a finished assignment. It will query the database where the holistic scores are stored and immediately return the value without performing any calculations&lt;br /&gt;
&lt;br /&gt;
[[File:Design.png|frame|center]]&lt;br /&gt;
&lt;br /&gt;
[[File:Mechanism.png|frame|center]]&lt;br /&gt;
&lt;br /&gt;
==Use Cases==&lt;br /&gt;
&lt;br /&gt;
The project can be broken down into two primary use cases.&lt;br /&gt;
&lt;br /&gt;
*  The user wants to view the scores before the assignment is finished.  Scores are calculated &amp;quot;on the fly&amp;quot; and presented to the user.&lt;br /&gt;
*  The user wants to view the scores after the assignment is finished.  Scores are calculated on assignment completion and stored in the database for quick retrieval.&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
The above two use cases can then be translated into three major scenarios we need to test.  The use case where the assignment is completed and scores are stored into the database is broken down into two scenarios to test the data input and data retrieval parts separately.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The following table contains the main scenarios we will cover when testing our project.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Scenario Number&lt;br /&gt;
! Description&lt;br /&gt;
! Expected Result for Pass&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| An assignment is finished and a score is calculated correctly and placed into the local_db_score table using the scheduled task feature.  First, set up an assignment with some score information.  Create a scheduled task to calculate the score and insert the score into the database upon assignment completion.&lt;br /&gt;
| Query the database and verify score is correct&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| Assignment is NOT finished and user wants to view scores.  First, set up an assignment with a deadline in the future.  Put in some score information.   The score should be calculated correctly on the fly using OnTheFlyCalc.&lt;br /&gt;
| After the assignment is created, this test will run on the UI.  The user will click the view scores link and the page should display the expected score.&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| Assignment is finished and the user wants to view scores.  This test will mainly just be a check if clicking view scores on the UI will result in the expected value showing up on the UI.  The interaction in getting the information in the database is already tested in Scenario 1.&lt;br /&gt;
| User clicks on view scores on a past assignment and sees the expected score on the UI&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The following diagrams show how the chosen scenarios above map to functionality.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:E1731-scenario-1.jpg|frame|center]]  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:E1731-scenario-2-3.jpg|frame|center]]&lt;/div&gt;</summary>
		<author><name>Psvaidya</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Design.png&amp;diff=108316</id>
		<title>File:Design.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Design.png&amp;diff=108316"/>
		<updated>2017-04-12T18:54:33Z</updated>

		<summary type="html">&lt;p&gt;Psvaidya: uploaded a new version of &amp;amp;quot;File:Design.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Psvaidya</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/E1731_Improve_Score_Calculation&amp;diff=108315</id>
		<title>CSC/ECE 517 Spring 2017/E1731 Improve Score Calculation</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/E1731_Improve_Score_Calculation&amp;diff=108315"/>
		<updated>2017-04-12T18:53:50Z</updated>

		<summary type="html">&lt;p&gt;Psvaidya: /* Design Plan */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;nowiki&amp;gt;  Expertiza is an opensource web based platform developed to assist students in educational institutions to perform peer reviews and group projects. The reviewing is done through a mechanism where students will be sent request to review work and the system will analyze and publish a summarized report. The software is designed in MVC (Model-View-Controller) architecture using Ruby on Rails.&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Problem Description==&lt;br /&gt;
===Current Scenario===&lt;br /&gt;
Today, Expertiza stores the scores based on each response to each criterion, but no holistic scores are stored. The &amp;quot;answers&amp;quot; table only contains the scores that user A has given user B on each criterion. This means that if we need to know what score A has given B based on 100, we have to rely on the code to calculate it every time the score is requested. This design slows down Expertiza as every time an instructor clicks on &amp;quot;View Scores&amp;quot;, all the calculations are done to display the score. The situation is even worse if we want to weight the scores by the reputation of each reviewer, which is a measure of how closely that reviewer's scores match other reviewers. In this case, the system potentially has to do thousands of arithmetic calculations to display the score for a particular assignment.&lt;br /&gt;
&lt;br /&gt;
===Proposed Solution===&lt;br /&gt;
We propose that we have two mechanisms to handle the holistic scores, depending on the current state of the assignment: This new approach will take the responses and the database will act as a storage environment. &lt;br /&gt;
* OnTheFlyCalc: &lt;br /&gt;
** Calculates holistic scores over a set of data: A set of records in answers table, namely the responses from user A to user B on each criterion.&lt;br /&gt;
** When an assignment is still ongoing, the reputations for each reviewer will be calculated and handled by OnTheFlyCalc&lt;br /&gt;
** This is similar to the current scenario&lt;br /&gt;
* LocalDBCalc: &lt;br /&gt;
** Calculates the holistic score over a single db query: &amp;quot;get the score that user A gives user B on assignment 999 on round 2&amp;quot;&lt;br /&gt;
** When an asignment has finished, all the reputations will be calculated by LocalDBCalc and stored, since they are finalized. So, when the scores are requested, they will be fetched using a single db query and displayed&lt;br /&gt;
** This will be a new addition to the code as currently there is no class. &lt;br /&gt;
&lt;br /&gt;
In this project, our goal is to make the OnTheFlyCalc and LocalDBCalc work only for peer-review scores.  As future projects will introduce other types of scores, the solution must be extensible.&lt;br /&gt;
&lt;br /&gt;
==Design Plan==&lt;br /&gt;
* A general ScoreCalc class will be created: this class will act like an interface used by bother onTheFlyCalc and LocalDBCalc to calculate and store scores. &lt;br /&gt;
* These classes (OnTheFlyCalc and LocalDBCalc classes) will be created which will be subclasses of ScoreCalc class. &lt;br /&gt;
* A new database table &amp;quot;local_db_scores&amp;quot; with following columns will be created to store the holistic scores:&lt;br /&gt;
** id: int&lt;br /&gt;
** type: string&lt;br /&gt;
** round: int&lt;br /&gt;
** score: int&lt;br /&gt;
** reference_id: int&lt;br /&gt;
* When an assignment finishes (that is when the deadline has passed), holistic scores will be calculated in LocalDBCalc and then inserted in the table &amp;quot;local_db_score&amp;quot; &lt;br /&gt;
** This will be done using scheduled tasks feature&lt;br /&gt;
** If the record to be inserted is a finalized peer-review score, the type stored in the database will be &amp;quot;ReviewLocalDBScore&amp;quot; and the reference_id will be the response_map id&lt;br /&gt;
** The peer-review scores will be calculated and stored for each of the review rounds because it is possible that user A only reviews user B in one out of several rounds.&lt;br /&gt;
* When a request is made to view the scores, depending on whether the assignment is ongoing or finished, either OnTheFlyCalc or LocalDBCalc will be called to calculate the score or query the score from the &amp;quot;local_db_scores&amp;quot; table&lt;br /&gt;
&lt;br /&gt;
[[File:Design.png|frame|center]]&lt;br /&gt;
&lt;br /&gt;
[[File:Mechanism.png|frame|center]]&lt;br /&gt;
&lt;br /&gt;
==Use Cases==&lt;br /&gt;
&lt;br /&gt;
The project can be broken down into two primary use cases.&lt;br /&gt;
&lt;br /&gt;
*  The user wants to view the scores before the assignment is finished.  Scores are calculated &amp;quot;on the fly&amp;quot; and presented to the user.&lt;br /&gt;
*  The user wants to view the scores after the assignment is finished.  Scores are calculated on assignment completion and stored in the database for quick retrieval.&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
The above two use cases can then be translated into three major scenarios we need to test.  The use case where the assignment is completed and scores are stored into the database is broken down into two scenarios to test the data input and data retrieval parts separately.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The following table contains the main scenarios we will cover when testing our project.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Scenario Number&lt;br /&gt;
! Description&lt;br /&gt;
! Expected Result for Pass&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| An assignment is finished and a score is calculated correctly and placed into the local_db_score table using the scheduled task feature.  First, set up an assignment with some score information.  Create a scheduled task to calculate the score and insert the score into the database upon assignment completion.&lt;br /&gt;
| Query the database and verify score is correct&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| Assignment is NOT finished and user wants to view scores.  First, set up an assignment with a deadline in the future.  Put in some score information.   The score should be calculated correctly on the fly using OnTheFlyCalc.&lt;br /&gt;
| After the assignment is created, this test will run on the UI.  The user will click the view scores link and the page should display the expected score.&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| Assignment is finished and the user wants to view scores.  This test will mainly just be a check if clicking view scores on the UI will result in the expected value showing up on the UI.  The interaction in getting the information in the database is already tested in Scenario 1.&lt;br /&gt;
| User clicks on view scores on a past assignment and sees the expected score on the UI&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The following diagrams show how the chosen scenarios above map to functionality.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:E1731-scenario-1.jpg|frame|center]]  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:E1731-scenario-2-3.jpg|frame|center]]&lt;/div&gt;</summary>
		<author><name>Psvaidya</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Mechanism.png&amp;diff=108314</id>
		<title>File:Mechanism.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Mechanism.png&amp;diff=108314"/>
		<updated>2017-04-12T18:53:19Z</updated>

		<summary type="html">&lt;p&gt;Psvaidya: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Psvaidya</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Design.png&amp;diff=108313</id>
		<title>File:Design.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Design.png&amp;diff=108313"/>
		<updated>2017-04-12T18:51:32Z</updated>

		<summary type="html">&lt;p&gt;Psvaidya: uploaded a new version of &amp;amp;quot;File:Design.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Psvaidya</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/E1731_Improve_Score_Calculation&amp;diff=107974</id>
		<title>CSC/ECE 517 Spring 2017/E1731 Improve Score Calculation</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/E1731_Improve_Score_Calculation&amp;diff=107974"/>
		<updated>2017-04-07T00:07:45Z</updated>

		<summary type="html">&lt;p&gt;Psvaidya: /* Problem Description */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;nowiki&amp;gt;  Expertiza is an opensource web based platform developed to assist students in educational institutions to perform peer reviews and group projects. The reviewing is done through a mechanism where students will be sent request to review work and the system will analyze and publish a summarized report. The software is designed in MVC (Model-View-Controller) architecture using Ruby on Rails.&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Problem Description==&lt;br /&gt;
===Current Scenario===&lt;br /&gt;
Today, Expertiza stores the scores based on each response to each criterion, but no holistic scores are stored. The &amp;quot;answers&amp;quot; table only contains the scores that user A has given user B on each criterion. This means that if we need to know what score A has given B based on 100, we have to rely on the code to calculate it every time the score is requested. This design slows down Expertiza as every time an instructor clicks on &amp;quot;View Scores&amp;quot;, all the calculations are done to display the score. The situation is even worse if we want to weight the scores by the reputation of each reviewer, which is a measure of how closely that reviewer's scores match other reviewers. In this case, the system potentially has to do thousands of arithmetic calculations to display the score for a particular assignment.&lt;br /&gt;
&lt;br /&gt;
===Proposed Solution===&lt;br /&gt;
We propose that we have two mechanisms to handle the holistic scores, depending on the current state of the assignment:&lt;br /&gt;
* OnTheFlyCalc: Calculates holistic scores over a set of data: A set of records in answers table, namely the responses from user A to user B on each criterion.&lt;br /&gt;
** When an assignment is still ongoing, the reputations for each reviewer will be calculated and handled by OnTheFlyCalc&lt;br /&gt;
** This is similar to the current scenario&lt;br /&gt;
* LocalDBCalc: Calculates the holistic score over a single db query: &amp;quot;get the score that user A gives user B on assignment 999 on round 2&amp;quot;&lt;br /&gt;
** When an asignment has finished, all the reputations will be calculated by LocalDBCalc and stored, since they are finalized. So, when the scores are requested, they will be fetched using a single db query and displayed&lt;br /&gt;
&lt;br /&gt;
In this project, our goal is to make the OnTheFlyCalc and LocalDBCalc work only for peer-review scores.  As future projects will introduce other types of scores, the solution must be extensible.&lt;br /&gt;
&lt;br /&gt;
==Design Plan==&lt;br /&gt;
* A general ScoreCalc class will be created&lt;br /&gt;
* OnTheFlyCalc and LocalDBCalc classes will be created which will be subclasses of ScoreCalc class&lt;br /&gt;
* A new database table &amp;quot;local_db_scores&amp;quot; with following columns will be created to store the holistic scores:&lt;br /&gt;
** id: int&lt;br /&gt;
** type: string&lt;br /&gt;
** round: int&lt;br /&gt;
** score: int&lt;br /&gt;
** reference_id: int&lt;br /&gt;
* When an assignment finishes (that is when the deadline has passed), holistic scores will be calculated in LocalDBCalc and then inserted in the table &amp;quot;local_db_score&amp;quot;&lt;br /&gt;
** This will be done using scheduled tasks feature&lt;br /&gt;
** If the record to be inserted is a finalized peer-review score, the type stored in the database will be &amp;quot;ReviewLocalDBScore&amp;quot; and the reference_id will be the response_map id&lt;br /&gt;
** The peer-review scores will be calculated and stored for each of the review rounds because it is possible that user A only reviews user B in one out of several rounds&lt;br /&gt;
* When a request is made to view the scores, depending on whether the assignment is ongoing or finished, either OnTheFlyCalc or LocalDBCalc will be called to calculate the score or query the score from the &amp;quot;local_db_scores&amp;quot; table&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Scenario Number&lt;br /&gt;
! Description&lt;br /&gt;
! Expected Result for Pass&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| An assignment is finished and a score is calculated correctly and placed into the local_db_score table using the scheduled task feature.  First, set up an assignment with some score information.  Create a scheduled task to calculate the score and insert the score into the database upon assignment completion.&lt;br /&gt;
| Query the database and verify score is correct&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| Assignment is NOT finished and user wants to view scores.  First, set up an assignment with a deadline in the future.  Put in some score information.   The score should be calculated correctly on the fly using OnTheFlyCalc.&lt;br /&gt;
| After the assignment is created, this test will run on the UI.  The user will click the view scores link and the page should display the expected score.&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| Assignment is finished and the user wants to view scores.  This test will mainly just be a check if clicking view scores on the UI will result in the expected value showing up on the UI.  The interaction in getting the information in the database is already tested in Scenario 1.&lt;br /&gt;
| User clicks on view scores on a past assignment and sees the expected score on the UI&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Psvaidya</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/E1731_Improve_Score_Calculation&amp;diff=107969</id>
		<title>CSC/ECE 517 Spring 2017/E1731 Improve Score Calculation</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/E1731_Improve_Score_Calculation&amp;diff=107969"/>
		<updated>2017-04-06T23:55:07Z</updated>

		<summary type="html">&lt;p&gt;Psvaidya: /* Design Plan */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;nowiki&amp;gt;  Expertiza is an opensource web based platform developed to assist students in educational institutions to perform peer reviews and group projects. The reviewing is done through a mechanism where students will be sent request to review work and the system will analyze and publish a summarized report. The software is designed in MVC (Model-View-Controller) architecture using Ruby on Rails.&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Problem Description==&lt;br /&gt;
===Current Scenario===&lt;br /&gt;
Today, Expertiza stores the scores based on each response to each criterion, but no holistic scores are stored. The answers table only contains the score that A gives B on each criterion. This means that if we need to know what score user A gives to user B based on 100, we have to rely on the code to calculate it every time the scores are requested. This design slows down Expertiza as every time instructor clicks on &amp;quot;View Scores&amp;quot;, all the calculations are done to display the score. The situation is even worse if we want to weight the scores by the reputation of each reviewer, which is a measure of how closely that reviewer's scores match other reviewers. The system potentially has to do thousands of arithmetic calculations to display the score for a particular assignment.&lt;br /&gt;
&lt;br /&gt;
===Proposed Solution===&lt;br /&gt;
We propose that we have two mechanism to handle holistic scores, depending on the current state of the assignment:&lt;br /&gt;
* OnTheFlyCalc: Calculates holistic scores over a set of data: A set of records in answers table, namely the responses from user A to user B on each criterion.&lt;br /&gt;
** When an assignment is still ongoing, the reputations for each reviewer will be calculated and handled by OnTheFlyCalc.&lt;br /&gt;
* LocalDBCalc: Calculates the holistic score over a single db query: &amp;quot;get the score that user A gives user B on assignment 999 on round 2&amp;quot;&lt;br /&gt;
** When an asignment has finished, all the reputations will be calculated by LocalDBCalc and stored, since they are finalized. So, when the scores are requested, it is fetched using a single db query and displayed.  &lt;br /&gt;
&lt;br /&gt;
In this project, our goal is to make the OnTheFlyCalc and LocalDBCalc work only for peer-review scores.  As future projects will introduce other types of scores, the solution must be extensible.&lt;br /&gt;
&lt;br /&gt;
==Design Plan==&lt;br /&gt;
* A general ScoreCalc class will be created&lt;br /&gt;
* OnTheFlyCalc and LocalDBCalc classes will be created which will be subclasses of ScoreCalc class&lt;br /&gt;
* A new database table &amp;quot;local_db_scores&amp;quot; with following columns will be created to store the holistic scores:&lt;br /&gt;
** id: int&lt;br /&gt;
** type: string&lt;br /&gt;
** round: int&lt;br /&gt;
** score: int&lt;br /&gt;
** reference_id: int&lt;br /&gt;
* When an assignment finishes (that is when the deadline has passed), holistic scores will be calculated in LocalDBCalc and then inserted in the table &amp;quot;local_db_score&amp;quot;&lt;br /&gt;
** This will be done using scheduled tasks feature&lt;br /&gt;
** If the record to be inserted is a finalized peer-review score, the type stored in the database will be &amp;quot;ReviewLocalDBScore&amp;quot; and the reference_id will be the response_map id&lt;br /&gt;
** The peer-review scores will be calculated and stored for each of the review rounds because it is possible that user A only reviews user B in one out of several rounds&lt;br /&gt;
* When a request is made to view the scores, depending on whether the assignment is ongoing or finished, either OnTheFlyCalc or LocalDBCalc will be called to calculate the score or query the score from the &amp;quot;local_db_scores&amp;quot; table&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Scenario Number&lt;br /&gt;
! Description&lt;br /&gt;
! Expected Result for Pass&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| An assignment is finished and a score is calculated correctly and placed into the local_db_score table using the scheduled task feature.  First, set up an assignment with some score information.  Create a scheduled task to calculate the score and insert the score into the database upon assignment completion.&lt;br /&gt;
| Query the database and verify score is correct&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| Assignment is NOT finished and user wants to view scores.  First, set up an assignment with a deadline in the future.  Put in some score information.   The score should be calculated correctly on the fly using OnTheFlyCalc.&lt;br /&gt;
| After the assignment is created, this test will run on the UI.  The user will click the view scores link and the page should display the expected score.&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| Assignment is finished and the user wants to view scores.  This test will mainly just be a check if clicking view scores on the UI will result in the expected value showing up on the UI.  The interaction in getting the information in the database is already tested in Scenario 1.&lt;br /&gt;
| User clicks on view scores on a past assignment and sees the expected score on the UI&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Psvaidya</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/E1731_Improve_Score_Calculation&amp;diff=107962</id>
		<title>CSC/ECE 517 Spring 2017/E1731 Improve Score Calculation</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/E1731_Improve_Score_Calculation&amp;diff=107962"/>
		<updated>2017-04-06T23:25:36Z</updated>

		<summary type="html">&lt;p&gt;Psvaidya: /* Design Plan */  basic design plan added&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;nowiki&amp;gt;  Expertiza is an opensource web based platform developed to assist students in educational institutions to perform peer reviews and group projects. The reviewing is done through a mechanism where students will be sent request to review work and the system will analyze and publish a summarized report. The software is designed in MVC (Model-View-Controller) architecture using Ruby on Rails.&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Problem Description==&lt;br /&gt;
===Current Scenario===&lt;br /&gt;
Today, Expertiza stores the scores based on each response to each criterion, but no holistic scores are stored. The answers table only contains the score that A gives B on each criterion. This means that if we need to know what score user A gives to user B based on 100, we have to rely on the code to calculate it every time the scores are requested. This design slows down Expertiza as every time instructor clicks on &amp;quot;View Scores&amp;quot;, all the calculations are done to display the score. The situation is even worse if we want to weight the scores by the reputation of each reviewer, which is a measure of how closely that reviewer's scores match other reviewers. The system potentially has to do thousands of arithmetic calculations to display the score for a particular assignment.&lt;br /&gt;
&lt;br /&gt;
===Proposed Solution===&lt;br /&gt;
We propose that we have two mechanism to handle holistic scores, depending on the current state of the assignment:&lt;br /&gt;
* OnTheFlyCalc: Calculates holistic scores over a set of data: A set of records in answers table, namely the responses from user A to user B on each criterion.&lt;br /&gt;
** When an assignment is still ongoing, the reputations for each reviewer will be calculated and handled by OnTheFlyCalc.&lt;br /&gt;
* LocalDBCalc: Calculates the holistic score over a single db query: &amp;quot;get the score that user A gives user B on assignment 999 on round 2&amp;quot;&lt;br /&gt;
** When an asignment has finished, all the reputations will be calculated by LocalDBCalc and stored, since they are finalized. So, when the scores are requested, it is fetched using a single db query and displayed.  &lt;br /&gt;
&lt;br /&gt;
In this project, our goal is to make the OnTheFlyCalc and LocalDBCalc work only for peer-review scores.  As future projects will introduce other types of scores, the solution must be extensible.&lt;br /&gt;
&lt;br /&gt;
==Design Plan==&lt;br /&gt;
* A general ScoreCalc class will be created&lt;br /&gt;
* OnTheFlyCalc and LocalDBCalc classes will be created which will be subclasses of ScoreCalc class&lt;br /&gt;
* A new database table &amp;quot;local_db_scores&amp;quot; with following columns will be created to store the holistic scores:&lt;br /&gt;
** id: int&lt;br /&gt;
** type: string&lt;br /&gt;
** round: int&lt;br /&gt;
** score: int&lt;br /&gt;
** reference_id: int&lt;br /&gt;
* When an assignment finishes (that is when the deadline has passed), holistic scores will be calculated in LocalDBCalc and then inserted in this new db table &amp;quot;local_db_score&amp;quot;&lt;br /&gt;
** This will be done using scheduled tasks feature&lt;br /&gt;
** If the record is a finalized peer-review score, the type stored in the database will be &amp;quot;ReviewLocalDBScore&amp;quot; and the reference_id will be the response_map id&lt;br /&gt;
** The peer-review scores will be calculated for all the review rounds because it is possible that user A only review user B in one out of several rounds&lt;br /&gt;
* When a request is made to view scores, depending on whether the assignment is ongoing or finished, either OnTheFlyCalc or LocalDBCalc will be called to calculate the score or query the score from the &amp;quot;local_db_scores&amp;quot; table&lt;/div&gt;</summary>
		<author><name>Psvaidya</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/E1731_Improve_Score_Calculation&amp;diff=107957</id>
		<title>CSC/ECE 517 Spring 2017/E1731 Improve Score Calculation</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/E1731_Improve_Score_Calculation&amp;diff=107957"/>
		<updated>2017-04-06T22:50:44Z</updated>

		<summary type="html">&lt;p&gt;Psvaidya: /* Problem Description */ Current Scenario and Proposed Solution added&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;nowiki&amp;gt;  Expertiza is an opensource web based platform developed to assist students in educational institutions to perform peer reviews and group projects. The reviewing is done through a mechanism where students will be sent request to review work and the system will analyze and publish a summarized report. The software is designed in MVC (Model-View-Controller) architecture using ruby on rails.&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Problem Description==&lt;br /&gt;
===Current Scenario===&lt;br /&gt;
Expertiza store the scores based on each response to each criterion, but no holistic scores are stored. The answers table only contains the score that A gives B on each criterion. This means that if we need to know what score user A gives to user B based on 100, we have to rely on the code to calculate it every time the scores are requested. This design slows down Expertiza as every time instructor clicks on &amp;quot;View Scores&amp;quot;, all the calculations are done to display the score. The situation is even worse if we want to weight the scores by the reputation of each reviewer, which is a measure of how closely that reviewer's scores match other reviewers. The system potentially has to do thousands of arithmetic calculations to display the score for a particular assignment.&lt;br /&gt;
&lt;br /&gt;
===Proposed Solution===&lt;br /&gt;
We propose that we have two mechanism to handle holistic scores, depending on the current state of the assignment:&lt;br /&gt;
* OnTheFlyCalc: Calculates holistic scores over a set of data: A set of records in answers table, namely the responses from user A to user B on each criterion.&lt;br /&gt;
** When an assignment is still ongoing, the reputations for each reviewer will be calculated and handled by OnTheFlyCalc.&lt;br /&gt;
* LocalDBCalc: Calculates the holistic score over a single db query: &amp;quot;get the score that user A gives user B on assignment 999 on round 2&amp;quot;&lt;br /&gt;
** When an asignment has finished, all the reputations will be calculated by LocalDBCalc and stored, since they are finalized. So, when the scores are requested, it is fetched using a single db query and displayed.  &lt;br /&gt;
&lt;br /&gt;
In this project, our goal is to make the OnTheFlyCalc and LocalDBCalc work for peer-review scores only, by making sure the code is extensible for further work.&lt;br /&gt;
&lt;br /&gt;
==Design Plan==&lt;/div&gt;</summary>
		<author><name>Psvaidya</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/E1731_Improve_Score_Calculation&amp;diff=107956</id>
		<title>CSC/ECE 517 Spring 2017/E1731 Improve Score Calculation</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/E1731_Improve_Score_Calculation&amp;diff=107956"/>
		<updated>2017-04-06T22:24:26Z</updated>

		<summary type="html">&lt;p&gt;Psvaidya: Created the page with expertiza introduction&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;nowiki&amp;gt;  Expertiza is an opensource web based platform developed to assist students in educational institutions to perform peer reviews and group projects. The reviewing is done through a mechanism where students will be sent request to review work and the system will analyze and publish a summarized report. The software is designed in MVC (Model-View-Controller) architecture using ruby on rails.&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Problem Description==&lt;br /&gt;
&lt;br /&gt;
==Design Plan==&lt;/div&gt;</summary>
		<author><name>Psvaidya</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/Use_Ajax_to_add_Participants,TA_and_Edit_Questionnaire&amp;diff=107896</id>
		<title>CSC/ECE 517 Spring 2017/Use Ajax to add Participants,TA and Edit Questionnaire</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/Use_Ajax_to_add_Participants,TA_and_Edit_Questionnaire&amp;diff=107896"/>
		<updated>2017-04-03T21:17:09Z</updated>

		<summary type="html">&lt;p&gt;Psvaidya: /* UI Testing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;nowiki&amp;gt;  Expertiza is an opensource software developed to assist people in education institutions to perform peer reviews and group projects. It is exceptionally helpful to the students and instructors. The software is designed in MVC (Model-View-Controller) architecture using ruby on rails.&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
Expertiza provides many categories to manage for an instructor. Few of these categories are assignments, courses and questionnaires. Currently, to add/remove/update records, the entire page is submitted to save the record and the entire page is re-loaded back again to reflect the changes on the page. The task is to improve this functionality such that some of the records, specifically adding participants to courses or assignments, adding/removing teaching assistants to/from courses and adding questions to questionnaires, can be saved remotely and the page updated without submitting and reloading the entire page. &lt;br /&gt;
Additionally, on assign reviewers page for an assignment, there is no way to see the current status of reviews and there is no way for an instructor to unsubmit a submitted review. So, another task is to add this functionality such that review status is seen for each review and to unsubmit a submitted review without reloading the page.&lt;br /&gt;
&lt;br /&gt;
==Proposed Solution==&lt;br /&gt;
This project proposes use of AJAX for the required pages to avoid page reloading at the time of adding and saving records. This solution will make sure that adding or saving of record is done remotely and the page is updated without reloading. It can be achieved by calling corresponding controller method, adding/saving the record remotely and rendering it back to JavaScript pages in the view instead of redirecting it to the same page. JavaScript pages in the view will update the page without reloading it, for example by appending the newly added record to the list of records. Thus, records are saved remotely and page refresh is avoided.&lt;br /&gt;
For the review status part, responses to the corresponding reviews on the page can be checked in the Response table and the review status shown as the status of the latest response. Unsubmitting a review can be done using AJAX without reloading the page.&lt;br /&gt;
&lt;br /&gt;
==Tasks==&lt;br /&gt;
* Add Participant in the assignments section using AJAX &lt;br /&gt;
* Add/Remove TA in the courses section using AJAX&lt;br /&gt;
* Edit Questionnaire by using AJAX for adding questions in the Questionnaire section&lt;br /&gt;
* Show Review Status on assign reviewers page and allow to un-submit a review using AJAX&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
===Adding participant===&lt;br /&gt;
'''Earlier scenario:''' When an instructor goes to &amp;quot;Manage Assignments -&amp;gt; Add Participants&amp;quot; page, he/she can add/remove new Participant to the assignment. The add page also displays list of participants above the form for new participant. Every time a new Participant is added, the page reloads to reflect the changes and render the updated list of participants, even in case of non-existing userid.&lt;br /&gt;
&lt;br /&gt;
'''Updates/Changes:'''&lt;br /&gt;
This page has been updated such that an instructor can add a new Participant using [https://en.wikipedia.org/wiki/Ajax_(programming) AJAX]. After adding AJAX changes, the list gets updated without reloading the entire page. The changes made are below.&lt;br /&gt;
&lt;br /&gt;
* Updated the ''shared_scripts/_user_list.html.erb'' file in views so that the Participants are listed by rendering another partial ''_participant.html.erb'' in participants controller. This change is to make it feasible to add AJAX to just append to the list without any extra formatting.&lt;br /&gt;
[[File:User_list.PNG]]&lt;br /&gt;
&lt;br /&gt;
* Created a new file ''participants/add.js.erb'' for adding AJAX to render newly added participant in case of successful addition and display error in case of any error.&lt;br /&gt;
[[File:Javascript changes.PNG]]&lt;br /&gt;
&lt;br /&gt;
* Updated the ''shared_scripts/_add_individual.html.erb'' form such that request should be through AJAX by setting remote flag to true.&lt;br /&gt;
[[File:Add_individual.PNG]]&lt;br /&gt;
&lt;br /&gt;
* Updated the participants controller ''participant_controller.rb'' in controllers to render JavaScript when add method is invoked by the form submit action instead of redirect to list page.&lt;br /&gt;
[[File:Controller_changes.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Adding/Removing TA===&lt;br /&gt;
'''Earlier scenario:''' When an instructor goes to &amp;quot;Manage Courses -&amp;gt; Add TA&amp;quot; page, he/she can add/remove new TA to the course. Every time a new TA is added or removed, the page reloads to reflect the changes, even if the userid used does not exist.&lt;br /&gt;
&lt;br /&gt;
'''Updates/Changes:''' This page has been updated such that an instructor can add a new TA or remove a new TA using AJAX. With these updates, the changes are reflected on the page without reloading the page, thus saving time.&lt;br /&gt;
* Updated the ''course/view_teaching_assistants.html.erb'' file in views so that the TAs are listed by rendering another partial ''_ta.html.erb''. This is done so that when a new TA has been added, AJAX call can be used to render the format required for the new TA in the list append to the already existing list without reloading the page.&lt;br /&gt;
[[File:View_teaching_assistants_html_erb.png]]&lt;br /&gt;
&lt;br /&gt;
* Created a new file ''course/_ta.html.erb'' in views which is a partial as described above and contains the code to list the TAs. The link_to &amp;quot;Delete&amp;quot; line in this file is updated to use :remote=&amp;gt;:true, so that AJAX call can be made to remove the TA remotely without reloading the page.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;%= link_to &amp;quot;Delete&amp;quot;, { :action =&amp;gt; 'remove_ta', :controller =&amp;gt;'course', :id =&amp;gt; ta.id, :course_id =&amp;gt; ta.course_id }, method: :post, :remote =&amp;gt; true, :class =&amp;gt; 'remove_ta' %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[File:Ta.png]]&lt;br /&gt;
&lt;br /&gt;
* Updated the ''course/_add_individual.html.erb'' file in views to perform the form_tag action to Add a TA remotely using :remote=&amp;gt;:true. In the below code, ''form_action'' and ''remote'' are local variables passed to this partial from ''course/view_teaching_assistants.html.erb'' with the values &amp;quot;add_ta&amp;quot; and &amp;quot;true&amp;quot; respectively &lt;br /&gt;
[[File:Add_individual_html_erb.png]]&lt;br /&gt;
&lt;br /&gt;
* Updated the ''course_controller.rb&amp;quot; file and replaced the redirect option in ''add_ta'' and ''remove_ta'' to render ''add_ta.js.erb'' and ''remove_ta.js.erb''. Also changed ''flash[:error]'' to ''flash.now[:error]'' so that the flash message is displayed now instead of after page reload.&lt;br /&gt;
[[File:Course_controller_rb1.png]]&lt;br /&gt;
&lt;br /&gt;
* Added a new file ''course/add.js.erb'' and ''course/remove_ta.js.erb'' to views. The ''add_ta.js.erb'' file renders the newly added TA and appends it to the list of TAs. It also shows flash error message if the userid used to add TA does not exist. Similarly, ''remote_ta.js.erb'' file removes the deleted TA from the list.&lt;br /&gt;
[[File:add_remove_js_erb.png]]&lt;br /&gt;
&lt;br /&gt;
===Edit Questionnaire===&lt;br /&gt;
&lt;br /&gt;
'''Current scenario :''' page consists of different subsections for creating questionnaire,adding questions to the questionnaire and saving the questionnaire i.e.&lt;br /&gt;
*_questionnaire.html.erb&lt;br /&gt;
&lt;br /&gt;
Adding questions feature is performed in the following method of ''questionnaires_controller.rb'' class&lt;br /&gt;
&lt;br /&gt;
def add_new_questions&lt;br /&gt;
    questionnaire_id = params[:id] unless params[:id].nil?&lt;br /&gt;
    num_of_existed_questions = Questionnaire.find(questionnaire_id).questions.size&lt;br /&gt;
    ((num_of_existed_questions + 1)..(num_of_existed_questions + params[:question][:total_num].to_i)).each do |i|&lt;br /&gt;
      question = Object.const_get(params[:question][:type]).create(txt: '', questionnaire_id: questionnaire_id, seq: i, type: params[:question][:type], break_before: true)&lt;br /&gt;
      if question.is_a? ScoredQuestion&lt;br /&gt;
        question.weight = 1&lt;br /&gt;
        question.max_label = 'Strongly agree'&lt;br /&gt;
        question.min_label = 'Strongly disagree'&lt;br /&gt;
      end&lt;br /&gt;
      question.size = '50, 3' if question.is_a? Criterion&lt;br /&gt;
      question.alternatives = '0|1|2|3|4|5' if question.is_a? Dropdown&lt;br /&gt;
      question.size = '60, 5' if question.is_a? TextArea&lt;br /&gt;
      question.size = '30' if question.is_a? TextField&lt;br /&gt;
      begin&lt;br /&gt;
        question.save&lt;br /&gt;
      rescue&lt;br /&gt;
        flash[:error] = $ERROR_INFO&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to edit_questionnaire_path(questionnaire_id.to_sym)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This method invokes ''question.create'' method in ''questions_cotroller.rb'' and saves the created question to the database. Then it redirects to the ''edit.html.erb'' page which causes page refresh while adding questions.&lt;br /&gt;
&lt;br /&gt;
'''Solution:''' This problem was tried to solve using AJAX by changing or adding the following classes and pages &lt;br /&gt;
* _question.html.erb (added) - displays added question&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;td align=&amp;quot;center&amp;quot;&amp;gt;&amp;lt;a rel=&amp;quot;nofollow&amp;quot; data-method=&amp;quot;delete&amp;quot; href=&amp;quot;/questions/' &amp;lt;%= @question.id%&amp;gt; '&amp;quot;&amp;gt;Remove&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
        &amp;lt;td&amp;gt;&amp;lt;input size=&amp;quot;6&amp;quot; value=&amp;quot;' &amp;lt;%= @question.seq%&amp;gt; '&amp;quot; name=&amp;quot;question[' question.id %&amp;gt;'][seq]&amp;quot; id=&amp;quot;question_' +&amp;lt;%=@question.id %&amp;gt; '_seq&amp;quot; type=&amp;quot;text&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
        &amp;lt;td&amp;gt;&amp;lt;textarea cols=&amp;quot;50&amp;quot; rows=&amp;quot;1&amp;quot; name=&amp;quot;question[' &amp;lt;%= @question.id%&amp;gt; '][txt]&amp;quot; id=&amp;quot;question_' &amp;lt;%= @question.id%&amp;gt; '_txt&amp;quot; placeholder=&amp;quot;Edit question content here&amp;quot;&amp;gt;' &amp;lt;%= @question.txt%&amp;gt; '&amp;lt;/textarea&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
        &amp;lt;td&amp;gt;&amp;lt;input size=&amp;quot;10&amp;quot; disabled=&amp;quot;disabled&amp;quot; value=&amp;quot;'  &amp;lt;%= @question.type%&amp;gt;  '&amp;quot; name=&amp;quot;question[' &amp;lt;%= @question.id%&amp;gt;'][type]&amp;quot; id=&amp;quot;question_' &amp;lt;%= @question.id%&amp;gt; '_type&amp;quot; type=&amp;quot;text&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
        &amp;lt;td&amp;gt;&amp;lt;!--placeholder (QuestionnaireHeader does not need weight)--&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* add_new_questions.js.erb (added) - appends the html content with added question in ''_question.html.erb'' to  questions_table in ''_questionnaire.html.erb''&lt;br /&gt;
&lt;br /&gt;
   $(&amp;quot;#questions_table&amp;quot;).append(&amp;quot;&amp;lt;%= j render :partial =&amp;gt; 'question',&lt;br /&gt;
           :locals =&amp;gt; {question: @question, :id =&amp;gt; @question.id, :controller =&amp;gt; 'questions'} %&amp;gt;&amp;quot;);&lt;br /&gt;
  &lt;br /&gt;
* edit.html.erb (modified : code removed) - following code is removed as it internally calls respective question header models and appends html string to questions_table internally.&lt;br /&gt;
      &lt;br /&gt;
      &amp;lt;% for @question in @questionnaire.questions do%&amp;gt;&lt;br /&gt;
        &amp;lt;%-# The following line call certain method of the object, which returns html string-%&amp;gt;&lt;br /&gt;
        &amp;lt;%= @question.edit %&amp;gt;&lt;br /&gt;
      &amp;lt;% end %&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
@question.edit invokes ''QuestionHeader.rb'' model which adds html content&lt;br /&gt;
     def edit(_count)&lt;br /&gt;
    html = '&amp;lt;tr&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td align=&amp;quot;center&amp;quot;&amp;gt;&amp;lt;a rel=&amp;quot;nofollow&amp;quot; data-method=&amp;quot;delete&amp;quot; href=&amp;quot;/questions/' + self.id.to_s + '&amp;quot;&amp;gt;Remove&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td&amp;gt;&amp;lt;input size=&amp;quot;6&amp;quot; value=&amp;quot;' + self.seq.to_s + '&amp;quot; name=&amp;quot;question[' + self.id.to_s + '][seq]&amp;quot; id=&amp;quot;question_' + self.id.to_s + '_seq&amp;quot; type=&amp;quot;text&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td&amp;gt;&amp;lt;textarea cols=&amp;quot;50&amp;quot; rows=&amp;quot;1&amp;quot; name=&amp;quot;question[' + self.id.to_s + '][txt]&amp;quot; id=&amp;quot;question_' + self.id.to_s + '_txt&amp;quot; placeholder=&amp;quot;Edit question content here&amp;quot;&amp;gt;' + self.txt + '&amp;lt;/textarea&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td&amp;gt;&amp;lt;input size=&amp;quot;10&amp;quot; disabled=&amp;quot;disabled&amp;quot; value=&amp;quot;' + self.type + '&amp;quot; name=&amp;quot;question[' + self.id.to_s + '][type]&amp;quot; id=&amp;quot;question_' + self.id.to_s + '_type&amp;quot; type=&amp;quot;text&amp;quot;&amp;gt;''&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td&amp;gt;&amp;lt;!--placeholder (QuestionnaireHeader does not need weight)--&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;/tr&amp;gt;'&lt;br /&gt;
    html.html_safe&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
* questionnaires_controller.rb (modified) - add_new_questions method is modified by replacing redire rendering ''add_new_questions.js.erb'' file&lt;br /&gt;
&lt;br /&gt;
  render :action=&amp;gt; 'add_new_questions.js.erb', :layout=&amp;gt;false, :question=&amp;gt; question&lt;br /&gt;
   #redirect_to edit_questionnaire_path(questionnaire_id.to_sym)&lt;br /&gt;
&lt;br /&gt;
'''Issue :''' But this solution is not working as AJAX can be applied to the browser side processing if the controller method is redirecting to the same page, which is not in this case as page gets redirected from question.html.erb to edit.html.erb. Another problem faced is the creation of questions which is called through ''_questionnaire.html.erb'' but not through ''_question.html.erb'' which makes it difficult to pass correct questionnaire id to the AJAX call.&lt;br /&gt;
&lt;br /&gt;
'''Alternative Approach to Edit Questionnaire:''' Another approach to solve this issue is to create a seperate java-script function which handles the entire process of adding,saving,deleting questions and appending them. Call this function from ''_questionnaire.html.erb'' instead of invoking add_new_questions method. Questions can be saved and retrived from data using JavaScript Rest API calls. But, this approach not only needs to restructure entire questionnaire structure and many components in the Expertiza project but also violates the MVC design of the project.&lt;br /&gt;
&lt;br /&gt;
===Un-submit reviews===&lt;br /&gt;
'''Earlier scenario:''' When an instructor/TA goes to &amp;quot;Manage Assignments -&amp;gt; Assign Reviewers&amp;quot; page, he/she can see a list of all the topics, the contributors and the reviewers for each topic. This page did not show the status of each review which can be in Assigned state or Saved state or Submitted state. Also, there was no way for the instructor/TA to un-submit an already submitted review.&lt;br /&gt;
&lt;br /&gt;
'''New Additions:'''&lt;br /&gt;
* Updated the ''review_mappings/_list_review_mappings.html.erb'' file in views to display the status of each review by the reviewer. For each review_mapping, the code checks if there is a response in ''Response'' table with the same ''map_id'' used in the review_mappings on this page. &lt;br /&gt;
** If there is no such response, it means that the reviewer has not saved/submitted the review and it is currently in Assigned State. So, &amp;quot;Response Status: Saved&amp;quot; is shown for that review.&lt;br /&gt;
** If there is a response, the last (latest) response is checked as per requirement and the ''is_submitted'' attribute of this response is checked in the ''Response'' table.&lt;br /&gt;
*** If the attribute is false, the review has been saved but not submitted. So, &amp;quot;Response Status: Saved&amp;quot; is shown for that review.&lt;br /&gt;
*** If the attribute is true, the review has been submitted. So, &amp;quot;Response Status: Submitted&amp;quot; is shown for that review. Next to this, a link is created to un-submit the review. Clicking on this link changes the ''is_submitted'' attribute to false and updates the Response Status to Saved on the page by using AJAX call, without reloading the page&lt;br /&gt;
[[File:List_review_mappings_html_erb.png]]&lt;br /&gt;
* Added a new method &amp;quot;unsubmit_review&amp;quot; to the ''review_mapping_controller.rb'' file. In this, we first find the latest response and then update the ''is_submitted'' attribute to false. The flash message is created based on whether the response was updated correctly. After this, ''unsubmit_review.js.rb'' file is rendered which updates the response status for the corresponding review on the page to Saved, without reloading the page&lt;br /&gt;
[[File:Review_mapping_controller_rb.png]]&lt;br /&gt;
* Added a new file ''review_mappings/unsubmit_review.js.erb'' to views. This file just changes the response status for the corresponding review displayed on the page to Saved from Submit after the review has been un-submitted and also prints the corresponding success or error flash message.&lt;br /&gt;
[[File:Unsubmit_review_js_erb.png]]&lt;br /&gt;
* Added a new line to ''routes.rb'' page for unsubmit_review action&lt;br /&gt;
[[File:Routes_rb.png]]&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
===Log in details===&lt;br /&gt;
&lt;br /&gt;
'''Username:''' instructor6&lt;br /&gt;
'''password:''' password&lt;br /&gt;
&lt;br /&gt;
Some valid user id's are student5000, student5001, student5002 etc. These can be used while adding new Participant or TA as described below.&lt;br /&gt;
&lt;br /&gt;
===Automated Testing===&lt;br /&gt;
* Created a helper module ''wait_for_ajax.rb'' with methods to wait for ajax requests to finish&lt;br /&gt;
[[File:Wait_ajax.png]]&lt;br /&gt;
* Updated the test &amp;quot;check to see if participants can be added&amp;quot; in ''assignment_creation_spec.rb'' to wait for AJAX calls to finish after adding a participant by using the helper module created&lt;br /&gt;
[[File:Assignment_create.png]]&lt;br /&gt;
* Added a new file ''course_creation_spec.rb'' to test adding and remove TA's&lt;br /&gt;
** This contains test named &amp;quot;should display newly created course&amp;quot; to check if the new course is successfully created (There was no such test earlier)&lt;br /&gt;
** This also contains a test named &amp;quot;check to see if TA can be added and removed&amp;quot; which checks if a new TA has gotten added after clicking on Add TA and and later removed after clicking on Delete&lt;br /&gt;
[[File:Add_ta.png]]&lt;br /&gt;
* Added a new test named &amp;quot;can unsubmit a review&amp;quot; in ''review_mapping_spec.rb''&lt;br /&gt;
** In this test, a new reviewer is added to review mapping, a new review is created and submitted, and then checked if unsubmit functionality is working correctly&lt;br /&gt;
[[File:Unsubmit_review.png]]&lt;br /&gt;
&lt;br /&gt;
===UI Testing===&lt;br /&gt;
&lt;br /&gt;
'''Steps to test adding participant: '''&lt;br /&gt;
&lt;br /&gt;
* Login as instructor&lt;br /&gt;
* Go to Manage -&amp;gt; Assignments.&lt;br /&gt;
* Switch to Assignments tab incase you are on some other tab&lt;br /&gt;
* For any assignment, click on the 'Add Participant' icon to go on add new participant page&lt;br /&gt;
* Enter userid of the participant and click on Add to add the participant&lt;br /&gt;
&lt;br /&gt;
'' Expected Output: '' When add button is clicked with valid userid, new participant should be added to the list without the page getting reloaded. In case of an attempt to add invalid user, the error should be displayed on top without page getting reloaded.&lt;br /&gt;
&lt;br /&gt;
''' Steps to test adding/removing TA:'''&lt;br /&gt;
&lt;br /&gt;
* Login as instructor&lt;br /&gt;
* Go to Manage -&amp;gt; Courses.&lt;br /&gt;
* Switch to Courses tab incase you are on some other tab&lt;br /&gt;
* For any course, click on the 'Add TA' icon to go on add new TA page&lt;br /&gt;
* Enter userid of the TA and click on Add to add the TA&lt;br /&gt;
* Click on 'remove_ta' link for any TA in the list to remove the TA&lt;br /&gt;
&lt;br /&gt;
'' Expected Output: '' When add button is clicked with valid userid, new TA should be added to the list without the page getting reloaded. In case of an attempt to add invalid user, the error should be displayed on top without page getting reloaded. When remove_ta link is clicked for any TA in the list, that corresponding TA should be removed from the list without the page getting reloaded.&lt;br /&gt;
&lt;br /&gt;
''' Steps to test adding question in questionnaire:'''&lt;br /&gt;
&lt;br /&gt;
* Login as instructor&lt;br /&gt;
* Go to Manage -&amp;gt; Questionnaires. Create a new Review Questionnaire by  clicking on the ‘New public item’ button for ‘Review’.&lt;br /&gt;
* Name the Questionnaire and click on create button&lt;br /&gt;
* Click on Edit for newly created questionnaire.  You will now be navigated to page where you can add new questions to the questionnaire. &lt;br /&gt;
* Click on add button in &amp;quot;Questions&amp;quot; section.&lt;br /&gt;
&lt;br /&gt;
''Expected output:'' When add button is clicked, question should be created and the questionnaire page should not get reloaded&lt;br /&gt;
&lt;br /&gt;
''' Steps to test un-submit reviews'''&lt;br /&gt;
&lt;br /&gt;
* Login as instructor&lt;br /&gt;
* Go to Manage -&amp;gt; Assignments.&lt;br /&gt;
* Switch to Assignments tab incase you are on some other tab&lt;br /&gt;
* For any assignment, click on the 'Assign reviewers' icon to go to the review mappings page&lt;br /&gt;
** Note: Some assignments might not have reviewers. So, try this for assignments with many reviewers&lt;br /&gt;
* For any review with Review Status = Submitted, click on 'unsubmit' button&lt;br /&gt;
&lt;br /&gt;
''Expected output:'' For every review, the review status should be seen as either Assigned or Saved or Submitted. For submitted reviews, when unsubmit button is clicked, that review should be unsubmitted and status should change to Saved without page getting reloaded.&lt;br /&gt;
&lt;br /&gt;
==Project Deployment==&lt;br /&gt;
&lt;br /&gt;
Expertiza setup is done in VCL which is reserved for 30 days with Ubuntu 14.04 base. Started expertiza server publicly and link to access the server is:&lt;br /&gt;
http://152.7.99.101:3000&lt;br /&gt;
&lt;br /&gt;
==Future work==&lt;br /&gt;
&lt;br /&gt;
In future, we will try to implement the edit questionnaire part using alternative approach. We will try to implement testing using rspec framework and improve the UI design of the pages.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
* https://www.youtube.com/channel/UCdKXzox7hrWjfOMML6FzTWg&lt;br /&gt;
* https://github.com/expertiza/expertiza&lt;br /&gt;
* http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation&lt;br /&gt;
* http://guides.rubyonrails.org/working_with_javascript_in_rails.html&lt;br /&gt;
* http://wiki.expertiza.ncsu.edu/index.php/Development:Setup:Linux:Debian&lt;/div&gt;</summary>
		<author><name>Psvaidya</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Add_ta.png&amp;diff=107878</id>
		<title>File:Add ta.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Add_ta.png&amp;diff=107878"/>
		<updated>2017-04-01T06:45:49Z</updated>

		<summary type="html">&lt;p&gt;Psvaidya: uploaded a new version of &amp;amp;quot;File:Add ta.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Psvaidya</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/Use_Ajax_to_add_Participants,TA_and_Edit_Questionnaire&amp;diff=107877</id>
		<title>CSC/ECE 517 Spring 2017/Use Ajax to add Participants,TA and Edit Questionnaire</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/Use_Ajax_to_add_Participants,TA_and_Edit_Questionnaire&amp;diff=107877"/>
		<updated>2017-04-01T06:42:08Z</updated>

		<summary type="html">&lt;p&gt;Psvaidya: /* Automated Testing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;nowiki&amp;gt;  Expertiza is an opensource software developed to assist people in education institutions to perform peer reviews and group projects. It is exceptionally helpful to the students and instructors. The software is designed in MVC (Model-View-Controller) architecture using ruby on rails.&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
Expertiza provides many categories to manage for an instructor. Few of these categories are assignments, courses and questionnaires. Currently, to add/remove/update records, the entire page is submitted to save the record and the entire page is re-loaded back again to reflect the changes on the page. The task is to improve this functionality such that some of the records, specifically adding participants to courses or assignments, adding/removing teaching assistants to/from courses and adding questions to questionnaires, can be saved remotely and the page updated without submitting and reloading the entire page. &lt;br /&gt;
Additionally, on assign reviewers page for an assignment, there is no way to see the current status of reviews and there is no way for an instructor to unsubmit a submitted review. So, another task is to add this functionality such that review status is seen for each review and to unsubmit a submitted review without reloading the page.&lt;br /&gt;
&lt;br /&gt;
==Proposed Solution==&lt;br /&gt;
This project proposes use of AJAX for the required pages to avoid page reloading at the time of adding and saving records. This solution will make sure that adding or saving of record is done remotely and the page is updated without reloading. It can be achieved by calling corresponding controller method, adding/saving the record remotely and rendering it back to JavaScript pages in the view instead of redirecting it to the same page. JavaScript pages in the view will update the page without reloading it, for example by appending the newly added record to the list of records. Thus, records are saved remotely and page refresh is avoided.&lt;br /&gt;
For the review status part, responses to the corresponding reviews on the page can be checked in the Response table and the review status shown as the status of the latest response. Unsubmitting a review can be done using AJAX without reloading the page.&lt;br /&gt;
&lt;br /&gt;
==Tasks==&lt;br /&gt;
* Add Participant in the assignments section using AJAX &lt;br /&gt;
* Add/Remove TA in the courses section using AJAX&lt;br /&gt;
* Edit Questionnaire by using AJAX for adding questions in the Questionnaire section&lt;br /&gt;
* Show Review Status on assign reviewers page and allow to un-submit a review using AJAX&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
===Adding participant===&lt;br /&gt;
'''Earlier scenario:''' When an instructor goes to &amp;quot;Manage Assignments -&amp;gt; Add Participants&amp;quot; page, he/she can add/remove new Participant to the assignment. The add page also displays list of participants above the form for new participant. Every time a new Participant is added, the page reloads to reflect the changes and render the updated list of participants, even in case of non-existing userid.&lt;br /&gt;
&lt;br /&gt;
'''Updates/Changes:'''&lt;br /&gt;
This page has been updated such that an instructor can add a new Participant using [https://en.wikipedia.org/wiki/Ajax_(programming) AJAX]. After adding AJAX changes, the list gets updated without reloading the entire page. The changes made are below.&lt;br /&gt;
&lt;br /&gt;
* Updated the ''shared_scripts/_user_list.html.erb'' file in views so that the Participants are listed by rendering another partial ''_participant.html.erb'' in participants controller. This change is to make it feasible to add AJAX to just append to the list without any extra formatting.&lt;br /&gt;
[[File:User_list.PNG]]&lt;br /&gt;
&lt;br /&gt;
* Created a new file ''participants/add.js.erb'' for adding AJAX to render newly added participant in case of successful addition and display error in case of any error.&lt;br /&gt;
[[File:Javascript changes.PNG]]&lt;br /&gt;
&lt;br /&gt;
* Updated the ''shared_scripts/_add_individual.html.erb'' form such that request should be through AJAX by setting remote flag to true.&lt;br /&gt;
[[File:Add_individual.PNG]]&lt;br /&gt;
&lt;br /&gt;
* Updated the participants controller ''participant_controller.rb'' in controllers to render JavaScript when add method is invoked by the form submit action instead of redirect to list page.&lt;br /&gt;
[[File:Controller_changes.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Adding/Removing TA===&lt;br /&gt;
'''Earlier scenario:''' When an instructor goes to &amp;quot;Manage Courses -&amp;gt; Add TA&amp;quot; page, he/she can add/remove new TA to the course. Every time a new TA is added or removed, the page reloads to reflect the changes, even if the userid used does not exist.&lt;br /&gt;
&lt;br /&gt;
'''Updates/Changes:''' This page has been updated such that an instructor can add a new TA or remove a new TA using AJAX. With these updates, the changes are reflected on the page without reloading the page, thus saving time.&lt;br /&gt;
* Updated the ''course/view_teaching_assistants.html.erb'' file in views so that the TAs are listed by rendering another partial ''_ta.html.erb''. This is done so that when a new TA has been added, AJAX call can be used to render the format required for the new TA in the list append to the already existing list without reloading the page.&lt;br /&gt;
[[File:View_teaching_assistants_html_erb.png]]&lt;br /&gt;
&lt;br /&gt;
* Created a new file ''course/_ta.html.erb'' in views which is a partial as described above and contains the code to list the TAs. The link_to &amp;quot;Delete&amp;quot; line in this file is updated to use :remote=&amp;gt;:true, so that AJAX call can be made to remove the TA remotely without reloading the page.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;%= link_to &amp;quot;Delete&amp;quot;, { :action =&amp;gt; 'remove_ta', :controller =&amp;gt;'course', :id =&amp;gt; ta.id, :course_id =&amp;gt; ta.course_id }, method: :post, :remote =&amp;gt; true, :class =&amp;gt; 'remove_ta' %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[File:Ta.png]]&lt;br /&gt;
&lt;br /&gt;
* Updated the ''course/_add_individual.html.erb'' file in views to perform the form_tag action to Add a TA remotely using :remote=&amp;gt;:true. In the below code, ''form_action'' and ''remote'' are local variables passed to this partial from ''course/view_teaching_assistants.html.erb'' with the values &amp;quot;add_ta&amp;quot; and &amp;quot;true&amp;quot; respectively &lt;br /&gt;
[[File:Add_individual_html_erb.png]]&lt;br /&gt;
&lt;br /&gt;
* Updated the ''course_controller.rb&amp;quot; file and replaced the redirect option in ''add_ta'' and ''remove_ta'' to render ''add_ta.js.erb'' and ''remove_ta.js.erb''. Also changed ''flash[:error]'' to ''flash.now[:error]'' so that the flash message is displayed now instead of after page reload.&lt;br /&gt;
[[File:Course_controller_rb1.png]]&lt;br /&gt;
&lt;br /&gt;
* Added a new file ''course/add.js.erb'' and ''course/remove_ta.js.erb'' to views. The ''add_ta.js.erb'' file renders the newly added TA and appends it to the list of TAs. It also shows flash error message if the userid used to add TA does not exist. Similarly, ''remote_ta.js.erb'' file removes the deleted TA from the list.&lt;br /&gt;
[[File:add_remove_js_erb.png]]&lt;br /&gt;
&lt;br /&gt;
===Edit Questionnaire===&lt;br /&gt;
&lt;br /&gt;
'''Current scenario :''' page consists of different subsections for creating questionnaire,adding questions to the questionnaire and saving the questionnaire i.e.&lt;br /&gt;
*_questionnaire.html.erb&lt;br /&gt;
&lt;br /&gt;
Adding questions feature is performed in the following method of ''questionnaires_controller.rb'' class&lt;br /&gt;
&lt;br /&gt;
def add_new_questions&lt;br /&gt;
    questionnaire_id = params[:id] unless params[:id].nil?&lt;br /&gt;
    num_of_existed_questions = Questionnaire.find(questionnaire_id).questions.size&lt;br /&gt;
    ((num_of_existed_questions + 1)..(num_of_existed_questions + params[:question][:total_num].to_i)).each do |i|&lt;br /&gt;
      question = Object.const_get(params[:question][:type]).create(txt: '', questionnaire_id: questionnaire_id, seq: i, type: params[:question][:type], break_before: true)&lt;br /&gt;
      if question.is_a? ScoredQuestion&lt;br /&gt;
        question.weight = 1&lt;br /&gt;
        question.max_label = 'Strongly agree'&lt;br /&gt;
        question.min_label = 'Strongly disagree'&lt;br /&gt;
      end&lt;br /&gt;
      question.size = '50, 3' if question.is_a? Criterion&lt;br /&gt;
      question.alternatives = '0|1|2|3|4|5' if question.is_a? Dropdown&lt;br /&gt;
      question.size = '60, 5' if question.is_a? TextArea&lt;br /&gt;
      question.size = '30' if question.is_a? TextField&lt;br /&gt;
      begin&lt;br /&gt;
        question.save&lt;br /&gt;
      rescue&lt;br /&gt;
        flash[:error] = $ERROR_INFO&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to edit_questionnaire_path(questionnaire_id.to_sym)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This method invokes ''question.create'' method in ''questions_cotroller.rb'' and saves the created question to the database. Then it redirects to the ''edit.html.erb'' page which causes page refresh while adding questions.&lt;br /&gt;
&lt;br /&gt;
'''Solution:''' This problem was tried to solve using AJAX by changing or adding the following classes and pages &lt;br /&gt;
* _question.html.erb (added) - displays added question&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;td align=&amp;quot;center&amp;quot;&amp;gt;&amp;lt;a rel=&amp;quot;nofollow&amp;quot; data-method=&amp;quot;delete&amp;quot; href=&amp;quot;/questions/' &amp;lt;%= @question.id%&amp;gt; '&amp;quot;&amp;gt;Remove&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
        &amp;lt;td&amp;gt;&amp;lt;input size=&amp;quot;6&amp;quot; value=&amp;quot;' &amp;lt;%= @question.seq%&amp;gt; '&amp;quot; name=&amp;quot;question[' question.id %&amp;gt;'][seq]&amp;quot; id=&amp;quot;question_' +&amp;lt;%=@question.id %&amp;gt; '_seq&amp;quot; type=&amp;quot;text&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
        &amp;lt;td&amp;gt;&amp;lt;textarea cols=&amp;quot;50&amp;quot; rows=&amp;quot;1&amp;quot; name=&amp;quot;question[' &amp;lt;%= @question.id%&amp;gt; '][txt]&amp;quot; id=&amp;quot;question_' &amp;lt;%= @question.id%&amp;gt; '_txt&amp;quot; placeholder=&amp;quot;Edit question content here&amp;quot;&amp;gt;' &amp;lt;%= @question.txt%&amp;gt; '&amp;lt;/textarea&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
        &amp;lt;td&amp;gt;&amp;lt;input size=&amp;quot;10&amp;quot; disabled=&amp;quot;disabled&amp;quot; value=&amp;quot;'  &amp;lt;%= @question.type%&amp;gt;  '&amp;quot; name=&amp;quot;question[' &amp;lt;%= @question.id%&amp;gt;'][type]&amp;quot; id=&amp;quot;question_' &amp;lt;%= @question.id%&amp;gt; '_type&amp;quot; type=&amp;quot;text&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
        &amp;lt;td&amp;gt;&amp;lt;!--placeholder (QuestionnaireHeader does not need weight)--&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* add_new_questions.js.erb (added) - appends the html content with added question in ''_question.html.erb'' to  questions_table in ''_questionnaire.html.erb''&lt;br /&gt;
&lt;br /&gt;
   $(&amp;quot;#questions_table&amp;quot;).append(&amp;quot;&amp;lt;%= j render :partial =&amp;gt; 'question',&lt;br /&gt;
           :locals =&amp;gt; {question: @question, :id =&amp;gt; @question.id, :controller =&amp;gt; 'questions'} %&amp;gt;&amp;quot;);&lt;br /&gt;
  &lt;br /&gt;
* edit.html.erb (modified : code removed) - following code is removed as it internally calls respective question header models and appends html string to questions_table internally.&lt;br /&gt;
      &lt;br /&gt;
      &amp;lt;% for @question in @questionnaire.questions do%&amp;gt;&lt;br /&gt;
        &amp;lt;%-# The following line call certain method of the object, which returns html string-%&amp;gt;&lt;br /&gt;
        &amp;lt;%= @question.edit %&amp;gt;&lt;br /&gt;
      &amp;lt;% end %&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
@question.edit invokes ''QuestionHeader.rb'' model which adds html content&lt;br /&gt;
     def edit(_count)&lt;br /&gt;
    html = '&amp;lt;tr&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td align=&amp;quot;center&amp;quot;&amp;gt;&amp;lt;a rel=&amp;quot;nofollow&amp;quot; data-method=&amp;quot;delete&amp;quot; href=&amp;quot;/questions/' + self.id.to_s + '&amp;quot;&amp;gt;Remove&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td&amp;gt;&amp;lt;input size=&amp;quot;6&amp;quot; value=&amp;quot;' + self.seq.to_s + '&amp;quot; name=&amp;quot;question[' + self.id.to_s + '][seq]&amp;quot; id=&amp;quot;question_' + self.id.to_s + '_seq&amp;quot; type=&amp;quot;text&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td&amp;gt;&amp;lt;textarea cols=&amp;quot;50&amp;quot; rows=&amp;quot;1&amp;quot; name=&amp;quot;question[' + self.id.to_s + '][txt]&amp;quot; id=&amp;quot;question_' + self.id.to_s + '_txt&amp;quot; placeholder=&amp;quot;Edit question content here&amp;quot;&amp;gt;' + self.txt + '&amp;lt;/textarea&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td&amp;gt;&amp;lt;input size=&amp;quot;10&amp;quot; disabled=&amp;quot;disabled&amp;quot; value=&amp;quot;' + self.type + '&amp;quot; name=&amp;quot;question[' + self.id.to_s + '][type]&amp;quot; id=&amp;quot;question_' + self.id.to_s + '_type&amp;quot; type=&amp;quot;text&amp;quot;&amp;gt;''&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td&amp;gt;&amp;lt;!--placeholder (QuestionnaireHeader does not need weight)--&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;/tr&amp;gt;'&lt;br /&gt;
    html.html_safe&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
* questionnaires_controller.rb (modified) - add_new_questions method is modified by replacing redire rendering ''add_new_questions.js.erb'' file&lt;br /&gt;
&lt;br /&gt;
  render :action=&amp;gt; 'add_new_questions.js.erb', :layout=&amp;gt;false, :question=&amp;gt; question&lt;br /&gt;
   #redirect_to edit_questionnaire_path(questionnaire_id.to_sym)&lt;br /&gt;
&lt;br /&gt;
'''Issue :''' But this solution is not working as AJAX can be applied to the browser side processing if the controller method is redirecting to the same page, which is not in this case as page gets redirected from question.html.erb to edit.html.erb. Another problem faced is the creation of questions which is called through ''_questionnaire.html.erb'' but not through ''_question.html.erb'' which makes it difficult to pass correct questionnaire id to the AJAX call.&lt;br /&gt;
&lt;br /&gt;
'''Alternative Approach to Edit Questionnaire:''' Another approach to solve this issue is to create a seperate java-script function which handles the entire process of adding,saving,deleting questions and appending them. Call this function from ''_questionnaire.html.erb'' instead of invoking add_new_questions method. Questions can be saved and retrived from data using JavaScript Rest API calls. But, this approach not only needs to restructure entire questionnaire structure and many components in the Expertiza project but also violates the MVC design of the project.&lt;br /&gt;
&lt;br /&gt;
===Un-submit reviews===&lt;br /&gt;
'''Earlier scenario:''' When an instructor/TA goes to &amp;quot;Manage Assignments -&amp;gt; Assign Reviewers&amp;quot; page, he/she can see a list of all the topics, the contributors and the reviewers for each topic. This page did not show the status of each review which can be in Assigned state or Saved state or Submitted state. Also, there was no way for the instructor/TA to un-submit an already submitted review.&lt;br /&gt;
&lt;br /&gt;
'''New Additions:'''&lt;br /&gt;
* Updated the ''review_mappings/_list_review_mappings.html.erb'' file in views to display the status of each review by the reviewer. For each review_mapping, the code checks if there is a response in ''Response'' table with the same ''map_id'' used in the review_mappings on this page. &lt;br /&gt;
** If there is no such response, it means that the reviewer has not saved/submitted the review and it is currently in Assigned State. So, &amp;quot;Response Status: Saved&amp;quot; is shown for that review.&lt;br /&gt;
** If there is a response, the last (latest) response is checked as per requirement and the ''is_submitted'' attribute of this response is checked in the ''Response'' table.&lt;br /&gt;
*** If the attribute is false, the review has been saved but not submitted. So, &amp;quot;Response Status: Saved&amp;quot; is shown for that review.&lt;br /&gt;
*** If the attribute is true, the review has been submitted. So, &amp;quot;Response Status: Submitted&amp;quot; is shown for that review. Next to this, a link is created to un-submit the review. Clicking on this link changes the ''is_submitted'' attribute to false and updates the Response Status to Saved on the page by using AJAX call, without reloading the page&lt;br /&gt;
[[File:List_review_mappings_html_erb.png]]&lt;br /&gt;
* Added a new method &amp;quot;unsubmit_review&amp;quot; to the ''review_mapping_controller.rb'' file. In this, we first find the latest response and then update the ''is_submitted'' attribute to false. The flash message is created based on whether the response was updated correctly. After this, ''unsubmit_review.js.rb'' file is rendered which updates the response status for the corresponding review on the page to Saved, without reloading the page&lt;br /&gt;
[[File:Review_mapping_controller_rb.png]]&lt;br /&gt;
* Added a new file ''review_mappings/unsubmit_review.js.erb'' to views. This file just changes the response status for the corresponding review displayed on the page to Saved from Submit after the review has been un-submitted and also prints the corresponding success or error flash message.&lt;br /&gt;
[[File:Unsubmit_review_js_erb.png]]&lt;br /&gt;
* Added a new line to ''routes.rb'' page for unsubmit_review action&lt;br /&gt;
[[File:Routes_rb.png]]&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
===Log in details===&lt;br /&gt;
&lt;br /&gt;
'''Username:''' instructor6&lt;br /&gt;
'''password:''' password&lt;br /&gt;
&lt;br /&gt;
Some valid user id's are student5000, student5001, student5002 etc. These can be used while adding new Participant or TA as described below.&lt;br /&gt;
&lt;br /&gt;
===Automated Testing===&lt;br /&gt;
* Created a helper module ''wait_for_ajax.rb'' with methods to wait for ajax requests to finish&lt;br /&gt;
[[File:Wait_ajax.png]]&lt;br /&gt;
* Updated the test &amp;quot;check to see if participants can be added&amp;quot; in ''assignment_creation_spec.rb'' to wait for AJAX calls to finish after adding a participant by using the helper module created&lt;br /&gt;
[[File:Assignment_create.png]]&lt;br /&gt;
* Added a new file ''course_creation_spec.rb'' to test adding and remove TA's&lt;br /&gt;
** This contains test named &amp;quot;should display newly created course&amp;quot; to check if the new course is successfully created (There was no such test earlier)&lt;br /&gt;
** This also contains a test named &amp;quot;check to see if TA can be added and removed&amp;quot; which checks if a new TA has gotten added after clicking on Add TA and and later removed after clicking on Delete&lt;br /&gt;
[[File:Add_ta.png]]&lt;br /&gt;
* Added a new test named &amp;quot;can unsubmit a review&amp;quot; in ''review_mapping_spec.rb''&lt;br /&gt;
** In this test, a new reviewer is added to review mapping, a new review is created and submitted, and then checked if unsubmit functionality is working correctly&lt;br /&gt;
[[File:Unsubmit_review.png]]&lt;br /&gt;
&lt;br /&gt;
===UI Testing===&lt;br /&gt;
&lt;br /&gt;
'''Steps to test adding participant: '''&lt;br /&gt;
&lt;br /&gt;
* Login as instructor&lt;br /&gt;
* Go to Manage -&amp;gt; Assignments.&lt;br /&gt;
* Switch to Assignments tab incase you are on some other tab&lt;br /&gt;
* For any assignment, click on the 'Add Participant' icon to go on add new participant page&lt;br /&gt;
* Enter userid of the participant and click on Add to add the participant&lt;br /&gt;
&lt;br /&gt;
'' Expected Output: '' When add button is clicked with valid userid, new participant should be added to the list without the page getting reloaded. In case of an attempt to add invalid user, the error should be displayed on top without page getting reloaded.&lt;br /&gt;
&lt;br /&gt;
''' Steps to test adding/removing TA:'''&lt;br /&gt;
&lt;br /&gt;
* Login as instructor&lt;br /&gt;
* Go to Manage -&amp;gt; Courses.&lt;br /&gt;
* Switch to Courses tab incase you are on some other tab&lt;br /&gt;
* For any course, click on the 'Add TA' icon to go on add new TA page&lt;br /&gt;
* Enter userid of the TA and click on Add to add the TA&lt;br /&gt;
* Click on 'remove_ta' link for any TA in the list to remove the TA&lt;br /&gt;
&lt;br /&gt;
'' Expected Output: '' When add button is clicked with valid userid, new TA should be added to the list without the page getting reloaded. In case of an attempt to add invalid user, the error should be displayed on top without page getting reloaded. When remove_ta link is clicked for any TA in the list, that corresponding TA should be removed from the list without the page getting reloaded.&lt;br /&gt;
Note: A duplicate TA is currently allowed. This was a part of original (earlier) functionality, and as this project involved changes to use AJAX and not changes to the actual functionality, this original functionality is not changed &lt;br /&gt;
&lt;br /&gt;
''' Steps to test adding question in questionnaire:'''&lt;br /&gt;
&lt;br /&gt;
* Login as instructor&lt;br /&gt;
* Go to Manage -&amp;gt; Questionnaires. Create a new Review Questionnaire by  clicking on the ‘New public item’ button for ‘Review’.&lt;br /&gt;
* Name the Questionnaire and click on create button&lt;br /&gt;
* Click on Edit for newly created questionnaire.  You will now be navigated to page where you can add new questions to the questionnaire. &lt;br /&gt;
* Click on add button in &amp;quot;Questions&amp;quot; section.&lt;br /&gt;
&lt;br /&gt;
''Expected output:'' When add button is clicked, question should be created and the questionnaire page should not get reloaded&lt;br /&gt;
&lt;br /&gt;
''' Steps to test un-submit reviews'''&lt;br /&gt;
&lt;br /&gt;
* Login as instructor&lt;br /&gt;
* Go to Manage -&amp;gt; Assignments.&lt;br /&gt;
* Switch to Assignments tab incase you are on some other tab&lt;br /&gt;
* For any assignment, click on the 'Assign reviewers' icon to go to the review mappings page&lt;br /&gt;
** Note: Some assignments might not have reviewers. So, try this for assignments with many reviewers&lt;br /&gt;
* For any review with Review Status = Submitted, click on 'unsubmit' button&lt;br /&gt;
&lt;br /&gt;
''Expected output:'' For every review, the review status should be seen as either Assigned or Saved or Submitted. For submitted reviews, when unsubmit button is clicked, that review should be unsubmitted and status should change to Saved without page getting reloaded.&lt;br /&gt;
&lt;br /&gt;
==Project Deployment==&lt;br /&gt;
&lt;br /&gt;
Expertiza setup is done in VCL which is reserved for 30 days with Ubuntu 14.04 base. Started expertiza server publicly and link to access the server is:&lt;br /&gt;
http://152.7.99.101:3000&lt;br /&gt;
&lt;br /&gt;
==Future work==&lt;br /&gt;
&lt;br /&gt;
In future, we will try to implement the edit questionnaire part using alternative approach. We will try to implement testing using rspec framework and improve the UI design of the pages.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
* https://www.youtube.com/channel/UCdKXzox7hrWjfOMML6FzTWg&lt;br /&gt;
* https://github.com/expertiza/expertiza&lt;br /&gt;
* http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation&lt;br /&gt;
* http://guides.rubyonrails.org/working_with_javascript_in_rails.html&lt;br /&gt;
* http://wiki.expertiza.ncsu.edu/index.php/Development:Setup:Linux:Debian&lt;/div&gt;</summary>
		<author><name>Psvaidya</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Add_ta.png&amp;diff=107876</id>
		<title>File:Add ta.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Add_ta.png&amp;diff=107876"/>
		<updated>2017-04-01T06:39:08Z</updated>

		<summary type="html">&lt;p&gt;Psvaidya: uploaded a new version of &amp;amp;quot;File:Add ta.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Psvaidya</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Unsubmit_review.png&amp;diff=107875</id>
		<title>File:Unsubmit review.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Unsubmit_review.png&amp;diff=107875"/>
		<updated>2017-04-01T06:37:29Z</updated>

		<summary type="html">&lt;p&gt;Psvaidya: uploaded a new version of &amp;amp;quot;File:Unsubmit review.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Psvaidya</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Assignment_create.png&amp;diff=107874</id>
		<title>File:Assignment create.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Assignment_create.png&amp;diff=107874"/>
		<updated>2017-04-01T06:36:26Z</updated>

		<summary type="html">&lt;p&gt;Psvaidya: uploaded a new version of &amp;amp;quot;File:Assignment create.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Psvaidya</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Wait_ajax.png&amp;diff=107873</id>
		<title>File:Wait ajax.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Wait_ajax.png&amp;diff=107873"/>
		<updated>2017-04-01T06:35:39Z</updated>

		<summary type="html">&lt;p&gt;Psvaidya: uploaded a new version of &amp;amp;quot;File:Wait ajax.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Psvaidya</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Routes_rb.png&amp;diff=107872</id>
		<title>File:Routes rb.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Routes_rb.png&amp;diff=107872"/>
		<updated>2017-04-01T06:34:14Z</updated>

		<summary type="html">&lt;p&gt;Psvaidya: uploaded a new version of &amp;amp;quot;File:Routes rb.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Updates to routes.rb file&lt;/div&gt;</summary>
		<author><name>Psvaidya</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Unsubmit_review_js_erb.png&amp;diff=107871</id>
		<title>File:Unsubmit review js erb.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Unsubmit_review_js_erb.png&amp;diff=107871"/>
		<updated>2017-04-01T06:33:42Z</updated>

		<summary type="html">&lt;p&gt;Psvaidya: uploaded a new version of &amp;amp;quot;File:Unsubmit review js erb.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Code from newly added file &amp;quot;views/review_mappings/unsubmit_review.js.erb&amp;quot;&lt;/div&gt;</summary>
		<author><name>Psvaidya</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Review_mapping_controller_rb.png&amp;diff=107870</id>
		<title>File:Review mapping controller rb.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Review_mapping_controller_rb.png&amp;diff=107870"/>
		<updated>2017-04-01T06:32:39Z</updated>

		<summary type="html">&lt;p&gt;Psvaidya: uploaded a new version of &amp;amp;quot;File:Review mapping controller rb.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The code changes in file &amp;quot;controller/review_mapping_controller.rb&amp;quot;&lt;/div&gt;</summary>
		<author><name>Psvaidya</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:List_review_mappings_html_erb.png&amp;diff=107869</id>
		<title>File:List review mappings html erb.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:List_review_mappings_html_erb.png&amp;diff=107869"/>
		<updated>2017-04-01T06:31:48Z</updated>

		<summary type="html">&lt;p&gt;Psvaidya: uploaded a new version of &amp;amp;quot;File:List review mappings html erb.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The code changes in file &amp;quot;views/_list_review_mappings.html.erb&amp;quot;&lt;/div&gt;</summary>
		<author><name>Psvaidya</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Course_controller_rb1.png&amp;diff=107868</id>
		<title>File:Course controller rb1.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Course_controller_rb1.png&amp;diff=107868"/>
		<updated>2017-04-01T06:31:02Z</updated>

		<summary type="html">&lt;p&gt;Psvaidya: uploaded a new version of &amp;amp;quot;File:Course controller rb1.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Updates to course controller file&lt;/div&gt;</summary>
		<author><name>Psvaidya</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Add_remove_js_erb.png&amp;diff=107867</id>
		<title>File:Add remove js erb.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Add_remove_js_erb.png&amp;diff=107867"/>
		<updated>2017-04-01T06:29:51Z</updated>

		<summary type="html">&lt;p&gt;Psvaidya: uploaded a new version of &amp;amp;quot;File:Add remove js erb.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Psvaidya</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Add_individual_html_erb.png&amp;diff=107866</id>
		<title>File:Add individual html erb.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Add_individual_html_erb.png&amp;diff=107866"/>
		<updated>2017-04-01T06:28:48Z</updated>

		<summary type="html">&lt;p&gt;Psvaidya: uploaded a new version of &amp;amp;quot;File:Add individual html erb.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Psvaidya</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Ta.png&amp;diff=107865</id>
		<title>File:Ta.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Ta.png&amp;diff=107865"/>
		<updated>2017-04-01T06:26:49Z</updated>

		<summary type="html">&lt;p&gt;Psvaidya: uploaded a new version of &amp;amp;quot;File:Ta.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Psvaidya</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:View_teaching_assistants_html_erb.png&amp;diff=107864</id>
		<title>File:View teaching assistants html erb.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:View_teaching_assistants_html_erb.png&amp;diff=107864"/>
		<updated>2017-04-01T06:25:48Z</updated>

		<summary type="html">&lt;p&gt;Psvaidya: uploaded a new version of &amp;amp;quot;File:View teaching assistants html erb.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Updates to file views/courses/view_teaching_assistants.html.erb&lt;/div&gt;</summary>
		<author><name>Psvaidya</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Controller_changes.PNG&amp;diff=107863</id>
		<title>File:Controller changes.PNG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Controller_changes.PNG&amp;diff=107863"/>
		<updated>2017-04-01T06:23:59Z</updated>

		<summary type="html">&lt;p&gt;Psvaidya: uploaded a new version of &amp;amp;quot;File:Controller changes.PNG&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;controller changes&lt;/div&gt;</summary>
		<author><name>Psvaidya</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Add_individual.PNG&amp;diff=107862</id>
		<title>File:Add individual.PNG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Add_individual.PNG&amp;diff=107862"/>
		<updated>2017-04-01T06:23:11Z</updated>

		<summary type="html">&lt;p&gt;Psvaidya: uploaded a new version of &amp;amp;quot;File:Add individual.PNG&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Psvaidya</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Javascript_changes.PNG&amp;diff=107861</id>
		<title>File:Javascript changes.PNG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Javascript_changes.PNG&amp;diff=107861"/>
		<updated>2017-04-01T06:22:18Z</updated>

		<summary type="html">&lt;p&gt;Psvaidya: uploaded a new version of &amp;amp;quot;File:Javascript changes.PNG&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;javascript changes&lt;/div&gt;</summary>
		<author><name>Psvaidya</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:User_list.PNG&amp;diff=107860</id>
		<title>File:User list.PNG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:User_list.PNG&amp;diff=107860"/>
		<updated>2017-04-01T06:20:58Z</updated>

		<summary type="html">&lt;p&gt;Psvaidya: uploaded a new version of &amp;amp;quot;File:User list.PNG&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;user list&lt;/div&gt;</summary>
		<author><name>Psvaidya</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Unsubmit_review.png&amp;diff=107858</id>
		<title>File:Unsubmit review.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Unsubmit_review.png&amp;diff=107858"/>
		<updated>2017-04-01T06:18:11Z</updated>

		<summary type="html">&lt;p&gt;Psvaidya: uploaded a new version of &amp;amp;quot;File:Unsubmit review.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Psvaidya</name></author>
	</entry>
</feed>