<?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=Hchen34</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=Hchen34"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Hchen34"/>
	<updated>2026-05-18T22:01: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_Fall_2021_-_E2168._Testing_-_Reputations&amp;diff=142652</id>
		<title>CSC/ECE 517 Fall 2021 - E2168. Testing - Reputations</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2168._Testing_-_Reputations&amp;diff=142652"/>
		<updated>2021-12-01T04:05:08Z</updated>

		<summary type="html">&lt;p&gt;Hchen34: format&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Project Overview ==&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;q&amp;gt;Online peer-review systems are now in common use in higher education. They free the instructor and course staff from having to provide personally all the feedback that students receive on their work. However, if we want to assure that all students receive competent feedback, or even use peer-assigned grades, we need a way to judge which peer reviewers are most credible. The solution is to use a reputation system.&amp;lt;/q&amp;gt; &amp;lt;br&amp;gt; The reputation system is meant to provide objective value to student assigned peer review scores. Students select from a list of tasks to be performed and then prepare their work and submit it to a peer-review system. The work is then reviewed by other students who offer comments/graded feedback to help the submitters improve their work.&lt;br /&gt;
During the peer review period it is important to determine which reviews are more accurate and show higher quality. Reputation is one way to achieve this goal; it is a quantization measurement to judge which peer reviewers are more reliable.&lt;br /&gt;
Peer reviewers can use expertiza to score an author. If Expertiza shows a confidence ratings for grades based upon the reviewers reputation then authors can more easily determine the legitimacy of the peer assigned score. In addition, the teaching staff can examine the quality of each peer review based on reputation values and, potentially, crowd-source a significant portion of the grading function.&lt;br /&gt;
Currently the reputation system is implemented in Expertiza through web-service, but there's no test written for it. Thus our goal is to set up assignments and reviews that would produce specific reputation scores, and test that the correct reputations are in fact being produced.&lt;br /&gt;
&lt;br /&gt;
=== System Design ===&lt;br /&gt;
The below is referenced from project E1625, which would give us the overall description of the reputation system.&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Diagram E1625.png|1000px]]&amp;lt;br&amp;gt;&lt;br /&gt;
There are two algorithms intended for use in calculation of the reputation values for participants. &lt;br /&gt;
&lt;br /&gt;
There is a [https://expertiza.ncsu.edu/reputation_web_service/client web-service] (the link accessible only to the instructors) available which serves a JSON response containing the reputation value based on the seed provided in the form of the last known reputation value which we store in the ''participants'' table. An instructor can specify which algorithm to use for a particular assignment to calculate the confidence rating. &lt;br /&gt;
&lt;br /&gt;
As the [https://docs.google.com/viewer?url=https%3A%2F%2Fwww.researchgate.net%2Fprofile%2FYang_Song36%2Fpublication%2F289528736_Pluggable_Reputation_Systems_for_Peer_Review_a_Web-Service_Approach%2Flinks%2F568ec8d008ae78cc05160aed.pdf%3FinViewer%3D0%26pdfJsDownload%3D0%26origin%3Dpublication_detail paper] on reputation system by observes, “the Hamer-peer algorithm has the lowest maximum absolute bias and the Lauw-peer algorithm has the lowest overall bias.This indicates, from the instructor’s perspective, if there are further assignments of this kind, expert grading may not be necessary.”&lt;br /&gt;
:;Reputation range of Hamer’s algorithm is :&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: red;&amp;quot;&amp;gt;red&amp;lt;/span&amp;gt;                   value &amp;lt; 0.5&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: yellow&amp;quot;&amp;gt;yellow&amp;lt;/span&amp;gt;              value is &amp;gt;= 0.5 and &amp;lt;= 1&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: orange&amp;quot;&amp;gt;orange&amp;lt;/span&amp;gt;             value is &amp;gt; 1 and &amp;lt;= 1.5&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: HoneyDew&amp;quot;&amp;gt;light green&amp;lt;/span&amp;gt;       value is &amp;gt; 1.5 and &amp;lt;= 2&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: Chartreuse&amp;quot;&amp;gt;green&amp;lt;/span&amp;gt;               value is &amp;gt; 2&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The main difference between the Hamer-peer and the Lauw-peer algorithm is that the Lauw-peer algorithm keeps track of the reviewer's leniency (“bias”), which can be either positive or negative. A positive leniency indicates the reviewer tends to give higher scores than average.  This project determines reputation by subtracting the absolute value of the leniency from 1. Additionally, the range for Hamer’s algorithm is (0,∞) while for Lauw’s algorithm it is [0,1]. &lt;br /&gt;
:;Reputation range of Lauw’s algorithm is&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: red&amp;quot;&amp;gt;red&amp;lt;/span&amp;gt;                   value is &amp;lt; 0.2&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: yellow&amp;quot;&amp;gt;yellow&amp;lt;/span&amp;gt;              value is &amp;gt;= 0.2 and &amp;lt;= 0.4&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: orange&amp;quot;&amp;gt;orange&amp;lt;/span&amp;gt;             value is &amp;gt; 0.4 and &amp;lt;= 0.6&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: HoneyDew&amp;quot;&amp;gt;light green&amp;lt;/span&amp;gt;       value is &amp;gt; 0.6 and &amp;lt;= 0.8&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: Chartreuse&amp;quot;&amp;gt;green&amp;lt;/span&amp;gt;               value is &amp;gt; 0.8&lt;br /&gt;
&lt;br /&gt;
The instructor can choose to show results from Hamer’s algorithm or Lauw’s algorithm. The default algorithm should be Lauw’s algorithm.&lt;br /&gt;
&lt;br /&gt;
=== Objectives ===&lt;br /&gt;
&lt;br /&gt;
Our objectives for this project are the following:&lt;br /&gt;
* Double and stub an assignment, a few submissions to the assignment, under different review rubrics&lt;br /&gt;
* Manually calculate reputation scores based on paper &amp;quot;Pluggable reputation systems for peer review: A web-service approach&amp;quot;&lt;br /&gt;
* Validate correct reputation scores based on different review rubrics generated by reputation management VS manual computation of reputation score using the Hamer's and Lauw's algorithm.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
*reputation_web_service_controller_spec&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
=== Setup Testing Objects ===&lt;br /&gt;
In order to implement testing on reputation, it is crucial to create sample reviews so that we could possibly obtain reputation score. During the kickoff meeting, our team defined four necessary steps to follow for the purpose of testing. Also, appropriate objects could be created and confined as discussed below.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The manifestation of each object will contribute to the success of the following test on reputations. Some fields in each object can be empty or have default values. Some attributes are not relevant to the test. When implementing the test, the test scripts need to generate or set fixed values for corresponding fields.&lt;br /&gt;
&lt;br /&gt;
==== Assignment ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[assignments]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Essential Parameters to be configured&amp;lt;br&amp;gt;&lt;br /&gt;
submitter_count = 0;&amp;lt;br&amp;gt;&lt;br /&gt;
num_reviews = 5;&amp;lt;br&amp;gt;&lt;br /&gt;
num_reviewers = 5;&amp;lt;br&amp;gt;&lt;br /&gt;
num_reviews_allowed = 5;&amp;lt;br&amp;gt;&lt;br /&gt;
rounds_of_reviews = 2;&amp;lt;br&amp;gt;&lt;br /&gt;
reputation_algorithm = lauw/hamer;&amp;lt;br&amp;gt;&lt;br /&gt;
Note: Two assignment objects were created. Assignment_1 used lauw's algorithm, whereas assignment_2 used hamer's alogorithm.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @assignment_1 = create(:assignment, created_at: DateTime.now.in_time_zone - 13.day, submitter_count: 0, num_reviews: 3, num_reviewers: 5, num_reviews_allowed: 5, rounds_of_reviews: 2, reputation_algorithm: 'lauw', id: 1)&lt;br /&gt;
  @assignment_2 = create(:assignment, created_at: DateTime.now.in_time_zone - 13.day, submitter_count: 0, num_reviews: 3, num_reviewers: 5, num_reviews_allowed: 5, rounds_of_reviews: 2, reputation_algorithm: 'hamer', id: 2)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Questionnaires(Rubrics) ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[questionnaires]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[assignment_questionnaires]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Essential Parameters to be configured&amp;lt;br&amp;gt;&lt;br /&gt;
min_question_score = 0;&amp;lt;br&amp;gt;&lt;br /&gt;
max_question_score = 5;&amp;lt;br&amp;gt;&lt;br /&gt;
type = ReviewQuestionnaire;&amp;lt;br&amp;gt;&lt;br /&gt;
Note: We will define the assignment with ReviewQuestionnaire type rubric. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @questionnaire_1 = create(:questionnaire, min_question_score: 0, max_question_score: 5, type: 'ReviewQuestionnaire', id: 1)&lt;br /&gt;
  # assignment_questionnaire_&amp;lt;i&amp;gt;_&amp;lt;j&amp;gt; means assignment #I'd #j th round of review.&lt;br /&gt;
  @assignment_questionnaire_1_1 = create(:assignment_questionnaire, assignment_id: @assignment_1.id, questionnaire_id: @questionnaire_1.id, used_in_round: 1)&lt;br /&gt;
  @assignment_questionnaire_1_2 = create(:assignment_questionnaire, assignment_id: @assignment_1.id, questionnaire_id: @questionnaire_1.id, used_in_round: 2)&lt;br /&gt;
  @assignment_questionnaire_2_1 = create(:assignment_questionnaire, assignment_id: @assignment_2.id, questionnaire_id: @questionnaire_1.id, used_in_round: 1)&lt;br /&gt;
  @assignment_questionnaire_2_2 = create(:assignment_questionnaire, assignment_id: @assignment_2.id, questionnaire_id: @questionnaire_1.id, used_in_round: 2)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Questions under Questionnaires ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[questions]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  # question_i_j means question #j in questionnaire #i.&lt;br /&gt;
  @question_1_1 = create(:question, questionnaire_id: @questionnaire_1.id, id: 1)&lt;br /&gt;
  @question_1_2 = create(:question, questionnaire_id: @questionnaire_1.id, id: 2)&lt;br /&gt;
  @question_1_3 = create(:question, questionnaire_id: @questionnaire_1.id, id: 3)&lt;br /&gt;
  @question_1_4 = create(:question, questionnaire_id: @questionnaire_1.id, id: 4)&lt;br /&gt;
  @question_1_5 = create(:question, questionnaire_id: @questionnaire_1.id, id: 5)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Reviewers and Reviewees ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[participants]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[teams]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
Reviewers (Participant):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @reviewer_1 = create(:participant, can_review: 1)&lt;br /&gt;
  @reviewer_2 = create(:participant, can_review: 1)&lt;br /&gt;
  @reviewer_3 = create(:participant, can_review: 1)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Reviewees (Teams):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @reviewee_1 = create(:assignment_team, assignment: @assignment)&lt;br /&gt;
  @reviewee_2 = create(:assignment_team, assignment: @assignment)&lt;br /&gt;
  @reviewee_3 = create(:assignment_team, assignment: @assignment)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Responses ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[response_maps]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[responses]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Essential Parameters to be configured&amp;lt;br&amp;gt;&lt;br /&gt;
reviewed_object_id = &amp;lt;target_assignment&amp;gt;.id ; &amp;lt;br&amp;gt;&lt;br /&gt;
reviewer_id = &amp;lt;target_reviewer&amp;gt;.id ; &amp;lt;br&amp;gt;&lt;br /&gt;
reviewee_id = &amp;lt;target_reviewee&amp;gt;.id ; &amp;lt;br&amp;gt;&lt;br /&gt;
Note: The response map is setup to determine the relationship between reviewer and reviewee of an assignment.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
Response_maps:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  # response_map_&amp;lt;i&amp;gt;_&amp;lt;j&amp;gt; means response of reviewer #j to reviewee #i. &lt;br /&gt;
  @response_map_1_1 = create(:review_response_map, reviewer_id: @reviewer_1.id, reviewee_id: @reviewee_1.id)&lt;br /&gt;
  @response_map_1_2 = create(:review_response_map, reviewer_id: @reviewer_2.id, reviewee_id: @reviewee_1.id)&lt;br /&gt;
  @response_map_1_3 = create(:review_response_map, reviewer_id: @reviewer_3.id, reviewee_id: @reviewee_1.id)&lt;br /&gt;
&lt;br /&gt;
  @response_map_2_1 = create(:review_response_map, reviewer_id: @reviewer_1.id, reviewee_id: @reviewee_2.id)&lt;br /&gt;
  @response_map_2_2 = create(:review_response_map, reviewer_id: @reviewer_2.id, reviewee_id: @reviewee_2.id)&lt;br /&gt;
  @response_map_2_3 = create(:review_response_map, reviewer_id: @reviewer_3.id, reviewee_id: @reviewee_2.id)&lt;br /&gt;
&lt;br /&gt;
  @response_map_3_1 = create(:review_response_map, reviewer_id: @reviewer_1.id, reviewee_id: @reviewee_3.id)&lt;br /&gt;
  @response_map_3_2 = create(:review_response_map, reviewer_id: @reviewer_2.id, reviewee_id: @reviewee_3.id)&lt;br /&gt;
  @response_map_3_3 = create(:review_response_map, reviewer_id: @reviewer_3.id, reviewee_id: @reviewee_3.id)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Responses:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  # response_&amp;lt;i&amp;gt;_&amp;lt;j&amp;gt; means response of reviewer #j to reviewee #i. &lt;br /&gt;
  @response_1_1 = create(:response, is_submitted: true, map_id: @response_map_1_1.id)&lt;br /&gt;
  @response_1_2 = create(:response, is_submitted: true, map_id: @response_map_1_2.id)&lt;br /&gt;
  @response_1_3 = create(:response, is_submitted: true, map_id: @response_map_1_3.id)&lt;br /&gt;
&lt;br /&gt;
  @response_2_1 = create(:response, is_submitted: true, map_id: @response_map_2_1.id)&lt;br /&gt;
  @response_2_2 = create(:response, is_submitted: true, map_id: @response_map_2_2.id)&lt;br /&gt;
  @response_2_3 = create(:response, is_submitted: true, map_id: @response_map_2_3.id)&lt;br /&gt;
&lt;br /&gt;
  @response_3_1 = create(:response, is_submitted: true, map_id: @response_map_3_1.id)&lt;br /&gt;
  @response_3_2 = create(:response, is_submitted: true, map_id: @response_map_3_2.id)&lt;br /&gt;
  @response_3_3 = create(:response, is_submitted: true, map_id: @response_map_3_3.id)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Relevant Methods ===&lt;br /&gt;
==== db_query ====&lt;br /&gt;
This is the normal db query method, call this method will return peer review grades with given assignment id.&lt;br /&gt;
We will test this method in two aspect. &lt;br /&gt;
1. Test whether or not the grade return is right based on the specified algorithm.&lt;br /&gt;
2. We need to test the correctness of the query.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context 'test db_query' do&lt;br /&gt;
    it 'return average score' do&lt;br /&gt;
      # reivewer_1's review for reviewee_1: [1, 2, 3, 4, 5]&lt;br /&gt;
      # create 5 answers for 5 related questions&lt;br /&gt;
&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_1.id, answer: 1)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_1.id, answer: 2)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_1.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_1.id, answer: 4)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      result = ReputationWebServiceController.new.db_query(1, 1, false)&lt;br /&gt;
      #expect to see a data array return generated by the score given.&lt;br /&gt;
      expect(result).to eq([[2, 1, 60.0]])&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== json_generator ====&lt;br /&gt;
This method will generate the hash format of the review, we will test this method by calling to and convert the result to json format the print to test its correctness.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context 'test json_generator' do&lt;br /&gt;
    it 'test 3 reviewer for one reviewee' do&lt;br /&gt;
      # reivewer_1's review for reviewee_1: [5, 5, 5, 5, 5]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
&lt;br /&gt;
      # reivewer_2's review for reviewee_1: [3, 3, 3, 3, 3]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
&lt;br /&gt;
      # reivewer_3's review for reviewee_1: [1, 1, 1, 1, 1]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
&lt;br /&gt;
      result = ReputationWebServiceController.new.json_generator(1, 0, 1)&lt;br /&gt;
      expect(result).to eq({&amp;quot;submission1&amp;quot;=&amp;gt;{&amp;quot;stu2&amp;quot;=&amp;gt;100.0, &amp;quot;stu3&amp;quot;=&amp;gt;60.0, &amp;quot;stu4&amp;quot;=&amp;gt;20.0}})&lt;br /&gt;
      #repeat for different answers&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'test same reviewer for different reviewee' do&lt;br /&gt;
      # reivewer_1's review for reviewee_1: [5, 5, 5, 5, 5]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
&lt;br /&gt;
      # reivewer_1's review for reviewee_2: [3, 3, 3, 3, 3]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
&lt;br /&gt;
      result = ReputationWebServiceController.new.json_generator(1, 0, 1)&lt;br /&gt;
      expect(result).to eq(&amp;quot;submission1&amp;quot;=&amp;gt;{&amp;quot;stu2&amp;quot;=&amp;gt;100.0}, &amp;quot;submission2&amp;quot;=&amp;gt;{&amp;quot;stu2&amp;quot;=&amp;gt;60.0})&lt;br /&gt;
      #repeat for different answers&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== send_post_request ==== &lt;br /&gt;
This method send a post request to peerlogic.csc.ncsu.edu/reputation/calculations/reputation_algorithms to calculate get the reputation result and use show the result in corresponding UI and update given reviewer's reputation. We will test this method based on the algorithm in the paper, first to test the result reputation value, second to test the update value in database.&lt;br /&gt;
&lt;br /&gt;
Note that this method is not functioning due to the missing public &amp;amp; private key file for RSA encryption. The algorithm involving &amp;quot;expert grade&amp;quot; was also not implemented. &lt;br /&gt;
Thus, this method could not be properly tested. However we have given the template to create tests for future use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context 'test send_post_request' do&lt;br /&gt;
    it 'failed because of no public key file' do&lt;br /&gt;
      # reivewer_1's review for reviewee_1: [5, 5, 5, 5, 5]&lt;br /&gt;
      # create 5 answers for 5 related questions&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
&lt;br /&gt;
      # choose hammer algorithm without expert grade(intructor's given grade)&lt;br /&gt;
      params = {assignment_id: 1, round_num: 1, algorithm: 'hammer', checkbox: {expert_grade: &amp;quot;empty&amp;quot;}}&lt;br /&gt;
      session = {user: build(:instructor, id: 1)}&lt;br /&gt;
&lt;br /&gt;
      expect(true).to eq(true)&lt;br /&gt;
&lt;br /&gt;
      # comment out because send_post_request method request public key file while this file is missing&lt;br /&gt;
      # so at this time send_post_request is not functioning normally&lt;br /&gt;
      # if it functions correctly, it will update the reviewer's reputation score according to the selected reputation algorithm.&lt;br /&gt;
&lt;br /&gt;
      # get :send_post_request, params, session&lt;br /&gt;
      # expect(response).to redirect_to '/reputation_web_service/client'&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== aes_encrypt &amp;amp; aes_decrypt ==== &lt;br /&gt;
&lt;br /&gt;
These two methods are counterparts of each other.  Instead of testing them separately, we test both in the '''same''' rspect context. We generate a random string mixed with numbers and then encrypt it with the method &amp;lt;code&amp;gt;aes_encrypt&amp;lt;/code&amp;gt; and receive the tuple &amp;lt;code&amp;gt;[cipher, key, iv]&amp;lt;/code&amp;gt;. Then the test invokes the &amp;lt;code&amp;gt;aes_decrypt&amp;lt;/code&amp;gt; method with the tuples to retrieve the plain text. Finally, the test checks whether the decrypted text is the same as the original random data. The test covers both the &amp;lt;code&amp;gt;aes_encrypt&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;aes_decrpyt&amp;lt;/code&amp;gt; methods in the reputation web service controller.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
context 'test aes_decrypt' do&lt;br /&gt;
  it 'return the correct plain text' do&lt;br /&gt;
    data = (0...8).map { (65 + rand(26)).chr }.join&lt;br /&gt;
    cipher, key, iv = ReputationWebServiceController.new.aes_encrypt(data)&lt;br /&gt;
    plain = ReputationWebServiceController.new.aes_decrypt(cipher, key, iv)&lt;br /&gt;
    expect(plain).to eq(data)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
=== Testing Results ===&lt;br /&gt;
&lt;br /&gt;
All of current examples passed the test. There are '''5''' examples in the &amp;lt;code&amp;gt;reputation_web_service_controller_spec.rb&amp;lt;/code&amp;gt; file and there is no failure.&lt;br /&gt;
&lt;br /&gt;
[[File:E2168-test-passed.png|600px]]&lt;br /&gt;
&lt;br /&gt;
There are total '''10''' method in the &amp;lt;code&amp;gt;reputation_web_service_controller.rb&amp;lt;/code&amp;gt; controller:&lt;br /&gt;
&lt;br /&gt;
# action_allowed?&lt;br /&gt;
# db_query&lt;br /&gt;
# db_query_with_quiz_score&lt;br /&gt;
# json_generator&lt;br /&gt;
# client&lt;br /&gt;
# send_post_request&lt;br /&gt;
# rsa_public_key1&lt;br /&gt;
# rsa_private_key2&lt;br /&gt;
# aes_encrypt&lt;br /&gt;
# aes_decrypt&lt;br /&gt;
&lt;br /&gt;
Our test covers '''7''' of them: &lt;br /&gt;
&lt;br /&gt;
# action_allowed?&lt;br /&gt;
# db_query&lt;br /&gt;
# json_generator&lt;br /&gt;
# client&lt;br /&gt;
# send_post_request&lt;br /&gt;
# aes_encrypt&lt;br /&gt;
# aes_decrypt&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;rsa_public_key1&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;rsa_public_key2&amp;lt;/code&amp;gt; methods requires the public key file 	&lt;br /&gt;
'''''public1.pem''''' and the private key file '''''private1.pem'''''. However, these two files are missing and therefore we could not test the related two methods.&lt;br /&gt;
&lt;br /&gt;
=== Coverage ===&lt;br /&gt;
The test coverage boosts from '''0%''' to '''50.31%'''.&lt;br /&gt;
&lt;br /&gt;
[[File:Test-coverage.png|1080px]]&lt;br /&gt;
&lt;br /&gt;
There is no testing implemented for the &amp;lt;code&amp;gt;reputation_web_service_controller.rb&amp;lt;/code&amp;gt; prior to our work and therefore the previous testing coverage is '''0%'''.&lt;br /&gt;
&lt;br /&gt;
From the coverage report generated by the &amp;lt;code&amp;gt;Simplecov&amp;lt;/code&amp;gt; gem, there are '''80''' lines covered by our test. As for the residual '''72''' lines of code, they are related to the public key file and deprecated functions for gathering data for a paper [https://doi.org/10.1109/FIE.2015.7344292] published in 2015.&lt;br /&gt;
&lt;br /&gt;
The code &amp;lt;code&amp;gt;case&amp;lt;/code&amp;gt; under the first &amp;lt;code&amp;gt;if&amp;lt;/code&amp;gt; statement in the &amp;lt;code&amp;gt;send_post_request&amp;lt;/code&amp;gt; method of the &amp;lt;code&amp;gt;reputation_web_service_controller.rb&amp;lt;/code&amp;gt; should be removed. The team in Fall 2020 [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2020_-_E2064._Refactor_reputation_web_service_controller.rb#Issues_to_be_fixed] also mentioned the issues.&lt;br /&gt;
&lt;br /&gt;
If the redundant method &amp;lt;code&amp;gt;send_post-request&amp;lt;/code&amp;gt; in the controller &amp;lt;code&amp;gt;reputation_web_service_controller.rb&amp;lt;/code&amp;gt; is commented out, the test coverage can achieve '''52.63%'''.&lt;br /&gt;
&lt;br /&gt;
[[File:Coverage-more.png|1080px]]&lt;br /&gt;
&lt;br /&gt;
=== Relevant Links ===&lt;br /&gt;
#[https://github.com/HenryChen34/expertiza/tree/beta Github Repo]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2128 Pull Request]&lt;br /&gt;
#[https://youtu.be/sL0xQTol61w Demo Video]&lt;br /&gt;
&lt;br /&gt;
== Future Tasks ==&lt;br /&gt;
As our team could not obtain the public/private key pair to access the reputation web service, we were only able get to the step prior to sending the JSON to the web service of reputation algorithms. Therefore, future steps are required to test on reputation system. &lt;br /&gt;
&lt;br /&gt;
# In send_post_request, there are references to specific assignments, such as 724, 735, and 756. They were put in to gather data for a paper published in 2015. They are no longer relevant and should be removed. &lt;br /&gt;
# Implement reputation score correctness test for both Lauw's and Hamer's Algorithm assuming reputation web service available in the future.  &lt;br /&gt;
# Current test cases are implemented only based on round 1 reputation scoring even though the assignment_1 and assignment_2 are subjective to be 2 rounds of review assignment. As the result of no accessibility to reputation web service, creation of round 2 object is meaningless because of the absence of round 1 reputation score. Therefore, future test cases need to stub the behavior of fulfilling assignment_questionnaire_1_2 (2nd round questionnaire) and assignment_questionnaire_2_2 (2nd round questionnaire) respectively assuming reputation web service available that time.  &lt;br /&gt;
# The db_query violates the DRY principle as it repetitively calculates sum of the assignment. Such sum calculation should be handled in the assignment.rb.&lt;br /&gt;
&lt;br /&gt;
== Collaborators ==&lt;br /&gt;
Jinku Cui (jcui23)&lt;br /&gt;
&lt;br /&gt;
Henry Chen (hchen34)&lt;br /&gt;
&lt;br /&gt;
Dong Li (dli35)&lt;br /&gt;
&lt;br /&gt;
Zijun Lu (zlu5)&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[https://doi.org/10.1109/FIE.2015.7344292 Pluggable reputation systems for peer review: A web-service approach]&lt;/div&gt;</summary>
		<author><name>Hchen34</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2168._Testing_-_Reputations&amp;diff=142651</id>
		<title>CSC/ECE 517 Fall 2021 - E2168. Testing - Reputations</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2168._Testing_-_Reputations&amp;diff=142651"/>
		<updated>2021-12-01T04:03:28Z</updated>

		<summary type="html">&lt;p&gt;Hchen34: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Project Overview ==&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;q&amp;gt;Online peer-review systems are now in common use in higher education. They free the instructor and course staff from having to provide personally all the feedback that students receive on their work. However, if we want to assure that all students receive competent feedback, or even use peer-assigned grades, we need a way to judge which peer reviewers are most credible. The solution is to use a reputation system.&amp;lt;/q&amp;gt; &amp;lt;br&amp;gt; The reputation system is meant to provide objective value to student assigned peer review scores. Students select from a list of tasks to be performed and then prepare their work and submit it to a peer-review system. The work is then reviewed by other students who offer comments/graded feedback to help the submitters improve their work.&lt;br /&gt;
During the peer review period it is important to determine which reviews are more accurate and show higher quality. Reputation is one way to achieve this goal; it is a quantization measurement to judge which peer reviewers are more reliable.&lt;br /&gt;
Peer reviewers can use expertiza to score an author. If Expertiza shows a confidence ratings for grades based upon the reviewers reputation then authors can more easily determine the legitimacy of the peer assigned score. In addition, the teaching staff can examine the quality of each peer review based on reputation values and, potentially, crowd-source a significant portion of the grading function.&lt;br /&gt;
Currently the reputation system is implemented in Expertiza through web-service, but there's no test written for it. Thus our goal is to set up assignments and reviews that would produce specific reputation scores, and test that the correct reputations are in fact being produced.&lt;br /&gt;
&lt;br /&gt;
=== System Design ===&lt;br /&gt;
The below is referenced from project E1625, which would give us the overall description of the reputation system.&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Diagram E1625.png|1000px]]&amp;lt;br&amp;gt;&lt;br /&gt;
There are two algorithms intended for use in calculation of the reputation values for participants. &lt;br /&gt;
&lt;br /&gt;
There is a [https://expertiza.ncsu.edu/reputation_web_service/client web-service] (the link accessible only to the instructors) available which serves a JSON response containing the reputation value based on the seed provided in the form of the last known reputation value which we store in the ''participants'' table. An instructor can specify which algorithm to use for a particular assignment to calculate the confidence rating. &lt;br /&gt;
&lt;br /&gt;
As the [https://docs.google.com/viewer?url=https%3A%2F%2Fwww.researchgate.net%2Fprofile%2FYang_Song36%2Fpublication%2F289528736_Pluggable_Reputation_Systems_for_Peer_Review_a_Web-Service_Approach%2Flinks%2F568ec8d008ae78cc05160aed.pdf%3FinViewer%3D0%26pdfJsDownload%3D0%26origin%3Dpublication_detail paper] on reputation system by observes, “the Hamer-peer algorithm has the lowest maximum absolute bias and the Lauw-peer algorithm has the lowest overall bias.This indicates, from the instructor’s perspective, if there are further assignments of this kind, expert grading may not be necessary.”&lt;br /&gt;
:;Reputation range of Hamer’s algorithm is :&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: red;&amp;quot;&amp;gt;red&amp;lt;/span&amp;gt;                   value &amp;lt; 0.5&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: yellow&amp;quot;&amp;gt;yellow&amp;lt;/span&amp;gt;              value is &amp;gt;= 0.5 and &amp;lt;= 1&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: orange&amp;quot;&amp;gt;orange&amp;lt;/span&amp;gt;             value is &amp;gt; 1 and &amp;lt;= 1.5&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: HoneyDew&amp;quot;&amp;gt;light green&amp;lt;/span&amp;gt;       value is &amp;gt; 1.5 and &amp;lt;= 2&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: Chartreuse&amp;quot;&amp;gt;green&amp;lt;/span&amp;gt;               value is &amp;gt; 2&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The main difference between the Hamer-peer and the Lauw-peer algorithm is that the Lauw-peer algorithm keeps track of the reviewer's leniency (“bias”), which can be either positive or negative. A positive leniency indicates the reviewer tends to give higher scores than average.  This project determines reputation by subtracting the absolute value of the leniency from 1. Additionally, the range for Hamer’s algorithm is (0,∞) while for Lauw’s algorithm it is [0,1]. &lt;br /&gt;
:;Reputation range of Lauw’s algorithm is&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: red&amp;quot;&amp;gt;red&amp;lt;/span&amp;gt;                   value is &amp;lt; 0.2&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: yellow&amp;quot;&amp;gt;yellow&amp;lt;/span&amp;gt;              value is &amp;gt;= 0.2 and &amp;lt;= 0.4&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: orange&amp;quot;&amp;gt;orange&amp;lt;/span&amp;gt;             value is &amp;gt; 0.4 and &amp;lt;= 0.6&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: HoneyDew&amp;quot;&amp;gt;light green&amp;lt;/span&amp;gt;       value is &amp;gt; 0.6 and &amp;lt;= 0.8&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: Chartreuse&amp;quot;&amp;gt;green&amp;lt;/span&amp;gt;               value is &amp;gt; 0.8&lt;br /&gt;
&lt;br /&gt;
The instructor can choose to show results from Hamer’s algorithm or Lauw’s algorithm. The default algorithm should be Lauw’s algorithm.&lt;br /&gt;
&lt;br /&gt;
=== Objectives ===&lt;br /&gt;
&lt;br /&gt;
Our objectives for this project are the following:&lt;br /&gt;
* Double and stub an assignment, a few submissions to the assignment, under different review rubrics&lt;br /&gt;
* Manually calculate reputation scores based on paper &amp;quot;Pluggable reputation systems for peer review: A web-service approach&amp;quot;&lt;br /&gt;
* Validate correct reputation scores based on different review rubrics generated by reputation management VS manual computation of reputation score using the Hamer's and Lauw's algorithm.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
*reputation_web_service_controller_spec&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
=== Setup Testing Objects ===&lt;br /&gt;
In order to implement testing on reputation, it is crucial to create sample reviews so that we could possibly obtain reputation score. During the kickoff meeting, our team defined four necessary steps to follow for the purpose of testing. Also, appropriate objects could be created and confined as discussed below.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The manifestation of each object will contribute to the success of the following test on reputations. Some fields in each object can be empty or have default values. Some attributes are not relevant to the test. When implementing the test, the test scripts need to generate or set fixed values for corresponding fields.&lt;br /&gt;
&lt;br /&gt;
==== Assignment ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[assignments]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Essential Parameters to be configured&amp;lt;br&amp;gt;&lt;br /&gt;
submitter_count = 0;&amp;lt;br&amp;gt;&lt;br /&gt;
num_reviews = 5;&amp;lt;br&amp;gt;&lt;br /&gt;
num_reviewers = 5;&amp;lt;br&amp;gt;&lt;br /&gt;
num_reviews_allowed = 5;&amp;lt;br&amp;gt;&lt;br /&gt;
rounds_of_reviews = 2;&amp;lt;br&amp;gt;&lt;br /&gt;
reputation_algorithm = lauw/hamer;&amp;lt;br&amp;gt;&lt;br /&gt;
Note: Two assignment objects were created. Assignment_1 used lauw's algorithm, whereas assignment_2 used hamer's alogorithm.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @assignment_1 = create(:assignment, created_at: DateTime.now.in_time_zone - 13.day, submitter_count: 0, num_reviews: 3, num_reviewers: 5, num_reviews_allowed: 5, rounds_of_reviews: 2, reputation_algorithm: 'lauw', id: 1)&lt;br /&gt;
  @assignment_2 = create(:assignment, created_at: DateTime.now.in_time_zone - 13.day, submitter_count: 0, num_reviews: 3, num_reviewers: 5, num_reviews_allowed: 5, rounds_of_reviews: 2, reputation_algorithm: 'hamer', id: 2)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Questionnaires(Rubrics) ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[questionnaires]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[assignment_questionnaires]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Essential Parameters to be configured&amp;lt;br&amp;gt;&lt;br /&gt;
min_question_score = 0;&amp;lt;br&amp;gt;&lt;br /&gt;
max_question_score = 5;&amp;lt;br&amp;gt;&lt;br /&gt;
type = ReviewQuestionnaire;&amp;lt;br&amp;gt;&lt;br /&gt;
Note: We will define the assignment with ReviewQuestionnaire type rubric. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @questionnaire_1 = create(:questionnaire, min_question_score: 0, max_question_score: 5, type: 'ReviewQuestionnaire', id: 1)&lt;br /&gt;
  # assignment_questionnaire_&amp;lt;i&amp;gt;_&amp;lt;j&amp;gt; means assignment #I'd #j th round of review.&lt;br /&gt;
  @assignment_questionnaire_1_1 = create(:assignment_questionnaire, assignment_id: @assignment_1.id, questionnaire_id: @questionnaire_1.id, used_in_round: 1)&lt;br /&gt;
  @assignment_questionnaire_1_2 = create(:assignment_questionnaire, assignment_id: @assignment_1.id, questionnaire_id: @questionnaire_1.id, used_in_round: 2)&lt;br /&gt;
  @assignment_questionnaire_2_1 = create(:assignment_questionnaire, assignment_id: @assignment_2.id, questionnaire_id: @questionnaire_1.id, used_in_round: 1)&lt;br /&gt;
  @assignment_questionnaire_2_2 = create(:assignment_questionnaire, assignment_id: @assignment_2.id, questionnaire_id: @questionnaire_1.id, used_in_round: 2)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Questions under Questionnaires ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[questions]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  # question_i_j means question #j in questionnaire #i.&lt;br /&gt;
  @question_1_1 = create(:question, questionnaire_id: @questionnaire_1.id, id: 1)&lt;br /&gt;
  @question_1_2 = create(:question, questionnaire_id: @questionnaire_1.id, id: 2)&lt;br /&gt;
  @question_1_3 = create(:question, questionnaire_id: @questionnaire_1.id, id: 3)&lt;br /&gt;
  @question_1_4 = create(:question, questionnaire_id: @questionnaire_1.id, id: 4)&lt;br /&gt;
  @question_1_5 = create(:question, questionnaire_id: @questionnaire_1.id, id: 5)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Reviewers and Reviewees ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[participants]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[teams]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
Reviewers (Participant):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @reviewer_1 = create(:participant, can_review: 1)&lt;br /&gt;
  @reviewer_2 = create(:participant, can_review: 1)&lt;br /&gt;
  @reviewer_3 = create(:participant, can_review: 1)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Reviewees (Teams):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @reviewee_1 = create(:assignment_team, assignment: @assignment)&lt;br /&gt;
  @reviewee_2 = create(:assignment_team, assignment: @assignment)&lt;br /&gt;
  @reviewee_3 = create(:assignment_team, assignment: @assignment)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Responses ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[response_maps]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[responses]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Essential Parameters to be configured&amp;lt;br&amp;gt;&lt;br /&gt;
reviewed_object_id = &amp;lt;target_assignment&amp;gt;.id ; &amp;lt;br&amp;gt;&lt;br /&gt;
reviewer_id = &amp;lt;target_reviewer&amp;gt;.id ; &amp;lt;br&amp;gt;&lt;br /&gt;
reviewee_id = &amp;lt;target_reviewee&amp;gt;.id ; &amp;lt;br&amp;gt;&lt;br /&gt;
Note: The response map is setup to determine the relationship between reviewer and reviewee of an assignment.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
Response_maps:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  # response_map_&amp;lt;i&amp;gt;_&amp;lt;j&amp;gt; means response of reviewer #j to reviewee #i. &lt;br /&gt;
  @response_map_1_1 = create(:review_response_map, reviewer_id: @reviewer_1.id, reviewee_id: @reviewee_1.id)&lt;br /&gt;
  @response_map_1_2 = create(:review_response_map, reviewer_id: @reviewer_2.id, reviewee_id: @reviewee_1.id)&lt;br /&gt;
  @response_map_1_3 = create(:review_response_map, reviewer_id: @reviewer_3.id, reviewee_id: @reviewee_1.id)&lt;br /&gt;
&lt;br /&gt;
  @response_map_2_1 = create(:review_response_map, reviewer_id: @reviewer_1.id, reviewee_id: @reviewee_2.id)&lt;br /&gt;
  @response_map_2_2 = create(:review_response_map, reviewer_id: @reviewer_2.id, reviewee_id: @reviewee_2.id)&lt;br /&gt;
  @response_map_2_3 = create(:review_response_map, reviewer_id: @reviewer_3.id, reviewee_id: @reviewee_2.id)&lt;br /&gt;
&lt;br /&gt;
  @response_map_3_1 = create(:review_response_map, reviewer_id: @reviewer_1.id, reviewee_id: @reviewee_3.id)&lt;br /&gt;
  @response_map_3_2 = create(:review_response_map, reviewer_id: @reviewer_2.id, reviewee_id: @reviewee_3.id)&lt;br /&gt;
  @response_map_3_3 = create(:review_response_map, reviewer_id: @reviewer_3.id, reviewee_id: @reviewee_3.id)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Responses:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  # response_&amp;lt;i&amp;gt;_&amp;lt;j&amp;gt; means response of reviewer #j to reviewee #i. &lt;br /&gt;
  @response_1_1 = create(:response, is_submitted: true, map_id: @response_map_1_1.id)&lt;br /&gt;
  @response_1_2 = create(:response, is_submitted: true, map_id: @response_map_1_2.id)&lt;br /&gt;
  @response_1_3 = create(:response, is_submitted: true, map_id: @response_map_1_3.id)&lt;br /&gt;
&lt;br /&gt;
  @response_2_1 = create(:response, is_submitted: true, map_id: @response_map_2_1.id)&lt;br /&gt;
  @response_2_2 = create(:response, is_submitted: true, map_id: @response_map_2_2.id)&lt;br /&gt;
  @response_2_3 = create(:response, is_submitted: true, map_id: @response_map_2_3.id)&lt;br /&gt;
&lt;br /&gt;
  @response_3_1 = create(:response, is_submitted: true, map_id: @response_map_3_1.id)&lt;br /&gt;
  @response_3_2 = create(:response, is_submitted: true, map_id: @response_map_3_2.id)&lt;br /&gt;
  @response_3_3 = create(:response, is_submitted: true, map_id: @response_map_3_3.id)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Relevant Methods ===&lt;br /&gt;
==== db_query ====&lt;br /&gt;
This is the normal db query method, call this method will return peer review grades with given assignment id.&lt;br /&gt;
We will test this method in two aspect. &lt;br /&gt;
1. Test whether or not the grade return is right based on the specified algorithm.&lt;br /&gt;
2. We need to test the correctness of the query.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context 'test db_query' do&lt;br /&gt;
    it 'return average score' do&lt;br /&gt;
      # reivewer_1's review for reviewee_1: [1, 2, 3, 4, 5]&lt;br /&gt;
      # create 5 answers for 5 related questions&lt;br /&gt;
&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_1.id, answer: 1)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_1.id, answer: 2)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_1.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_1.id, answer: 4)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      result = ReputationWebServiceController.new.db_query(1, 1, false)&lt;br /&gt;
      #expect to see a data array return generated by the score given.&lt;br /&gt;
      expect(result).to eq([[2, 1, 60.0]])&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== json_generator ====&lt;br /&gt;
This method will generate the hash format of the review, we will test this method by calling to and convert the result to json format the print to test its correctness.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context 'test json_generator' do&lt;br /&gt;
    it 'test 3 reviewer for one reviewee' do&lt;br /&gt;
      # reivewer_1's review for reviewee_1: [5, 5, 5, 5, 5]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
&lt;br /&gt;
      # reivewer_2's review for reviewee_1: [3, 3, 3, 3, 3]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
&lt;br /&gt;
      # reivewer_3's review for reviewee_1: [1, 1, 1, 1, 1]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
&lt;br /&gt;
      result = ReputationWebServiceController.new.json_generator(1, 0, 1)&lt;br /&gt;
      expect(result).to eq({&amp;quot;submission1&amp;quot;=&amp;gt;{&amp;quot;stu2&amp;quot;=&amp;gt;100.0, &amp;quot;stu3&amp;quot;=&amp;gt;60.0, &amp;quot;stu4&amp;quot;=&amp;gt;20.0}})&lt;br /&gt;
      #repeat for different answers&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'test same reviewer for different reviewee' do&lt;br /&gt;
      # reivewer_1's review for reviewee_1: [5, 5, 5, 5, 5]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
&lt;br /&gt;
      # reivewer_1's review for reviewee_2: [3, 3, 3, 3, 3]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
&lt;br /&gt;
      result = ReputationWebServiceController.new.json_generator(1, 0, 1)&lt;br /&gt;
      expect(result).to eq(&amp;quot;submission1&amp;quot;=&amp;gt;{&amp;quot;stu2&amp;quot;=&amp;gt;100.0}, &amp;quot;submission2&amp;quot;=&amp;gt;{&amp;quot;stu2&amp;quot;=&amp;gt;60.0})&lt;br /&gt;
      #repeat for different answers&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== send_post_request ==== &lt;br /&gt;
This method send a post request to peerlogic.csc.ncsu.edu/reputation/calculations/reputation_algorithms to calculate get the reputation result and use show the result in corresponding UI and update given reviewer's reputation. We will test this method based on the algorithm in the paper, first to test the result reputation value, second to test the update value in database.&lt;br /&gt;
&lt;br /&gt;
Note that this method is not functioning due to the missing public &amp;amp; private key file for RSA encryption. The algorithm involving &amp;quot;expert grade&amp;quot; was also not implemented. &lt;br /&gt;
Thus, this method could not be properly tested. However we have given the template to create tests for future use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context 'test send_post_request' do&lt;br /&gt;
    it 'failed because of no public key file' do&lt;br /&gt;
      # reivewer_1's review for reviewee_1: [5, 5, 5, 5, 5]&lt;br /&gt;
      # create 5 answers for 5 related questions&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
&lt;br /&gt;
      # choose hammer algorithm without expert grade(intructor's given grade)&lt;br /&gt;
      params = {assignment_id: 1, round_num: 1, algorithm: 'hammer', checkbox: {expert_grade: &amp;quot;empty&amp;quot;}}&lt;br /&gt;
      session = {user: build(:instructor, id: 1)}&lt;br /&gt;
&lt;br /&gt;
      expect(true).to eq(true)&lt;br /&gt;
&lt;br /&gt;
      # comment out because send_post_request method request public key file while this file is missing&lt;br /&gt;
      # so at this time send_post_request is not functioning normally&lt;br /&gt;
      # if it functions correctly, it will update the reviewer's reputation score according to the selected reputation algorithm.&lt;br /&gt;
&lt;br /&gt;
      # get :send_post_request, params, session&lt;br /&gt;
      # expect(response).to redirect_to '/reputation_web_service/client'&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== aes_encrypt &amp;amp; aes_decrypt ==== &lt;br /&gt;
&lt;br /&gt;
These two methods are counterparts of each other.  Instead of testing them separately, we test both in the '''same''' rspect context. We generate a random string mixed with numbers and then encrypt it with the method &amp;lt;code&amp;gt;aes_encrypt&amp;lt;/code&amp;gt; and receive the tuple &amp;lt;code&amp;gt;[cipher, key, iv]&amp;lt;/code&amp;gt;. Then the test invokes the &amp;lt;code&amp;gt;aes_decrypt&amp;lt;/code&amp;gt; method with the tuples to retrieve the plain text. Finally, the test checks whether the decrypted text is the same as the original random data. The test covers both the &amp;lt;code&amp;gt;aes_encrypt&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;aes_decrpyt&amp;lt;/code&amp;gt; methods in the reputation web service controller.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
context 'test aes_decrypt' do&lt;br /&gt;
  it 'return the correct plain text' do&lt;br /&gt;
    data = (0...8).map { (65 + rand(26)).chr }.join&lt;br /&gt;
    cipher, key, iv = ReputationWebServiceController.new.aes_encrypt(data)&lt;br /&gt;
    plain = ReputationWebServiceController.new.aes_decrypt(cipher, key, iv)&lt;br /&gt;
    expect(plain).to eq(data)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
=== Testing Results ===&lt;br /&gt;
&lt;br /&gt;
All of current examples passed the test. There are '''5''' examples in the &amp;lt;code&amp;gt;reputation_web_service_controller_spec.rb&amp;lt;/code&amp;gt; file and there is no failure.&lt;br /&gt;
&lt;br /&gt;
[[File:E2168-test-passed.png|600px]]&lt;br /&gt;
&lt;br /&gt;
There are total '''10''' method in the &amp;lt;code&amp;gt;reputation_web_service_controller.rb&amp;lt;/code&amp;gt; controller:&lt;br /&gt;
&lt;br /&gt;
# action_allowed?&lt;br /&gt;
# db_query&lt;br /&gt;
# db_query_with_quiz_score&lt;br /&gt;
# json_generator&lt;br /&gt;
# client&lt;br /&gt;
# send_post_request&lt;br /&gt;
# rsa_public_key1&lt;br /&gt;
# rsa_private_key2&lt;br /&gt;
# aes_encrypt&lt;br /&gt;
# aes_decrypt&lt;br /&gt;
&lt;br /&gt;
Our test covers '''7''' of them: &lt;br /&gt;
&lt;br /&gt;
# action_allowed?&lt;br /&gt;
# db_query&lt;br /&gt;
# json_generator&lt;br /&gt;
# client&lt;br /&gt;
# send_post_request&lt;br /&gt;
# aes_encrypt&lt;br /&gt;
# aes_decrypt&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;rsa_public_key1&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;rsa_public_key2&amp;lt;/code&amp;gt; methods requires the public key file 	&lt;br /&gt;
'''''public1.pem''''' and the private key file '''''private1.pem'''''. However, these two files are missing and therefore we could not test the related two methods.&lt;br /&gt;
&lt;br /&gt;
=== Coverage ===&lt;br /&gt;
The test coverage boosts from '''0%''' to '''50.31%'''.&lt;br /&gt;
&lt;br /&gt;
[[File:Test-coverage.png|1080px]]&lt;br /&gt;
&lt;br /&gt;
There is no testing implemented for the &amp;lt;code&amp;gt;reputation_web_service_controller.rb&amp;lt;/code&amp;gt; prior to our work and therefore the previous testing coverage is '''0%'''.&lt;br /&gt;
&lt;br /&gt;
From the coverage report generated by the &amp;lt;code&amp;gt;Simplecov&amp;lt;/code&amp;gt; gem, there are '''80''' lines covered by our test. As for the residual '''72''' lines of code, they are related to the public key file and deprecated functions for gathering data for a paper [https://doi.org/10.1109/FIE.2015.7344292] published in 2015.&lt;br /&gt;
&lt;br /&gt;
The code &amp;lt;code&amp;gt;case&amp;lt;/code&amp;gt; under the first &amp;lt;code&amp;gt;if&amp;lt;/code&amp;gt; statement in the &amp;lt;code&amp;gt;send_post_request&amp;lt;/code&amp;gt; method of the &amp;lt;code&amp;gt;reputation_web_service_controller.rb&amp;lt;/code&amp;gt; should be removed. The team in Fall 2020 [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2020_-_E2064._Refactor_reputation_web_service_controller.rb#Issues_to_be_fixed] also mentioned the issues.&lt;br /&gt;
&lt;br /&gt;
If the redundant method &amp;lt;code&amp;gt;send_post-request&amp;lt;/code&amp;gt; in the controller &amp;lt;code&amp;gt;reputation_web_service_controller.rb&amp;lt;/code&amp;gt; is commented out, the test coverage can achieve '''52.63%'''.&lt;br /&gt;
&lt;br /&gt;
[[File:Coverage-more.png|1080px]]&lt;br /&gt;
&lt;br /&gt;
=== Relevant Links ===&lt;br /&gt;
Github Repo : [https://github.com/HenryChen34/expertiza/tree/beta]&lt;br /&gt;
&lt;br /&gt;
Pull request: [https://github.com/expertiza/expertiza/pull/2128]&lt;br /&gt;
&lt;br /&gt;
== Future Tasks ==&lt;br /&gt;
As our team could not obtain the public/private key pair to access the reputation web service, we were only able get to the step prior to sending the JSON to the web service of reputation algorithms. Therefore, future steps are required to test on reputation system. &lt;br /&gt;
&lt;br /&gt;
# In send_post_request, there are references to specific assignments, such as 724, 735, and 756. They were put in to gather data for a paper published in 2015. They are no longer relevant and should be removed. &lt;br /&gt;
# Implement reputation score correctness test for both Lauw's and Hamer's Algorithm assuming reputation web service available in the future.  &lt;br /&gt;
# Current test cases are implemented only based on round 1 reputation scoring even though the assignment_1 and assignment_2 are subjective to be 2 rounds of review assignment. As the result of no accessibility to reputation web service, creation of round 2 object is meaningless because of the absence of round 1 reputation score. Therefore, future test cases need to stub the behavior of fulfilling assignment_questionnaire_1_2 (2nd round questionnaire) and assignment_questionnaire_2_2 (2nd round questionnaire) respectively assuming reputation web service available that time.  &lt;br /&gt;
# The db_query violates the DRY principle as it repetitively calculates sum of the assignment. Such sum calculation should be handled in the assignment.rb.&lt;br /&gt;
&lt;br /&gt;
== Collaborators ==&lt;br /&gt;
Jinku Cui (jcui23)&lt;br /&gt;
&lt;br /&gt;
Henry Chen (hchen34)&lt;br /&gt;
&lt;br /&gt;
Dong Li (dli35)&lt;br /&gt;
&lt;br /&gt;
Zijun Lu (zlu5)&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[https://doi.org/10.1109/FIE.2015.7344292 Pluggable reputation systems for peer review: A web-service approach]&lt;br /&gt;
#[https://youtu.be/sL0xQTol61w Demo Video]&lt;/div&gt;</summary>
		<author><name>Hchen34</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2168._Testing_-_Reputations&amp;diff=142650</id>
		<title>CSC/ECE 517 Fall 2021 - E2168. Testing - Reputations</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2168._Testing_-_Reputations&amp;diff=142650"/>
		<updated>2021-12-01T04:02:53Z</updated>

		<summary type="html">&lt;p&gt;Hchen34: add demo video link&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Project Overview ==&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;q&amp;gt;Online peer-review systems are now in common use in higher education. They free the instructor and course staff from having to provide personally all the feedback that students receive on their work. However, if we want to assure that all students receive competent feedback, or even use peer-assigned grades, we need a way to judge which peer reviewers are most credible. The solution is to use a reputation system.&amp;lt;/q&amp;gt; &amp;lt;br&amp;gt; The reputation system is meant to provide objective value to student assigned peer review scores. Students select from a list of tasks to be performed and then prepare their work and submit it to a peer-review system. The work is then reviewed by other students who offer comments/graded feedback to help the submitters improve their work.&lt;br /&gt;
During the peer review period it is important to determine which reviews are more accurate and show higher quality. Reputation is one way to achieve this goal; it is a quantization measurement to judge which peer reviewers are more reliable.&lt;br /&gt;
Peer reviewers can use expertiza to score an author. If Expertiza shows a confidence ratings for grades based upon the reviewers reputation then authors can more easily determine the legitimacy of the peer assigned score. In addition, the teaching staff can examine the quality of each peer review based on reputation values and, potentially, crowd-source a significant portion of the grading function.&lt;br /&gt;
Currently the reputation system is implemented in Expertiza through web-service, but there's no test written for it. Thus our goal is to set up assignments and reviews that would produce specific reputation scores, and test that the correct reputations are in fact being produced.&lt;br /&gt;
&lt;br /&gt;
=== System Design ===&lt;br /&gt;
The below is referenced from project E1625, which would give us the overall description of the reputation system.&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Diagram E1625.png|1000px]]&amp;lt;br&amp;gt;&lt;br /&gt;
There are two algorithms intended for use in calculation of the reputation values for participants. &lt;br /&gt;
&lt;br /&gt;
There is a [https://expertiza.ncsu.edu/reputation_web_service/client web-service] (the link accessible only to the instructors) available which serves a JSON response containing the reputation value based on the seed provided in the form of the last known reputation value which we store in the ''participants'' table. An instructor can specify which algorithm to use for a particular assignment to calculate the confidence rating. &lt;br /&gt;
&lt;br /&gt;
As the [https://docs.google.com/viewer?url=https%3A%2F%2Fwww.researchgate.net%2Fprofile%2FYang_Song36%2Fpublication%2F289528736_Pluggable_Reputation_Systems_for_Peer_Review_a_Web-Service_Approach%2Flinks%2F568ec8d008ae78cc05160aed.pdf%3FinViewer%3D0%26pdfJsDownload%3D0%26origin%3Dpublication_detail paper] on reputation system by observes, “the Hamer-peer algorithm has the lowest maximum absolute bias and the Lauw-peer algorithm has the lowest overall bias.This indicates, from the instructor’s perspective, if there are further assignments of this kind, expert grading may not be necessary.”&lt;br /&gt;
:;Reputation range of Hamer’s algorithm is :&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: red;&amp;quot;&amp;gt;red&amp;lt;/span&amp;gt;                   value &amp;lt; 0.5&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: yellow&amp;quot;&amp;gt;yellow&amp;lt;/span&amp;gt;              value is &amp;gt;= 0.5 and &amp;lt;= 1&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: orange&amp;quot;&amp;gt;orange&amp;lt;/span&amp;gt;             value is &amp;gt; 1 and &amp;lt;= 1.5&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: HoneyDew&amp;quot;&amp;gt;light green&amp;lt;/span&amp;gt;       value is &amp;gt; 1.5 and &amp;lt;= 2&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: Chartreuse&amp;quot;&amp;gt;green&amp;lt;/span&amp;gt;               value is &amp;gt; 2&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The main difference between the Hamer-peer and the Lauw-peer algorithm is that the Lauw-peer algorithm keeps track of the reviewer's leniency (“bias”), which can be either positive or negative. A positive leniency indicates the reviewer tends to give higher scores than average.  This project determines reputation by subtracting the absolute value of the leniency from 1. Additionally, the range for Hamer’s algorithm is (0,∞) while for Lauw’s algorithm it is [0,1]. &lt;br /&gt;
:;Reputation range of Lauw’s algorithm is&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: red&amp;quot;&amp;gt;red&amp;lt;/span&amp;gt;                   value is &amp;lt; 0.2&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: yellow&amp;quot;&amp;gt;yellow&amp;lt;/span&amp;gt;              value is &amp;gt;= 0.2 and &amp;lt;= 0.4&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: orange&amp;quot;&amp;gt;orange&amp;lt;/span&amp;gt;             value is &amp;gt; 0.4 and &amp;lt;= 0.6&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: HoneyDew&amp;quot;&amp;gt;light green&amp;lt;/span&amp;gt;       value is &amp;gt; 0.6 and &amp;lt;= 0.8&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: Chartreuse&amp;quot;&amp;gt;green&amp;lt;/span&amp;gt;               value is &amp;gt; 0.8&lt;br /&gt;
&lt;br /&gt;
The instructor can choose to show results from Hamer’s algorithm or Lauw’s algorithm. The default algorithm should be Lauw’s algorithm.&lt;br /&gt;
&lt;br /&gt;
=== Objectives ===&lt;br /&gt;
&lt;br /&gt;
Our objectives for this project are the following:&lt;br /&gt;
* Double and stub an assignment, a few submissions to the assignment, under different review rubrics&lt;br /&gt;
* Manually calculate reputation scores based on paper &amp;quot;Pluggable reputation systems for peer review: A web-service approach&amp;quot;&lt;br /&gt;
* Validate correct reputation scores based on different review rubrics generated by reputation management VS manual computation of reputation score using the Hamer's and Lauw's algorithm.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
*reputation_web_service_controller_spec&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
=== Setup Testing Objects ===&lt;br /&gt;
In order to implement testing on reputation, it is crucial to create sample reviews so that we could possibly obtain reputation score. During the kickoff meeting, our team defined four necessary steps to follow for the purpose of testing. Also, appropriate objects could be created and confined as discussed below.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The manifestation of each object will contribute to the success of the following test on reputations. Some fields in each object can be empty or have default values. Some attributes are not relevant to the test. When implementing the test, the test scripts need to generate or set fixed values for corresponding fields.&lt;br /&gt;
&lt;br /&gt;
==== Assignment ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[assignments]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Essential Parameters to be configured&amp;lt;br&amp;gt;&lt;br /&gt;
submitter_count = 0;&amp;lt;br&amp;gt;&lt;br /&gt;
num_reviews = 5;&amp;lt;br&amp;gt;&lt;br /&gt;
num_reviewers = 5;&amp;lt;br&amp;gt;&lt;br /&gt;
num_reviews_allowed = 5;&amp;lt;br&amp;gt;&lt;br /&gt;
rounds_of_reviews = 2;&amp;lt;br&amp;gt;&lt;br /&gt;
reputation_algorithm = lauw/hamer;&amp;lt;br&amp;gt;&lt;br /&gt;
Note: Two assignment objects were created. Assignment_1 used lauw's algorithm, whereas assignment_2 used hamer's alogorithm.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @assignment_1 = create(:assignment, created_at: DateTime.now.in_time_zone - 13.day, submitter_count: 0, num_reviews: 3, num_reviewers: 5, num_reviews_allowed: 5, rounds_of_reviews: 2, reputation_algorithm: 'lauw', id: 1)&lt;br /&gt;
  @assignment_2 = create(:assignment, created_at: DateTime.now.in_time_zone - 13.day, submitter_count: 0, num_reviews: 3, num_reviewers: 5, num_reviews_allowed: 5, rounds_of_reviews: 2, reputation_algorithm: 'hamer', id: 2)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Questionnaires(Rubrics) ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[questionnaires]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[assignment_questionnaires]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Essential Parameters to be configured&amp;lt;br&amp;gt;&lt;br /&gt;
min_question_score = 0;&amp;lt;br&amp;gt;&lt;br /&gt;
max_question_score = 5;&amp;lt;br&amp;gt;&lt;br /&gt;
type = ReviewQuestionnaire;&amp;lt;br&amp;gt;&lt;br /&gt;
Note: We will define the assignment with ReviewQuestionnaire type rubric. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @questionnaire_1 = create(:questionnaire, min_question_score: 0, max_question_score: 5, type: 'ReviewQuestionnaire', id: 1)&lt;br /&gt;
  # assignment_questionnaire_&amp;lt;i&amp;gt;_&amp;lt;j&amp;gt; means assignment #I'd #j th round of review.&lt;br /&gt;
  @assignment_questionnaire_1_1 = create(:assignment_questionnaire, assignment_id: @assignment_1.id, questionnaire_id: @questionnaire_1.id, used_in_round: 1)&lt;br /&gt;
  @assignment_questionnaire_1_2 = create(:assignment_questionnaire, assignment_id: @assignment_1.id, questionnaire_id: @questionnaire_1.id, used_in_round: 2)&lt;br /&gt;
  @assignment_questionnaire_2_1 = create(:assignment_questionnaire, assignment_id: @assignment_2.id, questionnaire_id: @questionnaire_1.id, used_in_round: 1)&lt;br /&gt;
  @assignment_questionnaire_2_2 = create(:assignment_questionnaire, assignment_id: @assignment_2.id, questionnaire_id: @questionnaire_1.id, used_in_round: 2)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Questions under Questionnaires ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[questions]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  # question_i_j means question #j in questionnaire #i.&lt;br /&gt;
  @question_1_1 = create(:question, questionnaire_id: @questionnaire_1.id, id: 1)&lt;br /&gt;
  @question_1_2 = create(:question, questionnaire_id: @questionnaire_1.id, id: 2)&lt;br /&gt;
  @question_1_3 = create(:question, questionnaire_id: @questionnaire_1.id, id: 3)&lt;br /&gt;
  @question_1_4 = create(:question, questionnaire_id: @questionnaire_1.id, id: 4)&lt;br /&gt;
  @question_1_5 = create(:question, questionnaire_id: @questionnaire_1.id, id: 5)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Reviewers and Reviewees ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[participants]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[teams]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
Reviewers (Participant):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @reviewer_1 = create(:participant, can_review: 1)&lt;br /&gt;
  @reviewer_2 = create(:participant, can_review: 1)&lt;br /&gt;
  @reviewer_3 = create(:participant, can_review: 1)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Reviewees (Teams):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @reviewee_1 = create(:assignment_team, assignment: @assignment)&lt;br /&gt;
  @reviewee_2 = create(:assignment_team, assignment: @assignment)&lt;br /&gt;
  @reviewee_3 = create(:assignment_team, assignment: @assignment)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Responses ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[response_maps]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[responses]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Essential Parameters to be configured&amp;lt;br&amp;gt;&lt;br /&gt;
reviewed_object_id = &amp;lt;target_assignment&amp;gt;.id ; &amp;lt;br&amp;gt;&lt;br /&gt;
reviewer_id = &amp;lt;target_reviewer&amp;gt;.id ; &amp;lt;br&amp;gt;&lt;br /&gt;
reviewee_id = &amp;lt;target_reviewee&amp;gt;.id ; &amp;lt;br&amp;gt;&lt;br /&gt;
Note: The response map is setup to determine the relationship between reviewer and reviewee of an assignment.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
Response_maps:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  # response_map_&amp;lt;i&amp;gt;_&amp;lt;j&amp;gt; means response of reviewer #j to reviewee #i. &lt;br /&gt;
  @response_map_1_1 = create(:review_response_map, reviewer_id: @reviewer_1.id, reviewee_id: @reviewee_1.id)&lt;br /&gt;
  @response_map_1_2 = create(:review_response_map, reviewer_id: @reviewer_2.id, reviewee_id: @reviewee_1.id)&lt;br /&gt;
  @response_map_1_3 = create(:review_response_map, reviewer_id: @reviewer_3.id, reviewee_id: @reviewee_1.id)&lt;br /&gt;
&lt;br /&gt;
  @response_map_2_1 = create(:review_response_map, reviewer_id: @reviewer_1.id, reviewee_id: @reviewee_2.id)&lt;br /&gt;
  @response_map_2_2 = create(:review_response_map, reviewer_id: @reviewer_2.id, reviewee_id: @reviewee_2.id)&lt;br /&gt;
  @response_map_2_3 = create(:review_response_map, reviewer_id: @reviewer_3.id, reviewee_id: @reviewee_2.id)&lt;br /&gt;
&lt;br /&gt;
  @response_map_3_1 = create(:review_response_map, reviewer_id: @reviewer_1.id, reviewee_id: @reviewee_3.id)&lt;br /&gt;
  @response_map_3_2 = create(:review_response_map, reviewer_id: @reviewer_2.id, reviewee_id: @reviewee_3.id)&lt;br /&gt;
  @response_map_3_3 = create(:review_response_map, reviewer_id: @reviewer_3.id, reviewee_id: @reviewee_3.id)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Responses:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  # response_&amp;lt;i&amp;gt;_&amp;lt;j&amp;gt; means response of reviewer #j to reviewee #i. &lt;br /&gt;
  @response_1_1 = create(:response, is_submitted: true, map_id: @response_map_1_1.id)&lt;br /&gt;
  @response_1_2 = create(:response, is_submitted: true, map_id: @response_map_1_2.id)&lt;br /&gt;
  @response_1_3 = create(:response, is_submitted: true, map_id: @response_map_1_3.id)&lt;br /&gt;
&lt;br /&gt;
  @response_2_1 = create(:response, is_submitted: true, map_id: @response_map_2_1.id)&lt;br /&gt;
  @response_2_2 = create(:response, is_submitted: true, map_id: @response_map_2_2.id)&lt;br /&gt;
  @response_2_3 = create(:response, is_submitted: true, map_id: @response_map_2_3.id)&lt;br /&gt;
&lt;br /&gt;
  @response_3_1 = create(:response, is_submitted: true, map_id: @response_map_3_1.id)&lt;br /&gt;
  @response_3_2 = create(:response, is_submitted: true, map_id: @response_map_3_2.id)&lt;br /&gt;
  @response_3_3 = create(:response, is_submitted: true, map_id: @response_map_3_3.id)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Relevant Methods ===&lt;br /&gt;
==== db_query ====&lt;br /&gt;
This is the normal db query method, call this method will return peer review grades with given assignment id.&lt;br /&gt;
We will test this method in two aspect. &lt;br /&gt;
1. Test whether or not the grade return is right based on the specified algorithm.&lt;br /&gt;
2. We need to test the correctness of the query.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context 'test db_query' do&lt;br /&gt;
    it 'return average score' do&lt;br /&gt;
      # reivewer_1's review for reviewee_1: [1, 2, 3, 4, 5]&lt;br /&gt;
      # create 5 answers for 5 related questions&lt;br /&gt;
&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_1.id, answer: 1)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_1.id, answer: 2)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_1.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_1.id, answer: 4)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      result = ReputationWebServiceController.new.db_query(1, 1, false)&lt;br /&gt;
      #expect to see a data array return generated by the score given.&lt;br /&gt;
      expect(result).to eq([[2, 1, 60.0]])&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== json_generator ====&lt;br /&gt;
This method will generate the hash format of the review, we will test this method by calling to and convert the result to json format the print to test its correctness.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context 'test json_generator' do&lt;br /&gt;
    it 'test 3 reviewer for one reviewee' do&lt;br /&gt;
      # reivewer_1's review for reviewee_1: [5, 5, 5, 5, 5]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
&lt;br /&gt;
      # reivewer_2's review for reviewee_1: [3, 3, 3, 3, 3]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
&lt;br /&gt;
      # reivewer_3's review for reviewee_1: [1, 1, 1, 1, 1]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
&lt;br /&gt;
      result = ReputationWebServiceController.new.json_generator(1, 0, 1)&lt;br /&gt;
      expect(result).to eq({&amp;quot;submission1&amp;quot;=&amp;gt;{&amp;quot;stu2&amp;quot;=&amp;gt;100.0, &amp;quot;stu3&amp;quot;=&amp;gt;60.0, &amp;quot;stu4&amp;quot;=&amp;gt;20.0}})&lt;br /&gt;
      #repeat for different answers&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'test same reviewer for different reviewee' do&lt;br /&gt;
      # reivewer_1's review for reviewee_1: [5, 5, 5, 5, 5]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
&lt;br /&gt;
      # reivewer_1's review for reviewee_2: [3, 3, 3, 3, 3]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
&lt;br /&gt;
      result = ReputationWebServiceController.new.json_generator(1, 0, 1)&lt;br /&gt;
      expect(result).to eq(&amp;quot;submission1&amp;quot;=&amp;gt;{&amp;quot;stu2&amp;quot;=&amp;gt;100.0}, &amp;quot;submission2&amp;quot;=&amp;gt;{&amp;quot;stu2&amp;quot;=&amp;gt;60.0})&lt;br /&gt;
      #repeat for different answers&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== send_post_request ==== &lt;br /&gt;
This method send a post request to peerlogic.csc.ncsu.edu/reputation/calculations/reputation_algorithms to calculate get the reputation result and use show the result in corresponding UI and update given reviewer's reputation. We will test this method based on the algorithm in the paper, first to test the result reputation value, second to test the update value in database.&lt;br /&gt;
&lt;br /&gt;
Note that this method is not functioning due to the missing public &amp;amp; private key file for RSA encryption. The algorithm involving &amp;quot;expert grade&amp;quot; was also not implemented. &lt;br /&gt;
Thus, this method could not be properly tested. However we have given the template to create tests for future use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context 'test send_post_request' do&lt;br /&gt;
    it 'failed because of no public key file' do&lt;br /&gt;
      # reivewer_1's review for reviewee_1: [5, 5, 5, 5, 5]&lt;br /&gt;
      # create 5 answers for 5 related questions&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
&lt;br /&gt;
      # choose hammer algorithm without expert grade(intructor's given grade)&lt;br /&gt;
      params = {assignment_id: 1, round_num: 1, algorithm: 'hammer', checkbox: {expert_grade: &amp;quot;empty&amp;quot;}}&lt;br /&gt;
      session = {user: build(:instructor, id: 1)}&lt;br /&gt;
&lt;br /&gt;
      expect(true).to eq(true)&lt;br /&gt;
&lt;br /&gt;
      # comment out because send_post_request method request public key file while this file is missing&lt;br /&gt;
      # so at this time send_post_request is not functioning normally&lt;br /&gt;
      # if it functions correctly, it will update the reviewer's reputation score according to the selected reputation algorithm.&lt;br /&gt;
&lt;br /&gt;
      # get :send_post_request, params, session&lt;br /&gt;
      # expect(response).to redirect_to '/reputation_web_service/client'&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== aes_encrypt &amp;amp; aes_decrypt ==== &lt;br /&gt;
&lt;br /&gt;
These two methods are counterparts of each other.  Instead of testing them separately, we test both in the '''same''' rspect context. We generate a random string mixed with numbers and then encrypt it with the method &amp;lt;code&amp;gt;aes_encrypt&amp;lt;/code&amp;gt; and receive the tuple &amp;lt;code&amp;gt;[cipher, key, iv]&amp;lt;/code&amp;gt;. Then the test invokes the &amp;lt;code&amp;gt;aes_decrypt&amp;lt;/code&amp;gt; method with the tuples to retrieve the plain text. Finally, the test checks whether the decrypted text is the same as the original random data. The test covers both the &amp;lt;code&amp;gt;aes_encrypt&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;aes_decrpyt&amp;lt;/code&amp;gt; methods in the reputation web service controller.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
context 'test aes_decrypt' do&lt;br /&gt;
  it 'return the correct plain text' do&lt;br /&gt;
    data = (0...8).map { (65 + rand(26)).chr }.join&lt;br /&gt;
    cipher, key, iv = ReputationWebServiceController.new.aes_encrypt(data)&lt;br /&gt;
    plain = ReputationWebServiceController.new.aes_decrypt(cipher, key, iv)&lt;br /&gt;
    expect(plain).to eq(data)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
=== Testing Results ===&lt;br /&gt;
&lt;br /&gt;
All of current examples passed the test. There are '''5''' examples in the &amp;lt;code&amp;gt;reputation_web_service_controller_spec.rb&amp;lt;/code&amp;gt; file and there is no failure.&lt;br /&gt;
&lt;br /&gt;
[[File:E2168-test-passed.png|600px]]&lt;br /&gt;
&lt;br /&gt;
There are total '''10''' method in the &amp;lt;code&amp;gt;reputation_web_service_controller.rb&amp;lt;/code&amp;gt; controller:&lt;br /&gt;
&lt;br /&gt;
# action_allowed?&lt;br /&gt;
# db_query&lt;br /&gt;
# db_query_with_quiz_score&lt;br /&gt;
# json_generator&lt;br /&gt;
# client&lt;br /&gt;
# send_post_request&lt;br /&gt;
# rsa_public_key1&lt;br /&gt;
# rsa_private_key2&lt;br /&gt;
# aes_encrypt&lt;br /&gt;
# aes_decrypt&lt;br /&gt;
&lt;br /&gt;
Our test covers '''7''' of them: &lt;br /&gt;
&lt;br /&gt;
# action_allowed?&lt;br /&gt;
# db_query&lt;br /&gt;
# json_generator&lt;br /&gt;
# client&lt;br /&gt;
# send_post_request&lt;br /&gt;
# aes_encrypt&lt;br /&gt;
# aes_decrypt&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;rsa_public_key1&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;rsa_public_key2&amp;lt;/code&amp;gt; methods requires the public key file 	&lt;br /&gt;
'''''public1.pem''''' and the private key file '''''private1.pem'''''. However, these two files are missing and therefore we could not test the related two methods.&lt;br /&gt;
&lt;br /&gt;
=== Coverage ===&lt;br /&gt;
The test coverage boosts from '''0%''' to '''50.31%'''.&lt;br /&gt;
&lt;br /&gt;
[[File:Test-coverage.png|1080px]]&lt;br /&gt;
&lt;br /&gt;
There is no testing implemented for the &amp;lt;code&amp;gt;reputation_web_service_controller.rb&amp;lt;/code&amp;gt; prior to our work and therefore the previous testing coverage is '''0%'''.&lt;br /&gt;
&lt;br /&gt;
From the coverage report generated by the &amp;lt;code&amp;gt;Simplecov&amp;lt;/code&amp;gt; gem, there are '''80''' lines covered by our test. As for the residual '''72''' lines of code, they are related to the public key file and deprecated functions for gathering data for a paper [https://doi.org/10.1109/FIE.2015.7344292] published in 2015.&lt;br /&gt;
&lt;br /&gt;
The code &amp;lt;code&amp;gt;case&amp;lt;/code&amp;gt; under the first &amp;lt;code&amp;gt;if&amp;lt;/code&amp;gt; statement in the &amp;lt;code&amp;gt;send_post_request&amp;lt;/code&amp;gt; method of the &amp;lt;code&amp;gt;reputation_web_service_controller.rb&amp;lt;/code&amp;gt; should be removed. The team in Fall 2020 [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2020_-_E2064._Refactor_reputation_web_service_controller.rb#Issues_to_be_fixed] also mentioned the issues.&lt;br /&gt;
&lt;br /&gt;
If the redundant method &amp;lt;code&amp;gt;send_post-request&amp;lt;/code&amp;gt; in the controller &amp;lt;code&amp;gt;reputation_web_service_controller.rb&amp;lt;/code&amp;gt; is commented out, the test coverage can achieve '''52.63%'''.&lt;br /&gt;
&lt;br /&gt;
[[File:Coverage-more.png|1080px]]&lt;br /&gt;
&lt;br /&gt;
=== Relevant Links ===&lt;br /&gt;
Github Repo : [https://github.com/HenryChen34/expertiza/tree/beta]&lt;br /&gt;
&lt;br /&gt;
Pull request: [https://github.com/expertiza/expertiza/pull/2128]&lt;br /&gt;
&lt;br /&gt;
== Future Tasks ==&lt;br /&gt;
As our team could not obtain the public/private key pair to access the reputation web service, we were only able get to the step prior to sending the JSON to the web service of reputation algorithms. Therefore, future steps are required to test on reputation system. &lt;br /&gt;
&lt;br /&gt;
# In send_post_request, there are references to specific assignments, such as 724, 735, and 756. They were put in to gather data for a paper published in 2015. They are no longer relevant and should be removed. &lt;br /&gt;
# Implement reputation score correctness test for both Lauw's and Hamer's Algorithm assuming reputation web service available in the future.  &lt;br /&gt;
# Current test cases are implemented only based on round 1 reputation scoring even though the assignment_1 and assignment_2 are subjective to be 2 rounds of review assignment. As the result of no accessibility to reputation web service, creation of round 2 object is meaningless because of the absence of round 1 reputation score. Therefore, future test cases need to stub the behavior of fulfilling assignment_questionnaire_1_2 (2nd round questionnaire) and assignment_questionnaire_2_2 (2nd round questionnaire) respectively assuming reputation web service available that time.  &lt;br /&gt;
# The db_query violates the DRY principle as it repetitively calculates sum of the assignment. Such sum calculation should be handled in the assignment.rb.&lt;br /&gt;
&lt;br /&gt;
== Collaborators ==&lt;br /&gt;
Jinku Cui (jcui23)&lt;br /&gt;
&lt;br /&gt;
Henry Chen (hchen34)&lt;br /&gt;
&lt;br /&gt;
Dong Li (dli35)&lt;br /&gt;
&lt;br /&gt;
Zijun Lu (zlu5)&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[https://doi.org/10.1109/FIE.2015.7344292 Pluggable reputation systems for peer review: A web-service approach]&lt;br /&gt;
#[https://youtu.be/sL0xQTol61w]&lt;/div&gt;</summary>
		<author><name>Hchen34</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2168._Testing_-_Reputations&amp;diff=142275</id>
		<title>CSC/ECE 517 Fall 2021 - E2168. Testing - Reputations</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2168._Testing_-_Reputations&amp;diff=142275"/>
		<updated>2021-11-30T03:38:40Z</updated>

		<summary type="html">&lt;p&gt;Hchen34: add comment for db_query test&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Project Overview ==&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;q&amp;gt;Online peer-review systems are now in common use in higher education. They free the instructor and course staff from having to provide personally all the feedback that students receive on their work. However, if we want to assure that all students receive competent feedback, or even use peer-assigned grades, we need a way to judge which peer reviewers are most credible. The solution is to use a reputation system.&amp;lt;/q&amp;gt; &amp;lt;br&amp;gt; The reputation system is meant to provide objective value to student assigned peer review scores. Students select from a list of tasks to be performed and then prepare their work and submit it to a peer-review system. The work is then reviewed by other students who offer comments/graded feedback to help the submitters improve their work.&lt;br /&gt;
During the peer review period it is important to determine which reviews are more accurate and show higher quality. Reputation is one way to achieve this goal; it is a quantization measurement to judge which peer reviewers are more reliable.&lt;br /&gt;
Peer reviewers can use expertiza to score an author. If Expertiza shows a confidence ratings for grades based upon the reviewers reputation then authors can more easily determine the legitimacy of the peer assigned score. In addition, the teaching staff can examine the quality of each peer review based on reputation values and, potentially, crowd-source a significant portion of the grading function.&lt;br /&gt;
Currently the reputation system is implemented in Expertiza through web-service, but there's no test written for it. Thus our goal is to set up assignments and reviews that would produce specific reputation scores, and test that the correct reputations are in fact being produced.&lt;br /&gt;
&lt;br /&gt;
=== System Design ===&lt;br /&gt;
The below is referenced from project E1625, which would give us the overall description of the reputation system.&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Diagram E1625.png|1000px]]&amp;lt;br&amp;gt;&lt;br /&gt;
There are two algorithms intended for use in calculation of the reputation values for participants. &lt;br /&gt;
&lt;br /&gt;
There is a [https://expertiza.ncsu.edu/reputation_web_service/client web-service] (the link accessible only to the instructors) available which serves a JSON response containing the reputation value based on the seed provided in the form of the last known reputation value which we store in the ''participants'' table. An instructor can specify which algorithm to use for a particular assignment to calculate the confidence rating. &lt;br /&gt;
&lt;br /&gt;
As the [https://docs.google.com/viewer?url=https%3A%2F%2Fwww.researchgate.net%2Fprofile%2FYang_Song36%2Fpublication%2F289528736_Pluggable_Reputation_Systems_for_Peer_Review_a_Web-Service_Approach%2Flinks%2F568ec8d008ae78cc05160aed.pdf%3FinViewer%3D0%26pdfJsDownload%3D0%26origin%3Dpublication_detail paper] on reputation system by observes, “the Hamer-peer algorithm has the lowest maximum absolute bias and the Lauw-peer algorithm has the lowest overall bias.This indicates, from the instructor’s perspective, if there are further assignments of this kind, expert grading may not be necessary.”&lt;br /&gt;
:;Reputation range of Hamer’s algorithm is :&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: red;&amp;quot;&amp;gt;red&amp;lt;/span&amp;gt;                   value &amp;lt; 0.5&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: yellow&amp;quot;&amp;gt;yellow&amp;lt;/span&amp;gt;              value is &amp;gt;= 0.5 and &amp;lt;= 1&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: orange&amp;quot;&amp;gt;orange&amp;lt;/span&amp;gt;             value is &amp;gt; 1 and &amp;lt;= 1.5&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: HoneyDew&amp;quot;&amp;gt;light green&amp;lt;/span&amp;gt;       value is &amp;gt; 1.5 and &amp;lt;= 2&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: Chartreuse&amp;quot;&amp;gt;green&amp;lt;/span&amp;gt;               value is &amp;gt; 2&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The main difference between the Hamer-peer and the Lauw-peer algorithm is that the Lauw-peer algorithm keeps track of the reviewer's leniency (“bias”), which can be either positive or negative. A positive leniency indicates the reviewer tends to give higher scores than average.  This project determines reputation by subtracting the absolute value of the leniency from 1. Additionally, the range for Hamer’s algorithm is (0,∞) while for Lauw’s algorithm it is [0,1]. &lt;br /&gt;
:;Reputation range of Lauw’s algorithm is&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: red&amp;quot;&amp;gt;red&amp;lt;/span&amp;gt;                   value is &amp;lt; 0.2&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: yellow&amp;quot;&amp;gt;yellow&amp;lt;/span&amp;gt;              value is &amp;gt;= 0.2 and &amp;lt;= 0.4&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: orange&amp;quot;&amp;gt;orange&amp;lt;/span&amp;gt;             value is &amp;gt; 0.4 and &amp;lt;= 0.6&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: HoneyDew&amp;quot;&amp;gt;light green&amp;lt;/span&amp;gt;       value is &amp;gt; 0.6 and &amp;lt;= 0.8&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: Chartreuse&amp;quot;&amp;gt;green&amp;lt;/span&amp;gt;               value is &amp;gt; 0.8&lt;br /&gt;
&lt;br /&gt;
The instructor can choose to show results from Hamer’s algorithm or Lauw’s algorithm. The default algorithm should be Lauw’s algorithm.&lt;br /&gt;
&lt;br /&gt;
=== Objectives ===&lt;br /&gt;
&lt;br /&gt;
Our objectives for this project are the following:&lt;br /&gt;
* Double and stub an assignment, a few submissions to the assignment, under different review rubrics&lt;br /&gt;
* Manually calculate reputation scores based on paper &amp;quot;Pluggable reputation systems for peer review: A web-service approach&amp;quot;&lt;br /&gt;
* Validate correct reputation scores based on different review rubrics generated by reputation management VS manual computation of reputation score using the Hamer's and Lauw's algorithm.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
*reputation_web_service_controller_spec&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
=== Setup Testing Objects ===&lt;br /&gt;
In order to implement testing on reputation, it is crucial to create sample reviews so that we could possibly obtain reputation score. During the kickoff meeting, our team defined four necessary steps to follow for the purpose of testing. Also, appropriate objects could be created and confined as discussed below.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The manifestation of each object will contribute to the success of the following test on reputations. Some fields in each object can be empty or have default values. Some attributes are not relevant to the test. When implementing the test, the test scripts need to generate or set fixed values for corresponding fields.&lt;br /&gt;
&lt;br /&gt;
==== Assignment ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[assignments]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Essential Parameters to be configured&amp;lt;br&amp;gt;&lt;br /&gt;
submitter_count = 0;&amp;lt;br&amp;gt;&lt;br /&gt;
num_reviews = 5;&amp;lt;br&amp;gt;&lt;br /&gt;
num_reviewers = 5;&amp;lt;br&amp;gt;&lt;br /&gt;
num_reviews_allowed = 5;&amp;lt;br&amp;gt;&lt;br /&gt;
rounds_of_reviews = 2;&amp;lt;br&amp;gt;&lt;br /&gt;
reputation_algorithm = lauw/hamer;&amp;lt;br&amp;gt;&lt;br /&gt;
Note: Two assignment objects were created. Assignment_1 used lauw's algorithm, whereas assignment_2 used hamer's alogorithm.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @assignment_1 = create(:assignment, created_at: DateTime.now.in_time_zone - 13.day, submitter_count: 0, num_reviews: 3, num_reviewers: 5, num_reviews_allowed: 5, rounds_of_reviews: 2, reputation_algorithm: 'lauw', id: 1)&lt;br /&gt;
  @assignment_2 = create(:assignment, created_at: DateTime.now.in_time_zone - 13.day, submitter_count: 0, num_reviews: 3, num_reviewers: 5, num_reviews_allowed: 5, rounds_of_reviews: 2, reputation_algorithm: 'hamer', id: 2)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Questionnaires(Rubrics) ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[questionnaires]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[assignment_questionnaires]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Essential Parameters to be configured&amp;lt;br&amp;gt;&lt;br /&gt;
min_question_score = 0;&amp;lt;br&amp;gt;&lt;br /&gt;
max_question_score = 5;&amp;lt;br&amp;gt;&lt;br /&gt;
type = ReviewQuestionnaire;&amp;lt;br&amp;gt;&lt;br /&gt;
Note: We will define the assignment with ReviewQuestionnaire type rubric. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @questionnaire_1 = create(:questionnaire, min_question_score: 0, max_question_score: 5, type: 'ReviewQuestionnaire', id: 1)&lt;br /&gt;
  # assignment_questionnaire_&amp;lt;i&amp;gt;_&amp;lt;j&amp;gt; means assignment #I'd #j th round of review.&lt;br /&gt;
  @assignment_questionnaire_1_1 = create(:assignment_questionnaire, assignment_id: @assignment_1.id, questionnaire_id: @questionnaire_1.id, used_in_round: 1)&lt;br /&gt;
  @assignment_questionnaire_1_2 = create(:assignment_questionnaire, assignment_id: @assignment_1.id, questionnaire_id: @questionnaire_1.id, used_in_round: 2)&lt;br /&gt;
  @assignment_questionnaire_2_1 = create(:assignment_questionnaire, assignment_id: @assignment_2.id, questionnaire_id: @questionnaire_1.id, used_in_round: 1)&lt;br /&gt;
  @assignment_questionnaire_2_2 = create(:assignment_questionnaire, assignment_id: @assignment_2.id, questionnaire_id: @questionnaire_1.id, used_in_round: 2)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Questions under Questionnaires ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[questions]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  # question_i_j means question #j in questionnaire #i.&lt;br /&gt;
  @question_1_1 = create(:question, questionnaire_id: @questionnaire_1.id, id: 1)&lt;br /&gt;
  @question_1_2 = create(:question, questionnaire_id: @questionnaire_1.id, id: 2)&lt;br /&gt;
  @question_1_3 = create(:question, questionnaire_id: @questionnaire_1.id, id: 3)&lt;br /&gt;
  @question_1_4 = create(:question, questionnaire_id: @questionnaire_1.id, id: 4)&lt;br /&gt;
  @question_1_5 = create(:question, questionnaire_id: @questionnaire_1.id, id: 5)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Reviewers and Reviewees ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[participants]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[teams]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
Reviewers (Participant):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @reviewer_1 = create(:participant, can_review: 1)&lt;br /&gt;
  @reviewer_2 = create(:participant, can_review: 1)&lt;br /&gt;
  @reviewer_3 = create(:participant, can_review: 1)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Reviewees (Teams):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @reviewee_1 = create(:assignment_team, assignment: @assignment)&lt;br /&gt;
  @reviewee_2 = create(:assignment_team, assignment: @assignment)&lt;br /&gt;
  @reviewee_3 = create(:assignment_team, assignment: @assignment)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Responses ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[response_maps]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[responses]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Essential Parameters to be configured&amp;lt;br&amp;gt;&lt;br /&gt;
reviewed_object_id = &amp;lt;target_assignment&amp;gt;.id ; &amp;lt;br&amp;gt;&lt;br /&gt;
reviewer_id = &amp;lt;target_reviewer&amp;gt;.id ; &amp;lt;br&amp;gt;&lt;br /&gt;
reviewee_id = &amp;lt;target_reviewee&amp;gt;.id ; &amp;lt;br&amp;gt;&lt;br /&gt;
Note: The response map is setup to determine the relationship between reviewer and reviewee of an assignment.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
Response_maps:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  # response_map_&amp;lt;i&amp;gt;_&amp;lt;j&amp;gt; means response of reviewer #j to reviewee #i. &lt;br /&gt;
  @response_map_1_1 = create(:review_response_map, reviewer_id: @reviewer_1.id, reviewee_id: @reviewee_1.id)&lt;br /&gt;
  @response_map_1_2 = create(:review_response_map, reviewer_id: @reviewer_2.id, reviewee_id: @reviewee_1.id)&lt;br /&gt;
  @response_map_1_3 = create(:review_response_map, reviewer_id: @reviewer_3.id, reviewee_id: @reviewee_1.id)&lt;br /&gt;
&lt;br /&gt;
  @response_map_2_1 = create(:review_response_map, reviewer_id: @reviewer_1.id, reviewee_id: @reviewee_2.id)&lt;br /&gt;
  @response_map_2_2 = create(:review_response_map, reviewer_id: @reviewer_2.id, reviewee_id: @reviewee_2.id)&lt;br /&gt;
  @response_map_2_3 = create(:review_response_map, reviewer_id: @reviewer_3.id, reviewee_id: @reviewee_2.id)&lt;br /&gt;
&lt;br /&gt;
  @response_map_3_1 = create(:review_response_map, reviewer_id: @reviewer_1.id, reviewee_id: @reviewee_3.id)&lt;br /&gt;
  @response_map_3_2 = create(:review_response_map, reviewer_id: @reviewer_2.id, reviewee_id: @reviewee_3.id)&lt;br /&gt;
  @response_map_3_3 = create(:review_response_map, reviewer_id: @reviewer_3.id, reviewee_id: @reviewee_3.id)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Responses:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  # response_&amp;lt;i&amp;gt;_&amp;lt;j&amp;gt; means response of reviewer #j to reviewee #i. &lt;br /&gt;
  @response_1_1 = create(:response, is_submitted: true, map_id: @response_map_1_1.id)&lt;br /&gt;
  @response_1_2 = create(:response, is_submitted: true, map_id: @response_map_1_2.id)&lt;br /&gt;
  @response_1_3 = create(:response, is_submitted: true, map_id: @response_map_1_3.id)&lt;br /&gt;
&lt;br /&gt;
  @response_2_1 = create(:response, is_submitted: true, map_id: @response_map_2_1.id)&lt;br /&gt;
  @response_2_2 = create(:response, is_submitted: true, map_id: @response_map_2_2.id)&lt;br /&gt;
  @response_2_3 = create(:response, is_submitted: true, map_id: @response_map_2_3.id)&lt;br /&gt;
&lt;br /&gt;
  @response_3_1 = create(:response, is_submitted: true, map_id: @response_map_3_1.id)&lt;br /&gt;
  @response_3_2 = create(:response, is_submitted: true, map_id: @response_map_3_2.id)&lt;br /&gt;
  @response_3_3 = create(:response, is_submitted: true, map_id: @response_map_3_3.id)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Relevant Methods ===&lt;br /&gt;
==== db_query ====&lt;br /&gt;
This is the normal db query method, call this method will return peer review grades with given assignment id.&lt;br /&gt;
We will test this method in two aspect. &lt;br /&gt;
1. Test whether or not the grade return is right based on the specified algorithm.&lt;br /&gt;
2. We need to test the correctness of the query.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context 'test db_query' do&lt;br /&gt;
    it 'return average score' do&lt;br /&gt;
      # reivewer_1's review for reviewee_1: [1, 2, 3, 4, 5]&lt;br /&gt;
      # create 5 answers for 5 related questions&lt;br /&gt;
&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_1.id, answer: 1)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_1.id, answer: 2)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_1.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_1.id, answer: 4)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      result = ReputationWebServiceController.new.db_query(1, 1, false)&lt;br /&gt;
      #expect to see a data array return generated by the score given.&lt;br /&gt;
      expect(result).to eq([[2, 1, 60.0]])&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== json_generator ====&lt;br /&gt;
This method will generate the hash format of the review, we will test this method by calling to and convert the result to json format the print to test its correctness.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context 'test json_generator' do&lt;br /&gt;
    it 'test 3 reviewer for one reviewee' do&lt;br /&gt;
      # reivewer_1's review for reviewee_1: [5, 5, 5, 5, 5]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
&lt;br /&gt;
      # reivewer_2's review for reviewee_1: [3, 3, 3, 3, 3]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
&lt;br /&gt;
      # reivewer_3's review for reviewee_1: [1, 1, 1, 1, 1]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
&lt;br /&gt;
      result = ReputationWebServiceController.new.json_generator(1, 0, 1)&lt;br /&gt;
      expect(result).to eq({&amp;quot;submission1&amp;quot;=&amp;gt;{&amp;quot;stu2&amp;quot;=&amp;gt;100.0, &amp;quot;stu3&amp;quot;=&amp;gt;60.0, &amp;quot;stu4&amp;quot;=&amp;gt;20.0}})&lt;br /&gt;
      #repeat for different answers&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'test same reviewer for different reviewee' do&lt;br /&gt;
      # reivewer_1's review for reviewee_1: [5, 5, 5, 5, 5]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
&lt;br /&gt;
      # reivewer_1's review for reviewee_2: [3, 3, 3, 3, 3]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
&lt;br /&gt;
      result = ReputationWebServiceController.new.json_generator(1, 0, 1)&lt;br /&gt;
      expect(result).to eq(&amp;quot;submission1&amp;quot;=&amp;gt;{&amp;quot;stu2&amp;quot;=&amp;gt;100.0}, &amp;quot;submission2&amp;quot;=&amp;gt;{&amp;quot;stu2&amp;quot;=&amp;gt;60.0})&lt;br /&gt;
      #repeat for different answers&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== send_post_request ==== &lt;br /&gt;
This method send a post request to peerlogic.csc.ncsu.edu/reputation/calculations/reputation_algorithms to calculate get the reputation result and use show the result in corresponding UI and update given reviewer's reputation. We will test this method based on the algorithm in the paper, first to test the result reputation value, second to test the update value in database.&lt;br /&gt;
&lt;br /&gt;
Note that this method is not functioning due to the missing public &amp;amp; private key file for RSA encryption. The algorithm involving &amp;quot;expert grade&amp;quot; was also not implemented. &lt;br /&gt;
Thus, this method could not be properly tested. However we have given the template to create tests for future use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context 'test send_post_request' do&lt;br /&gt;
    it 'failed because of no public key file' do&lt;br /&gt;
      # reivewer_1's review for reviewee_1: [5, 5, 5, 5, 5]&lt;br /&gt;
      # create 5 answers for 5 related questions&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
&lt;br /&gt;
      # choose hammer algorithm without expert grade(intructor's given grade)&lt;br /&gt;
      params = {assignment_id: 1, round_num: 1, algorithm: 'hammer', checkbox: {expert_grade: &amp;quot;empty&amp;quot;}}&lt;br /&gt;
      session = {user: build(:instructor, id: 1)}&lt;br /&gt;
&lt;br /&gt;
      expect(true).to eq(true)&lt;br /&gt;
&lt;br /&gt;
      # comment out because send_post_request method request public key file while this file is missing&lt;br /&gt;
      # so at this time send_post_request is not functioning normally&lt;br /&gt;
      # if it functions correctly, it will update the reviewer's reputation score according to the selected reputation algorithm.&lt;br /&gt;
&lt;br /&gt;
      # get :send_post_request, params, session&lt;br /&gt;
      # expect(response).to redirect_to '/reputation_web_service/client'&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
=== Testing Results ===&lt;br /&gt;
&lt;br /&gt;
=== Coverage ===&lt;br /&gt;
&lt;br /&gt;
== Future Tasks ==&lt;br /&gt;
As our team could not obtain the public/private key pair to access the reputation web service, we were only able get to the step prior to sending the JSON to the web service of reputation algorithms. Therefore, future steps are required to test on reputation system. &lt;br /&gt;
&lt;br /&gt;
# Current setup is based on assignment_1, which uses lauw's algorithm to calculate reputation score. Future testing team need to setup similar object set for assignment_2, which uses hamer's algorithm. &lt;br /&gt;
# In  send_post_request, there are references to specific assignments, such as 724, 735, and 756. They were put in to gather data for a paper published in 2015. They are no longer relevant and should be removed. (Need to replace by the comment Professor mentioned in the meeting today)&lt;br /&gt;
# Round 1 and round 2?&lt;br /&gt;
# The db_query violates the DRY principle as it repetitively calculates sum of the assignment. Such sum calculation should be handled in the assignment.rb.&lt;br /&gt;
&lt;br /&gt;
== Collaborators ==&lt;br /&gt;
Jinku Cui (jcui23)&lt;br /&gt;
&lt;br /&gt;
Henry Chen (hchen34)&lt;br /&gt;
&lt;br /&gt;
Dong Li (dli35)&lt;br /&gt;
&lt;br /&gt;
Zijun Lu (zlu5)&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[https://doi.org/10.1109/FIE.2015.7344292 Pluggable reputation systems for peer review: A web-service approach]&lt;/div&gt;</summary>
		<author><name>Hchen34</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2168._Testing_-_Reputations&amp;diff=142274</id>
		<title>CSC/ECE 517 Fall 2021 - E2168. Testing - Reputations</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2168._Testing_-_Reputations&amp;diff=142274"/>
		<updated>2021-11-30T03:32:43Z</updated>

		<summary type="html">&lt;p&gt;Hchen34: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Project Overview ==&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;q&amp;gt;Online peer-review systems are now in common use in higher education. They free the instructor and course staff from having to provide personally all the feedback that students receive on their work. However, if we want to assure that all students receive competent feedback, or even use peer-assigned grades, we need a way to judge which peer reviewers are most credible. The solution is to use a reputation system.&amp;lt;/q&amp;gt; &amp;lt;br&amp;gt; The reputation system is meant to provide objective value to student assigned peer review scores. Students select from a list of tasks to be performed and then prepare their work and submit it to a peer-review system. The work is then reviewed by other students who offer comments/graded feedback to help the submitters improve their work.&lt;br /&gt;
During the peer review period it is important to determine which reviews are more accurate and show higher quality. Reputation is one way to achieve this goal; it is a quantization measurement to judge which peer reviewers are more reliable.&lt;br /&gt;
Peer reviewers can use expertiza to score an author. If Expertiza shows a confidence ratings for grades based upon the reviewers reputation then authors can more easily determine the legitimacy of the peer assigned score. In addition, the teaching staff can examine the quality of each peer review based on reputation values and, potentially, crowd-source a significant portion of the grading function.&lt;br /&gt;
Currently the reputation system is implemented in Expertiza through web-service, but there's no test written for it. Thus our goal is to set up assignments and reviews that would produce specific reputation scores, and test that the correct reputations are in fact being produced.&lt;br /&gt;
&lt;br /&gt;
=== System Design ===&lt;br /&gt;
The below is referenced from project E1625, which would give us the overall description of the reputation system.&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Diagram E1625.png|1000px]]&amp;lt;br&amp;gt;&lt;br /&gt;
There are two algorithms intended for use in calculation of the reputation values for participants. &lt;br /&gt;
&lt;br /&gt;
There is a [https://expertiza.ncsu.edu/reputation_web_service/client web-service] (the link accessible only to the instructors) available which serves a JSON response containing the reputation value based on the seed provided in the form of the last known reputation value which we store in the ''participants'' table. An instructor can specify which algorithm to use for a particular assignment to calculate the confidence rating. &lt;br /&gt;
&lt;br /&gt;
As the [https://docs.google.com/viewer?url=https%3A%2F%2Fwww.researchgate.net%2Fprofile%2FYang_Song36%2Fpublication%2F289528736_Pluggable_Reputation_Systems_for_Peer_Review_a_Web-Service_Approach%2Flinks%2F568ec8d008ae78cc05160aed.pdf%3FinViewer%3D0%26pdfJsDownload%3D0%26origin%3Dpublication_detail paper] on reputation system by observes, “the Hamer-peer algorithm has the lowest maximum absolute bias and the Lauw-peer algorithm has the lowest overall bias.This indicates, from the instructor’s perspective, if there are further assignments of this kind, expert grading may not be necessary.”&lt;br /&gt;
:;Reputation range of Hamer’s algorithm is :&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: red;&amp;quot;&amp;gt;red&amp;lt;/span&amp;gt;                   value &amp;lt; 0.5&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: yellow&amp;quot;&amp;gt;yellow&amp;lt;/span&amp;gt;              value is &amp;gt;= 0.5 and &amp;lt;= 1&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: orange&amp;quot;&amp;gt;orange&amp;lt;/span&amp;gt;             value is &amp;gt; 1 and &amp;lt;= 1.5&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: HoneyDew&amp;quot;&amp;gt;light green&amp;lt;/span&amp;gt;       value is &amp;gt; 1.5 and &amp;lt;= 2&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: Chartreuse&amp;quot;&amp;gt;green&amp;lt;/span&amp;gt;               value is &amp;gt; 2&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The main difference between the Hamer-peer and the Lauw-peer algorithm is that the Lauw-peer algorithm keeps track of the reviewer's leniency (“bias”), which can be either positive or negative. A positive leniency indicates the reviewer tends to give higher scores than average.  This project determines reputation by subtracting the absolute value of the leniency from 1. Additionally, the range for Hamer’s algorithm is (0,∞) while for Lauw’s algorithm it is [0,1]. &lt;br /&gt;
:;Reputation range of Lauw’s algorithm is&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: red&amp;quot;&amp;gt;red&amp;lt;/span&amp;gt;                   value is &amp;lt; 0.2&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: yellow&amp;quot;&amp;gt;yellow&amp;lt;/span&amp;gt;              value is &amp;gt;= 0.2 and &amp;lt;= 0.4&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: orange&amp;quot;&amp;gt;orange&amp;lt;/span&amp;gt;             value is &amp;gt; 0.4 and &amp;lt;= 0.6&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: HoneyDew&amp;quot;&amp;gt;light green&amp;lt;/span&amp;gt;       value is &amp;gt; 0.6 and &amp;lt;= 0.8&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: Chartreuse&amp;quot;&amp;gt;green&amp;lt;/span&amp;gt;               value is &amp;gt; 0.8&lt;br /&gt;
&lt;br /&gt;
The instructor can choose to show results from Hamer’s algorithm or Lauw’s algorithm. The default algorithm should be Lauw’s algorithm.&lt;br /&gt;
&lt;br /&gt;
=== Objectives ===&lt;br /&gt;
&lt;br /&gt;
Our objectives for this project are the following:&lt;br /&gt;
* Double and stub an assignment, a few submissions to the assignment, under different review rubrics&lt;br /&gt;
* Manually calculate reputation scores based on paper &amp;quot;Pluggable reputation systems for peer review: A web-service approach&amp;quot;&lt;br /&gt;
* Validate correct reputation scores based on different review rubrics generated by reputation management VS manual computation of reputation score using the Hamer's and Lauw's algorithm.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
*reputation_web_service_controller_spec&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
=== Setup Testing Objects ===&lt;br /&gt;
In order to implement testing on reputation, it is crucial to create sample reviews so that we could possibly obtain reputation score. During the kickoff meeting, our team defined four necessary steps to follow for the purpose of testing. Also, appropriate objects could be created and confined as discussed below.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The manifestation of each object will contribute to the success of the following test on reputations. Some fields in each object can be empty or have default values. Some attributes are not relevant to the test. When implementing the test, the test scripts need to generate or set fixed values for corresponding fields.&lt;br /&gt;
&lt;br /&gt;
==== Assignment ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[assignments]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Essential Parameters to be configured&amp;lt;br&amp;gt;&lt;br /&gt;
submitter_count = 0;&amp;lt;br&amp;gt;&lt;br /&gt;
num_reviews = 5;&amp;lt;br&amp;gt;&lt;br /&gt;
num_reviewers = 5;&amp;lt;br&amp;gt;&lt;br /&gt;
num_reviews_allowed = 5;&amp;lt;br&amp;gt;&lt;br /&gt;
rounds_of_reviews = 2;&amp;lt;br&amp;gt;&lt;br /&gt;
reputation_algorithm = lauw/hamer;&amp;lt;br&amp;gt;&lt;br /&gt;
Note: Two assignment objects were created. Assignment_1 used lauw's algorithm, whereas assignment_2 used hamer's alogorithm.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @assignment_1 = create(:assignment, created_at: DateTime.now.in_time_zone - 13.day, submitter_count: 0, num_reviews: 3, num_reviewers: 5, num_reviews_allowed: 5, rounds_of_reviews: 2, reputation_algorithm: 'lauw', id: 1)&lt;br /&gt;
  @assignment_2 = create(:assignment, created_at: DateTime.now.in_time_zone - 13.day, submitter_count: 0, num_reviews: 3, num_reviewers: 5, num_reviews_allowed: 5, rounds_of_reviews: 2, reputation_algorithm: 'hamer', id: 2)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Questionnaires(Rubrics) ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[questionnaires]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[assignment_questionnaires]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Essential Parameters to be configured&amp;lt;br&amp;gt;&lt;br /&gt;
min_question_score = 0;&amp;lt;br&amp;gt;&lt;br /&gt;
max_question_score = 5;&amp;lt;br&amp;gt;&lt;br /&gt;
type = ReviewQuestionnaire;&amp;lt;br&amp;gt;&lt;br /&gt;
Note: We will define the assignment with ReviewQuestionnaire type rubric. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @questionnaire_1 = create(:questionnaire, min_question_score: 0, max_question_score: 5, type: 'ReviewQuestionnaire', id: 1)&lt;br /&gt;
  # assignment_questionnaire_&amp;lt;i&amp;gt;_&amp;lt;j&amp;gt; means assignment #I'd #j th round of review.&lt;br /&gt;
  @assignment_questionnaire_1_1 = create(:assignment_questionnaire, assignment_id: @assignment_1.id, questionnaire_id: @questionnaire_1.id, used_in_round: 1)&lt;br /&gt;
  @assignment_questionnaire_1_2 = create(:assignment_questionnaire, assignment_id: @assignment_1.id, questionnaire_id: @questionnaire_1.id, used_in_round: 2)&lt;br /&gt;
  @assignment_questionnaire_2_1 = create(:assignment_questionnaire, assignment_id: @assignment_2.id, questionnaire_id: @questionnaire_1.id, used_in_round: 1)&lt;br /&gt;
  @assignment_questionnaire_2_2 = create(:assignment_questionnaire, assignment_id: @assignment_2.id, questionnaire_id: @questionnaire_1.id, used_in_round: 2)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Questions under Questionnaires ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[questions]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  # question_i_j means question #j in questionnaire #i.&lt;br /&gt;
  @question_1_1 = create(:question, questionnaire_id: @questionnaire_1.id, id: 1)&lt;br /&gt;
  @question_1_2 = create(:question, questionnaire_id: @questionnaire_1.id, id: 2)&lt;br /&gt;
  @question_1_3 = create(:question, questionnaire_id: @questionnaire_1.id, id: 3)&lt;br /&gt;
  @question_1_4 = create(:question, questionnaire_id: @questionnaire_1.id, id: 4)&lt;br /&gt;
  @question_1_5 = create(:question, questionnaire_id: @questionnaire_1.id, id: 5)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Reviewers and Reviewees ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[participants]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[teams]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
Reviewers (Participant):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @reviewer_1 = create(:participant, can_review: 1)&lt;br /&gt;
  @reviewer_2 = create(:participant, can_review: 1)&lt;br /&gt;
  @reviewer_3 = create(:participant, can_review: 1)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Reviewees (Teams):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @reviewee_1 = create(:assignment_team, assignment: @assignment)&lt;br /&gt;
  @reviewee_2 = create(:assignment_team, assignment: @assignment)&lt;br /&gt;
  @reviewee_3 = create(:assignment_team, assignment: @assignment)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Responses ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[response_maps]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[responses]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Essential Parameters to be configured&amp;lt;br&amp;gt;&lt;br /&gt;
reviewed_object_id = &amp;lt;target_assignment&amp;gt;.id ; &amp;lt;br&amp;gt;&lt;br /&gt;
reviewer_id = &amp;lt;target_reviewer&amp;gt;.id ; &amp;lt;br&amp;gt;&lt;br /&gt;
reviewee_id = &amp;lt;target_reviewee&amp;gt;.id ; &amp;lt;br&amp;gt;&lt;br /&gt;
Note: The response map is setup to determine the relationship between reviewer and reviewee of an assignment.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
Response_maps:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  # response_map_&amp;lt;i&amp;gt;_&amp;lt;j&amp;gt; means response of reviewer #j to reviewee #i. &lt;br /&gt;
  @response_map_1_1 = create(:review_response_map, reviewer_id: @reviewer_1.id, reviewee_id: @reviewee_1.id)&lt;br /&gt;
  @response_map_1_2 = create(:review_response_map, reviewer_id: @reviewer_2.id, reviewee_id: @reviewee_1.id)&lt;br /&gt;
  @response_map_1_3 = create(:review_response_map, reviewer_id: @reviewer_3.id, reviewee_id: @reviewee_1.id)&lt;br /&gt;
&lt;br /&gt;
  @response_map_2_1 = create(:review_response_map, reviewer_id: @reviewer_1.id, reviewee_id: @reviewee_2.id)&lt;br /&gt;
  @response_map_2_2 = create(:review_response_map, reviewer_id: @reviewer_2.id, reviewee_id: @reviewee_2.id)&lt;br /&gt;
  @response_map_2_3 = create(:review_response_map, reviewer_id: @reviewer_3.id, reviewee_id: @reviewee_2.id)&lt;br /&gt;
&lt;br /&gt;
  @response_map_3_1 = create(:review_response_map, reviewer_id: @reviewer_1.id, reviewee_id: @reviewee_3.id)&lt;br /&gt;
  @response_map_3_2 = create(:review_response_map, reviewer_id: @reviewer_2.id, reviewee_id: @reviewee_3.id)&lt;br /&gt;
  @response_map_3_3 = create(:review_response_map, reviewer_id: @reviewer_3.id, reviewee_id: @reviewee_3.id)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Responses:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  # response_&amp;lt;i&amp;gt;_&amp;lt;j&amp;gt; means response of reviewer #j to reviewee #i. &lt;br /&gt;
  @response_1_1 = create(:response, is_submitted: true, map_id: @response_map_1_1.id)&lt;br /&gt;
  @response_1_2 = create(:response, is_submitted: true, map_id: @response_map_1_2.id)&lt;br /&gt;
  @response_1_3 = create(:response, is_submitted: true, map_id: @response_map_1_3.id)&lt;br /&gt;
&lt;br /&gt;
  @response_2_1 = create(:response, is_submitted: true, map_id: @response_map_2_1.id)&lt;br /&gt;
  @response_2_2 = create(:response, is_submitted: true, map_id: @response_map_2_2.id)&lt;br /&gt;
  @response_2_3 = create(:response, is_submitted: true, map_id: @response_map_2_3.id)&lt;br /&gt;
&lt;br /&gt;
  @response_3_1 = create(:response, is_submitted: true, map_id: @response_map_3_1.id)&lt;br /&gt;
  @response_3_2 = create(:response, is_submitted: true, map_id: @response_map_3_2.id)&lt;br /&gt;
  @response_3_3 = create(:response, is_submitted: true, map_id: @response_map_3_3.id)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Relevant Methods ===&lt;br /&gt;
==== db_query ====&lt;br /&gt;
This is the normal db query method, call this method will return peer review grades with given assignment id.&lt;br /&gt;
We will test this method in two aspect. &lt;br /&gt;
1. Test whether or not the grade return is right based on the specified algorithm.&lt;br /&gt;
2. We need to test the correctness of the query.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context 'test db_query' do&lt;br /&gt;
    it 'return average score' do&lt;br /&gt;
      # reivewer_1's review for reviewee_1: [1, 2, 3, 4, 5]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_1.id, answer: 1)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_1.id, answer: 2)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_1.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_1.id, answer: 4)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      result = ReputationWebServiceController.new.db_query(1, 1, false)&lt;br /&gt;
      expect(result).to eq([[2, 1, 60.0]])&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== json_generator ====&lt;br /&gt;
This method will generate the hash format of the review, we will test this method by calling to and convert the result to json format the print to test its correctness.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context 'test json_generator' do&lt;br /&gt;
    it 'test 3 reviewer for one reviewee' do&lt;br /&gt;
      # reivewer_1's review for reviewee_1: [5, 5, 5, 5, 5]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
&lt;br /&gt;
      # reivewer_2's review for reviewee_1: [3, 3, 3, 3, 3]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
&lt;br /&gt;
      # reivewer_3's review for reviewee_1: [1, 1, 1, 1, 1]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
&lt;br /&gt;
      result = ReputationWebServiceController.new.json_generator(1, 0, 1)&lt;br /&gt;
      expect(result).to eq({&amp;quot;submission1&amp;quot;=&amp;gt;{&amp;quot;stu2&amp;quot;=&amp;gt;100.0, &amp;quot;stu3&amp;quot;=&amp;gt;60.0, &amp;quot;stu4&amp;quot;=&amp;gt;20.0}})&lt;br /&gt;
      #repeat for different answers&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'test same reviewer for different reviewee' do&lt;br /&gt;
      # reivewer_1's review for reviewee_1: [5, 5, 5, 5, 5]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
&lt;br /&gt;
      # reivewer_1's review for reviewee_2: [3, 3, 3, 3, 3]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
&lt;br /&gt;
      result = ReputationWebServiceController.new.json_generator(1, 0, 1)&lt;br /&gt;
      expect(result).to eq(&amp;quot;submission1&amp;quot;=&amp;gt;{&amp;quot;stu2&amp;quot;=&amp;gt;100.0}, &amp;quot;submission2&amp;quot;=&amp;gt;{&amp;quot;stu2&amp;quot;=&amp;gt;60.0})&lt;br /&gt;
      #repeat for different answers&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== send_post_request ==== &lt;br /&gt;
This method send a post request to peerlogic.csc.ncsu.edu/reputation/calculations/reputation_algorithms to calculate get the reputation result and use show the result in corresponding UI and update given reviewer's reputation. We will test this method based on the algorithm in the paper, first to test the result reputation value, second to test the update value in database.&lt;br /&gt;
&lt;br /&gt;
Note that this method is not functioning due to the missing public &amp;amp; private key file for RSA encryption. The algorithm involving &amp;quot;expert grade&amp;quot; was also not implemented. &lt;br /&gt;
Thus, this method could not be properly tested. However we have given the template to create tests for future use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context 'test send_post_request' do&lt;br /&gt;
    it 'failed because of no public key file' do&lt;br /&gt;
      # reivewer_1's review for reviewee_1: [5, 5, 5, 5, 5]&lt;br /&gt;
      # create 5 answers for 5 related questions&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
&lt;br /&gt;
      # choose hammer algorithm without expert grade(intructor's given grade)&lt;br /&gt;
      params = {assignment_id: 1, round_num: 1, algorithm: 'hammer', checkbox: {expert_grade: &amp;quot;empty&amp;quot;}}&lt;br /&gt;
      session = {user: build(:instructor, id: 1)}&lt;br /&gt;
&lt;br /&gt;
      expect(true).to eq(true)&lt;br /&gt;
&lt;br /&gt;
      # comment out because send_post_request method request public key file while this file is missing&lt;br /&gt;
      # so at this time send_post_request is not functioning normally&lt;br /&gt;
      # if it functions correctly, it will update the reviewer's reputation score according to the selected reputation algorithm.&lt;br /&gt;
&lt;br /&gt;
      # get :send_post_request, params, session&lt;br /&gt;
      # expect(response).to redirect_to '/reputation_web_service/client'&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
=== Testing Results ===&lt;br /&gt;
&lt;br /&gt;
=== Coverage ===&lt;br /&gt;
&lt;br /&gt;
== Future Tasks ==&lt;br /&gt;
As our team could not obtain the public/private key pair to access the reputation web service, we were only able get to the step prior to sending the JSON to the web service of reputation algorithms. Therefore, future steps are required to test on reputation system. &lt;br /&gt;
&lt;br /&gt;
# Current setup is based on assignment_1, which uses lauw's algorithm to calculate reputation score. Future testing team need to setup similar object set for assignment_2, which uses hamer's algorithm. &lt;br /&gt;
# In  send_post_request, there are references to specific assignments, such as 724, 735, and 756. They were put in to gather data for a paper published in 2015. They are no longer relevant and should be removed. (Need to replace by the comment Professor mentioned in the meeting today)&lt;br /&gt;
# Round 1 and round 2?&lt;br /&gt;
# The db_query violates the DRY principle as it repetitively calculates sum of the assignment. Such sum calculation should be handled in the assignment.rb.&lt;br /&gt;
&lt;br /&gt;
== Collaborators ==&lt;br /&gt;
Jinku Cui (jcui23)&lt;br /&gt;
&lt;br /&gt;
Henry Chen (hchen34)&lt;br /&gt;
&lt;br /&gt;
Dong Li (dli35)&lt;br /&gt;
&lt;br /&gt;
Zijun Lu (zlu5)&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[https://doi.org/10.1109/FIE.2015.7344292 Pluggable reputation systems for peer review: A web-service approach]&lt;/div&gt;</summary>
		<author><name>Hchen34</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2168._Testing_-_Reputations&amp;diff=142272</id>
		<title>CSC/ECE 517 Fall 2021 - E2168. Testing - Reputations</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2168._Testing_-_Reputations&amp;diff=142272"/>
		<updated>2021-11-30T03:29:51Z</updated>

		<summary type="html">&lt;p&gt;Hchen34: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Project Overview ==&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;q&amp;gt;Online peer-review systems are now in common use in higher education. They free the instructor and course staff from having to provide personally all the feedback that students receive on their work. However, if we want to assure that all students receive competent feedback, or even use peer-assigned grades, we need a way to judge which peer reviewers are most credible. The solution is to use a reputation system.&amp;lt;/q&amp;gt; &amp;lt;br&amp;gt; The reputation system is meant to provide objective value to student assigned peer review scores. Students select from a list of tasks to be performed and then prepare their work and submit it to a peer-review system. The work is then reviewed by other students who offer comments/graded feedback to help the submitters improve their work.&lt;br /&gt;
During the peer review period it is important to determine which reviews are more accurate and show higher quality. Reputation is one way to achieve this goal; it is a quantization measurement to judge which peer reviewers are more reliable.&lt;br /&gt;
Peer reviewers can use expertiza to score an author. If Expertiza shows a confidence ratings for grades based upon the reviewers reputation then authors can more easily determine the legitimacy of the peer assigned score. In addition, the teaching staff can examine the quality of each peer review based on reputation values and, potentially, crowd-source a significant portion of the grading function.&lt;br /&gt;
Currently the reputation system is implemented in Expertiza through web-service, but there's no test written for it. Thus our goal is to set up assignments and reviews that would produce specific reputation scores, and test that the correct reputations are in fact being produced.&lt;br /&gt;
&lt;br /&gt;
=== System Design ===&lt;br /&gt;
The below is referenced from project E1625, which would give us the overall description of the reputation system.&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Diagram E1625.png|1000px]]&amp;lt;br&amp;gt;&lt;br /&gt;
There are two algorithms intended for use in calculation of the reputation values for participants. &lt;br /&gt;
&lt;br /&gt;
There is a [https://expertiza.ncsu.edu/reputation_web_service/client web-service] (the link accessible only to the instructors) available which serves a JSON response containing the reputation value based on the seed provided in the form of the last known reputation value which we store in the ''participants'' table. An instructor can specify which algorithm to use for a particular assignment to calculate the confidence rating. &lt;br /&gt;
&lt;br /&gt;
As the [https://docs.google.com/viewer?url=https%3A%2F%2Fwww.researchgate.net%2Fprofile%2FYang_Song36%2Fpublication%2F289528736_Pluggable_Reputation_Systems_for_Peer_Review_a_Web-Service_Approach%2Flinks%2F568ec8d008ae78cc05160aed.pdf%3FinViewer%3D0%26pdfJsDownload%3D0%26origin%3Dpublication_detail paper] on reputation system by observes, “the Hamer-peer algorithm has the lowest maximum absolute bias and the Lauw-peer algorithm has the lowest overall bias.This indicates, from the instructor’s perspective, if there are further assignments of this kind, expert grading may not be necessary.”&lt;br /&gt;
:;Reputation range of Hamer’s algorithm is :&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: red;&amp;quot;&amp;gt;red&amp;lt;/span&amp;gt;                   value &amp;lt; 0.5&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: yellow&amp;quot;&amp;gt;yellow&amp;lt;/span&amp;gt;              value is &amp;gt;= 0.5 and &amp;lt;= 1&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: orange&amp;quot;&amp;gt;orange&amp;lt;/span&amp;gt;             value is &amp;gt; 1 and &amp;lt;= 1.5&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: HoneyDew&amp;quot;&amp;gt;light green&amp;lt;/span&amp;gt;       value is &amp;gt; 1.5 and &amp;lt;= 2&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: Chartreuse&amp;quot;&amp;gt;green&amp;lt;/span&amp;gt;               value is &amp;gt; 2&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The main difference between the Hamer-peer and the Lauw-peer algorithm is that the Lauw-peer algorithm keeps track of the reviewer's leniency (“bias”), which can be either positive or negative. A positive leniency indicates the reviewer tends to give higher scores than average.  This project determines reputation by subtracting the absolute value of the leniency from 1. Additionally, the range for Hamer’s algorithm is (0,∞) while for Lauw’s algorithm it is [0,1]. &lt;br /&gt;
:;Reputation range of Lauw’s algorithm is&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: red&amp;quot;&amp;gt;red&amp;lt;/span&amp;gt;                   value is &amp;lt; 0.2&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: yellow&amp;quot;&amp;gt;yellow&amp;lt;/span&amp;gt;              value is &amp;gt;= 0.2 and &amp;lt;= 0.4&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: orange&amp;quot;&amp;gt;orange&amp;lt;/span&amp;gt;             value is &amp;gt; 0.4 and &amp;lt;= 0.6&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: HoneyDew&amp;quot;&amp;gt;light green&amp;lt;/span&amp;gt;       value is &amp;gt; 0.6 and &amp;lt;= 0.8&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: Chartreuse&amp;quot;&amp;gt;green&amp;lt;/span&amp;gt;               value is &amp;gt; 0.8&lt;br /&gt;
&lt;br /&gt;
The instructor can choose to show results from Hamer’s algorithm or Lauw’s algorithm. The default algorithm should be Lauw’s algorithm.&lt;br /&gt;
&lt;br /&gt;
=== Objectives ===&lt;br /&gt;
&lt;br /&gt;
Our objectives for this project are the following:&lt;br /&gt;
* Double and stub an assignment, a few submissions to the assignment, under different review rubrics&lt;br /&gt;
* Manually calculate reputation scores based on paper &amp;quot;Pluggable reputation systems for peer review: A web-service approach&amp;quot;&lt;br /&gt;
* Validate correct reputation scores based on different review rubrics generated by reputation management VS manual computation of reputation score using the Hamer's and Lauw's algorithm.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
*reputation_web_service_controller_spec&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
=== Setup Testing Objects ===&lt;br /&gt;
In order to implement testing on reputation, it is crucial to create sample reviews so that we could possibly obtain reputation score. During the kickoff meeting, our team defined four necessary steps to follow for the purpose of testing. Also, appropriate objects could be created and confined as discussed below.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The manifestation of each object will contribute to the success of the following test on reputations. Some fields in each object can be empty or have default values. Some attributes are not relevant to the test. When implementing the test, the test scripts need to generate or set fixed values for corresponding fields.&lt;br /&gt;
&lt;br /&gt;
==== Assignment ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[assignments]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Essential Parameters to be configured&amp;lt;br&amp;gt;&lt;br /&gt;
submitter_count = 0;&amp;lt;br&amp;gt;&lt;br /&gt;
num_reviews = 5;&amp;lt;br&amp;gt;&lt;br /&gt;
num_reviewers = 5;&amp;lt;br&amp;gt;&lt;br /&gt;
num_reviews_allowed = 5;&amp;lt;br&amp;gt;&lt;br /&gt;
rounds_of_reviews = 2;&amp;lt;br&amp;gt;&lt;br /&gt;
reputation_algorithm = lauw/hamer;&amp;lt;br&amp;gt;&lt;br /&gt;
Note: Two assignment objects were created. Assignment_1 used lauw's algorithm, whereas assignment_2 used hamer's alogorithm.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @assignment_1 = create(:assignment, created_at: DateTime.now.in_time_zone - 13.day, submitter_count: 0, num_reviews: 3, num_reviewers: 5, num_reviews_allowed: 5, rounds_of_reviews: 2, reputation_algorithm: 'lauw', id: 1)&lt;br /&gt;
  @assignment_2 = create(:assignment, created_at: DateTime.now.in_time_zone - 13.day, submitter_count: 0, num_reviews: 3, num_reviewers: 5, num_reviews_allowed: 5, rounds_of_reviews: 2, reputation_algorithm: 'hamer', id: 2)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Questionnaires(Rubrics) ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[questionnaires]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[assignment_questionnaires]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Essential Parameters to be configured&amp;lt;br&amp;gt;&lt;br /&gt;
min_question_score = 0;&amp;lt;br&amp;gt;&lt;br /&gt;
max_question_score = 5;&amp;lt;br&amp;gt;&lt;br /&gt;
type = ReviewQuestionnaire;&amp;lt;br&amp;gt;&lt;br /&gt;
Note: We will define the assignment with ReviewQuestionnaire type rubric. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @questionnaire_1 = create(:questionnaire, min_question_score: 0, max_question_score: 5, type: 'ReviewQuestionnaire', id: 1)&lt;br /&gt;
  @assignment_questionnaire_1_1 = create(:assignment_questionnaire, assignment_id: @assignment_1.id, questionnaire_id: @questionnaire_1.id, used_in_round: 1)&lt;br /&gt;
  @assignment_questionnaire_1_2 = create(:assignment_questionnaire, assignment_id: @assignment_1.id, questionnaire_id: @questionnaire_1.id, used_in_round: 2)&lt;br /&gt;
  @assignment_questionnaire_2_1 = create(:assignment_questionnaire, assignment_id: @assignment_2.id, questionnaire_id: @questionnaire_1.id, used_in_round: 1)&lt;br /&gt;
  @assignment_questionnaire_2_2 = create(:assignment_questionnaire, assignment_id: @assignment_2.id, questionnaire_id: @questionnaire_1.id, used_in_round: 2)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Questions under Questionnaires ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[questions]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  # question_i_j means question #j in questionnaire #i.&lt;br /&gt;
  @question_1_1 = create(:question, questionnaire_id: @questionnaire_1.id, id: 1)&lt;br /&gt;
  @question_1_2 = create(:question, questionnaire_id: @questionnaire_1.id, id: 2)&lt;br /&gt;
  @question_1_3 = create(:question, questionnaire_id: @questionnaire_1.id, id: 3)&lt;br /&gt;
  @question_1_4 = create(:question, questionnaire_id: @questionnaire_1.id, id: 4)&lt;br /&gt;
  @question_1_5 = create(:question, questionnaire_id: @questionnaire_1.id, id: 5)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Reviewers and Reviewees ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[participants]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[teams]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
Reviewers (Participant):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @reviewer_1 = create(:participant, can_review: 1)&lt;br /&gt;
  @reviewer_2 = create(:participant, can_review: 1)&lt;br /&gt;
  @reviewer_3 = create(:participant, can_review: 1)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Reviewees (Teams):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @reviewee_1 = create(:assignment_team, assignment: @assignment)&lt;br /&gt;
  @reviewee_2 = create(:assignment_team, assignment: @assignment)&lt;br /&gt;
  @reviewee_3 = create(:assignment_team, assignment: @assignment)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Responses ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[response_maps]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[responses]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Essential Parameters to be configured&amp;lt;br&amp;gt;&lt;br /&gt;
reviewed_object_id = &amp;lt;target_assignment&amp;gt;.id ; &amp;lt;br&amp;gt;&lt;br /&gt;
reviewer_id = &amp;lt;target_reviewer&amp;gt;.id ; &amp;lt;br&amp;gt;&lt;br /&gt;
reviewee_id = &amp;lt;target_reviewee&amp;gt;.id ; &amp;lt;br&amp;gt;&lt;br /&gt;
Note: The response map is setup to determine the relationship between reviewer and reviewee of an assignment.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
Response_maps:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  # response_map_&amp;lt;i&amp;gt;_&amp;lt;j&amp;gt; means response of reviewer #j to reviewee #i. &lt;br /&gt;
  @response_map_1_1 = create(:review_response_map, reviewer_id: @reviewer_1.id, reviewee_id: @reviewee_1.id)&lt;br /&gt;
  @response_map_1_2 = create(:review_response_map, reviewer_id: @reviewer_2.id, reviewee_id: @reviewee_1.id)&lt;br /&gt;
  @response_map_1_3 = create(:review_response_map, reviewer_id: @reviewer_3.id, reviewee_id: @reviewee_1.id)&lt;br /&gt;
&lt;br /&gt;
  @response_map_2_1 = create(:review_response_map, reviewer_id: @reviewer_1.id, reviewee_id: @reviewee_2.id)&lt;br /&gt;
  @response_map_2_2 = create(:review_response_map, reviewer_id: @reviewer_2.id, reviewee_id: @reviewee_2.id)&lt;br /&gt;
  @response_map_2_3 = create(:review_response_map, reviewer_id: @reviewer_3.id, reviewee_id: @reviewee_2.id)&lt;br /&gt;
&lt;br /&gt;
  @response_map_3_1 = create(:review_response_map, reviewer_id: @reviewer_1.id, reviewee_id: @reviewee_3.id)&lt;br /&gt;
  @response_map_3_2 = create(:review_response_map, reviewer_id: @reviewer_2.id, reviewee_id: @reviewee_3.id)&lt;br /&gt;
  @response_map_3_3 = create(:review_response_map, reviewer_id: @reviewer_3.id, reviewee_id: @reviewee_3.id)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Responses:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  # response_&amp;lt;i&amp;gt;_&amp;lt;j&amp;gt; means response of reviewer #j to reviewee #i. &lt;br /&gt;
  @response_1_1 = create(:response, is_submitted: true, map_id: @response_map_1_1.id)&lt;br /&gt;
  @response_1_2 = create(:response, is_submitted: true, map_id: @response_map_1_2.id)&lt;br /&gt;
  @response_1_3 = create(:response, is_submitted: true, map_id: @response_map_1_3.id)&lt;br /&gt;
&lt;br /&gt;
  @response_2_1 = create(:response, is_submitted: true, map_id: @response_map_2_1.id)&lt;br /&gt;
  @response_2_2 = create(:response, is_submitted: true, map_id: @response_map_2_2.id)&lt;br /&gt;
  @response_2_3 = create(:response, is_submitted: true, map_id: @response_map_2_3.id)&lt;br /&gt;
&lt;br /&gt;
  @response_3_1 = create(:response, is_submitted: true, map_id: @response_map_3_1.id)&lt;br /&gt;
  @response_3_2 = create(:response, is_submitted: true, map_id: @response_map_3_2.id)&lt;br /&gt;
  @response_3_3 = create(:response, is_submitted: true, map_id: @response_map_3_3.id)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Relevant Methods ===&lt;br /&gt;
==== db_query ====&lt;br /&gt;
This is the normal db query method, call this method will return peer review grades with given assignment id.&lt;br /&gt;
We will test this method in two aspect. &lt;br /&gt;
1. Test whether or not the grade return is right based on the specified algorithm.&lt;br /&gt;
2. We need to test the correctness of the query.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context 'test db_query' do&lt;br /&gt;
    it 'return average score' do&lt;br /&gt;
      # reivewer_1's review for reviewee_1: [1, 2, 3, 4, 5]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_1.id, answer: 1)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_1.id, answer: 2)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_1.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_1.id, answer: 4)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      result = ReputationWebServiceController.new.db_query(1, 1, false)&lt;br /&gt;
      expect(result).to eq([[2, 1, 60.0]])&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== json_generator ====&lt;br /&gt;
This method will generate the hash format of the review, we will test this method by calling to and convert the result to json format the print to test its correctness.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context 'test json_generator' do&lt;br /&gt;
    it 'test 3 reviewer for one reviewee' do&lt;br /&gt;
      # reivewer_1's review for reviewee_1: [5, 5, 5, 5, 5]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
&lt;br /&gt;
      # reivewer_2's review for reviewee_1: [3, 3, 3, 3, 3]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
&lt;br /&gt;
      # reivewer_3's review for reviewee_1: [1, 1, 1, 1, 1]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
&lt;br /&gt;
      result = ReputationWebServiceController.new.json_generator(1, 0, 1)&lt;br /&gt;
      expect(result).to eq({&amp;quot;submission1&amp;quot;=&amp;gt;{&amp;quot;stu2&amp;quot;=&amp;gt;100.0, &amp;quot;stu3&amp;quot;=&amp;gt;60.0, &amp;quot;stu4&amp;quot;=&amp;gt;20.0}})&lt;br /&gt;
      #repeat for different answers&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'test same reviewer for different reviewee' do&lt;br /&gt;
      # reivewer_1's review for reviewee_1: [5, 5, 5, 5, 5]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
&lt;br /&gt;
      # reivewer_1's review for reviewee_2: [3, 3, 3, 3, 3]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
&lt;br /&gt;
      result = ReputationWebServiceController.new.json_generator(1, 0, 1)&lt;br /&gt;
      expect(result).to eq(&amp;quot;submission1&amp;quot;=&amp;gt;{&amp;quot;stu2&amp;quot;=&amp;gt;100.0}, &amp;quot;submission2&amp;quot;=&amp;gt;{&amp;quot;stu2&amp;quot;=&amp;gt;60.0})&lt;br /&gt;
      #repeat for different answers&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== send_post_request ==== &lt;br /&gt;
This method send a post request to peerlogic.csc.ncsu.edu/reputation/calculations/reputation_algorithms to calculate get the reputation result and use show the result in corresponding UI and update given reviewer's reputation. We will test this method based on the algorithm in the paper, first to test the result reputation value, second to test the update value in database.&lt;br /&gt;
&lt;br /&gt;
Note that this method is not functioning due to the missing public &amp;amp; private key file for RSA encryption. The algorithm involving &amp;quot;expert grade&amp;quot; was also not implemented. &lt;br /&gt;
Thus, this method could not be properly tested. However we have given the template to create tests for future use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context 'test send_post_request' do&lt;br /&gt;
    it 'failed because of no public key file' do&lt;br /&gt;
      # reivewer_1's review for reviewee_1: [5, 5, 5, 5, 5]&lt;br /&gt;
      # create 5 answers for 5 related questions&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
&lt;br /&gt;
      # choose hammer algorithm without expert grade(intructor's given grade)&lt;br /&gt;
      params = {assignment_id: 1, round_num: 1, algorithm: 'hammer', checkbox: {expert_grade: &amp;quot;empty&amp;quot;}}&lt;br /&gt;
      session = {user: build(:instructor, id: 1)}&lt;br /&gt;
&lt;br /&gt;
      expect(true).to eq(true)&lt;br /&gt;
&lt;br /&gt;
      # comment out because send_post_request method request public key file while this file is missing&lt;br /&gt;
      # so at this time send_post_request is not functioning normally&lt;br /&gt;
      # if it functions correctly, it will update the reviewer's reputation score according to the selected reputation algorithm.&lt;br /&gt;
&lt;br /&gt;
      # get :send_post_request, params, session&lt;br /&gt;
      # expect(response).to redirect_to '/reputation_web_service/client'&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
=== Testing Results ===&lt;br /&gt;
&lt;br /&gt;
=== Coverage ===&lt;br /&gt;
&lt;br /&gt;
== Future Tasks ==&lt;br /&gt;
As our team could not obtain the public/private key pair to access the reputation web service, we were only able get to the step prior to sending the JSON to the web service of reputation algorithms. Therefore, future steps are required to test on reputation system. &lt;br /&gt;
&lt;br /&gt;
# Current setup is based on assignment_1, which uses lauw's algorithm to calculate reputation score. Future testing team need to setup similar object set for assignment_2, which uses hamer's algorithm. &lt;br /&gt;
# In  send_post_request, there are references to specific assignments, such as 724, 735, and 756. They were put in to gather data for a paper published in 2015. They are no longer relevant and should be removed. (Need to replace by the comment Professor mentioned in the meeting today)&lt;br /&gt;
# Round 1 and round 2?&lt;br /&gt;
# The db_query violates the DRY principle as it repetitively calculates sum of the assignment. Such sum calculation should be handled in the assignment.rb.&lt;br /&gt;
&lt;br /&gt;
== Collaborators ==&lt;br /&gt;
Jinku Cui (jcui23)&lt;br /&gt;
&lt;br /&gt;
Henry Chen (hchen34)&lt;br /&gt;
&lt;br /&gt;
Dong Li (dli35)&lt;br /&gt;
&lt;br /&gt;
Zijun Lu (zlu5)&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[https://doi.org/10.1109/FIE.2015.7344292 Pluggable reputation systems for peer review: A web-service approach]&lt;/div&gt;</summary>
		<author><name>Hchen34</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2168._Testing_-_Reputations&amp;diff=142270</id>
		<title>CSC/ECE 517 Fall 2021 - E2168. Testing - Reputations</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2168._Testing_-_Reputations&amp;diff=142270"/>
		<updated>2021-11-30T03:29:04Z</updated>

		<summary type="html">&lt;p&gt;Hchen34: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Project Overview ==&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;q&amp;gt;Online peer-review systems are now in common use in higher education. They free the instructor and course staff from having to provide personally all the feedback that students receive on their work. However, if we want to assure that all students receive competent feedback, or even use peer-assigned grades, we need a way to judge which peer reviewers are most credible. The solution is to use a reputation system.&amp;lt;/q&amp;gt; &amp;lt;br&amp;gt; The reputation system is meant to provide objective value to student assigned peer review scores. Students select from a list of tasks to be performed and then prepare their work and submit it to a peer-review system. The work is then reviewed by other students who offer comments/graded feedback to help the submitters improve their work.&lt;br /&gt;
During the peer review period it is important to determine which reviews are more accurate and show higher quality. Reputation is one way to achieve this goal; it is a quantization measurement to judge which peer reviewers are more reliable.&lt;br /&gt;
Peer reviewers can use expertiza to score an author. If Expertiza shows a confidence ratings for grades based upon the reviewers reputation then authors can more easily determine the legitimacy of the peer assigned score. In addition, the teaching staff can examine the quality of each peer review based on reputation values and, potentially, crowd-source a significant portion of the grading function.&lt;br /&gt;
Currently the reputation system is implemented in Expertiza through web-service, but there's no test written for it. Thus our goal is to set up assignments and reviews that would produce specific reputation scores, and test that the correct reputations are in fact being produced.&lt;br /&gt;
&lt;br /&gt;
=== System Design ===&lt;br /&gt;
The below is referenced from project E1625, which would give us the overall description of the reputation system.&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Diagram E1625.png|1000px]]&amp;lt;br&amp;gt;&lt;br /&gt;
There are two algorithms intended for use in calculation of the reputation values for participants. &lt;br /&gt;
&lt;br /&gt;
There is a [https://expertiza.ncsu.edu/reputation_web_service/client web-service] (the link accessible only to the instructors) available which serves a JSON response containing the reputation value based on the seed provided in the form of the last known reputation value which we store in the ''participants'' table. An instructor can specify which algorithm to use for a particular assignment to calculate the confidence rating. &lt;br /&gt;
&lt;br /&gt;
As the [https://docs.google.com/viewer?url=https%3A%2F%2Fwww.researchgate.net%2Fprofile%2FYang_Song36%2Fpublication%2F289528736_Pluggable_Reputation_Systems_for_Peer_Review_a_Web-Service_Approach%2Flinks%2F568ec8d008ae78cc05160aed.pdf%3FinViewer%3D0%26pdfJsDownload%3D0%26origin%3Dpublication_detail paper] on reputation system by observes, “the Hamer-peer algorithm has the lowest maximum absolute bias and the Lauw-peer algorithm has the lowest overall bias.This indicates, from the instructor’s perspective, if there are further assignments of this kind, expert grading may not be necessary.”&lt;br /&gt;
:;Reputation range of Hamer’s algorithm is :&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: red;&amp;quot;&amp;gt;red&amp;lt;/span&amp;gt;                   value &amp;lt; 0.5&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: yellow&amp;quot;&amp;gt;yellow&amp;lt;/span&amp;gt;              value is &amp;gt;= 0.5 and &amp;lt;= 1&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: orange&amp;quot;&amp;gt;orange&amp;lt;/span&amp;gt;             value is &amp;gt; 1 and &amp;lt;= 1.5&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: HoneyDew&amp;quot;&amp;gt;light green&amp;lt;/span&amp;gt;       value is &amp;gt; 1.5 and &amp;lt;= 2&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: Chartreuse&amp;quot;&amp;gt;green&amp;lt;/span&amp;gt;               value is &amp;gt; 2&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The main difference between the Hamer-peer and the Lauw-peer algorithm is that the Lauw-peer algorithm keeps track of the reviewer's leniency (“bias”), which can be either positive or negative. A positive leniency indicates the reviewer tends to give higher scores than average.  This project determines reputation by subtracting the absolute value of the leniency from 1. Additionally, the range for Hamer’s algorithm is (0,∞) while for Lauw’s algorithm it is [0,1]. &lt;br /&gt;
:;Reputation range of Lauw’s algorithm is&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: red&amp;quot;&amp;gt;red&amp;lt;/span&amp;gt;                   value is &amp;lt; 0.2&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: yellow&amp;quot;&amp;gt;yellow&amp;lt;/span&amp;gt;              value is &amp;gt;= 0.2 and &amp;lt;= 0.4&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: orange&amp;quot;&amp;gt;orange&amp;lt;/span&amp;gt;             value is &amp;gt; 0.4 and &amp;lt;= 0.6&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: HoneyDew&amp;quot;&amp;gt;light green&amp;lt;/span&amp;gt;       value is &amp;gt; 0.6 and &amp;lt;= 0.8&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: Chartreuse&amp;quot;&amp;gt;green&amp;lt;/span&amp;gt;               value is &amp;gt; 0.8&lt;br /&gt;
&lt;br /&gt;
The instructor can choose to show results from Hamer’s algorithm or Lauw’s algorithm. The default algorithm should be Lauw’s algorithm.&lt;br /&gt;
&lt;br /&gt;
=== Objectives ===&lt;br /&gt;
&lt;br /&gt;
Our objectives for this project are the following:&lt;br /&gt;
* Double and stub an assignment, a few submissions to the assignment, under different review rubrics&lt;br /&gt;
* Manually calculate reputation scores based on paper &amp;quot;Pluggable reputation systems for peer review: A web-service approach&amp;quot;&lt;br /&gt;
* Validate correct reputation scores based on different review rubrics generated by reputation management VS manual computation of reputation score using the Hamer's and Lauw's algorithm.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
*reputation_web_service_controller_spec&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
=== Setup Testing Objects ===&lt;br /&gt;
In order to implement testing on reputation, it is crucial to create sample reviews so that we could possibly obtain reputation score. During the kickoff meeting, our team defined four necessary steps to follow for the purpose of testing. Also, appropriate objects could be created and confined as discussed below.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The manifestation of each object will contribute to the success of the following test on reputations. Some fields in each object can be empty or have default values. Some attributes are not relevant to the test. When implementing the test, the test scripts need to generate or set fixed values for corresponding fields.&lt;br /&gt;
&lt;br /&gt;
==== Assignment ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[assignments]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Essential Parameters to be configured&amp;lt;br&amp;gt;&lt;br /&gt;
submitter_count = 0;&amp;lt;br&amp;gt;&lt;br /&gt;
num_reviews = 5;&amp;lt;br&amp;gt;&lt;br /&gt;
num_reviewers = 5;&amp;lt;br&amp;gt;&lt;br /&gt;
num_reviews_allowed = 5;&amp;lt;br&amp;gt;&lt;br /&gt;
rounds_of_reviews = 2;&amp;lt;br&amp;gt;&lt;br /&gt;
reputation_algorithm = lauw/hamer;&amp;lt;br&amp;gt;&lt;br /&gt;
Note: Two assignment objects were created. Assignment_1 used lauw's algorithm, whereas assignment_2 used hamer's alogorithm.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @assignment_1 = create(:assignment, created_at: DateTime.now.in_time_zone - 13.day, submitter_count: 0, num_reviews: 3, num_reviewers: 5, num_reviews_allowed: 5, rounds_of_reviews: 2, reputation_algorithm: 'lauw', id: 1)&lt;br /&gt;
  @assignment_2 = create(:assignment, created_at: DateTime.now.in_time_zone - 13.day, submitter_count: 0, num_reviews: 3, num_reviewers: 5, num_reviews_allowed: 5, rounds_of_reviews: 2, reputation_algorithm: 'hamer', id: 2)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Questionnaires(Rubrics) ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[questionnaires]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[assignment_questionnaires]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Essential Parameters to be configured&amp;lt;br&amp;gt;&lt;br /&gt;
min_question_score = 0;&amp;lt;br&amp;gt;&lt;br /&gt;
max_question_score = 5;&amp;lt;br&amp;gt;&lt;br /&gt;
type = ReviewQuestionnaire;&amp;lt;br&amp;gt;&lt;br /&gt;
Note: We will define the assignment with ReviewQuestionnaire type rubric. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @questionnaire_1 = create(:questionnaire, min_question_score: 0, max_question_score: 5, type: 'ReviewQuestionnaire', id: 1)&lt;br /&gt;
  @assignment_questionnaire_1_1 = create(:assignment_questionnaire, assignment_id: @assignment_1.id, questionnaire_id: @questionnaire_1.id, used_in_round: 1)&lt;br /&gt;
  @assignment_questionnaire_1_2 = create(:assignment_questionnaire, assignment_id: @assignment_1.id, questionnaire_id: @questionnaire_1.id, used_in_round: 2)&lt;br /&gt;
  @assignment_questionnaire_2_1 = create(:assignment_questionnaire, assignment_id: @assignment_2.id, questionnaire_id: @questionnaire_1.id, used_in_round: 1)&lt;br /&gt;
  @assignment_questionnaire_2_2 = create(:assignment_questionnaire, assignment_id: @assignment_2.id, questionnaire_id: @questionnaire_1.id, used_in_round: 2)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Questions under Questionnaires ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[questions]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  # question_i_j means question #j in questionnaire #i.&lt;br /&gt;
  @question_1_1 = create(:question, questionnaire_id: @questionnaire_1.id, id: 1)&lt;br /&gt;
  @question_1_2 = create(:question, questionnaire_id: @questionnaire_1.id, id: 2)&lt;br /&gt;
  @question_1_3 = create(:question, questionnaire_id: @questionnaire_1.id, id: 3)&lt;br /&gt;
  @question_1_4 = create(:question, questionnaire_id: @questionnaire_1.id, id: 4)&lt;br /&gt;
  @question_1_5 = create(:question, questionnaire_id: @questionnaire_1.id, id: 5)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Reviewers and Reviewees ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[participants]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[teams]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
Reviewers (Participant):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @reviewer_1 = create(:participant, can_review: 1)&lt;br /&gt;
  @reviewer_2 = create(:participant, can_review: 1)&lt;br /&gt;
  @reviewer_3 = create(:participant, can_review: 1)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Reviewees (Teams):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @reviewee_1 = create(:assignment_team, assignment: @assignment)&lt;br /&gt;
  @reviewee_2 = create(:assignment_team, assignment: @assignment)&lt;br /&gt;
  @reviewee_3 = create(:assignment_team, assignment: @assignment)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Responses ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[response_maps]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[responses]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Essential Parameters to be configured&amp;lt;br&amp;gt;&lt;br /&gt;
reviewed_object_id = &amp;lt;target_assignment&amp;gt;.id ; &amp;lt;br&amp;gt;&lt;br /&gt;
reviewer_id = &amp;lt;target_reviewer&amp;gt;.id ; &amp;lt;br&amp;gt;&lt;br /&gt;
reviewee_id = &amp;lt;target_reviewee&amp;gt;.id ; &amp;lt;br&amp;gt;&lt;br /&gt;
Note: The response map is setup to determine the relationship between reviewer and reviewee of an assignment.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
Response_maps:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  # response_map_&amp;lt;i&amp;gt;_&amp;lt;j&amp;gt; means response of reviewer #j's to reviewee #i. &lt;br /&gt;
  @response_map_1_1 = create(:review_response_map, reviewer_id: @reviewer_1.id, reviewee_id: @reviewee_1.id)&lt;br /&gt;
  @response_map_1_2 = create(:review_response_map, reviewer_id: @reviewer_2.id, reviewee_id: @reviewee_1.id)&lt;br /&gt;
  @response_map_1_3 = create(:review_response_map, reviewer_id: @reviewer_3.id, reviewee_id: @reviewee_1.id)&lt;br /&gt;
&lt;br /&gt;
  @response_map_2_1 = create(:review_response_map, reviewer_id: @reviewer_1.id, reviewee_id: @reviewee_2.id)&lt;br /&gt;
  @response_map_2_2 = create(:review_response_map, reviewer_id: @reviewer_2.id, reviewee_id: @reviewee_2.id)&lt;br /&gt;
  @response_map_2_3 = create(:review_response_map, reviewer_id: @reviewer_3.id, reviewee_id: @reviewee_2.id)&lt;br /&gt;
&lt;br /&gt;
  @response_map_3_1 = create(:review_response_map, reviewer_id: @reviewer_1.id, reviewee_id: @reviewee_3.id)&lt;br /&gt;
  @response_map_3_2 = create(:review_response_map, reviewer_id: @reviewer_2.id, reviewee_id: @reviewee_3.id)&lt;br /&gt;
  @response_map_3_3 = create(:review_response_map, reviewer_id: @reviewer_3.id, reviewee_id: @reviewee_3.id)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Responses:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  # response_&amp;lt;i&amp;gt;_&amp;lt;j&amp;gt; means response of reviewer #j's to reviewee #i. &lt;br /&gt;
  @response_1_1 = create(:response, is_submitted: true, map_id: @response_map_1_1.id)&lt;br /&gt;
  @response_1_2 = create(:response, is_submitted: true, map_id: @response_map_1_2.id)&lt;br /&gt;
  @response_1_3 = create(:response, is_submitted: true, map_id: @response_map_1_3.id)&lt;br /&gt;
&lt;br /&gt;
  @response_2_1 = create(:response, is_submitted: true, map_id: @response_map_2_1.id)&lt;br /&gt;
  @response_2_2 = create(:response, is_submitted: true, map_id: @response_map_2_2.id)&lt;br /&gt;
  @response_2_3 = create(:response, is_submitted: true, map_id: @response_map_2_3.id)&lt;br /&gt;
&lt;br /&gt;
  @response_3_1 = create(:response, is_submitted: true, map_id: @response_map_3_1.id)&lt;br /&gt;
  @response_3_2 = create(:response, is_submitted: true, map_id: @response_map_3_2.id)&lt;br /&gt;
  @response_3_3 = create(:response, is_submitted: true, map_id: @response_map_3_3.id)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Relevant Methods ===&lt;br /&gt;
==== db_query ====&lt;br /&gt;
This is the normal db query method, call this method will return peer review grades with given assignment id.&lt;br /&gt;
We will test this method in two aspect. &lt;br /&gt;
1. Test whether or not the grade return is right based on the specified algorithm.&lt;br /&gt;
2. We need to test the correctness of the query.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context 'test db_query' do&lt;br /&gt;
    it 'return average score' do&lt;br /&gt;
      # reivewer_1's review for reviewee_1: [1, 2, 3, 4, 5]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_1.id, answer: 1)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_1.id, answer: 2)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_1.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_1.id, answer: 4)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      result = ReputationWebServiceController.new.db_query(1, 1, false)&lt;br /&gt;
      expect(result).to eq([[2, 1, 60.0]])&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== json_generator ====&lt;br /&gt;
This method will generate the hash format of the review, we will test this method by calling to and convert the result to json format the print to test its correctness.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context 'test json_generator' do&lt;br /&gt;
    it 'test 3 reviewer for one reviewee' do&lt;br /&gt;
      # reivewer_1's review for reviewee_1: [5, 5, 5, 5, 5]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
&lt;br /&gt;
      # reivewer_2's review for reviewee_1: [3, 3, 3, 3, 3]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
&lt;br /&gt;
      # reivewer_3's review for reviewee_1: [1, 1, 1, 1, 1]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
&lt;br /&gt;
      result = ReputationWebServiceController.new.json_generator(1, 0, 1)&lt;br /&gt;
      expect(result).to eq({&amp;quot;submission1&amp;quot;=&amp;gt;{&amp;quot;stu2&amp;quot;=&amp;gt;100.0, &amp;quot;stu3&amp;quot;=&amp;gt;60.0, &amp;quot;stu4&amp;quot;=&amp;gt;20.0}})&lt;br /&gt;
      #repeat for different answers&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'test same reviewer for different reviewee' do&lt;br /&gt;
      # reivewer_1's review for reviewee_1: [5, 5, 5, 5, 5]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
&lt;br /&gt;
      # reivewer_1's review for reviewee_2: [3, 3, 3, 3, 3]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
&lt;br /&gt;
      result = ReputationWebServiceController.new.json_generator(1, 0, 1)&lt;br /&gt;
      expect(result).to eq(&amp;quot;submission1&amp;quot;=&amp;gt;{&amp;quot;stu2&amp;quot;=&amp;gt;100.0}, &amp;quot;submission2&amp;quot;=&amp;gt;{&amp;quot;stu2&amp;quot;=&amp;gt;60.0})&lt;br /&gt;
      #repeat for different answers&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== send_post_request ==== &lt;br /&gt;
This method send a post request to peerlogic.csc.ncsu.edu/reputation/calculations/reputation_algorithms to calculate get the reputation result and use show the result in corresponding UI and update given reviewer's reputation. We will test this method based on the algorithm in the paper, first to test the result reputation value, second to test the update value in database.&lt;br /&gt;
&lt;br /&gt;
Note that this method is not functioning due to the missing public &amp;amp; private key file for RSA encryption. The algorithm involving &amp;quot;expert grade&amp;quot; was also not implemented. &lt;br /&gt;
Thus, this method could not be properly tested. However we have given the template to create tests for future use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context 'test send_post_request' do&lt;br /&gt;
    it 'failed because of no public key file' do&lt;br /&gt;
      # reivewer_1's review for reviewee_1: [5, 5, 5, 5, 5]&lt;br /&gt;
      # create 5 answers for 5 related questions&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
&lt;br /&gt;
      # choose hammer algorithm without expert grade(intructor's given grade)&lt;br /&gt;
      params = {assignment_id: 1, round_num: 1, algorithm: 'hammer', checkbox: {expert_grade: &amp;quot;empty&amp;quot;}}&lt;br /&gt;
      session = {user: build(:instructor, id: 1)}&lt;br /&gt;
&lt;br /&gt;
      expect(true).to eq(true)&lt;br /&gt;
&lt;br /&gt;
      # comment out because send_post_request method request public key file while this file is missing&lt;br /&gt;
      # so at this time send_post_request is not functioning normally&lt;br /&gt;
      # if it functions correctly, it will update the reviewer's reputation score according to the selected reputation algorithm.&lt;br /&gt;
&lt;br /&gt;
      # get :send_post_request, params, session&lt;br /&gt;
      # expect(response).to redirect_to '/reputation_web_service/client'&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
=== Testing Results ===&lt;br /&gt;
&lt;br /&gt;
=== Coverage ===&lt;br /&gt;
&lt;br /&gt;
== Future Tasks ==&lt;br /&gt;
As our team could not obtain the public/private key pair to access the reputation web service, we were only able get to the step prior to sending the JSON to the web service of reputation algorithms. Therefore, future steps are required to test on reputation system. &lt;br /&gt;
&lt;br /&gt;
# Current setup is based on assignment_1, which uses lauw's algorithm to calculate reputation score. Future testing team need to setup similar object set for assignment_2, which uses hamer's algorithm. &lt;br /&gt;
# In  send_post_request, there are references to specific assignments, such as 724, 735, and 756. They were put in to gather data for a paper published in 2015. They are no longer relevant and should be removed. (Need to replace by the comment Professor mentioned in the meeting today)&lt;br /&gt;
# Round 1 and round 2?&lt;br /&gt;
# The db_query violates the DRY principle as it repetitively calculates sum of the assignment. Such sum calculation should be handled in the assignment.rb.&lt;br /&gt;
&lt;br /&gt;
== Collaborators ==&lt;br /&gt;
Jinku Cui (jcui23)&lt;br /&gt;
&lt;br /&gt;
Henry Chen (hchen34)&lt;br /&gt;
&lt;br /&gt;
Dong Li (dli35)&lt;br /&gt;
&lt;br /&gt;
Zijun Lu (zlu5)&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[https://doi.org/10.1109/FIE.2015.7344292 Pluggable reputation systems for peer review: A web-service approach]&lt;/div&gt;</summary>
		<author><name>Hchen34</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2168._Testing_-_Reputations&amp;diff=142268</id>
		<title>CSC/ECE 517 Fall 2021 - E2168. Testing - Reputations</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2168._Testing_-_Reputations&amp;diff=142268"/>
		<updated>2021-11-30T03:28:02Z</updated>

		<summary type="html">&lt;p&gt;Hchen34: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Project Overview ==&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;q&amp;gt;Online peer-review systems are now in common use in higher education. They free the instructor and course staff from having to provide personally all the feedback that students receive on their work. However, if we want to assure that all students receive competent feedback, or even use peer-assigned grades, we need a way to judge which peer reviewers are most credible. The solution is to use a reputation system.&amp;lt;/q&amp;gt; &amp;lt;br&amp;gt; The reputation system is meant to provide objective value to student assigned peer review scores. Students select from a list of tasks to be performed and then prepare their work and submit it to a peer-review system. The work is then reviewed by other students who offer comments/graded feedback to help the submitters improve their work.&lt;br /&gt;
During the peer review period it is important to determine which reviews are more accurate and show higher quality. Reputation is one way to achieve this goal; it is a quantization measurement to judge which peer reviewers are more reliable.&lt;br /&gt;
Peer reviewers can use expertiza to score an author. If Expertiza shows a confidence ratings for grades based upon the reviewers reputation then authors can more easily determine the legitimacy of the peer assigned score. In addition, the teaching staff can examine the quality of each peer review based on reputation values and, potentially, crowd-source a significant portion of the grading function.&lt;br /&gt;
Currently the reputation system is implemented in Expertiza through web-service, but there's no test written for it. Thus our goal is to set up assignments and reviews that would produce specific reputation scores, and test that the correct reputations are in fact being produced.&lt;br /&gt;
&lt;br /&gt;
=== System Design ===&lt;br /&gt;
The below is referenced from project E1625, which would give us the overall description of the reputation system.&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Diagram E1625.png|1000px]]&amp;lt;br&amp;gt;&lt;br /&gt;
There are two algorithms intended for use in calculation of the reputation values for participants. &lt;br /&gt;
&lt;br /&gt;
There is a [https://expertiza.ncsu.edu/reputation_web_service/client web-service] (the link accessible only to the instructors) available which serves a JSON response containing the reputation value based on the seed provided in the form of the last known reputation value which we store in the ''participants'' table. An instructor can specify which algorithm to use for a particular assignment to calculate the confidence rating. &lt;br /&gt;
&lt;br /&gt;
As the [https://docs.google.com/viewer?url=https%3A%2F%2Fwww.researchgate.net%2Fprofile%2FYang_Song36%2Fpublication%2F289528736_Pluggable_Reputation_Systems_for_Peer_Review_a_Web-Service_Approach%2Flinks%2F568ec8d008ae78cc05160aed.pdf%3FinViewer%3D0%26pdfJsDownload%3D0%26origin%3Dpublication_detail paper] on reputation system by observes, “the Hamer-peer algorithm has the lowest maximum absolute bias and the Lauw-peer algorithm has the lowest overall bias.This indicates, from the instructor’s perspective, if there are further assignments of this kind, expert grading may not be necessary.”&lt;br /&gt;
:;Reputation range of Hamer’s algorithm is :&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: red;&amp;quot;&amp;gt;red&amp;lt;/span&amp;gt;                   value &amp;lt; 0.5&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: yellow&amp;quot;&amp;gt;yellow&amp;lt;/span&amp;gt;              value is &amp;gt;= 0.5 and &amp;lt;= 1&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: orange&amp;quot;&amp;gt;orange&amp;lt;/span&amp;gt;             value is &amp;gt; 1 and &amp;lt;= 1.5&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: HoneyDew&amp;quot;&amp;gt;light green&amp;lt;/span&amp;gt;       value is &amp;gt; 1.5 and &amp;lt;= 2&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: Chartreuse&amp;quot;&amp;gt;green&amp;lt;/span&amp;gt;               value is &amp;gt; 2&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The main difference between the Hamer-peer and the Lauw-peer algorithm is that the Lauw-peer algorithm keeps track of the reviewer's leniency (“bias”), which can be either positive or negative. A positive leniency indicates the reviewer tends to give higher scores than average.  This project determines reputation by subtracting the absolute value of the leniency from 1. Additionally, the range for Hamer’s algorithm is (0,∞) while for Lauw’s algorithm it is [0,1]. &lt;br /&gt;
:;Reputation range of Lauw’s algorithm is&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: red&amp;quot;&amp;gt;red&amp;lt;/span&amp;gt;                   value is &amp;lt; 0.2&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: yellow&amp;quot;&amp;gt;yellow&amp;lt;/span&amp;gt;              value is &amp;gt;= 0.2 and &amp;lt;= 0.4&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: orange&amp;quot;&amp;gt;orange&amp;lt;/span&amp;gt;             value is &amp;gt; 0.4 and &amp;lt;= 0.6&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: HoneyDew&amp;quot;&amp;gt;light green&amp;lt;/span&amp;gt;       value is &amp;gt; 0.6 and &amp;lt;= 0.8&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: Chartreuse&amp;quot;&amp;gt;green&amp;lt;/span&amp;gt;               value is &amp;gt; 0.8&lt;br /&gt;
&lt;br /&gt;
The instructor can choose to show results from Hamer’s algorithm or Lauw’s algorithm. The default algorithm should be Lauw’s algorithm.&lt;br /&gt;
&lt;br /&gt;
=== Objectives ===&lt;br /&gt;
&lt;br /&gt;
Our objectives for this project are the following:&lt;br /&gt;
* Double and stub an assignment, a few submissions to the assignment, under different review rubrics&lt;br /&gt;
* Manually calculate reputation scores based on paper &amp;quot;Pluggable reputation systems for peer review: A web-service approach&amp;quot;&lt;br /&gt;
* Validate correct reputation scores based on different review rubrics generated by reputation management VS manual computation of reputation score using the Hamer's and Lauw's algorithm.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
*reputation_web_service_controller_spec&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
=== Setup Testing Objects ===&lt;br /&gt;
In order to implement testing on reputation, it is crucial to create sample reviews so that we could possibly obtain reputation score. During the kickoff meeting, our team defined four necessary steps to follow for the purpose of testing. Also, appropriate objects could be created and confined as discussed below.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The manifestation of each object will contribute to the success of the following test on reputations. Some fields in each object can be empty or have default values. Some attributes are not relevant to the test. When implementing the test, the test scripts need to generate or set fixed values for corresponding fields.&lt;br /&gt;
&lt;br /&gt;
==== Assignment ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[assignments]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Essential Parameters to be configured&amp;lt;br&amp;gt;&lt;br /&gt;
submitter_count = 0;&amp;lt;br&amp;gt;&lt;br /&gt;
num_reviews = 5;&amp;lt;br&amp;gt;&lt;br /&gt;
num_reviewers = 5;&amp;lt;br&amp;gt;&lt;br /&gt;
num_reviews_allowed = 5;&amp;lt;br&amp;gt;&lt;br /&gt;
rounds_of_reviews = 2;&amp;lt;br&amp;gt;&lt;br /&gt;
reputation_algorithm = lauw/hamer;&amp;lt;br&amp;gt;&lt;br /&gt;
Note: Two assignment objects were created. Assignment_1 used lauw's algorithm, whereas assignment_2 used hamer's alogorithm.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @assignment_1 = create(:assignment, created_at: DateTime.now.in_time_zone - 13.day, submitter_count: 0, num_reviews: 3, num_reviewers: 5, num_reviews_allowed: 5, rounds_of_reviews: 2, reputation_algorithm: 'lauw', id: 1)&lt;br /&gt;
  @assignment_2 = create(:assignment, created_at: DateTime.now.in_time_zone - 13.day, submitter_count: 0, num_reviews: 3, num_reviewers: 5, num_reviews_allowed: 5, rounds_of_reviews: 2, reputation_algorithm: 'hamer', id: 2)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Questionnaires(Rubrics) ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[questionnaires]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[assignment_questionnaires]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Essential Parameters to be configured&amp;lt;br&amp;gt;&lt;br /&gt;
min_question_score = 0;&amp;lt;br&amp;gt;&lt;br /&gt;
max_question_score = 5;&amp;lt;br&amp;gt;&lt;br /&gt;
type = ReviewQuestionnaire;&amp;lt;br&amp;gt;&lt;br /&gt;
Note: We will define the assignment with ReviewQuestionnaire type rubric. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @questionnaire_1 = create(:questionnaire, min_question_score: 0, max_question_score: 5, type: 'ReviewQuestionnaire', id: 1)&lt;br /&gt;
  @assignment_questionnaire_1_1 = create(:assignment_questionnaire, assignment_id: @assignment_1.id, questionnaire_id: @questionnaire_1.id, used_in_round: 1)&lt;br /&gt;
  @assignment_questionnaire_1_2 = create(:assignment_questionnaire, assignment_id: @assignment_1.id, questionnaire_id: @questionnaire_1.id, used_in_round: 2)&lt;br /&gt;
  @assignment_questionnaire_2_1 = create(:assignment_questionnaire, assignment_id: @assignment_2.id, questionnaire_id: @questionnaire_1.id, used_in_round: 1)&lt;br /&gt;
  @assignment_questionnaire_2_2 = create(:assignment_questionnaire, assignment_id: @assignment_2.id, questionnaire_id: @questionnaire_1.id, used_in_round: 2)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Questions under Questionnaires ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[questions]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  # question_j_j means question #j in questionnaire #i.&lt;br /&gt;
  @question_1_1 = create(:question, questionnaire_id: @questionnaire_1.id, id: 1)&lt;br /&gt;
  @question_1_2 = create(:question, questionnaire_id: @questionnaire_1.id, id: 2)&lt;br /&gt;
  @question_1_3 = create(:question, questionnaire_id: @questionnaire_1.id, id: 3)&lt;br /&gt;
  @question_1_4 = create(:question, questionnaire_id: @questionnaire_1.id, id: 4)&lt;br /&gt;
  @question_1_5 = create(:question, questionnaire_id: @questionnaire_1.id, id: 5)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Reviewers and Reviewees ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[participants]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[teams]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
Reviewers (Participant):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @reviewer_1 = create(:participant, can_review: 1)&lt;br /&gt;
  @reviewer_2 = create(:participant, can_review: 1)&lt;br /&gt;
  @reviewer_3 = create(:participant, can_review: 1)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Reviewees (Teams):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @reviewee_1 = create(:assignment_team, assignment: @assignment)&lt;br /&gt;
  @reviewee_2 = create(:assignment_team, assignment: @assignment)&lt;br /&gt;
  @reviewee_3 = create(:assignment_team, assignment: @assignment)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Responses ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[response_maps]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[responses]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Essential Parameters to be configured&amp;lt;br&amp;gt;&lt;br /&gt;
reviewed_object_id = &amp;lt;target_assignment&amp;gt;.id ; &amp;lt;br&amp;gt;&lt;br /&gt;
reviewer_id = &amp;lt;target_reviewer&amp;gt;.id ; &amp;lt;br&amp;gt;&lt;br /&gt;
reviewee_id = &amp;lt;target_reviewee&amp;gt;.id ; &amp;lt;br&amp;gt;&lt;br /&gt;
Note: The response map is setup to determine the relationship between reviewer and reviewee of an assignment.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
Response_maps:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  # response_map_&amp;lt;i&amp;gt;_&amp;lt;j&amp;gt; means reviewer #j's review to reviewee #i. &lt;br /&gt;
  @response_map_1_1 = create(:review_response_map, reviewer_id: @reviewer_1.id, reviewee_id: @reviewee_1.id)&lt;br /&gt;
  @response_map_1_2 = create(:review_response_map, reviewer_id: @reviewer_2.id, reviewee_id: @reviewee_1.id)&lt;br /&gt;
  @response_map_1_3 = create(:review_response_map, reviewer_id: @reviewer_3.id, reviewee_id: @reviewee_1.id)&lt;br /&gt;
&lt;br /&gt;
  @response_map_2_1 = create(:review_response_map, reviewer_id: @reviewer_1.id, reviewee_id: @reviewee_2.id)&lt;br /&gt;
  @response_map_2_2 = create(:review_response_map, reviewer_id: @reviewer_2.id, reviewee_id: @reviewee_2.id)&lt;br /&gt;
  @response_map_2_3 = create(:review_response_map, reviewer_id: @reviewer_3.id, reviewee_id: @reviewee_2.id)&lt;br /&gt;
&lt;br /&gt;
  @response_map_3_1 = create(:review_response_map, reviewer_id: @reviewer_1.id, reviewee_id: @reviewee_3.id)&lt;br /&gt;
  @response_map_3_2 = create(:review_response_map, reviewer_id: @reviewer_2.id, reviewee_id: @reviewee_3.id)&lt;br /&gt;
  @response_map_3_3 = create(:review_response_map, reviewer_id: @reviewer_3.id, reviewee_id: @reviewee_3.id)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Responses:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  # response_&amp;lt;i&amp;gt;_&amp;lt;j&amp;gt; means reviewer #j's review to reviewee #i. &lt;br /&gt;
  @response_1_1 = create(:response, is_submitted: true, map_id: @response_map_1_1.id)&lt;br /&gt;
  @response_1_2 = create(:response, is_submitted: true, map_id: @response_map_1_2.id)&lt;br /&gt;
  @response_1_3 = create(:response, is_submitted: true, map_id: @response_map_1_3.id)&lt;br /&gt;
&lt;br /&gt;
  @response_2_1 = create(:response, is_submitted: true, map_id: @response_map_2_1.id)&lt;br /&gt;
  @response_2_2 = create(:response, is_submitted: true, map_id: @response_map_2_2.id)&lt;br /&gt;
  @response_2_3 = create(:response, is_submitted: true, map_id: @response_map_2_3.id)&lt;br /&gt;
&lt;br /&gt;
  @response_3_1 = create(:response, is_submitted: true, map_id: @response_map_3_1.id)&lt;br /&gt;
  @response_3_2 = create(:response, is_submitted: true, map_id: @response_map_3_2.id)&lt;br /&gt;
  @response_3_3 = create(:response, is_submitted: true, map_id: @response_map_3_3.id)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Relevant Methods ===&lt;br /&gt;
==== db_query ====&lt;br /&gt;
This is the normal db query method, call this method will return peer review grades with given assignment id.&lt;br /&gt;
We will test this method in two aspect. &lt;br /&gt;
1. Test whether or not the grade return is right based on the specified algorithm.&lt;br /&gt;
2. We need to test the correctness of the query.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context 'test db_query' do&lt;br /&gt;
    it 'return average score' do&lt;br /&gt;
      # reivewer_1's review for reviewee_1: [1, 2, 3, 4, 5]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_1.id, answer: 1)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_1.id, answer: 2)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_1.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_1.id, answer: 4)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      result = ReputationWebServiceController.new.db_query(1, 1, false)&lt;br /&gt;
      expect(result).to eq([[2, 1, 60.0]])&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== json_generator ====&lt;br /&gt;
This method will generate the hash format of the review, we will test this method by calling to and convert the result to json format the print to test its correctness.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context 'test json_generator' do&lt;br /&gt;
    it 'test 3 reviewer for one reviewee' do&lt;br /&gt;
      # reivewer_1's review for reviewee_1: [5, 5, 5, 5, 5]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
&lt;br /&gt;
      # reivewer_2's review for reviewee_1: [3, 3, 3, 3, 3]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
&lt;br /&gt;
      # reivewer_3's review for reviewee_1: [1, 1, 1, 1, 1]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
&lt;br /&gt;
      result = ReputationWebServiceController.new.json_generator(1, 0, 1)&lt;br /&gt;
      expect(result).to eq({&amp;quot;submission1&amp;quot;=&amp;gt;{&amp;quot;stu2&amp;quot;=&amp;gt;100.0, &amp;quot;stu3&amp;quot;=&amp;gt;60.0, &amp;quot;stu4&amp;quot;=&amp;gt;20.0}})&lt;br /&gt;
      #repeat for different answers&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'test same reviewer for different reviewee' do&lt;br /&gt;
      # reivewer_1's review for reviewee_1: [5, 5, 5, 5, 5]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
&lt;br /&gt;
      # reivewer_1's review for reviewee_2: [3, 3, 3, 3, 3]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
&lt;br /&gt;
      result = ReputationWebServiceController.new.json_generator(1, 0, 1)&lt;br /&gt;
      expect(result).to eq(&amp;quot;submission1&amp;quot;=&amp;gt;{&amp;quot;stu2&amp;quot;=&amp;gt;100.0}, &amp;quot;submission2&amp;quot;=&amp;gt;{&amp;quot;stu2&amp;quot;=&amp;gt;60.0})&lt;br /&gt;
      #repeat for different answers&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== send_post_request ==== &lt;br /&gt;
This method send a post request to peerlogic.csc.ncsu.edu/reputation/calculations/reputation_algorithms to calculate get the reputation result and use show the result in corresponding UI and update given reviewer's reputation. We will test this method based on the algorithm in the paper, first to test the result reputation value, second to test the update value in database.&lt;br /&gt;
&lt;br /&gt;
Note that this method is not functioning due to the missing public &amp;amp; private key file for RSA encryption. The algorithm involving &amp;quot;expert grade&amp;quot; was also not implemented. &lt;br /&gt;
Thus, this method could not be properly tested. However we have given the template to create tests for future use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context 'test send_post_request' do&lt;br /&gt;
    it 'failed because of no public key file' do&lt;br /&gt;
      # reivewer_1's review for reviewee_1: [5, 5, 5, 5, 5]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
&lt;br /&gt;
      params = {assignment_id: 1, round_num: 1, algorithm: 'hammer', checkbox: {expert_grade: &amp;quot;empty&amp;quot;}}&lt;br /&gt;
      session = {user: build(:instructor, id: 1)}&lt;br /&gt;
&lt;br /&gt;
      expect(true).to eq(true)&lt;br /&gt;
&lt;br /&gt;
      # comment out because send_post_request method request public key file while this file is missing&lt;br /&gt;
      # so at this time send_post_request is not functioning normally&lt;br /&gt;
      # get :send_post_request, params, session&lt;br /&gt;
      # expect(response).to redirect_to '/reputation_web_service/client'&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
=== Testing Results ===&lt;br /&gt;
&lt;br /&gt;
=== Coverage ===&lt;br /&gt;
&lt;br /&gt;
== Future Tasks ==&lt;br /&gt;
As our team could not obtain the public/private key pair to access the reputation web service, we were only able get to the step prior to sending the JSON to the web service of reputation algorithms. Therefore, future steps are required to test on reputation system. &lt;br /&gt;
&lt;br /&gt;
# Current setup is based on assignment_1, which uses lauw's algorithm to calculate reputation score. Future testing team need to setup similar object set for assignment_2, which uses hamer's algorithm. &lt;br /&gt;
# In  send_post_request, there are references to specific assignments, such as 724, 735, and 756. They were put in to gather data for a paper published in 2015. They are no longer relevant and should be removed. (Need to replace by the comment Professor mentioned in the meeting today)&lt;br /&gt;
# Round 1 and round 2?&lt;br /&gt;
# The db_query violates the DRY principle as it repetitively calculates sum of the assignment. Such sum calculation should be handled in the assignment.rb.&lt;br /&gt;
&lt;br /&gt;
== Collaborators ==&lt;br /&gt;
Jinku Cui (jcui23)&lt;br /&gt;
&lt;br /&gt;
Henry Chen (hchen34)&lt;br /&gt;
&lt;br /&gt;
Dong Li (dli35)&lt;br /&gt;
&lt;br /&gt;
Zijun Lu (zlu5)&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[https://doi.org/10.1109/FIE.2015.7344292 Pluggable reputation systems for peer review: A web-service approach]&lt;/div&gt;</summary>
		<author><name>Hchen34</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2168._Testing_-_Reputations&amp;diff=142265</id>
		<title>CSC/ECE 517 Fall 2021 - E2168. Testing - Reputations</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2168._Testing_-_Reputations&amp;diff=142265"/>
		<updated>2021-11-30T03:24:30Z</updated>

		<summary type="html">&lt;p&gt;Hchen34: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Project Overview ==&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;q&amp;gt;Online peer-review systems are now in common use in higher education. They free the instructor and course staff from having to provide personally all the feedback that students receive on their work. However, if we want to assure that all students receive competent feedback, or even use peer-assigned grades, we need a way to judge which peer reviewers are most credible. The solution is to use a reputation system.&amp;lt;/q&amp;gt; &amp;lt;br&amp;gt; The reputation system is meant to provide objective value to student assigned peer review scores. Students select from a list of tasks to be performed and then prepare their work and submit it to a peer-review system. The work is then reviewed by other students who offer comments/graded feedback to help the submitters improve their work.&lt;br /&gt;
During the peer review period it is important to determine which reviews are more accurate and show higher quality. Reputation is one way to achieve this goal; it is a quantization measurement to judge which peer reviewers are more reliable.&lt;br /&gt;
Peer reviewers can use expertiza to score an author. If Expertiza shows a confidence ratings for grades based upon the reviewers reputation then authors can more easily determine the legitimacy of the peer assigned score. In addition, the teaching staff can examine the quality of each peer review based on reputation values and, potentially, crowd-source a significant portion of the grading function.&lt;br /&gt;
Currently the reputation system is implemented in Expertiza through web-service, but there's no test written for it. Thus our goal is to set up assignments and reviews that would produce specific reputation scores, and test that the correct reputations are in fact being produced.&lt;br /&gt;
&lt;br /&gt;
=== System Design ===&lt;br /&gt;
The below is referenced from project E1625, which would give us the overall description of the reputation system.&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Diagram E1625.png|1000px]]&amp;lt;br&amp;gt;&lt;br /&gt;
There are two algorithms intended for use in calculation of the reputation values for participants. &lt;br /&gt;
&lt;br /&gt;
There is a [https://expertiza.ncsu.edu/reputation_web_service/client web-service] (the link accessible only to the instructors) available which serves a JSON response containing the reputation value based on the seed provided in the form of the last known reputation value which we store in the ''participants'' table. An instructor can specify which algorithm to use for a particular assignment to calculate the confidence rating. &lt;br /&gt;
&lt;br /&gt;
As the [https://docs.google.com/viewer?url=https%3A%2F%2Fwww.researchgate.net%2Fprofile%2FYang_Song36%2Fpublication%2F289528736_Pluggable_Reputation_Systems_for_Peer_Review_a_Web-Service_Approach%2Flinks%2F568ec8d008ae78cc05160aed.pdf%3FinViewer%3D0%26pdfJsDownload%3D0%26origin%3Dpublication_detail paper] on reputation system by observes, “the Hamer-peer algorithm has the lowest maximum absolute bias and the Lauw-peer algorithm has the lowest overall bias.This indicates, from the instructor’s perspective, if there are further assignments of this kind, expert grading may not be necessary.”&lt;br /&gt;
:;Reputation range of Hamer’s algorithm is :&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: red;&amp;quot;&amp;gt;red&amp;lt;/span&amp;gt;                   value &amp;lt; 0.5&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: yellow&amp;quot;&amp;gt;yellow&amp;lt;/span&amp;gt;              value is &amp;gt;= 0.5 and &amp;lt;= 1&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: orange&amp;quot;&amp;gt;orange&amp;lt;/span&amp;gt;             value is &amp;gt; 1 and &amp;lt;= 1.5&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: HoneyDew&amp;quot;&amp;gt;light green&amp;lt;/span&amp;gt;       value is &amp;gt; 1.5 and &amp;lt;= 2&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: Chartreuse&amp;quot;&amp;gt;green&amp;lt;/span&amp;gt;               value is &amp;gt; 2&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The main difference between the Hamer-peer and the Lauw-peer algorithm is that the Lauw-peer algorithm keeps track of the reviewer's leniency (“bias”), which can be either positive or negative. A positive leniency indicates the reviewer tends to give higher scores than average.  This project determines reputation by subtracting the absolute value of the leniency from 1. Additionally, the range for Hamer’s algorithm is (0,∞) while for Lauw’s algorithm it is [0,1]. &lt;br /&gt;
:;Reputation range of Lauw’s algorithm is&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: red&amp;quot;&amp;gt;red&amp;lt;/span&amp;gt;                   value is &amp;lt; 0.2&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: yellow&amp;quot;&amp;gt;yellow&amp;lt;/span&amp;gt;              value is &amp;gt;= 0.2 and &amp;lt;= 0.4&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: orange&amp;quot;&amp;gt;orange&amp;lt;/span&amp;gt;             value is &amp;gt; 0.4 and &amp;lt;= 0.6&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: HoneyDew&amp;quot;&amp;gt;light green&amp;lt;/span&amp;gt;       value is &amp;gt; 0.6 and &amp;lt;= 0.8&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: Chartreuse&amp;quot;&amp;gt;green&amp;lt;/span&amp;gt;               value is &amp;gt; 0.8&lt;br /&gt;
&lt;br /&gt;
The instructor can choose to show results from Hamer’s algorithm or Lauw’s algorithm. The default algorithm should be Lauw’s algorithm.&lt;br /&gt;
&lt;br /&gt;
=== Objectives ===&lt;br /&gt;
&lt;br /&gt;
Our objectives for this project are the following:&lt;br /&gt;
* Double and stub an assignment, a few submissions to the assignment, under different review rubrics&lt;br /&gt;
* Manually calculate reputation scores based on paper &amp;quot;Pluggable reputation systems for peer review: A web-service approach&amp;quot;&lt;br /&gt;
* Validate correct reputation scores based on different review rubrics generated by reputation management VS manual computation of reputation score using the Hamer's and Lauw's algorithm.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
*reputation_web_service_controller_spec&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
=== Setup Testing Objects ===&lt;br /&gt;
In order to implement testing on reputation, it is crucial to create sample reviews so that we could possibly obtain reputation score. During the kickoff meeting, our team defined four necessary steps to follow for the purpose of testing. Also, appropriate objects could be created and confined as discussed below.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The manifestation of each object will contribute to the success of the following test on reputations. Some fields in each object can be empty or have default values. Some attributes are not relevant to the test. When implementing the test, the test scripts need to generate or set fixed values for corresponding fields.&lt;br /&gt;
&lt;br /&gt;
==== Assignment ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[assignments]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Essential Parameters to be configured&amp;lt;br&amp;gt;&lt;br /&gt;
submitter_count = 0;&amp;lt;br&amp;gt;&lt;br /&gt;
num_reviews = 5;&amp;lt;br&amp;gt;&lt;br /&gt;
num_reviewers = 5;&amp;lt;br&amp;gt;&lt;br /&gt;
num_reviews_allowed = 5;&amp;lt;br&amp;gt;&lt;br /&gt;
rounds_of_reviews = 2;&amp;lt;br&amp;gt;&lt;br /&gt;
reputation_algorithm = lauw/hamer;&amp;lt;br&amp;gt;&lt;br /&gt;
Note: Two assignment objects were created. Assignment_1 used lauw's algorithm, whereas assignment_2 used hamer's alogorithm.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @assignment_1 = create(:assignment, created_at: DateTime.now.in_time_zone - 13.day, submitter_count: 0, num_reviews: 3, num_reviewers: 5, num_reviews_allowed: 5, rounds_of_reviews: 2, reputation_algorithm: 'lauw', id: 1)&lt;br /&gt;
  @assignment_2 = create(:assignment, created_at: DateTime.now.in_time_zone - 13.day, submitter_count: 0, num_reviews: 3, num_reviewers: 5, num_reviews_allowed: 5, rounds_of_reviews: 2, reputation_algorithm: 'hamer', id: 2)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Questionnaires(Rubrics) ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[questionnaires]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[assignment_questionnaires]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Essential Parameters to be configured&amp;lt;br&amp;gt;&lt;br /&gt;
min_question_score = 0;&amp;lt;br&amp;gt;&lt;br /&gt;
max_question_score = 5;&amp;lt;br&amp;gt;&lt;br /&gt;
type = ReviewQuestionnaire;&amp;lt;br&amp;gt;&lt;br /&gt;
Note: We will define the assignment with ReviewQuestionnaire type rubric. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @questionnaire_1 = create(:questionnaire, min_question_score: 0, max_question_score: 5, type: 'ReviewQuestionnaire', id: 1)&lt;br /&gt;
  @assignment_questionnaire_1_1 = create(:assignment_questionnaire, assignment_id: @assignment_1.id, questionnaire_id: @questionnaire_1.id, used_in_round: 1)&lt;br /&gt;
  @assignment_questionnaire_1_2 = create(:assignment_questionnaire, assignment_id: @assignment_1.id, questionnaire_id: @questionnaire_1.id, used_in_round: 2)&lt;br /&gt;
  @assignment_questionnaire_2_1 = create(:assignment_questionnaire, assignment_id: @assignment_2.id, questionnaire_id: @questionnaire_1.id, used_in_round: 1)&lt;br /&gt;
  @assignment_questionnaire_2_2 = create(:assignment_questionnaire, assignment_id: @assignment_2.id, questionnaire_id: @questionnaire_1.id, used_in_round: 2)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Questions under Questionnaires ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[questions]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  # question_j_j means question #j in questionnaire #i.&lt;br /&gt;
  @question_1_1 = create(:question, questionnaire_id: @questionnaire_1.id, id: 1)&lt;br /&gt;
  @question_1_2 = create(:question, questionnaire_id: @questionnaire_1.id, id: 2)&lt;br /&gt;
  @question_1_3 = create(:question, questionnaire_id: @questionnaire_1.id, id: 3)&lt;br /&gt;
  @question_1_4 = create(:question, questionnaire_id: @questionnaire_1.id, id: 4)&lt;br /&gt;
  @question_1_5 = create(:question, questionnaire_id: @questionnaire_1.id, id: 5)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Reviewers and Reviewees ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[participants]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[teams]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
Reviewers (Participant):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @reviewer_1 = create(:participant, can_review: 1)&lt;br /&gt;
  @reviewer_2 = create(:participant, can_review: 1)&lt;br /&gt;
  @reviewer_3 = create(:participant, can_review: 1)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Reviewees (Teams):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @reviewee_1 = create(:assignment_team, assignment: @assignment)&lt;br /&gt;
  @reviewee_2 = create(:assignment_team, assignment: @assignment)&lt;br /&gt;
  @reviewee_3 = create(:assignment_team, assignment: @assignment)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Responses ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[response_maps]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[responses]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Essential Parameters to be configured&amp;lt;br&amp;gt;&lt;br /&gt;
reviewed_object_id = &amp;lt;target_assignment&amp;gt;.id ; &amp;lt;br&amp;gt;&lt;br /&gt;
reviewer_id = &amp;lt;target_reviewer&amp;gt;.id ; &amp;lt;br&amp;gt;&lt;br /&gt;
reviewee_id = &amp;lt;target_reviewee&amp;gt;.id ; &amp;lt;br&amp;gt;&lt;br /&gt;
Note: The response map is setup to determine the relationship between reviewer and reviewee of an assignment.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
Response_maps:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  # response_map_&amp;lt;i&amp;gt;_&amp;lt;j&amp;gt; means reviewer #1's review to reviewee #j. &lt;br /&gt;
  @response_map_1_1 = create(:review_response_map, reviewer_id: @reviewer_1.id, reviewee_id: @reviewee_1.id)&lt;br /&gt;
  @response_map_1_2 = create(:review_response_map, reviewer_id: @reviewer_2.id, reviewee_id: @reviewee_1.id)&lt;br /&gt;
  @response_map_1_3 = create(:review_response_map, reviewer_id: @reviewer_3.id, reviewee_id: @reviewee_1.id)&lt;br /&gt;
&lt;br /&gt;
  @response_map_2_1 = create(:review_response_map, reviewer_id: @reviewer_1.id, reviewee_id: @reviewee_2.id)&lt;br /&gt;
  @response_map_2_2 = create(:review_response_map, reviewer_id: @reviewer_2.id, reviewee_id: @reviewee_2.id)&lt;br /&gt;
  @response_map_2_3 = create(:review_response_map, reviewer_id: @reviewer_3.id, reviewee_id: @reviewee_2.id)&lt;br /&gt;
&lt;br /&gt;
  @response_map_3_1 = create(:review_response_map, reviewer_id: @reviewer_1.id, reviewee_id: @reviewee_3.id)&lt;br /&gt;
  @response_map_3_2 = create(:review_response_map, reviewer_id: @reviewer_2.id, reviewee_id: @reviewee_3.id)&lt;br /&gt;
  @response_map_3_3 = create(:review_response_map, reviewer_id: @reviewer_3.id, reviewee_id: @reviewee_3.id)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Responses:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  # response_&amp;lt;i&amp;gt;_&amp;lt;j&amp;gt; means reviewer #1's review to reviewee #j. &lt;br /&gt;
  @response_1_1 = create(:response, is_submitted: true, map_id: @response_map_1_1.id)&lt;br /&gt;
  @response_1_2 = create(:response, is_submitted: true, map_id: @response_map_1_2.id)&lt;br /&gt;
  @response_1_3 = create(:response, is_submitted: true, map_id: @response_map_1_3.id)&lt;br /&gt;
&lt;br /&gt;
  @response_2_1 = create(:response, is_submitted: true, map_id: @response_map_2_1.id)&lt;br /&gt;
  @response_2_2 = create(:response, is_submitted: true, map_id: @response_map_2_2.id)&lt;br /&gt;
  @response_2_3 = create(:response, is_submitted: true, map_id: @response_map_2_3.id)&lt;br /&gt;
&lt;br /&gt;
  @response_3_1 = create(:response, is_submitted: true, map_id: @response_map_3_1.id)&lt;br /&gt;
  @response_3_2 = create(:response, is_submitted: true, map_id: @response_map_3_2.id)&lt;br /&gt;
  @response_3_3 = create(:response, is_submitted: true, map_id: @response_map_3_3.id)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Relevant Methods ===&lt;br /&gt;
==== db_query ====&lt;br /&gt;
This is the normal db query method, call this method will return peer review grades with given assignment id.&lt;br /&gt;
We will test this method in two aspect. &lt;br /&gt;
1. Test whether or not the grade return is right based on the specified algorithm.&lt;br /&gt;
2. We need to test the correctness of the query.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context 'test db_query' do&lt;br /&gt;
    it 'return average score' do&lt;br /&gt;
      # reivewer_1's review for reviewee_1: [1, 2, 3, 4, 5]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_1.id, answer: 1)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_1.id, answer: 2)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_1.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_1.id, answer: 4)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      result = ReputationWebServiceController.new.db_query(1, 1, false)&lt;br /&gt;
      expect(result).to eq([[2, 1, 60.0]])&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== json_generator ====&lt;br /&gt;
This method will generate the hash format of the review, we will test this method by calling to and convert the result to json format the print to test its correctness.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context 'test json_generator' do&lt;br /&gt;
    it 'test 3 reviewer for one reviewee' do&lt;br /&gt;
      # reivewer_1's review for reviewee_1: [5, 5, 5, 5, 5]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
&lt;br /&gt;
      # reivewer_2's review for reviewee_1: [3, 3, 3, 3, 3]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
&lt;br /&gt;
      # reivewer_3's review for reviewee_1: [1, 1, 1, 1, 1]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
&lt;br /&gt;
      result = ReputationWebServiceController.new.json_generator(1, 0, 1)&lt;br /&gt;
      expect(result).to eq({&amp;quot;submission1&amp;quot;=&amp;gt;{&amp;quot;stu2&amp;quot;=&amp;gt;100.0, &amp;quot;stu3&amp;quot;=&amp;gt;60.0, &amp;quot;stu4&amp;quot;=&amp;gt;20.0}})&lt;br /&gt;
      #repeat for different answers&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'test same reviewer for different reviewee' do&lt;br /&gt;
      # reivewer_1's review for reviewee_1: [5, 5, 5, 5, 5]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
&lt;br /&gt;
      # reivewer_1's review for reviewee_2: [3, 3, 3, 3, 3]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
&lt;br /&gt;
      result = ReputationWebServiceController.new.json_generator(1, 0, 1)&lt;br /&gt;
      expect(result).to eq(&amp;quot;submission1&amp;quot;=&amp;gt;{&amp;quot;stu2&amp;quot;=&amp;gt;100.0}, &amp;quot;submission2&amp;quot;=&amp;gt;{&amp;quot;stu2&amp;quot;=&amp;gt;60.0})&lt;br /&gt;
      #repeat for different answers&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== send_post_request ==== &lt;br /&gt;
This method send a post request to peerlogic.csc.ncsu.edu/reputation/calculations/reputation_algorithms to calculate get the reputation result and use show the result in corresponding UI and update given reviewer's reputation. We will test this method based on the algorithm in the paper, first to test the result reputation value, second to test the update value in database.&lt;br /&gt;
&lt;br /&gt;
Note that this method is not functioning due to the missing public &amp;amp; private key file for RSA encryption. The algorithm involving &amp;quot;expert grade&amp;quot; was also not implemented. &lt;br /&gt;
Thus, this method could not be properly tested. However we have given the template to create tests for future use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context 'test send_post_request' do&lt;br /&gt;
    it 'failed because of no public key file' do&lt;br /&gt;
      # reivewer_1's review for reviewee_1: [5, 5, 5, 5, 5]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
&lt;br /&gt;
      params = {assignment_id: 1, round_num: 1, algorithm: 'hammer', checkbox: {expert_grade: &amp;quot;empty&amp;quot;}}&lt;br /&gt;
      session = {user: build(:instructor, id: 1)}&lt;br /&gt;
&lt;br /&gt;
      expect(true).to eq(true)&lt;br /&gt;
&lt;br /&gt;
      # comment out because send_post_request method request public key file while this file is missing&lt;br /&gt;
      # so at this time send_post_request is not functioning normally&lt;br /&gt;
      # get :send_post_request, params, session&lt;br /&gt;
      # expect(response).to redirect_to '/reputation_web_service/client'&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
=== Testing Results ===&lt;br /&gt;
&lt;br /&gt;
=== Coverage ===&lt;br /&gt;
&lt;br /&gt;
== Future Tasks ==&lt;br /&gt;
As our team could not obtain the public/private key pair to access the reputation web service, we were only able get to the step prior to sending the JSON to the web service of reputation algorithms. Therefore, future steps are required to test on reputation system. &lt;br /&gt;
&lt;br /&gt;
# Current setup is based on assignment_1, which uses lauw's algorithm to calculate reputation score. Future testing team need to setup similar object set for assignment_2, which uses hamer's algorithm. &lt;br /&gt;
# In  send_post_request, there are references to specific assignments, such as 724, 735, and 756. They were put in to gather data for a paper published in 2015. They are no longer relevant and should be removed. (Need to replace by the comment Professor mentioned in the meeting today)&lt;br /&gt;
# Round 1 and round 2?&lt;br /&gt;
# The db_query violates the DRY principle as it repetitively calculates sum of the assignment. Such sum calculation should be handled in the assignment.rb.&lt;br /&gt;
&lt;br /&gt;
== Collaborators ==&lt;br /&gt;
Jinku Cui (jcui23)&lt;br /&gt;
&lt;br /&gt;
Henry Chen (hchen34)&lt;br /&gt;
&lt;br /&gt;
Dong Li (dli35)&lt;br /&gt;
&lt;br /&gt;
Zijun Lu (zlu5)&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[https://doi.org/10.1109/FIE.2015.7344292 Pluggable reputation systems for peer review: A web-service approach]&lt;/div&gt;</summary>
		<author><name>Hchen34</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2168._Testing_-_Reputations&amp;diff=142264</id>
		<title>CSC/ECE 517 Fall 2021 - E2168. Testing - Reputations</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2168._Testing_-_Reputations&amp;diff=142264"/>
		<updated>2021-11-30T03:23:49Z</updated>

		<summary type="html">&lt;p&gt;Hchen34: Some comments for code.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Project Overview ==&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;q&amp;gt;Online peer-review systems are now in common use in higher education. They free the instructor and course staff from having to provide personally all the feedback that students receive on their work. However, if we want to assure that all students receive competent feedback, or even use peer-assigned grades, we need a way to judge which peer reviewers are most credible. The solution is to use a reputation system.&amp;lt;/q&amp;gt; &amp;lt;br&amp;gt; The reputation system is meant to provide objective value to student assigned peer review scores. Students select from a list of tasks to be performed and then prepare their work and submit it to a peer-review system. The work is then reviewed by other students who offer comments/graded feedback to help the submitters improve their work.&lt;br /&gt;
During the peer review period it is important to determine which reviews are more accurate and show higher quality. Reputation is one way to achieve this goal; it is a quantization measurement to judge which peer reviewers are more reliable.&lt;br /&gt;
Peer reviewers can use expertiza to score an author. If Expertiza shows a confidence ratings for grades based upon the reviewers reputation then authors can more easily determine the legitimacy of the peer assigned score. In addition, the teaching staff can examine the quality of each peer review based on reputation values and, potentially, crowd-source a significant portion of the grading function.&lt;br /&gt;
Currently the reputation system is implemented in Expertiza through web-service, but there's no test written for it. Thus our goal is to set up assignments and reviews that would produce specific reputation scores, and test that the correct reputations are in fact being produced.&lt;br /&gt;
&lt;br /&gt;
=== System Design ===&lt;br /&gt;
The below is referenced from project E1625, which would give us the overall description of the reputation system.&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Diagram E1625.png|1000px]]&amp;lt;br&amp;gt;&lt;br /&gt;
There are two algorithms intended for use in calculation of the reputation values for participants. &lt;br /&gt;
&lt;br /&gt;
There is a [https://expertiza.ncsu.edu/reputation_web_service/client web-service] (the link accessible only to the instructors) available which serves a JSON response containing the reputation value based on the seed provided in the form of the last known reputation value which we store in the ''participants'' table. An instructor can specify which algorithm to use for a particular assignment to calculate the confidence rating. &lt;br /&gt;
&lt;br /&gt;
As the [https://docs.google.com/viewer?url=https%3A%2F%2Fwww.researchgate.net%2Fprofile%2FYang_Song36%2Fpublication%2F289528736_Pluggable_Reputation_Systems_for_Peer_Review_a_Web-Service_Approach%2Flinks%2F568ec8d008ae78cc05160aed.pdf%3FinViewer%3D0%26pdfJsDownload%3D0%26origin%3Dpublication_detail paper] on reputation system by observes, “the Hamer-peer algorithm has the lowest maximum absolute bias and the Lauw-peer algorithm has the lowest overall bias.This indicates, from the instructor’s perspective, if there are further assignments of this kind, expert grading may not be necessary.”&lt;br /&gt;
:;Reputation range of Hamer’s algorithm is :&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: red;&amp;quot;&amp;gt;red&amp;lt;/span&amp;gt;                   value &amp;lt; 0.5&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: yellow&amp;quot;&amp;gt;yellow&amp;lt;/span&amp;gt;              value is &amp;gt;= 0.5 and &amp;lt;= 1&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: orange&amp;quot;&amp;gt;orange&amp;lt;/span&amp;gt;             value is &amp;gt; 1 and &amp;lt;= 1.5&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: HoneyDew&amp;quot;&amp;gt;light green&amp;lt;/span&amp;gt;       value is &amp;gt; 1.5 and &amp;lt;= 2&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: Chartreuse&amp;quot;&amp;gt;green&amp;lt;/span&amp;gt;               value is &amp;gt; 2&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The main difference between the Hamer-peer and the Lauw-peer algorithm is that the Lauw-peer algorithm keeps track of the reviewer's leniency (“bias”), which can be either positive or negative. A positive leniency indicates the reviewer tends to give higher scores than average.  This project determines reputation by subtracting the absolute value of the leniency from 1. Additionally, the range for Hamer’s algorithm is (0,∞) while for Lauw’s algorithm it is [0,1]. &lt;br /&gt;
:;Reputation range of Lauw’s algorithm is&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: red&amp;quot;&amp;gt;red&amp;lt;/span&amp;gt;                   value is &amp;lt; 0.2&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: yellow&amp;quot;&amp;gt;yellow&amp;lt;/span&amp;gt;              value is &amp;gt;= 0.2 and &amp;lt;= 0.4&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: orange&amp;quot;&amp;gt;orange&amp;lt;/span&amp;gt;             value is &amp;gt; 0.4 and &amp;lt;= 0.6&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: HoneyDew&amp;quot;&amp;gt;light green&amp;lt;/span&amp;gt;       value is &amp;gt; 0.6 and &amp;lt;= 0.8&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: Chartreuse&amp;quot;&amp;gt;green&amp;lt;/span&amp;gt;               value is &amp;gt; 0.8&lt;br /&gt;
&lt;br /&gt;
The instructor can choose to show results from Hamer’s algorithm or Lauw’s algorithm. The default algorithm should be Lauw’s algorithm.&lt;br /&gt;
&lt;br /&gt;
=== Objectives ===&lt;br /&gt;
&lt;br /&gt;
Our objectives for this project are the following:&lt;br /&gt;
* Double and stub an assignment, a few submissions to the assignment, under different review rubrics&lt;br /&gt;
* Manually calculate reputation scores based on paper &amp;quot;Pluggable reputation systems for peer review: A web-service approach&amp;quot;&lt;br /&gt;
* Validate correct reputation scores based on different review rubrics generated by reputation management VS manual computation of reputation score using the Hamer's and Lauw's algorithm.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
*reputation_web_service_controller_spec&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
=== Setup Testing Objects ===&lt;br /&gt;
In order to implement testing on reputation, it is crucial to create sample reviews so that we could possibly obtain reputation score. During the kickoff meeting, our team defined four necessary steps to follow for the purpose of testing. Also, appropriate objects could be created and confined as discussed below.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The manifestation of each object will contribute to the success of the following test on reputations. Some fields in each object can be empty or have default values. Some attributes are not relevant to the test. When implementing the test, the test scripts need to generate or set fixed values for corresponding fields.&lt;br /&gt;
&lt;br /&gt;
==== Assignment ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[assignments]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Essential Parameters to be configured&amp;lt;br&amp;gt;&lt;br /&gt;
submitter_count = 0;&amp;lt;br&amp;gt;&lt;br /&gt;
num_reviews = 5;&amp;lt;br&amp;gt;&lt;br /&gt;
num_reviewers = 5;&amp;lt;br&amp;gt;&lt;br /&gt;
num_reviews_allowed = 5;&amp;lt;br&amp;gt;&lt;br /&gt;
rounds_of_reviews = 2;&amp;lt;br&amp;gt;&lt;br /&gt;
reputation_algorithm = lauw/hamer;&amp;lt;br&amp;gt;&lt;br /&gt;
Note: Two assignment objects were created. Assignment_1 used lauw's algorithm, whereas assignment_2 used hamer's alogorithm.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @assignment_1 = create(:assignment, created_at: DateTime.now.in_time_zone - 13.day, submitter_count: 0, num_reviews: 3, num_reviewers: 5, num_reviews_allowed: 5, rounds_of_reviews: 2, reputation_algorithm: 'lauw', id: 1)&lt;br /&gt;
  @assignment_2 = create(:assignment, created_at: DateTime.now.in_time_zone - 13.day, submitter_count: 0, num_reviews: 3, num_reviewers: 5, num_reviews_allowed: 5, rounds_of_reviews: 2, reputation_algorithm: 'hamer', id: 2)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Questionnaires(Rubrics) ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[questionnaires]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[assignment_questionnaires]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Essential Parameters to be configured&amp;lt;br&amp;gt;&lt;br /&gt;
min_question_score = 0;&amp;lt;br&amp;gt;&lt;br /&gt;
max_question_score = 5;&amp;lt;br&amp;gt;&lt;br /&gt;
type = ReviewQuestionnaire;&amp;lt;br&amp;gt;&lt;br /&gt;
Note: We will define the assignment with ReviewQuestionnaire type rubric. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @questionnaire_1 = create(:questionnaire, min_question_score: 0, max_question_score: 5, type: 'ReviewQuestionnaire', id: 1)&lt;br /&gt;
  @assignment_questionnaire_1_1 = create(:assignment_questionnaire, assignment_id: @assignment_1.id, questionnaire_id: @questionnaire_1.id, used_in_round: 1)&lt;br /&gt;
  @assignment_questionnaire_1_2 = create(:assignment_questionnaire, assignment_id: @assignment_1.id, questionnaire_id: @questionnaire_1.id, used_in_round: 2)&lt;br /&gt;
  @assignment_questionnaire_2_1 = create(:assignment_questionnaire, assignment_id: @assignment_2.id, questionnaire_id: @questionnaire_1.id, used_in_round: 1)&lt;br /&gt;
  @assignment_questionnaire_2_2 = create(:assignment_questionnaire, assignment_id: @assignment_2.id, questionnaire_id: @questionnaire_1.id, used_in_round: 2)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Questions under Questionnaires ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[questions]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  # question_j_j means question #j in questionnaire #i.&lt;br /&gt;
  @question_1_1 = create(:question, questionnaire_id: @questionnaire_1.id, id: 1)&lt;br /&gt;
  @question_1_2 = create(:question, questionnaire_id: @questionnaire_1.id, id: 2)&lt;br /&gt;
  @question_1_3 = create(:question, questionnaire_id: @questionnaire_1.id, id: 3)&lt;br /&gt;
  @question_1_4 = create(:question, questionnaire_id: @questionnaire_1.id, id: 4)&lt;br /&gt;
  @question_1_5 = create(:question, questionnaire_id: @questionnaire_1.id, id: 5)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Reviewers and Reviewees ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[participants]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[teams]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
Reviewers (Participant):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @reviewer_1 = create(:participant, can_review: 1)&lt;br /&gt;
  @reviewer_2 = create(:participant, can_review: 1)&lt;br /&gt;
  @reviewer_3 = create(:participant, can_review: 1)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Reviewees (Teams):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @reviewee_1 = create(:assignment_team, assignment: @assignment)&lt;br /&gt;
  @reviewee_2 = create(:assignment_team, assignment: @assignment)&lt;br /&gt;
  @reviewee_3 = create(:assignment_team, assignment: @assignment)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Responses ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[response_maps]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[responses]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Essential Parameters to be configured&amp;lt;br&amp;gt;&lt;br /&gt;
reviewed_object_id = &amp;lt;target_assignment&amp;gt;.id ; &amp;lt;br&amp;gt;&lt;br /&gt;
reviewer_id = &amp;lt;target_reviewer&amp;gt;.id ; &amp;lt;br&amp;gt;&lt;br /&gt;
reviewee_id = &amp;lt;target_reviewee&amp;gt;.id ; &amp;lt;br&amp;gt;&lt;br /&gt;
Note: The response map is setup to determine the relationship between reviewer and reviewee of an assignment.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
Response_maps:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  # response_map_&amp;lt;I&amp;gt;_&amp;lt;j&amp;gt; means reviewer #1's review to reviewee #j. &lt;br /&gt;
  @response_map_1_1 = create(:review_response_map, reviewer_id: @reviewer_1.id, reviewee_id: @reviewee_1.id)&lt;br /&gt;
  @response_map_1_2 = create(:review_response_map, reviewer_id: @reviewer_2.id, reviewee_id: @reviewee_1.id)&lt;br /&gt;
  @response_map_1_3 = create(:review_response_map, reviewer_id: @reviewer_3.id, reviewee_id: @reviewee_1.id)&lt;br /&gt;
&lt;br /&gt;
  @response_map_2_1 = create(:review_response_map, reviewer_id: @reviewer_1.id, reviewee_id: @reviewee_2.id)&lt;br /&gt;
  @response_map_2_2 = create(:review_response_map, reviewer_id: @reviewer_2.id, reviewee_id: @reviewee_2.id)&lt;br /&gt;
  @response_map_2_3 = create(:review_response_map, reviewer_id: @reviewer_3.id, reviewee_id: @reviewee_2.id)&lt;br /&gt;
&lt;br /&gt;
  @response_map_3_1 = create(:review_response_map, reviewer_id: @reviewer_1.id, reviewee_id: @reviewee_3.id)&lt;br /&gt;
  @response_map_3_2 = create(:review_response_map, reviewer_id: @reviewer_2.id, reviewee_id: @reviewee_3.id)&lt;br /&gt;
  @response_map_3_3 = create(:review_response_map, reviewer_id: @reviewer_3.id, reviewee_id: @reviewee_3.id)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Responses:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  # response_&amp;lt;I&amp;gt;_&amp;lt;j&amp;gt; means reviewer #1's review to reviewee #j. &lt;br /&gt;
  @response_1_1 = create(:response, is_submitted: true, map_id: @response_map_1_1.id)&lt;br /&gt;
  @response_1_2 = create(:response, is_submitted: true, map_id: @response_map_1_2.id)&lt;br /&gt;
  @response_1_3 = create(:response, is_submitted: true, map_id: @response_map_1_3.id)&lt;br /&gt;
&lt;br /&gt;
  @response_2_1 = create(:response, is_submitted: true, map_id: @response_map_2_1.id)&lt;br /&gt;
  @response_2_2 = create(:response, is_submitted: true, map_id: @response_map_2_2.id)&lt;br /&gt;
  @response_2_3 = create(:response, is_submitted: true, map_id: @response_map_2_3.id)&lt;br /&gt;
&lt;br /&gt;
  @response_3_1 = create(:response, is_submitted: true, map_id: @response_map_3_1.id)&lt;br /&gt;
  @response_3_2 = create(:response, is_submitted: true, map_id: @response_map_3_2.id)&lt;br /&gt;
  @response_3_3 = create(:response, is_submitted: true, map_id: @response_map_3_3.id)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Relevant Methods ===&lt;br /&gt;
==== db_query ====&lt;br /&gt;
This is the normal db query method, call this method will return peer review grades with given assignment id.&lt;br /&gt;
We will test this method in two aspect. &lt;br /&gt;
1. Test whether or not the grade return is right based on the specified algorithm.&lt;br /&gt;
2. We need to test the correctness of the query.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context 'test db_query' do&lt;br /&gt;
    it 'return average score' do&lt;br /&gt;
      # reivewer_1's review for reviewee_1: [1, 2, 3, 4, 5]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_1.id, answer: 1)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_1.id, answer: 2)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_1.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_1.id, answer: 4)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      result = ReputationWebServiceController.new.db_query(1, 1, false)&lt;br /&gt;
      expect(result).to eq([[2, 1, 60.0]])&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== json_generator ====&lt;br /&gt;
This method will generate the hash format of the review, we will test this method by calling to and convert the result to json format the print to test its correctness.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context 'test json_generator' do&lt;br /&gt;
    it 'test 3 reviewer for one reviewee' do&lt;br /&gt;
      # reivewer_1's review for reviewee_1: [5, 5, 5, 5, 5]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
&lt;br /&gt;
      # reivewer_2's review for reviewee_1: [3, 3, 3, 3, 3]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
&lt;br /&gt;
      # reivewer_3's review for reviewee_1: [1, 1, 1, 1, 1]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
&lt;br /&gt;
      result = ReputationWebServiceController.new.json_generator(1, 0, 1)&lt;br /&gt;
      expect(result).to eq({&amp;quot;submission1&amp;quot;=&amp;gt;{&amp;quot;stu2&amp;quot;=&amp;gt;100.0, &amp;quot;stu3&amp;quot;=&amp;gt;60.0, &amp;quot;stu4&amp;quot;=&amp;gt;20.0}})&lt;br /&gt;
      #repeat for different answers&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'test same reviewer for different reviewee' do&lt;br /&gt;
      # reivewer_1's review for reviewee_1: [5, 5, 5, 5, 5]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
&lt;br /&gt;
      # reivewer_1's review for reviewee_2: [3, 3, 3, 3, 3]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
&lt;br /&gt;
      result = ReputationWebServiceController.new.json_generator(1, 0, 1)&lt;br /&gt;
      expect(result).to eq(&amp;quot;submission1&amp;quot;=&amp;gt;{&amp;quot;stu2&amp;quot;=&amp;gt;100.0}, &amp;quot;submission2&amp;quot;=&amp;gt;{&amp;quot;stu2&amp;quot;=&amp;gt;60.0})&lt;br /&gt;
      #repeat for different answers&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== send_post_request ==== &lt;br /&gt;
This method send a post request to peerlogic.csc.ncsu.edu/reputation/calculations/reputation_algorithms to calculate get the reputation result and use show the result in corresponding UI and update given reviewer's reputation. We will test this method based on the algorithm in the paper, first to test the result reputation value, second to test the update value in database.&lt;br /&gt;
&lt;br /&gt;
Note that this method is not functioning due to the missing public &amp;amp; private key file for RSA encryption. The algorithm involving &amp;quot;expert grade&amp;quot; was also not implemented. &lt;br /&gt;
Thus, this method could not be properly tested. However we have given the template to create tests for future use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context 'test send_post_request' do&lt;br /&gt;
    it 'failed because of no public key file' do&lt;br /&gt;
      # reivewer_1's review for reviewee_1: [5, 5, 5, 5, 5]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
&lt;br /&gt;
      params = {assignment_id: 1, round_num: 1, algorithm: 'hammer', checkbox: {expert_grade: &amp;quot;empty&amp;quot;}}&lt;br /&gt;
      session = {user: build(:instructor, id: 1)}&lt;br /&gt;
&lt;br /&gt;
      expect(true).to eq(true)&lt;br /&gt;
&lt;br /&gt;
      # comment out because send_post_request method request public key file while this file is missing&lt;br /&gt;
      # so at this time send_post_request is not functioning normally&lt;br /&gt;
      # get :send_post_request, params, session&lt;br /&gt;
      # expect(response).to redirect_to '/reputation_web_service/client'&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
=== Testing Results ===&lt;br /&gt;
&lt;br /&gt;
=== Coverage ===&lt;br /&gt;
&lt;br /&gt;
== Future Tasks ==&lt;br /&gt;
As our team could not obtain the public/private key pair to access the reputation web service, we were only able get to the step prior to sending the JSON to the web service of reputation algorithms. Therefore, future steps are required to test on reputation system. &lt;br /&gt;
&lt;br /&gt;
# Current setup is based on assignment_1, which uses lauw's algorithm to calculate reputation score. Future testing team need to setup similar object set for assignment_2, which uses hamer's algorithm. &lt;br /&gt;
# In  send_post_request, there are references to specific assignments, such as 724, 735, and 756. They were put in to gather data for a paper published in 2015. They are no longer relevant and should be removed. (Need to replace by the comment Professor mentioned in the meeting today)&lt;br /&gt;
# Round 1 and round 2?&lt;br /&gt;
# The db_query violates the DRY principle as it repetitively calculates sum of the assignment. Such sum calculation should be handled in the assignment.rb.&lt;br /&gt;
&lt;br /&gt;
== Collaborators ==&lt;br /&gt;
Jinku Cui (jcui23)&lt;br /&gt;
&lt;br /&gt;
Henry Chen (hchen34)&lt;br /&gt;
&lt;br /&gt;
Dong Li (dli35)&lt;br /&gt;
&lt;br /&gt;
Zijun Lu (zlu5)&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[https://doi.org/10.1109/FIE.2015.7344292 Pluggable reputation systems for peer review: A web-service approach]&lt;/div&gt;</summary>
		<author><name>Hchen34</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2168._Testing_-_Reputations&amp;diff=141984</id>
		<title>CSC/ECE 517 Fall 2021 - E2168. Testing - Reputations</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2168._Testing_-_Reputations&amp;diff=141984"/>
		<updated>2021-11-29T21:51:26Z</updated>

		<summary type="html">&lt;p&gt;Hchen34: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Project Overview ==&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;q&amp;gt;Online peer-review systems are now in common use in higher education. They free the instructor and course staff from having to provide personally all the feedback that students receive on their work. However, if we want to assure that all students receive competent feedback, or even use peer-assigned grades, we need a way to judge which peer reviewers are most credible. The solution is to use a reputation system.&amp;lt;/q&amp;gt; &amp;lt;br&amp;gt; The reputation system is meant to provide objective value to student assigned peer review scores. Students select from a list of tasks to be performed and then prepare their work and submit it to a peer-review system. The work is then reviewed by other students who offer comments/graded feedback to help the submitters improve their work.&lt;br /&gt;
During the peer review period it is important to determine which reviews are more accurate and show higher quality. Reputation is one way to achieve this goal; it is a quantization measurement to judge which peer reviewers are more reliable.&lt;br /&gt;
Peer reviewers can use expertiza to score an author. If Expertiza shows a confidence ratings for grades based upon the reviewers reputation then authors can more easily determine the legitimacy of the peer assigned score. In addition, the teaching staff can examine the quality of each peer review based on reputation values and, potentially, crowd-source a significant portion of the grading function.&lt;br /&gt;
Currently the reputation system is implemented in Expertiza through web-service, but there's no test written for it. Thus our goal is to write tests to verify Hamer's and Lauw’s algorithm from the reputation system.&lt;br /&gt;
&lt;br /&gt;
=== System Design ===&lt;br /&gt;
The below is referenced from project E1625, which would give us the overall description of the reputation system.&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Diagram E1625.png|1000px]]&amp;lt;br&amp;gt;&lt;br /&gt;
There are two algorithms intended for use in calculation of the reputation values for participants. &lt;br /&gt;
&lt;br /&gt;
There is a [https://expertiza.ncsu.edu/reputation_web_service/client web-service] (the link accessible only to the instructors) available which serves a JSON response containing the reputation value based on the seed provided in the form of the last known reputation value which we store in the ''participants'' table. An instructor can specify which algorithm to use for a particular assignment to calculate the confidence rating. &lt;br /&gt;
&lt;br /&gt;
As the [https://docs.google.com/viewer?url=https%3A%2F%2Fwww.researchgate.net%2Fprofile%2FYang_Song36%2Fpublication%2F289528736_Pluggable_Reputation_Systems_for_Peer_Review_a_Web-Service_Approach%2Flinks%2F568ec8d008ae78cc05160aed.pdf%3FinViewer%3D0%26pdfJsDownload%3D0%26origin%3Dpublication_detail paper] on reputation system by observes, “the Hamer-peer algorithm has the lowest maximum absolute bias and the Lauw-peer algorithm has the lowest overall bias.This indicates, from the instructor’s perspective, if there are further assignments of this kind, expert grading may not be necessary.”&lt;br /&gt;
:;Reputation range of Hamer’s algorithm is :&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: red;&amp;quot;&amp;gt;red&amp;lt;/span&amp;gt;                   value &amp;lt; 0.5&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: yellow&amp;quot;&amp;gt;yellow&amp;lt;/span&amp;gt;              value is &amp;gt;= 0.5 and &amp;lt;= 1&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: orange&amp;quot;&amp;gt;orange&amp;lt;/span&amp;gt;             value is &amp;gt; 1 and &amp;lt;= 1.5&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: HoneyDew&amp;quot;&amp;gt;light green&amp;lt;/span&amp;gt;       value is &amp;gt; 1.5 and &amp;lt;= 2&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: Chartreuse&amp;quot;&amp;gt;green&amp;lt;/span&amp;gt;               value is &amp;gt; 2&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The main difference between the Hamer-peer and the Lauw-peer algorithm is that the Lauw-peer algorithm keeps track of the reviewer's leniency (“bias”), which can be either positive or negative. A positive leniency indicates the reviewer tends to give higher scores than average.  This project determines reputation by subtracting the absolute value of the leniency from 1. Additionally, the range for Hamer’s algorithm is (0,∞) while for Lauw’s algorithm it is [0,1]. &lt;br /&gt;
:;Reputation range of Lauw’s algorithm is&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: red&amp;quot;&amp;gt;red&amp;lt;/span&amp;gt;                   value is &amp;lt; 0.2&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: yellow&amp;quot;&amp;gt;yellow&amp;lt;/span&amp;gt;              value is &amp;gt;= 0.2 and &amp;lt;= 0.4&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: orange&amp;quot;&amp;gt;orange&amp;lt;/span&amp;gt;             value is &amp;gt; 0.4 and &amp;lt;= 0.6&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: HoneyDew&amp;quot;&amp;gt;light green&amp;lt;/span&amp;gt;       value is &amp;gt; 0.6 and &amp;lt;= 0.8&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: Chartreuse&amp;quot;&amp;gt;green&amp;lt;/span&amp;gt;               value is &amp;gt; 0.8&lt;br /&gt;
&lt;br /&gt;
The instructor can choose to show results from Hamer’s algorithm or Lauw’s algorithm. The default algorithm should be Lauw’s algorithm.&lt;br /&gt;
&lt;br /&gt;
=== Objectives ===&lt;br /&gt;
&lt;br /&gt;
Our objectives for this project are the following:&lt;br /&gt;
* Double and stub an assignment, a few submissions to the assignment, under different review rubrics&lt;br /&gt;
* Manually calculate reputation scores based on paper &amp;quot;Pluggable reputation systems for peer review: A web-service approach&amp;quot;&lt;br /&gt;
* Validate correct reputation scores based on different review rubrics generated by reputation management VS manual computation of reputation score expectation on different reputation range of Hamer's and Lauw's algorithm with or without instructor score impact.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
*reputation_web_service_controller_spec&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
=== Setup Testing Objects ===&lt;br /&gt;
In order to implement testing on reputation, it is crucial to create sample reviews so that we could possibly obtain reputation score. During the kickoff meeting, our team defined four necessary steps to follow for the purpose of testing. Also, appropriate objects could be created and confined as discussed below.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The manifestation of each object will contribute to the success of the following test on reputations. Some fields in each object can be empty or have default values. Some attributes are not relevant to the test. When implementing the test, the test scripts need to generate or set fixed values for corresponding fields.&lt;br /&gt;
&lt;br /&gt;
==== Assignment ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[assignments]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Essential Parameters to be configured&amp;lt;br&amp;gt;&lt;br /&gt;
submitter_count = 0;&amp;lt;br&amp;gt;&lt;br /&gt;
num_reviews = 5;&amp;lt;br&amp;gt;&lt;br /&gt;
num_reviewers = 5;&amp;lt;br&amp;gt;&lt;br /&gt;
num_reviews_allowed = 5;&amp;lt;br&amp;gt;&lt;br /&gt;
rounds_of_reviews = 2;&amp;lt;br&amp;gt;&lt;br /&gt;
reputation_algorithm = lauw/hamer;&amp;lt;br&amp;gt;&lt;br /&gt;
Note: Two assignment objects were created. Assignment_1 used lauw's algorithm, whereas assignment_2 used hamer's alogorithm.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @assignment_1 = create(:assignment, created_at: DateTime.now.in_time_zone - 13.day, submitter_count: 0, num_reviews: 3, num_reviewers: 5, num_reviews_allowed: 5, rounds_of_reviews: 2, reputation_algorithm: 'lauw', id: 1)&lt;br /&gt;
  @assignment_2 = create(:assignment, created_at: DateTime.now.in_time_zone - 13.day, submitter_count: 0, num_reviews: 3, num_reviewers: 5, num_reviews_allowed: 5, rounds_of_reviews: 2, reputation_algorithm: 'hamer', id: 2)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Questionnaires(Rubrics) ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[questionnaires]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[assignment_questionnaires]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Essential Parameters to be configured&amp;lt;br&amp;gt;&lt;br /&gt;
min_question_score = 0;&amp;lt;br&amp;gt;&lt;br /&gt;
max_question_score = 5;&amp;lt;br&amp;gt;&lt;br /&gt;
type = ReviewQuestionnaire;&amp;lt;br&amp;gt;&lt;br /&gt;
Note: We will define the assignment with ReviewQuestionnaire type rubric. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @questionnaire_1 = create(:questionnaire, min_question_score: 0, max_question_score: 5, type: 'ReviewQuestionnaire', id: 1)&lt;br /&gt;
  @assignment_questionnaire_1_1 = create(:assignment_questionnaire, assignment_id: @assignment_1.id, questionnaire_id: @questionnaire_1.id, used_in_round: 1)&lt;br /&gt;
  @assignment_questionnaire_1_2 = create(:assignment_questionnaire, assignment_id: @assignment_1.id, questionnaire_id: @questionnaire_1.id, used_in_round: 2)&lt;br /&gt;
  @assignment_questionnaire_2_1 = create(:assignment_questionnaire, assignment_id: @assignment_2.id, questionnaire_id: @questionnaire_1.id, used_in_round: 1)&lt;br /&gt;
  @assignment_questionnaire_2_2 = create(:assignment_questionnaire, assignment_id: @assignment_2.id, questionnaire_id: @questionnaire_1.id, used_in_round: 2)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Questions under Questionnaires ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[questions]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @question_1_1 = create(:question, questionnaire_id: @questionnaire_1.id, id: 1)&lt;br /&gt;
  @question_1_2 = create(:question, questionnaire_id: @questionnaire_1.id, id: 2)&lt;br /&gt;
  @question_1_3 = create(:question, questionnaire_id: @questionnaire_1.id, id: 3)&lt;br /&gt;
  @question_1_4 = create(:question, questionnaire_id: @questionnaire_1.id, id: 4)&lt;br /&gt;
  @question_1_5 = create(:question, questionnaire_id: @questionnaire_1.id, id: 5)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Reviewers and Reviewees ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[participants]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[teams]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
Reviewers (Participant):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @reviewer_1 = create(:participant, can_review: 1)&lt;br /&gt;
  @reviewer_2 = create(:participant, can_review: 1)&lt;br /&gt;
  @reviewer_3 = create(:participant, can_review: 1)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Reviewees (Teams):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @reviewee_1 = create(:assignment_team, assignment: @assignment)&lt;br /&gt;
  @reviewee_2 = create(:assignment_team, assignment: @assignment)&lt;br /&gt;
  @reviewee_3 = create(:assignment_team, assignment: @assignment)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Responses ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[response_maps]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[responses]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Essential Parameters to be configured&amp;lt;br&amp;gt;&lt;br /&gt;
reviewed_object_id = &amp;lt;target_assignment&amp;gt;.id ; &amp;lt;br&amp;gt;&lt;br /&gt;
reviewer_id = &amp;lt;target_reviewer&amp;gt;.id ; &amp;lt;br&amp;gt;&lt;br /&gt;
reviewee_id = &amp;lt;target_reviewee&amp;gt;.id ; &amp;lt;br&amp;gt;&lt;br /&gt;
Note: The response map is setup to determine the relationship between reviewer and reviewee of an assignment.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
Response_maps:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @response_map_1_1 = create(:review_response_map, reviewer_id: @reviewer_1.id, reviewee_id: @reviewee_1.id)&lt;br /&gt;
  @response_map_1_2 = create(:review_response_map, reviewer_id: @reviewer_2.id, reviewee_id: @reviewee_1.id)&lt;br /&gt;
  @response_map_1_3 = create(:review_response_map, reviewer_id: @reviewer_3.id, reviewee_id: @reviewee_1.id)&lt;br /&gt;
&lt;br /&gt;
  @response_map_2_1 = create(:review_response_map, reviewer_id: @reviewer_1.id, reviewee_id: @reviewee_2.id)&lt;br /&gt;
  @response_map_2_2 = create(:review_response_map, reviewer_id: @reviewer_2.id, reviewee_id: @reviewee_2.id)&lt;br /&gt;
  @response_map_2_3 = create(:review_response_map, reviewer_id: @reviewer_3.id, reviewee_id: @reviewee_2.id)&lt;br /&gt;
&lt;br /&gt;
  @response_map_3_1 = create(:review_response_map, reviewer_id: @reviewer_1.id, reviewee_id: @reviewee_3.id)&lt;br /&gt;
  @response_map_3_2 = create(:review_response_map, reviewer_id: @reviewer_2.id, reviewee_id: @reviewee_3.id)&lt;br /&gt;
  @response_map_3_3 = create(:review_response_map, reviewer_id: @reviewer_3.id, reviewee_id: @reviewee_3.id)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Responses:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @response_1_1 = create(:response, is_submitted: true, map_id: @response_map_1_1.id)&lt;br /&gt;
  @response_1_2 = create(:response, is_submitted: true, map_id: @response_map_1_2.id)&lt;br /&gt;
  @response_1_3 = create(:response, is_submitted: true, map_id: @response_map_1_3.id)&lt;br /&gt;
&lt;br /&gt;
  @response_2_1 = create(:response, is_submitted: true, map_id: @response_map_2_1.id)&lt;br /&gt;
  @response_2_2 = create(:response, is_submitted: true, map_id: @response_map_2_2.id)&lt;br /&gt;
  @response_2_3 = create(:response, is_submitted: true, map_id: @response_map_2_3.id)&lt;br /&gt;
&lt;br /&gt;
  @response_3_1 = create(:response, is_submitted: true, map_id: @response_map_3_1.id)&lt;br /&gt;
  @response_3_2 = create(:response, is_submitted: true, map_id: @response_map_3_2.id)&lt;br /&gt;
  @response_3_3 = create(:response, is_submitted: true, map_id: @response_map_3_3.id)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Relevant Methods ===&lt;br /&gt;
==== db_query ====&lt;br /&gt;
This is the normal db query method, call this method will return peer review grades with given assignment id.&lt;br /&gt;
We will test this method in two aspect. &lt;br /&gt;
1. Test whether or not the grade return is right based on the specified algorithm.&lt;br /&gt;
2. We need to test the correctness of the query.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context 'test db_query' do&lt;br /&gt;
    it 'return average score' do&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_1.id, answer: 1)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_1.id, answer: 2)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_1.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_1.id, answer: 4)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      result = ReputationWebServiceController.new.db_query(1, 1, false)&lt;br /&gt;
      expect(result).to eq([[2, 1, 60.0]])&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== json_generator ====&lt;br /&gt;
This method will generate the hash format of the review, we will test this method by calling to and convert the result to json format the print to test its correctness.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context 'test json_generator' do&lt;br /&gt;
    it 'test 3 reviewer for one reviewee' do&lt;br /&gt;
      # reivewer_1's review for reviewee_1: [5, 5, 5, 5, 5]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
&lt;br /&gt;
      # reivewer_2's review for reviewee_1: [3, 3, 3, 3, 3]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
&lt;br /&gt;
      # reivewer_3's review for reviewee_1: [1, 1, 1, 1, 1]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
&lt;br /&gt;
      #result = ReputationWebServiceController.new.db_query(1, 1, false)&lt;br /&gt;
      #expect(result).to eq([[2, 1, 100.0], [3, 1, 60.0], [4, 1, 20.0]])&lt;br /&gt;
      result = ReputationWebServiceController.new.json_generator(1, 0, 1)&lt;br /&gt;
      expect(result).to eq({&amp;quot;submission1&amp;quot;=&amp;gt;{&amp;quot;stu2&amp;quot;=&amp;gt;100.0, &amp;quot;stu3&amp;quot;=&amp;gt;60.0, &amp;quot;stu4&amp;quot;=&amp;gt;20.0}})&lt;br /&gt;
      #repeat for different answers&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'test same reviewer for different reviewee' do&lt;br /&gt;
      # reivewer_1's review for reviewee_1: [5, 5, 5, 5, 5]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
&lt;br /&gt;
      # reivewer_1's review for reviewee_2: [3, 3, 3, 3, 3]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
&lt;br /&gt;
      result = ReputationWebServiceController.new.json_generator(1, 0, 1)&lt;br /&gt;
      expect(result).to eq(&amp;quot;submission1&amp;quot;=&amp;gt;{&amp;quot;stu2&amp;quot;=&amp;gt;100.0}, &amp;quot;submission2&amp;quot;=&amp;gt;{&amp;quot;stu2&amp;quot;=&amp;gt;60.0})&lt;br /&gt;
      #repeat for different answers&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== send_post_request ==== &lt;br /&gt;
This method send a post request to peerlogic.csc.ncsu.edu/reputation/calculations/reputation_algorithms to calculate get the reputation result and use show the result in corresponding UI and update given reviewer's reputation. We will test this method based on the algorithm in the paper, first to test the result reputation value, second to test the update value in database.&lt;br /&gt;
&lt;br /&gt;
Note that this method is not functioning due to the missing public &amp;amp; private key file for RSA encryption. The algorithm involving &amp;quot;expert grade&amp;quot; was also not implemented. &lt;br /&gt;
Thus, this method could not be properly tested. However we have given the template to create tests for future use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context 'test send_post_request' do&lt;br /&gt;
    it 'failed because of no public key file' do&lt;br /&gt;
      # reivewer_1's review for reviewee_1: [5, 5, 5, 5, 5]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
&lt;br /&gt;
      params = {assignment_id: 1, round_num: 1, algorithm: 'hammer', checkbox: {expert_grade: &amp;quot;empty&amp;quot;}}&lt;br /&gt;
      session = {user: build(:instructor, id: 1)}&lt;br /&gt;
&lt;br /&gt;
      expect(true).to eq(true)&lt;br /&gt;
&lt;br /&gt;
      # comment out because send_post_request method request public key file while this file is missing&lt;br /&gt;
      # so at this time send_post_request is not functioning normally&lt;br /&gt;
      # get :send_post_request, params, session&lt;br /&gt;
      # expect(response).to redirect_to '/reputation_web_service/client'&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
=== Testing Results ===&lt;br /&gt;
&lt;br /&gt;
=== Coverage ===&lt;br /&gt;
&lt;br /&gt;
=== Future Tasks ===&lt;br /&gt;
As our team could not obtain the public/private key pair to access the reputation web service, we were only able get to the step prior to sending the JSON to the web service of reputation algorithms. Therefore, future steps are required to test on reputation system. &lt;br /&gt;
&lt;br /&gt;
# There is a lot of unused/commented code, which should be removed.&lt;br /&gt;
# Figure out what the code is doing and write appropriate comments for it.&lt;br /&gt;
# In the case of db_query, the name should say what it queries for. Also, this method not only queries, but calculates sums.  Since each method should do only one thing, the code for calculating sums should be in another method. And there should be comments in the code!&lt;br /&gt;
#json_generator should be generate_json. There needs to be a method comment saying what the parameters are.&lt;br /&gt;
# In  send_post_request, there are references to specific assignments, such as 724, 735, and 756. They were put in to gather data for a paper published in 2015. They are no longer relevant and should be removed. send_post_request is 91 lines long, far too long.&lt;br /&gt;
#There is a password for a private key in the code (and the code is open-sourced!) It should be in the db instead.&lt;br /&gt;
#Fix spelling of “dimention”&lt;br /&gt;
#client is a bad method name; why is stuff being copied from class variables to instance variables?&lt;br /&gt;
&lt;br /&gt;
== Collaborators ==&lt;br /&gt;
Jinku Cui (jcui23)&lt;br /&gt;
&lt;br /&gt;
Henry Chen (hchen34)&lt;br /&gt;
&lt;br /&gt;
Dong Li (dli35)&lt;br /&gt;
&lt;br /&gt;
Zijun Lu (zlu5)&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[https://doi.org/10.1109/FIE.2015.7344292 Pluggable reputation systems for peer review: A web-service approach]&lt;/div&gt;</summary>
		<author><name>Hchen34</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2168._Testing_-_Reputations&amp;diff=141980</id>
		<title>CSC/ECE 517 Fall 2021 - E2168. Testing - Reputations</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2168._Testing_-_Reputations&amp;diff=141980"/>
		<updated>2021-11-29T21:49:02Z</updated>

		<summary type="html">&lt;p&gt;Hchen34: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Project Overview ==&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;q&amp;gt;Online peer-review systems are now in common use in higher education. They free the instructor and course staff from having to provide personally all the feedback that students receive on their work. However, if we want to assure that all students receive competent feedback, or even use peer-assigned grades, we need a way to judge which peer reviewers are most credible. The solution is to use a reputation system.&amp;lt;/q&amp;gt; &amp;lt;br&amp;gt; The reputation system is meant to provide objective value to student assigned peer review scores. Students select from a list of tasks to be performed and then prepare their work and submit it to a peer-review system. The work is then reviewed by other students who offer comments/graded feedback to help the submitters improve their work.&lt;br /&gt;
During the peer review period it is important to determine which reviews are more accurate and show higher quality. Reputation is one way to achieve this goal; it is a quantization measurement to judge which peer reviewers are more reliable.&lt;br /&gt;
Peer reviewers can use expertiza to score an author. If Expertiza shows a confidence ratings for grades based upon the reviewers reputation then authors can more easily determine the legitimacy of the peer assigned score. In addition, the teaching staff can examine the quality of each peer review based on reputation values and, potentially, crowd-source a significant portion of the grading function.&lt;br /&gt;
Currently the reputation system is implemented in Expertiza through web-service, but there's no test written for it. Thus our goal is to write tests to verify Hamer's and Lauw’s algorithm from the reputation system.&lt;br /&gt;
&lt;br /&gt;
=== System Design ===&lt;br /&gt;
The below is referenced from project E1625, which would give us the overall description of the reputation system.&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Diagram E1625.png|1000px]]&amp;lt;br&amp;gt;&lt;br /&gt;
There are two algorithms intended for use in calculation of the reputation values for participants. &lt;br /&gt;
&lt;br /&gt;
There is a [https://expertiza.ncsu.edu/reputation_web_service/client web-service] (the link accessible only to the instructors) available which serves a JSON response containing the reputation value based on the seed provided in the form of the last known reputation value which we store in the ''participants'' table. An instructor can specify which algorithm to use for a particular assignment to calculate the confidence rating. &lt;br /&gt;
&lt;br /&gt;
As the [https://docs.google.com/viewer?url=https%3A%2F%2Fwww.researchgate.net%2Fprofile%2FYang_Song36%2Fpublication%2F289528736_Pluggable_Reputation_Systems_for_Peer_Review_a_Web-Service_Approach%2Flinks%2F568ec8d008ae78cc05160aed.pdf%3FinViewer%3D0%26pdfJsDownload%3D0%26origin%3Dpublication_detail paper] on reputation system by observes, “the Hamer-peer algorithm has the lowest maximum absolute bias and the Lauw-peer algorithm has the lowest overall bias.This indicates, from the instructor’s perspective, if there are further assignments of this kind, expert grading may not be necessary.”&lt;br /&gt;
:;Reputation range of Hamer’s algorithm is :&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: red;&amp;quot;&amp;gt;red&amp;lt;/span&amp;gt;                   value &amp;lt; 0.5&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: yellow&amp;quot;&amp;gt;yellow&amp;lt;/span&amp;gt;              value is &amp;gt;= 0.5 and &amp;lt;= 1&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: orange&amp;quot;&amp;gt;orange&amp;lt;/span&amp;gt;             value is &amp;gt; 1 and &amp;lt;= 1.5&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: HoneyDew&amp;quot;&amp;gt;light green&amp;lt;/span&amp;gt;       value is &amp;gt; 1.5 and &amp;lt;= 2&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: Chartreuse&amp;quot;&amp;gt;green&amp;lt;/span&amp;gt;               value is &amp;gt; 2&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The main difference between the Hamer-peer and the Lauw-peer algorithm is that the Lauw-peer algorithm keeps track of the reviewer's leniency (“bias”), which can be either positive or negative. A positive leniency indicates the reviewer tends to give higher scores than average.  This project determines reputation by subtracting the absolute value of the leniency from 1. Additionally, the range for Hamer’s algorithm is (0,∞) while for Lauw’s algorithm it is [0,1]. &lt;br /&gt;
:;Reputation range of Lauw’s algorithm is&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: red&amp;quot;&amp;gt;red&amp;lt;/span&amp;gt;                   value is &amp;lt; 0.2&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: yellow&amp;quot;&amp;gt;yellow&amp;lt;/span&amp;gt;              value is &amp;gt;= 0.2 and &amp;lt;= 0.4&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: orange&amp;quot;&amp;gt;orange&amp;lt;/span&amp;gt;             value is &amp;gt; 0.4 and &amp;lt;= 0.6&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: HoneyDew&amp;quot;&amp;gt;light green&amp;lt;/span&amp;gt;       value is &amp;gt; 0.6 and &amp;lt;= 0.8&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: Chartreuse&amp;quot;&amp;gt;green&amp;lt;/span&amp;gt;               value is &amp;gt; 0.8&lt;br /&gt;
&lt;br /&gt;
The instructor can choose to show results from Hamer’s algorithm or Lauw’s algorithm. The default algorithm should be Lauw’s algorithm.&lt;br /&gt;
&lt;br /&gt;
=== Objectives ===&lt;br /&gt;
&lt;br /&gt;
Our objectives for this project are the following:&lt;br /&gt;
* Double and stub an assignment, a few submissions to the assignment, under different review rubrics&lt;br /&gt;
* Manually calculate reputation scores based on paper &amp;quot;Pluggable reputation systems for peer review: A web-service approach&amp;quot;&lt;br /&gt;
* Validate correct reputation scores based on different review rubrics generated by reputation management VS manual computation of reputation score expectation on different reputation range of Hamer's and Lauw's algorithm with or without instructor score impact.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
*reputation_web_service_controller_spec&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
=== Setup Testing Objects ===&lt;br /&gt;
In order to implement testing on reputation, it is crucial to create sample reviews so that we could possibly obtain reputation score. During the kickoff meeting, our team defined four necessary steps to follow for the purpose of testing. Also, appropriate objects could be created and confined as discussed below.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The manifestation of each object will contribute to the success of the following test on reputations. Some fields in each object can be empty or have default values. Some attributes are not relevant to the test. When implementing the test, the test scripts need to generate or set fixed values for corresponding fields.&lt;br /&gt;
&lt;br /&gt;
==== Assignment ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[assignments]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Essential Parameters to be configured&amp;lt;br&amp;gt;&lt;br /&gt;
submitter_count = 0;&amp;lt;br&amp;gt;&lt;br /&gt;
num_reviews = 5;&amp;lt;br&amp;gt;&lt;br /&gt;
num_reviewers = 5;&amp;lt;br&amp;gt;&lt;br /&gt;
num_reviews_allowed = 5;&amp;lt;br&amp;gt;&lt;br /&gt;
rounds_of_reviews = 2;&amp;lt;br&amp;gt;&lt;br /&gt;
reputation_algorithm = lauw/hamer;&amp;lt;br&amp;gt;&lt;br /&gt;
Note: Two assignment objects were created. Assignment_1 used lauw's algorithm, whereas assignment_2 used hamer's alogorithm.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @assignment_1 = create(:assignment, created_at: DateTime.now.in_time_zone - 13.day, submitter_count: 0, num_reviews: 3, num_reviewers: 5, num_reviews_allowed: 5, rounds_of_reviews: 2, reputation_algorithm: 'lauw', id: 1)&lt;br /&gt;
  @assignment_2 = create(:assignment, created_at: DateTime.now.in_time_zone - 13.day, submitter_count: 0, num_reviews: 3, num_reviewers: 5, num_reviews_allowed: 5, rounds_of_reviews: 2, reputation_algorithm: 'hamer', id: 2)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Questionnaires(Rubrics) ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[questionnaires]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[assignment_questionnaires]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Essential Parameters to be configured&amp;lt;br&amp;gt;&lt;br /&gt;
min_question_score = 0;&amp;lt;br&amp;gt;&lt;br /&gt;
max_question_score = 5;&amp;lt;br&amp;gt;&lt;br /&gt;
type = ReviewQuestionnaire;&amp;lt;br&amp;gt;&lt;br /&gt;
Note: We will define the assignment with ReviewQuestionnaire type rubric. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @questionnaire_1 = create(:questionnaire, min_question_score: 0, max_question_score: 5, type: 'ReviewQuestionnaire', id: 1)&lt;br /&gt;
  @assignment_questionnaire_1_1 = create(:assignment_questionnaire, assignment_id: @assignment_1.id, questionnaire_id: @questionnaire_1.id, used_in_round: 1)&lt;br /&gt;
  @assignment_questionnaire_1_2 = create(:assignment_questionnaire, assignment_id: @assignment_1.id, questionnaire_id: @questionnaire_1.id, used_in_round: 2)&lt;br /&gt;
  @assignment_questionnaire_2_1 = create(:assignment_questionnaire, assignment_id: @assignment_2.id, questionnaire_id: @questionnaire_1.id, used_in_round: 1)&lt;br /&gt;
  @assignment_questionnaire_2_2 = create(:assignment_questionnaire, assignment_id: @assignment_2.id, questionnaire_id: @questionnaire_1.id, used_in_round: 2)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Questions under Questionnaires ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[questions]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @question_1_1 = create(:question, questionnaire_id: @questionnaire_1.id, id: 1)&lt;br /&gt;
  @question_1_2 = create(:question, questionnaire_id: @questionnaire_1.id, id: 2)&lt;br /&gt;
  @question_1_3 = create(:question, questionnaire_id: @questionnaire_1.id, id: 3)&lt;br /&gt;
  @question_1_4 = create(:question, questionnaire_id: @questionnaire_1.id, id: 4)&lt;br /&gt;
  @question_1_5 = create(:question, questionnaire_id: @questionnaire_1.id, id: 5)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Reviewers and Reviewees ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[participants]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[teams]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
Reviewers (Participant):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @reviewer_1 = create(:participant, can_review: 1)&lt;br /&gt;
  @reviewer_2 = create(:participant, can_review: 1)&lt;br /&gt;
  @reviewer_3 = create(:participant, can_review: 1)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Reviewees (Teams):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @reviewee_1 = create(:assignment_team, assignment: @assignment)&lt;br /&gt;
  @reviewee_2 = create(:assignment_team, assignment: @assignment)&lt;br /&gt;
  @reviewee_3 = create(:assignment_team, assignment: @assignment)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Responses ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[response_maps]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[responses]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Essential Parameters to be configured&amp;lt;br&amp;gt;&lt;br /&gt;
reviewed_object_id = &amp;lt;target_assignment&amp;gt;.id ; &amp;lt;br&amp;gt;&lt;br /&gt;
reviewer_id = &amp;lt;target_reviewer&amp;gt;.id ; &amp;lt;br&amp;gt;&lt;br /&gt;
reviewee_id = &amp;lt;target_reviewee&amp;gt;.id ; &amp;lt;br&amp;gt;&lt;br /&gt;
Note: The response map is setup to determine the relationship between reviewer and reviewee of an assignment.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
Response_maps:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @response_map_1_1 = create(:review_response_map, reviewer_id: @reviewer_1.id, reviewee_id: @reviewee_1.id)&lt;br /&gt;
  @response_map_1_2 = create(:review_response_map, reviewer_id: @reviewer_2.id, reviewee_id: @reviewee_1.id)&lt;br /&gt;
  @response_map_1_3 = create(:review_response_map, reviewer_id: @reviewer_3.id, reviewee_id: @reviewee_1.id)&lt;br /&gt;
&lt;br /&gt;
  @response_map_2_1 = create(:review_response_map, reviewer_id: @reviewer_1.id, reviewee_id: @reviewee_2.id)&lt;br /&gt;
  @response_map_2_2 = create(:review_response_map, reviewer_id: @reviewer_2.id, reviewee_id: @reviewee_2.id)&lt;br /&gt;
  @response_map_2_3 = create(:review_response_map, reviewer_id: @reviewer_3.id, reviewee_id: @reviewee_2.id)&lt;br /&gt;
&lt;br /&gt;
  @response_map_3_1 = create(:review_response_map, reviewer_id: @reviewer_1.id, reviewee_id: @reviewee_3.id)&lt;br /&gt;
  @response_map_3_2 = create(:review_response_map, reviewer_id: @reviewer_2.id, reviewee_id: @reviewee_3.id)&lt;br /&gt;
  @response_map_3_3 = create(:review_response_map, reviewer_id: @reviewer_3.id, reviewee_id: @reviewee_3.id)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Responses:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @response_1_1 = create(:response, is_submitted: true, map_id: @response_map_1_1.id)&lt;br /&gt;
  @response_1_2 = create(:response, is_submitted: true, map_id: @response_map_1_2.id)&lt;br /&gt;
  @response_1_3 = create(:response, is_submitted: true, map_id: @response_map_1_3.id)&lt;br /&gt;
&lt;br /&gt;
  @response_2_1 = create(:response, is_submitted: true, map_id: @response_map_2_1.id)&lt;br /&gt;
  @response_2_2 = create(:response, is_submitted: true, map_id: @response_map_2_2.id)&lt;br /&gt;
  @response_2_3 = create(:response, is_submitted: true, map_id: @response_map_2_3.id)&lt;br /&gt;
&lt;br /&gt;
  @response_3_1 = create(:response, is_submitted: true, map_id: @response_map_3_1.id)&lt;br /&gt;
  @response_3_2 = create(:response, is_submitted: true, map_id: @response_map_3_2.id)&lt;br /&gt;
  @response_3_3 = create(:response, is_submitted: true, map_id: @response_map_3_3.id)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Relevant Methods ===&lt;br /&gt;
==== db_query ====&lt;br /&gt;
This is the normal db query method, call this method will return peer review grades with given assignment id.&lt;br /&gt;
We will test this method in two aspect. &lt;br /&gt;
1. Test whether or not the grade return is right based on the specified algorithm.&lt;br /&gt;
2. We need to test the correctness of the query.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context 'test db_query' do&lt;br /&gt;
    it 'return average score' do&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_1.id, answer: 1)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_1.id, answer: 2)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_1.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_1.id, answer: 4)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      result = ReputationWebServiceController.new.db_query(1, 1, false)&lt;br /&gt;
      expect(result).to eq([[2, 1, 60.0]])&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== json_generator ====&lt;br /&gt;
This method will generate the hash format of the review, we will test this method by calling to and convert the result to json format the print to test its correctness.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context 'test json_generator' do&lt;br /&gt;
    it 'test 3 reviewer for one reviewee' do&lt;br /&gt;
      # reivewer_1's review for reviewee_1: [5, 5, 5, 5, 5]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
&lt;br /&gt;
      # reivewer_2's review for reviewee_1: [3, 3, 3, 3, 3]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
&lt;br /&gt;
      # reivewer_3's review for reviewee_1: [1, 1, 1, 1, 1]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
&lt;br /&gt;
      #result = ReputationWebServiceController.new.db_query(1, 1, false)&lt;br /&gt;
      #expect(result).to eq([[2, 1, 100.0], [3, 1, 60.0], [4, 1, 20.0]])&lt;br /&gt;
      result = ReputationWebServiceController.new.json_generator(1, 0, 1)&lt;br /&gt;
      expect(result).to eq({&amp;quot;submission1&amp;quot;=&amp;gt;{&amp;quot;stu2&amp;quot;=&amp;gt;100.0, &amp;quot;stu3&amp;quot;=&amp;gt;60.0, &amp;quot;stu4&amp;quot;=&amp;gt;20.0}})&lt;br /&gt;
      #repeat for different answers&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'test same reviewer for different reviewee' do&lt;br /&gt;
      # reivewer_1's review for reviewee_1: [5, 5, 5, 5, 5]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
&lt;br /&gt;
      # reivewer_1's review for reviewee_2: [3, 3, 3, 3, 3]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
&lt;br /&gt;
      result = ReputationWebServiceController.new.json_generator(1, 0, 1)&lt;br /&gt;
      expect(result).to eq(&amp;quot;submission1&amp;quot;=&amp;gt;{&amp;quot;stu2&amp;quot;=&amp;gt;100.0}, &amp;quot;submission2&amp;quot;=&amp;gt;{&amp;quot;stu2&amp;quot;=&amp;gt;60.0})&lt;br /&gt;
      #repeat for different answers&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== send_post_request ==== &lt;br /&gt;
This method send a post request to peerlogic.csc.ncsu.edu/reputation/calculations/reputation_algorithms to calculate get the reputation result and use show the result in corresponding UI and update given reviewer's reputation. We will test this method based on the algorithm in the paper, first to test the result reputation value, second to test the update value in database.&lt;br /&gt;
&lt;br /&gt;
Note that this method is not functioning due to the missing public &amp;amp; private key file for RSA encryption. The algorithm involving &amp;quot;expert grade&amp;quot; was also not implemented. &lt;br /&gt;
Thus, this method could not be properly tested. However we have gave the template to create tests for future use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context 'test send_post_request' do&lt;br /&gt;
    it 'failed because of no public key file' do&lt;br /&gt;
      # reivewer_1's review for reviewee_1: [5, 5, 5, 5, 5]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
&lt;br /&gt;
      params = {assignment_id: 1, round_num: 1, algorithm: 'hammer', checkbox: {expert_grade: &amp;quot;empty&amp;quot;}}&lt;br /&gt;
      session = {user: build(:instructor, id: 1)}&lt;br /&gt;
&lt;br /&gt;
      expect(true).to eq(true)&lt;br /&gt;
&lt;br /&gt;
      # comment out because send_post_request method request public key file while this file is missing&lt;br /&gt;
      # so at this time send_post_request is not functioning normally&lt;br /&gt;
      # get :send_post_request, params, session&lt;br /&gt;
      # expect(response).to redirect_to '/reputation_web_service/client'&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
=== Testing Results ===&lt;br /&gt;
&lt;br /&gt;
=== Coverage ===&lt;br /&gt;
&lt;br /&gt;
=== Future Tasks ===&lt;br /&gt;
As our team could not obtain the public/private key pair to access the reputation web service, we were only able get to the step prior to sending the JSON to the web service of reputation algorithms. Therefore, future steps are required to test on reputation system. &lt;br /&gt;
&lt;br /&gt;
# There is a lot of unused/commented code, which should be removed.&lt;br /&gt;
# Figure out what the code is doing and write appropriate comments for it.&lt;br /&gt;
# In the case of db_query, the name should say what it queries for. Also, this method not only queries, but calculates sums.  Since each method should do only one thing, the code for calculating sums should be in another method. And there should be comments in the code!&lt;br /&gt;
#json_generator should be generate_json. There needs to be a method comment saying what the parameters are.&lt;br /&gt;
# In  send_post_request, there are references to specific assignments, such as 724, 735, and 756. They were put in to gather data for a paper published in 2015. They are no longer relevant and should be removed. send_post_request is 91 lines long, far too long.&lt;br /&gt;
#There is a password for a private key in the code (and the code is open-sourced!) It should be in the db instead.&lt;br /&gt;
#Fix spelling of “dimention”&lt;br /&gt;
#client is a bad method name; why is stuff being copied from class variables to instance variables?&lt;br /&gt;
&lt;br /&gt;
== Collaborators ==&lt;br /&gt;
Jinku Cui (jcui23)&lt;br /&gt;
&lt;br /&gt;
Henry Chen (hchen34)&lt;br /&gt;
&lt;br /&gt;
Dong Li (dli35)&lt;br /&gt;
&lt;br /&gt;
Zijun Lu (zlu5)&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[https://doi.org/10.1109/FIE.2015.7344292 Pluggable reputation systems for peer review: A web-service approach]&lt;/div&gt;</summary>
		<author><name>Hchen34</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2168._Testing_-_Reputations&amp;diff=141968</id>
		<title>CSC/ECE 517 Fall 2021 - E2168. Testing - Reputations</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2168._Testing_-_Reputations&amp;diff=141968"/>
		<updated>2021-11-29T21:42:26Z</updated>

		<summary type="html">&lt;p&gt;Hchen34: Explain why send_post_request was not tested&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Project Overview ==&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;q&amp;gt;Online peer-review systems are now in common use in higher education. They free the instructor and course staff from having to provide personally all the feedback that students receive on their work. However, if we want to assure that all students receive competent feedback, or even use peer-assigned grades, we need a way to judge which peer reviewers are most credible. The solution is to use a reputation system.&amp;lt;/q&amp;gt; &amp;lt;br&amp;gt; The reputation system is meant to provide objective value to student assigned peer review scores. Students select from a list of tasks to be performed and then prepare their work and submit it to a peer-review system. The work is then reviewed by other students who offer comments/graded feedback to help the submitters improve their work.&lt;br /&gt;
During the peer review period it is important to determine which reviews are more accurate and show higher quality. Reputation is one way to achieve this goal; it is a quantization measurement to judge which peer reviewers are more reliable.&lt;br /&gt;
Peer reviewers can use expertiza to score an author. If Expertiza shows a confidence ratings for grades based upon the reviewers reputation then authors can more easily determine the legitimacy of the peer assigned score. In addition, the teaching staff can examine the quality of each peer review based on reputation values and, potentially, crowd-source a significant portion of the grading function.&lt;br /&gt;
Currently the reputation system is implemented in Expertiza through web-service, but there's no test written for it. Thus our goal is to write tests to verify Hamer's and Lauw’s algorithm from the reputation system.&lt;br /&gt;
&lt;br /&gt;
=== System Design ===&lt;br /&gt;
The below is referenced from project E1625, which would give us the overall description of the reputation system.&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Diagram E1625.png|1000px]]&amp;lt;br&amp;gt;&lt;br /&gt;
There are two algorithms intended for use in calculation of the reputation values for participants. &lt;br /&gt;
&lt;br /&gt;
There is a [https://expertiza.ncsu.edu/reputation_web_service/client web-service] (the link accessible only to the instructors) available which serves a JSON response containing the reputation value based on the seed provided in the form of the last known reputation value which we store in the ''participants'' table. An instructor can specify which algorithm to use for a particular assignment to calculate the confidence rating. &lt;br /&gt;
&lt;br /&gt;
As the [https://docs.google.com/viewer?url=https%3A%2F%2Fwww.researchgate.net%2Fprofile%2FYang_Song36%2Fpublication%2F289528736_Pluggable_Reputation_Systems_for_Peer_Review_a_Web-Service_Approach%2Flinks%2F568ec8d008ae78cc05160aed.pdf%3FinViewer%3D0%26pdfJsDownload%3D0%26origin%3Dpublication_detail paper] on reputation system by observes, “the Hamer-peer algorithm has the lowest maximum absolute bias and the Lauw-peer algorithm has the lowest overall bias.This indicates, from the instructor’s perspective, if there are further assignments of this kind, expert grading may not be necessary.”&lt;br /&gt;
:;Reputation range of Hamer’s algorithm is :&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: red;&amp;quot;&amp;gt;red&amp;lt;/span&amp;gt;                   value &amp;lt; 0.5&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: yellow&amp;quot;&amp;gt;yellow&amp;lt;/span&amp;gt;              value is &amp;gt;= 0.5 and &amp;lt;= 1&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: orange&amp;quot;&amp;gt;orange&amp;lt;/span&amp;gt;             value is &amp;gt; 1 and &amp;lt;= 1.5&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: HoneyDew&amp;quot;&amp;gt;light green&amp;lt;/span&amp;gt;       value is &amp;gt; 1.5 and &amp;lt;= 2&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: Chartreuse&amp;quot;&amp;gt;green&amp;lt;/span&amp;gt;               value is &amp;gt; 2&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The main difference between the Hamer-peer and the Lauw-peer algorithm is that the Lauw-peer algorithm keeps track of the reviewer's leniency (“bias”), which can be either positive or negative. A positive leniency indicates the reviewer tends to give higher scores than average.  This project determines reputation by subtracting the absolute value of the leniency from 1. Additionally, the range for Hamer’s algorithm is (0,∞) while for Lauw’s algorithm it is [0,1]. &lt;br /&gt;
:;Reputation range of Lauw’s algorithm is&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: red&amp;quot;&amp;gt;red&amp;lt;/span&amp;gt;                   value is &amp;lt; 0.2&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: yellow&amp;quot;&amp;gt;yellow&amp;lt;/span&amp;gt;              value is &amp;gt;= 0.2 and &amp;lt;= 0.4&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: orange&amp;quot;&amp;gt;orange&amp;lt;/span&amp;gt;             value is &amp;gt; 0.4 and &amp;lt;= 0.6&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: HoneyDew&amp;quot;&amp;gt;light green&amp;lt;/span&amp;gt;       value is &amp;gt; 0.6 and &amp;lt;= 0.8&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: Chartreuse&amp;quot;&amp;gt;green&amp;lt;/span&amp;gt;               value is &amp;gt; 0.8&lt;br /&gt;
&lt;br /&gt;
The instructor can choose to show results from Hamer’s algorithm or Lauw’s algorithm. The default algorithm should be Lauw’s algorithm.&lt;br /&gt;
&lt;br /&gt;
=== Objectives ===&lt;br /&gt;
&lt;br /&gt;
Our objectives for this project are the following:&lt;br /&gt;
* Double and stub an assignment, a few submissions to the assignment, under different review rubrics&lt;br /&gt;
* Manually calculate reputation scores based on paper &amp;quot;Pluggable reputation systems for peer review: A web-service approach&amp;quot;&lt;br /&gt;
* Validate correct reputation scores based on different review rubrics generated by reputation management VS manual computation of reputation score expectation on different reputation range of Hamer's and Lauw's algorithm with or without instructor score impact.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
*reputation_web_service_controller_spec&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
=== Setup Testing Objects ===&lt;br /&gt;
In order to implement testing on reputation, it is crucial to create sample reviews so that we could possibly obtain reputation score. During the kickoff meeting, our team defined four necessary steps to follow for the purpose of testing. Also, appropriate objects could be created and confined as discussed below.&lt;br /&gt;
&lt;br /&gt;
==== Assignment ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[assignments]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Essential Parameters to be configured&amp;lt;br&amp;gt;&lt;br /&gt;
submitter_count = 0;&amp;lt;br&amp;gt;&lt;br /&gt;
num_reviews = 5;&amp;lt;br&amp;gt;&lt;br /&gt;
num_reviewers = 5;&amp;lt;br&amp;gt;&lt;br /&gt;
num_reviews_allowed = 5;&amp;lt;br&amp;gt;&lt;br /&gt;
rounds_of_reviews = 2;&amp;lt;br&amp;gt;&lt;br /&gt;
reputation_algorithm = lauw/hamer;&amp;lt;br&amp;gt;&lt;br /&gt;
Note: Two assignment objects were created. Assignment_1 used lauw's algorithm, whereas assignment_2 used hamer's alogorithm.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @assignment_1 = create(:assignment, created_at: DateTime.now.in_time_zone - 13.day, submitter_count: 0, num_reviews: 3, num_reviewers: 5, num_reviews_allowed: 5, rounds_of_reviews: 2, reputation_algorithm: 'lauw', id: 1)&lt;br /&gt;
  @assignment_2 = create(:assignment, created_at: DateTime.now.in_time_zone - 13.day, submitter_count: 0, num_reviews: 3, num_reviewers: 5, num_reviews_allowed: 5, rounds_of_reviews: 2, reputation_algorithm: 'hamer', id: 2)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Questionnaires(Rubrics) ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[questionnaires]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[assignment_questionnaires]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Essential Parameters to be configured&amp;lt;br&amp;gt;&lt;br /&gt;
instructor_id = from_fixture;&amp;lt;br&amp;gt;&lt;br /&gt;
min_question_score = 0;&amp;lt;br&amp;gt;&lt;br /&gt;
max_question_score = 5;&amp;lt;br&amp;gt;&lt;br /&gt;
type = ReviewQuestionnaire;&amp;lt;br&amp;gt;&lt;br /&gt;
Note: We will define the assignment with ReviewQuestionnaire type rubric. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @questionnaire_1 = create(:questionnaire, min_question_score: 0, max_question_score: 5, type: 'ReviewQuestionnaire', id: 1)&lt;br /&gt;
  @assignment_questionnaire_1_1 = create(:assignment_questionnaire, assignment_id: @assignment_1.id, questionnaire_id: @questionnaire_1.id, used_in_round: 1)&lt;br /&gt;
  @assignment_questionnaire_1_2 = create(:assignment_questionnaire, assignment_id: @assignment_1.id, questionnaire_id: @questionnaire_1.id, used_in_round: 2)&lt;br /&gt;
  @assignment_questionnaire_2_1 = create(:assignment_questionnaire, assignment_id: @assignment_2.id, questionnaire_id: @questionnaire_1.id, used_in_round: 1)&lt;br /&gt;
  @assignment_questionnaire_2_2 = create(:assignment_questionnaire, assignment_id: @assignment_2.id, questionnaire_id: @questionnaire_1.id, used_in_round: 2, id: 4)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Questions under Questionnaires ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[questions]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @question_1_1 = create(:question, questionnaire_id: @questionnaire_1.id, id: 1)&lt;br /&gt;
  @question_1_2 = create(:question, questionnaire_id: @questionnaire_1.id, id: 2)&lt;br /&gt;
  @question_1_3 = create(:question, questionnaire_id: @questionnaire_1.id, id: 3)&lt;br /&gt;
  @question_1_4 = create(:question, questionnaire_id: @questionnaire_1.id, id: 4)&lt;br /&gt;
  @question_1_5 = create(:question, questionnaire_id: @questionnaire_1.id, id: 5)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Reviewers and Reviewees ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[participants]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[teams]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
Reviewers (Participant):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @reviewer_1 = create(:participant, can_review: 1)&lt;br /&gt;
  @reviewer_2 = create(:participant, can_review: 1)&lt;br /&gt;
  @reviewer_3 = create(:participant, can_review: 1)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Reviewees (Teams):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @reviewee_1 = create(:assignment_team, assignment: @assignment)&lt;br /&gt;
  @reviewee_2 = create(:assignment_team, assignment: @assignment)&lt;br /&gt;
  @reviewee_3 = create(:assignment_team, assignment: @assignment)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Responses ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[response_maps]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[responses]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Essential Parameters to be configured&amp;lt;br&amp;gt;&lt;br /&gt;
reviewed_object_id = assignment_id;&amp;lt;br&amp;gt;&lt;br /&gt;
reviewer_id = participants;&amp;lt;br&amp;gt;&lt;br /&gt;
reviewee_id = AssignmentTeam;&amp;lt;br&amp;gt;&lt;br /&gt;
Note: we will setup response map to determine relationship between reviewer and reviewee of an assignment.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
Response_maps:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @response_map_1_1 = create(:review_response_map, reviewer_id: @reviewer_1.id, reviewee_id: @reviewee_1.id)&lt;br /&gt;
  @response_map_1_2 = create(:review_response_map, reviewer_id: @reviewer_2.id, reviewee_id: @reviewee_1.id)&lt;br /&gt;
  @response_map_1_3 = create(:review_response_map, reviewer_id: @reviewer_3.id, reviewee_id: @reviewee_1.id)&lt;br /&gt;
&lt;br /&gt;
  @response_map_2_1 = create(:review_response_map, reviewer_id: @reviewer_1.id, reviewee_id: @reviewee_2.id)&lt;br /&gt;
  @response_map_2_2 = create(:review_response_map, reviewer_id: @reviewer_2.id, reviewee_id: @reviewee_2.id)&lt;br /&gt;
  @response_map_2_3 = create(:review_response_map, reviewer_id: @reviewer_3.id, reviewee_id: @reviewee_2.id)&lt;br /&gt;
&lt;br /&gt;
  @response_map_3_1 = create(:review_response_map, reviewer_id: @reviewer_1.id, reviewee_id: @reviewee_3.id)&lt;br /&gt;
  @response_map_3_2 = create(:review_response_map, reviewer_id: @reviewer_2.id, reviewee_id: @reviewee_3.id)&lt;br /&gt;
  @response_map_3_3 = create(:review_response_map, reviewer_id: @reviewer_3.id, reviewee_id: @reviewee_3.id)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Responses:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @response_1_1 = create(:response, is_submitted: true, map_id: @response_map_1_1.id)&lt;br /&gt;
  @response_1_2 = create(:response, is_submitted: true, map_id: @response_map_1_2.id)&lt;br /&gt;
  @response_1_3 = create(:response, is_submitted: true, map_id: @response_map_1_3.id)&lt;br /&gt;
&lt;br /&gt;
  @response_2_1 = create(:response, is_submitted: true, map_id: @response_map_2_1.id)&lt;br /&gt;
  @response_2_2 = create(:response, is_submitted: true, map_id: @response_map_2_2.id)&lt;br /&gt;
  @response_2_3 = create(:response, is_submitted: true, map_id: @response_map_2_3.id)&lt;br /&gt;
&lt;br /&gt;
  @response_3_1 = create(:response, is_submitted: true, map_id: @response_map_3_1.id)&lt;br /&gt;
  @response_3_2 = create(:response, is_submitted: true, map_id: @response_map_3_2.id)&lt;br /&gt;
  @response_3_3 = create(:response, is_submitted: true, map_id: @response_map_3_3.id)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The manifestation of each object will contribute to the success of the following test on reputations. Some fields in each object can be empty or have default values. Some attributes are not relevant to the test. When implementing the test, the test scripts need to generate or set fixed values for corresponding fields.&lt;br /&gt;
&lt;br /&gt;
=== Relevant Methods ===&lt;br /&gt;
==== db_query ====&lt;br /&gt;
This is the normal db query method, call this method will return peer review grades with given assignment id.&lt;br /&gt;
We will test this method in two aspect. &lt;br /&gt;
1. Test whether or not the grade return is right based on the specified algorithm.&lt;br /&gt;
2. We need to test the correctness of the query.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context 'test db_query' do&lt;br /&gt;
    it 'return average score' do&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_1.id, answer: 1)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_1.id, answer: 2)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_1.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_1.id, answer: 4)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      result = ReputationWebServiceController.new.db_query(1, 1, false)&lt;br /&gt;
      expect(result).to eq([[2, 1, 60.0]])&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== json_generator ====&lt;br /&gt;
This method will generate the hash format of the review, we will test this method by calling to and convert the result to json format the print to test its correctness.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context 'test json_generator' do&lt;br /&gt;
    it 'test 3 reviewer for one reviewee' do&lt;br /&gt;
      # reivewer_1's review for reviewee_1: [5, 5, 5, 5, 5]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
&lt;br /&gt;
      # reivewer_2's review for reviewee_1: [3, 3, 3, 3, 3]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
&lt;br /&gt;
      # reivewer_3's review for reviewee_1: [1, 1, 1, 1, 1]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
&lt;br /&gt;
      #result = ReputationWebServiceController.new.db_query(1, 1, false)&lt;br /&gt;
      #expect(result).to eq([[2, 1, 100.0], [3, 1, 60.0], [4, 1, 20.0]])&lt;br /&gt;
      result = ReputationWebServiceController.new.json_generator(1, 0, 1)&lt;br /&gt;
      expect(result).to eq({&amp;quot;submission1&amp;quot;=&amp;gt;{&amp;quot;stu2&amp;quot;=&amp;gt;100.0, &amp;quot;stu3&amp;quot;=&amp;gt;60.0, &amp;quot;stu4&amp;quot;=&amp;gt;20.0}})&lt;br /&gt;
      #repeat for different answers&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'test same reviewer for different reviewee' do&lt;br /&gt;
      # reivewer_1's review for reviewee_1: [5, 5, 5, 5, 5]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
&lt;br /&gt;
      # reivewer_1's review for reviewee_2: [3, 3, 3, 3, 3]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
&lt;br /&gt;
      result = ReputationWebServiceController.new.json_generator(1, 0, 1)&lt;br /&gt;
      expect(result).to eq(&amp;quot;submission1&amp;quot;=&amp;gt;{&amp;quot;stu2&amp;quot;=&amp;gt;100.0}, &amp;quot;submission2&amp;quot;=&amp;gt;{&amp;quot;stu2&amp;quot;=&amp;gt;60.0})&lt;br /&gt;
      #repeat for different answers&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== send_post_request ==== &lt;br /&gt;
This method send a post request to peerlogic.csc.ncsu.edu/reputation/calculations/reputation_algorithms to calculate get the reputation result and use show the result in corresponding UI and update given reviewer's reputation. We will test this method based on the algorithm in the paper, first to test the result reputation value, second to test the update value in database.&lt;br /&gt;
&lt;br /&gt;
Note that this method is not functioning due to the missing public &amp;amp; private key file for RSA encryption. The algorithm involving &amp;quot;expert grade&amp;quot; was also not implemented. &lt;br /&gt;
Thus, this method could not be properly tested. However we have gave the template to create tests for future use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context 'test send_post_request' do&lt;br /&gt;
    it 'failed because of no public key file' do&lt;br /&gt;
      # reivewer_1's review for reviewee_1: [5, 5, 5, 5, 5]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
&lt;br /&gt;
      params = {assignment_id: 1, round_num: 1, algorithm: 'hammer', checkbox: {expert_grade: &amp;quot;empty&amp;quot;}}&lt;br /&gt;
      session = {user: build(:instructor, id: 1)}&lt;br /&gt;
&lt;br /&gt;
      expect(true).to eq(true)&lt;br /&gt;
&lt;br /&gt;
      # comment out because send_post_request method request public key file while this file is missing&lt;br /&gt;
      # so at this time send_post_request is not functioning normally&lt;br /&gt;
      # get :send_post_request, params, session&lt;br /&gt;
      # expect(response).to redirect_to '/reputation_web_service/client'&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
=== Testing Results ===&lt;br /&gt;
&lt;br /&gt;
=== Coverage ===&lt;br /&gt;
&lt;br /&gt;
=== Future Tasks ===&lt;br /&gt;
As our team could not obtain the public/private key pair to access the reputation web service, we were only able get to the step prior to sending the JSON to the web service of reputation algorithms. Therefore, future steps are required to test on reputation system. &lt;br /&gt;
&lt;br /&gt;
# There is a lot of unused/commented code, which should be removed.&lt;br /&gt;
# Figure out what the code is doing and write appropriate comments for it.&lt;br /&gt;
# In the case of db_query, the name should say what it queries for. Also, this method not only queries, but calculates sums.  Since each method should do only one thing, the code for calculating sums should be in another method. And there should be comments in the code!&lt;br /&gt;
#json_generator should be generate_json. There needs to be a method comment saying what the parameters are.&lt;br /&gt;
# In  send_post_request, there are references to specific assignments, such as 724, 735, and 756. They were put in to gather data for a paper published in 2015. They are no longer relevant and should be removed. send_post_request is 91 lines long, far too long.&lt;br /&gt;
#There is a password for a private key in the code (and the code is open-sourced!) It should be in the db instead.&lt;br /&gt;
#Fix spelling of “dimention”&lt;br /&gt;
#client is a bad method name; why is stuff being copied from class variables to instance variables?&lt;br /&gt;
&lt;br /&gt;
== Collaborators ==&lt;br /&gt;
Jinku Cui (jcui23)&lt;br /&gt;
&lt;br /&gt;
Henry Chen (hchen34)&lt;br /&gt;
&lt;br /&gt;
Dong Li (dli35)&lt;br /&gt;
&lt;br /&gt;
Zijun Lu (zlu5)&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[https://doi.org/10.1109/FIE.2015.7344292 Pluggable reputation systems for peer review: A web-service approach]&lt;/div&gt;</summary>
		<author><name>Hchen34</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2168._Testing_-_Reputations&amp;diff=141961</id>
		<title>CSC/ECE 517 Fall 2021 - E2168. Testing - Reputations</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2168._Testing_-_Reputations&amp;diff=141961"/>
		<updated>2021-11-29T21:37:28Z</updated>

		<summary type="html">&lt;p&gt;Hchen34: Added testing results and coverage category for future use&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Project Overview ==&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;q&amp;gt;Online peer-review systems are now in common use in higher education. They free the instructor and course staff from having to provide personally all the feedback that students receive on their work. However, if we want to assure that all students receive competent feedback, or even use peer-assigned grades, we need a way to judge which peer reviewers are most credible. The solution is to use a reputation system.&amp;lt;/q&amp;gt; &amp;lt;br&amp;gt; The reputation system is meant to provide objective value to student assigned peer review scores. Students select from a list of tasks to be performed and then prepare their work and submit it to a peer-review system. The work is then reviewed by other students who offer comments/graded feedback to help the submitters improve their work.&lt;br /&gt;
During the peer review period it is important to determine which reviews are more accurate and show higher quality. Reputation is one way to achieve this goal; it is a quantization measurement to judge which peer reviewers are more reliable.&lt;br /&gt;
Peer reviewers can use expertiza to score an author. If Expertiza shows a confidence ratings for grades based upon the reviewers reputation then authors can more easily determine the legitimacy of the peer assigned score. In addition, the teaching staff can examine the quality of each peer review based on reputation values and, potentially, crowd-source a significant portion of the grading function.&lt;br /&gt;
Currently the reputation system is implemented in Expertiza through web-service, but there's no test written for it. Thus our goal is to write tests to verify Hamer's and Lauw’s algorithm from the reputation system.&lt;br /&gt;
&lt;br /&gt;
=== System Design ===&lt;br /&gt;
The below is referenced from project E1625, which would give us the overall description of the reputation system.&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Diagram E1625.png|1000px]]&amp;lt;br&amp;gt;&lt;br /&gt;
There are two algorithms intended for use in calculation of the reputation values for participants. &lt;br /&gt;
&lt;br /&gt;
There is a [https://expertiza.ncsu.edu/reputation_web_service/client web-service] (the link accessible only to the instructors) available which serves a JSON response containing the reputation value based on the seed provided in the form of the last known reputation value which we store in the ''participants'' table. An instructor can specify which algorithm to use for a particular assignment to calculate the confidence rating. &lt;br /&gt;
&lt;br /&gt;
As the [https://docs.google.com/viewer?url=https%3A%2F%2Fwww.researchgate.net%2Fprofile%2FYang_Song36%2Fpublication%2F289528736_Pluggable_Reputation_Systems_for_Peer_Review_a_Web-Service_Approach%2Flinks%2F568ec8d008ae78cc05160aed.pdf%3FinViewer%3D0%26pdfJsDownload%3D0%26origin%3Dpublication_detail paper] on reputation system by observes, “the Hamer-peer algorithm has the lowest maximum absolute bias and the Lauw-peer algorithm has the lowest overall bias.This indicates, from the instructor’s perspective, if there are further assignments of this kind, expert grading may not be necessary.”&lt;br /&gt;
:;Reputation range of Hamer’s algorithm is :&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: red;&amp;quot;&amp;gt;red&amp;lt;/span&amp;gt;                   value &amp;lt; 0.5&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: yellow&amp;quot;&amp;gt;yellow&amp;lt;/span&amp;gt;              value is &amp;gt;= 0.5 and &amp;lt;= 1&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: orange&amp;quot;&amp;gt;orange&amp;lt;/span&amp;gt;             value is &amp;gt; 1 and &amp;lt;= 1.5&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: HoneyDew&amp;quot;&amp;gt;light green&amp;lt;/span&amp;gt;       value is &amp;gt; 1.5 and &amp;lt;= 2&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: Chartreuse&amp;quot;&amp;gt;green&amp;lt;/span&amp;gt;               value is &amp;gt; 2&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The main difference between the Hamer-peer and the Lauw-peer algorithm is that the Lauw-peer algorithm keeps track of the reviewer's leniency (“bias”), which can be either positive or negative. A positive leniency indicates the reviewer tends to give higher scores than average.  This project determines reputation by subtracting the absolute value of the leniency from 1. Additionally, the range for Hamer’s algorithm is (0,∞) while for Lauw’s algorithm it is [0,1]. &lt;br /&gt;
:;Reputation range of Lauw’s algorithm is&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: red&amp;quot;&amp;gt;red&amp;lt;/span&amp;gt;                   value is &amp;lt; 0.2&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: yellow&amp;quot;&amp;gt;yellow&amp;lt;/span&amp;gt;              value is &amp;gt;= 0.2 and &amp;lt;= 0.4&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: orange&amp;quot;&amp;gt;orange&amp;lt;/span&amp;gt;             value is &amp;gt; 0.4 and &amp;lt;= 0.6&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: HoneyDew&amp;quot;&amp;gt;light green&amp;lt;/span&amp;gt;       value is &amp;gt; 0.6 and &amp;lt;= 0.8&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: Chartreuse&amp;quot;&amp;gt;green&amp;lt;/span&amp;gt;               value is &amp;gt; 0.8&lt;br /&gt;
&lt;br /&gt;
The instructor can choose to show results from Hamer’s algorithm or Lauw’s algorithm. The default algorithm should be Lauw’s algorithm.&lt;br /&gt;
&lt;br /&gt;
=== Objectives ===&lt;br /&gt;
&lt;br /&gt;
Our objectives for this project are the following:&lt;br /&gt;
* Double and stub an assignment, a few submissions to the assignment, under different review rubrics&lt;br /&gt;
* Manually calculate reputation scores based on paper &amp;quot;Pluggable reputation systems for peer review: A web-service approach&amp;quot;&lt;br /&gt;
* Validate correct reputation scores based on different review rubrics generated by reputation management VS manual computation of reputation score expectation on different reputation range of Hamer's and Lauw's algorithm with or without instructor score impact.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
*reputation_web_service_controller_spec&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
=== Setup Testing Objects ===&lt;br /&gt;
In order to implement testing on reputation, it is crucial to create sample reviews so that we could possibly obtain reputation score. During the kickoff meeting, our team defined four necessary steps to follow for the purpose of testing. Also, appropriate objects could be created and confined as discussed below.&lt;br /&gt;
&lt;br /&gt;
==== Assignment ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[assignments]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Essential Parameters to be configured&amp;lt;br&amp;gt;&lt;br /&gt;
submitter_count = 0;&amp;lt;br&amp;gt;&lt;br /&gt;
num_reviews = 5;&amp;lt;br&amp;gt;&lt;br /&gt;
num_reviewers = 5;&amp;lt;br&amp;gt;&lt;br /&gt;
num_reviews_allowed = 5;&amp;lt;br&amp;gt;&lt;br /&gt;
rounds_of_reviews = 2;&amp;lt;br&amp;gt;&lt;br /&gt;
reputation_algorithm = lauw/hamer;&amp;lt;br&amp;gt;&lt;br /&gt;
Note: Two assignment objects were created. Assignment_1 used lauw's algorithm, whereas assignment_2 used hamer's alogorithm.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @assignment_1 = create(:assignment, created_at: DateTime.now.in_time_zone - 13.day, submitter_count: 0, num_reviews: 3, num_reviewers: 5, num_reviews_allowed: 5, rounds_of_reviews: 2, reputation_algorithm: 'lauw', id: 1)&lt;br /&gt;
  @assignment_2 = create(:assignment, created_at: DateTime.now.in_time_zone - 13.day, submitter_count: 0, num_reviews: 3, num_reviewers: 5, num_reviews_allowed: 5, rounds_of_reviews: 2, reputation_algorithm: 'hamer', id: 2)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Questionnaires(Rubrics) ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[questionnaires]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[assignment_questionnaires]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Essential Parameters to be configured&amp;lt;br&amp;gt;&lt;br /&gt;
instructor_id = from_fixture;&amp;lt;br&amp;gt;&lt;br /&gt;
min_question_score = 0;&amp;lt;br&amp;gt;&lt;br /&gt;
max_question_score = 5;&amp;lt;br&amp;gt;&lt;br /&gt;
type = ReviewQuestionnaire;&amp;lt;br&amp;gt;&lt;br /&gt;
Note: We will define the assignment with ReviewQuestionnaire type rubric. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @questionnaire_1 = create(:questionnaire, min_question_score: 0, max_question_score: 5, type: 'ReviewQuestionnaire', id: 1)&lt;br /&gt;
  @assignment_questionnaire_1_1 = create(:assignment_questionnaire, assignment_id: @assignment_1.id, questionnaire_id: @questionnaire_1.id, used_in_round: 1)&lt;br /&gt;
  @assignment_questionnaire_1_2 = create(:assignment_questionnaire, assignment_id: @assignment_1.id, questionnaire_id: @questionnaire_1.id, used_in_round: 2)&lt;br /&gt;
  @assignment_questionnaire_2_1 = create(:assignment_questionnaire, assignment_id: @assignment_2.id, questionnaire_id: @questionnaire_1.id, used_in_round: 1)&lt;br /&gt;
  @assignment_questionnaire_2_2 = create(:assignment_questionnaire, assignment_id: @assignment_2.id, questionnaire_id: @questionnaire_1.id, used_in_round: 2, id: 4)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Questions under Questionnaires ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[questions]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @question_1_1 = create(:question, questionnaire_id: @questionnaire_1.id, id: 1)&lt;br /&gt;
  @question_1_2 = create(:question, questionnaire_id: @questionnaire_1.id, id: 2)&lt;br /&gt;
  @question_1_3 = create(:question, questionnaire_id: @questionnaire_1.id, id: 3)&lt;br /&gt;
  @question_1_4 = create(:question, questionnaire_id: @questionnaire_1.id, id: 4)&lt;br /&gt;
  @question_1_5 = create(:question, questionnaire_id: @questionnaire_1.id, id: 5)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Reviewers and Reviewees ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[participants]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[teams]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
Reviewers (Participant):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @reviewer_1 = create(:participant, can_review: 1)&lt;br /&gt;
  @reviewer_2 = create(:participant, can_review: 1)&lt;br /&gt;
  @reviewer_3 = create(:participant, can_review: 1)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Reviewees (Teams):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @reviewee_1 = create(:assignment_team, assignment: @assignment)&lt;br /&gt;
  @reviewee_2 = create(:assignment_team, assignment: @assignment)&lt;br /&gt;
  @reviewee_3 = create(:assignment_team, assignment: @assignment)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Responses ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[response_maps]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[responses]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Essential Parameters to be configured&amp;lt;br&amp;gt;&lt;br /&gt;
reviewed_object_id = assignment_id;&amp;lt;br&amp;gt;&lt;br /&gt;
reviewer_id = participants;&amp;lt;br&amp;gt;&lt;br /&gt;
reviewee_id = AssignmentTeam;&amp;lt;br&amp;gt;&lt;br /&gt;
Note: we will setup response map to determine relationship between reviewer and reviewee of an assignment.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
Response_maps:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @response_map_1_1 = create(:review_response_map, reviewer_id: @reviewer_1.id, reviewee_id: @reviewee_1.id)&lt;br /&gt;
  @response_map_1_2 = create(:review_response_map, reviewer_id: @reviewer_2.id, reviewee_id: @reviewee_1.id)&lt;br /&gt;
  @response_map_1_3 = create(:review_response_map, reviewer_id: @reviewer_3.id, reviewee_id: @reviewee_1.id)&lt;br /&gt;
&lt;br /&gt;
  @response_map_2_1 = create(:review_response_map, reviewer_id: @reviewer_1.id, reviewee_id: @reviewee_2.id)&lt;br /&gt;
  @response_map_2_2 = create(:review_response_map, reviewer_id: @reviewer_2.id, reviewee_id: @reviewee_2.id)&lt;br /&gt;
  @response_map_2_3 = create(:review_response_map, reviewer_id: @reviewer_3.id, reviewee_id: @reviewee_2.id)&lt;br /&gt;
&lt;br /&gt;
  @response_map_3_1 = create(:review_response_map, reviewer_id: @reviewer_1.id, reviewee_id: @reviewee_3.id)&lt;br /&gt;
  @response_map_3_2 = create(:review_response_map, reviewer_id: @reviewer_2.id, reviewee_id: @reviewee_3.id)&lt;br /&gt;
  @response_map_3_3 = create(:review_response_map, reviewer_id: @reviewer_3.id, reviewee_id: @reviewee_3.id)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Responses:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @response_1_1 = create(:response, is_submitted: true, map_id: @response_map_1_1.id)&lt;br /&gt;
  @response_1_2 = create(:response, is_submitted: true, map_id: @response_map_1_2.id)&lt;br /&gt;
  @response_1_3 = create(:response, is_submitted: true, map_id: @response_map_1_3.id)&lt;br /&gt;
&lt;br /&gt;
  @response_2_1 = create(:response, is_submitted: true, map_id: @response_map_2_1.id)&lt;br /&gt;
  @response_2_2 = create(:response, is_submitted: true, map_id: @response_map_2_2.id)&lt;br /&gt;
  @response_2_3 = create(:response, is_submitted: true, map_id: @response_map_2_3.id)&lt;br /&gt;
&lt;br /&gt;
  @response_3_1 = create(:response, is_submitted: true, map_id: @response_map_3_1.id)&lt;br /&gt;
  @response_3_2 = create(:response, is_submitted: true, map_id: @response_map_3_2.id)&lt;br /&gt;
  @response_3_3 = create(:response, is_submitted: true, map_id: @response_map_3_3.id)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The manifestation of each object will contribute to the success of the following test on reputations. Some fields in each object can be empty or have default values. Some attributes are not relevant to the test. When implementing the test, the test scripts need to generate or set fixed values for corresponding fields.&lt;br /&gt;
&lt;br /&gt;
=== Relevant Methods ===&lt;br /&gt;
==== db_query ====&lt;br /&gt;
This is the normal db query method, call this method will return peer review grades with given assignment id.&lt;br /&gt;
We will test this method in two aspect. &lt;br /&gt;
1. Test whether or not the grade return is right based on the specified algorithm.&lt;br /&gt;
2. We need to test the correctness of the query.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context 'test db_query' do&lt;br /&gt;
    it 'return average score' do&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_1.id, answer: 1)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_1.id, answer: 2)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_1.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_1.id, answer: 4)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      result = ReputationWebServiceController.new.db_query(1, 1, false)&lt;br /&gt;
      expect(result).to eq([[2, 1, 60.0]])&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== json_generator ====&lt;br /&gt;
This method will generate the hash format of the review, we will test this method by calling to and convert the result to json format the print to test its correctness.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context 'test json_generator' do&lt;br /&gt;
    it 'test 3 reviewer for one reviewee' do&lt;br /&gt;
      # reivewer_1's review for reviewee_1: [5, 5, 5, 5, 5]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
&lt;br /&gt;
      # reivewer_2's review for reviewee_1: [3, 3, 3, 3, 3]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
&lt;br /&gt;
      # reivewer_3's review for reviewee_1: [1, 1, 1, 1, 1]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
&lt;br /&gt;
      #result = ReputationWebServiceController.new.db_query(1, 1, false)&lt;br /&gt;
      #expect(result).to eq([[2, 1, 100.0], [3, 1, 60.0], [4, 1, 20.0]])&lt;br /&gt;
      result = ReputationWebServiceController.new.json_generator(1, 0, 1)&lt;br /&gt;
      expect(result).to eq({&amp;quot;submission1&amp;quot;=&amp;gt;{&amp;quot;stu2&amp;quot;=&amp;gt;100.0, &amp;quot;stu3&amp;quot;=&amp;gt;60.0, &amp;quot;stu4&amp;quot;=&amp;gt;20.0}})&lt;br /&gt;
      #repeat for different answers&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'test same reviewer for different reviewee' do&lt;br /&gt;
      # reivewer_1's review for reviewee_1: [5, 5, 5, 5, 5]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
&lt;br /&gt;
      # reivewer_1's review for reviewee_2: [3, 3, 3, 3, 3]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
&lt;br /&gt;
      result = ReputationWebServiceController.new.json_generator(1, 0, 1)&lt;br /&gt;
      expect(result).to eq(&amp;quot;submission1&amp;quot;=&amp;gt;{&amp;quot;stu2&amp;quot;=&amp;gt;100.0}, &amp;quot;submission2&amp;quot;=&amp;gt;{&amp;quot;stu2&amp;quot;=&amp;gt;60.0})&lt;br /&gt;
      #repeat for different answers&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== send_post_request ==== &lt;br /&gt;
This method send a post request to peerlogic.csc.ncsu.edu/reputation/calculations/reputation_algorithms to calculate get the reputation result and use show the result &lt;br /&gt;
in corresponding UI and update given reviewer's reputation. We will test this method based on the algorithm in the paper, first to test the result reputation value, second to test the&lt;br /&gt;
update value in database.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context 'test send_post_request' do&lt;br /&gt;
    it 'failed because of no public key file' do&lt;br /&gt;
      # reivewer_1's review for reviewee_1: [5, 5, 5, 5, 5]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
&lt;br /&gt;
      params = {assignment_id: 1, round_num: 1, algorithm: 'hammer', checkbox: {expert_grade: &amp;quot;empty&amp;quot;}}&lt;br /&gt;
      session = {user: build(:instructor, id: 1)}&lt;br /&gt;
&lt;br /&gt;
      expect(true).to eq(true)&lt;br /&gt;
&lt;br /&gt;
      # comment out because send_post_request method request public key file while this file is missing&lt;br /&gt;
      # so at this time send_post_request is not functioning normally&lt;br /&gt;
      # get :send_post_request, params, session&lt;br /&gt;
      # expect(response).to redirect_to '/reputation_web_service/client'&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
=== Testing Results ===&lt;br /&gt;
&lt;br /&gt;
=== Coverage ===&lt;br /&gt;
&lt;br /&gt;
=== Future Tasks ===&lt;br /&gt;
As our team could not obtain the public/private key pair to access the reputation web service, we were only able get to the step prior to sending the JSON to the web service of reputation algorithms. Therefore, future steps are required to test on reputation system. &lt;br /&gt;
&lt;br /&gt;
# There is a lot of unused/commented code, which should be removed.&lt;br /&gt;
# Figure out what the code is doing and write appropriate comments for it.&lt;br /&gt;
# In the case of db_query, the name should say what it queries for. Also, this method not only queries, but calculates sums.  Since each method should do only one thing, the code for calculating sums should be in another method. And there should be comments in the code!&lt;br /&gt;
#json_generator should be generate_json. There needs to be a method comment saying what the parameters are.&lt;br /&gt;
# In  send_post_request, there are references to specific assignments, such as 724, 735, and 756. They were put in to gather data for a paper published in 2015. They are no longer relevant and should be removed. send_post_request is 91 lines long, far too long.&lt;br /&gt;
#There is a password for a private key in the code (and the code is open-sourced!) It should be in the db instead.&lt;br /&gt;
#Fix spelling of “dimention”&lt;br /&gt;
#client is a bad method name; why is stuff being copied from class variables to instance variables?&lt;br /&gt;
&lt;br /&gt;
== Collaborators ==&lt;br /&gt;
Jinku Cui (jcui23)&lt;br /&gt;
&lt;br /&gt;
Henry Chen (hchen34)&lt;br /&gt;
&lt;br /&gt;
Dong Li (dli35)&lt;br /&gt;
&lt;br /&gt;
Zijun Lu (zlu5)&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[https://doi.org/10.1109/FIE.2015.7344292 Pluggable reputation systems for peer review: A web-service approach]&lt;/div&gt;</summary>
		<author><name>Hchen34</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2168._Testing_-_Reputations&amp;diff=141958</id>
		<title>CSC/ECE 517 Fall 2021 - E2168. Testing - Reputations</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2168._Testing_-_Reputations&amp;diff=141958"/>
		<updated>2021-11-29T21:35:23Z</updated>

		<summary type="html">&lt;p&gt;Hchen34: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Project Overview ==&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;q&amp;gt;Online peer-review systems are now in common use in higher education. They free the instructor and course staff from having to provide personally all the feedback that students receive on their work. However, if we want to assure that all students receive competent feedback, or even use peer-assigned grades, we need a way to judge which peer reviewers are most credible. The solution is to use a reputation system.&amp;lt;/q&amp;gt; &amp;lt;br&amp;gt; The reputation system is meant to provide objective value to student assigned peer review scores. Students select from a list of tasks to be performed and then prepare their work and submit it to a peer-review system. The work is then reviewed by other students who offer comments/graded feedback to help the submitters improve their work.&lt;br /&gt;
During the peer review period it is important to determine which reviews are more accurate and show higher quality. Reputation is one way to achieve this goal; it is a quantization measurement to judge which peer reviewers are more reliable.&lt;br /&gt;
Peer reviewers can use expertiza to score an author. If Expertiza shows a confidence ratings for grades based upon the reviewers reputation then authors can more easily determine the legitimacy of the peer assigned score. In addition, the teaching staff can examine the quality of each peer review based on reputation values and, potentially, crowd-source a significant portion of the grading function.&lt;br /&gt;
Currently the reputation system is implemented in Expertiza through web-service, but there's no test written for it. Thus our goal is to write tests to verify Hamer's and Lauw’s algorithm from the reputation system.&lt;br /&gt;
&lt;br /&gt;
=== System Design ===&lt;br /&gt;
The below is referenced from project E1625, which would give us the overall description of the reputation system.&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Diagram E1625.png|1000px]]&amp;lt;br&amp;gt;&lt;br /&gt;
There are two algorithms intended for use in calculation of the reputation values for participants. &lt;br /&gt;
&lt;br /&gt;
There is a [https://expertiza.ncsu.edu/reputation_web_service/client web-service] (the link accessible only to the instructors) available which serves a JSON response containing the reputation value based on the seed provided in the form of the last known reputation value which we store in the ''participants'' table. An instructor can specify which algorithm to use for a particular assignment to calculate the confidence rating. &lt;br /&gt;
&lt;br /&gt;
As the [https://docs.google.com/viewer?url=https%3A%2F%2Fwww.researchgate.net%2Fprofile%2FYang_Song36%2Fpublication%2F289528736_Pluggable_Reputation_Systems_for_Peer_Review_a_Web-Service_Approach%2Flinks%2F568ec8d008ae78cc05160aed.pdf%3FinViewer%3D0%26pdfJsDownload%3D0%26origin%3Dpublication_detail paper] on reputation system by observes, “the Hamer-peer algorithm has the lowest maximum absolute bias and the Lauw-peer algorithm has the lowest overall bias.This indicates, from the instructor’s perspective, if there are further assignments of this kind, expert grading may not be necessary.”&lt;br /&gt;
:;Reputation range of Hamer’s algorithm is :&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: red;&amp;quot;&amp;gt;red&amp;lt;/span&amp;gt;                   value &amp;lt; 0.5&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: yellow&amp;quot;&amp;gt;yellow&amp;lt;/span&amp;gt;              value is &amp;gt;= 0.5 and &amp;lt;= 1&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: orange&amp;quot;&amp;gt;orange&amp;lt;/span&amp;gt;             value is &amp;gt; 1 and &amp;lt;= 1.5&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: HoneyDew&amp;quot;&amp;gt;light green&amp;lt;/span&amp;gt;       value is &amp;gt; 1.5 and &amp;lt;= 2&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: Chartreuse&amp;quot;&amp;gt;green&amp;lt;/span&amp;gt;               value is &amp;gt; 2&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The main difference between the Hamer-peer and the Lauw-peer algorithm is that the Lauw-peer algorithm keeps track of the reviewer's leniency (“bias”), which can be either positive or negative. A positive leniency indicates the reviewer tends to give higher scores than average.  This project determines reputation by subtracting the absolute value of the leniency from 1. Additionally, the range for Hamer’s algorithm is (0,∞) while for Lauw’s algorithm it is [0,1]. &lt;br /&gt;
:;Reputation range of Lauw’s algorithm is&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: red&amp;quot;&amp;gt;red&amp;lt;/span&amp;gt;                   value is &amp;lt; 0.2&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: yellow&amp;quot;&amp;gt;yellow&amp;lt;/span&amp;gt;              value is &amp;gt;= 0.2 and &amp;lt;= 0.4&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: orange&amp;quot;&amp;gt;orange&amp;lt;/span&amp;gt;             value is &amp;gt; 0.4 and &amp;lt;= 0.6&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: HoneyDew&amp;quot;&amp;gt;light green&amp;lt;/span&amp;gt;       value is &amp;gt; 0.6 and &amp;lt;= 0.8&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: Chartreuse&amp;quot;&amp;gt;green&amp;lt;/span&amp;gt;               value is &amp;gt; 0.8&lt;br /&gt;
&lt;br /&gt;
The instructor can choose to show results from Hamer’s algorithm or Lauw’s algorithm. The default algorithm should be Lauw’s algorithm.&lt;br /&gt;
&lt;br /&gt;
=== Objectives ===&lt;br /&gt;
&lt;br /&gt;
Our objectives for this project are the following:&lt;br /&gt;
* Double and stub an assignment, a few submissions to the assignment, under different review rubrics&lt;br /&gt;
* Manually calculate reputation scores based on paper &amp;quot;Pluggable reputation systems for peer review: A web-service approach&amp;quot;&lt;br /&gt;
* Validate correct reputation scores based on different review rubrics generated by reputation management VS manual computation of reputation score expectation on different reputation range of Hamer's and Lauw's algorithm with or without instructor score impact.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
*reputation_web_service_controller_spec&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
=== Setup Testing Objects ===&lt;br /&gt;
In order to implement testing on reputation, it is crucial to create sample reviews so that we could possibly obtain reputation score. During the kickoff meeting, our team defined four necessary steps to follow for the purpose of testing. Also, appropriate objects could be created and confined as discussed below.&lt;br /&gt;
&lt;br /&gt;
==== Assignment ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[assignments]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Essential Parameters to be configured&amp;lt;br&amp;gt;&lt;br /&gt;
submitter_count = 0;&amp;lt;br&amp;gt;&lt;br /&gt;
num_reviews = 5;&amp;lt;br&amp;gt;&lt;br /&gt;
num_reviewers = 5;&amp;lt;br&amp;gt;&lt;br /&gt;
num_reviews_allowed = 5;&amp;lt;br&amp;gt;&lt;br /&gt;
rounds_of_reviews = 2;&amp;lt;br&amp;gt;&lt;br /&gt;
reputation_algorithm = lauw/hamer;&amp;lt;br&amp;gt;&lt;br /&gt;
Note: Two assignment objects were created. Assignment_1 used lauw's algorithm, whereas assignment_2 used hamer's alogorithm.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @assignment_1 = create(:assignment, created_at: DateTime.now.in_time_zone - 13.day, submitter_count: 0, num_reviews: 3, num_reviewers: 5, num_reviews_allowed: 5, rounds_of_reviews: 2, reputation_algorithm: 'lauw', id: 1)&lt;br /&gt;
  @assignment_2 = create(:assignment, created_at: DateTime.now.in_time_zone - 13.day, submitter_count: 0, num_reviews: 3, num_reviewers: 5, num_reviews_allowed: 5, rounds_of_reviews: 2, reputation_algorithm: 'hamer', id: 2)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Questionnaires(Rubrics) ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[questionnaires]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[assignment_questionnaires]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Essential Parameters to be configured&amp;lt;br&amp;gt;&lt;br /&gt;
instructor_id = from_fixture;&amp;lt;br&amp;gt;&lt;br /&gt;
min_question_score = 0;&amp;lt;br&amp;gt;&lt;br /&gt;
max_question_score = 5;&amp;lt;br&amp;gt;&lt;br /&gt;
type = ReviewQuestionnaire;&amp;lt;br&amp;gt;&lt;br /&gt;
Note: We will define the assignment with ReviewQuestionnaire type rubric. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @questionnaire_1 = create(:questionnaire, min_question_score: 0, max_question_score: 5, type: 'ReviewQuestionnaire', id: 1)&lt;br /&gt;
  @assignment_questionnaire_1_1 = create(:assignment_questionnaire, assignment_id: @assignment_1.id, questionnaire_id: @questionnaire_1.id, used_in_round: 1)&lt;br /&gt;
  @assignment_questionnaire_1_2 = create(:assignment_questionnaire, assignment_id: @assignment_1.id, questionnaire_id: @questionnaire_1.id, used_in_round: 2)&lt;br /&gt;
  @assignment_questionnaire_2_1 = create(:assignment_questionnaire, assignment_id: @assignment_2.id, questionnaire_id: @questionnaire_1.id, used_in_round: 1)&lt;br /&gt;
  @assignment_questionnaire_2_2 = create(:assignment_questionnaire, assignment_id: @assignment_2.id, questionnaire_id: @questionnaire_1.id, used_in_round: 2, id: 4)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Questions under Questionnaires ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[questions]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @question_1_1 = create(:question, questionnaire_id: @questionnaire_1.id, id: 1)&lt;br /&gt;
  @question_1_2 = create(:question, questionnaire_id: @questionnaire_1.id, id: 2)&lt;br /&gt;
  @question_1_3 = create(:question, questionnaire_id: @questionnaire_1.id, id: 3)&lt;br /&gt;
  @question_1_4 = create(:question, questionnaire_id: @questionnaire_1.id, id: 4)&lt;br /&gt;
  @question_1_5 = create(:question, questionnaire_id: @questionnaire_1.id, id: 5)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Reviewers and Reviewees ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[participants]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[teams]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
Reviewers (Participant):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @reviewer_1 = create(:participant, can_review: 1)&lt;br /&gt;
  @reviewer_2 = create(:participant, can_review: 1)&lt;br /&gt;
  @reviewer_3 = create(:participant, can_review: 1)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Reviewees (Teams):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @reviewee_1 = create(:assignment_team, assignment: @assignment)&lt;br /&gt;
  @reviewee_2 = create(:assignment_team, assignment: @assignment)&lt;br /&gt;
  @reviewee_3 = create(:assignment_team, assignment: @assignment)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Responses ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[response_maps]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[responses]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Essential Parameters to be configured&amp;lt;br&amp;gt;&lt;br /&gt;
reviewed_object_id = assignment_id;&amp;lt;br&amp;gt;&lt;br /&gt;
reviewer_id = participants;&amp;lt;br&amp;gt;&lt;br /&gt;
reviewee_id = AssignmentTeam;&amp;lt;br&amp;gt;&lt;br /&gt;
Note: we will setup response map to determine relationship between reviewer and reviewee of an assignment.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
Response_maps:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @response_map_1_1 = create(:review_response_map, reviewer_id: @reviewer_1.id, reviewee_id: @reviewee_1.id)&lt;br /&gt;
  @response_map_1_2 = create(:review_response_map, reviewer_id: @reviewer_2.id, reviewee_id: @reviewee_1.id)&lt;br /&gt;
  @response_map_1_3 = create(:review_response_map, reviewer_id: @reviewer_3.id, reviewee_id: @reviewee_1.id)&lt;br /&gt;
&lt;br /&gt;
  @response_map_2_1 = create(:review_response_map, reviewer_id: @reviewer_1.id, reviewee_id: @reviewee_2.id)&lt;br /&gt;
  @response_map_2_2 = create(:review_response_map, reviewer_id: @reviewer_2.id, reviewee_id: @reviewee_2.id)&lt;br /&gt;
  @response_map_2_3 = create(:review_response_map, reviewer_id: @reviewer_3.id, reviewee_id: @reviewee_2.id)&lt;br /&gt;
&lt;br /&gt;
  @response_map_3_1 = create(:review_response_map, reviewer_id: @reviewer_1.id, reviewee_id: @reviewee_3.id)&lt;br /&gt;
  @response_map_3_2 = create(:review_response_map, reviewer_id: @reviewer_2.id, reviewee_id: @reviewee_3.id)&lt;br /&gt;
  @response_map_3_3 = create(:review_response_map, reviewer_id: @reviewer_3.id, reviewee_id: @reviewee_3.id)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Responses:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @response_1_1 = create(:response, is_submitted: true, map_id: @response_map_1_1.id)&lt;br /&gt;
  @response_1_2 = create(:response, is_submitted: true, map_id: @response_map_1_2.id)&lt;br /&gt;
  @response_1_3 = create(:response, is_submitted: true, map_id: @response_map_1_3.id)&lt;br /&gt;
&lt;br /&gt;
  @response_2_1 = create(:response, is_submitted: true, map_id: @response_map_2_1.id)&lt;br /&gt;
  @response_2_2 = create(:response, is_submitted: true, map_id: @response_map_2_2.id)&lt;br /&gt;
  @response_2_3 = create(:response, is_submitted: true, map_id: @response_map_2_3.id)&lt;br /&gt;
&lt;br /&gt;
  @response_3_1 = create(:response, is_submitted: true, map_id: @response_map_3_1.id)&lt;br /&gt;
  @response_3_2 = create(:response, is_submitted: true, map_id: @response_map_3_2.id)&lt;br /&gt;
  @response_3_3 = create(:response, is_submitted: true, map_id: @response_map_3_3.id)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The manifestation of each object will contribute to the success of the following test on reputations. Some fields in each object can be empty or have default values. Some attributes are not relevant to the test. When implementing the test, the test scripts need to generate or set fixed values for corresponding fields.&lt;br /&gt;
&lt;br /&gt;
=== Relevant Methods ===&lt;br /&gt;
==== db_query ====&lt;br /&gt;
This is the normal db query method, call this method will return peer review grades with given assignment id.&lt;br /&gt;
We will test this method in two aspect. &lt;br /&gt;
1. Test whether or not the grade return is right based on the specified algorithm.&lt;br /&gt;
2. We need to test the correctness of the query.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context 'test db_query' do&lt;br /&gt;
    it 'return average score' do&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_1.id, answer: 1)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_1.id, answer: 2)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_1.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_1.id, answer: 4)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      result = ReputationWebServiceController.new.db_query(1, 1, false)&lt;br /&gt;
      expect(result).to eq([[2, 1, 60.0]])&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== json_generator ====&lt;br /&gt;
This method will generate the hash format of the review, we will test this method by calling to and convert the result to json format the print to test its correctness.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context 'test json_generator' do&lt;br /&gt;
    it 'test 3 reviewer for one reviewee' do&lt;br /&gt;
      # reivewer_1's review for reviewee_1: [5, 5, 5, 5, 5]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
&lt;br /&gt;
      # reivewer_2's review for reviewee_1: [3, 3, 3, 3, 3]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
&lt;br /&gt;
      # reivewer_3's review for reviewee_1: [1, 1, 1, 1, 1]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
&lt;br /&gt;
      #result = ReputationWebServiceController.new.db_query(1, 1, false)&lt;br /&gt;
      #expect(result).to eq([[2, 1, 100.0], [3, 1, 60.0], [4, 1, 20.0]])&lt;br /&gt;
      result = ReputationWebServiceController.new.json_generator(1, 0, 1)&lt;br /&gt;
      expect(result).to eq({&amp;quot;submission1&amp;quot;=&amp;gt;{&amp;quot;stu2&amp;quot;=&amp;gt;100.0, &amp;quot;stu3&amp;quot;=&amp;gt;60.0, &amp;quot;stu4&amp;quot;=&amp;gt;20.0}})&lt;br /&gt;
      #repeat for different answers&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'test same reviewer for different reviewee' do&lt;br /&gt;
      # reivewer_1's review for reviewee_1: [5, 5, 5, 5, 5]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
&lt;br /&gt;
      # reivewer_1's review for reviewee_2: [3, 3, 3, 3, 3]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
&lt;br /&gt;
      result = ReputationWebServiceController.new.json_generator(1, 0, 1)&lt;br /&gt;
      expect(result).to eq(&amp;quot;submission1&amp;quot;=&amp;gt;{&amp;quot;stu2&amp;quot;=&amp;gt;100.0}, &amp;quot;submission2&amp;quot;=&amp;gt;{&amp;quot;stu2&amp;quot;=&amp;gt;60.0})&lt;br /&gt;
      #repeat for different answers&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== send_post_request ==== &lt;br /&gt;
This method send a post request to peerlogic.csc.ncsu.edu/reputation/calculations/reputation_algorithms to calculate get the reputation result and use show the result &lt;br /&gt;
in corresponding UI and update given reviewer's reputation. We will test this method based on the algorithm in the paper, first to test the result reputation value, second to test the&lt;br /&gt;
update value in database.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context 'test send_post_request' do&lt;br /&gt;
    it 'failed because of no public key file' do&lt;br /&gt;
      # reivewer_1's review for reviewee_1: [5, 5, 5, 5, 5]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
&lt;br /&gt;
      params = {assignment_id: 1, round_num: 1, algorithm: 'hammer', checkbox: {expert_grade: &amp;quot;empty&amp;quot;}}&lt;br /&gt;
      session = {user: build(:instructor, id: 1)}&lt;br /&gt;
&lt;br /&gt;
      expect(true).to eq(true)&lt;br /&gt;
&lt;br /&gt;
      # comment out because send_post_request method request public key file while this file is missing&lt;br /&gt;
      # so at this time send_post_request is not functioning normally&lt;br /&gt;
      # get :send_post_request, params, session&lt;br /&gt;
      # expect(response).to redirect_to '/reputation_web_service/client'&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
&lt;br /&gt;
=== Future Tasks ===&lt;br /&gt;
As our team could not obtain the public/private key pair to access the reputation web service, we were only able get to the step prior to sending the JSON to the web service of reputation algorithms. Therefore, future steps are required to test on reputation system. &lt;br /&gt;
&lt;br /&gt;
# There is a lot of unused/commented code, which should be removed.&lt;br /&gt;
# Figure out what the code is doing and write appropriate comments for it.&lt;br /&gt;
# In the case of db_query, the name should say what it queries for. Also, this method not only queries, but calculates sums.  Since each method should do only one thing, the code for calculating sums should be in another method. And there should be comments in the code!&lt;br /&gt;
#json_generator should be generate_json. There needs to be a method comment saying what the parameters are.&lt;br /&gt;
# In  send_post_request, there are references to specific assignments, such as 724, 735, and 756. They were put in to gather data for a paper published in 2015. They are no longer relevant and should be removed. send_post_request is 91 lines long, far too long.&lt;br /&gt;
#There is a password for a private key in the code (and the code is open-sourced!) It should be in the db instead.&lt;br /&gt;
#Fix spelling of “dimention”&lt;br /&gt;
#client is a bad method name; why is stuff being copied from class variables to instance variables?&lt;br /&gt;
&lt;br /&gt;
=== Collaborators ===&lt;br /&gt;
Jinku Cui (jcui23)&lt;br /&gt;
&lt;br /&gt;
Henry Chen (hchen34)&lt;br /&gt;
&lt;br /&gt;
Dong Li (dli35)&lt;br /&gt;
&lt;br /&gt;
Zijun Lu (zlu5)&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[https://doi.org/10.1109/FIE.2015.7344292 Pluggable reputation systems for peer review: A web-service approach]&lt;/div&gt;</summary>
		<author><name>Hchen34</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2168._Testing_-_Reputations&amp;diff=141954</id>
		<title>CSC/ECE 517 Fall 2021 - E2168. Testing - Reputations</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2168._Testing_-_Reputations&amp;diff=141954"/>
		<updated>2021-11-29T21:33:08Z</updated>

		<summary type="html">&lt;p&gt;Hchen34: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Project Overview ==&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;q&amp;gt;Online peer-review systems are now in common use in higher education. They free the instructor and course staff from having to provide personally all the feedback that students receive on their work. However, if we want to assure that all students receive competent feedback, or even use peer-assigned grades, we need a way to judge which peer reviewers are most credible. The solution is to use a reputation system.&amp;lt;/q&amp;gt; &amp;lt;br&amp;gt; The reputation system is meant to provide objective value to student assigned peer review scores. Students select from a list of tasks to be performed and then prepare their work and submit it to a peer-review system. The work is then reviewed by other students who offer comments/graded feedback to help the submitters improve their work.&lt;br /&gt;
During the peer review period it is important to determine which reviews are more accurate and show higher quality. Reputation is one way to achieve this goal; it is a quantization measurement to judge which peer reviewers are more reliable.&lt;br /&gt;
Peer reviewers can use expertiza to score an author. If Expertiza shows a confidence ratings for grades based upon the reviewers reputation then authors can more easily determine the legitimacy of the peer assigned score. In addition, the teaching staff can examine the quality of each peer review based on reputation values and, potentially, crowd-source a significant portion of the grading function.&lt;br /&gt;
Currently the reputation system is implemented in Expertiza through web-service, but there's no test written for it. Thus our goal is to write tests to verify Hamer's and Lauw’s algorithm from the reputation system.&lt;br /&gt;
&lt;br /&gt;
=== System Design ===&lt;br /&gt;
The below is referenced from project E1625, which would give us the overall description of the reputation system.&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Diagram E1625.png|1000px]]&amp;lt;br&amp;gt;&lt;br /&gt;
There are two algorithms intended for use in calculation of the reputation values for participants. &lt;br /&gt;
&lt;br /&gt;
There is a [https://expertiza.ncsu.edu/reputation_web_service/client web-service] (the link accessible only to the instructors) available which serves a JSON response containing the reputation value based on the seed provided in the form of the last known reputation value which we store in the ''participants'' table. An instructor can specify which algorithm to use for a particular assignment to calculate the confidence rating. &lt;br /&gt;
&lt;br /&gt;
As the [https://docs.google.com/viewer?url=https%3A%2F%2Fwww.researchgate.net%2Fprofile%2FYang_Song36%2Fpublication%2F289528736_Pluggable_Reputation_Systems_for_Peer_Review_a_Web-Service_Approach%2Flinks%2F568ec8d008ae78cc05160aed.pdf%3FinViewer%3D0%26pdfJsDownload%3D0%26origin%3Dpublication_detail paper] on reputation system by observes, “the Hamer-peer algorithm has the lowest maximum absolute bias and the Lauw-peer algorithm has the lowest overall bias.This indicates, from the instructor’s perspective, if there are further assignments of this kind, expert grading may not be necessary.”&lt;br /&gt;
:;Reputation range of Hamer’s algorithm is :&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: red;&amp;quot;&amp;gt;red&amp;lt;/span&amp;gt;                   value &amp;lt; 0.5&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: yellow&amp;quot;&amp;gt;yellow&amp;lt;/span&amp;gt;              value is &amp;gt;= 0.5 and &amp;lt;= 1&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: orange&amp;quot;&amp;gt;orange&amp;lt;/span&amp;gt;             value is &amp;gt; 1 and &amp;lt;= 1.5&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: HoneyDew&amp;quot;&amp;gt;light green&amp;lt;/span&amp;gt;       value is &amp;gt; 1.5 and &amp;lt;= 2&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: Chartreuse&amp;quot;&amp;gt;green&amp;lt;/span&amp;gt;               value is &amp;gt; 2&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The main difference between the Hamer-peer and the Lauw-peer algorithm is that the Lauw-peer algorithm keeps track of the reviewer's leniency (“bias”), which can be either positive or negative. A positive leniency indicates the reviewer tends to give higher scores than average.  This project determines reputation by subtracting the absolute value of the leniency from 1. Additionally, the range for Hamer’s algorithm is (0,∞) while for Lauw’s algorithm it is [0,1]. &lt;br /&gt;
:;Reputation range of Lauw’s algorithm is&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: red&amp;quot;&amp;gt;red&amp;lt;/span&amp;gt;                   value is &amp;lt; 0.2&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: yellow&amp;quot;&amp;gt;yellow&amp;lt;/span&amp;gt;              value is &amp;gt;= 0.2 and &amp;lt;= 0.4&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: orange&amp;quot;&amp;gt;orange&amp;lt;/span&amp;gt;             value is &amp;gt; 0.4 and &amp;lt;= 0.6&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: HoneyDew&amp;quot;&amp;gt;light green&amp;lt;/span&amp;gt;       value is &amp;gt; 0.6 and &amp;lt;= 0.8&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: Chartreuse&amp;quot;&amp;gt;green&amp;lt;/span&amp;gt;               value is &amp;gt; 0.8&lt;br /&gt;
&lt;br /&gt;
The instructor can choose to show results from Hamer’s algorithm or Lauw’s algorithm. The default algorithm should be Lauw’s algorithm.&lt;br /&gt;
&lt;br /&gt;
=== Objectives ===&lt;br /&gt;
&lt;br /&gt;
Our objectives for this project are the following:&lt;br /&gt;
* Double and stub an assignment, a few submissions to the assignment, under different review rubrics&lt;br /&gt;
* Manually calculate reputation scores based on paper &amp;quot;Pluggable reputation systems for peer review: A web-service approach&amp;quot;&lt;br /&gt;
* Validate correct reputation scores based on different review rubrics generated by reputation management VS manual computation of reputation score expectation on different reputation range of Hamer's and Lauw's algorithm with or without instructor score impact.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
*reputation_web_service_controller_spec&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
=== Setup Testing Objects ===&lt;br /&gt;
In order to implement testing on reputation, it is crucial to create sample reviews so that we could possibly obtain reputation score. During the kickoff meeting, our team defined four necessary steps to follow for the purpose of testing. Also, appropriate objects could be created and confined as discussed below.&lt;br /&gt;
&lt;br /&gt;
==== Assignment ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[assignments]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Essential Parameters to be configured&amp;lt;br&amp;gt;&lt;br /&gt;
submitter_count = 0;&amp;lt;br&amp;gt;&lt;br /&gt;
num_reviews = 5;&amp;lt;br&amp;gt;&lt;br /&gt;
num_reviewers = 5;&amp;lt;br&amp;gt;&lt;br /&gt;
num_reviews_allowed = 5;&amp;lt;br&amp;gt;&lt;br /&gt;
rounds_of_reviews = 2;&amp;lt;br&amp;gt;&lt;br /&gt;
reputation_algorithm = lauw/hamer;&amp;lt;br&amp;gt;&lt;br /&gt;
Note: Two assignment objects were created. Assignment_1 used lauw's algorithm, whereas assignment_2 used hamer's alogorithm.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @assignment_1 = create(:assignment, created_at: DateTime.now.in_time_zone - 13.day, submitter_count: 0, num_reviews: 3, num_reviewers: 5, num_reviews_allowed: 5, rounds_of_reviews: 2, reputation_algorithm: 'lauw', id: 1)&lt;br /&gt;
  @assignment_2 = create(:assignment, created_at: DateTime.now.in_time_zone - 13.day, submitter_count: 0, num_reviews: 3, num_reviewers: 5, num_reviews_allowed: 5, rounds_of_reviews: 2, reputation_algorithm: 'hamer', id: 2)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Questionnaires(Rubrics) ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[questionnaires]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[assignment_questionnaires]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Essential Parameters to be configured&amp;lt;br&amp;gt;&lt;br /&gt;
instructor_id = from_fixture;&amp;lt;br&amp;gt;&lt;br /&gt;
min_question_score = 0;&amp;lt;br&amp;gt;&lt;br /&gt;
max_question_score = 5;&amp;lt;br&amp;gt;&lt;br /&gt;
type = ReviewQuestionnaire;&amp;lt;br&amp;gt;&lt;br /&gt;
Note: We will define the assignment with ReviewQuestionnaire type rubric. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @questionnaire_1 = create(:questionnaire, min_question_score: 0, max_question_score: 5, type: 'ReviewQuestionnaire', id: 1)&lt;br /&gt;
  @assignment_questionnaire_1_1 = create(:assignment_questionnaire, assignment_id: @assignment_1.id, questionnaire_id: @questionnaire_1.id, used_in_round: 1)&lt;br /&gt;
  @assignment_questionnaire_1_2 = create(:assignment_questionnaire, assignment_id: @assignment_1.id, questionnaire_id: @questionnaire_1.id, used_in_round: 2)&lt;br /&gt;
  @assignment_questionnaire_2_1 = create(:assignment_questionnaire, assignment_id: @assignment_2.id, questionnaire_id: @questionnaire_1.id, used_in_round: 1)&lt;br /&gt;
  @assignment_questionnaire_2_2 = create(:assignment_questionnaire, assignment_id: @assignment_2.id, questionnaire_id: @questionnaire_1.id, used_in_round: 2, id: 4)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Questions under Questionnaires ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[questions]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @question_1_1 = create(:question, questionnaire_id: @questionnaire_1.id, id: 1)&lt;br /&gt;
  @question_1_2 = create(:question, questionnaire_id: @questionnaire_1.id, id: 2)&lt;br /&gt;
  @question_1_3 = create(:question, questionnaire_id: @questionnaire_1.id, id: 3)&lt;br /&gt;
  @question_1_4 = create(:question, questionnaire_id: @questionnaire_1.id, id: 4)&lt;br /&gt;
  @question_1_5 = create(:question, questionnaire_id: @questionnaire_1.id, id: 5)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Reviewers and Reviewees ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[participants]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[teams]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
Reviewers (Participant):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @reviewer_1 = create(:participant, can_review: 1)&lt;br /&gt;
  @reviewer_2 = create(:participant, can_review: 1)&lt;br /&gt;
  @reviewer_3 = create(:participant, can_review: 1)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Reviewees (Teams):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @reviewee_1 = create(:assignment_team, assignment: @assignment)&lt;br /&gt;
  @reviewee_2 = create(:assignment_team, assignment: @assignment)&lt;br /&gt;
  @reviewee_3 = create(:assignment_team, assignment: @assignment)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Responses ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[response_maps]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[responses]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Essential Parameters to be configured&amp;lt;br&amp;gt;&lt;br /&gt;
reviewed_object_id = assignment_id;&amp;lt;br&amp;gt;&lt;br /&gt;
reviewer_id = participants;&amp;lt;br&amp;gt;&lt;br /&gt;
reviewee_id = AssignmentTeam;&amp;lt;br&amp;gt;&lt;br /&gt;
Note: we will setup response map to determine relationship between reviewer and reviewee of an assignment.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
Response_maps:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @response_map_1_1 = create(:review_response_map, reviewer_id: @reviewer_1.id, reviewee_id: @reviewee_1.id)&lt;br /&gt;
  @response_map_1_2 = create(:review_response_map, reviewer_id: @reviewer_2.id, reviewee_id: @reviewee_1.id)&lt;br /&gt;
  @response_map_1_3 = create(:review_response_map, reviewer_id: @reviewer_3.id, reviewee_id: @reviewee_1.id)&lt;br /&gt;
&lt;br /&gt;
  @response_map_2_1 = create(:review_response_map, reviewer_id: @reviewer_1.id, reviewee_id: @reviewee_2.id)&lt;br /&gt;
  @response_map_2_2 = create(:review_response_map, reviewer_id: @reviewer_2.id, reviewee_id: @reviewee_2.id)&lt;br /&gt;
  @response_map_2_3 = create(:review_response_map, reviewer_id: @reviewer_3.id, reviewee_id: @reviewee_2.id)&lt;br /&gt;
&lt;br /&gt;
  @response_map_3_1 = create(:review_response_map, reviewer_id: @reviewer_1.id, reviewee_id: @reviewee_3.id)&lt;br /&gt;
  @response_map_3_2 = create(:review_response_map, reviewer_id: @reviewer_2.id, reviewee_id: @reviewee_3.id)&lt;br /&gt;
  @response_map_3_3 = create(:review_response_map, reviewer_id: @reviewer_3.id, reviewee_id: @reviewee_3.id)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Responses:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @response_1_1 = create(:response, is_submitted: true, map_id: @response_map_1_1.id)&lt;br /&gt;
  @response_1_2 = create(:response, is_submitted: true, map_id: @response_map_1_2.id)&lt;br /&gt;
  @response_1_3 = create(:response, is_submitted: true, map_id: @response_map_1_3.id)&lt;br /&gt;
&lt;br /&gt;
  @response_2_1 = create(:response, is_submitted: true, map_id: @response_map_2_1.id)&lt;br /&gt;
  @response_2_2 = create(:response, is_submitted: true, map_id: @response_map_2_2.id)&lt;br /&gt;
  @response_2_3 = create(:response, is_submitted: true, map_id: @response_map_2_3.id)&lt;br /&gt;
&lt;br /&gt;
  @response_3_1 = create(:response, is_submitted: true, map_id: @response_map_3_1.id)&lt;br /&gt;
  @response_3_2 = create(:response, is_submitted: true, map_id: @response_map_3_2.id)&lt;br /&gt;
  @response_3_3 = create(:response, is_submitted: true, map_id: @response_map_3_3.id)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The manifestation of each object will contribute to the success of the following test on reputations. Some fields in each object can be empty or have default values. Some attributes are not relevant to the test. When implementing the test, the test scripts need to generate or set fixed values for corresponding fields.&lt;br /&gt;
&lt;br /&gt;
=== Relevant Methods ===&lt;br /&gt;
==== db_query ====&lt;br /&gt;
This is the normal db query method, call this method will return peer review grades with given assignment id.&lt;br /&gt;
We will test this method in two aspect. &lt;br /&gt;
1. Test whether or not the grade return is right based on the specified algorithm.&lt;br /&gt;
2. We need to test the correctness of the query.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context 'test db_query' do&lt;br /&gt;
    it 'return average score' do&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_1.id, answer: 1)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_1.id, answer: 2)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_1.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_1.id, answer: 4)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      result = ReputationWebServiceController.new.db_query(1, 1, false)&lt;br /&gt;
      expect(result).to eq([[2, 1, 60.0]])&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== json_generator ====&lt;br /&gt;
This method will generate the hash format of the review, we will test this method by calling to and convert the result to json format the print to test its correctness.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context 'test json_generator' do&lt;br /&gt;
    it 'test 3 reviewer for one reviewee' do&lt;br /&gt;
      # reivewer_1's review for reviewee_1: [5, 5, 5, 5, 5]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
&lt;br /&gt;
      # reivewer_2's review for reviewee_1: [3, 3, 3, 3, 3]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
&lt;br /&gt;
      # reivewer_3's review for reviewee_1: [1, 1, 1, 1, 1]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
&lt;br /&gt;
      #result = ReputationWebServiceController.new.db_query(1, 1, false)&lt;br /&gt;
      #expect(result).to eq([[2, 1, 100.0], [3, 1, 60.0], [4, 1, 20.0]])&lt;br /&gt;
      result = ReputationWebServiceController.new.json_generator(1, 0, 1)&lt;br /&gt;
      expect(result).to eq({&amp;quot;submission1&amp;quot;=&amp;gt;{&amp;quot;stu2&amp;quot;=&amp;gt;100.0, &amp;quot;stu3&amp;quot;=&amp;gt;60.0, &amp;quot;stu4&amp;quot;=&amp;gt;20.0}})&lt;br /&gt;
      #repeat for different answers&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'test same reviewer for different reviewee' do&lt;br /&gt;
      # reivewer_1's review for reviewee_1: [5, 5, 5, 5, 5]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
&lt;br /&gt;
      # reivewer_1's review for reviewee_2: [3, 3, 3, 3, 3]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
&lt;br /&gt;
      result = ReputationWebServiceController.new.json_generator(1, 0, 1)&lt;br /&gt;
      expect(result).to eq(&amp;quot;submission1&amp;quot;=&amp;gt;{&amp;quot;stu2&amp;quot;=&amp;gt;100.0}, &amp;quot;submission2&amp;quot;=&amp;gt;{&amp;quot;stu2&amp;quot;=&amp;gt;60.0})&lt;br /&gt;
      #repeat for different answers&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== send_post_request ==== &lt;br /&gt;
This method send a post request to peerlogic.csc.ncsu.edu/reputation/calculations/reputation_algorithms to calculate get the reputation result and use show the result &lt;br /&gt;
in corresponding UI and update given reviewer's reputation. We will test this method based on the algorithm in the paper, first to test the result reputation value, second to test the&lt;br /&gt;
update value in database.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context 'test send_post_request' do&lt;br /&gt;
    it 'failed because of no public key file' do&lt;br /&gt;
      # reivewer_1's review for reviewee_1: [5, 5, 5, 5, 5]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
&lt;br /&gt;
      params = {assignment_id: 1, round_num: 1, algorithm: 'hammer', checkbox: {expert_grade: &amp;quot;empty&amp;quot;}}&lt;br /&gt;
      session = {user: build(:instructor, id: 1)}&lt;br /&gt;
&lt;br /&gt;
      expect(true).to eq(true)&lt;br /&gt;
&lt;br /&gt;
      # comment out because send_post_request method request public key file while this file is missing&lt;br /&gt;
      # so at this time send_post_request is not functioning normally&lt;br /&gt;
      # get :send_post_request, params, session&lt;br /&gt;
      # expect(response).to redirect_to '/reputation_web_service/client'&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
&lt;br /&gt;
=== Future Tasks ===&lt;br /&gt;
As our team could not obtain the public/private key pair to access the reputation web service, we were only able get to the step prior to sending the JSON to the web service of reputation algorithms. Therefore, future steps are required to test on reputation system. &lt;br /&gt;
&lt;br /&gt;
# There is a lot of unused/commented code, which should be removed.&lt;br /&gt;
# Figure out what the code is doing and write appropriate comments for it.&lt;br /&gt;
# In the case of db_query, the name should say what it queries for. Also, this method not only queries, but calculates sums.  Since each method should do only one thing, the code for calculating sums should be in another method. And there should be comments in the code!&lt;br /&gt;
#json_generator should be generate_json. There needs to be a method comment saying what the parameters are.&lt;br /&gt;
# In  send_post_request, there are references to specific assignments, such as 724, 735, and 756. They were put in to gather data for a paper published in 2015. They are no longer relevant and should be removed. send_post_request is 91 lines long, far too long.&lt;br /&gt;
#There is a password for a private key in the code (and the code is open-sourced!) It should be in the db instead.&lt;br /&gt;
#Fix spelling of “dimention”&lt;br /&gt;
#client is a bad method name; why is stuff being copied from class variables to instance variables?&lt;br /&gt;
&lt;br /&gt;
=== Collaborators ===&lt;br /&gt;
Jinku Cui (jcui23)&lt;br /&gt;
&lt;br /&gt;
Henry Chen (hchen34)&lt;br /&gt;
&lt;br /&gt;
Dong Li (dli35)&lt;br /&gt;
&lt;br /&gt;
Zijun Lu (zlu5)&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[https://doi.org/10.1109/FIE.2015.7344292 Pluggable reputation systems for peer review: A web-service approach]&lt;/div&gt;</summary>
		<author><name>Hchen34</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2168._Testing_-_Reputations&amp;diff=141953</id>
		<title>CSC/ECE 517 Fall 2021 - E2168. Testing - Reputations</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2168._Testing_-_Reputations&amp;diff=141953"/>
		<updated>2021-11-29T21:32:25Z</updated>

		<summary type="html">&lt;p&gt;Hchen34: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Project Overview ==&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;q&amp;gt;Online peer-review systems are now in common use in higher education. They free the instructor and course staff from having to provide personally all the feedback that students receive on their work. However, if we want to assure that all students receive competent feedback, or even use peer-assigned grades, we need a way to judge which peer reviewers are most credible. The solution is to use a reputation system.&amp;lt;/q&amp;gt; &amp;lt;br&amp;gt; The reputation system is meant to provide objective value to student assigned peer review scores. Students select from a list of tasks to be performed and then prepare their work and submit it to a peer-review system. The work is then reviewed by other students who offer comments/graded feedback to help the submitters improve their work.&lt;br /&gt;
During the peer review period it is important to determine which reviews are more accurate and show higher quality. Reputation is one way to achieve this goal; it is a quantization measurement to judge which peer reviewers are more reliable.&lt;br /&gt;
Peer reviewers can use expertiza to score an author. If Expertiza shows a confidence ratings for grades based upon the reviewers reputation then authors can more easily determine the legitimacy of the peer assigned score. In addition, the teaching staff can examine the quality of each peer review based on reputation values and, potentially, crowd-source a significant portion of the grading function.&lt;br /&gt;
Currently the reputation system is implemented in Expertiza through web-service, but there's no test written for it. Thus our goal is to write tests to verify Hamer's and Lauw’s algorithm from the reputation system.&lt;br /&gt;
&lt;br /&gt;
=== System Design ===&lt;br /&gt;
The below is referenced from project E1625, which would give us the overall description of the reputation system.&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Diagram E1625.png|1000px]]&amp;lt;br&amp;gt;&lt;br /&gt;
There are two algorithms intended for use in calculation of the reputation values for participants. &lt;br /&gt;
&lt;br /&gt;
There is a [https://expertiza.ncsu.edu/reputation_web_service/client web-service] (the link accessible only to the instructors) available which serves a JSON response containing the reputation value based on the seed provided in the form of the last known reputation value which we store in the ''participants'' table. An instructor can specify which algorithm to use for a particular assignment to calculate the confidence rating. &lt;br /&gt;
&lt;br /&gt;
As the [https://docs.google.com/viewer?url=https%3A%2F%2Fwww.researchgate.net%2Fprofile%2FYang_Song36%2Fpublication%2F289528736_Pluggable_Reputation_Systems_for_Peer_Review_a_Web-Service_Approach%2Flinks%2F568ec8d008ae78cc05160aed.pdf%3FinViewer%3D0%26pdfJsDownload%3D0%26origin%3Dpublication_detail paper] on reputation system by observes, “the Hamer-peer algorithm has the lowest maximum absolute bias and the Lauw-peer algorithm has the lowest overall bias.This indicates, from the instructor’s perspective, if there are further assignments of this kind, expert grading may not be necessary.”&lt;br /&gt;
:;Reputation range of Hamer’s algorithm is :&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: red;&amp;quot;&amp;gt;red&amp;lt;/span&amp;gt;                   value &amp;lt; 0.5&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: yellow&amp;quot;&amp;gt;yellow&amp;lt;/span&amp;gt;              value is &amp;gt;= 0.5 and &amp;lt;= 1&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: orange&amp;quot;&amp;gt;orange&amp;lt;/span&amp;gt;             value is &amp;gt; 1 and &amp;lt;= 1.5&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: HoneyDew&amp;quot;&amp;gt;light green&amp;lt;/span&amp;gt;       value is &amp;gt; 1.5 and &amp;lt;= 2&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: Chartreuse&amp;quot;&amp;gt;green&amp;lt;/span&amp;gt;               value is &amp;gt; 2&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The main difference between the Hamer-peer and the Lauw-peer algorithm is that the Lauw-peer algorithm keeps track of the reviewer's leniency (“bias”), which can be either positive or negative. A positive leniency indicates the reviewer tends to give higher scores than average.  This project determines reputation by subtracting the absolute value of the leniency from 1. Additionally, the range for Hamer’s algorithm is (0,∞) while for Lauw’s algorithm it is [0,1]. &lt;br /&gt;
:;Reputation range of Lauw’s algorithm is&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: red&amp;quot;&amp;gt;red&amp;lt;/span&amp;gt;                   value is &amp;lt; 0.2&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: yellow&amp;quot;&amp;gt;yellow&amp;lt;/span&amp;gt;              value is &amp;gt;= 0.2 and &amp;lt;= 0.4&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: orange&amp;quot;&amp;gt;orange&amp;lt;/span&amp;gt;             value is &amp;gt; 0.4 and &amp;lt;= 0.6&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: HoneyDew&amp;quot;&amp;gt;light green&amp;lt;/span&amp;gt;       value is &amp;gt; 0.6 and &amp;lt;= 0.8&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: Chartreuse&amp;quot;&amp;gt;green&amp;lt;/span&amp;gt;               value is &amp;gt; 0.8&lt;br /&gt;
&lt;br /&gt;
The instructor can choose to show results from Hamer’s algorithm or Lauw’s algorithm. The default algorithm should be Lauw’s algorithm.&lt;br /&gt;
&lt;br /&gt;
=== Objectives ===&lt;br /&gt;
&lt;br /&gt;
Our objectives for this project are the following:&lt;br /&gt;
* Double and stub an assignment, a few submissions to the assignment, under different review rubrics&lt;br /&gt;
* Manually calculate reputation scores based on paper &amp;quot;Pluggable reputation systems for peer review: A web-service approach&amp;quot;&lt;br /&gt;
* Validate correct reputation scores based on different review rubrics generated by reputation management VS manual computation of reputation score expectation on different reputation range of Hamer's and Lauw's algorithm with or without instructor score impact.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
*reputation_web_service_controller_spec&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
=== Setup Testing Objects ===&lt;br /&gt;
In order to implement testing on reputation, it is crucial to create sample reviews so that we could possibly obtain reputation score. During the kickoff meeting, our team defined four necessary steps to follow for the purpose of testing. Also, appropriate objects could be created and confined as discussed below.&lt;br /&gt;
&lt;br /&gt;
==== Assignment ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[assignments]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Essential Parameters to be configured&amp;lt;br&amp;gt;&lt;br /&gt;
submitter_count = 0;&amp;lt;br&amp;gt;&lt;br /&gt;
num_reviews = 5;&amp;lt;br&amp;gt;&lt;br /&gt;
num_reviewers = 5;&amp;lt;br&amp;gt;&lt;br /&gt;
num_reviews_allowed = 5;&amp;lt;br&amp;gt;&lt;br /&gt;
rounds_of_reviews = 2;&amp;lt;br&amp;gt;&lt;br /&gt;
reputation_algorithm = lauw/hamer;&amp;lt;br&amp;gt;&lt;br /&gt;
Note: Two assignment objects were created. Assignment_1 used lauw's algorithm, whereas assignment_2 used hamer's alogorithm.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @assignment_1 = create(:assignment, created_at: DateTime.now.in_time_zone - 13.day, submitter_count: 0, num_reviews: 3, num_reviewers: 5, num_reviews_allowed: 5, rounds_of_reviews: 2, reputation_algorithm: 'lauw', id: 1)&lt;br /&gt;
  @assignment_2 = create(:assignment, created_at: DateTime.now.in_time_zone - 13.day, submitter_count: 0, num_reviews: 3, num_reviewers: 5, num_reviews_allowed: 5, rounds_of_reviews: 2, reputation_algorithm: 'hamer', id: 2)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Questionnaires(Rubrics) ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[questionnaires]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[assignment_questionnaires]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Essential Parameters to be configured&amp;lt;br&amp;gt;&lt;br /&gt;
instructor_id = from_fixture;&amp;lt;br&amp;gt;&lt;br /&gt;
min_question_score = 0;&amp;lt;br&amp;gt;&lt;br /&gt;
max_question_score = 5;&amp;lt;br&amp;gt;&lt;br /&gt;
type = ReviewQuestionnaire;&amp;lt;br&amp;gt;&lt;br /&gt;
Note: We will define the assignment with ReviewQuestionnaire type rubric. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @questionnaire_1 = create(:questionnaire, min_question_score: 0, max_question_score: 5, type: 'ReviewQuestionnaire', id: 1)&lt;br /&gt;
  @assignment_questionnaire_1_1 = create(:assignment_questionnaire, assignment_id: @assignment_1.id, questionnaire_id: @questionnaire_1.id, used_in_round: 1)&lt;br /&gt;
  @assignment_questionnaire_1_2 = create(:assignment_questionnaire, assignment_id: @assignment_1.id, questionnaire_id: @questionnaire_1.id, used_in_round: 2)&lt;br /&gt;
  @assignment_questionnaire_2_1 = create(:assignment_questionnaire, assignment_id: @assignment_2.id, questionnaire_id: @questionnaire_1.id, used_in_round: 1)&lt;br /&gt;
  @assignment_questionnaire_2_2 = create(:assignment_questionnaire, assignment_id: @assignment_2.id, questionnaire_id: @questionnaire_1.id, used_in_round: 2, id: 4)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Questions under Questionnaires ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[questions]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @question_1_1 = create(:question, questionnaire_id: @questionnaire_1.id, id: 1)&lt;br /&gt;
  @question_1_2 = create(:question, questionnaire_id: @questionnaire_1.id, id: 2)&lt;br /&gt;
  @question_1_3 = create(:question, questionnaire_id: @questionnaire_1.id, id: 3)&lt;br /&gt;
  @question_1_4 = create(:question, questionnaire_id: @questionnaire_1.id, id: 4)&lt;br /&gt;
  @question_1_5 = create(:question, questionnaire_id: @questionnaire_1.id, id: 5)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Reviewers and Reviewees ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[participants]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[teams]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
Reviewers (Participant):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @reviewer_1 = create(:participant, can_review: 1)&lt;br /&gt;
  @reviewer_2 = create(:participant, can_review: 1)&lt;br /&gt;
  @reviewer_3 = create(:participant, can_review: 1)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Reviewees (Teams):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @reviewee_1 = create(:assignment_team, assignment: @assignment)&lt;br /&gt;
  @reviewee_2 = create(:assignment_team, assignment: @assignment)&lt;br /&gt;
  @reviewee_3 = create(:assignment_team, assignment: @assignment)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Responses ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[response_maps]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[responses]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Essential Parameters to be configured&amp;lt;br&amp;gt;&lt;br /&gt;
reviewed_object_id = assignment_id;&amp;lt;br&amp;gt;&lt;br /&gt;
reviewer_id = participants;&amp;lt;br&amp;gt;&lt;br /&gt;
reviewee_id = AssignmentTeam;&amp;lt;br&amp;gt;&lt;br /&gt;
Note: we will setup response map to determine relationship between reviewer and reviewee of an assignment.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
Response_maps:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @response_map_1_1 = create(:review_response_map, reviewer_id: @reviewer_1.id, reviewee_id: @reviewee_1.id)&lt;br /&gt;
  @response_map_1_2 = create(:review_response_map, reviewer_id: @reviewer_2.id, reviewee_id: @reviewee_1.id)&lt;br /&gt;
  @response_map_1_3 = create(:review_response_map, reviewer_id: @reviewer_3.id, reviewee_id: @reviewee_1.id)&lt;br /&gt;
&lt;br /&gt;
  @response_map_2_1 = create(:review_response_map, reviewer_id: @reviewer_1.id, reviewee_id: @reviewee_2.id)&lt;br /&gt;
  @response_map_2_2 = create(:review_response_map, reviewer_id: @reviewer_2.id, reviewee_id: @reviewee_2.id)&lt;br /&gt;
  @response_map_2_3 = create(:review_response_map, reviewer_id: @reviewer_3.id, reviewee_id: @reviewee_2.id)&lt;br /&gt;
&lt;br /&gt;
  @response_map_3_1 = create(:review_response_map, reviewer_id: @reviewer_1.id, reviewee_id: @reviewee_3.id)&lt;br /&gt;
  @response_map_3_2 = create(:review_response_map, reviewer_id: @reviewer_2.id, reviewee_id: @reviewee_3.id)&lt;br /&gt;
  @response_map_3_3 = create(:review_response_map, reviewer_id: @reviewer_3.id, reviewee_id: @reviewee_3.id)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Responses:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @response_1_1 = create(:response, is_submitted: true, map_id: @response_map_1_1.id)&lt;br /&gt;
  @response_1_2 = create(:response, is_submitted: true, map_id: @response_map_1_2.id)&lt;br /&gt;
  @response_1_3 = create(:response, is_submitted: true, map_id: @response_map_1_3.id)&lt;br /&gt;
&lt;br /&gt;
  @response_2_1 = create(:response, is_submitted: true, map_id: @response_map_2_1.id)&lt;br /&gt;
  @response_2_2 = create(:response, is_submitted: true, map_id: @response_map_2_2.id)&lt;br /&gt;
  @response_2_3 = create(:response, is_submitted: true, map_id: @response_map_2_3.id)&lt;br /&gt;
&lt;br /&gt;
  @response_3_1 = create(:response, is_submitted: true, map_id: @response_map_3_1.id)&lt;br /&gt;
  @response_3_2 = create(:response, is_submitted: true, map_id: @response_map_3_2.id)&lt;br /&gt;
  @response_3_3 = create(:response, is_submitted: true, map_id: @response_map_3_3.id)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The manifestation of each object will contribute to the success of the following test on reputations. Some fields in each object can be empty or have default values. Some attributes are not relevant to the test. When implementing the test, the test scripts need to generate or set fixed values for corresponding fields.&lt;br /&gt;
&lt;br /&gt;
=== Relevant Methods ===&lt;br /&gt;
==== db_query ====&lt;br /&gt;
This is the normal db query method, call this method will return peer review grades with given assignment id.&lt;br /&gt;
We will test this method in two aspect. &lt;br /&gt;
1. Test whether or not the grade return is right based on the specified algorithm.&lt;br /&gt;
2. We need to test the correctness of the query.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context 'test db_query' do&lt;br /&gt;
    it 'return average score' do&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_1.id, answer: 1)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_1.id, answer: 2)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_1.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_1.id, answer: 4)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      result = ReputationWebServiceController.new.db_query(1, 1, false)&lt;br /&gt;
      expect(result).to eq([[2, 1, 60.0]])&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== json_generator ====&lt;br /&gt;
This method will generate the hash format of the review, we will test this method by calling to and convert the result to json format the print to test its correctness.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context 'test json_generator' do&lt;br /&gt;
    it 'test 3 reviewer for one reviewee' do&lt;br /&gt;
      # reivewer_1's review for reviewee_1: [5, 5, 5, 5, 5]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
&lt;br /&gt;
      # reivewer_2's review for reviewee_1: [3, 3, 3, 3, 3]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
&lt;br /&gt;
      # reivewer_3's review for reviewee_1: [1, 1, 1, 1, 1]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
&lt;br /&gt;
      #result = ReputationWebServiceController.new.db_query(1, 1, false)&lt;br /&gt;
      #expect(result).to eq([[2, 1, 100.0], [3, 1, 60.0], [4, 1, 20.0]])&lt;br /&gt;
      result = ReputationWebServiceController.new.json_generator(1, 0, 1)&lt;br /&gt;
      expect(result).to eq({&amp;quot;submission1&amp;quot;=&amp;gt;{&amp;quot;stu2&amp;quot;=&amp;gt;100.0, &amp;quot;stu3&amp;quot;=&amp;gt;60.0, &amp;quot;stu4&amp;quot;=&amp;gt;20.0}})&lt;br /&gt;
      #repeat for different answers&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'test same reviewer for different reviewee' do&lt;br /&gt;
      # reivewer_1's review for reviewee_1: [5, 5, 5, 5, 5]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
&lt;br /&gt;
      # reivewer_1's review for reviewee_2: [3, 3, 3, 3, 3]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
&lt;br /&gt;
      result = ReputationWebServiceController.new.json_generator(1, 0, 1)&lt;br /&gt;
      expect(result).to eq(&amp;quot;submission1&amp;quot;=&amp;gt;{&amp;quot;stu2&amp;quot;=&amp;gt;100.0}, &amp;quot;submission2&amp;quot;=&amp;gt;{&amp;quot;stu2&amp;quot;=&amp;gt;60.0})&lt;br /&gt;
      #repeat for different answers&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== send_post_request ==== &lt;br /&gt;
This method send a post request to peerlogic.csc.ncsu.edu/reputation/calculations/reputation_algorithms to calculate get the reputation result and use show the result &lt;br /&gt;
in corresponding UI and update given reviewer's reputation. We will test this method based on the algorithm in the paper, first to test the result reputation value, second to test the&lt;br /&gt;
update value in database.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context 'test send_post_request' do&lt;br /&gt;
    it 'failed because of no public key file' do&lt;br /&gt;
      # reivewer_1's review for reviewee_1: [5, 5, 5, 5, 5]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
&lt;br /&gt;
      params = {assignment_id: 1, round_num: 1, algorithm: 'hammer', checkbox: {expert_grade: &amp;quot;empty&amp;quot;}}&lt;br /&gt;
      session = {user: build(:instructor, id: 1)}&lt;br /&gt;
&lt;br /&gt;
      expect(true).to eq(true)&lt;br /&gt;
&lt;br /&gt;
      # comment out because send_post_request method request public key file while this file is missing&lt;br /&gt;
      # so at this time send_post_request is not functioning normally&lt;br /&gt;
      # get :send_post_request, params, session&lt;br /&gt;
      # expect(response).to redirect_to '/reputation_web_service/client'&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
&lt;br /&gt;
== Future Tasks ==&lt;br /&gt;
As our team could not obtain the public/private key pair to access the reputation web service, we were only able get to the step prior to sending the JSON to the web service of reputation algorithms. Therefore, future steps are required to test on reputation system. &lt;br /&gt;
&lt;br /&gt;
# There is a lot of unused/commented code, which should be removed.&lt;br /&gt;
# Figure out what the code is doing and write appropriate comments for it.&lt;br /&gt;
# In the case of db_query, the name should say what it queries for. Also, this method not only queries, but calculates sums.  Since each method should do only one thing, the code for calculating sums should be in another method. And there should be comments in the code!&lt;br /&gt;
#json_generator should be generate_json. There needs to be a method comment saying what the parameters are.&lt;br /&gt;
# In  send_post_request, there are references to specific assignments, such as 724, 735, and 756. They were put in to gather data for a paper published in 2015. They are no longer relevant and should be removed. send_post_request is 91 lines long, far too long.&lt;br /&gt;
#There is a password for a private key in the code (and the code is open-sourced!) It should be in the db instead.&lt;br /&gt;
#Fix spelling of “dimention”&lt;br /&gt;
#client is a bad method name; why is stuff being copied from class variables to instance variables?&lt;br /&gt;
&lt;br /&gt;
=== Collaborators ===&lt;br /&gt;
Jinku Cui (jcui23)&lt;br /&gt;
&lt;br /&gt;
Henry Chen (hchen34)&lt;br /&gt;
&lt;br /&gt;
Dong Li (dli35)&lt;br /&gt;
&lt;br /&gt;
Zijun Lu (zlu5)&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[https://doi.org/10.1109/FIE.2015.7344292 Pluggable reputation systems for peer review: A web-service approach]&lt;/div&gt;</summary>
		<author><name>Hchen34</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2168._Testing_-_Reputations&amp;diff=141945</id>
		<title>CSC/ECE 517 Fall 2021 - E2168. Testing - Reputations</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2168._Testing_-_Reputations&amp;diff=141945"/>
		<updated>2021-11-29T21:30:09Z</updated>

		<summary type="html">&lt;p&gt;Hchen34: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Project Overview ==&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;q&amp;gt;Online peer-review systems are now in common use in higher education. They free the instructor and course staff from having to provide personally all the feedback that students receive on their work. However, if we want to assure that all students receive competent feedback, or even use peer-assigned grades, we need a way to judge which peer reviewers are most credible. The solution is to use a reputation system.&amp;lt;/q&amp;gt; &amp;lt;br&amp;gt; The reputation system is meant to provide objective value to student assigned peer review scores. Students select from a list of tasks to be performed and then prepare their work and submit it to a peer-review system. The work is then reviewed by other students who offer comments/graded feedback to help the submitters improve their work.&lt;br /&gt;
During the peer review period it is important to determine which reviews are more accurate and show higher quality. Reputation is one way to achieve this goal; it is a quantization measurement to judge which peer reviewers are more reliable.&lt;br /&gt;
Peer reviewers can use expertiza to score an author. If Expertiza shows a confidence ratings for grades based upon the reviewers reputation then authors can more easily determine the legitimacy of the peer assigned score. In addition, the teaching staff can examine the quality of each peer review based on reputation values and, potentially, crowd-source a significant portion of the grading function.&lt;br /&gt;
Currently the reputation system is implemented in Expertiza through web-service, but there's no test written for it. Thus our goal is to write tests to verify Hamer's and Lauw’s algorithm from the reputation system.&lt;br /&gt;
&lt;br /&gt;
=== System Design ===&lt;br /&gt;
The below is referenced from project E1625, which would give us the overall description of the reputation system.&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Diagram E1625.png|1000px]]&amp;lt;br&amp;gt;&lt;br /&gt;
There are two algorithms intended for use in calculation of the reputation values for participants. &lt;br /&gt;
&lt;br /&gt;
There is a [https://expertiza.ncsu.edu/reputation_web_service/client web-service] (the link accessible only to the instructors) available which serves a JSON response containing the reputation value based on the seed provided in the form of the last known reputation value which we store in the ''participants'' table. An instructor can specify which algorithm to use for a particular assignment to calculate the confidence rating. &lt;br /&gt;
&lt;br /&gt;
As the [https://docs.google.com/viewer?url=https%3A%2F%2Fwww.researchgate.net%2Fprofile%2FYang_Song36%2Fpublication%2F289528736_Pluggable_Reputation_Systems_for_Peer_Review_a_Web-Service_Approach%2Flinks%2F568ec8d008ae78cc05160aed.pdf%3FinViewer%3D0%26pdfJsDownload%3D0%26origin%3Dpublication_detail paper] on reputation system by observes, “the Hamer-peer algorithm has the lowest maximum absolute bias and the Lauw-peer algorithm has the lowest overall bias.This indicates, from the instructor’s perspective, if there are further assignments of this kind, expert grading may not be necessary.”&lt;br /&gt;
:;Reputation range of Hamer’s algorithm is :&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: red;&amp;quot;&amp;gt;red&amp;lt;/span&amp;gt;                   value &amp;lt; 0.5&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: yellow&amp;quot;&amp;gt;yellow&amp;lt;/span&amp;gt;              value is &amp;gt;= 0.5 and &amp;lt;= 1&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: orange&amp;quot;&amp;gt;orange&amp;lt;/span&amp;gt;             value is &amp;gt; 1 and &amp;lt;= 1.5&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: HoneyDew&amp;quot;&amp;gt;light green&amp;lt;/span&amp;gt;       value is &amp;gt; 1.5 and &amp;lt;= 2&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: Chartreuse&amp;quot;&amp;gt;green&amp;lt;/span&amp;gt;               value is &amp;gt; 2&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The main difference between the Hamer-peer and the Lauw-peer algorithm is that the Lauw-peer algorithm keeps track of the reviewer's leniency (“bias”), which can be either positive or negative. A positive leniency indicates the reviewer tends to give higher scores than average.  This project determines reputation by subtracting the absolute value of the leniency from 1. Additionally, the range for Hamer’s algorithm is (0,∞) while for Lauw’s algorithm it is [0,1]. &lt;br /&gt;
:;Reputation range of Lauw’s algorithm is&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: red&amp;quot;&amp;gt;red&amp;lt;/span&amp;gt;                   value is &amp;lt; 0.2&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: yellow&amp;quot;&amp;gt;yellow&amp;lt;/span&amp;gt;              value is &amp;gt;= 0.2 and &amp;lt;= 0.4&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: orange&amp;quot;&amp;gt;orange&amp;lt;/span&amp;gt;             value is &amp;gt; 0.4 and &amp;lt;= 0.6&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: HoneyDew&amp;quot;&amp;gt;light green&amp;lt;/span&amp;gt;       value is &amp;gt; 0.6 and &amp;lt;= 0.8&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: Chartreuse&amp;quot;&amp;gt;green&amp;lt;/span&amp;gt;               value is &amp;gt; 0.8&lt;br /&gt;
&lt;br /&gt;
The instructor can choose to show results from Hamer’s algorithm or Lauw’s algorithm. The default algorithm should be Lauw’s algorithm.&lt;br /&gt;
&lt;br /&gt;
=== Objectives ===&lt;br /&gt;
&lt;br /&gt;
Our objectives for this project are the following:&lt;br /&gt;
* Double and stub an assignment, a few submissions to the assignment, under different review rubrics&lt;br /&gt;
* Manually calculate reputation scores based on paper &amp;quot;Pluggable reputation systems for peer review: A web-service approach&amp;quot;&lt;br /&gt;
* Validate correct reputation scores based on different review rubrics generated by reputation management VS manual computation of reputation score expectation on different reputation range of Hamer's and Lauw's algorithm with or without instructor score impact.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
*reputation_web_service_controller_spec&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
=== Setup Testing Objects ===&lt;br /&gt;
In order to implement testing on reputation, it is crucial to create sample reviews so that we could possibly obtain reputation score. During the kickoff meeting, our team defined four necessary steps to follow for the purpose of testing. Also, appropriate objects could be created and confined as discussed below.&lt;br /&gt;
&lt;br /&gt;
==== 1. Assignment ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[assignments]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Essential Parameters to be configured&amp;lt;br&amp;gt;&lt;br /&gt;
submitter_count = 0;&amp;lt;br&amp;gt;&lt;br /&gt;
num_reviews = 5;&amp;lt;br&amp;gt;&lt;br /&gt;
num_reviewers = 5;&amp;lt;br&amp;gt;&lt;br /&gt;
num_reviews_allowed = 5;&amp;lt;br&amp;gt;&lt;br /&gt;
rounds_of_reviews = 2;&amp;lt;br&amp;gt;&lt;br /&gt;
reputation_algorithm = lauw/hamer;&amp;lt;br&amp;gt;&lt;br /&gt;
Note: Two assignment objects were created. Assignment_1 used lauw's algorithm, whereas assignment_2 used hamer's alogorithm.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @assignment_1 = create(:assignment, created_at: DateTime.now.in_time_zone - 13.day, submitter_count: 0, num_reviews: 3, num_reviewers: 5, num_reviews_allowed: 5, rounds_of_reviews: 2, reputation_algorithm: 'lauw', id: 1)&lt;br /&gt;
  @assignment_2 = create(:assignment, created_at: DateTime.now.in_time_zone - 13.day, submitter_count: 0, num_reviews: 3, num_reviewers: 5, num_reviews_allowed: 5, rounds_of_reviews: 2, reputation_algorithm: 'hamer', id: 2)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== 2. Questionnaires(Rubrics) ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[questionnaires]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[assignment_questionnaires]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Essential Parameters to be configured&amp;lt;br&amp;gt;&lt;br /&gt;
instructor_id = from_fixture;&amp;lt;br&amp;gt;&lt;br /&gt;
min_question_score = 0;&amp;lt;br&amp;gt;&lt;br /&gt;
max_question_score = 5;&amp;lt;br&amp;gt;&lt;br /&gt;
type = ReviewQuestionnaire;&amp;lt;br&amp;gt;&lt;br /&gt;
Note: We will define the assignment with ReviewQuestionnaire type rubric. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @questionnaire_1 = create(:questionnaire, min_question_score: 0, max_question_score: 5, type: 'ReviewQuestionnaire', id: 1)&lt;br /&gt;
  @assignment_questionnaire_1_1 = create(:assignment_questionnaire, assignment_id: @assignment_1.id, questionnaire_id: @questionnaire_1.id, used_in_round: 1)&lt;br /&gt;
  @assignment_questionnaire_1_2 = create(:assignment_questionnaire, assignment_id: @assignment_1.id, questionnaire_id: @questionnaire_1.id, used_in_round: 2)&lt;br /&gt;
  @assignment_questionnaire_2_1 = create(:assignment_questionnaire, assignment_id: @assignment_2.id, questionnaire_id: @questionnaire_1.id, used_in_round: 1)&lt;br /&gt;
  @assignment_questionnaire_2_2 = create(:assignment_questionnaire, assignment_id: @assignment_2.id, questionnaire_id: @questionnaire_1.id, used_in_round: 2, id: 4)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== 3. Questions under Questionnaires ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[questions]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @question_1_1 = create(:question, questionnaire_id: @questionnaire_1.id, id: 1)&lt;br /&gt;
  @question_1_2 = create(:question, questionnaire_id: @questionnaire_1.id, id: 2)&lt;br /&gt;
  @question_1_3 = create(:question, questionnaire_id: @questionnaire_1.id, id: 3)&lt;br /&gt;
  @question_1_4 = create(:question, questionnaire_id: @questionnaire_1.id, id: 4)&lt;br /&gt;
  @question_1_5 = create(:question, questionnaire_id: @questionnaire_1.id, id: 5)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== 4. Reviewers and Reviewees ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[participants]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[teams]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
Reviewers (Participant):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @reviewer_1 = create(:participant, can_review: 1)&lt;br /&gt;
  @reviewer_2 = create(:participant, can_review: 1)&lt;br /&gt;
  @reviewer_3 = create(:participant, can_review: 1)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Reviewees (Teams):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @reviewee_1 = create(:assignment_team, assignment: @assignment)&lt;br /&gt;
  @reviewee_2 = create(:assignment_team, assignment: @assignment)&lt;br /&gt;
  @reviewee_3 = create(:assignment_team, assignment: @assignment)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== 5. Responses ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[response_maps]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[responses]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Essential Parameters to be configured&amp;lt;br&amp;gt;&lt;br /&gt;
reviewed_object_id = assignment_id;&amp;lt;br&amp;gt;&lt;br /&gt;
reviewer_id = participants;&amp;lt;br&amp;gt;&lt;br /&gt;
reviewee_id = AssignmentTeam;&amp;lt;br&amp;gt;&lt;br /&gt;
Note: we will setup response map to determine relationship between reviewer and reviewee of an assignment.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
Response_maps:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @response_map_1_1 = create(:review_response_map, reviewer_id: @reviewer_1.id, reviewee_id: @reviewee_1.id)&lt;br /&gt;
  @response_map_1_2 = create(:review_response_map, reviewer_id: @reviewer_2.id, reviewee_id: @reviewee_1.id)&lt;br /&gt;
  @response_map_1_3 = create(:review_response_map, reviewer_id: @reviewer_3.id, reviewee_id: @reviewee_1.id)&lt;br /&gt;
&lt;br /&gt;
  @response_map_2_1 = create(:review_response_map, reviewer_id: @reviewer_1.id, reviewee_id: @reviewee_2.id)&lt;br /&gt;
  @response_map_2_2 = create(:review_response_map, reviewer_id: @reviewer_2.id, reviewee_id: @reviewee_2.id)&lt;br /&gt;
  @response_map_2_3 = create(:review_response_map, reviewer_id: @reviewer_3.id, reviewee_id: @reviewee_2.id)&lt;br /&gt;
&lt;br /&gt;
  @response_map_3_1 = create(:review_response_map, reviewer_id: @reviewer_1.id, reviewee_id: @reviewee_3.id)&lt;br /&gt;
  @response_map_3_2 = create(:review_response_map, reviewer_id: @reviewer_2.id, reviewee_id: @reviewee_3.id)&lt;br /&gt;
  @response_map_3_3 = create(:review_response_map, reviewer_id: @reviewer_3.id, reviewee_id: @reviewee_3.id)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Responses:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @response_1_1 = create(:response, is_submitted: true, map_id: @response_map_1_1.id)&lt;br /&gt;
  @response_1_2 = create(:response, is_submitted: true, map_id: @response_map_1_2.id)&lt;br /&gt;
  @response_1_3 = create(:response, is_submitted: true, map_id: @response_map_1_3.id)&lt;br /&gt;
&lt;br /&gt;
  @response_2_1 = create(:response, is_submitted: true, map_id: @response_map_2_1.id)&lt;br /&gt;
  @response_2_2 = create(:response, is_submitted: true, map_id: @response_map_2_2.id)&lt;br /&gt;
  @response_2_3 = create(:response, is_submitted: true, map_id: @response_map_2_3.id)&lt;br /&gt;
&lt;br /&gt;
  @response_3_1 = create(:response, is_submitted: true, map_id: @response_map_3_1.id)&lt;br /&gt;
  @response_3_2 = create(:response, is_submitted: true, map_id: @response_map_3_2.id)&lt;br /&gt;
  @response_3_3 = create(:response, is_submitted: true, map_id: @response_map_3_3.id)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The manifestation of each object will contribute to the success of the following test on reputations. Some fields in each object can be empty or have default values. Some attributes are not relevant to the test. When implementing the test, the test scripts need to generate or set fixed values for corresponding fields.&lt;br /&gt;
&lt;br /&gt;
=== Relevant Methods ===&lt;br /&gt;
==== db_query ====&lt;br /&gt;
This is the normal db query method, call this method will return peer review grades with given assignment id.&lt;br /&gt;
We will test this method in two aspect. &lt;br /&gt;
1. Test whether or not the grade return is right based on the specified algorithm.&lt;br /&gt;
2. We need to test the correctness of the query.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context 'test db_query' do&lt;br /&gt;
    it 'return average score' do&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_1.id, answer: 1)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_1.id, answer: 2)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_1.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_1.id, answer: 4)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      result = ReputationWebServiceController.new.db_query(1, 1, false)&lt;br /&gt;
      expect(result).to eq([[2, 1, 60.0]])&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== json_generator ====&lt;br /&gt;
This method will generate the hash format of the review, we will test this method by calling to and convert the result to json format the print to test its correctness.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context 'test json_generator' do&lt;br /&gt;
    it 'test 3 reviewer for one reviewee' do&lt;br /&gt;
      # reivewer_1's review for reviewee_1: [5, 5, 5, 5, 5]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
&lt;br /&gt;
      # reivewer_2's review for reviewee_1: [3, 3, 3, 3, 3]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
&lt;br /&gt;
      # reivewer_3's review for reviewee_1: [1, 1, 1, 1, 1]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
&lt;br /&gt;
      #result = ReputationWebServiceController.new.db_query(1, 1, false)&lt;br /&gt;
      #expect(result).to eq([[2, 1, 100.0], [3, 1, 60.0], [4, 1, 20.0]])&lt;br /&gt;
      result = ReputationWebServiceController.new.json_generator(1, 0, 1)&lt;br /&gt;
      expect(result).to eq({&amp;quot;submission1&amp;quot;=&amp;gt;{&amp;quot;stu2&amp;quot;=&amp;gt;100.0, &amp;quot;stu3&amp;quot;=&amp;gt;60.0, &amp;quot;stu4&amp;quot;=&amp;gt;20.0}})&lt;br /&gt;
      #repeat for different answers&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'test same reviewer for different reviewee' do&lt;br /&gt;
      # reivewer_1's review for reviewee_1: [5, 5, 5, 5, 5]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
&lt;br /&gt;
      # reivewer_1's review for reviewee_2: [3, 3, 3, 3, 3]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
&lt;br /&gt;
      result = ReputationWebServiceController.new.json_generator(1, 0, 1)&lt;br /&gt;
      expect(result).to eq(&amp;quot;submission1&amp;quot;=&amp;gt;{&amp;quot;stu2&amp;quot;=&amp;gt;100.0}, &amp;quot;submission2&amp;quot;=&amp;gt;{&amp;quot;stu2&amp;quot;=&amp;gt;60.0})&lt;br /&gt;
      #repeat for different answers&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== send_post_request ==== &lt;br /&gt;
This method send a post request to peerlogic.csc.ncsu.edu/reputation/calculations/reputation_algorithms to calculate get the reputation result and use show the result &lt;br /&gt;
in corresponding UI and update given reviewer's reputation. We will test this method based on the algorithm in the paper, first to test the result reputation value, second to test the&lt;br /&gt;
update value in database.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context 'test send_post_request' do&lt;br /&gt;
    it 'failed because of no public key file' do&lt;br /&gt;
      # reivewer_1's review for reviewee_1: [5, 5, 5, 5, 5]&lt;br /&gt;
      create(:answer, question_id: @question_1_1.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_2.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_3.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_4.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
      create(:answer, question_id: @question_1_5.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
&lt;br /&gt;
      params = {assignment_id: 1, round_num: 1, algorithm: 'hammer', checkbox: {expert_grade: &amp;quot;empty&amp;quot;}}&lt;br /&gt;
      session = {user: build(:instructor, id: 1)}&lt;br /&gt;
&lt;br /&gt;
      expect(true).to eq(true)&lt;br /&gt;
&lt;br /&gt;
      # comment out because send_post_request method request public key file while this file is missing&lt;br /&gt;
      # so at this time send_post_request is not functioning normally&lt;br /&gt;
      # get :send_post_request, params, session&lt;br /&gt;
      # expect(response).to redirect_to '/reputation_web_service/client'&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
&lt;br /&gt;
== Future Tasks ==&lt;br /&gt;
As our team could not obtain the public/private key pair to access the reputation web service, we were only able get to the step prior to sending the JSON to the web service of reputation algorithms. Therefore, future steps are required to test on reputation system. &lt;br /&gt;
&lt;br /&gt;
# There is a lot of unused/commented code, which should be removed.&lt;br /&gt;
# Figure out what the code is doing and write appropriate comments for it.&lt;br /&gt;
# In the case of db_query, the name should say what it queries for. Also, this method not only queries, but calculates sums.  Since each method should do only one thing, the code for calculating sums should be in another method. And there should be comments in the code!&lt;br /&gt;
#json_generator should be generate_json. There needs to be a method comment saying what the parameters are.&lt;br /&gt;
# In  send_post_request, there are references to specific assignments, such as 724, 735, and 756. They were put in to gather data for a paper published in 2015. They are no longer relevant and should be removed. send_post_request is 91 lines long, far too long.&lt;br /&gt;
#There is a password for a private key in the code (and the code is open-sourced!) It should be in the db instead.&lt;br /&gt;
#Fix spelling of “dimention”&lt;br /&gt;
#client is a bad method name; why is stuff being copied from class variables to instance variables?&lt;br /&gt;
&lt;br /&gt;
=== Collaborators ===&lt;br /&gt;
Jinku Cui (jcui23)&lt;br /&gt;
&lt;br /&gt;
Henry Chen (hchen34)&lt;br /&gt;
&lt;br /&gt;
Dong Li (dli35)&lt;br /&gt;
&lt;br /&gt;
Zijun Lu (zlu5)&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[https://doi.org/10.1109/FIE.2015.7344292 Pluggable reputation systems for peer review: A web-service approach]&lt;/div&gt;</summary>
		<author><name>Hchen34</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2168._Testing_-_Reputations&amp;diff=141931</id>
		<title>CSC/ECE 517 Fall 2021 - E2168. Testing - Reputations</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2168._Testing_-_Reputations&amp;diff=141931"/>
		<updated>2021-11-29T21:23:18Z</updated>

		<summary type="html">&lt;p&gt;Hchen34: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Project Overview ==&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;q&amp;gt;Online peer-review systems are now in common use in higher education. They free the instructor and course staff from having to provide personally all the feedback that students receive on their work. However, if we want to assure that all students receive competent feedback, or even use peer-assigned grades, we need a way to judge which peer reviewers are most credible. The solution is to use a reputation system.&amp;lt;/q&amp;gt; &amp;lt;br&amp;gt; The reputation system is meant to provide objective value to student assigned peer review scores. Students select from a list of tasks to be performed and then prepare their work and submit it to a peer-review system. The work is then reviewed by other students who offer comments/graded feedback to help the submitters improve their work.&lt;br /&gt;
During the peer review period it is important to determine which reviews are more accurate and show higher quality. Reputation is one way to achieve this goal; it is a quantization measurement to judge which peer reviewers are more reliable.&lt;br /&gt;
Peer reviewers can use expertiza to score an author. If Expertiza shows a confidence ratings for grades based upon the reviewers reputation then authors can more easily determine the legitimacy of the peer assigned score. In addition, the teaching staff can examine the quality of each peer review based on reputation values and, potentially, crowd-source a significant portion of the grading function.&lt;br /&gt;
Currently the reputation system is implemented in Expertiza through web-service, but there's no test written for it. Thus our goal is to write tests to verify Hamer's and Lauw’s algorithm from the reputation system.&lt;br /&gt;
&lt;br /&gt;
=== System Design ===&lt;br /&gt;
The below is referenced from project E1625, which would give us the overall description of the reputation system.&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Diagram E1625.png|1000px]]&amp;lt;br&amp;gt;&lt;br /&gt;
There are two algorithms intended for use in calculation of the reputation values for participants. &lt;br /&gt;
&lt;br /&gt;
There is a [https://expertiza.ncsu.edu/reputation_web_service/client web-service] (the link accessible only to the instructors) available which serves a JSON response containing the reputation value based on the seed provided in the form of the last known reputation value which we store in the ''participants'' table. An instructor can specify which algorithm to use for a particular assignment to calculate the confidence rating. &lt;br /&gt;
&lt;br /&gt;
As the [https://docs.google.com/viewer?url=https%3A%2F%2Fwww.researchgate.net%2Fprofile%2FYang_Song36%2Fpublication%2F289528736_Pluggable_Reputation_Systems_for_Peer_Review_a_Web-Service_Approach%2Flinks%2F568ec8d008ae78cc05160aed.pdf%3FinViewer%3D0%26pdfJsDownload%3D0%26origin%3Dpublication_detail paper] on reputation system by observes, “the Hamer-peer algorithm has the lowest maximum absolute bias and the Lauw-peer algorithm has the lowest overall bias.This indicates, from the instructor’s perspective, if there are further assignments of this kind, expert grading may not be necessary.”&lt;br /&gt;
:;Reputation range of Hamer’s algorithm is :&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: red;&amp;quot;&amp;gt;red&amp;lt;/span&amp;gt;                   value &amp;lt; 0.5&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: yellow&amp;quot;&amp;gt;yellow&amp;lt;/span&amp;gt;              value is &amp;gt;= 0.5 and &amp;lt;= 1&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: orange&amp;quot;&amp;gt;orange&amp;lt;/span&amp;gt;             value is &amp;gt; 1 and &amp;lt;= 1.5&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: HoneyDew&amp;quot;&amp;gt;light green&amp;lt;/span&amp;gt;       value is &amp;gt; 1.5 and &amp;lt;= 2&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: Chartreuse&amp;quot;&amp;gt;green&amp;lt;/span&amp;gt;               value is &amp;gt; 2&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The main difference between the Hamer-peer and the Lauw-peer algorithm is that the Lauw-peer algorithm keeps track of the reviewer's leniency (“bias”), which can be either positive or negative. A positive leniency indicates the reviewer tends to give higher scores than average.  This project determines reputation by subtracting the absolute value of the leniency from 1. Additionally, the range for Hamer’s algorithm is (0,∞) while for Lauw’s algorithm it is [0,1]. &lt;br /&gt;
:;Reputation range of Lauw’s algorithm is&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: red&amp;quot;&amp;gt;red&amp;lt;/span&amp;gt;                   value is &amp;lt; 0.2&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: yellow&amp;quot;&amp;gt;yellow&amp;lt;/span&amp;gt;              value is &amp;gt;= 0.2 and &amp;lt;= 0.4&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: orange&amp;quot;&amp;gt;orange&amp;lt;/span&amp;gt;             value is &amp;gt; 0.4 and &amp;lt;= 0.6&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: HoneyDew&amp;quot;&amp;gt;light green&amp;lt;/span&amp;gt;       value is &amp;gt; 0.6 and &amp;lt;= 0.8&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: Chartreuse&amp;quot;&amp;gt;green&amp;lt;/span&amp;gt;               value is &amp;gt; 0.8&lt;br /&gt;
&lt;br /&gt;
The instructor can choose to show results from Hamer’s algorithm or Lauw’s algorithm. The default algorithm should be Lauw’s algorithm.&lt;br /&gt;
&lt;br /&gt;
=== Objectives ===&lt;br /&gt;
&lt;br /&gt;
Our objectives for this project are the following:&lt;br /&gt;
* Double and stub an assignment, a few submissions to the assignment, under different review rubrics&lt;br /&gt;
* Manually calculate reputation scores based on paper &amp;quot;Pluggable reputation systems for peer review: A web-service approach&amp;quot;&lt;br /&gt;
* Validate correct reputation scores based on different review rubrics generated by reputation management VS manual computation of reputation score expectation on different reputation range of Hamer's and Lauw's algorithm with or without instructor score impact.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
*reputation_web_service_controller_spec&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
=== Setup Testing Objects ===&lt;br /&gt;
In order to implement testing on reputation, it is crucial to create sample reviews so that we could possibly obtain reputation score. During the kickoff meeting, our team defined four necessary steps to follow for the purpose of testing. Also, appropriate objects could be created and confined as discussed below.&lt;br /&gt;
&lt;br /&gt;
==== 1. Assignment ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[assignments]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Essential Parameters to be configured&amp;lt;br&amp;gt;&lt;br /&gt;
submitter_count = 0;&amp;lt;br&amp;gt;&lt;br /&gt;
num_reviews = 5;&amp;lt;br&amp;gt;&lt;br /&gt;
num_reviewers = 5;&amp;lt;br&amp;gt;&lt;br /&gt;
num_reviews_allowed = 5;&amp;lt;br&amp;gt;&lt;br /&gt;
rounds_of_reviews = 2;&amp;lt;br&amp;gt;&lt;br /&gt;
reputation_algorithm = lauw/hamer;&amp;lt;br&amp;gt;&lt;br /&gt;
Note: Two assignment objects were created. Assignment_1 used lauw's algorithm, whereas assignment_2 used hamer's alogorithm.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @assignment_1 = create(:assignment, created_at: DateTime.now.in_time_zone - 13.day, submitter_count: 0, num_reviews: 3, num_reviewers: 5, num_reviews_allowed: 5, rounds_of_reviews: 2, reputation_algorithm: 'lauw', id: 1)&lt;br /&gt;
  @assignment_2 = create(:assignment, created_at: DateTime.now.in_time_zone - 13.day, submitter_count: 0, num_reviews: 3, num_reviewers: 5, num_reviews_allowed: 5, rounds_of_reviews: 2, reputation_algorithm: 'hamer', id: 2)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== 2. Questionnaires(Rubrics) ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[questionnaires]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[assignment_questionnaires]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Essential Parameters to be configured&amp;lt;br&amp;gt;&lt;br /&gt;
instructor_id = from_fixture;&amp;lt;br&amp;gt;&lt;br /&gt;
min_question_score = 0;&amp;lt;br&amp;gt;&lt;br /&gt;
max_question_score = 5;&amp;lt;br&amp;gt;&lt;br /&gt;
type = ReviewQuestionnaire;&amp;lt;br&amp;gt;&lt;br /&gt;
Note: We will define the assignment with ReviewQuestionnaire type rubric. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @questionnaire_1 = create(:questionnaire, min_question_score: 0, max_question_score: 5, type: 'ReviewQuestionnaire', id: 1)&lt;br /&gt;
  @assignment_questionnaire_1_1 = create(:assignment_questionnaire, assignment_id: @assignment_1.id, questionnaire_id: @questionnaire_1.id, used_in_round: 1)&lt;br /&gt;
  @assignment_questionnaire_1_2 = create(:assignment_questionnaire, assignment_id: @assignment_1.id, questionnaire_id: @questionnaire_1.id, used_in_round: 2)&lt;br /&gt;
  @assignment_questionnaire_2_1 = create(:assignment_questionnaire, assignment_id: @assignment_2.id, questionnaire_id: @questionnaire_1.id, used_in_round: 1)&lt;br /&gt;
  @assignment_questionnaire_2_2 = create(:assignment_questionnaire, assignment_id: @assignment_2.id, questionnaire_id: @questionnaire_1.id, used_in_round: 2, id: 4)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== 3. Questions under Questionnaires ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[questions]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @question_1_1 = create(:question, questionnaire_id: @questionnaire_1.id, id: 1)&lt;br /&gt;
  @question_1_2 = create(:question, questionnaire_id: @questionnaire_1.id, id: 2)&lt;br /&gt;
  @question_1_3 = create(:question, questionnaire_id: @questionnaire_1.id, id: 3)&lt;br /&gt;
  @question_1_4 = create(:question, questionnaire_id: @questionnaire_1.id, id: 4)&lt;br /&gt;
  @question_1_5 = create(:question, questionnaire_id: @questionnaire_1.id, id: 5)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== 4. Reviewers and Reviewees ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[participants]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[teams]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
Reviewers (Participant):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @reviewer_1 = create(:participant, can_review: 1)&lt;br /&gt;
  @reviewer_2 = create(:participant, can_review: 1)&lt;br /&gt;
  @reviewer_3 = create(:participant, can_review: 1)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Reviewees (Teams):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @reviewee_1 = create(:assignment_team, assignment: @assignment)&lt;br /&gt;
  @reviewee_2 = create(:assignment_team, assignment: @assignment)&lt;br /&gt;
  @reviewee_3 = create(:assignment_team, assignment: @assignment)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== 5. Responses ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[response_maps]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[responses]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Essential Parameters to be configured&amp;lt;br&amp;gt;&lt;br /&gt;
reviewed_object_id = assignment_id;&amp;lt;br&amp;gt;&lt;br /&gt;
reviewer_id = participants;&amp;lt;br&amp;gt;&lt;br /&gt;
reviewee_id = AssignmentTeam;&amp;lt;br&amp;gt;&lt;br /&gt;
Note: we will setup response map to determine relationship between reviewer and reviewee of an assignment.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
Response_maps:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @response_map_1_1 = create(:review_response_map, reviewer_id: @reviewer_1.id, reviewee_id: @reviewee_1.id)&lt;br /&gt;
  @response_map_1_2 = create(:review_response_map, reviewer_id: @reviewer_2.id, reviewee_id: @reviewee_1.id)&lt;br /&gt;
  @response_map_1_3 = create(:review_response_map, reviewer_id: @reviewer_3.id, reviewee_id: @reviewee_1.id)&lt;br /&gt;
&lt;br /&gt;
  @response_map_2_1 = create(:review_response_map, reviewer_id: @reviewer_1.id, reviewee_id: @reviewee_2.id)&lt;br /&gt;
  @response_map_2_2 = create(:review_response_map, reviewer_id: @reviewer_2.id, reviewee_id: @reviewee_2.id)&lt;br /&gt;
  @response_map_2_3 = create(:review_response_map, reviewer_id: @reviewer_3.id, reviewee_id: @reviewee_2.id)&lt;br /&gt;
&lt;br /&gt;
  @response_map_3_1 = create(:review_response_map, reviewer_id: @reviewer_1.id, reviewee_id: @reviewee_3.id)&lt;br /&gt;
  @response_map_3_2 = create(:review_response_map, reviewer_id: @reviewer_2.id, reviewee_id: @reviewee_3.id)&lt;br /&gt;
  @response_map_3_3 = create(:review_response_map, reviewer_id: @reviewer_3.id, reviewee_id: @reviewee_3.id)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Responses:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @response_1_1 = create(:response, is_submitted: true, map_id: @response_map_1_1.id)&lt;br /&gt;
  @response_1_2 = create(:response, is_submitted: true, map_id: @response_map_1_2.id)&lt;br /&gt;
  @response_1_3 = create(:response, is_submitted: true, map_id: @response_map_1_3.id)&lt;br /&gt;
&lt;br /&gt;
  @response_2_1 = create(:response, is_submitted: true, map_id: @response_map_2_1.id)&lt;br /&gt;
  @response_2_2 = create(:response, is_submitted: true, map_id: @response_map_2_2.id)&lt;br /&gt;
  @response_2_3 = create(:response, is_submitted: true, map_id: @response_map_2_3.id)&lt;br /&gt;
&lt;br /&gt;
  @response_3_1 = create(:response, is_submitted: true, map_id: @response_map_3_1.id)&lt;br /&gt;
  @response_3_2 = create(:response, is_submitted: true, map_id: @response_map_3_2.id)&lt;br /&gt;
  @response_3_3 = create(:response, is_submitted: true, map_id: @response_map_3_3.id)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The manifestation of each object will contribute to the success of the following test on reputations. Some fields in each object can be empty or have default values. Some attributes are not relevant to the test. When implementing the test, the test scripts need to generate or set fixed values for corresponding fields.&lt;br /&gt;
&lt;br /&gt;
=== Relevant Methods ===&lt;br /&gt;
==== ReputationController_spec ====&lt;br /&gt;
*db_query&lt;br /&gt;
This is the normal db query method, call this method will return peer review grades with given assignment id.&lt;br /&gt;
We will test this method in two aspect. 1. Test whether or not the grade return is right based on the specified algorithm.&lt;br /&gt;
2. We need to test the correctness of the query.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    context 'test db_query' do&lt;br /&gt;
      it 'return average score' do&lt;br /&gt;
        create(:answer, question_id: @question_1_1.id, response_id: @response_1_1.id, answer: 1)&lt;br /&gt;
        create(:answer, question_id: @question_1_2.id, response_id: @response_1_1.id, answer: 2)&lt;br /&gt;
        create(:answer, question_id: @question_1_3.id, response_id: @response_1_1.id, answer: 3)&lt;br /&gt;
        create(:answer, question_id: @question_1_4.id, response_id: @response_1_1.id, answer: 4)&lt;br /&gt;
        create(:answer, question_id: @question_1_5.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
        result = ReputationWebServiceController.new.db_query(1, 1, false)&lt;br /&gt;
        expect(result).to eq([[2, 1, 60.0]])&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*json_generator&lt;br /&gt;
This method will generate the hash format of the review, we will test this method by calling to and convert the result to json format the print to test its correctness.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    context 'test json_generator' do&lt;br /&gt;
      it 'test 3 reviewer for one reviewee' do&lt;br /&gt;
        # reivewer_1's review for reviewee_1: [5, 5, 5, 5, 5]&lt;br /&gt;
        create(:answer, question_id: @question_1_1.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
        create(:answer, question_id: @question_1_2.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
        create(:answer, question_id: @question_1_3.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
        create(:answer, question_id: @question_1_4.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
        create(:answer, question_id: @question_1_5.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
&lt;br /&gt;
        # reivewer_2's review for reviewee_1: [3, 3, 3, 3, 3]&lt;br /&gt;
        create(:answer, question_id: @question_1_1.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
        create(:answer, question_id: @question_1_2.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
        create(:answer, question_id: @question_1_3.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
        create(:answer, question_id: @question_1_4.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
        create(:answer, question_id: @question_1_5.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
&lt;br /&gt;
        # reivewer_3's review for reviewee_1: [1, 1, 1, 1, 1]&lt;br /&gt;
        create(:answer, question_id: @question_1_1.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
        create(:answer, question_id: @question_1_2.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
        create(:answer, question_id: @question_1_3.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
        create(:answer, question_id: @question_1_4.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
        create(:answer, question_id: @question_1_5.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
&lt;br /&gt;
        #result = ReputationWebServiceController.new.db_query(1, 1, false)&lt;br /&gt;
        #expect(result).to eq([[2, 1, 100.0], [3, 1, 60.0], [4, 1, 20.0]])&lt;br /&gt;
        result = ReputationWebServiceController.new.json_generator(1, 0, 1)&lt;br /&gt;
        expect(result).to eq({&amp;quot;submission1&amp;quot;=&amp;gt;{&amp;quot;stu2&amp;quot;=&amp;gt;100.0, &amp;quot;stu3&amp;quot;=&amp;gt;60.0, &amp;quot;stu4&amp;quot;=&amp;gt;20.0}})&lt;br /&gt;
        #repeat for different answers&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      it 'test same reviewer for different reviewee' do&lt;br /&gt;
        # reivewer_1's review for reviewee_1: [5, 5, 5, 5, 5]&lt;br /&gt;
        create(:answer, question_id: @question_1_1.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
        create(:answer, question_id: @question_1_2.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
        create(:answer, question_id: @question_1_3.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
        create(:answer, question_id: @question_1_4.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
        create(:answer, question_id: @question_1_5.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
&lt;br /&gt;
        # reivewer_1's review for reviewee_2: [3, 3, 3, 3, 3]&lt;br /&gt;
        create(:answer, question_id: @question_1_1.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
        create(:answer, question_id: @question_1_2.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
        create(:answer, question_id: @question_1_3.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
        create(:answer, question_id: @question_1_4.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
        create(:answer, question_id: @question_1_5.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
&lt;br /&gt;
        result = ReputationWebServiceController.new.json_generator(1, 0, 1)&lt;br /&gt;
        expect(result).to eq(&amp;quot;submission1&amp;quot;=&amp;gt;{&amp;quot;stu2&amp;quot;=&amp;gt;100.0}, &amp;quot;submission2&amp;quot;=&amp;gt;{&amp;quot;stu2&amp;quot;=&amp;gt;60.0})&lt;br /&gt;
        #repeat for different answers&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*send_post_request&lt;br /&gt;
This method send a post request to peerlogic.csc.ncsu.edu/reputation/calculations/reputation_algorithms to calculate get the reputation result and use show the result &lt;br /&gt;
in corresponding UI and update given reviewer's reputation. We will test this method based on the algorithm in the paper, first to test the result reputation value, second to test the&lt;br /&gt;
update value in database.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    context 'test send_post_request' do&lt;br /&gt;
      it 'failed because of no public key file' do&lt;br /&gt;
        # reivewer_1's review for reviewee_1: [5, 5, 5, 5, 5]&lt;br /&gt;
        create(:answer, question_id: @question_1_1.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
        create(:answer, question_id: @question_1_2.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
        create(:answer, question_id: @question_1_3.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
        create(:answer, question_id: @question_1_4.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
        create(:answer, question_id: @question_1_5.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
&lt;br /&gt;
        params = {assignment_id: 1, round_num: 1, algorithm: 'hammer', checkbox: {expert_grade: &amp;quot;empty&amp;quot;}}&lt;br /&gt;
        session = {user: build(:instructor, id: 1)}&lt;br /&gt;
&lt;br /&gt;
        expect(true).to eq(true)&lt;br /&gt;
&lt;br /&gt;
        # comment out because send_post_request method request public key file while this file is missing&lt;br /&gt;
        # so at this time send_post_request is not functioning normally&lt;br /&gt;
        # get :send_post_request, params, session&lt;br /&gt;
        # expect(response).to redirect_to '/reputation_web_service/client'&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Future Tasks ==&lt;br /&gt;
As our team was not able to obtain the public/private key pair to access the reputation web service, we  &lt;br /&gt;
reputation_web_service_controller.rb is a fairly complex file. It contains a lot of methods that are long and hard to understand (for e.g. send_post_request). These methods need to be broken down into simpler and more specific methods that are easier to read/understand. Also, the few instances of code duplication that exist should be removed.&lt;br /&gt;
&lt;br /&gt;
# There is a lot of unused/commented code, which should be removed.&lt;br /&gt;
# Figure out what the code is doing and write appropriate comments for it.&lt;br /&gt;
# In the case of db_query, the name should say what it queries for. Also, this method not only queries, but calculates sums.  Since each method should do only one thing, the code for calculating sums should be in another method. And there should be comments in the code!&lt;br /&gt;
#json_generator should be generate_json. There needs to be a method comment saying what the parameters are.&lt;br /&gt;
# In  send_post_request, there are references to specific assignments, such as 724, 735, and 756. They were put in to gather data for a paper published in 2015. They are no longer relevant and should be removed. send_post_request is 91 lines long, far too long.&lt;br /&gt;
#There is a password for a private key in the code (and the code is open-sourced!) It should be in the db instead.&lt;br /&gt;
#Fix spelling of “dimention”&lt;br /&gt;
#client is a bad method name; why is stuff being copied from class variables to instance variables?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Collaborators ===&lt;br /&gt;
Jinku Cui (jcui23)&lt;br /&gt;
&lt;br /&gt;
Henry Chen (hchen34)&lt;br /&gt;
&lt;br /&gt;
Dong Li (dli35)&lt;br /&gt;
&lt;br /&gt;
Zijun Lu (zlu5)&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[https://doi.org/10.1109/FIE.2015.7344292 Pluggable reputation systems for peer review: A web-service approach]&lt;/div&gt;</summary>
		<author><name>Hchen34</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2168._Testing_-_Reputations&amp;diff=141929</id>
		<title>CSC/ECE 517 Fall 2021 - E2168. Testing - Reputations</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2168._Testing_-_Reputations&amp;diff=141929"/>
		<updated>2021-11-29T21:21:14Z</updated>

		<summary type="html">&lt;p&gt;Hchen34: updates testing objects&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Project Overview ==&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;q&amp;gt;Online peer-review systems are now in common use in higher education. They free the instructor and course staff from having to provide personally all the feedback that students receive on their work. However, if we want to assure that all students receive competent feedback, or even use peer-assigned grades, we need a way to judge which peer reviewers are most credible. The solution is to use a reputation system.&amp;lt;/q&amp;gt; &amp;lt;br&amp;gt; The reputation system is meant to provide objective value to student assigned peer review scores. Students select from a list of tasks to be performed and then prepare their work and submit it to a peer-review system. The work is then reviewed by other students who offer comments/graded feedback to help the submitters improve their work.&lt;br /&gt;
During the peer review period it is important to determine which reviews are more accurate and show higher quality. Reputation is one way to achieve this goal; it is a quantization measurement to judge which peer reviewers are more reliable.&lt;br /&gt;
Peer reviewers can use expertiza to score an author. If Expertiza shows a confidence ratings for grades based upon the reviewers reputation then authors can more easily determine the legitimacy of the peer assigned score. In addition, the teaching staff can examine the quality of each peer review based on reputation values and, potentially, crowd-source a significant portion of the grading function.&lt;br /&gt;
Currently the reputation system is implemented in Expertiza through web-service, but there's no test written for it. Thus our goal is to write tests to verify Hamer's and Lauw’s algorithm from the reputation system.&lt;br /&gt;
&lt;br /&gt;
=== System Design ===&lt;br /&gt;
The below is referenced from project E1625, which would give us the overall description of the reputation system.&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Diagram E1625.png|1000px]]&amp;lt;br&amp;gt;&lt;br /&gt;
There are two algorithms intended for use in calculation of the reputation values for participants. &lt;br /&gt;
&lt;br /&gt;
There is a [https://expertiza.ncsu.edu/reputation_web_service/client web-service] (the link accessible only to the instructors) available which serves a JSON response containing the reputation value based on the seed provided in the form of the last known reputation value which we store in the ''participants'' table. An instructor can specify which algorithm to use for a particular assignment to calculate the confidence rating. &lt;br /&gt;
&lt;br /&gt;
As the [https://docs.google.com/viewer?url=https%3A%2F%2Fwww.researchgate.net%2Fprofile%2FYang_Song36%2Fpublication%2F289528736_Pluggable_Reputation_Systems_for_Peer_Review_a_Web-Service_Approach%2Flinks%2F568ec8d008ae78cc05160aed.pdf%3FinViewer%3D0%26pdfJsDownload%3D0%26origin%3Dpublication_detail paper] on reputation system by observes, “the Hamer-peer algorithm has the lowest maximum absolute bias and the Lauw-peer algorithm has the lowest overall bias.This indicates, from the instructor’s perspective, if there are further assignments of this kind, expert grading may not be necessary.”&lt;br /&gt;
:;Reputation range of Hamer’s algorithm is :&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: red;&amp;quot;&amp;gt;red&amp;lt;/span&amp;gt;                   value &amp;lt; 0.5&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: yellow&amp;quot;&amp;gt;yellow&amp;lt;/span&amp;gt;              value is &amp;gt;= 0.5 and &amp;lt;= 1&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: orange&amp;quot;&amp;gt;orange&amp;lt;/span&amp;gt;             value is &amp;gt; 1 and &amp;lt;= 1.5&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: HoneyDew&amp;quot;&amp;gt;light green&amp;lt;/span&amp;gt;       value is &amp;gt; 1.5 and &amp;lt;= 2&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: Chartreuse&amp;quot;&amp;gt;green&amp;lt;/span&amp;gt;               value is &amp;gt; 2&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The main difference between the Hamer-peer and the Lauw-peer algorithm is that the Lauw-peer algorithm keeps track of the reviewer's leniency (“bias”), which can be either positive or negative. A positive leniency indicates the reviewer tends to give higher scores than average.  This project determines reputation by subtracting the absolute value of the leniency from 1. Additionally, the range for Hamer’s algorithm is (0,∞) while for Lauw’s algorithm it is [0,1]. &lt;br /&gt;
:;Reputation range of Lauw’s algorithm is&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: red&amp;quot;&amp;gt;red&amp;lt;/span&amp;gt;                   value is &amp;lt; 0.2&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: yellow&amp;quot;&amp;gt;yellow&amp;lt;/span&amp;gt;              value is &amp;gt;= 0.2 and &amp;lt;= 0.4&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: orange&amp;quot;&amp;gt;orange&amp;lt;/span&amp;gt;             value is &amp;gt; 0.4 and &amp;lt;= 0.6&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: HoneyDew&amp;quot;&amp;gt;light green&amp;lt;/span&amp;gt;       value is &amp;gt; 0.6 and &amp;lt;= 0.8&lt;br /&gt;
:&amp;lt;span style=&amp;quot;background-color: Chartreuse&amp;quot;&amp;gt;green&amp;lt;/span&amp;gt;               value is &amp;gt; 0.8&lt;br /&gt;
&lt;br /&gt;
The instructor can choose to show results from Hamer’s algorithm or Lauw’s algorithm. The default algorithm should be Lauw’s algorithm.&lt;br /&gt;
&lt;br /&gt;
=== Objectives ===&lt;br /&gt;
&lt;br /&gt;
Our objectives for this project are the following:&lt;br /&gt;
* Double and stub an assignment, a few submissions to the assignment, under different review rubrics&lt;br /&gt;
* Manually calculate reputation scores based on paper &amp;quot;Pluggable reputation systems for peer review: A web-service approach&amp;quot;&lt;br /&gt;
* Validate correct reputation scores based on different review rubrics generated by reputation management VS manual computation of reputation score expectation on different reputation range of Hamer's and Lauw's algorithm with or without instructor score impact.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
*reputation_web_service_controller_spec&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
=== Testing Objects ===&lt;br /&gt;
In order to implement testing on reputation, it is crucial to create sample reviews so that we could possibly obtain reputation score. During the kickoff meeting, our team defined four necessary steps to follow for the purpose of testing. Also, appropriate objects could be created and confined as discussed below.&lt;br /&gt;
&lt;br /&gt;
==== 1. Setup Assignment ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[assignments]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Essential Parameters to be configured&amp;lt;br&amp;gt;&lt;br /&gt;
submitter_count = 0;&amp;lt;br&amp;gt;&lt;br /&gt;
num_reviews = 5;&amp;lt;br&amp;gt;&lt;br /&gt;
num_reviewers = 5;&amp;lt;br&amp;gt;&lt;br /&gt;
num_reviews_allowed = 5;&amp;lt;br&amp;gt;&lt;br /&gt;
rounds_of_reviews = 2;&amp;lt;br&amp;gt;&lt;br /&gt;
reputation_algorithm = lauw/hamer;&amp;lt;br&amp;gt;&lt;br /&gt;
Note: Two assignment objects were created. Assignment_1 used lauw's algorithm, whereas assignment_2 used hamer's alogorithm.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @assignment_1 = create(:assignment, created_at: DateTime.now.in_time_zone - 13.day, submitter_count: 0, num_reviews: 3, num_reviewers: 5, num_reviews_allowed: 5, rounds_of_reviews: 2, reputation_algorithm: 'lauw', id: 1)&lt;br /&gt;
  @assignment_2 = create(:assignment, created_at: DateTime.now.in_time_zone - 13.day, submitter_count: 0, num_reviews: 3, num_reviewers: 5, num_reviews_allowed: 5, rounds_of_reviews: 2, reputation_algorithm: 'hamer', id: 2)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== 2. Setup Questionnaires(Rubrics) ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[questionnaires]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[assignment_questionnaires]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Essential Parameters to be configured&amp;lt;br&amp;gt;&lt;br /&gt;
instructor_id = from_fixture;&amp;lt;br&amp;gt;&lt;br /&gt;
min_question_score = 0;&amp;lt;br&amp;gt;&lt;br /&gt;
max_question_score = 5;&amp;lt;br&amp;gt;&lt;br /&gt;
type = ReviewQuestionnaire;&amp;lt;br&amp;gt;&lt;br /&gt;
Note: We will define the assignment with ReviewQuestionnaire type rubric. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @questionnaire_1 = create(:questionnaire, min_question_score: 0, max_question_score: 5, type: 'ReviewQuestionnaire', id: 1)&lt;br /&gt;
  @assignment_questionnaire_1_1 = create(:assignment_questionnaire, assignment_id: @assignment_1.id, questionnaire_id: @questionnaire_1.id, used_in_round: 1)&lt;br /&gt;
  @assignment_questionnaire_1_2 = create(:assignment_questionnaire, assignment_id: @assignment_1.id, questionnaire_id: @questionnaire_1.id, used_in_round: 2)&lt;br /&gt;
  @assignment_questionnaire_2_1 = create(:assignment_questionnaire, assignment_id: @assignment_2.id, questionnaire_id: @questionnaire_1.id, used_in_round: 1)&lt;br /&gt;
  @assignment_questionnaire_2_2 = create(:assignment_questionnaire, assignment_id: @assignment_2.id, questionnaire_id: @questionnaire_1.id, used_in_round: 2, id: 4)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== 3. Setup Questions under Questionnaires ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[questions]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @question_1_1 = create(:question, questionnaire_id: @questionnaire_1.id, id: 1)&lt;br /&gt;
  @question_1_2 = create(:question, questionnaire_id: @questionnaire_1.id, id: 2)&lt;br /&gt;
  @question_1_3 = create(:question, questionnaire_id: @questionnaire_1.id, id: 3)&lt;br /&gt;
  @question_1_4 = create(:question, questionnaire_id: @questionnaire_1.id, id: 4)&lt;br /&gt;
  @question_1_5 = create(:question, questionnaire_id: @questionnaire_1.id, id: 5)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== 4. Setup Reviewers and Reviewees ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[participants]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[teams]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
Reviewers (Participant):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @reviewer_1 = create(:participant, can_review: 1)&lt;br /&gt;
  @reviewer_2 = create(:participant, can_review: 1)&lt;br /&gt;
  @reviewer_3 = create(:participant, can_review: 1)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Reviewees (Teams):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @reviewee_1 = create(:assignment_team, assignment: @assignment)&lt;br /&gt;
  @reviewee_2 = create(:assignment_team, assignment: @assignment)&lt;br /&gt;
  @reviewee_3 = create(:assignment_team, assignment: @assignment)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== 5. Setup Responses ====&lt;br /&gt;
* Objects involved &amp;lt;br&amp;gt;&lt;br /&gt;
[[response_maps]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[responses]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Essential Parameters to be configured&amp;lt;br&amp;gt;&lt;br /&gt;
reviewed_object_id = assignment_id;&amp;lt;br&amp;gt;&lt;br /&gt;
reviewer_id = participants;&amp;lt;br&amp;gt;&lt;br /&gt;
reviewee_id = AssignmentTeam;&amp;lt;br&amp;gt;&lt;br /&gt;
Note: we will setup response map to determine relationship between reviewer and reviewee of an assignment.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Code Implemented &amp;lt;br&amp;gt;&lt;br /&gt;
Response_maps:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @response_map_1_1 = create(:review_response_map, reviewer_id: @reviewer_1.id, reviewee_id: @reviewee_1.id)&lt;br /&gt;
  @response_map_1_2 = create(:review_response_map, reviewer_id: @reviewer_2.id, reviewee_id: @reviewee_1.id)&lt;br /&gt;
  @response_map_1_3 = create(:review_response_map, reviewer_id: @reviewer_3.id, reviewee_id: @reviewee_1.id)&lt;br /&gt;
&lt;br /&gt;
  @response_map_2_1 = create(:review_response_map, reviewer_id: @reviewer_1.id, reviewee_id: @reviewee_2.id)&lt;br /&gt;
  @response_map_2_2 = create(:review_response_map, reviewer_id: @reviewer_2.id, reviewee_id: @reviewee_2.id)&lt;br /&gt;
  @response_map_2_3 = create(:review_response_map, reviewer_id: @reviewer_3.id, reviewee_id: @reviewee_2.id)&lt;br /&gt;
&lt;br /&gt;
  @response_map_3_1 = create(:review_response_map, reviewer_id: @reviewer_1.id, reviewee_id: @reviewee_3.id)&lt;br /&gt;
  @response_map_3_2 = create(:review_response_map, reviewer_id: @reviewer_2.id, reviewee_id: @reviewee_3.id)&lt;br /&gt;
  @response_map_3_3 = create(:review_response_map, reviewer_id: @reviewer_3.id, reviewee_id: @reviewee_3.id)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Responses:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  @response_1_1 = create(:response, is_submitted: true, map_id: @response_map_1_1.id)&lt;br /&gt;
  @response_1_2 = create(:response, is_submitted: true, map_id: @response_map_1_2.id)&lt;br /&gt;
  @response_1_3 = create(:response, is_submitted: true, map_id: @response_map_1_3.id)&lt;br /&gt;
&lt;br /&gt;
  @response_2_1 = create(:response, is_submitted: true, map_id: @response_map_2_1.id)&lt;br /&gt;
  @response_2_2 = create(:response, is_submitted: true, map_id: @response_map_2_2.id)&lt;br /&gt;
  @response_2_3 = create(:response, is_submitted: true, map_id: @response_map_2_3.id)&lt;br /&gt;
&lt;br /&gt;
  @response_3_1 = create(:response, is_submitted: true, map_id: @response_map_3_1.id)&lt;br /&gt;
  @response_3_2 = create(:response, is_submitted: true, map_id: @response_map_3_2.id)&lt;br /&gt;
  @response_3_3 = create(:response, is_submitted: true, map_id: @response_map_3_3.id)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The manifestation of each object will contribute to the success of the following test on reputations. Some fields in each object can be empty or have default values. Some attributes are not relevant to the test. When implementing the test, the test scripts need to generate or set fixed values for corresponding fields.&lt;br /&gt;
&lt;br /&gt;
=== Relevant Methods ===&lt;br /&gt;
==== ReputationController_spec ====&lt;br /&gt;
*db_query&lt;br /&gt;
This is the normal db query method, call this method will return peer review grades with given assignment id.&lt;br /&gt;
We will test this method in two aspect. 1. Test whether or not the grade return is right based on the specified algorithm.&lt;br /&gt;
2. We need to test the correctness of the query.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    context 'test db_query' do&lt;br /&gt;
      it 'return average score' do&lt;br /&gt;
        create(:answer, question_id: @question_1_1.id, response_id: @response_1_1.id, answer: 1)&lt;br /&gt;
        create(:answer, question_id: @question_1_2.id, response_id: @response_1_1.id, answer: 2)&lt;br /&gt;
        create(:answer, question_id: @question_1_3.id, response_id: @response_1_1.id, answer: 3)&lt;br /&gt;
        create(:answer, question_id: @question_1_4.id, response_id: @response_1_1.id, answer: 4)&lt;br /&gt;
        create(:answer, question_id: @question_1_5.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
        result = ReputationWebServiceController.new.db_query(1, 1, false)&lt;br /&gt;
        expect(result).to eq([[2, 1, 60.0]])&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*json_generator&lt;br /&gt;
This method will generate the hash format of the review, we will test this method by calling to and convert the result to json format the print to test its correctness.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    context 'test json_generator' do&lt;br /&gt;
      it 'test 3 reviewer for one reviewee' do&lt;br /&gt;
        # reivewer_1's review for reviewee_1: [5, 5, 5, 5, 5]&lt;br /&gt;
        create(:answer, question_id: @question_1_1.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
        create(:answer, question_id: @question_1_2.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
        create(:answer, question_id: @question_1_3.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
        create(:answer, question_id: @question_1_4.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
        create(:answer, question_id: @question_1_5.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
&lt;br /&gt;
        # reivewer_2's review for reviewee_1: [3, 3, 3, 3, 3]&lt;br /&gt;
        create(:answer, question_id: @question_1_1.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
        create(:answer, question_id: @question_1_2.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
        create(:answer, question_id: @question_1_3.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
        create(:answer, question_id: @question_1_4.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
        create(:answer, question_id: @question_1_5.id, response_id: @response_1_2.id, answer: 3)&lt;br /&gt;
&lt;br /&gt;
        # reivewer_3's review for reviewee_1: [1, 1, 1, 1, 1]&lt;br /&gt;
        create(:answer, question_id: @question_1_1.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
        create(:answer, question_id: @question_1_2.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
        create(:answer, question_id: @question_1_3.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
        create(:answer, question_id: @question_1_4.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
        create(:answer, question_id: @question_1_5.id, response_id: @response_1_3.id, answer: 1)&lt;br /&gt;
&lt;br /&gt;
        #result = ReputationWebServiceController.new.db_query(1, 1, false)&lt;br /&gt;
        #expect(result).to eq([[2, 1, 100.0], [3, 1, 60.0], [4, 1, 20.0]])&lt;br /&gt;
        result = ReputationWebServiceController.new.json_generator(1, 0, 1)&lt;br /&gt;
        expect(result).to eq({&amp;quot;submission1&amp;quot;=&amp;gt;{&amp;quot;stu2&amp;quot;=&amp;gt;100.0, &amp;quot;stu3&amp;quot;=&amp;gt;60.0, &amp;quot;stu4&amp;quot;=&amp;gt;20.0}})&lt;br /&gt;
        #repeat for different answers&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      it 'test same reviewer for different reviewee' do&lt;br /&gt;
        # reivewer_1's review for reviewee_1: [5, 5, 5, 5, 5]&lt;br /&gt;
        create(:answer, question_id: @question_1_1.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
        create(:answer, question_id: @question_1_2.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
        create(:answer, question_id: @question_1_3.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
        create(:answer, question_id: @question_1_4.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
        create(:answer, question_id: @question_1_5.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
&lt;br /&gt;
        # reivewer_1's review for reviewee_2: [3, 3, 3, 3, 3]&lt;br /&gt;
        create(:answer, question_id: @question_1_1.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
        create(:answer, question_id: @question_1_2.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
        create(:answer, question_id: @question_1_3.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
        create(:answer, question_id: @question_1_4.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
        create(:answer, question_id: @question_1_5.id, response_id: @response_2_1.id, answer: 3)&lt;br /&gt;
&lt;br /&gt;
        result = ReputationWebServiceController.new.json_generator(1, 0, 1)&lt;br /&gt;
        expect(result).to eq(&amp;quot;submission1&amp;quot;=&amp;gt;{&amp;quot;stu2&amp;quot;=&amp;gt;100.0}, &amp;quot;submission2&amp;quot;=&amp;gt;{&amp;quot;stu2&amp;quot;=&amp;gt;60.0})&lt;br /&gt;
        #repeat for different answers&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*send_post_request&lt;br /&gt;
This method send a post request to peerlogic.csc.ncsu.edu/reputation/calculations/reputation_algorithms to calculate get the reputation result and use show the result &lt;br /&gt;
in corresponding UI and update given reviewer's reputation. We will test this method based on the algorithm in the paper, first to test the result reputation value, second to test the&lt;br /&gt;
update value in database.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    context 'test send_post_request' do&lt;br /&gt;
      it 'failed because of no public key file' do&lt;br /&gt;
        # reivewer_1's review for reviewee_1: [5, 5, 5, 5, 5]&lt;br /&gt;
        create(:answer, question_id: @question_1_1.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
        create(:answer, question_id: @question_1_2.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
        create(:answer, question_id: @question_1_3.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
        create(:answer, question_id: @question_1_4.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
        create(:answer, question_id: @question_1_5.id, response_id: @response_1_1.id, answer: 5)&lt;br /&gt;
&lt;br /&gt;
        params = {assignment_id: 1, round_num: 1, algorithm: 'hammer', checkbox: {expert_grade: &amp;quot;empty&amp;quot;}}&lt;br /&gt;
        session = {user: build(:instructor, id: 1)}&lt;br /&gt;
&lt;br /&gt;
        expect(true).to eq(true)&lt;br /&gt;
&lt;br /&gt;
        # comment out because send_post_request method request public key file while this file is missing&lt;br /&gt;
        # so at this time send_post_request is not functioning normally&lt;br /&gt;
        # get :send_post_request, params, session&lt;br /&gt;
        # expect(response).to redirect_to '/reputation_web_service/client'&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Future Tasks ==&lt;br /&gt;
As our team was not able to obtain the public/private key pair to access the reputation web service, we  &lt;br /&gt;
reputation_web_service_controller.rb is a fairly complex file. It contains a lot of methods that are long and hard to understand (for e.g. send_post_request). These methods need to be broken down into simpler and more specific methods that are easier to read/understand. Also, the few instances of code duplication that exist should be removed.&lt;br /&gt;
&lt;br /&gt;
# There is a lot of unused/commented code, which should be removed.&lt;br /&gt;
# Figure out what the code is doing and write appropriate comments for it.&lt;br /&gt;
# In the case of db_query, the name should say what it queries for. Also, this method not only queries, but calculates sums.  Since each method should do only one thing, the code for calculating sums should be in another method. And there should be comments in the code!&lt;br /&gt;
#json_generator should be generate_json. There needs to be a method comment saying what the parameters are.&lt;br /&gt;
# In  send_post_request, there are references to specific assignments, such as 724, 735, and 756. They were put in to gather data for a paper published in 2015. They are no longer relevant and should be removed. send_post_request is 91 lines long, far too long.&lt;br /&gt;
#There is a password for a private key in the code (and the code is open-sourced!) It should be in the db instead.&lt;br /&gt;
#Fix spelling of “dimention”&lt;br /&gt;
#client is a bad method name; why is stuff being copied from class variables to instance variables?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Collaborators ===&lt;br /&gt;
Jinku Cui (jcui23)&lt;br /&gt;
&lt;br /&gt;
Henry Chen (hchen34)&lt;br /&gt;
&lt;br /&gt;
Dong Li (dli35)&lt;br /&gt;
&lt;br /&gt;
Zijun Lu (zlu5)&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[https://doi.org/10.1109/FIE.2015.7344292 Pluggable reputation systems for peer review: A web-service approach]&lt;/div&gt;</summary>
		<author><name>Hchen34</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2168._Testing_-_Reputations&amp;diff=141382</id>
		<title>CSC/ECE 517 Fall 2021 - E2168. Testing - Reputations</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2168._Testing_-_Reputations&amp;diff=141382"/>
		<updated>2021-11-09T02:22:40Z</updated>

		<summary type="html">&lt;p&gt;Hchen34: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Project Overview ==&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;q&amp;gt;Online peer-review systems are now in common use in higher education. They free the instructor and course staff from having to provide personally all the feedback that students receive on their work. However, if we want to assure that all students receive competent feedback, or even use peer-assigned grades, we need a way to judge which peer reviewers are most credible. The solution is to use a reputation system.&amp;lt;/q&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
Currently the reputation system is implemented in Expertiza through web-service, but there's no test written for it. Thus our goal is to write tests to verify the reputation system.&lt;br /&gt;
&lt;br /&gt;
=== Objectives ===&lt;br /&gt;
&lt;br /&gt;
Our objectives for this project are the following:&lt;br /&gt;
* Double and stub an assignment, a few submissions to the assignment, under different review rubrics&lt;br /&gt;
* Manually calculate reputation scores based on paper &amp;quot;Pluggable reputation systems for peer review: A web-service approach&amp;quot;&lt;br /&gt;
* Validate correct reputation scores based on different review rubrics generated by reputation management VS manual computation of reputation score expectation&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
*reputation_web_service_controller_spec&lt;br /&gt;
&lt;br /&gt;
=== Project Design ===&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
=== Testing Objects ===&lt;br /&gt;
In order to implement testing on reputation, it is essential to create sample reviews so that we could possibly obtain reputation score. During the kickoff meeting, our team defined five necessary steps to follow for the purpose of testing. Also, appropriate objects could be created and confined as discussed below.&lt;br /&gt;
&lt;br /&gt;
1 : Setup Assignment&lt;br /&gt;
&lt;br /&gt;
[[File:Assignment imported.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
*[[assignments]]&amp;lt;br&amp;gt;&lt;br /&gt;
- Essential Parameters to be configured&amp;lt;br&amp;gt;&lt;br /&gt;
submitter_count	= 0;&amp;lt;br&amp;gt;&lt;br /&gt;
num_reviews = 3;&amp;lt;br&amp;gt;&lt;br /&gt;
staggerred_deadline = false;&amp;lt;br&amp;gt;&lt;br /&gt;
rounds_of_reviews = 2;&amp;lt;br&amp;gt;&lt;br /&gt;
reputation_algorithm = lauw; (Lauw only, Hamer is currently out of scope)&amp;lt;br&amp;gt;&lt;br /&gt;
Note: We will create multiple two-round review assignment objects with 3 reviews required done per students. Because the Hamer was migrated to a web service from Expertiza code base, we are only required to test on the Lauw algorithm only.&amp;lt;br&amp;gt;&lt;br /&gt;
2. Submission to Assignment&lt;br /&gt;
*[[submission_records]]&amp;lt;br&amp;gt;&lt;br /&gt;
- Essential Parameters to be configured&amp;lt;br&amp;gt;&lt;br /&gt;
content = website_link;&amp;lt;br&amp;gt;&lt;br /&gt;
Note: We will have to check on how submission is determined by the system. The initial thought is to just submit a website. However, the alternative way might be check on the directory number.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Setup Questionnaires/Rubrics&amp;lt;br&amp;gt;&lt;br /&gt;
*[[questionnaires]]&amp;lt;br&amp;gt;&lt;br /&gt;
*[[assignment_questionnaires]]&amp;lt;br&amp;gt;&lt;br /&gt;
- Essential Parameters to be configured&amp;lt;br&amp;gt;&lt;br /&gt;
instructor_id = from_fixture;&amp;lt;br&amp;gt;&lt;br /&gt;
min_question_score = 0;&amp;lt;br&amp;gt;&lt;br /&gt;
max_question_score = 5;&amp;lt;br&amp;gt;&lt;br /&gt;
default_num_choices =100;&amp;lt;br&amp;gt;&lt;br /&gt;
type = ReviewQuestionnaire;&amp;lt;br&amp;gt;&lt;br /&gt;
Note: We will define the assignment with ReviewQuestionnaire type rubric. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4. Setup response map&amp;lt;br&amp;gt;&lt;br /&gt;
*[[participants]]&amp;lt;br&amp;gt;&lt;br /&gt;
*[[teams]]&amp;lt;br&amp;gt;&lt;br /&gt;
*[[teams_users]]&amp;lt;br&amp;gt;&lt;br /&gt;
*[[users]]&amp;lt;br&amp;gt;&lt;br /&gt;
*[[responses]]&amp;lt;br&amp;gt;&lt;br /&gt;
*[[response_maps]]&amp;lt;br&amp;gt;&lt;br /&gt;
- Essential Parameters to be configured&amp;lt;br&amp;gt;&lt;br /&gt;
reviewed_object_id = assignment_id;&amp;lt;br&amp;gt;&lt;br /&gt;
reviewer_id = participants;&lt;br /&gt;
reviewee_id = AssignmentTeam;&lt;br /&gt;
Note: we will setup response map to determine relationship between reviewer and reviewee of an assignment.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The manifestation of each object will contribute to the success of the following test on reputations. Some fields in each object can be empty or have default values. Some attributes are not relevant to the test. When implementing the test, the test scripts need to generate or set fixed values for corresponding fields.&lt;br /&gt;
&lt;br /&gt;
=== Relevant Methods ===&lt;br /&gt;
==== ReputationController_spec ====&lt;br /&gt;
*db_query&lt;br /&gt;
This is the normal db query method, call this method will return peer review grades with given assignment id.&lt;br /&gt;
We will test this method in two aspect. 1. Test whether or not the grade return is right based on the specified algorithm.&lt;br /&gt;
2. We need to test the correctness of the query.&lt;br /&gt;
&lt;br /&gt;
*db_query_with_quiz_score&lt;br /&gt;
This is the special db query, call this method will return quiz scores with given assignment id. We will test this method with same logic as the first one.&lt;br /&gt;
&lt;br /&gt;
*json_generator&lt;br /&gt;
This method will generate the hash format of the review, we will test this method by calling to and convert the result to json format the print to test its correctness.&lt;br /&gt;
&lt;br /&gt;
*client&lt;br /&gt;
client method will fill many instance variables with corresponding class variables, we need to test this method with send_post_request.&lt;br /&gt;
&lt;br /&gt;
*send_post_request&lt;br /&gt;
This method send a post request to peerlogic.csc.ncsu.edu/reputation/calculations/reputation_algorithms to calculate get the reputation result and use show the result &lt;br /&gt;
in corresponding UI and update given reviewer's reputation. We will test this method based on the algorithm in the paper, first to test the result reputation value, second to test the&lt;br /&gt;
update value in database.&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
=== Collaborators ===&lt;br /&gt;
Jinku Cui (jcui23)&lt;br /&gt;
&lt;br /&gt;
Henry Chen (hchen34)&lt;br /&gt;
&lt;br /&gt;
Dong Li (dli35)&lt;br /&gt;
&lt;br /&gt;
Zijun Lu (zlu5)&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[https://doi.org/10.1109/FIE.2015.7344292 Pluggable reputation systems for peer review: A web-service approach]&lt;/div&gt;</summary>
		<author><name>Hchen34</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2168._Testing_-_Reputations&amp;diff=140971</id>
		<title>CSC/ECE 517 Fall 2021 - E2168. Testing - Reputations</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2168._Testing_-_Reputations&amp;diff=140971"/>
		<updated>2021-11-05T02:50:27Z</updated>

		<summary type="html">&lt;p&gt;Hchen34: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Project Overview ==&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;q&amp;gt;Online peer-review systems are now in common use in higher education. They free the instructor and course staff from having to provide personally all the feedback that students receive on their work. However, if we want to assure that all students receive competent feedback, or even use peer-assigned grades, we need a way to judge which peer reviewers are most credible. The solution is to use a reputation system.&amp;lt;/q&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
Currently the reputation system is implemented in Expertiza through web-service, but there's no test written for it. Thus our goal is to write tests to verify the reputation system.&lt;br /&gt;
&lt;br /&gt;
=== Objectives ===&lt;br /&gt;
&lt;br /&gt;
Our objectives for this project are the following:&lt;br /&gt;
* Double and stub an assignment, a few submissions to the assignment, under different review rubrics&lt;br /&gt;
* Manually calculate reputation scores based on paper &amp;quot;Pluggable reputation systems for peer review: A web-service approach&amp;quot;&lt;br /&gt;
* Validate correct reputation scores based on different review rubrics generated by reputation management VS manual computation of reputation score expectation&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
*reputation_web_service_controller_spec&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
=== Testing Objects ===&lt;br /&gt;
Following objects will be created and confined for the purpose of testing. &lt;br /&gt;
&lt;br /&gt;
*[[assignments]]&amp;lt;br&amp;gt;&lt;br /&gt;
*[[submission_records]]&amp;lt;br&amp;gt;&lt;br /&gt;
*[[questionnaires]]&amp;lt;br&amp;gt;&lt;br /&gt;
*[[assignment_questionnaires]]&amp;lt;br&amp;gt;&lt;br /&gt;
*[[participants]]&amp;lt;br&amp;gt;&lt;br /&gt;
*[[teams]]&amp;lt;br&amp;gt;&lt;br /&gt;
*[[teams_users]]&amp;lt;br&amp;gt;&lt;br /&gt;
*[[users]]&amp;lt;br&amp;gt;&lt;br /&gt;
*[[responses]]&amp;lt;br&amp;gt;&lt;br /&gt;
*[[response_maps]]&lt;br /&gt;
&lt;br /&gt;
The manifestation of each object will contribute to the success of the following test on reputations. Some fields in each object can be empty or have default values. Some attributes are not relevant to the test. When implementing the test, the test scripts need to generate or set fixed values for corresponding fields.&lt;br /&gt;
&lt;br /&gt;
=== Relevant Methods ===&lt;br /&gt;
==== ReputationController_spec ====&lt;br /&gt;
*db_query&lt;br /&gt;
This is the normal db query method, call this method will return peer review grades with given assignment id.&lt;br /&gt;
We will test this method in two aspect. 1. Test whether or not the grade return is right based on the specified algorithm.&lt;br /&gt;
2. We need to test the correctness of the query.&lt;br /&gt;
&lt;br /&gt;
*db_query_with_quiz_score&lt;br /&gt;
This is the special db query, call this method will return quiz scores with given assignment id. We will test this method with same logic as the first one.&lt;br /&gt;
&lt;br /&gt;
*json_generator&lt;br /&gt;
This method will generate the hash format of the review, we will test this method by calling to and convert the result to json format the print to test its correctness.&lt;br /&gt;
&lt;br /&gt;
*client&lt;br /&gt;
client method will fill many instance variables with corresponding class variables, we need to test this method with send_post_request.&lt;br /&gt;
&lt;br /&gt;
*send_post_request&lt;br /&gt;
This method send a post request to peerlogic.csc.ncsu.edu/reputation/calculations/reputation_algorithms to calculate get the reputation result and use show the result &lt;br /&gt;
in corresponding UI and update given reviewer's reputation. We will test this method based on the algorithm in the paper, first to test the result reputation value, second to test the&lt;br /&gt;
update value in database.&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
=== Collaborators ===&lt;br /&gt;
Jinku Cui (jcui23)&lt;br /&gt;
&lt;br /&gt;
Henry Chen (hchen34)&lt;br /&gt;
&lt;br /&gt;
Dong Li (dli35)&lt;br /&gt;
&lt;br /&gt;
Zijun Lu (zlu5)&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[https://doi.org/10.1109/FIE.2015.7344292 Pluggable reputation systems for peer review: A web-service approach]&lt;/div&gt;</summary>
		<author><name>Hchen34</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2168._Testing_-_Reputations&amp;diff=140970</id>
		<title>CSC/ECE 517 Fall 2021 - E2168. Testing - Reputations</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2168._Testing_-_Reputations&amp;diff=140970"/>
		<updated>2021-11-05T02:50:04Z</updated>

		<summary type="html">&lt;p&gt;Hchen34: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Project Overview ==&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;q&amp;gt;Online peer-review systems are now in common use in higher education. They free the instructor and course staff from having to provide personally all the feedback that students receive on their work. However, if we want to assure that all students receive competent feedback, or even use peer-assigned grades, we need a way to judge which peer reviewers are most credible. The solution is to use a reputation system.&amp;lt;/q&amp;gt;&lt;br /&gt;
Currently the reputation system is implemented in Expertiza through web-service, but there's no test written for it. Thus our goal is to write tests to verify the reputation system.&lt;br /&gt;
&lt;br /&gt;
=== Objectives ===&lt;br /&gt;
&lt;br /&gt;
Our objectives for this project are the following:&lt;br /&gt;
* Double and stub an assignment, a few submissions to the assignment, under different review rubrics&lt;br /&gt;
* Manually calculate reputation scores based on paper &amp;quot;Pluggable reputation systems for peer review: A web-service approach&amp;quot;&lt;br /&gt;
* Validate correct reputation scores based on different review rubrics generated by reputation management VS manual computation of reputation score expectation&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
*reputation_web_service_controller_spec&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
=== Testing Objects ===&lt;br /&gt;
Following objects will be created and confined for the purpose of testing. &lt;br /&gt;
&lt;br /&gt;
*[[assignments]]&amp;lt;br&amp;gt;&lt;br /&gt;
*[[submission_records]]&amp;lt;br&amp;gt;&lt;br /&gt;
*[[questionnaires]]&amp;lt;br&amp;gt;&lt;br /&gt;
*[[assignment_questionnaires]]&amp;lt;br&amp;gt;&lt;br /&gt;
*[[participants]]&amp;lt;br&amp;gt;&lt;br /&gt;
*[[teams]]&amp;lt;br&amp;gt;&lt;br /&gt;
*[[teams_users]]&amp;lt;br&amp;gt;&lt;br /&gt;
*[[users]]&amp;lt;br&amp;gt;&lt;br /&gt;
*[[responses]]&amp;lt;br&amp;gt;&lt;br /&gt;
*[[response_maps]]&lt;br /&gt;
&lt;br /&gt;
The manifestation of each object will contribute to the success of the following test on reputations. Some fields in each object can be empty or have default values. Some attributes are not relevant to the test. When implementing the test, the test scripts need to generate or set fixed values for corresponding fields.&lt;br /&gt;
&lt;br /&gt;
=== Relevant Methods ===&lt;br /&gt;
==== ReputationController_spec ====&lt;br /&gt;
*db_query&lt;br /&gt;
This is the normal db query method, call this method will return peer review grades with given assignment id.&lt;br /&gt;
We will test this method in two aspect. 1. Test whether or not the grade return is right based on the specified algorithm.&lt;br /&gt;
2. We need to test the correctness of the query.&lt;br /&gt;
&lt;br /&gt;
*db_query_with_quiz_score&lt;br /&gt;
This is the special db query, call this method will return quiz scores with given assignment id. We will test this method with same logic as the first one.&lt;br /&gt;
&lt;br /&gt;
*json_generator&lt;br /&gt;
This method will generate the hash format of the review, we will test this method by calling to and convert the result to json format the print to test its correctness.&lt;br /&gt;
&lt;br /&gt;
*client&lt;br /&gt;
client method will fill many instance variables with corresponding class variables, we need to test this method with send_post_request.&lt;br /&gt;
&lt;br /&gt;
*send_post_request&lt;br /&gt;
This method send a post request to peerlogic.csc.ncsu.edu/reputation/calculations/reputation_algorithms to calculate get the reputation result and use show the result &lt;br /&gt;
in corresponding UI and update given reviewer's reputation. We will test this method based on the algorithm in the paper, first to test the result reputation value, second to test the&lt;br /&gt;
update value in database.&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
=== Collaborators ===&lt;br /&gt;
Jinku Cui (jcui23)&lt;br /&gt;
&lt;br /&gt;
Henry Chen (hchen34)&lt;br /&gt;
&lt;br /&gt;
Dong Li (dli35)&lt;br /&gt;
&lt;br /&gt;
Zijun Lu (zlu5)&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[https://doi.org/10.1109/FIE.2015.7344292 Pluggable reputation systems for peer review: A web-service approach]&lt;/div&gt;</summary>
		<author><name>Hchen34</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2168._Testing_-_Reputations&amp;diff=140969</id>
		<title>CSC/ECE 517 Fall 2021 - E2168. Testing - Reputations</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2168._Testing_-_Reputations&amp;diff=140969"/>
		<updated>2021-11-05T02:48:48Z</updated>

		<summary type="html">&lt;p&gt;Hchen34: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Project Overview ==&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Online peer-review systems are now in common use in higher education. They free the instructor and course staff from having to provide personally all the feedback that students receive on their work. However, if we want to assure that all students receive competent feedback, or even use peer-assigned grades, we need a way to judge which peer reviewers are most credible. The solution is to use a reputation system.&amp;lt;/p&amp;gt;&lt;br /&gt;
Currently the reputation system is implemented in Expertiza through web-service, but there's no test written for it. Thus our goal is to write tests to verify the reputation system.&lt;br /&gt;
&lt;br /&gt;
=== Objectives ===&lt;br /&gt;
&lt;br /&gt;
Our objectives for this project are the following:&lt;br /&gt;
* Double and stub an assignment, a few submissions to the assignment, under different review rubrics&lt;br /&gt;
* Manually calculate reputation scores based on paper &amp;quot;Pluggable reputation systems for peer review: A web-service approach&amp;quot;&lt;br /&gt;
* Validate correct reputation scores based on different review rubrics generated by reputation management VS manual computation of reputation score expectation&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
*reputation_web_service_controller_spec&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
=== Testing Objects ===&lt;br /&gt;
Following objects will be created and confined for the purpose of testing. &lt;br /&gt;
&lt;br /&gt;
*[[assignments]]&amp;lt;br&amp;gt;&lt;br /&gt;
*[[submission_records]]&amp;lt;br&amp;gt;&lt;br /&gt;
*[[questionnaires]]&amp;lt;br&amp;gt;&lt;br /&gt;
*[[assignment_questionnaires]]&amp;lt;br&amp;gt;&lt;br /&gt;
*[[participants]]&amp;lt;br&amp;gt;&lt;br /&gt;
*[[teams]]&amp;lt;br&amp;gt;&lt;br /&gt;
*[[teams_users]]&amp;lt;br&amp;gt;&lt;br /&gt;
*[[users]]&amp;lt;br&amp;gt;&lt;br /&gt;
*[[responses]]&amp;lt;br&amp;gt;&lt;br /&gt;
*[[response_maps]]&lt;br /&gt;
&lt;br /&gt;
The manifestation of each object will contribute to the success of the following test on reputations. Some fields in each object can be empty or have default values. Some attributes are not relevant to the test. When implementing the test, the test scripts need to generate or set fixed values for corresponding fields.&lt;br /&gt;
&lt;br /&gt;
=== Relevant Methods ===&lt;br /&gt;
==== ReputationController_spec ====&lt;br /&gt;
*db_query&lt;br /&gt;
This is the normal db query method, call this method will return peer review grades with given assignment id.&lt;br /&gt;
We will test this method in two aspect. 1. Test whether or not the grade return is right based on the specified algorithm.&lt;br /&gt;
2. We need to test the correctness of the query.&lt;br /&gt;
&lt;br /&gt;
*db_query_with_quiz_score&lt;br /&gt;
This is the special db query, call this method will return quiz scores with given assignment id. We will test this method with same logic as the first one.&lt;br /&gt;
&lt;br /&gt;
*json_generator&lt;br /&gt;
This method will generate the hash format of the review, we will test this method by calling to and convert the result to json format the print to test its correctness.&lt;br /&gt;
&lt;br /&gt;
*client&lt;br /&gt;
client method will fill many instance variables with corresponding class variables, we need to test this method with send_post_request.&lt;br /&gt;
&lt;br /&gt;
*send_post_request&lt;br /&gt;
This method send a post request to peerlogic.csc.ncsu.edu/reputation/calculations/reputation_algorithms to calculate get the reputation result and use show the result &lt;br /&gt;
in corresponding UI and update given reviewer's reputation. We will test this method based on the algorithm in the paper, first to test the result reputation value, second to test the&lt;br /&gt;
update value in database.&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
=== Collaborators ===&lt;br /&gt;
Jinku Cui (jcui23)&lt;br /&gt;
&lt;br /&gt;
Henry Chen (hchen34)&lt;br /&gt;
&lt;br /&gt;
Dong Li (dli35)&lt;br /&gt;
&lt;br /&gt;
Zijun Lu (zlu5)&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[https://doi.org/10.1109/FIE.2015.7344292 Pluggable reputation systems for peer review: A web-service approach]&lt;/div&gt;</summary>
		<author><name>Hchen34</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2168._Testing_-_Reputations&amp;diff=140968</id>
		<title>CSC/ECE 517 Fall 2021 - E2168. Testing - Reputations</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2168._Testing_-_Reputations&amp;diff=140968"/>
		<updated>2021-11-05T02:48:30Z</updated>

		<summary type="html">&lt;p&gt;Hchen34: added introduction to reputation system&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Project Overview ==&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Online peer-review systems are now in common use in higher education. They free the instructor and course staff from having to provide personally all the feedback that students receive on their work. However, if we want to assure that all students receive competent feedback, or even use peer-assigned grades, we need a way to judge which peer reviewers are most credible. The solution is to use a reputation system.&amp;lt;/p&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
Currently the reputation system is implemented in Expertiza through web-service, but there's no test written for it. Thus our goal is to write tests to verify the reputation system.&lt;br /&gt;
&lt;br /&gt;
=== Objectives ===&lt;br /&gt;
&lt;br /&gt;
Our objectives for this project are the following:&lt;br /&gt;
* Double and stub an assignment, a few submissions to the assignment, under different review rubrics&lt;br /&gt;
* Manually calculate reputation scores based on paper &amp;quot;Pluggable reputation systems for peer review: A web-service approach&amp;quot;&lt;br /&gt;
* Validate correct reputation scores based on different review rubrics generated by reputation management VS manual computation of reputation score expectation&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
*reputation_web_service_controller_spec&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
=== Testing Objects ===&lt;br /&gt;
Following objects will be created and confined for the purpose of testing. &lt;br /&gt;
&lt;br /&gt;
*[[assignments]]&amp;lt;br&amp;gt;&lt;br /&gt;
*[[submission_records]]&amp;lt;br&amp;gt;&lt;br /&gt;
*[[questionnaires]]&amp;lt;br&amp;gt;&lt;br /&gt;
*[[assignment_questionnaires]]&amp;lt;br&amp;gt;&lt;br /&gt;
*[[participants]]&amp;lt;br&amp;gt;&lt;br /&gt;
*[[teams]]&amp;lt;br&amp;gt;&lt;br /&gt;
*[[teams_users]]&amp;lt;br&amp;gt;&lt;br /&gt;
*[[users]]&amp;lt;br&amp;gt;&lt;br /&gt;
*[[responses]]&amp;lt;br&amp;gt;&lt;br /&gt;
*[[response_maps]]&lt;br /&gt;
&lt;br /&gt;
The manifestation of each object will contribute to the success of the following test on reputations. Some fields in each object can be empty or have default values. Some attributes are not relevant to the test. When implementing the test, the test scripts need to generate or set fixed values for corresponding fields.&lt;br /&gt;
&lt;br /&gt;
=== Relevant Methods ===&lt;br /&gt;
==== ReputationController_spec ====&lt;br /&gt;
*db_query&lt;br /&gt;
This is the normal db query method, call this method will return peer review grades with given assignment id.&lt;br /&gt;
We will test this method in two aspect. 1. Test whether or not the grade return is right based on the specified algorithm.&lt;br /&gt;
2. We need to test the correctness of the query.&lt;br /&gt;
&lt;br /&gt;
*db_query_with_quiz_score&lt;br /&gt;
This is the special db query, call this method will return quiz scores with given assignment id. We will test this method with same logic as the first one.&lt;br /&gt;
&lt;br /&gt;
*json_generator&lt;br /&gt;
This method will generate the hash format of the review, we will test this method by calling to and convert the result to json format the print to test its correctness.&lt;br /&gt;
&lt;br /&gt;
*client&lt;br /&gt;
client method will fill many instance variables with corresponding class variables, we need to test this method with send_post_request.&lt;br /&gt;
&lt;br /&gt;
*send_post_request&lt;br /&gt;
This method send a post request to peerlogic.csc.ncsu.edu/reputation/calculations/reputation_algorithms to calculate get the reputation result and use show the result &lt;br /&gt;
in corresponding UI and update given reviewer's reputation. We will test this method based on the algorithm in the paper, first to test the result reputation value, second to test the&lt;br /&gt;
update value in database.&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
=== Collaborators ===&lt;br /&gt;
Jinku Cui (jcui23)&lt;br /&gt;
&lt;br /&gt;
Henry Chen (hchen34)&lt;br /&gt;
&lt;br /&gt;
Dong Li (dli35)&lt;br /&gt;
&lt;br /&gt;
Zijun Lu (zlu5)&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[https://doi.org/10.1109/FIE.2015.7344292 Pluggable reputation systems for peer review: A web-service approach]&lt;/div&gt;</summary>
		<author><name>Hchen34</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2168._Testing_-_Reputations&amp;diff=140967</id>
		<title>CSC/ECE 517 Fall 2021 - E2168. Testing - Reputations</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2168._Testing_-_Reputations&amp;diff=140967"/>
		<updated>2021-11-05T02:37:32Z</updated>

		<summary type="html">&lt;p&gt;Hchen34: remove hamer.rb related methods&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Project Overview ==&lt;br /&gt;
&lt;br /&gt;
=== Objectives ===&lt;br /&gt;
&lt;br /&gt;
Our objectives for this project are the following:&lt;br /&gt;
* Double and stub an assignment, a few submissions to the assignment, under different review rubrics&lt;br /&gt;
* Manually calculate reputation scores based on paper &amp;quot;Pluggable reputation systems for peer review: A web-service approach&amp;quot;&lt;br /&gt;
* Validate correct reputation scores based on different review rubrics generated by reputation management VS manual computation of reputation score expectation&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
*reputation_web_service_controller_spec&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
=== Testing Objects ===&lt;br /&gt;
Following objects will be created and confined for the purpose of testing. &lt;br /&gt;
&lt;br /&gt;
*[[assignments]]&amp;lt;br&amp;gt;&lt;br /&gt;
*[[submission_records]]&amp;lt;br&amp;gt;&lt;br /&gt;
*[[questionnaires]]&amp;lt;br&amp;gt;&lt;br /&gt;
*[[assignment_questionnaires]]&amp;lt;br&amp;gt;&lt;br /&gt;
*[[participants]]&amp;lt;br&amp;gt;&lt;br /&gt;
*[[teams]]&amp;lt;br&amp;gt;&lt;br /&gt;
*[[teams_users]]&amp;lt;br&amp;gt;&lt;br /&gt;
*[[users]]&amp;lt;br&amp;gt;&lt;br /&gt;
*[[responses]]&amp;lt;br&amp;gt;&lt;br /&gt;
*[[response_maps]]&lt;br /&gt;
&lt;br /&gt;
The manifestation of each object will contribute to the success of the following test on reputations. Some fields in each object can be empty or have default values. Some attributes are not relevant to the test. When implementing the test, the test scripts need to generate or set fixed values for corresponding fields.&lt;br /&gt;
&lt;br /&gt;
=== Relevant Methods ===&lt;br /&gt;
==== ReputationController_spec ====&lt;br /&gt;
*db_query&lt;br /&gt;
This is the normal db query method, call this method will return peer review grades with given assignment id.&lt;br /&gt;
We will test this method in two aspect. 1. Test whether or not the grade return is right based on the specified algorithm.&lt;br /&gt;
2. We need to test the correctness of the query.&lt;br /&gt;
&lt;br /&gt;
*db_query_with_quiz_score&lt;br /&gt;
This is the special db query, call this method will return quiz scores with given assignment id. We will test this method with same logic as the first one.&lt;br /&gt;
&lt;br /&gt;
*json_generator&lt;br /&gt;
This method will generate the hash format of the review, we will test this method by calling to and convert the result to json format the print to test its correctness.&lt;br /&gt;
&lt;br /&gt;
*client&lt;br /&gt;
client method will fill many instance variables with corresponding class variables, we need to test this method with send_post_request.&lt;br /&gt;
&lt;br /&gt;
*send_post_request&lt;br /&gt;
This method send a post request to peerlogic.csc.ncsu.edu/reputation/calculations/reputation_algorithms to calculate get the reputation result and use show the result &lt;br /&gt;
in corresponding UI and update given reviewer's reputation. We will test this method based on the algorithm in the paper, first to test the result reputation value, second to test the&lt;br /&gt;
update value in database.&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
=== Collaborators ===&lt;br /&gt;
Jinku Cui (jcui23)&lt;br /&gt;
&lt;br /&gt;
Henry Chen (hchen34)&lt;br /&gt;
&lt;br /&gt;
Dong Li (dli35)&lt;br /&gt;
&lt;br /&gt;
Zijun Lu (zlu5)&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[https://doi.org/10.1109/FIE.2015.7344292 Pluggable reputation systems for peer review: A web-service approach]&lt;/div&gt;</summary>
		<author><name>Hchen34</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2168._Testing_-_Reputations&amp;diff=140712</id>
		<title>CSC/ECE 517 Fall 2021 - E2168. Testing - Reputations</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2168._Testing_-_Reputations&amp;diff=140712"/>
		<updated>2021-11-03T23:13:01Z</updated>

		<summary type="html">&lt;p&gt;Hchen34: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Project Overview ==&lt;br /&gt;
&lt;br /&gt;
=== Objectives ===&lt;br /&gt;
&lt;br /&gt;
Our objectives for this project are the following:&lt;br /&gt;
* Double and stub an assignment, a few submissions to the assignment, under different review rubrics&lt;br /&gt;
* Manually calculate reputation scores based on paper &amp;quot;Pluggable reputation systems for peer review: A web-service approach&amp;quot;&lt;br /&gt;
* Validate correct reputation scores based on different review rubrics generated by reputation management VS manual computation of reputation score expectation&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
*reputation_web_service_controller_spec&lt;br /&gt;
*hamer_spec&lt;br /&gt;
*&amp;lt;del&amp;gt;lauw_spec (?)&amp;lt;/del&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
=== Testing Objects ===&lt;br /&gt;
Following objects will be created and confined for the purpose of testing. &lt;br /&gt;
&lt;br /&gt;
*[[assignments]]&amp;lt;br&amp;gt;&lt;br /&gt;
*[[submission_records]]&amp;lt;br&amp;gt;&lt;br /&gt;
*[[questionnaires]]&amp;lt;br&amp;gt;&lt;br /&gt;
*[[assignment_questionnaires]]&amp;lt;br&amp;gt;&lt;br /&gt;
*[[participants]]&amp;lt;br&amp;gt;&lt;br /&gt;
*[[teams]]&amp;lt;br&amp;gt;&lt;br /&gt;
*[[teams_users]]&amp;lt;br&amp;gt;&lt;br /&gt;
*[[users]]&amp;lt;br&amp;gt;&lt;br /&gt;
*[[responses]]&amp;lt;br&amp;gt;&lt;br /&gt;
*[[response_maps]]&lt;br /&gt;
&lt;br /&gt;
=== Relevant Methods ===&lt;br /&gt;
==== hamer_spec ====&lt;br /&gt;
*calculate_weighted_scores_and_reputation&lt;br /&gt;
This is the main method of Hamer algorithm. Reviewers inaccuracy will be calculated and updated from past average, then weight of the review will be adjusted based on the inaccuracy. We plan to create two contexts to test it as below: 1. When the review is the same from average, reviewer’s inaccuracy should be minimized and the review’s weight should be maximized; 2. When the review is furthest from average, reviewer’s inaccuracy should be maximized and the review’s weight should be minimized.&lt;br /&gt;
*converged?&lt;br /&gt;
This method ensures the final result of calculated reviews' weights is converged, as the algorithm requires. A simple fixture test can be done by giving the method a set of input data and compare it to expected result.&lt;br /&gt;
==== ReputationController_spec ====&lt;br /&gt;
*db_query&lt;br /&gt;
*db_query_with_quiz_score&lt;br /&gt;
*json_generator&lt;br /&gt;
*client&lt;br /&gt;
*send_post_request&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
=== Collaborators ===&lt;br /&gt;
Jinku Cui (jcui23)&lt;br /&gt;
&lt;br /&gt;
Henry Chen (hchen34)&lt;br /&gt;
&lt;br /&gt;
Dong Li (dli35)&lt;br /&gt;
&lt;br /&gt;
Zijun Lu (zlu5)&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[https://doi.org/10.1109/FIE.2015.7344292 Pluggable reputation systems for peer review: A web-service approach]&lt;/div&gt;</summary>
		<author><name>Hchen34</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2168._Testing_-_Reputations&amp;diff=140711</id>
		<title>CSC/ECE 517 Fall 2021 - E2168. Testing - Reputations</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2168._Testing_-_Reputations&amp;diff=140711"/>
		<updated>2021-11-03T23:08:16Z</updated>

		<summary type="html">&lt;p&gt;Hchen34: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Project Overview ==&lt;br /&gt;
&lt;br /&gt;
=== Objectives ===&lt;br /&gt;
&lt;br /&gt;
Our objectives for this project are the following:&lt;br /&gt;
* Double and stub an assignment, a few submissions to the assignment, under different review rubrics&lt;br /&gt;
* Manually calculate reputation scores based on paper &amp;quot;Pluggable reputation systems for peer review: A web-service approach&amp;quot;&lt;br /&gt;
* Validate correct reputation scores based on different review rubrics generated by reputation management VS manual computation of reputation score expectation&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
*reputation_web_service_controller_spec&lt;br /&gt;
*hamer_spec&lt;br /&gt;
*&amp;lt;del&amp;gt;lauw_spec (?)&amp;lt;/del&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
=== Testing Objects ===&lt;br /&gt;
Following objects will be created and confined for the purpose of testing. &lt;br /&gt;
&lt;br /&gt;
*[[assignments]]&amp;lt;br&amp;gt;&lt;br /&gt;
*[[submission_records]]&amp;lt;br&amp;gt;&lt;br /&gt;
*[[questionnaires]]&amp;lt;br&amp;gt;&lt;br /&gt;
*[[assignment_questionnaires]]&amp;lt;br&amp;gt;&lt;br /&gt;
*[[participants]]&amp;lt;br&amp;gt;&lt;br /&gt;
*[[teams]]&amp;lt;br&amp;gt;&lt;br /&gt;
*[[teams_users]]&amp;lt;br&amp;gt;&lt;br /&gt;
*[[users]]&amp;lt;br&amp;gt;&lt;br /&gt;
*[[responses]]&amp;lt;br&amp;gt;&lt;br /&gt;
*[[response_maps]]&lt;br /&gt;
&lt;br /&gt;
=== Relevant Methods ===&lt;br /&gt;
==== hamer_spec ====&lt;br /&gt;
*calculate_weighted_scores_and_reputation&lt;br /&gt;
This is the main method of Hamer algorithm. Reviewers inaccuracy will be calculated and updated from past average, then weight of the review will be adjusted based on the inaccuracy. We plan to create two contexts to test it as below: 1. When the review is the same from average, reviewer’s inaccuracy should be minimized and the review’s weight should be maximized; 2. When the review is furthest from average, reviewer’s inaccuracy should be maximized and the review’s weight should be minimized.&lt;br /&gt;
*&amp;lt;del&amp;gt;converged?&amp;lt;/del&amp;gt;&lt;br /&gt;
&amp;lt;del&amp;gt;This method ensures the final result of calculated reviews' weights is converged, as the algorithm requires. No testing is needed on this method.&amp;lt;/del&amp;gt;&lt;br /&gt;
==== ReputationController_spec ====&lt;br /&gt;
*db_query&lt;br /&gt;
*db_query_with_quiz_score&lt;br /&gt;
*json_generator&lt;br /&gt;
*client&lt;br /&gt;
*send_post_request&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
=== Collaborators ===&lt;br /&gt;
Jinku Cui (jcui23)&lt;br /&gt;
&lt;br /&gt;
Henry Chen (hchen34)&lt;br /&gt;
&lt;br /&gt;
Dong Li (dli35)&lt;br /&gt;
&lt;br /&gt;
Zijun Lu (zlu5)&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[https://doi.org/10.1109/FIE.2015.7344292 Pluggable reputation systems for peer review: A web-service approach]&lt;/div&gt;</summary>
		<author><name>Hchen34</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2168._Testing_-_Reputations&amp;diff=140710</id>
		<title>CSC/ECE 517 Fall 2021 - E2168. Testing - Reputations</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2168._Testing_-_Reputations&amp;diff=140710"/>
		<updated>2021-11-03T22:46:46Z</updated>

		<summary type="html">&lt;p&gt;Hchen34: Added Test Objects section&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Project Overview ==&lt;br /&gt;
&lt;br /&gt;
=== Objectives ===&lt;br /&gt;
&lt;br /&gt;
Our objectives for this project are the following:&lt;br /&gt;
* Double and stub an assignment, a few submissions to the assignment, under different review rubrics&lt;br /&gt;
* Manually calculate reputation scores based on paper &amp;quot;Pluggable reputation systems for peer review: A web-service approach&amp;quot;&lt;br /&gt;
* Validate correct reputation scores based on different review rubrics generated by reputation management VS manual computation of reputation score expectation&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
*reputation_web_service_controller_spec&lt;br /&gt;
*hamer_spec&lt;br /&gt;
*lauw_spec (?)&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
=== Testing Objects ===&lt;br /&gt;
Following objects will be created and confined for the purpose of testing. &lt;br /&gt;
&lt;br /&gt;
*[[assignments]]&amp;lt;br&amp;gt;&lt;br /&gt;
*[[submission_records]]&amp;lt;br&amp;gt;&lt;br /&gt;
*[[questionnaires]]&amp;lt;br&amp;gt;&lt;br /&gt;
*[[assignment_questionnaires]]&amp;lt;br&amp;gt;&lt;br /&gt;
*[[participants]]&amp;lt;br&amp;gt;&lt;br /&gt;
*[[teams]]&amp;lt;br&amp;gt;&lt;br /&gt;
*[[teams_users]]&amp;lt;br&amp;gt;&lt;br /&gt;
*[[users]]&amp;lt;br&amp;gt;&lt;br /&gt;
*[[responses]]&amp;lt;br&amp;gt;&lt;br /&gt;
*[[response_maps]]&lt;br /&gt;
&lt;br /&gt;
=== Relevant Methods ===&lt;br /&gt;
hamer_spec&lt;br /&gt;
*calculate_weighted_scores_and_reputation&lt;br /&gt;
*converged?&lt;br /&gt;
&lt;br /&gt;
ReputationController_spec&lt;br /&gt;
*db_query&lt;br /&gt;
*db_query_with_quiz_score&lt;br /&gt;
*json_generator&lt;br /&gt;
*client&lt;br /&gt;
*send_post_request&lt;br /&gt;
&lt;br /&gt;
== hamer_spec ==&lt;br /&gt;
&lt;br /&gt;
=== calculate_weighted_scores_and_reputation ===&lt;br /&gt;
&lt;br /&gt;
=== converged? ===&lt;br /&gt;
&lt;br /&gt;
== ReputationController_spec ==&lt;br /&gt;
&lt;br /&gt;
=== db_query ===&lt;br /&gt;
&lt;br /&gt;
=== db_query_with_quiz_score ===&lt;br /&gt;
&lt;br /&gt;
=== json_generator ===&lt;br /&gt;
&lt;br /&gt;
=== client ===&lt;br /&gt;
&lt;br /&gt;
=== send_post_request ===&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
&lt;br /&gt;
=== Collaborators ===&lt;br /&gt;
Jinku Cui (jcui23)&lt;br /&gt;
&lt;br /&gt;
Henry Chen (hchen34)&lt;br /&gt;
&lt;br /&gt;
Dong Li (dli35)&lt;br /&gt;
&lt;br /&gt;
Zijun Lu (zlu5)&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[https://doi.org/10.1109/FIE.2015.7344292 Pluggable reputation systems for peer review: A web-service approach]&lt;/div&gt;</summary>
		<author><name>Hchen34</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2168._Testing_-_Reputations&amp;diff=140387</id>
		<title>CSC/ECE 517 Fall 2021 - E2168. Testing - Reputations</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2168._Testing_-_Reputations&amp;diff=140387"/>
		<updated>2021-11-02T02:38:13Z</updated>

		<summary type="html">&lt;p&gt;Hchen34: added methods (subject to changes)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Project Overview ==&lt;br /&gt;
&lt;br /&gt;
=== Objectives ===&lt;br /&gt;
&lt;br /&gt;
Our objectives for this project are the following:&lt;br /&gt;
*&lt;br /&gt;
*&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
*ReputationController_spec&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
=== Relevant Methods ===&lt;br /&gt;
ReputationController_spec&lt;br /&gt;
*db_query&lt;br /&gt;
*db_query_with_quiz_score&lt;br /&gt;
*json_generator&lt;br /&gt;
*client&lt;br /&gt;
*send_post_request&lt;br /&gt;
&lt;br /&gt;
== ReputationController_spec ==&lt;br /&gt;
&lt;br /&gt;
=== db_query ===&lt;br /&gt;
&lt;br /&gt;
=== db_query_with_quiz_score ===&lt;br /&gt;
&lt;br /&gt;
=== json_generator ===&lt;br /&gt;
&lt;br /&gt;
=== client ===&lt;br /&gt;
&lt;br /&gt;
=== send_post_request ===&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
&lt;br /&gt;
=== Collaborators ===&lt;br /&gt;
Jinku Cui (jcui23)&lt;br /&gt;
&lt;br /&gt;
Henry Chen (hchen34)&lt;br /&gt;
&lt;br /&gt;
Dong Li (dli35)&lt;br /&gt;
&lt;br /&gt;
Zijun Lu (zlu5)&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[https://doi.org/10.1109/FIE.2015.7344292 Pluggable reputation systems for peer review: A web-service approach]&lt;/div&gt;</summary>
		<author><name>Hchen34</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2168._Testing_-_Reputations&amp;diff=140383</id>
		<title>CSC/ECE 517 Fall 2021 - E2168. Testing - Reputations</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2168._Testing_-_Reputations&amp;diff=140383"/>
		<updated>2021-11-02T02:29:54Z</updated>

		<summary type="html">&lt;p&gt;Hchen34: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Project Overview ==&lt;br /&gt;
&lt;br /&gt;
=== Objectives ===&lt;br /&gt;
&lt;br /&gt;
Our objectives for this project are the following:&lt;br /&gt;
*&lt;br /&gt;
*&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
*ReputationController_spec&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
=== Relevant Methods ===&lt;br /&gt;
ReputationController_spec&lt;br /&gt;
*&lt;br /&gt;
*&lt;br /&gt;
&lt;br /&gt;
== ReputationController_spec ==&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
=== Collaborators ===&lt;br /&gt;
Jinku Cui (jcui23)&lt;br /&gt;
&lt;br /&gt;
Henry Chen (hchen34)&lt;br /&gt;
&lt;br /&gt;
Dong Li (dli35)&lt;br /&gt;
&lt;br /&gt;
Zijun Lu (zlu5)&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[https://doi.org/10.1109/FIE.2015.7344292 Pluggable reputation systems for peer review: A web-service approach]&lt;/div&gt;</summary>
		<author><name>Hchen34</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2168._Testing_-_Reputations&amp;diff=140381</id>
		<title>CSC/ECE 517 Fall 2021 - E2168. Testing - Reputations</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2168._Testing_-_Reputations&amp;diff=140381"/>
		<updated>2021-11-02T02:29:11Z</updated>

		<summary type="html">&lt;p&gt;Hchen34: Created sections&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Project Overview ==&lt;br /&gt;
&lt;br /&gt;
=== Objectives ===&lt;br /&gt;
&lt;br /&gt;
Our objectives for this project are the following:&lt;br /&gt;
*&lt;br /&gt;
*&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
*ReputationController_spec&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
=== Relevant Methods ===&lt;br /&gt;
ReputationController_spec&lt;br /&gt;
*&lt;br /&gt;
*&lt;br /&gt;
&lt;br /&gt;
== ReputationController_spec ==&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
=== Collaborators ===&lt;br /&gt;
Jinku Cui (jcui23)&lt;br /&gt;
Henry Chen (hchen34)&lt;br /&gt;
Dong Li (dli35)&lt;br /&gt;
Zijun Lu (zlu5)&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[https://doi.org/10.1109/FIE.2015.7344292 Pluggable reputation systems for peer review: A web-service approach]&lt;/div&gt;</summary>
		<author><name>Hchen34</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2138._Auto-generate_submission_directory_names_based_on_assignment&amp;diff=140017</id>
		<title>CSC/ECE 517 Fall 2021 - E2138. Auto-generate submission directory names based on assignment</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2138._Auto-generate_submission_directory_names_based_on_assignment&amp;diff=140017"/>
		<updated>2021-10-25T16:41:09Z</updated>

		<summary type="html">&lt;p&gt;Hchen34: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page describes the changes made under E2138, in order to auto-generate submission directory names based on assignment names for Fall 2021, CSC/ECE 517.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
= Overview =&lt;br /&gt;
&lt;br /&gt;
== About Expertiza ==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
== Issues for this project ==&lt;br /&gt;
&lt;br /&gt;
When instructors give an assignment a name, submission directories should be auto-generated based on the assignment name, and also be unique. A number of issues existed when a previous team worked on this assignment (E2054), including&lt;br /&gt;
* Issue #1: The directory name should be auto-generated from the assignment name.&lt;br /&gt;
* Issue #2: It should be done by changing spaces in the names to underscores. E.g., the directory for Program 1 is by default &amp;quot;Program_1&amp;quot;.&lt;br /&gt;
* Issue #3: A check should be added to prevent two assignments in the same course from having the same name.&lt;br /&gt;
* Issue #4: Verify or add if not present - a check to stop two assignments from sharing the same directory.&lt;br /&gt;
* Issue #5: On changing the name of an assignment while creating it, the code shouldn't throw a NoMethodError.&lt;br /&gt;
&lt;br /&gt;
= Project implementation =&lt;br /&gt;
&lt;br /&gt;
== Submitted work and demonstration of project ==&lt;br /&gt;
&lt;br /&gt;
* [http://152.7.98.88:8080/ Link to deployed code on NCSU VCL]&lt;br /&gt;
* [https://github.com/SN-18/expertiza Link to our Github repository]&lt;br /&gt;
&lt;br /&gt;
== Files involved ==&lt;br /&gt;
*app/views/assignments/edit/_general.html.erb - added function that auto generate directory name, and substitute its spacebar with underscore.&lt;br /&gt;
*app/models/assignment.rb - added presence and uniqueness validation to assignment.&lt;br /&gt;
*app/controllers/assignments_controller.rb - modify create method to check for existing assignment name &amp;amp; directory.&lt;br /&gt;
*spec/controllers/assignments_controller_spec.rb - edited &amp;amp; added tests for the project.&lt;br /&gt;
*spec/models/due_date_spec.rb - fixed issues where tests can fail due to creating assignments with same names &amp;amp; directories.&lt;br /&gt;
*spec/models/student_task_spec.rb - fixed issues where tests can fail due to creating assignments with same names &amp;amp; directories.&lt;br /&gt;
&lt;br /&gt;
== Changes made to code ==&lt;br /&gt;
&lt;br /&gt;
=== views ===&lt;br /&gt;
The following code was added to &amp;lt;b&amp;gt;app/views/assignments/edit/_general.html.erb&amp;lt;/b&amp;gt;. The purpose is to generate submission directory name from the assignment name and substitute the spacebar with underscore.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
$(function() {&lt;br /&gt;
    $(&amp;quot;#assignment_form_assignment_name&amp;quot;).change(function() {&lt;br /&gt;
        filename = $( &amp;quot;#assignment_form_assignment_name&amp;quot; ).val().replace(/ /g,&amp;quot;_&amp;quot;).replace(/[/\\?%*:|&amp;quot;&amp;lt;&amp;gt;/$&amp;amp;!#%^@]/g, '');;&lt;br /&gt;
        $('#assignment_form_assignment_directory_path').val(filename);&lt;br /&gt;
    });&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
function autogenerate_submission(){&lt;br /&gt;
  assignment_form.assignment.directory_path = assignment_form.assignment.name;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== models ===&lt;br /&gt;
The following code was added to &amp;lt;b&amp;gt;app/models/assignment.rb&amp;lt;/b&amp;gt;'s Assignment class, to add validation for assignment name and directory.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  validates :directory_path, presence: true # E2138 Validation for unique submission directory&lt;br /&gt;
  validates :directory_path, uniqueness: {scope: :course_id}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== controllers ===&lt;br /&gt;
The following code was modified in &amp;lt;b&amp;gt;app/controllers/assignments_controller.rb&amp;lt;/b&amp;gt;'s create method, adding checks for assignment name and directory when creating assignment.&lt;br /&gt;
&lt;br /&gt;
'''Before'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def create&lt;br /&gt;
     @assignment_form = AssignmentForm.new(assignment_form_params)&lt;br /&gt;
     if params[:button]&lt;br /&gt;
       if @assignment_form.save&lt;br /&gt;
         @assignment_form.create_assignment_node&lt;br /&gt;
         exist_assignment = Assignment.find_by(id: @assignment_form.assignment.id)&lt;br /&gt;
         assignment_form_params[:assignment][:id] = exist_assignment.id.to_s&lt;br /&gt;
         if assignment_form_params[:assignment][:directory_path].blank?&lt;br /&gt;
           assignment_form_params[:assignment][:directory_path] = &amp;quot;assignment_#{assignment_form_params[:assignment][:id]}&amp;quot;&lt;br /&gt;
         end&lt;br /&gt;
         ques_array = assignment_form_params[:assignment_questionnaire]&lt;br /&gt;
         due_array = assignment_form_params[:due_date]&lt;br /&gt;
         ques_array.each do |cur_questionnaire|&lt;br /&gt;
           cur_questionnaire[:assignment_id] = exist_assignment.id.to_s&lt;br /&gt;
         end&lt;br /&gt;
         due_array.each do |cur_due|&lt;br /&gt;
           cur_due[:parent_id] = exist_assignment.id.to_s&lt;br /&gt;
         end&lt;br /&gt;
         assignment_form_params[:assignment_questionnaire] = ques_array&lt;br /&gt;
         assignment_form_params[:due_date] = due_array&lt;br /&gt;
         @assignment_form.update(assignment_form_params, current_user)&lt;br /&gt;
         aid = Assignment.find_by(id: @assignment_form.assignment.id).id&lt;br /&gt;
         ExpertizaLogger.info &amp;quot;Assignment created: #{@assignment_form.as_json}&amp;quot;&lt;br /&gt;
         redirect_to edit_assignment_path aid&lt;br /&gt;
         undo_link(&amp;quot;Assignment \&amp;quot;#{@assignment_form.assignment.name}\&amp;quot; has been created successfully. &amp;quot;)&lt;br /&gt;
         return&lt;br /&gt;
       else&lt;br /&gt;
         flash.now[:error] = &amp;quot;Failed to create assignment&amp;quot;&lt;br /&gt;
         render 'new'&lt;br /&gt;
       end&lt;br /&gt;
     else&lt;br /&gt;
       render 'new'&lt;br /&gt;
      undo_link(&amp;quot;Assignment \&amp;quot;#{@assignment_form.assignment.name}\&amp;quot; has been created successfully. &amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''After'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def create&lt;br /&gt;
    @assignment_form = AssignmentForm.new(assignment_form_params)&lt;br /&gt;
    if params[:button]&lt;br /&gt;
      # E2138 issue #3&lt;br /&gt;
      find_existing_assignment = Assignment.find_by(name: @assignment_form.assignment.name, course_id: @assignment_form.assignment.course_id)&lt;br /&gt;
      dir_path = assignment_form_params[:assignment][:directory_path]&lt;br /&gt;
      find_existing_directory = Assignment.find_by(directory_path: dir_path, course_id: @assignment_form.assignment.course_id)&lt;br /&gt;
      if !find_existing_assignment and !find_existing_directory and @assignment_form.save #No existing names/directories &lt;br /&gt;
        @assignment_form.create_assignment_node&lt;br /&gt;
        current_assignment = Assignment.find_by(name: @assignment_form.assignment.name, course_id: @assignment_form.assignment.course_id)&lt;br /&gt;
        assignment_form_params[:assignment][:id] = current_assignment.id.to_s&lt;br /&gt;
        ques_array = assignment_form_params[:assignment_questionnaire]&lt;br /&gt;
        due_array = assignment_form_params[:due_date]&lt;br /&gt;
        ques_array.each do |cur_questionnaire|&lt;br /&gt;
          cur_questionnaire[:assignment_id] = current_assignment.id.to_s&lt;br /&gt;
        end&lt;br /&gt;
        due_array.each do |cur_due|&lt;br /&gt;
          cur_due[:parent_id] = current_assignment.id.to_s&lt;br /&gt;
        end&lt;br /&gt;
        assignment_form_params[:assignment_questionnaire] = ques_array&lt;br /&gt;
        assignment_form_params[:due_date] = due_array&lt;br /&gt;
        @assignment_form.update(assignment_form_params, current_user)&lt;br /&gt;
        aid = Assignment.find_by(name: @assignment_form.assignment.name, course_id: @assignment_form.assignment.course_id).id&lt;br /&gt;
        ExpertizaLogger.info &amp;quot;Assignment created: #{@assignment_form.as_json}&amp;quot;&lt;br /&gt;
        redirect_to edit_assignment_path aid&lt;br /&gt;
        undo_link(&amp;quot;Assignment \&amp;quot;#{@assignment_form.assignment.name}\&amp;quot; has been created successfully. &amp;quot;)&lt;br /&gt;
        return&lt;br /&gt;
      else&lt;br /&gt;
        flash[:error] = &amp;quot;Failed to create assignment.&amp;quot;&lt;br /&gt;
        if find_existing_assignment&lt;br /&gt;
          flash[:error] &amp;lt;&amp;lt; &amp;quot;&amp;lt;br&amp;gt;  &amp;quot; + @assignment_form.assignment.name + &amp;quot; already exists as an assignment name&amp;quot;&lt;br /&gt;
        end&lt;br /&gt;
        if find_existing_directory&lt;br /&gt;
          flash[:error] &amp;lt;&amp;lt; &amp;quot;&amp;lt;br&amp;gt;  &amp;quot; + dir_path + &amp;quot; already exists as a submission directory name&amp;quot;&lt;br /&gt;
        end&lt;br /&gt;
        redirect_to &amp;quot;/assignments/new?private=1&amp;quot;&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      render 'new'&lt;br /&gt;
      undo_link(&amp;quot;Assignment \&amp;quot;#{@assignment_form.assignment.name}\&amp;quot; has been created successfully. &amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Test Plan =&lt;br /&gt;
&lt;br /&gt;
== Manual UI Testing ==&lt;br /&gt;
The following steps must be performed to test the project UI:&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Step 1:''' Log in as an Instructor, with Username - instructor6, Password - password.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:expertiza_login.PNG]]&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Step 2:''' Create a new assignment. Assignment is named as &amp;quot;Test Assignment&amp;quot;, under course CSC/ECE 517 Fall 2020.&lt;br /&gt;
The directory name gets auto generated with name replacing space by underscore in assignment name.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:auto_generated.PNG]]&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Step 3:''' Assignment gets successfully created. Assignment is named as &amp;quot;Test Assignment&amp;quot; and gets saved in the directory &amp;quot;Test_assignment&amp;quot;, under course CSC/ECE 517 Fall 2020&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:save_success.PNG]]&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Step 4:''' Create and save another assignment with same name. Following error is observed. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:error.PNG]]&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
== RSpec Testing ==&lt;br /&gt;
The following RSpec test is added in the &amp;lt;b&amp;gt;assignments_contoller_spec.rb&amp;lt;/b&amp;gt; file&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 # Assignment Names Cannot be duplicated&lt;br /&gt;
 context 'when assignment_form name already exists and is not saved properly' do&lt;br /&gt;
      it 'redirects to assignment#new page' do&lt;br /&gt;
        allow(assignment_form).to receive(:assignment).and_return(assignment)&lt;br /&gt;
        allow(Assignment).to receive(:find_by).with(any_args).and_return(false)&lt;br /&gt;
        allow(Assignment).to receive(:find_by).with(any_args).and_return(false)&lt;br /&gt;
        allow(assignment_form).to receive(:save).and_return(true)&lt;br /&gt;
        allow(assignment_form).to receive(:create_assignment_node).and_return(double('node'))&lt;br /&gt;
        allow(assignment_form).to receive(:update).with(any_args).and_return(true)&lt;br /&gt;
        allow(assignment).to receive(:id).and_return(1)&lt;br /&gt;
        allow(Assignment).to receive(:find_by).with(course_id:1, name:'test assignment').and_return(assignment)&lt;br /&gt;
        post :create, @params&lt;br /&gt;
        expect(flash[:error]).to eq('Failed to create assignment.&amp;lt;br&amp;gt;  test assignment already exists as an assignment name')&lt;br /&gt;
        expect(response).to redirect_to('/assignments/new?private=1')&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The following RSpec tests are corrected in the &amp;lt;b&amp;gt;assignments_contoller_spec.rb&amp;lt;/b&amp;gt; file&lt;br /&gt;
&lt;br /&gt;
'''Before'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    context 'when assignment_form is saved successfully' do&lt;br /&gt;
      it 'redirects to assignment#edit page' do&lt;br /&gt;
        allow(assignment_form).to receive(:assignment).and_return(assignment)&lt;br /&gt;
        allow(assignment_form).to receive(:save).and_return(true)&lt;br /&gt;
        allow(assignment_form).to receive(:update).with(any_args).and_return(true)&lt;br /&gt;
        allow(assignment_form).to receive(:create_assignment_node).and_return(double('node'))&lt;br /&gt;
        allow(assignment).to receive(:id).and_return(1)&lt;br /&gt;
        allow(Assignment).to receive(:find_by).with(id: 1).and_return(assignment)&lt;br /&gt;
        allow_any_instance_of(AssignmentsController).to receive(:undo_link)&lt;br /&gt;
          .with('Assignment &amp;quot;test assignment&amp;quot; has been created successfully. ').and_return(true)&lt;br /&gt;
        post :create, @params&lt;br /&gt;
        expect(response).to redirect_to('/assignments/1/edit')&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
'''After'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 context 'when assignment_form is saved successfully' do&lt;br /&gt;
      it 'redirects to assignment#edit page' do&lt;br /&gt;
        allow(assignment_form).to receive(:assignment).and_return(assignment)&lt;br /&gt;
        allow(Assignment).to receive(:find_by).with(any_args).and_return(false)&lt;br /&gt;
        allow(Assignment).to receive(:find_by).with(any_args).and_return(false)&lt;br /&gt;
        allow(assignment_form).to receive(:save).and_return(true)&lt;br /&gt;
        allow(assignment_form).to receive(:create_assignment_node).and_return(double('node'))&lt;br /&gt;
        allow(assignment_form).to receive(:update).with(any_args).and_return(true)&lt;br /&gt;
        allow(assignment).to receive(:id).and_return(1)&lt;br /&gt;
        allow(Assignment).to receive(:find_by).with(course_id:1, name:'test assignment').and_return(assignment)&lt;br /&gt;
        allow_any_instance_of(AssignmentsController).to receive(:undo_link)&lt;br /&gt;
           .with('Assignment &amp;quot;test assignment&amp;quot; has been created successfully. ').and_return(true)&lt;br /&gt;
        post :create, @params&lt;br /&gt;
        expect(response).to redirect_to('/assignments/1/edit')&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
= Team Information =&lt;br /&gt;
Mentor: Nicholas Himes (nnhimes)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Henry Chen (hchen34)&lt;br /&gt;
&lt;br /&gt;
Saurabh Nanda (snanda2)&lt;br /&gt;
&lt;br /&gt;
Snehapriyaa Mathiyalaghan (smathiy)&lt;/div&gt;</summary>
		<author><name>Hchen34</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2138._Auto-generate_submission_directory_names_based_on_assignment&amp;diff=140016</id>
		<title>CSC/ECE 517 Fall 2021 - E2138. Auto-generate submission directory names based on assignment</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2138._Auto-generate_submission_directory_names_based_on_assignment&amp;diff=140016"/>
		<updated>2021-10-25T16:39:56Z</updated>

		<summary type="html">&lt;p&gt;Hchen34: added RSpec files in files involved&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page describes the changes made under E2138, in order to auto-generate submission directory names based on assignment names for Fall 2021, CSC/ECE 517.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
= Overview =&lt;br /&gt;
&lt;br /&gt;
== About Expertiza ==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
== Issues for this project ==&lt;br /&gt;
&lt;br /&gt;
When instructors give an assignment a name, submission directories should be auto-generated based on the assignment name, and also be unique. A number of issues existed when a previous team worked on this assignment (E2054), including&lt;br /&gt;
* Issue #1: The directory name should be auto-generated from the assignment name.&lt;br /&gt;
* Issue #2: It should be done by changing spaces in the names to underscores. E.g., the directory for Program 1 is by default &amp;quot;Program_1&amp;quot;.&lt;br /&gt;
* Issue #3: A check should be added to prevent two assignments in the same course from having the same name.&lt;br /&gt;
* Issue #4: Verify or add if not present - a check to stop two assignments from sharing the same directory.&lt;br /&gt;
* Issue #5: On changing the name of an assignment while creating it, the code shouldn't throw a NoMethodError.&lt;br /&gt;
&lt;br /&gt;
= Project implementation =&lt;br /&gt;
&lt;br /&gt;
== Submitted work and demonstration of project ==&lt;br /&gt;
&lt;br /&gt;
* [http://152.7.98.88:8080/ Link to deployed code on NCSU VCL]&lt;br /&gt;
* [https://github.com/SN-18/expertiza Link to our Github repository]&lt;br /&gt;
&lt;br /&gt;
== Files involved ==&lt;br /&gt;
*app/views/assignments/edit/_general.html.erb - added function that auto generate directory name, and substitute its spacebar with underscore.&lt;br /&gt;
*app/models/assignment.rb - added presence and uniqueness validation to assignment.&lt;br /&gt;
*app/controllers/assignments_controller.rb - modify create method to check for existing assignment name &amp;amp; directory.&lt;br /&gt;
*spec/controllers/assignments_controller_spec.rb - edited &amp;amp; added tests for the project.&lt;br /&gt;
*spec/models/due_date_spec.rb - fixed issues where tests can fail due to creating assignments with same names &amp;amp; directories.&lt;br /&gt;
*spec/models/student_task_spec.rb - fixed issues where tests can fail due to creating assignments with same names &amp;amp; directories.&lt;br /&gt;
&lt;br /&gt;
== Changes made to code ==&lt;br /&gt;
&lt;br /&gt;
=== views ===&lt;br /&gt;
The following code was added to &amp;lt;b&amp;gt;app/views/assignments/edit/_general.html.erb&amp;lt;/b&amp;gt;. The purpose is to generate submission directory name from the assignment name and substitute the spacebar with underscore.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
$(function() {&lt;br /&gt;
    $(&amp;quot;#assignment_form_assignment_name&amp;quot;).change(function() {&lt;br /&gt;
        filename = $( &amp;quot;#assignment_form_assignment_name&amp;quot; ).val().replace(/ /g,&amp;quot;_&amp;quot;).replace(/[/\\?%*:|&amp;quot;&amp;lt;&amp;gt;/$&amp;amp;!#%^@]/g, '');;&lt;br /&gt;
        $('#assignment_form_assignment_directory_path').val(filename);&lt;br /&gt;
    });&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
function autogenerate_submission(){&lt;br /&gt;
  assignment_form.assignment.directory_path = assignment_form.assignment.name;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== models ===&lt;br /&gt;
The following code was added to &amp;lt;b&amp;gt;app/models/assignment.rb&amp;lt;/b&amp;gt;'s Assignment class, to add validation for assignment name and directory.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  validates :directory_path, presence: true # E2138 Validation for unique submission directory&lt;br /&gt;
  validates :directory_path, uniqueness: {scope: :course_id}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== controllers ===&lt;br /&gt;
The following code was modified in &amp;lt;b&amp;gt;app/controllers/assignments_controller.rb&amp;lt;/b&amp;gt;'s create method, adding checks for assignment name and directory when creating assignment.&lt;br /&gt;
&lt;br /&gt;
'''Before'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def create&lt;br /&gt;
     @assignment_form = AssignmentForm.new(assignment_form_params)&lt;br /&gt;
     if params[:button]&lt;br /&gt;
       if @assignment_form.save&lt;br /&gt;
         @assignment_form.create_assignment_node&lt;br /&gt;
         exist_assignment = Assignment.find_by(id: @assignment_form.assignment.id)&lt;br /&gt;
         assignment_form_params[:assignment][:id] = exist_assignment.id.to_s&lt;br /&gt;
         if assignment_form_params[:assignment][:directory_path].blank?&lt;br /&gt;
           assignment_form_params[:assignment][:directory_path] = &amp;quot;assignment_#{assignment_form_params[:assignment][:id]}&amp;quot;&lt;br /&gt;
         end&lt;br /&gt;
         ques_array = assignment_form_params[:assignment_questionnaire]&lt;br /&gt;
         due_array = assignment_form_params[:due_date]&lt;br /&gt;
         ques_array.each do |cur_questionnaire|&lt;br /&gt;
           cur_questionnaire[:assignment_id] = exist_assignment.id.to_s&lt;br /&gt;
         end&lt;br /&gt;
         due_array.each do |cur_due|&lt;br /&gt;
           cur_due[:parent_id] = exist_assignment.id.to_s&lt;br /&gt;
         end&lt;br /&gt;
         assignment_form_params[:assignment_questionnaire] = ques_array&lt;br /&gt;
         assignment_form_params[:due_date] = due_array&lt;br /&gt;
         @assignment_form.update(assignment_form_params, current_user)&lt;br /&gt;
         aid = Assignment.find_by(id: @assignment_form.assignment.id).id&lt;br /&gt;
         ExpertizaLogger.info &amp;quot;Assignment created: #{@assignment_form.as_json}&amp;quot;&lt;br /&gt;
         redirect_to edit_assignment_path aid&lt;br /&gt;
         undo_link(&amp;quot;Assignment \&amp;quot;#{@assignment_form.assignment.name}\&amp;quot; has been created successfully. &amp;quot;)&lt;br /&gt;
         return&lt;br /&gt;
       else&lt;br /&gt;
         flash.now[:error] = &amp;quot;Failed to create assignment&amp;quot;&lt;br /&gt;
         render 'new'&lt;br /&gt;
       end&lt;br /&gt;
     else&lt;br /&gt;
       render 'new'&lt;br /&gt;
      undo_link(&amp;quot;Assignment \&amp;quot;#{@assignment_form.assignment.name}\&amp;quot; has been created successfully. &amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''After'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def create&lt;br /&gt;
    @assignment_form = AssignmentForm.new(assignment_form_params)&lt;br /&gt;
    if params[:button]&lt;br /&gt;
      # E2138 issue #3&lt;br /&gt;
      find_existing_assignment = Assignment.find_by(name: @assignment_form.assignment.name, course_id: @assignment_form.assignment.course_id)&lt;br /&gt;
      dir_path = assignment_form_params[:assignment][:directory_path]&lt;br /&gt;
      find_existing_directory = Assignment.find_by(directory_path: dir_path, course_id: @assignment_form.assignment.course_id)&lt;br /&gt;
      if !find_existing_assignment and !find_existing_directory and @assignment_form.save #No existing names/directories &lt;br /&gt;
        @assignment_form.create_assignment_node&lt;br /&gt;
        current_assignment = Assignment.find_by(name: @assignment_form.assignment.name, course_id: @assignment_form.assignment.course_id)&lt;br /&gt;
        assignment_form_params[:assignment][:id] = current_assignment.id.to_s&lt;br /&gt;
        ques_array = assignment_form_params[:assignment_questionnaire]&lt;br /&gt;
        due_array = assignment_form_params[:due_date]&lt;br /&gt;
        ques_array.each do |cur_questionnaire|&lt;br /&gt;
          cur_questionnaire[:assignment_id] = current_assignment.id.to_s&lt;br /&gt;
        end&lt;br /&gt;
        due_array.each do |cur_due|&lt;br /&gt;
          cur_due[:parent_id] = current_assignment.id.to_s&lt;br /&gt;
        end&lt;br /&gt;
        assignment_form_params[:assignment_questionnaire] = ques_array&lt;br /&gt;
        assignment_form_params[:due_date] = due_array&lt;br /&gt;
        @assignment_form.update(assignment_form_params, current_user)&lt;br /&gt;
        aid = Assignment.find_by(name: @assignment_form.assignment.name, course_id: @assignment_form.assignment.course_id).id&lt;br /&gt;
        ExpertizaLogger.info &amp;quot;Assignment created: #{@assignment_form.as_json}&amp;quot;&lt;br /&gt;
        redirect_to edit_assignment_path aid&lt;br /&gt;
        undo_link(&amp;quot;Assignment \&amp;quot;#{@assignment_form.assignment.name}\&amp;quot; has been created successfully. &amp;quot;)&lt;br /&gt;
        return&lt;br /&gt;
      else&lt;br /&gt;
        flash[:error] = &amp;quot;Failed to create assignment.&amp;quot;&lt;br /&gt;
        if find_existing_assignment&lt;br /&gt;
          flash[:error] &amp;lt;&amp;lt; &amp;quot;&amp;lt;br&amp;gt;  &amp;quot; + @assignment_form.assignment.name + &amp;quot; already exists as an assignment name&amp;quot;&lt;br /&gt;
        end&lt;br /&gt;
        if find_existing_directory&lt;br /&gt;
          flash[:error] &amp;lt;&amp;lt; &amp;quot;&amp;lt;br&amp;gt;  &amp;quot; + dir_path + &amp;quot; already exists as a submission directory name&amp;quot;&lt;br /&gt;
        end&lt;br /&gt;
        redirect_to &amp;quot;/assignments/new?private=1&amp;quot;&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      render 'new'&lt;br /&gt;
      undo_link(&amp;quot;Assignment \&amp;quot;#{@assignment_form.assignment.name}\&amp;quot; has been created successfully. &amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Test Plan =&lt;br /&gt;
&lt;br /&gt;
== Manual UI Testing ==&lt;br /&gt;
The following steps must be performed to test the project UI:&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Step 1:''' Log in as an Instructor, with Username - instructor6, Password - password.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:expertiza_login.PNG]]&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Step 2:''' Create a new assignment. Assignment is named as &amp;quot;Test Assignment&amp;quot;, under course CSC/ECE 517 Fall 2020.&lt;br /&gt;
The directory name gets auto generated with name replacing space by underscore in assignment name.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:auto_generated.PNG]]&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Step 3:''' Assignment gets successfully created. Assignment is named as &amp;quot;Test Assignment&amp;quot; and gets saved in the directory &amp;quot;Test_assignment&amp;quot;, under course CSC/ECE 517 Fall 2020&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:save_success.PNG]]&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Step 4:''' Create and save another assignment with same name. Following error is observed. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:error.PNG]]&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
== RSpec Testing ==&lt;br /&gt;
The following RSpec test is added in the &amp;lt;b&amp;gt;assignments_contoller_spec.rb&amp;lt;/b&amp;gt; file&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 # Assignment Names Cannot be duplicated&lt;br /&gt;
 context 'when assignment_form name already exists and is not saved properly' do&lt;br /&gt;
      it 'redirects to assignment#new page' do&lt;br /&gt;
        allow(assignment_form).to receive(:assignment).and_return(assignment)&lt;br /&gt;
        allow(Assignment).to receive(:find_by).with(any_args).and_return(false)&lt;br /&gt;
        allow(Assignment).to receive(:find_by).with(any_args).and_return(false)&lt;br /&gt;
        allow(assignment_form).to receive(:save).and_return(true)&lt;br /&gt;
        allow(assignment_form).to receive(:create_assignment_node).and_return(double('node'))&lt;br /&gt;
        allow(assignment_form).to receive(:update).with(any_args).and_return(true)&lt;br /&gt;
        allow(assignment).to receive(:id).and_return(1)&lt;br /&gt;
        allow(Assignment).to receive(:find_by).with(course_id:1, name:'test assignment').and_return(assignment)&lt;br /&gt;
        post :create, @params&lt;br /&gt;
        expect(flash[:error]).to eq('Failed to create assignment.&amp;lt;br&amp;gt;  test assignment already exists as an assignment name')&lt;br /&gt;
        expect(response).to redirect_to('/assignments/new?private=1')&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The following RSpec tests are corrected in the &amp;lt;b&amp;gt;assignments_contoller_spec.rb&amp;lt;/b&amp;gt; file&lt;br /&gt;
'''Before'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    context 'when assignment_form is saved successfully' do&lt;br /&gt;
      it 'redirects to assignment#edit page' do&lt;br /&gt;
        allow(assignment_form).to receive(:assignment).and_return(assignment)&lt;br /&gt;
        allow(assignment_form).to receive(:save).and_return(true)&lt;br /&gt;
        allow(assignment_form).to receive(:update).with(any_args).and_return(true)&lt;br /&gt;
        allow(assignment_form).to receive(:create_assignment_node).and_return(double('node'))&lt;br /&gt;
        allow(assignment).to receive(:id).and_return(1)&lt;br /&gt;
        allow(Assignment).to receive(:find_by).with(id: 1).and_return(assignment)&lt;br /&gt;
        allow_any_instance_of(AssignmentsController).to receive(:undo_link)&lt;br /&gt;
          .with('Assignment &amp;quot;test assignment&amp;quot; has been created successfully. ').and_return(true)&lt;br /&gt;
        post :create, @params&lt;br /&gt;
        expect(response).to redirect_to('/assignments/1/edit')&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
'''After'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 context 'when assignment_form is saved successfully' do&lt;br /&gt;
      it 'redirects to assignment#edit page' do&lt;br /&gt;
        allow(assignment_form).to receive(:assignment).and_return(assignment)&lt;br /&gt;
        allow(Assignment).to receive(:find_by).with(any_args).and_return(false)&lt;br /&gt;
        allow(Assignment).to receive(:find_by).with(any_args).and_return(false)&lt;br /&gt;
        allow(assignment_form).to receive(:save).and_return(true)&lt;br /&gt;
        allow(assignment_form).to receive(:create_assignment_node).and_return(double('node'))&lt;br /&gt;
        allow(assignment_form).to receive(:update).with(any_args).and_return(true)&lt;br /&gt;
        allow(assignment).to receive(:id).and_return(1)&lt;br /&gt;
        allow(Assignment).to receive(:find_by).with(course_id:1, name:'test assignment').and_return(assignment)&lt;br /&gt;
        allow_any_instance_of(AssignmentsController).to receive(:undo_link)&lt;br /&gt;
           .with('Assignment &amp;quot;test assignment&amp;quot; has been created successfully. ').and_return(true)&lt;br /&gt;
        post :create, @params&lt;br /&gt;
        expect(response).to redirect_to('/assignments/1/edit')&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
= Team Information =&lt;br /&gt;
Mentor: Nicholas Himes (nnhimes)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Henry Chen (hchen34)&lt;br /&gt;
&lt;br /&gt;
Saurabh Nanda (snanda2)&lt;br /&gt;
&lt;br /&gt;
Snehapriyaa Mathiyalaghan (smathiy)&lt;/div&gt;</summary>
		<author><name>Hchen34</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2138._Auto-generate_submission_directory_names_based_on_assignment&amp;diff=139541</id>
		<title>CSC/ECE 517 Fall 2021 - E2138. Auto-generate submission directory names based on assignment</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2138._Auto-generate_submission_directory_names_based_on_assignment&amp;diff=139541"/>
		<updated>2021-10-20T21:50:31Z</updated>

		<summary type="html">&lt;p&gt;Hchen34: Undo revision 139523 by Hdu5 (talk)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page describes the changes made under E2138, in order to auto-generate submission directory names based on assignment names for Fall 2021, CSC/ECE 517.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
= Overview =&lt;br /&gt;
&lt;br /&gt;
== About Expertiza ==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
== Issues for this project ==&lt;br /&gt;
&lt;br /&gt;
When instructors give an assignment a name, submission directories should be auto-generated based on the assignment name, and also be unique. A number of issues existed when a previous team worked on this assignment (E2054), including&lt;br /&gt;
* Issue #1: The directory name should be auto-generated from the assignment name.&lt;br /&gt;
* Issue #2: It should be done by changing spaces in the names to underscores. E.g., the directory for Program 1 is by default &amp;quot;Program_1&amp;quot;.&lt;br /&gt;
* Issue #3: A check should be added to prevent two assignments in the same course from having the same name.&lt;br /&gt;
* Issue #4: Verify or add if not present - a check to stop two assignments from sharing the same directory.&lt;br /&gt;
* Issue #5: On changing the name of an assignment while creating it, the code shouldn't throw a NoMethodError.&lt;br /&gt;
&lt;br /&gt;
= Project implementation =&lt;br /&gt;
&lt;br /&gt;
== Submitted work and demonstration of project ==&lt;br /&gt;
&lt;br /&gt;
* [http://152.7.98.88:8080/ Link to deployed code on NCSU VCL]&lt;br /&gt;
* [https://github.com/SN-18/expertiza Link to our Github repository]&lt;br /&gt;
&lt;br /&gt;
== Files involved ==&lt;br /&gt;
*app/views/assignments/edit/_general.html.erb - added function that auto generate directory name, and substitute its spacebar with underscore.&lt;br /&gt;
*app/models/assignment.rb - added presence and uniqueness validation to assignment.&lt;br /&gt;
*app/controllers/assignments_controller.rb - modify create method to check for existing assignment name &amp;amp; directory.&lt;br /&gt;
&lt;br /&gt;
== Changes made to code ==&lt;br /&gt;
&lt;br /&gt;
=== views ===&lt;br /&gt;
The following code was added to &amp;lt;b&amp;gt;app/views/assignments/edit/_general.html.erb&amp;lt;/b&amp;gt;. The purpose is to generate submission directory name from the assignment name and substitute the spacebar with underscore.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
$(function() {&lt;br /&gt;
    $(&amp;quot;#assignment_form_assignment_name&amp;quot;).change(function() {&lt;br /&gt;
        filename = $( &amp;quot;#assignment_form_assignment_name&amp;quot; ).val().replace(/ /g,&amp;quot;_&amp;quot;).replace(/[/\\?%*:|&amp;quot;&amp;lt;&amp;gt;/$&amp;amp;!#%^@]/g, '');;&lt;br /&gt;
        $('#assignment_form_assignment_directory_path').val(filename);&lt;br /&gt;
    });&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
function autogenerate_submission(){&lt;br /&gt;
  assignment_form.assignment.directory_path = assignment_form.assignment.name;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== models ===&lt;br /&gt;
The following code was added to &amp;lt;b&amp;gt;app/models/assignment.rb&amp;lt;/b&amp;gt;'s Assignment class, to add validation for assignment name and directory.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  validates :directory_path, presence: true # E2138 Validation for unique submission directory&lt;br /&gt;
  validates :directory_path, uniqueness: {scope: :course_id}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== controllers ===&lt;br /&gt;
The following code was modified in &amp;lt;b&amp;gt;app/controllers/assignments_controller.rb&amp;lt;/b&amp;gt;'s create method, adding checks for assignment name and directory when creating assignment.&lt;br /&gt;
&lt;br /&gt;
'''Before'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def create&lt;br /&gt;
     @assignment_form = AssignmentForm.new(assignment_form_params)&lt;br /&gt;
     if params[:button]&lt;br /&gt;
       if @assignment_form.save&lt;br /&gt;
         @assignment_form.create_assignment_node&lt;br /&gt;
         exist_assignment = Assignment.find_by(id: @assignment_form.assignment.id)&lt;br /&gt;
         assignment_form_params[:assignment][:id] = exist_assignment.id.to_s&lt;br /&gt;
         if assignment_form_params[:assignment][:directory_path].blank?&lt;br /&gt;
           assignment_form_params[:assignment][:directory_path] = &amp;quot;assignment_#{assignment_form_params[:assignment][:id]}&amp;quot;&lt;br /&gt;
         end&lt;br /&gt;
         ques_array = assignment_form_params[:assignment_questionnaire]&lt;br /&gt;
         due_array = assignment_form_params[:due_date]&lt;br /&gt;
         ques_array.each do |cur_questionnaire|&lt;br /&gt;
           cur_questionnaire[:assignment_id] = exist_assignment.id.to_s&lt;br /&gt;
         end&lt;br /&gt;
         due_array.each do |cur_due|&lt;br /&gt;
           cur_due[:parent_id] = exist_assignment.id.to_s&lt;br /&gt;
         end&lt;br /&gt;
         assignment_form_params[:assignment_questionnaire] = ques_array&lt;br /&gt;
         assignment_form_params[:due_date] = due_array&lt;br /&gt;
         @assignment_form.update(assignment_form_params, current_user)&lt;br /&gt;
         aid = Assignment.find_by(id: @assignment_form.assignment.id).id&lt;br /&gt;
         ExpertizaLogger.info &amp;quot;Assignment created: #{@assignment_form.as_json}&amp;quot;&lt;br /&gt;
         redirect_to edit_assignment_path aid&lt;br /&gt;
         undo_link(&amp;quot;Assignment \&amp;quot;#{@assignment_form.assignment.name}\&amp;quot; has been created successfully. &amp;quot;)&lt;br /&gt;
         return&lt;br /&gt;
       else&lt;br /&gt;
         flash.now[:error] = &amp;quot;Failed to create assignment&amp;quot;&lt;br /&gt;
         render 'new'&lt;br /&gt;
       end&lt;br /&gt;
     else&lt;br /&gt;
       render 'new'&lt;br /&gt;
      undo_link(&amp;quot;Assignment \&amp;quot;#{@assignment_form.assignment.name}\&amp;quot; has been created successfully. &amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''After'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def create&lt;br /&gt;
    @assignment_form = AssignmentForm.new(assignment_form_params)&lt;br /&gt;
    if params[:button]&lt;br /&gt;
      # E2138 issue #3&lt;br /&gt;
      find_existing_assignment = Assignment.find_by(name: @assignment_form.assignment.name, course_id: @assignment_form.assignment.course_id)&lt;br /&gt;
      dir_path = assignment_form_params[:assignment][:directory_path]&lt;br /&gt;
      find_existing_directory = Assignment.find_by(directory_path: dir_path, course_id: @assignment_form.assignment.course_id)&lt;br /&gt;
      if !find_existing_assignment and !find_existing_directory and @assignment_form.save #No existing names/directories &lt;br /&gt;
        @assignment_form.create_assignment_node&lt;br /&gt;
        current_assignment = Assignment.find_by(name: @assignment_form.assignment.name, course_id: @assignment_form.assignment.course_id)&lt;br /&gt;
        assignment_form_params[:assignment][:id] = current_assignment.id.to_s&lt;br /&gt;
        ques_array = assignment_form_params[:assignment_questionnaire]&lt;br /&gt;
        due_array = assignment_form_params[:due_date]&lt;br /&gt;
        ques_array.each do |cur_questionnaire|&lt;br /&gt;
          cur_questionnaire[:assignment_id] = current_assignment.id.to_s&lt;br /&gt;
        end&lt;br /&gt;
        due_array.each do |cur_due|&lt;br /&gt;
          cur_due[:parent_id] = current_assignment.id.to_s&lt;br /&gt;
        end&lt;br /&gt;
        assignment_form_params[:assignment_questionnaire] = ques_array&lt;br /&gt;
        assignment_form_params[:due_date] = due_array&lt;br /&gt;
        @assignment_form.update(assignment_form_params, current_user)&lt;br /&gt;
        aid = Assignment.find_by(name: @assignment_form.assignment.name, course_id: @assignment_form.assignment.course_id).id&lt;br /&gt;
        ExpertizaLogger.info &amp;quot;Assignment created: #{@assignment_form.as_json}&amp;quot;&lt;br /&gt;
        redirect_to edit_assignment_path aid&lt;br /&gt;
        undo_link(&amp;quot;Assignment \&amp;quot;#{@assignment_form.assignment.name}\&amp;quot; has been created successfully. &amp;quot;)&lt;br /&gt;
        return&lt;br /&gt;
      else&lt;br /&gt;
        flash[:error] = &amp;quot;Failed to create assignment.&amp;quot;&lt;br /&gt;
        if find_existing_assignment&lt;br /&gt;
          flash[:error] &amp;lt;&amp;lt; &amp;quot;&amp;lt;br&amp;gt;  &amp;quot; + @assignment_form.assignment.name + &amp;quot; already exists as an assignment name&amp;quot;&lt;br /&gt;
        end&lt;br /&gt;
        if find_existing_directory&lt;br /&gt;
          flash[:error] &amp;lt;&amp;lt; &amp;quot;&amp;lt;br&amp;gt;  &amp;quot; + dir_path + &amp;quot; already exists as a submission directory name&amp;quot;&lt;br /&gt;
        end&lt;br /&gt;
        redirect_to &amp;quot;/assignments/new?private=1&amp;quot;&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      render 'new'&lt;br /&gt;
      undo_link(&amp;quot;Assignment \&amp;quot;#{@assignment_form.assignment.name}\&amp;quot; has been created successfully. &amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Test Plan =&lt;br /&gt;
&lt;br /&gt;
== Manual UI Testing ==&lt;br /&gt;
The following steps must be performed to test the project UI:&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Step 1:''' Log in as an Instructor, with Username - instructor6, Password - password&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:expertiza_login.PNG]]&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Step 2:''' Create a new assignment. Assignment is named as &amp;quot;Test Assignment&amp;quot;, under course CSC/ECE 517 Fall 2020.&lt;br /&gt;
The directory name gets auto generated with replacing space by underscore in assignment name.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:auto_generated.PNG]]&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Step 3:''' Assignment gets successfully created. Assignment is named as &amp;quot;Test Assignment&amp;quot; and gets saved in the directory &amp;quot;Test_assignment&amp;quot;, under course CSC/ECE 517 Fall 2020&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:save_success.PNG]]&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Step 4:''' Try saving another assignment with same name. Following error is observed. br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:error.PNG]]&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
== RSpec Testing ==&lt;br /&gt;
The following RSpec tests are corrected in the &amp;lt;b&amp;gt;assignments_contoller_spec.rb&amp;lt;/b&amp;gt; file&lt;br /&gt;
'''Before'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    context 'when assignment_form is saved successfully' do&lt;br /&gt;
      it 'redirects to assignment#edit page' do&lt;br /&gt;
        allow(assignment_form).to receive(:assignment).and_return(assignment)&lt;br /&gt;
        allow(Assignment).to receive(:find_by).with(any_args).and_return(false)&lt;br /&gt;
        allow(Assignment).to receive(:find_by).with(any_args).and_return(false)&lt;br /&gt;
        allow(assignment_form).to receive(:save).and_return(true)&lt;br /&gt;
        allow(assignment_form).to receive(:create_assignment_node).and_return(double('node'))&lt;br /&gt;
        allow(assignment_form).to receive(:update).with(any_args).and_return(true)&lt;br /&gt;
        allow(assignment).to receive(:id).and_return(1)&lt;br /&gt;
        allow(Assignment).to receive(:find_by).with(course_id:1, name:'test assignment').and_return(assignment)&lt;br /&gt;
        allow_any_instance_of(AssignmentsController).to receive(:undo_link)&lt;br /&gt;
           .with('Assignment &amp;quot;test assignment&amp;quot; has been created successfully. ').and_return(true)&lt;br /&gt;
        post :create, @params&lt;br /&gt;
        expect(response).to redirect_to('/assignments/1/edit')&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
'''After'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 context 'when assignment_form is saved successfully' do&lt;br /&gt;
      it 'redirects to assignment#edit page' do&lt;br /&gt;
        allow(assignment_form).to receive(:assignment).and_return(assignment)&lt;br /&gt;
        allow(Assignment).to receive(:find_by).with(any_args).and_return(false)&lt;br /&gt;
        allow(Assignment).to receive(:find_by).with(any_args).and_return(false)&lt;br /&gt;
        allow(assignment_form).to receive(:save).and_return(true)&lt;br /&gt;
        allow(assignment_form).to receive(:create_assignment_node).and_return(double('node'))&lt;br /&gt;
        allow(assignment_form).to receive(:update).with(any_args).and_return(true)&lt;br /&gt;
        allow(assignment).to receive(:id).and_return(1)&lt;br /&gt;
        allow(Assignment).to receive(:find_by).with(course_id:1, name:'test assignment').and_return(assignment)&lt;br /&gt;
        allow_any_instance_of(AssignmentsController).to receive(:undo_link)&lt;br /&gt;
           .with('Assignment &amp;quot;test assignment&amp;quot; has been created successfully. ').and_return(true)&lt;br /&gt;
        post :create, @params&lt;br /&gt;
        expect(response).to redirect_to('/assignments/1/edit')&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
= Team Information =&lt;br /&gt;
Mentor: Nicholas Himes (nnhimes)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Henry Chen (hchen34)&lt;br /&gt;
&lt;br /&gt;
Saurabh Nanda (snanda2)&lt;br /&gt;
&lt;br /&gt;
Snehapriyaa Mathiyalaghan (smathiy)&lt;/div&gt;</summary>
		<author><name>Hchen34</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2138._Auto-generate_submission_directory_names_based_on_assignment&amp;diff=139540</id>
		<title>CSC/ECE 517 Fall 2021 - E2138. Auto-generate submission directory names based on assignment</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2138._Auto-generate_submission_directory_names_based_on_assignment&amp;diff=139540"/>
		<updated>2021-10-20T21:50:16Z</updated>

		<summary type="html">&lt;p&gt;Hchen34: Undo revision 139528 by Hdu5 (talk)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page describes the changes made under E2138, in order to auto-generate submission directory names based on assignment names for Fall 2021, CSC/ECE 517.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
= Overview =&lt;br /&gt;
&lt;br /&gt;
== About Expertiza ==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
== Issues for this project ==&lt;br /&gt;
&lt;br /&gt;
When instructors give an assignment a name, submission directories should be auto-generated based on the assignment name, and also be unique. A number of issues existed when a previous team worked on this assignment (E2054), including&lt;br /&gt;
* Issue #1: The directory name should be auto-generated from the assignment name.&lt;br /&gt;
* Issue #2: It should be done by changing spaces in the names to underscores. E.g., the directory for Program 1 is by default &amp;quot;Program_1&amp;quot;.&lt;br /&gt;
* Issue #3: A check should be added to prevent two assignments in the same course from having the same name.&lt;br /&gt;
* Issue #4: Verify or add if not present - a check to stop two assignments from sharing the same directory.&lt;br /&gt;
* Issue #5: On changing the name of an assignment while creating it, the code shouldn't throw a NoMethodError.&lt;br /&gt;
&lt;br /&gt;
= Project implementation =&lt;br /&gt;
&lt;br /&gt;
== Submitted work and demonstration of project ==&lt;br /&gt;
&lt;br /&gt;
* [http://152.7.98.88:8080/ Link to deployed code on NCSU VCL]&lt;br /&gt;
* [https://github.com/SN-18/expertiza Link to our Github repository]&lt;br /&gt;
&lt;br /&gt;
== Files involved ==&lt;br /&gt;
*app/controllers/impersonate_controller.rb - refactored the codes related to the issues mentioned above.&lt;br /&gt;
*spec/controllers/impersonate_controller_spec.rb - implemented and added some related tests.&lt;br /&gt;
&lt;br /&gt;
== Changes made to code ==&lt;br /&gt;
&lt;br /&gt;
=== views ===&lt;br /&gt;
The following code was added to &amp;lt;b&amp;gt;app/views/assignments/edit/_general.html.erb&amp;lt;/b&amp;gt;. The purpose is to generate submission directory name from the assignment name and substitute the spacebar with underscore.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
$(function() {&lt;br /&gt;
    $(&amp;quot;#assignment_form_assignment_name&amp;quot;).change(function() {&lt;br /&gt;
        filename = $( &amp;quot;#assignment_form_assignment_name&amp;quot; ).val().replace(/ /g,&amp;quot;_&amp;quot;).replace(/[/\\?%*:|&amp;quot;&amp;lt;&amp;gt;/$&amp;amp;!#%^@]/g, '');;&lt;br /&gt;
        $('#assignment_form_assignment_directory_path').val(filename);&lt;br /&gt;
    });&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
function autogenerate_submission(){&lt;br /&gt;
  assignment_form.assignment.directory_path = assignment_form.assignment.name;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== models ===&lt;br /&gt;
The following code was added to &amp;lt;b&amp;gt;app/models/assignment.rb&amp;lt;/b&amp;gt;'s Assignment class, to add validation for assignment name and directory.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  validates :directory_path, presence: true # E2138 Validation for unique submission directory&lt;br /&gt;
  validates :directory_path, uniqueness: {scope: :course_id}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== controllers ===&lt;br /&gt;
The following code was modified in &amp;lt;b&amp;gt;app/controllers/assignments_controller.rb&amp;lt;/b&amp;gt;'s create method, adding checks for assignment name and directory when creating assignment.&lt;br /&gt;
&lt;br /&gt;
'''Before'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def create&lt;br /&gt;
     @assignment_form = AssignmentForm.new(assignment_form_params)&lt;br /&gt;
     if params[:button]&lt;br /&gt;
       if @assignment_form.save&lt;br /&gt;
         @assignment_form.create_assignment_node&lt;br /&gt;
         exist_assignment = Assignment.find_by(id: @assignment_form.assignment.id)&lt;br /&gt;
         assignment_form_params[:assignment][:id] = exist_assignment.id.to_s&lt;br /&gt;
         if assignment_form_params[:assignment][:directory_path].blank?&lt;br /&gt;
           assignment_form_params[:assignment][:directory_path] = &amp;quot;assignment_#{assignment_form_params[:assignment][:id]}&amp;quot;&lt;br /&gt;
         end&lt;br /&gt;
         ques_array = assignment_form_params[:assignment_questionnaire]&lt;br /&gt;
         due_array = assignment_form_params[:due_date]&lt;br /&gt;
         ques_array.each do |cur_questionnaire|&lt;br /&gt;
           cur_questionnaire[:assignment_id] = exist_assignment.id.to_s&lt;br /&gt;
         end&lt;br /&gt;
         due_array.each do |cur_due|&lt;br /&gt;
           cur_due[:parent_id] = exist_assignment.id.to_s&lt;br /&gt;
         end&lt;br /&gt;
         assignment_form_params[:assignment_questionnaire] = ques_array&lt;br /&gt;
         assignment_form_params[:due_date] = due_array&lt;br /&gt;
         @assignment_form.update(assignment_form_params, current_user)&lt;br /&gt;
         aid = Assignment.find_by(id: @assignment_form.assignment.id).id&lt;br /&gt;
         ExpertizaLogger.info &amp;quot;Assignment created: #{@assignment_form.as_json}&amp;quot;&lt;br /&gt;
         redirect_to edit_assignment_path aid&lt;br /&gt;
         undo_link(&amp;quot;Assignment \&amp;quot;#{@assignment_form.assignment.name}\&amp;quot; has been created successfully. &amp;quot;)&lt;br /&gt;
         return&lt;br /&gt;
       else&lt;br /&gt;
         flash.now[:error] = &amp;quot;Failed to create assignment&amp;quot;&lt;br /&gt;
         render 'new'&lt;br /&gt;
       end&lt;br /&gt;
     else&lt;br /&gt;
       render 'new'&lt;br /&gt;
      undo_link(&amp;quot;Assignment \&amp;quot;#{@assignment_form.assignment.name}\&amp;quot; has been created successfully. &amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''After'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def create&lt;br /&gt;
    @assignment_form = AssignmentForm.new(assignment_form_params)&lt;br /&gt;
    if params[:button]&lt;br /&gt;
      # E2138 issue #3&lt;br /&gt;
      find_existing_assignment = Assignment.find_by(name: @assignment_form.assignment.name, course_id: @assignment_form.assignment.course_id)&lt;br /&gt;
      dir_path = assignment_form_params[:assignment][:directory_path]&lt;br /&gt;
      find_existing_directory = Assignment.find_by(directory_path: dir_path, course_id: @assignment_form.assignment.course_id)&lt;br /&gt;
      if !find_existing_assignment and !find_existing_directory and @assignment_form.save #No existing names/directories &lt;br /&gt;
        @assignment_form.create_assignment_node&lt;br /&gt;
        current_assignment = Assignment.find_by(name: @assignment_form.assignment.name, course_id: @assignment_form.assignment.course_id)&lt;br /&gt;
        assignment_form_params[:assignment][:id] = current_assignment.id.to_s&lt;br /&gt;
        ques_array = assignment_form_params[:assignment_questionnaire]&lt;br /&gt;
        due_array = assignment_form_params[:due_date]&lt;br /&gt;
        ques_array.each do |cur_questionnaire|&lt;br /&gt;
          cur_questionnaire[:assignment_id] = current_assignment.id.to_s&lt;br /&gt;
        end&lt;br /&gt;
        due_array.each do |cur_due|&lt;br /&gt;
          cur_due[:parent_id] = current_assignment.id.to_s&lt;br /&gt;
        end&lt;br /&gt;
        assignment_form_params[:assignment_questionnaire] = ques_array&lt;br /&gt;
        assignment_form_params[:due_date] = due_array&lt;br /&gt;
        @assignment_form.update(assignment_form_params, current_user)&lt;br /&gt;
        aid = Assignment.find_by(name: @assignment_form.assignment.name, course_id: @assignment_form.assignment.course_id).id&lt;br /&gt;
        ExpertizaLogger.info &amp;quot;Assignment created: #{@assignment_form.as_json}&amp;quot;&lt;br /&gt;
        redirect_to edit_assignment_path aid&lt;br /&gt;
        undo_link(&amp;quot;Assignment \&amp;quot;#{@assignment_form.assignment.name}\&amp;quot; has been created successfully. &amp;quot;)&lt;br /&gt;
        return&lt;br /&gt;
      else&lt;br /&gt;
        flash[:error] = &amp;quot;Failed to create assignment.&amp;quot;&lt;br /&gt;
        if find_existing_assignment&lt;br /&gt;
          flash[:error] &amp;lt;&amp;lt; &amp;quot;&amp;lt;br&amp;gt;  &amp;quot; + @assignment_form.assignment.name + &amp;quot; already exists as an assignment name&amp;quot;&lt;br /&gt;
        end&lt;br /&gt;
        if find_existing_directory&lt;br /&gt;
          flash[:error] &amp;lt;&amp;lt; &amp;quot;&amp;lt;br&amp;gt;  &amp;quot; + dir_path + &amp;quot; already exists as a submission directory name&amp;quot;&lt;br /&gt;
        end&lt;br /&gt;
        redirect_to &amp;quot;/assignments/new?private=1&amp;quot;&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      render 'new'&lt;br /&gt;
      undo_link(&amp;quot;Assignment \&amp;quot;#{@assignment_form.assignment.name}\&amp;quot; has been created successfully. &amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Test Plan =&lt;br /&gt;
&lt;br /&gt;
== Manual UI Testing ==&lt;br /&gt;
The following steps must be performed to test the project UI:&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Step 1:''' Log in as an Instructor, with Username - instructor6, Password - password&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:expertiza_login.PNG]]&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Step 2:''' Create a new assignment. Assignment is named as &amp;quot;Test Assignment&amp;quot;, under course CSC/ECE 517 Fall 2020.&lt;br /&gt;
The directory name gets auto generated with replacing space by underscore in assignment name.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:auto_generated.PNG]]&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Step 3:''' Assignment gets successfully created. Assignment is named as &amp;quot;Test Assignment&amp;quot; and gets saved in the directory &amp;quot;Test_assignment&amp;quot;, under course CSC/ECE 517 Fall 2020&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:save_success.PNG]]&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Step 4:''' Try saving another assignment with same name. Following error is observed. br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:error.PNG]]&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
== RSpec Testing ==&lt;br /&gt;
The following RSpec tests are corrected in the &amp;lt;b&amp;gt;assignments_contoller_spec.rb&amp;lt;/b&amp;gt; file&lt;br /&gt;
'''Before'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    context 'when assignment_form is saved successfully' do&lt;br /&gt;
      it 'redirects to assignment#edit page' do&lt;br /&gt;
        allow(assignment_form).to receive(:assignment).and_return(assignment)&lt;br /&gt;
        allow(Assignment).to receive(:find_by).with(any_args).and_return(false)&lt;br /&gt;
        allow(Assignment).to receive(:find_by).with(any_args).and_return(false)&lt;br /&gt;
        allow(assignment_form).to receive(:save).and_return(true)&lt;br /&gt;
        allow(assignment_form).to receive(:create_assignment_node).and_return(double('node'))&lt;br /&gt;
        allow(assignment_form).to receive(:update).with(any_args).and_return(true)&lt;br /&gt;
        allow(assignment).to receive(:id).and_return(1)&lt;br /&gt;
        allow(Assignment).to receive(:find_by).with(course_id:1, name:'test assignment').and_return(assignment)&lt;br /&gt;
        allow_any_instance_of(AssignmentsController).to receive(:undo_link)&lt;br /&gt;
           .with('Assignment &amp;quot;test assignment&amp;quot; has been created successfully. ').and_return(true)&lt;br /&gt;
        post :create, @params&lt;br /&gt;
        expect(response).to redirect_to('/assignments/1/edit')&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
'''After'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 context 'when assignment_form is saved successfully' do&lt;br /&gt;
      it 'redirects to assignment#edit page' do&lt;br /&gt;
        allow(assignment_form).to receive(:assignment).and_return(assignment)&lt;br /&gt;
        allow(Assignment).to receive(:find_by).with(any_args).and_return(false)&lt;br /&gt;
        allow(Assignment).to receive(:find_by).with(any_args).and_return(false)&lt;br /&gt;
        allow(assignment_form).to receive(:save).and_return(true)&lt;br /&gt;
        allow(assignment_form).to receive(:create_assignment_node).and_return(double('node'))&lt;br /&gt;
        allow(assignment_form).to receive(:update).with(any_args).and_return(true)&lt;br /&gt;
        allow(assignment).to receive(:id).and_return(1)&lt;br /&gt;
        allow(Assignment).to receive(:find_by).with(course_id:1, name:'test assignment').and_return(assignment)&lt;br /&gt;
        allow_any_instance_of(AssignmentsController).to receive(:undo_link)&lt;br /&gt;
           .with('Assignment &amp;quot;test assignment&amp;quot; has been created successfully. ').and_return(true)&lt;br /&gt;
        post :create, @params&lt;br /&gt;
        expect(response).to redirect_to('/assignments/1/edit')&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
= Team Information =&lt;br /&gt;
Mentor: Nicholas Himes (nnhimes)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Henry Chen (hchen34)&lt;br /&gt;
&lt;br /&gt;
Saurabh Nanda (snanda2)&lt;br /&gt;
&lt;br /&gt;
Snehapriyaa Mathiyalaghan (smathiy)&lt;/div&gt;</summary>
		<author><name>Hchen34</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2138._Auto-generate_submission_directory_names_based_on_assignment&amp;diff=139539</id>
		<title>CSC/ECE 517 Fall 2021 - E2138. Auto-generate submission directory names based on assignment</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2138._Auto-generate_submission_directory_names_based_on_assignment&amp;diff=139539"/>
		<updated>2021-10-20T21:50:05Z</updated>

		<summary type="html">&lt;p&gt;Hchen34: Undo revision 139529 by Hdu5 (talk)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page describes the changes made under E2138, in order to auto-generate submission directory names based on assignment names for Fall 2021, CSC/ECE 517.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
= Overview =&lt;br /&gt;
&lt;br /&gt;
== About Expertiza ==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
== Issues for this project ==&lt;br /&gt;
&lt;br /&gt;
When instructors give an assignment a name, submission directories should be auto-generated based on the assignment name, and also be unique. A number of issues existed when a previous team worked on this assignment (E2054), including&lt;br /&gt;
* Issue #1: The directory name should be auto-generated from the assignment name.&lt;br /&gt;
* Issue #2: It should be done by changing spaces in the names to underscores. E.g., the directory for Program 1 is by default &amp;quot;Program_1&amp;quot;.&lt;br /&gt;
* Issue #3: A check should be added to prevent two assignments in the same course from having the same name.&lt;br /&gt;
* Issue #4: Verify or add if not present - a check to stop two assignments from sharing the same directory.&lt;br /&gt;
* Issue #5: On changing the name of an assignment while creating it, the code shouldn't throw a NoMethodError.&lt;br /&gt;
&lt;br /&gt;
= Project implementation =&lt;br /&gt;
&lt;br /&gt;
== Submitted work and demonstration of project ==&lt;br /&gt;
&lt;br /&gt;
* [http://152.7.98.88:8080/ Link to deployed code on NCSU VCL]&lt;br /&gt;
* [https://github.com/SN-18/expertiza Link to our Github repository]&lt;br /&gt;
&lt;br /&gt;
== Files involved ==&lt;br /&gt;
*app/controllers/impersonate_controller.rb - refactored the codes related to the issues mentioned above.&lt;br /&gt;
*spec/controllers/impersonate_controller_spec.rb - implemented and added some related tests.&lt;br /&gt;
&lt;br /&gt;
== Changes made to code ==&lt;br /&gt;
&lt;br /&gt;
The following code was modified in &amp;lt;b&amp;gt;app/controllers/impersonate_controller.rb&amp;lt;/b&amp;gt;, in order to refactor to:&lt;br /&gt;
* make the code more readable.&lt;br /&gt;
* properly delete unused variable .&lt;br /&gt;
&lt;br /&gt;
'''Before'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def create&lt;br /&gt;
     @assignment_form = AssignmentForm.new(assignment_form_params)&lt;br /&gt;
     if params[:button]&lt;br /&gt;
       if @assignment_form.save&lt;br /&gt;
         @assignment_form.create_assignment_node&lt;br /&gt;
         exist_assignment = Assignment.find_by(id: @assignment_form.assignment.id)&lt;br /&gt;
         assignment_form_params[:assignment][:id] = exist_assignment.id.to_s&lt;br /&gt;
         if assignment_form_params[:assignment][:directory_path].blank?&lt;br /&gt;
           assignment_form_params[:assignment][:directory_path] = &amp;quot;assignment_#{assignment_form_params[:assignment][:id]}&amp;quot;&lt;br /&gt;
         end&lt;br /&gt;
         ques_array = assignment_form_params[:assignment_questionnaire]&lt;br /&gt;
         due_array = assignment_form_params[:due_date]&lt;br /&gt;
         ques_array.each do |cur_questionnaire|&lt;br /&gt;
           cur_questionnaire[:assignment_id] = exist_assignment.id.to_s&lt;br /&gt;
         end&lt;br /&gt;
         due_array.each do |cur_due|&lt;br /&gt;
           cur_due[:parent_id] = exist_assignment.id.to_s&lt;br /&gt;
         end&lt;br /&gt;
         assignment_form_params[:assignment_questionnaire] = ques_array&lt;br /&gt;
         assignment_form_params[:due_date] = due_array&lt;br /&gt;
         @assignment_form.update(assignment_form_params, current_user)&lt;br /&gt;
         aid = Assignment.find_by(id: @assignment_form.assignment.id).id&lt;br /&gt;
         ExpertizaLogger.info &amp;quot;Assignment created: #{@assignment_form.as_json}&amp;quot;&lt;br /&gt;
         redirect_to edit_assignment_path aid&lt;br /&gt;
         undo_link(&amp;quot;Assignment \&amp;quot;#{@assignment_form.assignment.name}\&amp;quot; has been created successfully. &amp;quot;)&lt;br /&gt;
         return&lt;br /&gt;
       else&lt;br /&gt;
         flash.now[:error] = &amp;quot;Failed to create assignment&amp;quot;&lt;br /&gt;
         render 'new'&lt;br /&gt;
       end&lt;br /&gt;
     else&lt;br /&gt;
       render 'new'&lt;br /&gt;
      undo_link(&amp;quot;Assignment \&amp;quot;#{@assignment_form.assignment.name}\&amp;quot; has been created successfully. &amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''After'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def create&lt;br /&gt;
    @assignment_form = AssignmentForm.new(assignment_form_params)&lt;br /&gt;
    if params[:button]&lt;br /&gt;
      # E2138 issue #3&lt;br /&gt;
      find_existing_assignment = Assignment.find_by(name: @assignment_form.assignment.name, course_id: @assignment_form.assignment.course_id)&lt;br /&gt;
      dir_path = assignment_form_params[:assignment][:directory_path]&lt;br /&gt;
      find_existing_directory = Assignment.find_by(directory_path: dir_path, course_id: @assignment_form.assignment.course_id)&lt;br /&gt;
      if !find_existing_assignment and !find_existing_directory and @assignment_form.save #No existing names/directories &lt;br /&gt;
        @assignment_form.create_assignment_node&lt;br /&gt;
        current_assignment = Assignment.find_by(name: @assignment_form.assignment.name, course_id: @assignment_form.assignment.course_id)&lt;br /&gt;
        assignment_form_params[:assignment][:id] = current_assignment.id.to_s&lt;br /&gt;
        ques_array = assignment_form_params[:assignment_questionnaire]&lt;br /&gt;
        due_array = assignment_form_params[:due_date]&lt;br /&gt;
        ques_array.each do |cur_questionnaire|&lt;br /&gt;
          cur_questionnaire[:assignment_id] = current_assignment.id.to_s&lt;br /&gt;
        end&lt;br /&gt;
        due_array.each do |cur_due|&lt;br /&gt;
          cur_due[:parent_id] = current_assignment.id.to_s&lt;br /&gt;
        end&lt;br /&gt;
        assignment_form_params[:assignment_questionnaire] = ques_array&lt;br /&gt;
        assignment_form_params[:due_date] = due_array&lt;br /&gt;
        @assignment_form.update(assignment_form_params, current_user)&lt;br /&gt;
        aid = Assignment.find_by(name: @assignment_form.assignment.name, course_id: @assignment_form.assignment.course_id).id&lt;br /&gt;
        ExpertizaLogger.info &amp;quot;Assignment created: #{@assignment_form.as_json}&amp;quot;&lt;br /&gt;
        redirect_to edit_assignment_path aid&lt;br /&gt;
        undo_link(&amp;quot;Assignment \&amp;quot;#{@assignment_form.assignment.name}\&amp;quot; has been created successfully. &amp;quot;)&lt;br /&gt;
        return&lt;br /&gt;
      else&lt;br /&gt;
        flash[:error] = &amp;quot;Failed to create assignment.&amp;quot;&lt;br /&gt;
        if find_existing_assignment&lt;br /&gt;
          flash[:error] &amp;lt;&amp;lt; &amp;quot;&amp;lt;br&amp;gt;  &amp;quot; + @assignment_form.assignment.name + &amp;quot; already exists as an assignment name&amp;quot;&lt;br /&gt;
        end&lt;br /&gt;
        if find_existing_directory&lt;br /&gt;
          flash[:error] &amp;lt;&amp;lt; &amp;quot;&amp;lt;br&amp;gt;  &amp;quot; + dir_path + &amp;quot; already exists as a submission directory name&amp;quot;&lt;br /&gt;
        end&lt;br /&gt;
        redirect_to &amp;quot;/assignments/new?private=1&amp;quot;&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      render 'new'&lt;br /&gt;
      undo_link(&amp;quot;Assignment \&amp;quot;#{@assignment_form.assignment.name}\&amp;quot; has been created successfully. &amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Test Plan =&lt;br /&gt;
&lt;br /&gt;
== Manual UI Testing ==&lt;br /&gt;
The following steps must be performed to test the project UI:&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Step 1:''' Log in as an Instructor, with Username - instructor6, Password - password&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:expertiza_login.PNG]]&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Step 2:''' Create a new assignment. Assignment is named as &amp;quot;Test Assignment&amp;quot;, under course CSC/ECE 517 Fall 2020.&lt;br /&gt;
The directory name gets auto generated with replacing space by underscore in assignment name.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:auto_generated.PNG]]&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Step 3:''' Assignment gets successfully created. Assignment is named as &amp;quot;Test Assignment&amp;quot; and gets saved in the directory &amp;quot;Test_assignment&amp;quot;, under course CSC/ECE 517 Fall 2020&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:save_success.PNG]]&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Step 4:''' Try saving another assignment with same name. Following error is observed. br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:error.PNG]]&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
== RSpec Testing ==&lt;br /&gt;
The following RSpec tests are corrected in the &amp;lt;b&amp;gt;assignments_contoller_spec.rb&amp;lt;/b&amp;gt; file&lt;br /&gt;
'''Before'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    context 'when assignment_form is saved successfully' do&lt;br /&gt;
      it 'redirects to assignment#edit page' do&lt;br /&gt;
        allow(assignment_form).to receive(:assignment).and_return(assignment)&lt;br /&gt;
        allow(Assignment).to receive(:find_by).with(any_args).and_return(false)&lt;br /&gt;
        allow(Assignment).to receive(:find_by).with(any_args).and_return(false)&lt;br /&gt;
        allow(assignment_form).to receive(:save).and_return(true)&lt;br /&gt;
        allow(assignment_form).to receive(:create_assignment_node).and_return(double('node'))&lt;br /&gt;
        allow(assignment_form).to receive(:update).with(any_args).and_return(true)&lt;br /&gt;
        allow(assignment).to receive(:id).and_return(1)&lt;br /&gt;
        allow(Assignment).to receive(:find_by).with(course_id:1, name:'test assignment').and_return(assignment)&lt;br /&gt;
        allow_any_instance_of(AssignmentsController).to receive(:undo_link)&lt;br /&gt;
           .with('Assignment &amp;quot;test assignment&amp;quot; has been created successfully. ').and_return(true)&lt;br /&gt;
        post :create, @params&lt;br /&gt;
        expect(response).to redirect_to('/assignments/1/edit')&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
'''After'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 context 'when assignment_form is saved successfully' do&lt;br /&gt;
      it 'redirects to assignment#edit page' do&lt;br /&gt;
        allow(assignment_form).to receive(:assignment).and_return(assignment)&lt;br /&gt;
        allow(Assignment).to receive(:find_by).with(any_args).and_return(false)&lt;br /&gt;
        allow(Assignment).to receive(:find_by).with(any_args).and_return(false)&lt;br /&gt;
        allow(assignment_form).to receive(:save).and_return(true)&lt;br /&gt;
        allow(assignment_form).to receive(:create_assignment_node).and_return(double('node'))&lt;br /&gt;
        allow(assignment_form).to receive(:update).with(any_args).and_return(true)&lt;br /&gt;
        allow(assignment).to receive(:id).and_return(1)&lt;br /&gt;
        allow(Assignment).to receive(:find_by).with(course_id:1, name:'test assignment').and_return(assignment)&lt;br /&gt;
        allow_any_instance_of(AssignmentsController).to receive(:undo_link)&lt;br /&gt;
           .with('Assignment &amp;quot;test assignment&amp;quot; has been created successfully. ').and_return(true)&lt;br /&gt;
        post :create, @params&lt;br /&gt;
        expect(response).to redirect_to('/assignments/1/edit')&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
= Team Information =&lt;br /&gt;
Mentor: Nicholas Himes (nnhimes)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Henry Chen (hchen34)&lt;br /&gt;
&lt;br /&gt;
Saurabh Nanda (snanda2)&lt;br /&gt;
&lt;br /&gt;
Snehapriyaa Mathiyalaghan (smathiy)&lt;/div&gt;</summary>
		<author><name>Hchen34</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2138._Auto-generate_submission_directory_names_based_on_assignment&amp;diff=139538</id>
		<title>CSC/ECE 517 Fall 2021 - E2138. Auto-generate submission directory names based on assignment</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2138._Auto-generate_submission_directory_names_based_on_assignment&amp;diff=139538"/>
		<updated>2021-10-20T21:49:51Z</updated>

		<summary type="html">&lt;p&gt;Hchen34: Undo revision 139530 by Hdu5 (talk)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page describes the changes made under E2138, in order to auto-generate submission directory names based on assignment names for Fall 2021, CSC/ECE 517.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
= Overview =&lt;br /&gt;
&lt;br /&gt;
== About Expertiza ==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
== Issues for this project ==&lt;br /&gt;
&lt;br /&gt;
When instructors give an assignment a name, submission directories should be auto-generated based on the assignment name, and also be unique. A number of issues existed when a previous team worked on this assignment (E2054), including&lt;br /&gt;
* Issue #1: The directory name should be auto-generated from the assignment name.&lt;br /&gt;
* Issue #2: It should be done by changing spaces in the names to underscores. E.g., the directory for Program 1 is by default &amp;quot;Program_1&amp;quot;.&lt;br /&gt;
* Issue #3: A check should be added to prevent two assignments in the same course from having the same name.&lt;br /&gt;
* Issue #4: Verify or add if not present - a check to stop two assignments from sharing the same directory.&lt;br /&gt;
* Issue #5: On changing the name of an assignment while creating it, the code shouldn't throw a NoMethodError.&lt;br /&gt;
&lt;br /&gt;
= Project implementation =&lt;br /&gt;
&lt;br /&gt;
== Submitted work and demonstration of project ==&lt;br /&gt;
&lt;br /&gt;
* [http://152.7.98.88:8080/ Link to deployed code on NCSU VCL]&lt;br /&gt;
* [https://github.com/SN-18/expertiza Link to our Github repository]&lt;br /&gt;
&lt;br /&gt;
== Files involved ==&lt;br /&gt;
*app/controllers/impersonate_controller.rb - refactored the codes related to the issues mentioned above.&lt;br /&gt;
*spec/controllers/impersonate_controller_spec.rb - implemented and added some related tests.&lt;br /&gt;
&lt;br /&gt;
== Changes made to code ==&lt;br /&gt;
&lt;br /&gt;
The following code was modified in &amp;lt;b&amp;gt;app/controllers/impersonate_controller.rb&amp;lt;/b&amp;gt;, in order to refactor to:&lt;br /&gt;
* make the code more readable.&lt;br /&gt;
* properly delete unused variable .&lt;br /&gt;
&lt;br /&gt;
'''Before'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def overwrite_session&lt;br /&gt;
    # If not impersonatable, then original user's session remains&lt;br /&gt;
    if params[:impersonate].nil?&lt;br /&gt;
      # E1991 : check whether instructor is currently in anonymized view&lt;br /&gt;
      user = User.anonymized_view?(session[:ip]) ? User.real_user_from_anonymized_name(params[:user][:name]) : user = User.find_by(name: params[:user][:name])&lt;br /&gt;
      session[:super_user] = session[:user] if session[:super_user].nil?&lt;br /&gt;
      AuthController.clear_user_info(session, nil)&lt;br /&gt;
      session[:original_user] = @original_user&lt;br /&gt;
      session[:impersonate] = true&lt;br /&gt;
      session[:user] = user&lt;br /&gt;
    else&lt;br /&gt;
      # If some user is to be impersonated, their session details are overwritten onto the current to impersonate&lt;br /&gt;
      if !params[:impersonate][:name].empty?&lt;br /&gt;
        # E1991 : check whether instructor is currently in anonymized view&lt;br /&gt;
        user = User.anonymized_view?(session[:ip]) ? User.real_user_from_anonymized_name(params[:impersonate][:name]) : user = user = User.find_by(name: params[:impersonate][:name])&lt;br /&gt;
        AuthController.clear_user_info(session, nil)&lt;br /&gt;
        session[:user] = user&lt;br /&gt;
        session[:impersonate] =  true&lt;br /&gt;
        session[:original_user] = @original_user&lt;br /&gt;
      else&lt;br /&gt;
        # E1991 : check whether instructor is currently in anonymized view&lt;br /&gt;
        user = User.anonymized_view?(session[:ip]) ? User.real_user_from_anonymized_name(params[:user][:name]) : user = User.find_by(name: params[:user][:name])&lt;br /&gt;
        AuthController.clear_user_info(session, nil)&lt;br /&gt;
        session[:user] = session[:super_user]&lt;br /&gt;
        user = session[:user]&lt;br /&gt;
        session[:super_user] = nil&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''After'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   def overwrite_session&lt;br /&gt;
    # If not impersonatable, then original user's session remains&lt;br /&gt;
    if params[:impersonate].nil?&lt;br /&gt;
      # E1991 : check whether instructor is currently in anonymized view&lt;br /&gt;
      if User.anonymized_view?(session[:ip])&lt;br /&gt;
        user = User.real_user_from_anonymized_name(params[:user][:name])&lt;br /&gt;
      else&lt;br /&gt;
        user = User.find_by(name: params[:user][:name])&lt;br /&gt;
      end&lt;br /&gt;
      session[:super_user] = session[:user] if session[:super_user].nil?&lt;br /&gt;
      AuthController.clear_user_info(session, nil)&lt;br /&gt;
      session[:original_user] = @original_user&lt;br /&gt;
      session[:impersonate] = true&lt;br /&gt;
      session[:user] = user&lt;br /&gt;
      # If some user is to be impersonated, their session details are overwritten onto the current to impersonate&lt;br /&gt;
    elsif !params[:impersonate][:name].empty?&lt;br /&gt;
      # E1991 : check whether instructor is currently in anonymized view&lt;br /&gt;
      if User.anonymized_view?(session[:ip])&lt;br /&gt;
        user = User.real_user_from_anonymized_name(params[:impersonate][:name])&lt;br /&gt;
      else&lt;br /&gt;
        user = User.find_by(name: params[:impersonate][:name])&lt;br /&gt;
      end&lt;br /&gt;
      AuthController.clear_user_info(session, nil)&lt;br /&gt;
      session[:user] = user&lt;br /&gt;
      session[:impersonate] =  true&lt;br /&gt;
      session[:original_user] = @original_user&lt;br /&gt;
    else&lt;br /&gt;
      # E1991 : check whether instructor is currently in anonymized view&lt;br /&gt;
      AuthController.clear_user_info(session, nil)&lt;br /&gt;
      session[:user] = session[:super_user]&lt;br /&gt;
      session[:super_user] = nil&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Test Plan =&lt;br /&gt;
&lt;br /&gt;
== Manual UI Testing ==&lt;br /&gt;
The following steps must be performed to test the project UI:&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Step 1:''' Log in as an Instructor, with Username - instructor6, Password - password&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:expertiza_login.PNG]]&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Step 2:''' Create a new assignment. Assignment is named as &amp;quot;Test Assignment&amp;quot;, under course CSC/ECE 517 Fall 2020.&lt;br /&gt;
The directory name gets auto generated with replacing space by underscore in assignment name.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:auto_generated.PNG]]&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Step 3:''' Assignment gets successfully created. Assignment is named as &amp;quot;Test Assignment&amp;quot; and gets saved in the directory &amp;quot;Test_assignment&amp;quot;, under course CSC/ECE 517 Fall 2020&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:save_success.PNG]]&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Step 4:''' Try saving another assignment with same name. Following error is observed. br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:error.PNG]]&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
== RSpec Testing ==&lt;br /&gt;
The following RSpec tests are corrected in the &amp;lt;b&amp;gt;assignments_contoller_spec.rb&amp;lt;/b&amp;gt; file&lt;br /&gt;
'''Before'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    context 'when assignment_form is saved successfully' do&lt;br /&gt;
      it 'redirects to assignment#edit page' do&lt;br /&gt;
        allow(assignment_form).to receive(:assignment).and_return(assignment)&lt;br /&gt;
        allow(Assignment).to receive(:find_by).with(any_args).and_return(false)&lt;br /&gt;
        allow(Assignment).to receive(:find_by).with(any_args).and_return(false)&lt;br /&gt;
        allow(assignment_form).to receive(:save).and_return(true)&lt;br /&gt;
        allow(assignment_form).to receive(:create_assignment_node).and_return(double('node'))&lt;br /&gt;
        allow(assignment_form).to receive(:update).with(any_args).and_return(true)&lt;br /&gt;
        allow(assignment).to receive(:id).and_return(1)&lt;br /&gt;
        allow(Assignment).to receive(:find_by).with(course_id:1, name:'test assignment').and_return(assignment)&lt;br /&gt;
        allow_any_instance_of(AssignmentsController).to receive(:undo_link)&lt;br /&gt;
           .with('Assignment &amp;quot;test assignment&amp;quot; has been created successfully. ').and_return(true)&lt;br /&gt;
        post :create, @params&lt;br /&gt;
        expect(response).to redirect_to('/assignments/1/edit')&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
'''After'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 context 'when assignment_form is saved successfully' do&lt;br /&gt;
      it 'redirects to assignment#edit page' do&lt;br /&gt;
        allow(assignment_form).to receive(:assignment).and_return(assignment)&lt;br /&gt;
        allow(Assignment).to receive(:find_by).with(any_args).and_return(false)&lt;br /&gt;
        allow(Assignment).to receive(:find_by).with(any_args).and_return(false)&lt;br /&gt;
        allow(assignment_form).to receive(:save).and_return(true)&lt;br /&gt;
        allow(assignment_form).to receive(:create_assignment_node).and_return(double('node'))&lt;br /&gt;
        allow(assignment_form).to receive(:update).with(any_args).and_return(true)&lt;br /&gt;
        allow(assignment).to receive(:id).and_return(1)&lt;br /&gt;
        allow(Assignment).to receive(:find_by).with(course_id:1, name:'test assignment').and_return(assignment)&lt;br /&gt;
        allow_any_instance_of(AssignmentsController).to receive(:undo_link)&lt;br /&gt;
           .with('Assignment &amp;quot;test assignment&amp;quot; has been created successfully. ').and_return(true)&lt;br /&gt;
        post :create, @params&lt;br /&gt;
        expect(response).to redirect_to('/assignments/1/edit')&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
= Team Information =&lt;br /&gt;
Mentor: Nicholas Himes (nnhimes)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Henry Chen (hchen34)&lt;br /&gt;
&lt;br /&gt;
Saurabh Nanda (snanda2)&lt;br /&gt;
&lt;br /&gt;
Snehapriyaa Mathiyalaghan (smathiy)&lt;/div&gt;</summary>
		<author><name>Hchen34</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2138._Auto-generate_submission_directory_names_based_on_assignment&amp;diff=139537</id>
		<title>CSC/ECE 517 Fall 2021 - E2138. Auto-generate submission directory names based on assignment</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2138._Auto-generate_submission_directory_names_based_on_assignment&amp;diff=139537"/>
		<updated>2021-10-20T21:49:21Z</updated>

		<summary type="html">&lt;p&gt;Hchen34: Undo revision 139531 by Hdu5 (talk)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page describes the changes made under E2138, in order to auto-generate submission directory names based on assignment names for Fall 2021, CSC/ECE 517.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
= Overview =&lt;br /&gt;
&lt;br /&gt;
== About Expertiza ==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
== Issues for this project ==&lt;br /&gt;
&lt;br /&gt;
When instructors give an assignment a name, submission directories should be auto-generated based on the assignment name, and also be unique. A number of issues existed when a previous team worked on this assignment (E2054), including&lt;br /&gt;
* Issue #1: The directory name should be auto-generated from the assignment name.&lt;br /&gt;
* Issue #2: It should be done by changing spaces in the names to underscores. E.g., the directory for Program 1 is by default &amp;quot;Program_1&amp;quot;.&lt;br /&gt;
* Issue #3: A check should be added to prevent two assignments in the same course from having the same name.&lt;br /&gt;
* Issue #4: Verify or add if not present - a check to stop two assignments from sharing the same directory.&lt;br /&gt;
* Issue #5: On changing the name of an assignment while creating it, the code shouldn't throw a NoMethodError.&lt;br /&gt;
&lt;br /&gt;
= Project implementation =&lt;br /&gt;
&lt;br /&gt;
== Submitted work and demonstration of project ==&lt;br /&gt;
&lt;br /&gt;
* [http://152.7.98.88:8080/ Link to deployed code on NCSU VCL]&lt;br /&gt;
* [https://github.com/SN-18/expertiza Link to our Github repository]&lt;br /&gt;
&lt;br /&gt;
== Files involved ==&lt;br /&gt;
*app/controllers/impersonate_controller.rb - refactored the codes related to the issues mentioned above.&lt;br /&gt;
*spec/controllers/impersonate_controller_spec.rb - implemented and added some related tests.&lt;br /&gt;
&lt;br /&gt;
== Changes made to code ==&lt;br /&gt;
&lt;br /&gt;
* The following code was modified in &amp;lt;b&amp;gt;app/controllers/impersonate_controller.rb&amp;lt;/b&amp;gt;, in order to refactor to:&lt;br /&gt;
** make the code more readable.&lt;br /&gt;
** properly delete unused variable.&lt;br /&gt;
&lt;br /&gt;
* In function &amp;lt;b&amp;gt;overwrite_session&amp;lt;/b&amp;gt;:&lt;br /&gt;
'''Before'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def overwrite_session&lt;br /&gt;
    # If not impersonatable, then original user's session remains&lt;br /&gt;
    if params[:impersonate].nil?&lt;br /&gt;
      # E1991 : check whether instructor is currently in anonymized view&lt;br /&gt;
      user = User.anonymized_view?(session[:ip]) ? User.real_user_from_anonymized_name(params[:user][:name]) : user = User.find_by(name: params[:user][:name])&lt;br /&gt;
      session[:super_user] = session[:user] if session[:super_user].nil?&lt;br /&gt;
      AuthController.clear_user_info(session, nil)&lt;br /&gt;
      session[:original_user] = @original_user&lt;br /&gt;
      session[:impersonate] = true&lt;br /&gt;
      session[:user] = user&lt;br /&gt;
    else&lt;br /&gt;
      # If some user is to be impersonated, their session details are overwritten onto the current to impersonate&lt;br /&gt;
      if !params[:impersonate][:name].empty?&lt;br /&gt;
        # E1991 : check whether instructor is currently in anonymized view&lt;br /&gt;
        user = User.anonymized_view?(session[:ip]) ? User.real_user_from_anonymized_name(params[:impersonate][:name]) : user = user = User.find_by(name: params[:impersonate][:name])&lt;br /&gt;
        AuthController.clear_user_info(session, nil)&lt;br /&gt;
        session[:user] = user&lt;br /&gt;
        session[:impersonate] =  true&lt;br /&gt;
        session[:original_user] = @original_user&lt;br /&gt;
      else&lt;br /&gt;
        # E1991 : check whether instructor is currently in anonymized view&lt;br /&gt;
        user = User.anonymized_view?(session[:ip]) ? User.real_user_from_anonymized_name(params[:user][:name]) : user = User.find_by(name: params[:user][:name])&lt;br /&gt;
        AuthController.clear_user_info(session, nil)&lt;br /&gt;
        session[:user] = session[:super_user]&lt;br /&gt;
        user = session[:user]&lt;br /&gt;
        session[:super_user] = nil&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''After'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   def overwrite_session&lt;br /&gt;
    # If not impersonatable, then original user's session remains&lt;br /&gt;
    if params[:impersonate].nil?&lt;br /&gt;
      # E1991 : check whether instructor is currently in anonymized view&lt;br /&gt;
      if User.anonymized_view?(session[:ip])&lt;br /&gt;
        user = User.real_user_from_anonymized_name(params[:user][:name])&lt;br /&gt;
      else&lt;br /&gt;
        user = User.find_by(name: params[:user][:name])&lt;br /&gt;
      end&lt;br /&gt;
      session[:super_user] = session[:user] if session[:super_user].nil?&lt;br /&gt;
      AuthController.clear_user_info(session, nil)&lt;br /&gt;
      session[:original_user] = @original_user&lt;br /&gt;
      session[:impersonate] = true&lt;br /&gt;
      session[:user] = user&lt;br /&gt;
      # If some user is to be impersonated, their session details are overwritten onto the current to impersonate&lt;br /&gt;
    elsif !params[:impersonate][:name].empty?&lt;br /&gt;
      # E1991 : check whether instructor is currently in anonymized view&lt;br /&gt;
      if User.anonymized_view?(session[:ip])&lt;br /&gt;
        user = User.real_user_from_anonymized_name(params[:impersonate][:name])&lt;br /&gt;
      else&lt;br /&gt;
        user = User.find_by(name: params[:impersonate][:name])&lt;br /&gt;
      end&lt;br /&gt;
      AuthController.clear_user_info(session, nil)&lt;br /&gt;
      session[:user] = user&lt;br /&gt;
      session[:impersonate] =  true&lt;br /&gt;
      session[:original_user] = @original_user&lt;br /&gt;
    else&lt;br /&gt;
      # E1991 : check whether instructor is currently in anonymized view&lt;br /&gt;
      AuthController.clear_user_info(session, nil)&lt;br /&gt;
      session[:user] = session[:super_user]&lt;br /&gt;
      session[:super_user] = nil&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Test Plan =&lt;br /&gt;
&lt;br /&gt;
== Manual UI Testing ==&lt;br /&gt;
The following steps must be performed to test the project UI:&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Step 1:''' Log in as an Instructor, with Username - instructor6, Password - password&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:expertiza_login.PNG]]&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Step 2:''' Create a new assignment. Assignment is named as &amp;quot;Test Assignment&amp;quot;, under course CSC/ECE 517 Fall 2020.&lt;br /&gt;
The directory name gets auto generated with replacing space by underscore in assignment name.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:auto_generated.PNG]]&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Step 3:''' Assignment gets successfully created. Assignment is named as &amp;quot;Test Assignment&amp;quot; and gets saved in the directory &amp;quot;Test_assignment&amp;quot;, under course CSC/ECE 517 Fall 2020&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:save_success.PNG]]&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Step 4:''' Try saving another assignment with same name. Following error is observed. br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:error.PNG]]&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
== RSpec Testing ==&lt;br /&gt;
The following RSpec tests are corrected in the &amp;lt;b&amp;gt;assignments_contoller_spec.rb&amp;lt;/b&amp;gt; file&lt;br /&gt;
'''Before'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    context 'when assignment_form is saved successfully' do&lt;br /&gt;
      it 'redirects to assignment#edit page' do&lt;br /&gt;
        allow(assignment_form).to receive(:assignment).and_return(assignment)&lt;br /&gt;
        allow(Assignment).to receive(:find_by).with(any_args).and_return(false)&lt;br /&gt;
        allow(Assignment).to receive(:find_by).with(any_args).and_return(false)&lt;br /&gt;
        allow(assignment_form).to receive(:save).and_return(true)&lt;br /&gt;
        allow(assignment_form).to receive(:create_assignment_node).and_return(double('node'))&lt;br /&gt;
        allow(assignment_form).to receive(:update).with(any_args).and_return(true)&lt;br /&gt;
        allow(assignment).to receive(:id).and_return(1)&lt;br /&gt;
        allow(Assignment).to receive(:find_by).with(course_id:1, name:'test assignment').and_return(assignment)&lt;br /&gt;
        allow_any_instance_of(AssignmentsController).to receive(:undo_link)&lt;br /&gt;
           .with('Assignment &amp;quot;test assignment&amp;quot; has been created successfully. ').and_return(true)&lt;br /&gt;
        post :create, @params&lt;br /&gt;
        expect(response).to redirect_to('/assignments/1/edit')&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
'''After'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 context 'when assignment_form is saved successfully' do&lt;br /&gt;
      it 'redirects to assignment#edit page' do&lt;br /&gt;
        allow(assignment_form).to receive(:assignment).and_return(assignment)&lt;br /&gt;
        allow(Assignment).to receive(:find_by).with(any_args).and_return(false)&lt;br /&gt;
        allow(Assignment).to receive(:find_by).with(any_args).and_return(false)&lt;br /&gt;
        allow(assignment_form).to receive(:save).and_return(true)&lt;br /&gt;
        allow(assignment_form).to receive(:create_assignment_node).and_return(double('node'))&lt;br /&gt;
        allow(assignment_form).to receive(:update).with(any_args).and_return(true)&lt;br /&gt;
        allow(assignment).to receive(:id).and_return(1)&lt;br /&gt;
        allow(Assignment).to receive(:find_by).with(course_id:1, name:'test assignment').and_return(assignment)&lt;br /&gt;
        allow_any_instance_of(AssignmentsController).to receive(:undo_link)&lt;br /&gt;
           .with('Assignment &amp;quot;test assignment&amp;quot; has been created successfully. ').and_return(true)&lt;br /&gt;
        post :create, @params&lt;br /&gt;
        expect(response).to redirect_to('/assignments/1/edit')&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
= Team Information =&lt;br /&gt;
Mentor: Nicholas Himes (nnhimes)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Henry Chen (hchen34)&lt;br /&gt;
&lt;br /&gt;
Saurabh Nanda (snanda2)&lt;br /&gt;
&lt;br /&gt;
Snehapriyaa Mathiyalaghan (smathiy)&lt;/div&gt;</summary>
		<author><name>Hchen34</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2138._Auto-generate_submission_directory_names_based_on_assignment&amp;diff=139536</id>
		<title>CSC/ECE 517 Fall 2021 - E2138. Auto-generate submission directory names based on assignment</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2138._Auto-generate_submission_directory_names_based_on_assignment&amp;diff=139536"/>
		<updated>2021-10-20T21:49:02Z</updated>

		<summary type="html">&lt;p&gt;Hchen34: Undo revision 139532 by Hdu5 (talk)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page describes the changes made under E2138, in order to auto-generate submission directory names based on assignment names for Fall 2021, CSC/ECE 517.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
= Overview =&lt;br /&gt;
&lt;br /&gt;
== About Expertiza ==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
== Issues for this project ==&lt;br /&gt;
&lt;br /&gt;
When instructors give an assignment a name, submission directories should be auto-generated based on the assignment name, and also be unique. A number of issues existed when a previous team worked on this assignment (E2054), including&lt;br /&gt;
* Issue #1: The directory name should be auto-generated from the assignment name.&lt;br /&gt;
* Issue #2: It should be done by changing spaces in the names to underscores. E.g., the directory for Program 1 is by default &amp;quot;Program_1&amp;quot;.&lt;br /&gt;
* Issue #3: A check should be added to prevent two assignments in the same course from having the same name.&lt;br /&gt;
* Issue #4: Verify or add if not present - a check to stop two assignments from sharing the same directory.&lt;br /&gt;
* Issue #5: On changing the name of an assignment while creating it, the code shouldn't throw a NoMethodError.&lt;br /&gt;
&lt;br /&gt;
= Project implementation =&lt;br /&gt;
&lt;br /&gt;
== Submitted work and demonstration of project ==&lt;br /&gt;
&lt;br /&gt;
* [http://152.7.98.88:8080/ Link to deployed code on NCSU VCL]&lt;br /&gt;
* [https://github.com/SN-18/expertiza Link to our Github repository]&lt;br /&gt;
&lt;br /&gt;
== Files involved ==&lt;br /&gt;
*app/controllers/impersonate_controller.rb - refactored the codes related to the issues mentioned above.&lt;br /&gt;
*spec/controllers/impersonate_controller_spec.rb - implemented and added some related tests.&lt;br /&gt;
&lt;br /&gt;
== Changes made to code ==&lt;br /&gt;
&lt;br /&gt;
* The following code was modified in &amp;lt;b&amp;gt;app/controllers/impersonate_controller.rb&amp;lt;/b&amp;gt;, in order to refactor to:&lt;br /&gt;
** make the code more readable.&lt;br /&gt;
** properly delete unused variable.&lt;br /&gt;
&lt;br /&gt;
=== In function &amp;lt;b&amp;gt;overwrite_session&amp;lt;/b&amp;gt; ===&lt;br /&gt;
'''Before'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def overwrite_session&lt;br /&gt;
    # If not impersonatable, then original user's session remains&lt;br /&gt;
    if params[:impersonate].nil?&lt;br /&gt;
      # E1991 : check whether instructor is currently in anonymized view&lt;br /&gt;
      user = User.anonymized_view?(session[:ip]) ? User.real_user_from_anonymized_name(params[:user][:name]) : user = User.find_by(name: params[:user][:name])&lt;br /&gt;
      session[:super_user] = session[:user] if session[:super_user].nil?&lt;br /&gt;
      AuthController.clear_user_info(session, nil)&lt;br /&gt;
      session[:original_user] = @original_user&lt;br /&gt;
      session[:impersonate] = true&lt;br /&gt;
      session[:user] = user&lt;br /&gt;
    else&lt;br /&gt;
      # If some user is to be impersonated, their session details are overwritten onto the current to impersonate&lt;br /&gt;
      if !params[:impersonate][:name].empty?&lt;br /&gt;
        # E1991 : check whether instructor is currently in anonymized view&lt;br /&gt;
        user = User.anonymized_view?(session[:ip]) ? User.real_user_from_anonymized_name(params[:impersonate][:name]) : user = user = User.find_by(name: params[:impersonate][:name])&lt;br /&gt;
        AuthController.clear_user_info(session, nil)&lt;br /&gt;
        session[:user] = user&lt;br /&gt;
        session[:impersonate] =  true&lt;br /&gt;
        session[:original_user] = @original_user&lt;br /&gt;
      else&lt;br /&gt;
        # E1991 : check whether instructor is currently in anonymized view&lt;br /&gt;
        user = User.anonymized_view?(session[:ip]) ? User.real_user_from_anonymized_name(params[:user][:name]) : user = User.find_by(name: params[:user][:name])&lt;br /&gt;
        AuthController.clear_user_info(session, nil)&lt;br /&gt;
        session[:user] = session[:super_user]&lt;br /&gt;
        user = session[:user]&lt;br /&gt;
        session[:super_user] = nil&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''After'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   def overwrite_session&lt;br /&gt;
    # If not impersonatable, then original user's session remains&lt;br /&gt;
    if params[:impersonate].nil?&lt;br /&gt;
      # E1991 : check whether instructor is currently in anonymized view&lt;br /&gt;
      if User.anonymized_view?(session[:ip])&lt;br /&gt;
        user = User.real_user_from_anonymized_name(params[:user][:name])&lt;br /&gt;
      else&lt;br /&gt;
        user = User.find_by(name: params[:user][:name])&lt;br /&gt;
      end&lt;br /&gt;
      session[:super_user] = session[:user] if session[:super_user].nil?&lt;br /&gt;
      AuthController.clear_user_info(session, nil)&lt;br /&gt;
      session[:original_user] = @original_user&lt;br /&gt;
      session[:impersonate] = true&lt;br /&gt;
      session[:user] = user&lt;br /&gt;
      # If some user is to be impersonated, their session details are overwritten onto the current to impersonate&lt;br /&gt;
    elsif !params[:impersonate][:name].empty?&lt;br /&gt;
      # E1991 : check whether instructor is currently in anonymized view&lt;br /&gt;
      if User.anonymized_view?(session[:ip])&lt;br /&gt;
        user = User.real_user_from_anonymized_name(params[:impersonate][:name])&lt;br /&gt;
      else&lt;br /&gt;
        user = User.find_by(name: params[:impersonate][:name])&lt;br /&gt;
      end&lt;br /&gt;
      AuthController.clear_user_info(session, nil)&lt;br /&gt;
      session[:user] = user&lt;br /&gt;
      session[:impersonate] =  true&lt;br /&gt;
      session[:original_user] = @original_user&lt;br /&gt;
    else&lt;br /&gt;
      # E1991 : check whether instructor is currently in anonymized view&lt;br /&gt;
      AuthController.clear_user_info(session, nil)&lt;br /&gt;
      session[:user] = session[:super_user]&lt;br /&gt;
      session[:super_user] = nil&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Test Plan =&lt;br /&gt;
&lt;br /&gt;
== Manual UI Testing ==&lt;br /&gt;
The following steps must be performed to test the project UI:&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Step 1:''' Log in as an Instructor, with Username - instructor6, Password - password&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:expertiza_login.PNG]]&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Step 2:''' Create a new assignment. Assignment is named as &amp;quot;Test Assignment&amp;quot;, under course CSC/ECE 517 Fall 2020.&lt;br /&gt;
The directory name gets auto generated with replacing space by underscore in assignment name.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:auto_generated.PNG]]&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Step 3:''' Assignment gets successfully created. Assignment is named as &amp;quot;Test Assignment&amp;quot; and gets saved in the directory &amp;quot;Test_assignment&amp;quot;, under course CSC/ECE 517 Fall 2020&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:save_success.PNG]]&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Step 4:''' Try saving another assignment with same name. Following error is observed. br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:error.PNG]]&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
== RSpec Testing ==&lt;br /&gt;
The following RSpec tests are corrected in the &amp;lt;b&amp;gt;assignments_contoller_spec.rb&amp;lt;/b&amp;gt; file&lt;br /&gt;
'''Before'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    context 'when assignment_form is saved successfully' do&lt;br /&gt;
      it 'redirects to assignment#edit page' do&lt;br /&gt;
        allow(assignment_form).to receive(:assignment).and_return(assignment)&lt;br /&gt;
        allow(Assignment).to receive(:find_by).with(any_args).and_return(false)&lt;br /&gt;
        allow(Assignment).to receive(:find_by).with(any_args).and_return(false)&lt;br /&gt;
        allow(assignment_form).to receive(:save).and_return(true)&lt;br /&gt;
        allow(assignment_form).to receive(:create_assignment_node).and_return(double('node'))&lt;br /&gt;
        allow(assignment_form).to receive(:update).with(any_args).and_return(true)&lt;br /&gt;
        allow(assignment).to receive(:id).and_return(1)&lt;br /&gt;
        allow(Assignment).to receive(:find_by).with(course_id:1, name:'test assignment').and_return(assignment)&lt;br /&gt;
        allow_any_instance_of(AssignmentsController).to receive(:undo_link)&lt;br /&gt;
           .with('Assignment &amp;quot;test assignment&amp;quot; has been created successfully. ').and_return(true)&lt;br /&gt;
        post :create, @params&lt;br /&gt;
        expect(response).to redirect_to('/assignments/1/edit')&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
'''After'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 context 'when assignment_form is saved successfully' do&lt;br /&gt;
      it 'redirects to assignment#edit page' do&lt;br /&gt;
        allow(assignment_form).to receive(:assignment).and_return(assignment)&lt;br /&gt;
        allow(Assignment).to receive(:find_by).with(any_args).and_return(false)&lt;br /&gt;
        allow(Assignment).to receive(:find_by).with(any_args).and_return(false)&lt;br /&gt;
        allow(assignment_form).to receive(:save).and_return(true)&lt;br /&gt;
        allow(assignment_form).to receive(:create_assignment_node).and_return(double('node'))&lt;br /&gt;
        allow(assignment_form).to receive(:update).with(any_args).and_return(true)&lt;br /&gt;
        allow(assignment).to receive(:id).and_return(1)&lt;br /&gt;
        allow(Assignment).to receive(:find_by).with(course_id:1, name:'test assignment').and_return(assignment)&lt;br /&gt;
        allow_any_instance_of(AssignmentsController).to receive(:undo_link)&lt;br /&gt;
           .with('Assignment &amp;quot;test assignment&amp;quot; has been created successfully. ').and_return(true)&lt;br /&gt;
        post :create, @params&lt;br /&gt;
        expect(response).to redirect_to('/assignments/1/edit')&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
= Team Information =&lt;br /&gt;
Mentor: Nicholas Himes (nnhimes)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Henry Chen (hchen34)&lt;br /&gt;
&lt;br /&gt;
Saurabh Nanda (snanda2)&lt;br /&gt;
&lt;br /&gt;
Snehapriyaa Mathiyalaghan (smathiy)&lt;/div&gt;</summary>
		<author><name>Hchen34</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2138._Auto-generate_submission_directory_names_based_on_assignment&amp;diff=139232</id>
		<title>CSC/ECE 517 Fall 2021 - E2138. Auto-generate submission directory names based on assignment</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2138._Auto-generate_submission_directory_names_based_on_assignment&amp;diff=139232"/>
		<updated>2021-10-20T00:36:06Z</updated>

		<summary type="html">&lt;p&gt;Hchen34: minor formatting changes&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page describes the changes made under E2138, in order to auto-generate submission directory names based on assignment names for Fall 2021, CSC/ECE 517.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
= Overview =&lt;br /&gt;
&lt;br /&gt;
== About Expertiza ==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
== Issues for this project ==&lt;br /&gt;
&lt;br /&gt;
When instructors give an assignment a name, submission directories should be auto-generated based on the assignment name, and also be unique. A number of issues existed when a previous team worked on this assignment (E2054), including&lt;br /&gt;
* Issue #1: The directory name should be auto-generated from the assignment name.&lt;br /&gt;
* Issue #2: It should be done by changing spaces in the names to underscores. E.g., the directory for Program 1 is by default &amp;quot;Program_1&amp;quot;.&lt;br /&gt;
* Issue #3: A check should be added to prevent two assignments in the same course from having the same name.&lt;br /&gt;
* Issue #4: Verify or add if not present - a check to stop two assignments from sharing the same directory.&lt;br /&gt;
* Issue #5: On changing the name of an assignment while creating it, the code shouldn't throw a NoMethodError.&lt;br /&gt;
&lt;br /&gt;
= Project implementation =&lt;br /&gt;
&lt;br /&gt;
== Submitted work and demonstration of project ==&lt;br /&gt;
&lt;br /&gt;
* [http://152.7.98.88:8080/ Link to deployed code on NCSU VCL]&lt;br /&gt;
* [https://github.com/SN-18/expertiza Link to our Github repository]&lt;br /&gt;
&lt;br /&gt;
== Files involved ==&lt;br /&gt;
*app/views/assignments/edit/_general.html.erb - added function that auto generate directory name, and substitute its spacebar with underscore.&lt;br /&gt;
*app/models/assignment.rb - added presence and uniqueness validation to assignment.&lt;br /&gt;
*app/controllers/assignments_controller.rb - modify create method to check for existing assignment name &amp;amp; directory.&lt;br /&gt;
&lt;br /&gt;
== Changes made to code ==&lt;br /&gt;
&lt;br /&gt;
=== views ===&lt;br /&gt;
The following code was added to &amp;lt;b&amp;gt;app/views/assignments/edit/_general.html.erb&amp;lt;/b&amp;gt;. The purpose is to generate submission directory name from the assignment name and substitute the spacebar with underscore.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
$(function() {&lt;br /&gt;
    $(&amp;quot;#assignment_form_assignment_name&amp;quot;).change(function() {&lt;br /&gt;
        filename = $( &amp;quot;#assignment_form_assignment_name&amp;quot; ).val().replace(/ /g,&amp;quot;_&amp;quot;).replace(/[/\\?%*:|&amp;quot;&amp;lt;&amp;gt;/$&amp;amp;!#%^@]/g, '');;&lt;br /&gt;
        $('#assignment_form_assignment_directory_path').val(filename);&lt;br /&gt;
    });&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
function autogenerate_submission(){&lt;br /&gt;
  assignment_form.assignment.directory_path = assignment_form.assignment.name;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== models ===&lt;br /&gt;
The following code was added to &amp;lt;b&amp;gt;app/models/assignment.rb&amp;lt;/b&amp;gt;'s Assignment class, to add validation for assignment name and directory.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  validates :directory_path, presence: true # E2138 Validation for unique submission directory&lt;br /&gt;
  validates :directory_path, uniqueness: {scope: :course_id}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== controllers ===&lt;br /&gt;
The following code was modified in &amp;lt;b&amp;gt;app/controllers/assignments_controller.rb&amp;lt;/b&amp;gt;'s create method, adding checks for assignment name and directory when creating assignment.&lt;br /&gt;
&lt;br /&gt;
'''Before'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def create&lt;br /&gt;
     @assignment_form = AssignmentForm.new(assignment_form_params)&lt;br /&gt;
     if params[:button]&lt;br /&gt;
       if @assignment_form.save&lt;br /&gt;
         @assignment_form.create_assignment_node&lt;br /&gt;
         exist_assignment = Assignment.find_by(id: @assignment_form.assignment.id)&lt;br /&gt;
         assignment_form_params[:assignment][:id] = exist_assignment.id.to_s&lt;br /&gt;
         if assignment_form_params[:assignment][:directory_path].blank?&lt;br /&gt;
           assignment_form_params[:assignment][:directory_path] = &amp;quot;assignment_#{assignment_form_params[:assignment][:id]}&amp;quot;&lt;br /&gt;
         end&lt;br /&gt;
         ques_array = assignment_form_params[:assignment_questionnaire]&lt;br /&gt;
         due_array = assignment_form_params[:due_date]&lt;br /&gt;
         ques_array.each do |cur_questionnaire|&lt;br /&gt;
           cur_questionnaire[:assignment_id] = exist_assignment.id.to_s&lt;br /&gt;
         end&lt;br /&gt;
         due_array.each do |cur_due|&lt;br /&gt;
           cur_due[:parent_id] = exist_assignment.id.to_s&lt;br /&gt;
         end&lt;br /&gt;
         assignment_form_params[:assignment_questionnaire] = ques_array&lt;br /&gt;
         assignment_form_params[:due_date] = due_array&lt;br /&gt;
         @assignment_form.update(assignment_form_params, current_user)&lt;br /&gt;
         aid = Assignment.find_by(id: @assignment_form.assignment.id).id&lt;br /&gt;
         ExpertizaLogger.info &amp;quot;Assignment created: #{@assignment_form.as_json}&amp;quot;&lt;br /&gt;
         redirect_to edit_assignment_path aid&lt;br /&gt;
         undo_link(&amp;quot;Assignment \&amp;quot;#{@assignment_form.assignment.name}\&amp;quot; has been created successfully. &amp;quot;)&lt;br /&gt;
         return&lt;br /&gt;
       else&lt;br /&gt;
         flash.now[:error] = &amp;quot;Failed to create assignment&amp;quot;&lt;br /&gt;
         render 'new'&lt;br /&gt;
       end&lt;br /&gt;
     else&lt;br /&gt;
       render 'new'&lt;br /&gt;
      undo_link(&amp;quot;Assignment \&amp;quot;#{@assignment_form.assignment.name}\&amp;quot; has been created successfully. &amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''After'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def create&lt;br /&gt;
    @assignment_form = AssignmentForm.new(assignment_form_params)&lt;br /&gt;
    if params[:button]&lt;br /&gt;
      # E2138 issue #3&lt;br /&gt;
      find_existing_assignment = Assignment.find_by(name: @assignment_form.assignment.name, course_id: @assignment_form.assignment.course_id)&lt;br /&gt;
      dir_path = assignment_form_params[:assignment][:directory_path]&lt;br /&gt;
      find_existing_directory = Assignment.find_by(directory_path: dir_path, course_id: @assignment_form.assignment.course_id)&lt;br /&gt;
      if !find_existing_assignment and !find_existing_directory and @assignment_form.save #No existing names/directories &lt;br /&gt;
        @assignment_form.create_assignment_node&lt;br /&gt;
        current_assignment = Assignment.find_by(name: @assignment_form.assignment.name, course_id: @assignment_form.assignment.course_id)&lt;br /&gt;
        assignment_form_params[:assignment][:id] = current_assignment.id.to_s&lt;br /&gt;
        ques_array = assignment_form_params[:assignment_questionnaire]&lt;br /&gt;
        due_array = assignment_form_params[:due_date]&lt;br /&gt;
        ques_array.each do |cur_questionnaire|&lt;br /&gt;
          cur_questionnaire[:assignment_id] = current_assignment.id.to_s&lt;br /&gt;
        end&lt;br /&gt;
        due_array.each do |cur_due|&lt;br /&gt;
          cur_due[:parent_id] = current_assignment.id.to_s&lt;br /&gt;
        end&lt;br /&gt;
        assignment_form_params[:assignment_questionnaire] = ques_array&lt;br /&gt;
        assignment_form_params[:due_date] = due_array&lt;br /&gt;
        @assignment_form.update(assignment_form_params, current_user)&lt;br /&gt;
        aid = Assignment.find_by(name: @assignment_form.assignment.name, course_id: @assignment_form.assignment.course_id).id&lt;br /&gt;
        ExpertizaLogger.info &amp;quot;Assignment created: #{@assignment_form.as_json}&amp;quot;&lt;br /&gt;
        redirect_to edit_assignment_path aid&lt;br /&gt;
        undo_link(&amp;quot;Assignment \&amp;quot;#{@assignment_form.assignment.name}\&amp;quot; has been created successfully. &amp;quot;)&lt;br /&gt;
        return&lt;br /&gt;
      else&lt;br /&gt;
        flash[:error] = &amp;quot;Failed to create assignment.&amp;quot;&lt;br /&gt;
        if find_existing_assignment&lt;br /&gt;
          flash[:error] &amp;lt;&amp;lt; &amp;quot;&amp;lt;br&amp;gt;  &amp;quot; + @assignment_form.assignment.name + &amp;quot; already exists as an assignment name&amp;quot;&lt;br /&gt;
        end&lt;br /&gt;
        if find_existing_directory&lt;br /&gt;
          flash[:error] &amp;lt;&amp;lt; &amp;quot;&amp;lt;br&amp;gt;  &amp;quot; + dir_path + &amp;quot; already exists as a submission directory name&amp;quot;&lt;br /&gt;
        end&lt;br /&gt;
        redirect_to &amp;quot;/assignments/new?private=1&amp;quot;&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      render 'new'&lt;br /&gt;
      undo_link(&amp;quot;Assignment \&amp;quot;#{@assignment_form.assignment.name}\&amp;quot; has been created successfully. &amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Test Plan =&lt;br /&gt;
&lt;br /&gt;
== Manual UI Testing ==&lt;br /&gt;
&lt;br /&gt;
== RSpec Testing ==&lt;br /&gt;
&lt;br /&gt;
= Team Information =&lt;br /&gt;
Mentor: Nicholas Himes (nnhimes)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Henry Chen (hchen34)&lt;br /&gt;
&lt;br /&gt;
Saurabh Nanda (snanda2)&lt;br /&gt;
&lt;br /&gt;
Snehapriyaa Mathiyalaghan (smathiy)&lt;/div&gt;</summary>
		<author><name>Hchen34</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2138._Auto-generate_submission_directory_names_based_on_assignment&amp;diff=139231</id>
		<title>CSC/ECE 517 Fall 2021 - E2138. Auto-generate submission directory names based on assignment</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2138._Auto-generate_submission_directory_names_based_on_assignment&amp;diff=139231"/>
		<updated>2021-10-20T00:34:28Z</updated>

		<summary type="html">&lt;p&gt;Hchen34: edited Project implementation section&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page describes the changes made under E2138, in order to auto-generate submission directory names based on assignment names for Fall 2021, CSC/ECE 517.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Overview=&lt;br /&gt;
&lt;br /&gt;
==About Expertiza==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
==Issues for this project==&lt;br /&gt;
&lt;br /&gt;
When instructors give an assignment a name, submission directories should be auto-generated based on the assignment name, and also be unique. A number of issues existed when a previous team worked on this assignment (E2054), including&lt;br /&gt;
* Issue #1: The directory name should be auto-generated from the assignment name.&lt;br /&gt;
* Issue #2: It should be done by changing spaces in the names to underscores. E.g., the directory for Program 1 is by default &amp;quot;Program_1&amp;quot;.&lt;br /&gt;
* Issue #3: A check should be added to prevent two assignments in the same course from having the same name.&lt;br /&gt;
* Issue #4: Verify or add if not present - a check to stop two assignments from sharing the same directory.&lt;br /&gt;
* Issue #5: On changing the name of an assignment while creating it, the code shouldn't throw a NoMethodError.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Project implementation =&lt;br /&gt;
&lt;br /&gt;
== Submitted work and demonstration of project == &lt;br /&gt;
* [http://152.7.98.88:8080/ Link to deployed code on NCSU VCL]&lt;br /&gt;
* [https://github.com/SN-18/expertiza Link to our Github repository]&lt;br /&gt;
&lt;br /&gt;
== Files involved ==&lt;br /&gt;
*app/views/assignments/edit/_general.html.erb - added function that auto generate directory name, and substitute its spacebar with underscore.&lt;br /&gt;
*app/models/assignment.rb - added presence and uniqueness validation to assignment.&lt;br /&gt;
*app/controllers/assignments_controller.rb - modify create method to check for existing assignment name &amp;amp; directory.&lt;br /&gt;
&lt;br /&gt;
== Changes made to code ==&lt;br /&gt;
&lt;br /&gt;
===views===&lt;br /&gt;
The following code was added to &amp;lt;b&amp;gt;app/views/assignments/edit/_general.html.erb&amp;lt;/b&amp;gt;. The purpose is to generate submission directory name from the assignment name and substitute the spacebar with underscore.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
$(function() {&lt;br /&gt;
    $(&amp;quot;#assignment_form_assignment_name&amp;quot;).change(function() {&lt;br /&gt;
        filename = $( &amp;quot;#assignment_form_assignment_name&amp;quot; ).val().replace(/ /g,&amp;quot;_&amp;quot;).replace(/[/\\?%*:|&amp;quot;&amp;lt;&amp;gt;/$&amp;amp;!#%^@]/g, '');;&lt;br /&gt;
        $('#assignment_form_assignment_directory_path').val(filename);&lt;br /&gt;
    });&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
function autogenerate_submission(){&lt;br /&gt;
  assignment_form.assignment.directory_path = assignment_form.assignment.name;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===models===&lt;br /&gt;
The following code was added to &amp;lt;b&amp;gt;app/models/assignment.rb&amp;lt;/b&amp;gt;'s Assignment class, to add validation for assignment name and directory.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  validates :directory_path, presence: true # E2138 Validation for unique submission directory&lt;br /&gt;
  validates :directory_path, uniqueness: {scope: :course_id}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===controllers===&lt;br /&gt;
The following code was modified in &amp;lt;b&amp;gt;app/controllers/assignments_controller.rb&amp;lt;/b&amp;gt;'s create method, adding checks for assignment name and directory when creating assignment.&lt;br /&gt;
&lt;br /&gt;
'''Before'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def create&lt;br /&gt;
     @assignment_form = AssignmentForm.new(assignment_form_params)&lt;br /&gt;
     if params[:button]&lt;br /&gt;
       if @assignment_form.save&lt;br /&gt;
         @assignment_form.create_assignment_node&lt;br /&gt;
         exist_assignment = Assignment.find_by(id: @assignment_form.assignment.id)&lt;br /&gt;
         assignment_form_params[:assignment][:id] = exist_assignment.id.to_s&lt;br /&gt;
         if assignment_form_params[:assignment][:directory_path].blank?&lt;br /&gt;
           assignment_form_params[:assignment][:directory_path] = &amp;quot;assignment_#{assignment_form_params[:assignment][:id]}&amp;quot;&lt;br /&gt;
         end&lt;br /&gt;
         ques_array = assignment_form_params[:assignment_questionnaire]&lt;br /&gt;
         due_array = assignment_form_params[:due_date]&lt;br /&gt;
         ques_array.each do |cur_questionnaire|&lt;br /&gt;
           cur_questionnaire[:assignment_id] = exist_assignment.id.to_s&lt;br /&gt;
         end&lt;br /&gt;
         due_array.each do |cur_due|&lt;br /&gt;
           cur_due[:parent_id] = exist_assignment.id.to_s&lt;br /&gt;
         end&lt;br /&gt;
         assignment_form_params[:assignment_questionnaire] = ques_array&lt;br /&gt;
         assignment_form_params[:due_date] = due_array&lt;br /&gt;
         @assignment_form.update(assignment_form_params, current_user)&lt;br /&gt;
         aid = Assignment.find_by(id: @assignment_form.assignment.id).id&lt;br /&gt;
         ExpertizaLogger.info &amp;quot;Assignment created: #{@assignment_form.as_json}&amp;quot;&lt;br /&gt;
         redirect_to edit_assignment_path aid&lt;br /&gt;
         undo_link(&amp;quot;Assignment \&amp;quot;#{@assignment_form.assignment.name}\&amp;quot; has been created successfully. &amp;quot;)&lt;br /&gt;
         return&lt;br /&gt;
       else&lt;br /&gt;
         flash.now[:error] = &amp;quot;Failed to create assignment&amp;quot;&lt;br /&gt;
         render 'new'&lt;br /&gt;
       end&lt;br /&gt;
     else&lt;br /&gt;
       render 'new'&lt;br /&gt;
      undo_link(&amp;quot;Assignment \&amp;quot;#{@assignment_form.assignment.name}\&amp;quot; has been created successfully. &amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''After'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def create&lt;br /&gt;
    @assignment_form = AssignmentForm.new(assignment_form_params)&lt;br /&gt;
    if params[:button]&lt;br /&gt;
      # E2138 issue #3&lt;br /&gt;
      find_existing_assignment = Assignment.find_by(name: @assignment_form.assignment.name, course_id: @assignment_form.assignment.course_id)&lt;br /&gt;
      dir_path = assignment_form_params[:assignment][:directory_path]&lt;br /&gt;
      find_existing_directory = Assignment.find_by(directory_path: dir_path, course_id: @assignment_form.assignment.course_id)&lt;br /&gt;
      if !find_existing_assignment and !find_existing_directory and @assignment_form.save #No existing names/directories &lt;br /&gt;
        @assignment_form.create_assignment_node&lt;br /&gt;
        current_assignment = Assignment.find_by(name: @assignment_form.assignment.name, course_id: @assignment_form.assignment.course_id)&lt;br /&gt;
        assignment_form_params[:assignment][:id] = current_assignment.id.to_s&lt;br /&gt;
        ques_array = assignment_form_params[:assignment_questionnaire]&lt;br /&gt;
        due_array = assignment_form_params[:due_date]&lt;br /&gt;
        ques_array.each do |cur_questionnaire|&lt;br /&gt;
          cur_questionnaire[:assignment_id] = current_assignment.id.to_s&lt;br /&gt;
        end&lt;br /&gt;
        due_array.each do |cur_due|&lt;br /&gt;
          cur_due[:parent_id] = current_assignment.id.to_s&lt;br /&gt;
        end&lt;br /&gt;
        assignment_form_params[:assignment_questionnaire] = ques_array&lt;br /&gt;
        assignment_form_params[:due_date] = due_array&lt;br /&gt;
        @assignment_form.update(assignment_form_params, current_user)&lt;br /&gt;
        aid = Assignment.find_by(name: @assignment_form.assignment.name, course_id: @assignment_form.assignment.course_id).id&lt;br /&gt;
        ExpertizaLogger.info &amp;quot;Assignment created: #{@assignment_form.as_json}&amp;quot;&lt;br /&gt;
        redirect_to edit_assignment_path aid&lt;br /&gt;
        undo_link(&amp;quot;Assignment \&amp;quot;#{@assignment_form.assignment.name}\&amp;quot; has been created successfully. &amp;quot;)&lt;br /&gt;
        return&lt;br /&gt;
      else&lt;br /&gt;
        flash[:error] = &amp;quot;Failed to create assignment.&amp;quot;&lt;br /&gt;
        if find_existing_assignment&lt;br /&gt;
          flash[:error] &amp;lt;&amp;lt; &amp;quot;&amp;lt;br&amp;gt;  &amp;quot; + @assignment_form.assignment.name + &amp;quot; already exists as an assignment name&amp;quot;&lt;br /&gt;
        end&lt;br /&gt;
        if find_existing_directory&lt;br /&gt;
          flash[:error] &amp;lt;&amp;lt; &amp;quot;&amp;lt;br&amp;gt;  &amp;quot; + dir_path + &amp;quot; already exists as a submission directory name&amp;quot;&lt;br /&gt;
        end&lt;br /&gt;
        redirect_to &amp;quot;/assignments/new?private=1&amp;quot;&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      render 'new'&lt;br /&gt;
      undo_link(&amp;quot;Assignment \&amp;quot;#{@assignment_form.assignment.name}\&amp;quot; has been created successfully. &amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Test Plan =&lt;br /&gt;
&lt;br /&gt;
== Manual UI Testing ==&lt;br /&gt;
&lt;br /&gt;
== RSpec Testing ==&lt;br /&gt;
&lt;br /&gt;
= Team Information =&lt;br /&gt;
Mentor: Nicholas Himes (nnhimes)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Henry Chen (hchen34)&lt;br /&gt;
&lt;br /&gt;
Saurabh Nanda (snanda2)&lt;br /&gt;
&lt;br /&gt;
Snehapriyaa Mathiyalaghan (smathiy)&lt;/div&gt;</summary>
		<author><name>Hchen34</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2138._Auto-generate_submission_directory_names_based_on_assignment&amp;diff=139110</id>
		<title>CSC/ECE 517 Fall 2021 - E2138. Auto-generate submission directory names based on assignment</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2138._Auto-generate_submission_directory_names_based_on_assignment&amp;diff=139110"/>
		<updated>2021-10-18T20:04:19Z</updated>

		<summary type="html">&lt;p&gt;Hchen34: update VCL address&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page describes the changes made under E2138, in order to auto-generate submission directory names based on assignment names for Fall 2021, CSC/ECE 517.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==About Expertiza==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
==Issues for this project==&lt;br /&gt;
When instructors give an assignment a name, submission directories should be auto-generated based on the assignment name, and also be unique. A number of issues existed when a previous team worked on this assignment (E2054), including&lt;br /&gt;
* Issue #1: The directory name should be auto-generated from the assignment name.&lt;br /&gt;
* Issue #2: It should be done by changing spaces in the names to underscores. E.g., the directory for Program 1 is by default &amp;quot;Program_1&amp;quot;.&lt;br /&gt;
* Issue #3: A check should be added to prevent two assignments in the same course from having the same name.&lt;br /&gt;
* Issue #4: Verify or add if not present - a check to stop two assignments from sharing the same directory.&lt;br /&gt;
* Issue #5: On changing the name of an assignment while creating it, the code shouldn't throw a NoMethodError.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Project implementation =&lt;br /&gt;
&lt;br /&gt;
== Submitted work and demonstration of project == &lt;br /&gt;
* [http://152.7.98.88:8080/ Link to deployed code on NCSU VCL]&lt;br /&gt;
* [https://github.com/SN-18/expertiza Link to our Github repository]&lt;br /&gt;
&lt;br /&gt;
== Files involved ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Changes made to code ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Test Plan =&lt;br /&gt;
&lt;br /&gt;
== Manual UI Testing ==&lt;br /&gt;
&lt;br /&gt;
== RSpec Testing ==&lt;br /&gt;
&lt;br /&gt;
= Team Information =&lt;br /&gt;
&lt;br /&gt;
Henry Chen (hchen34)&lt;br /&gt;
&lt;br /&gt;
Saurabh Nanda (snanda2)&lt;br /&gt;
&lt;br /&gt;
Snehapriyaa Mathiyalaghan (smathiy)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Mentor: Nicholas Himes (nnhimes)&lt;/div&gt;</summary>
		<author><name>Hchen34</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2138._Auto-generate_submission_directory_names_based_on_assignment&amp;diff=139054</id>
		<title>CSC/ECE 517 Fall 2021 - E2138. Auto-generate submission directory names based on assignment</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2138._Auto-generate_submission_directory_names_based_on_assignment&amp;diff=139054"/>
		<updated>2021-10-17T20:47:35Z</updated>

		<summary type="html">&lt;p&gt;Hchen34: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page describes the changes made under E2138, in order to auto-generate submission directory names based on assignment names for Fall 2021, CSC/ECE 517.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==About Expertiza==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
==Issues for this project==&lt;br /&gt;
When instructors give an assignment a name, submission directories should be auto-generated based on the assignment name, and also be unique. A number of issues existed when a previous team worked on this assignment (E2054), including&lt;br /&gt;
* Issue #1: The directory name should be auto-generated from the assignment name.&lt;br /&gt;
* Issue #2: It should be done by changing spaces in the names to underscores. E.g., the directory for Program 1 is by default &amp;quot;Program_1&amp;quot;.&lt;br /&gt;
* Issue #3: A check should be added to prevent two assignments in the same course from having the same name.&lt;br /&gt;
* Issue #4: Verify or add if not present - a check to stop two assignments from sharing the same directory.&lt;br /&gt;
* Issue #5: On changing the name of an assignment while creating it, the code shouldn't throw a NoMethodError.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Project implementation =&lt;br /&gt;
&lt;br /&gt;
== Submitted work and demonstration of project == &lt;br /&gt;
* [http://152.7.99.133:8080/ Link to deployed code on NCSU VCL]&lt;br /&gt;
* [https://github.com/SN-18/expertiza Link to our Github repository]&lt;br /&gt;
&lt;br /&gt;
== Files involved ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Changes made to code ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Test Plan =&lt;br /&gt;
&lt;br /&gt;
== Manual UI Testing ==&lt;br /&gt;
&lt;br /&gt;
== RSpec Testing ==&lt;br /&gt;
&lt;br /&gt;
= Team Information =&lt;br /&gt;
&lt;br /&gt;
Henry Chen (hchen34)&lt;br /&gt;
&lt;br /&gt;
Saurabh Nanda (snanda2)&lt;br /&gt;
&lt;br /&gt;
Snehapriyaa Mathiyalaghan (smathiy)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Mentor: Nicholas Himes (nnhimes)&lt;/div&gt;</summary>
		<author><name>Hchen34</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2138._Auto-generate_submission_directory_names_based_on_assignment&amp;diff=139053</id>
		<title>CSC/ECE 517 Fall 2021 - E2138. Auto-generate submission directory names based on assignment</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2138._Auto-generate_submission_directory_names_based_on_assignment&amp;diff=139053"/>
		<updated>2021-10-17T20:46:06Z</updated>

		<summary type="html">&lt;p&gt;Hchen34: initial edit&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page describes the changes made under E2138, in order to auto-generate submission directory names based on assignment names for Fall 2021, CSC/ECE 517.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==About Expertiza==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
==Issues for this project==&lt;br /&gt;
When instructors give an assignment a name, submission directories should be auto-generated based on the assignment name, and also be unique. A number of issues existed when a previous team worked on this assignment (E2054), including&lt;br /&gt;
* Issue #1: The directory name should be auto-generated from the assignment name.&lt;br /&gt;
* Issue #2: It should be done by changing spaces in the names to underscores. E.g., the directory for Program 1 is by default &amp;quot;Program_1&amp;quot;.&lt;br /&gt;
* Issue #3: A check should be added to prevent two assignments in the same course from having the same name.&lt;br /&gt;
* Issue #4: Verify or add if not present - a check to stop two assignments from sharing the same directory.&lt;br /&gt;
* Issue #5: On changing the name of an assignment while creating it, the code shouldn't throw a NoMethodError.&lt;br /&gt;
&lt;br /&gt;
= Project implementation =&lt;br /&gt;
&lt;br /&gt;
== Submitted work and demonstration of project == &lt;br /&gt;
* [http://152.7.99.133:8080/ Link to deployed code on NCSU VCL]&lt;br /&gt;
* [https://github.com/SN-18/expertiza Link to our Github repository]&lt;br /&gt;
&lt;br /&gt;
== Files involved ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Changes made to code ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Test Plan =&lt;br /&gt;
&lt;br /&gt;
== Manual UI Testing ==&lt;br /&gt;
&lt;br /&gt;
== RSpec Testing ==&lt;br /&gt;
&lt;br /&gt;
= Team Information =&lt;br /&gt;
&lt;br /&gt;
1) Henry Chen (hchen34)&lt;br /&gt;
2) Saurabh Nanda (snanda2)&lt;br /&gt;
3) Snehapriyaa Mathiyalaghan (smathiy)&lt;br /&gt;
&lt;br /&gt;
Mentor: Nicholas Himes (nnhimes)&lt;/div&gt;</summary>
		<author><name>Hchen34</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2138._Auto-generate_submission_directory_names_based_on_assignment&amp;diff=139047</id>
		<title>CSC/ECE 517 Fall 2021 - E2138. Auto-generate submission directory names based on assignment</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2138._Auto-generate_submission_directory_names_based_on_assignment&amp;diff=139047"/>
		<updated>2021-10-17T20:27:36Z</updated>

		<summary type="html">&lt;p&gt;Hchen34: Created page with &amp;quot;Test&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Test&lt;/div&gt;</summary>
		<author><name>Hchen34</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021&amp;diff=139046</id>
		<title>CSC/ECE 517 Fall 2021</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021&amp;diff=139046"/>
		<updated>2021-10-17T20:26:37Z</updated>

		<summary type="html">&lt;p&gt;Hchen34: add E2138&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== OSS Projects ==&lt;br /&gt;
* [[CSC/ECE 517 Fall 2021 - {$num}. {$desc.title}]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2021 - E2128. Refactor student_quizzes_controller.rb &amp;amp; late_policies_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2021 - E2132. Add tests cases for review mapping helper.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2021 - E2134. Write unit tests for admin_controller.rb and institution_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2021 - E2138. Auto-generate submission directory names based on assignment]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2021 - E2142. Improve e-mail notifications]]&lt;/div&gt;</summary>
		<author><name>Hchen34</name></author>
	</entry>
</feed>