<?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=Hren3</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=Hren3"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Hren3"/>
	<updated>2026-06-13T20:28:23Z</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_2017/E17A6._Fix_account_creation_over_web_to_work_reasonably&amp;diff=113633</id>
		<title>CSC/ECE 517 Fall 2017/E17A6. Fix account creation over web to work reasonably</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E17A6._Fix_account_creation_over_web_to_work_reasonably&amp;diff=113633"/>
		<updated>2017-11-16T14:19:05Z</updated>

		<summary type="html">&lt;p&gt;Hren3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction to Expertise'''==&lt;br /&gt;
&lt;br /&gt;
Expertiza is a educational website that allows school users to submit peer reviews on assignments. To register to use this website, one needs to be either a course TA or Instructor and send a request to expertiza administrator to get approved. The request function only serves TAs and Instructors, so students won't be able to register. A student account is created by instructors or TAs. The whole purpose of this approval process is because students have no point of using this website without enrolling to an instructors course first, so they shouldn't request accounts from expertiza but from their instructors and TAs.&lt;br /&gt;
&lt;br /&gt;
A pending request page that displays all the requests should also be able to perform actions like approve or reject with an note.&lt;br /&gt;
&lt;br /&gt;
However, currently, all of these are done manually, which means no pending request page currently exists, no simple approve or reject action, and no user experience, and all users are added into the database through command line operations in the database(only instructor and TA roles which is acceptable currently but not when more other institutions try to user Expertiza).&lt;br /&gt;
&lt;br /&gt;
In addition, we also want users be able to add their institution if it does not show under the list provided by us.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Problem Statement'''==&lt;br /&gt;
'''Overall Introduction'''&lt;br /&gt;
&lt;br /&gt;
Request account function is currently not working properly. A new user who tries to request an expertiza account can do so, but the instructor can see yet has no power to approve any request. The approval process is currently done manually, which is cumbersome. &lt;br /&gt;
Our mission is to fix the request account functionality so that whoever requests for a new accounts can be approved by instructor clicking a button, and secondly, optimize the functionality to improve user experience.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Detailed Requirements and Plan===&lt;br /&gt;
'''1. Add institution''' &amp;lt;br\&amp;gt;&lt;br /&gt;
-A registering user should be able to choose their institution from a drop-down menu, but they should also be able to add an institution if they couldn't find one. &amp;lt;br\&amp;gt;&lt;br /&gt;
&lt;br /&gt;
-The new institution should be saved as a new record into the ''institution table''&amp;lt;br\&amp;gt;&lt;br /&gt;
&lt;br /&gt;
-New account request should be saved to ''requested_users table'' with correct institution id.&amp;lt;br\&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''2.superadmin, admin should be able to approve/decline requests'''&amp;lt;br\&amp;gt;&lt;br /&gt;
&lt;br /&gt;
-add a new drop-down item under “Administration &amp;gt; Show…” so requests can be visually displayed and handled&amp;lt;br\&amp;gt;&lt;br /&gt;
&lt;br /&gt;
-enable the &amp;quot;approve&amp;quot; function for admin and superadmin&amp;lt;br\&amp;gt;&lt;br /&gt;
&lt;br /&gt;
-make clickable user email address so a conversation is possible&amp;lt;br\&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''3. The record retain after admin's approval/rejection and an email will be sent to remind'''&amp;lt;br\&amp;gt;&lt;br /&gt;
&lt;br /&gt;
-an email should be sent when a request is approved or declined&amp;lt;br\&amp;gt;&lt;br /&gt;
&lt;br /&gt;
-all record should be kept on the page even it has been handled&amp;lt;br\&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Use Case Diagram ===&lt;br /&gt;
&lt;br /&gt;
The following is the use case diagram for the feature that we are going to implement.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Fix request.png]]&lt;br /&gt;
&lt;br /&gt;
===Fix 1. Add institution ===&lt;br /&gt;
- redesign the view shown in the previous section to include a field named institution in the current form to allow user to submit their institution if they couldn't find one in the list, and save it into the table corresponding to the form it submits to.&lt;br /&gt;
&lt;br /&gt;
- design a requested_user table to save all account requests&lt;br /&gt;
&lt;br /&gt;
===Fix 2. Add new Page and Action===&lt;br /&gt;
- to create an new view that can show all pending account requests and include actions like approve and reject to allow instructors to process requests on the same page&lt;br /&gt;
&lt;br /&gt;
- create corresponding new controller with methods corresponding to actions like reject, approve and index.&lt;br /&gt;
&lt;br /&gt;
[[File:Rel.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Fix 3. The record retains after admin's approval and email reminder ===&lt;br /&gt;
- redesign the view and model to retain the request record after super-admin or admin approves the request.&lt;br /&gt;
&lt;br /&gt;
- add an email tag in the corresponding view, so there will be an email send to email address offered by requester after approval/rejection.&lt;br /&gt;
&lt;br /&gt;
=='''Mockup Screens'''==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1. First of all, a new user need to click 'REQUEST ACCOUNT' to create a new account.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:cs.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. In the 'request new' page, in the original version, the user can only choose an institution from the drop-down menu. After our modification, the user can choose the 'Not List' choice in the drop-down menu and type in an institution when (s)he is not able to find his(her) institution in the drop-down menu.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Screen_Shot_2017-11-06_at_10.17.01_PM.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Add a picture after changing.&lt;br /&gt;
&lt;br /&gt;
3. After log in as an admin/super admin, the user can see a drop-down item under 'Administration-&amp;gt;Show requests' to see all the new account requests.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Administrator.png]] ‎&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4. After clicking the 'Show requests', the admin can see a list of new account requests and the emails are clickable to send email to the requesting user. Also, after the admin approves the request, the record should retain in the view and an email informing the requestor will be sent to the requestors' given email address.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Requests.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
5. After clicking the email address, the email editor will pop up and admin can converse requestors.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Emails.png]]&lt;br /&gt;
&lt;br /&gt;
=='''Design Pattern'''==&lt;br /&gt;
&lt;br /&gt;
==='''1. MVC'''===&lt;br /&gt;
The project is implemented in Ruby on Rails that uses MVC architecture. It separates an application’s data model, user interface, and control logic into three distinct components (model, view and controller, respectively).&lt;br /&gt;
&lt;br /&gt;
==='''2. Dry Principle'''===&lt;br /&gt;
We are trying to reuse the existing functionalities in Expertiza, thus avoiding code duplication. Whenever possible, code modification based on the existing classes, controllers, or tables will be done instead of creating the new one.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
Both manual and RSpec test will be performed on the following items.&lt;br /&gt;
&lt;br /&gt;
1. a proper error message for improper information filled in, such as wrong email address format or existing account.&lt;br /&gt;
&lt;br /&gt;
2. When a pending account gets approved or rejected, an email will be sent to the submitted email address.&lt;br /&gt;
&lt;br /&gt;
3. A new item &amp;quot;show&amp;quot; should be added under administration and direct instructor to pending requests page when clicked&lt;br /&gt;
&lt;br /&gt;
4. pending requests will have an email column that is clickable which allows instructor to send emails to applicants before a decision is made.&lt;br /&gt;
&lt;br /&gt;
5. when a request is processed, its record is still kept with the status of processed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Team Informantion ==&lt;br /&gt;
Guiyang Fan(gfan@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Haoxu Ren(hren3@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Dongyu Wang(dwang32@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Yichi Zhang(yzhan222@ncsu.edu)&lt;/div&gt;</summary>
		<author><name>Hren3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Fix_request.png&amp;diff=113632</id>
		<title>File:Fix request.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Fix_request.png&amp;diff=113632"/>
		<updated>2017-11-16T14:18:43Z</updated>

		<summary type="html">&lt;p&gt;Hren3: request&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;request&lt;/div&gt;</summary>
		<author><name>Hren3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E17A6._Fix_account_creation_over_web_to_work_reasonably&amp;diff=112311</id>
		<title>CSC/ECE 517 Fall 2017/E17A6. Fix account creation over web to work reasonably</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E17A6._Fix_account_creation_over_web_to_work_reasonably&amp;diff=112311"/>
		<updated>2017-11-07T16:10:51Z</updated>

		<summary type="html">&lt;p&gt;Hren3: /* Problem Statement */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
Request account function is currently not working properly. A new user who tries to request an expertiza account can do so, but the instructor can see yet has no power to approve any request. The approval process is currently done manually, which is cumbersome. &lt;br /&gt;
Our mission is to fix the request account functionality so that whoever request for a new accounts can be approved by instructor clicking an button and optimize the functionality to improve user experience.&lt;br /&gt;
&lt;br /&gt;
[[File:cs.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Screen_Shot_2017-11-06_at_10.17.01_PM.png]]&lt;br /&gt;
&lt;br /&gt;
===Task Specifications===&lt;br /&gt;
'''1. Add institution''' &amp;lt;br\&amp;gt;&lt;br /&gt;
-A registering user should be able to choose their institution from a drop-down menu, but they should also be able to add an institution if they couldn't find one. &amp;lt;br\&amp;gt;&lt;br /&gt;
-The new institution should be saved as a new record into the ''institution table''&amp;lt;br\&amp;gt;&lt;br /&gt;
-New account request should be saved to ''requested_users table'' with correct institution id.&amp;lt;br\&amp;gt;&lt;br /&gt;
'''2.superadmin, admin should be able to approve/decline requests'''&amp;lt;br\&amp;gt;&lt;br /&gt;
-add a new drop-down item under “Administration &amp;gt; Show…” so requests can be visually displayed and handled&amp;lt;br\&amp;gt;&lt;br /&gt;
-enable the &amp;quot;approve&amp;quot; function for admin and superadmin&amp;lt;br\&amp;gt;&lt;br /&gt;
-make clickable user email address so a conversation is possible&amp;lt;br\&amp;gt;&lt;br /&gt;
-an email should be sent when a request is approved or declined&amp;lt;br\&amp;gt;&lt;br /&gt;
-all record should be kept on the page even it has been handled&amp;lt;br\&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Team Informantion ==&lt;br /&gt;
Guiyang Fan(gfan@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Haoxu Ren(hren3@ncsu.edu)&lt;/div&gt;</summary>
		<author><name>Hren3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Cs.png&amp;diff=112310</id>
		<title>File:Cs.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Cs.png&amp;diff=112310"/>
		<updated>2017-11-07T16:10:29Z</updated>

		<summary type="html">&lt;p&gt;Hren3: screen shot&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;screen shot&lt;/div&gt;</summary>
		<author><name>Hren3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:As.png&amp;diff=112309</id>
		<title>File:As.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:As.png&amp;diff=112309"/>
		<updated>2017-11-07T16:07:46Z</updated>

		<summary type="html">&lt;p&gt;Hren3: screen&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;screen&lt;/div&gt;</summary>
		<author><name>Hren3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E17A6._Fix_account_creation_over_web_to_work_reasonably&amp;diff=112308</id>
		<title>CSC/ECE 517 Fall 2017/E17A6. Fix account creation over web to work reasonably</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E17A6._Fix_account_creation_over_web_to_work_reasonably&amp;diff=112308"/>
		<updated>2017-11-07T15:53:19Z</updated>

		<summary type="html">&lt;p&gt;Hren3: /* Team Informantion */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
Request account function is currently not working properly. A new user who tries to request an expertiza account can do so, but the instructor can see yet has no power to approve any request. The approval process is currently done manually, which is cumbersome. &lt;br /&gt;
Our mission is to fix the request account functionality so that whoever request for a new accounts can be approved by instructor clicking an button and optimize the functionality to improve user experience.&lt;br /&gt;
&lt;br /&gt;
[[File:Screen_Shot_2017-11-06_at_10.17.01_PM.png]]&lt;br /&gt;
&lt;br /&gt;
===Task Specifications===&lt;br /&gt;
'''1. Add institution''' &amp;lt;br\&amp;gt;&lt;br /&gt;
-A registering user should be able to choose their institution from a drop-down menu, but they should also be able to add an institution if they couldn't find one. &amp;lt;br\&amp;gt;&lt;br /&gt;
-The new institution should be saved as a new record into the ''institution table''&amp;lt;br\&amp;gt;&lt;br /&gt;
-New account request should be saved to ''requested_users table'' with correct institution id.&amp;lt;br\&amp;gt;&lt;br /&gt;
'''2.superadmin, admin should be able to approve/decline requests'''&amp;lt;br\&amp;gt;&lt;br /&gt;
-add a new drop-down item under “Administration &amp;gt; Show…” so requests can be visually displayed and handled&amp;lt;br\&amp;gt;&lt;br /&gt;
-enable the &amp;quot;approve&amp;quot; function for admin and superadmin&amp;lt;br\&amp;gt;&lt;br /&gt;
-make clickable user email address so a conversation is possible&amp;lt;br\&amp;gt;&lt;br /&gt;
-an email should be sent when a request is approved or declined&amp;lt;br\&amp;gt;&lt;br /&gt;
-all record should be kept on the page even it has been handled&amp;lt;br\&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Team Informantion ==&lt;br /&gt;
Guiyang Fan(gfan@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Haoxu Ren(hren3@ncsu.edu)&lt;/div&gt;</summary>
		<author><name>Hren3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E17A6._Fix_account_creation_over_web_to_work_reasonably&amp;diff=112307</id>
		<title>CSC/ECE 517 Fall 2017/E17A6. Fix account creation over web to work reasonably</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E17A6._Fix_account_creation_over_web_to_work_reasonably&amp;diff=112307"/>
		<updated>2017-11-07T15:53:12Z</updated>

		<summary type="html">&lt;p&gt;Hren3: /* Team Informantion */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
Request account function is currently not working properly. A new user who tries to request an expertiza account can do so, but the instructor can see yet has no power to approve any request. The approval process is currently done manually, which is cumbersome. &lt;br /&gt;
Our mission is to fix the request account functionality so that whoever request for a new accounts can be approved by instructor clicking an button and optimize the functionality to improve user experience.&lt;br /&gt;
&lt;br /&gt;
[[File:Screen_Shot_2017-11-06_at_10.17.01_PM.png]]&lt;br /&gt;
&lt;br /&gt;
===Task Specifications===&lt;br /&gt;
'''1. Add institution''' &amp;lt;br\&amp;gt;&lt;br /&gt;
-A registering user should be able to choose their institution from a drop-down menu, but they should also be able to add an institution if they couldn't find one. &amp;lt;br\&amp;gt;&lt;br /&gt;
-The new institution should be saved as a new record into the ''institution table''&amp;lt;br\&amp;gt;&lt;br /&gt;
-New account request should be saved to ''requested_users table'' with correct institution id.&amp;lt;br\&amp;gt;&lt;br /&gt;
'''2.superadmin, admin should be able to approve/decline requests'''&amp;lt;br\&amp;gt;&lt;br /&gt;
-add a new drop-down item under “Administration &amp;gt; Show…” so requests can be visually displayed and handled&amp;lt;br\&amp;gt;&lt;br /&gt;
-enable the &amp;quot;approve&amp;quot; function for admin and superadmin&amp;lt;br\&amp;gt;&lt;br /&gt;
-make clickable user email address so a conversation is possible&amp;lt;br\&amp;gt;&lt;br /&gt;
-an email should be sent when a request is approved or declined&amp;lt;br\&amp;gt;&lt;br /&gt;
-all record should be kept on the page even it has been handled&amp;lt;br\&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Team Informantion ==&lt;br /&gt;
Guiyang Fan(gfan@ncsu.edu)&lt;br /&gt;
Haoxu Ren(hren3@ncsu.edu)&lt;/div&gt;</summary>
		<author><name>Hren3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1772_Refactor_reputation_web_service_controller.rb&amp;diff=111908</id>
		<title>CSC/ECE 517 Fall 2017/E1772 Refactor reputation web service controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1772_Refactor_reputation_web_service_controller.rb&amp;diff=111908"/>
		<updated>2017-11-06T00:47:30Z</updated>

		<summary type="html">&lt;p&gt;Hren3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''==&lt;br /&gt;
==='''Introduction to Expertiza'''===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a peer review based system which provides incremental learning from the class. This project has been developed together by faculty and students using [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create, edit and delete assignments, create new assignment topics, assign them to a particular class or selected students, have students work on teams and then review each other's assignments at the end. For the students, they can signup for topics, form teams, and submit their projects and assignments. &lt;br /&gt;
Students then review the work done by other students and give suggestions to improve. Teams after reviews are allotted scores and they can refer to the peer comments to further improve their work. It also supports submission of different file types for assignments, including the URLs and wiki pages.&lt;br /&gt;
==='''Problem Statement'''===&lt;br /&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 the reputation system. Reputation systems have been deployed as web services, peer-review researchers will be able to use them to calculate scores on assignments, both past and present (past data can be used to tune the algorithms). &lt;br /&gt;
&lt;br /&gt;
For this project, our team's job is to refactor the file: reputation_web_service_controller.rb. This file is the controller to calculate the reputation scores. A “reputation” measures how close a reviewer’s scores are to other reviewers scores. This controller is the sub-class of Application_Controller, in this controller, it implements the calculation and query of reputation scores.&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Issues to be fixed'''==&lt;br /&gt;
&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. 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;
#Replace class variable with a class instance var, and change all other places using these variables.&lt;br /&gt;
#Refactor method db_query&lt;br /&gt;
#Use zero? method instead of == 0&lt;br /&gt;
#Use find_by instead of dynamic method&lt;br /&gt;
#Delete lines which is wrong or useless.&lt;br /&gt;
#Comment lines&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Modified Files'''==&lt;br /&gt;
&lt;br /&gt;
reputation_web_service_controller.rb&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''NewFiles'''==&lt;br /&gt;
&lt;br /&gt;
reputation_web_service_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
=='''Important links'''==&lt;br /&gt;
[https://www.youtube.com/watch?v=jdL-L-UZp1A&amp;amp;t=20s Demo Video Link]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[https://github.com/yuxuyang/expertiza Project Repo]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[https://github.com/expertiza/expertiza/pull/1027 Github Pull Request]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
=='''Approach taken to resolve the issues'''==&lt;br /&gt;
==='''Replace class variable with a class instance var, and change all other places using these variables.'''===&lt;br /&gt;
In ruby, class variables are started with '@@'and this class variable are shared in the whole inherit chain, and class variables are shared by all objects of a class. For instance variables, in Ruby, instance variables are started with '@' and instance variables belong to one object, can not be used by sub-classes. &lt;br /&gt;
&lt;br /&gt;
In the project, we are asked to replace the class variable with a class instance variables. &lt;br /&gt;
So, as the figure 1 shown, in variables declaration part, we changed all class variables to instance variables.&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation code1.png]]&lt;br /&gt;
&lt;br /&gt;
Next, we need to change all other places using these variables.&lt;br /&gt;
&lt;br /&gt;
In action '''send_post_request'''&lt;br /&gt;
&lt;br /&gt;
[[File:Reputaion 2.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Reputaion3.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation4.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation5.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation6.png]]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
==='''Refactor method db_query'''===&lt;br /&gt;
In the Reputation_web_service controller, the action db_query is important, because it implements the query of peer review grade.To refactor the db_query method, we need to firstly focus on the input variables of this method, there are 4 variables need inputs.&lt;br /&gt;
The db_query method is shown as follow:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def db_query(assignment_id, another_assignment_id = 0, round_num, hasTopic)&lt;br /&gt;
      ...&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
There is a problem: Optional arguments should appear at the end of the argument list, in this method, '''''another_assignment_id''''' is a optional arguments, but in the original version, the optional arguments -- '''''another_assignment_id''''' just appear right behind the argument--'''''assignment_id''''', so we need to refactor it.&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation8.png]]&lt;br /&gt;
&lt;br /&gt;
And the same problems occurs when we assigns value to variable '''''@results'''''. We also need to change it.&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation10.png]]&lt;br /&gt;
&lt;br /&gt;
There is another problem in the db_query method, we can see there is a input variable named '''''hasTopic''''', but actually that's not follow the '''&amp;quot;good Ruby and Rails coding practices&amp;quot;''', so we need to refactor it which shown as follow:&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation9.png]]&lt;br /&gt;
&lt;br /&gt;
Finally, The project asked us'' 'Move Line 26-50 before this method''', it's important for code refactor, because it's very inelegant if you put the comments inside the method. If others want to read your codes, it will cost their much more time so that it needs to be changed. Simply, we can just move the whole comments before the method, and that will make the codes easily for reading.&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation11.png]]&lt;br /&gt;
&lt;br /&gt;
==='''Use zero? method instead of == 0.'''===&lt;br /&gt;
&lt;br /&gt;
In the original version of project, every time there is a zero judgement occurs, it use ''''''==0'''''' or ''''''!=0'''''', of course it can achieve the judgement of zero, but according to the security consideration in ruby on rails development, we need to avoid the use of ''''''==0'''''' or ''''''!=0''''''. So the best way to solve it is using the '''''zero?''''' instead of ''''''==0'''''' or ''''''!=0'''''', which shown as follow:&lt;br /&gt;
[[File:Reputation12.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation13.png]]&lt;br /&gt;
&lt;br /&gt;
==='''Use find_by instead of dynamic method.'''===&lt;br /&gt;
This issue is replacing the find_by_id to find_by(id: id). The only difference of this change is syntax and their function worked in the same way. But if the customer want to change the way to find assignment, find_by(id: id) would be easier to change because programmer only need to change the parameter, while find_by_id need to change the whole method and its parameter. Therefore, in this project, using find_by_id is more efficient.&lt;br /&gt;
[[File:refactor15.png]]&lt;br /&gt;
[[File:refactor16.png]]&lt;br /&gt;
&lt;br /&gt;
==='''Delete lines which is wrong or useless.'''===&lt;br /&gt;
In Line 111, the variable inner_msg has never been used, so it can be deleted&lt;br /&gt;
[[File:refactor17.png]]&lt;br /&gt;
&lt;br /&gt;
From line 164 to 201 and line 204 to 241, cases for reputation value and do not need to handle the case for assign id. req body would change only in the case for 'Add expert grades'. If these two part failed to be deleted, the body would append three times and output wrong result.&lt;br /&gt;
[[File:refactor21.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:refactor19.png]]&lt;br /&gt;
&lt;br /&gt;
==='''Comment lines.'''===&lt;br /&gt;
The function for controller is not for output but just control and update the change of view. So puts should not appear in controller&lt;br /&gt;
&lt;br /&gt;
[[File:refactor22.png]]&lt;br /&gt;
[[File:refactor23.png]]&lt;br /&gt;
&lt;br /&gt;
==='''RSpec Test'''===&lt;br /&gt;
Our test plan is to test if db_query(assignment_id, round_num, has_topic, another_assignment_id = 0)(in line 51), db_query_with_quiz_score(assignment_id, another_assignment_id = 0)(int line 82), json_generator(assignment_id, another_assignment_id = 0, round_num = 2, type = 'peer review grades')(in line 101) work in the right way. These are in controller/reputation_web_service_controller.rb&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
require 'rspec'&lt;br /&gt;
&lt;br /&gt;
describe ReputationWebServiceController do&lt;br /&gt;
&lt;br /&gt;
  before(:each) do&lt;br /&gt;
    user = build(:instructor)&lt;br /&gt;
    stub_current_user(user, user.role.name, user.role)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  it 'should do execute query' do&lt;br /&gt;
    #controller.json_generator(41,0,2,'peer review grades').should != nil&lt;br /&gt;
    has_topic = !SignUpTopic.where(41).empty?&lt;br /&gt;
    raw_data_array = []&lt;br /&gt;
    raw_data_array = controller.db_query(41,2,has_topic,0)&lt;br /&gt;
    expect(controller.db_query(41,2,has_topic,0)).to be_an_instance_of(Array)&lt;br /&gt;
    expect(controller.db_query(41,2,has_topic,0)).should_not be(nil)&lt;br /&gt;
    expect(raw_data_array).should_not be(nil)&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The above codes is to test if get query can parse id and some other variables and return the correct review grade. Our test make sure the review grade are array and array contains data which is not null.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  it 'should execute query for quiz score' do&lt;br /&gt;
    result = controller.db_query_with_quiz_score(55,0)&lt;br /&gt;
    expect(result).to be_an_instance_of(Array)&lt;br /&gt;
    expect(result).should_not be(nil)&lt;br /&gt;
    #puts result&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The above code is to test if we can query quiz score by given assignment id and another assignment id and return correct quiz score array. Our test make sure that the the result is array and not a null array&lt;br /&gt;
&lt;br /&gt;
But when we try to test json_generator(assignment_id, another_assignment_id = 0, round_num = 2, type = 'peer review grades'). There is a wrong report which is no method. the line 106 that is no method is:&lt;br /&gt;
@results = db_query(assignment.id, round_num, has_topic, another_assignment_id)&lt;br /&gt;
And the report is that:&lt;br /&gt;
[[File:24.jpeg]]&lt;br /&gt;
&lt;br /&gt;
Because this method can't be called for some reason and this is not the part that we need to refactor, we can't test this part.&lt;/div&gt;</summary>
		<author><name>Hren3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1772_Refactor_reputation_web_service_controller.rb&amp;diff=111907</id>
		<title>CSC/ECE 517 Fall 2017/E1772 Refactor reputation web service controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1772_Refactor_reputation_web_service_controller.rb&amp;diff=111907"/>
		<updated>2017-11-06T00:44:29Z</updated>

		<summary type="html">&lt;p&gt;Hren3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''==&lt;br /&gt;
==='''Introduction to Expertiza'''===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a peer review based system which provides incremental learning from the class. This project has been developed together by faculty and students using [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create, edit and delete assignments, create new assignment topics, assign them to a particular class or selected students, have students work on teams and then review each other's assignments at the end. For the students, they can signup for topics, form teams, and submit their projects and assignments. &lt;br /&gt;
Students then review the work done by other students and give suggestions to improve. Teams after reviews are allotted scores and they can refer to the peer comments to further improve their work. It also supports submission of different file types for assignments, including the URLs and wiki pages.&lt;br /&gt;
==='''Problem Statement'''===&lt;br /&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 the reputation system. Reputation systems have been deployed as web services, peer-review researchers will be able to use them to calculate scores on assignments, both past and present (past data can be used to tune the algorithms). &lt;br /&gt;
&lt;br /&gt;
For this project, our team's job is to refactor the file: reputation_web_service_controller.rb. This file is the controller to calculate the reputation scores. A “reputation” measures how close a reviewer’s scores are to other reviewers scores. This controller is the sub-class of Application_Controller, in this controller, it implements the calculation and query of reputation scores.&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Issues to be fixed'''==&lt;br /&gt;
&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. 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;
#Replace class variable with a class instance var, and change all other places using these variables.&lt;br /&gt;
#Refactor method db_query&lt;br /&gt;
#Use zero? method instead of == 0&lt;br /&gt;
#Use find_by instead of dynamic method&lt;br /&gt;
#Delete lines which is wrong or useless.&lt;br /&gt;
#Comment lines&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Modified Files'''==&lt;br /&gt;
&lt;br /&gt;
reputation_web_service_controller.rb&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''NewFiles'''==&lt;br /&gt;
&lt;br /&gt;
reputation_web_service_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
=='''NewFiles'''==&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
=='''Approach taken to resolve the issues'''==&lt;br /&gt;
==='''Replace class variable with a class instance var, and change all other places using these variables.'''===&lt;br /&gt;
In ruby, class variables are started with '@@'and this class variable are shared in the whole inherit chain, and class variables are shared by all objects of a class. For instance variables, in Ruby, instance variables are started with '@' and instance variables belong to one object, can not be used by sub-classes. &lt;br /&gt;
&lt;br /&gt;
In the project, we are asked to replace the class variable with a class instance variables. &lt;br /&gt;
So, as the figure 1 shown, in variables declaration part, we changed all class variables to instance variables.&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation code1.png]]&lt;br /&gt;
&lt;br /&gt;
Next, we need to change all other places using these variables.&lt;br /&gt;
&lt;br /&gt;
In action '''send_post_request'''&lt;br /&gt;
&lt;br /&gt;
[[File:Reputaion 2.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Reputaion3.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation4.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation5.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation6.png]]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
==='''Refactor method db_query'''===&lt;br /&gt;
In the Reputation_web_service controller, the action db_query is important, because it implements the query of peer review grade.To refactor the db_query method, we need to firstly focus on the input variables of this method, there are 4 variables need inputs.&lt;br /&gt;
The db_query method is shown as follow:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def db_query(assignment_id, another_assignment_id = 0, round_num, hasTopic)&lt;br /&gt;
      ...&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
There is a problem: Optional arguments should appear at the end of the argument list, in this method, '''''another_assignment_id''''' is a optional arguments, but in the original version, the optional arguments -- '''''another_assignment_id''''' just appear right behind the argument--'''''assignment_id''''', so we need to refactor it.&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation8.png]]&lt;br /&gt;
&lt;br /&gt;
And the same problems occurs when we assigns value to variable '''''@results'''''. We also need to change it.&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation10.png]]&lt;br /&gt;
&lt;br /&gt;
There is another problem in the db_query method, we can see there is a input variable named '''''hasTopic''''', but actually that's not follow the '''&amp;quot;good Ruby and Rails coding practices&amp;quot;''', so we need to refactor it which shown as follow:&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation9.png]]&lt;br /&gt;
&lt;br /&gt;
Finally, The project asked us'' 'Move Line 26-50 before this method''', it's important for code refactor, because it's very inelegant if you put the comments inside the method. If others want to read your codes, it will cost their much more time so that it needs to be changed. Simply, we can just move the whole comments before the method, and that will make the codes easily for reading.&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation11.png]]&lt;br /&gt;
&lt;br /&gt;
==='''Use zero? method instead of == 0.'''===&lt;br /&gt;
&lt;br /&gt;
In the original version of project, every time there is a zero judgement occurs, it use ''''''==0'''''' or ''''''!=0'''''', of course it can achieve the judgement of zero, but according to the security consideration in ruby on rails development, we need to avoid the use of ''''''==0'''''' or ''''''!=0''''''. So the best way to solve it is using the '''''zero?''''' instead of ''''''==0'''''' or ''''''!=0'''''', which shown as follow:&lt;br /&gt;
[[File:Reputation12.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation13.png]]&lt;br /&gt;
&lt;br /&gt;
==='''Use find_by instead of dynamic method.'''===&lt;br /&gt;
This issue is replacing the find_by_id to find_by(id: id). The only difference of this change is syntax and their function worked in the same way. But if the customer want to change the way to find assignment, find_by(id: id) would be easier to change because programmer only need to change the parameter, while find_by_id need to change the whole method and its parameter. Therefore, in this project, using find_by_id is more efficient.&lt;br /&gt;
[[File:refactor15.png]]&lt;br /&gt;
[[File:refactor16.png]]&lt;br /&gt;
&lt;br /&gt;
==='''Delete lines which is wrong or useless.'''===&lt;br /&gt;
In Line 111, the variable inner_msg has never been used, so it can be deleted&lt;br /&gt;
[[File:refactor17.png]]&lt;br /&gt;
&lt;br /&gt;
From line 164 to 201 and line 204 to 241, cases for reputation value and do not need to handle the case for assign id. req body would change only in the case for 'Add expert grades'. If these two part failed to be deleted, the body would append three times and output wrong result.&lt;br /&gt;
[[File:refactor21.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:refactor19.png]]&lt;br /&gt;
&lt;br /&gt;
==='''Comment lines.'''===&lt;br /&gt;
The function for controller is not for output but just control and update the change of view. So puts should not appear in controller&lt;br /&gt;
&lt;br /&gt;
[[File:refactor22.png]]&lt;br /&gt;
[[File:refactor23.png]]&lt;br /&gt;
&lt;br /&gt;
==='''RSpec Test'''===&lt;br /&gt;
Our test plan is to test if db_query(assignment_id, round_num, has_topic, another_assignment_id = 0)(in line 51), db_query_with_quiz_score(assignment_id, another_assignment_id = 0)(int line 82), json_generator(assignment_id, another_assignment_id = 0, round_num = 2, type = 'peer review grades')(in line 101) work in the right way. These are in controller/reputation_web_service_controller.rb&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
require 'rspec'&lt;br /&gt;
&lt;br /&gt;
describe ReputationWebServiceController do&lt;br /&gt;
&lt;br /&gt;
  before(:each) do&lt;br /&gt;
    user = build(:instructor)&lt;br /&gt;
    stub_current_user(user, user.role.name, user.role)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  it 'should do execute query' do&lt;br /&gt;
    #controller.json_generator(41,0,2,'peer review grades').should != nil&lt;br /&gt;
    has_topic = !SignUpTopic.where(41).empty?&lt;br /&gt;
    raw_data_array = []&lt;br /&gt;
    raw_data_array = controller.db_query(41,2,has_topic,0)&lt;br /&gt;
    expect(controller.db_query(41,2,has_topic,0)).to be_an_instance_of(Array)&lt;br /&gt;
    expect(controller.db_query(41,2,has_topic,0)).should_not be(nil)&lt;br /&gt;
    expect(raw_data_array).should_not be(nil)&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The above codes is to test if get query can parse id and some other variables and return the correct review grade. Our test make sure the review grade are array and array contains data which is not null.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  it 'should execute query for quiz score' do&lt;br /&gt;
    result = controller.db_query_with_quiz_score(55,0)&lt;br /&gt;
    expect(result).to be_an_instance_of(Array)&lt;br /&gt;
    expect(result).should_not be(nil)&lt;br /&gt;
    #puts result&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The above code is to test if we can query quiz score by given assignment id and another assignment id and return correct quiz score array. Our test make sure that the the result is array and not a null array&lt;br /&gt;
&lt;br /&gt;
But when we try to test json_generator(assignment_id, another_assignment_id = 0, round_num = 2, type = 'peer review grades'). There is a wrong report which is no method. the line 106 that is no method is:&lt;br /&gt;
@results = db_query(assignment.id, round_num, has_topic, another_assignment_id)&lt;br /&gt;
And the report is that:&lt;br /&gt;
[[File:24.jpeg]]&lt;br /&gt;
&lt;br /&gt;
Because this method can't be called for some reason and this is not the part that we need to refactor, we can't test this part.&lt;/div&gt;</summary>
		<author><name>Hren3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1772_Refactor_reputation_web_service_controller.rb&amp;diff=111906</id>
		<title>CSC/ECE 517 Fall 2017/E1772 Refactor reputation web service controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1772_Refactor_reputation_web_service_controller.rb&amp;diff=111906"/>
		<updated>2017-11-06T00:43:25Z</updated>

		<summary type="html">&lt;p&gt;Hren3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''==&lt;br /&gt;
==='''Introduction to Expertiza'''===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a peer review based system which provides incremental learning from the class. This project has been developed together by faculty and students using [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create, edit and delete assignments, create new assignment topics, assign them to a particular class or selected students, have students work on teams and then review each other's assignments at the end. For the students, they can signup for topics, form teams, and submit their projects and assignments. &lt;br /&gt;
Students then review the work done by other students and give suggestions to improve. Teams after reviews are allotted scores and they can refer to the peer comments to further improve their work. It also supports submission of different file types for assignments, including the URLs and wiki pages.&lt;br /&gt;
==='''Problem Statement'''===&lt;br /&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 the reputation system. Reputation systems have been deployed as web services, peer-review researchers will be able to use them to calculate scores on assignments, both past and present (past data can be used to tune the algorithms). &lt;br /&gt;
&lt;br /&gt;
For this project, our team's job is to refactor the file: reputation_web_service_controller.rb. This file is the controller to calculate the reputation scores. A “reputation” measures how close a reviewer’s scores are to other reviewers scores. This controller is the sub-class of Application_Controller, in this controller, it implements the calculation and query of reputation scores.&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Issues to be fixed'''==&lt;br /&gt;
&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. 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;
#Replace class variable with a class instance var, and change all other places using these variables.&lt;br /&gt;
#Refactor method db_query&lt;br /&gt;
#Use zero? method instead of == 0&lt;br /&gt;
#Use find_by instead of dynamic method&lt;br /&gt;
#Delete lines which is wrong or useless.&lt;br /&gt;
#Comment lines&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Modified Files'''==&lt;br /&gt;
&lt;br /&gt;
reputation_web_service_controller.rb&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''NewFiles'''==&lt;br /&gt;
&lt;br /&gt;
reputation_web_service_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
=='''Approach taken to resolve the issues'''==&lt;br /&gt;
==='''Replace class variable with a class instance var, and change all other places using these variables.'''===&lt;br /&gt;
In ruby, class variables are started with '@@'and this class variable are shared in the whole inherit chain, and class variables are shared by all objects of a class. For instance variables, in Ruby, instance variables are started with '@' and instance variables belong to one object, can not be used by sub-classes. &lt;br /&gt;
&lt;br /&gt;
In the project, we are asked to replace the class variable with a class instance variables. &lt;br /&gt;
So, as the figure 1 shown, in variables declaration part, we changed all class variables to instance variables.&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation code1.png]]&lt;br /&gt;
&lt;br /&gt;
Next, we need to change all other places using these variables.&lt;br /&gt;
&lt;br /&gt;
In action '''send_post_request'''&lt;br /&gt;
&lt;br /&gt;
[[File:Reputaion 2.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Reputaion3.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation4.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation5.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation6.png]]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
==='''Refactor method db_query'''===&lt;br /&gt;
In the Reputation_web_service controller, the action db_query is important, because it implements the query of peer review grade.To refactor the db_query method, we need to firstly focus on the input variables of this method, there are 4 variables need inputs.&lt;br /&gt;
The db_query method is shown as follow:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def db_query(assignment_id, another_assignment_id = 0, round_num, hasTopic)&lt;br /&gt;
      ...&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
There is a problem: Optional arguments should appear at the end of the argument list, in this method, '''''another_assignment_id''''' is a optional arguments, but in the original version, the optional arguments -- '''''another_assignment_id''''' just appear right behind the argument--'''''assignment_id''''', so we need to refactor it.&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation8.png]]&lt;br /&gt;
&lt;br /&gt;
And the same problems occurs when we assigns value to variable '''''@results'''''. We also need to change it.&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation10.png]]&lt;br /&gt;
&lt;br /&gt;
There is another problem in the db_query method, we can see there is a input variable named '''''hasTopic''''', but actually that's not follow the '''&amp;quot;good Ruby and Rails coding practices&amp;quot;''', so we need to refactor it which shown as follow:&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation9.png]]&lt;br /&gt;
&lt;br /&gt;
Finally, The project asked us'' 'Move Line 26-50 before this method''', it's important for code refactor, because it's very inelegant if you put the comments inside the method. If others want to read your codes, it will cost their much more time so that it needs to be changed. Simply, we can just move the whole comments before the method, and that will make the codes easily for reading.&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation11.png]]&lt;br /&gt;
&lt;br /&gt;
==='''Use zero? method instead of == 0.'''===&lt;br /&gt;
&lt;br /&gt;
In the original version of project, every time there is a zero judgement occurs, it use ''''''==0'''''' or ''''''!=0'''''', of course it can achieve the judgement of zero, but according to the security consideration in ruby on rails development, we need to avoid the use of ''''''==0'''''' or ''''''!=0''''''. So the best way to solve it is using the '''''zero?''''' instead of ''''''==0'''''' or ''''''!=0'''''', which shown as follow:&lt;br /&gt;
[[File:Reputation12.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation13.png]]&lt;br /&gt;
&lt;br /&gt;
==='''Use find_by instead of dynamic method.'''===&lt;br /&gt;
This issue is replacing the find_by_id to find_by(id: id). The only difference of this change is syntax and their function worked in the same way. But if the customer want to change the way to find assignment, find_by(id: id) would be easier to change because programmer only need to change the parameter, while find_by_id need to change the whole method and its parameter. Therefore, in this project, using find_by_id is more efficient.&lt;br /&gt;
[[File:refactor15.png]]&lt;br /&gt;
[[File:refactor16.png]]&lt;br /&gt;
&lt;br /&gt;
==='''Delete lines which is wrong or useless.'''===&lt;br /&gt;
In Line 111, the variable inner_msg has never been used, so it can be deleted&lt;br /&gt;
[[File:refactor17.png]]&lt;br /&gt;
&lt;br /&gt;
From line 164 to 201 and line 204 to 241, cases for reputation value and do not need to handle the case for assign id. req body would change only in the case for 'Add expert grades'. If these two part failed to be deleted, the body would append three times and output wrong result.&lt;br /&gt;
[[File:refactor21.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:refactor19.png]]&lt;br /&gt;
&lt;br /&gt;
==='''Comment lines.'''===&lt;br /&gt;
The function for controller is not for output but just control and update the change of view. So puts should not appear in controller&lt;br /&gt;
&lt;br /&gt;
[[File:refactor22.png]]&lt;br /&gt;
[[File:refactor23.png]]&lt;br /&gt;
&lt;br /&gt;
==='''RSpec Test'''===&lt;br /&gt;
Our test plan is to test if db_query(assignment_id, round_num, has_topic, another_assignment_id = 0)(in line 51), db_query_with_quiz_score(assignment_id, another_assignment_id = 0)(int line 82), json_generator(assignment_id, another_assignment_id = 0, round_num = 2, type = 'peer review grades')(in line 101) work in the right way. These are in controller/reputation_web_service_controller.rb&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
require 'rspec'&lt;br /&gt;
&lt;br /&gt;
describe ReputationWebServiceController do&lt;br /&gt;
&lt;br /&gt;
  before(:each) do&lt;br /&gt;
    user = build(:instructor)&lt;br /&gt;
    stub_current_user(user, user.role.name, user.role)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  it 'should do execute query' do&lt;br /&gt;
    #controller.json_generator(41,0,2,'peer review grades').should != nil&lt;br /&gt;
    has_topic = !SignUpTopic.where(41).empty?&lt;br /&gt;
    raw_data_array = []&lt;br /&gt;
    raw_data_array = controller.db_query(41,2,has_topic,0)&lt;br /&gt;
    expect(controller.db_query(41,2,has_topic,0)).to be_an_instance_of(Array)&lt;br /&gt;
    expect(controller.db_query(41,2,has_topic,0)).should_not be(nil)&lt;br /&gt;
    expect(raw_data_array).should_not be(nil)&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The above codes is to test if get query can parse id and some other variables and return the correct review grade. Our test make sure the review grade are array and array contains data which is not null.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  it 'should execute query for quiz score' do&lt;br /&gt;
    result = controller.db_query_with_quiz_score(55,0)&lt;br /&gt;
    expect(result).to be_an_instance_of(Array)&lt;br /&gt;
    expect(result).should_not be(nil)&lt;br /&gt;
    #puts result&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The above code is to test if we can query quiz score by given assignment id and another assignment id and return correct quiz score array. Our test make sure that the the result is array and not a null array&lt;br /&gt;
&lt;br /&gt;
But when we try to test json_generator(assignment_id, another_assignment_id = 0, round_num = 2, type = 'peer review grades'). There is a wrong report which is no method. the line 106 that is no method is:&lt;br /&gt;
@results = db_query(assignment.id, round_num, has_topic, another_assignment_id)&lt;br /&gt;
And the report is that:&lt;br /&gt;
[[File:24.jpeg]]&lt;br /&gt;
&lt;br /&gt;
Because this method can't be called for some reason and this is not the part that we need to refactor, we can't test this part.&lt;/div&gt;</summary>
		<author><name>Hren3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1772_Refactor_reputation_web_service_controller.rb&amp;diff=111597</id>
		<title>CSC/ECE 517 Fall 2017/E1772 Refactor reputation web service controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1772_Refactor_reputation_web_service_controller.rb&amp;diff=111597"/>
		<updated>2017-11-03T01:43:46Z</updated>

		<summary type="html">&lt;p&gt;Hren3: /* Delete lines which is wrong or useless. */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
==='''Introduction to Expertiza'''===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a peer review based system which provides incremental learning from the class. This project has been developed together by faculty and students using [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create, edit and delete assignments, create new assignment topics, assign them to a particular class or selected students, have students work on teams and then review each other's assignments at the end. For the students, they can signup for topics, form teams, and submit their projects and assignments. &lt;br /&gt;
Students then review the work done by other students and give suggestions to improve. Teams after reviews are allotted scores and they can refer to the peer comments to further improve their work. It also supports submission of different file types for assignments, including the URLs and wiki pages.&lt;br /&gt;
==='''Problem Statement'''===&lt;br /&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 the reputation system. Reputation systems have been deployed as web services, peer-review researchers will be able to use them to calculate scores on assignments, both past and present (past data can be used to tune the algorithms). &lt;br /&gt;
&lt;br /&gt;
For this project, our team's job is to refactor the file: reputation_web_service_controller.rb. This file is the controller to calculate the reputation scores. A “reputation” measures how close a reviewer’s scores are to other reviewers scores. This controller is the sub-class of Application_Controller, in this controller, it implements the calculation and query of reputation scores.&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Issues to be fixed'''==&lt;br /&gt;
&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. 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;
#Replace class variable with a class instance var, and change all other places using these variables.&lt;br /&gt;
#Refactor method db_query&lt;br /&gt;
#Use zero? method instead of == 0&lt;br /&gt;
#Use find_by instead of dynamic method&lt;br /&gt;
#Delete lines which is wrong or useless.&lt;br /&gt;
#Comment lines&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Modified Files'''==&lt;br /&gt;
&lt;br /&gt;
reputation_web_service_controller.rb&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
=='''Approach taken to resolve the issues'''==&lt;br /&gt;
==='''Replace class variable with a class instance var, and change all other places using these variables.'''===&lt;br /&gt;
In ruby, class variables are started with '@@'and this class variable are shared in the whole inherit chain, and class variables are shared by all objects of a class. For instance variables, in Ruby, instance variables are started with '@' and instance variables belong to one object, can not be used by sub-classes. &lt;br /&gt;
&lt;br /&gt;
In the project, we are asked to replace the class variable with a class instance variables. &lt;br /&gt;
So, as the figure 1 shown, in variables declaration part, we changed all class variables to instance variables.&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation code1.png]]&lt;br /&gt;
&lt;br /&gt;
Next, we need to change all other places using these variables.&lt;br /&gt;
&lt;br /&gt;
In action '''send_post_request'''&lt;br /&gt;
&lt;br /&gt;
[[File:Reputaion 2.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Reputaion3.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation4.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation5.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation6.png]]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
==='''Refactor method db_query'''===&lt;br /&gt;
In the Reputation_web_service controller, the action db_query is important, because it implements the query of peer review grade.To refactor the db_query method, we need to firstly focus on the input variables of this method, there are 4 variables need inputs.&lt;br /&gt;
The db_query method is shown as follow:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def db_query(assignment_id, another_assignment_id = 0, round_num, hasTopic)&lt;br /&gt;
      ...&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
There is a problem: Optional arguments should appear at the end of the argument list, in this method, '''''another_assignment_id''''' is a optional arguments, but in the original version, the optional arguments -- '''''another_assignment_id''''' just appear right behind the argument--'''''assignment_id''''', so we need to refactor it.&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation8.png]]&lt;br /&gt;
&lt;br /&gt;
And the same problems occurs when we assigns value to variable '''''@results'''''. We also need to change it.&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation10.png]]&lt;br /&gt;
&lt;br /&gt;
There is another problem in the db_query method, we can see there is a input variable named '''''hasTopic''''', but actually that's not follow the '''&amp;quot;good Ruby and Rails coding practices&amp;quot;''', so we need to refactor it which shown as follow:&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation9.png]]&lt;br /&gt;
&lt;br /&gt;
Finally, The project asked us'' 'Move Line 26-50 before this method''', it's important for code refactor, because it's very inelegant if you put the comments inside the method. If others want to read your codes, it will cost their much more time so that it needs to be changed. Simply, we can just move the whole comments before the method, and that will make the codes easily for reading.&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation11.png]]&lt;br /&gt;
&lt;br /&gt;
==='''Use zero? method instead of == 0.'''===&lt;br /&gt;
&lt;br /&gt;
In the original version of project, every time there is a zero judgement occurs, it use ''''''==0'''''' or ''''''!=0'''''', of course it can achieve the judgement of zero, but according to the security consideration in ruby on rails development, we need to avoid the use of ''''''==0'''''' or ''''''!=0''''''. So the best way to solve it is using the '''''zero?''''' instead of ''''''==0'''''' or ''''''!=0'''''', which shown as follow:&lt;br /&gt;
[[File:Reputation12.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation13.png]]&lt;br /&gt;
&lt;br /&gt;
==='''Use find_by instead of dynamic method.'''===&lt;br /&gt;
This issue is replacing the find_by_id to find_by(id: id). The only difference of this change is syntax and their function worked in the same way. But if the customer want to change the way to find assignment, find_by(id: id) would be easier to change because programmer only need to change the parameter, while find_by_id need to change the whole method and its parameter. Therefore, in this project, using find_by_id is more efficient.&lt;br /&gt;
[[File:refactor15.png]]&lt;br /&gt;
[[File:refactor16.png]]&lt;br /&gt;
&lt;br /&gt;
==='''Delete lines which is wrong or useless.'''===&lt;br /&gt;
In Line 111, the variable inner_msg has never been used, so it can be deleted&lt;br /&gt;
[[File:refactor17.png]]&lt;br /&gt;
&lt;br /&gt;
From line 164 to 201 and line 204 to 241, cases for reputation value and do not need to handle the case for assign id. req body would change only in the case for 'Add expert grades'. If these two part failed to be deleted, the body would append three times and output wrong result.&lt;br /&gt;
[[File:refactor21.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:refactor19.png]]&lt;br /&gt;
&lt;br /&gt;
==='''Comment lines.'''===&lt;br /&gt;
The function for controller is not for output but just control and update the change of view. So puts should not appear in controller&lt;br /&gt;
&lt;br /&gt;
[[File:refactor22.png]]&lt;br /&gt;
[[File:refactor23.png]]&lt;br /&gt;
&lt;br /&gt;
==='''RSpec Test'''===&lt;br /&gt;
To finish the Test part, we write some test to ensure the functionality works and also to make sure the refactoring does not break any of the existing functionality. These tests check for the basic functionality of the reputation_web_service_controller.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe ReputationWebServiceController do&lt;br /&gt;
&lt;br /&gt;
  before(:each) do&lt;br /&gt;
    user = build(:instructor)&lt;br /&gt;
    stub_current_user(user, user.role.name, user.role)&lt;br /&gt;
    request.env['HTTP_REFERER'] = 'www.google.com'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  it 'should do execute query' do&lt;br /&gt;
    #controller.json_generator(41,0,2,'peer review grades').should != nil&lt;br /&gt;
    has_topic = !SignUpTopic.where(41).empty?&lt;br /&gt;
    raw_data_array = []&lt;br /&gt;
    raw_data_array = controller.db_query(41,2,has_topic,0)&lt;br /&gt;
    expect(controller.db_query(41,2,has_topic,0)).to be_an_instance_of(Array)&lt;br /&gt;
    expect(controller.db_query(41,2,has_topic,0)).should_not be(nil)&lt;br /&gt;
    expect(raw_data_array).should_not be(nil)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
   it 'should do special query with quiz score' do&lt;br /&gt;
    #controller.json_generator(41,0,2,'peer review grades').should != nil&lt;br /&gt;
    raw_data_array = []&lt;br /&gt;
    raw_data_array = controller.db_query_with_quiz_score(41,0)    &lt;br /&gt;
    expect(controller.db_query_with_quiz_score(41,0)).to be_an_instance_of(Array)&lt;br /&gt;
    expect(controller.db_query_with_quiz_score(41,0)).should_not be(nil)&lt;br /&gt;
    expect(raw_data_array).should_not be(nil)&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  it 'should query the QuizQuestionnaire with team_ids' do&lt;br /&gt;
    team_ids = 1&lt;br /&gt;
    quiz_questionnnaire_ids = []&lt;br /&gt;
    allow( QuizQuestionnaire).to where(:team_id).and_return(quiz_questionnnaires)&lt;br /&gt;
    expect(quiz_questionnnaires).should_not be(nil)&lt;br /&gt;
  end &lt;br /&gt;
  &lt;br /&gt;
  it 'should get the quiz score' do&lt;br /&gt;
      allow(Participant).to find(:reviewer_id).and_return(participant)&lt;br /&gt;
      expect(participant).should_not be(nil)&lt;br /&gt;
      allow(Participant).to find(:response_map).and_return(quiz_score)&lt;br /&gt;
      expect(quiz_score).should_not be(nil)   &lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The above codes achieve the test part of this controller——'''''Reputation_Web_Service_Controller''''', it this controller, there are some methods and we choose two methods do the test: '''''db_query''''' and '''''db_query_with_quiz_score'''''.&lt;/div&gt;</summary>
		<author><name>Hren3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1772_Refactor_reputation_web_service_controller.rb&amp;diff=111596</id>
		<title>CSC/ECE 517 Fall 2017/E1772 Refactor reputation web service controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1772_Refactor_reputation_web_service_controller.rb&amp;diff=111596"/>
		<updated>2017-11-03T01:43:26Z</updated>

		<summary type="html">&lt;p&gt;Hren3: /* Delete lines which is wrong or useless. */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
==='''Introduction to Expertiza'''===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a peer review based system which provides incremental learning from the class. This project has been developed together by faculty and students using [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create, edit and delete assignments, create new assignment topics, assign them to a particular class or selected students, have students work on teams and then review each other's assignments at the end. For the students, they can signup for topics, form teams, and submit their projects and assignments. &lt;br /&gt;
Students then review the work done by other students and give suggestions to improve. Teams after reviews are allotted scores and they can refer to the peer comments to further improve their work. It also supports submission of different file types for assignments, including the URLs and wiki pages.&lt;br /&gt;
==='''Problem Statement'''===&lt;br /&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 the reputation system. Reputation systems have been deployed as web services, peer-review researchers will be able to use them to calculate scores on assignments, both past and present (past data can be used to tune the algorithms). &lt;br /&gt;
&lt;br /&gt;
For this project, our team's job is to refactor the file: reputation_web_service_controller.rb. This file is the controller to calculate the reputation scores. A “reputation” measures how close a reviewer’s scores are to other reviewers scores. This controller is the sub-class of Application_Controller, in this controller, it implements the calculation and query of reputation scores.&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Issues to be fixed'''==&lt;br /&gt;
&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. 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;
#Replace class variable with a class instance var, and change all other places using these variables.&lt;br /&gt;
#Refactor method db_query&lt;br /&gt;
#Use zero? method instead of == 0&lt;br /&gt;
#Use find_by instead of dynamic method&lt;br /&gt;
#Delete lines which is wrong or useless.&lt;br /&gt;
#Comment lines&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Modified Files'''==&lt;br /&gt;
&lt;br /&gt;
reputation_web_service_controller.rb&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
=='''Approach taken to resolve the issues'''==&lt;br /&gt;
==='''Replace class variable with a class instance var, and change all other places using these variables.'''===&lt;br /&gt;
In ruby, class variables are started with '@@'and this class variable are shared in the whole inherit chain, and class variables are shared by all objects of a class. For instance variables, in Ruby, instance variables are started with '@' and instance variables belong to one object, can not be used by sub-classes. &lt;br /&gt;
&lt;br /&gt;
In the project, we are asked to replace the class variable with a class instance variables. &lt;br /&gt;
So, as the figure 1 shown, in variables declaration part, we changed all class variables to instance variables.&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation code1.png]]&lt;br /&gt;
&lt;br /&gt;
Next, we need to change all other places using these variables.&lt;br /&gt;
&lt;br /&gt;
In action '''send_post_request'''&lt;br /&gt;
&lt;br /&gt;
[[File:Reputaion 2.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Reputaion3.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation4.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation5.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation6.png]]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
==='''Refactor method db_query'''===&lt;br /&gt;
In the Reputation_web_service controller, the action db_query is important, because it implements the query of peer review grade.To refactor the db_query method, we need to firstly focus on the input variables of this method, there are 4 variables need inputs.&lt;br /&gt;
The db_query method is shown as follow:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def db_query(assignment_id, another_assignment_id = 0, round_num, hasTopic)&lt;br /&gt;
      ...&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
There is a problem: Optional arguments should appear at the end of the argument list, in this method, '''''another_assignment_id''''' is a optional arguments, but in the original version, the optional arguments -- '''''another_assignment_id''''' just appear right behind the argument--'''''assignment_id''''', so we need to refactor it.&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation8.png]]&lt;br /&gt;
&lt;br /&gt;
And the same problems occurs when we assigns value to variable '''''@results'''''. We also need to change it.&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation10.png]]&lt;br /&gt;
&lt;br /&gt;
There is another problem in the db_query method, we can see there is a input variable named '''''hasTopic''''', but actually that's not follow the '''&amp;quot;good Ruby and Rails coding practices&amp;quot;''', so we need to refactor it which shown as follow:&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation9.png]]&lt;br /&gt;
&lt;br /&gt;
Finally, The project asked us'' 'Move Line 26-50 before this method''', it's important for code refactor, because it's very inelegant if you put the comments inside the method. If others want to read your codes, it will cost their much more time so that it needs to be changed. Simply, we can just move the whole comments before the method, and that will make the codes easily for reading.&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation11.png]]&lt;br /&gt;
&lt;br /&gt;
==='''Use zero? method instead of == 0.'''===&lt;br /&gt;
&lt;br /&gt;
In the original version of project, every time there is a zero judgement occurs, it use ''''''==0'''''' or ''''''!=0'''''', of course it can achieve the judgement of zero, but according to the security consideration in ruby on rails development, we need to avoid the use of ''''''==0'''''' or ''''''!=0''''''. So the best way to solve it is using the '''''zero?''''' instead of ''''''==0'''''' or ''''''!=0'''''', which shown as follow:&lt;br /&gt;
[[File:Reputation12.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation13.png]]&lt;br /&gt;
&lt;br /&gt;
==='''Use find_by instead of dynamic method.'''===&lt;br /&gt;
This issue is replacing the find_by_id to find_by(id: id). The only difference of this change is syntax and their function worked in the same way. But if the customer want to change the way to find assignment, find_by(id: id) would be easier to change because programmer only need to change the parameter, while find_by_id need to change the whole method and its parameter. Therefore, in this project, using find_by_id is more efficient.&lt;br /&gt;
[[File:refactor15.png]]&lt;br /&gt;
[[File:refactor16.png]]&lt;br /&gt;
&lt;br /&gt;
==='''Delete lines which is wrong or useless.'''===&lt;br /&gt;
In Line 111, the variable inner_msg has never been used, so it can be deleted&lt;br /&gt;
[[File:refactor17.png]]&lt;br /&gt;
From line 164 to 201 and line 204 to 241, cases for reputation value and do not need to handle the case for assign id. req body would change only in the case for 'Add expert grades'. If these two part failed to be deleted, the body would append three times and output wrong result.&lt;br /&gt;
[[File:refactor21.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:refactor19.png]]&lt;br /&gt;
&lt;br /&gt;
==='''Comment lines.'''===&lt;br /&gt;
The function for controller is not for output but just control and update the change of view. So puts should not appear in controller&lt;br /&gt;
&lt;br /&gt;
[[File:refactor22.png]]&lt;br /&gt;
[[File:refactor23.png]]&lt;br /&gt;
&lt;br /&gt;
==='''RSpec Test'''===&lt;br /&gt;
To finish the Test part, we write some test to ensure the functionality works and also to make sure the refactoring does not break any of the existing functionality. These tests check for the basic functionality of the reputation_web_service_controller.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe ReputationWebServiceController do&lt;br /&gt;
&lt;br /&gt;
  before(:each) do&lt;br /&gt;
    user = build(:instructor)&lt;br /&gt;
    stub_current_user(user, user.role.name, user.role)&lt;br /&gt;
    request.env['HTTP_REFERER'] = 'www.google.com'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  it 'should do execute query' do&lt;br /&gt;
    #controller.json_generator(41,0,2,'peer review grades').should != nil&lt;br /&gt;
    has_topic = !SignUpTopic.where(41).empty?&lt;br /&gt;
    raw_data_array = []&lt;br /&gt;
    raw_data_array = controller.db_query(41,2,has_topic,0)&lt;br /&gt;
    expect(controller.db_query(41,2,has_topic,0)).to be_an_instance_of(Array)&lt;br /&gt;
    expect(controller.db_query(41,2,has_topic,0)).should_not be(nil)&lt;br /&gt;
    expect(raw_data_array).should_not be(nil)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
   it 'should do special query with quiz score' do&lt;br /&gt;
    #controller.json_generator(41,0,2,'peer review grades').should != nil&lt;br /&gt;
    raw_data_array = []&lt;br /&gt;
    raw_data_array = controller.db_query_with_quiz_score(41,0)    &lt;br /&gt;
    expect(controller.db_query_with_quiz_score(41,0)).to be_an_instance_of(Array)&lt;br /&gt;
    expect(controller.db_query_with_quiz_score(41,0)).should_not be(nil)&lt;br /&gt;
    expect(raw_data_array).should_not be(nil)&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  it 'should query the QuizQuestionnaire with team_ids' do&lt;br /&gt;
    team_ids = 1&lt;br /&gt;
    quiz_questionnnaire_ids = []&lt;br /&gt;
    allow( QuizQuestionnaire).to where(:team_id).and_return(quiz_questionnnaires)&lt;br /&gt;
    expect(quiz_questionnnaires).should_not be(nil)&lt;br /&gt;
  end &lt;br /&gt;
  &lt;br /&gt;
  it 'should get the quiz score' do&lt;br /&gt;
      allow(Participant).to find(:reviewer_id).and_return(participant)&lt;br /&gt;
      expect(participant).should_not be(nil)&lt;br /&gt;
      allow(Participant).to find(:response_map).and_return(quiz_score)&lt;br /&gt;
      expect(quiz_score).should_not be(nil)   &lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The above codes achieve the test part of this controller——'''''Reputation_Web_Service_Controller''''', it this controller, there are some methods and we choose two methods do the test: '''''db_query''''' and '''''db_query_with_quiz_score'''''.&lt;/div&gt;</summary>
		<author><name>Hren3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1772_Refactor_reputation_web_service_controller.rb&amp;diff=111593</id>
		<title>CSC/ECE 517 Fall 2017/E1772 Refactor reputation web service controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1772_Refactor_reputation_web_service_controller.rb&amp;diff=111593"/>
		<updated>2017-11-03T01:42:22Z</updated>

		<summary type="html">&lt;p&gt;Hren3: /* RSpec Test */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
==='''Introduction to Expertiza'''===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a peer review based system which provides incremental learning from the class. This project has been developed together by faculty and students using [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create, edit and delete assignments, create new assignment topics, assign them to a particular class or selected students, have students work on teams and then review each other's assignments at the end. For the students, they can signup for topics, form teams, and submit their projects and assignments. &lt;br /&gt;
Students then review the work done by other students and give suggestions to improve. Teams after reviews are allotted scores and they can refer to the peer comments to further improve their work. It also supports submission of different file types for assignments, including the URLs and wiki pages.&lt;br /&gt;
==='''Problem Statement'''===&lt;br /&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 the reputation system. Reputation systems have been deployed as web services, peer-review researchers will be able to use them to calculate scores on assignments, both past and present (past data can be used to tune the algorithms). &lt;br /&gt;
&lt;br /&gt;
For this project, our team's job is to refactor the file: reputation_web_service_controller.rb. This file is the controller to calculate the reputation scores. A “reputation” measures how close a reviewer’s scores are to other reviewers scores. This controller is the sub-class of Application_Controller, in this controller, it implements the calculation and query of reputation scores.&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Issues to be fixed'''==&lt;br /&gt;
&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. 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;
#Replace class variable with a class instance var, and change all other places using these variables.&lt;br /&gt;
#Refactor method db_query&lt;br /&gt;
#Use zero? method instead of == 0&lt;br /&gt;
#Use find_by instead of dynamic method&lt;br /&gt;
#Delete lines which is wrong or useless.&lt;br /&gt;
#Comment lines&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Modified Files'''==&lt;br /&gt;
&lt;br /&gt;
reputation_web_service_controller.rb&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
=='''Approach taken to resolve the issues'''==&lt;br /&gt;
==='''Replace class variable with a class instance var, and change all other places using these variables.'''===&lt;br /&gt;
In ruby, class variables are started with '@@'and this class variable are shared in the whole inherit chain, and class variables are shared by all objects of a class. For instance variables, in Ruby, instance variables are started with '@' and instance variables belong to one object, can not be used by sub-classes. &lt;br /&gt;
&lt;br /&gt;
In the project, we are asked to replace the class variable with a class instance variables. &lt;br /&gt;
So, as the figure 1 shown, in variables declaration part, we changed all class variables to instance variables.&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation code1.png]]&lt;br /&gt;
&lt;br /&gt;
Next, we need to change all other places using these variables.&lt;br /&gt;
&lt;br /&gt;
In action '''send_post_request'''&lt;br /&gt;
&lt;br /&gt;
[[File:Reputaion 2.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Reputaion3.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation4.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation5.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation6.png]]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
==='''Refactor method db_query'''===&lt;br /&gt;
In the Reputation_web_service controller, the action db_query is important, because it implements the query of peer review grade.To refactor the db_query method, we need to firstly focus on the input variables of this method, there are 4 variables need inputs.&lt;br /&gt;
The db_query method is shown as follow:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def db_query(assignment_id, another_assignment_id = 0, round_num, hasTopic)&lt;br /&gt;
      ...&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
There is a problem: Optional arguments should appear at the end of the argument list, in this method, '''''another_assignment_id''''' is a optional arguments, but in the original version, the optional arguments -- '''''another_assignment_id''''' just appear right behind the argument--'''''assignment_id''''', so we need to refactor it.&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation8.png]]&lt;br /&gt;
&lt;br /&gt;
And the same problems occurs when we assigns value to variable '''''@results'''''. We also need to change it.&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation10.png]]&lt;br /&gt;
&lt;br /&gt;
There is another problem in the db_query method, we can see there is a input variable named '''''hasTopic''''', but actually that's not follow the '''&amp;quot;good Ruby and Rails coding practices&amp;quot;''', so we need to refactor it which shown as follow:&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation9.png]]&lt;br /&gt;
&lt;br /&gt;
Finally, The project asked us'' 'Move Line 26-50 before this method''', it's important for code refactor, because it's very inelegant if you put the comments inside the method. If others want to read your codes, it will cost their much more time so that it needs to be changed. Simply, we can just move the whole comments before the method, and that will make the codes easily for reading.&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation11.png]]&lt;br /&gt;
&lt;br /&gt;
==='''Use zero? method instead of == 0.'''===&lt;br /&gt;
&lt;br /&gt;
In the original version of project, every time there is a zero judgement occurs, it use ''''''==0'''''' or ''''''!=0'''''', of course it can achieve the judgement of zero, but according to the security consideration in ruby on rails development, we need to avoid the use of ''''''==0'''''' or ''''''!=0''''''. So the best way to solve it is using the '''''zero?''''' instead of ''''''==0'''''' or ''''''!=0'''''', which shown as follow:&lt;br /&gt;
[[File:Reputation12.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation13.png]]&lt;br /&gt;
&lt;br /&gt;
==='''Use find_by instead of dynamic method.'''===&lt;br /&gt;
This issue is replacing the find_by_id to find_by(id: id). The only difference of this change is syntax and their function worked in the same way. But if the customer want to change the way to find assignment, find_by(id: id) would be easier to change because programmer only need to change the parameter, while find_by_id need to change the whole method and its parameter. Therefore, in this project, using find_by_id is more efficient.&lt;br /&gt;
[[File:refactor15.png]]&lt;br /&gt;
[[File:refactor16.png]]&lt;br /&gt;
&lt;br /&gt;
==='''Delete lines which is wrong or useless.'''===&lt;br /&gt;
In Line 111, the variable inner_msg has never been used, so it can be deleted&lt;br /&gt;
[[File:refactor17.png]]&lt;br /&gt;
From line 164 to 201 and line 204 to 241, cases for reputation value and do not need to handle the case for assign id. req body would change only in the case for 'Add expert grades'. If these two part failed to be deleted, the body would append three times and output wrong result.&lt;br /&gt;
[[File:refactor21.png]]&lt;br /&gt;
[[File:refactor19.png]]&lt;br /&gt;
&lt;br /&gt;
==='''Comment lines.'''===&lt;br /&gt;
The function for controller is not for output but just control and update the change of view. So puts should not appear in controller&lt;br /&gt;
&lt;br /&gt;
[[File:refactor22.png]]&lt;br /&gt;
[[File:refactor23.png]]&lt;br /&gt;
&lt;br /&gt;
==='''RSpec Test'''===&lt;br /&gt;
To finish the Test part, we write some test to ensure the functionality works and also to make sure the refactoring does not break any of the existing functionality. These tests check for the basic functionality of the reputation_web_service_controller.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe ReputationWebServiceController do&lt;br /&gt;
&lt;br /&gt;
  before(:each) do&lt;br /&gt;
    user = build(:instructor)&lt;br /&gt;
    stub_current_user(user, user.role.name, user.role)&lt;br /&gt;
    request.env['HTTP_REFERER'] = 'www.google.com'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  it 'should do execute query' do&lt;br /&gt;
    #controller.json_generator(41,0,2,'peer review grades').should != nil&lt;br /&gt;
    has_topic = !SignUpTopic.where(41).empty?&lt;br /&gt;
    raw_data_array = []&lt;br /&gt;
    raw_data_array = controller.db_query(41,2,has_topic,0)&lt;br /&gt;
    expect(controller.db_query(41,2,has_topic,0)).to be_an_instance_of(Array)&lt;br /&gt;
    expect(controller.db_query(41,2,has_topic,0)).should_not be(nil)&lt;br /&gt;
    expect(raw_data_array).should_not be(nil)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
   it 'should do special query with quiz score' do&lt;br /&gt;
    #controller.json_generator(41,0,2,'peer review grades').should != nil&lt;br /&gt;
    raw_data_array = []&lt;br /&gt;
    raw_data_array = controller.db_query_with_quiz_score(41,0)    &lt;br /&gt;
    expect(controller.db_query_with_quiz_score(41,0)).to be_an_instance_of(Array)&lt;br /&gt;
    expect(controller.db_query_with_quiz_score(41,0)).should_not be(nil)&lt;br /&gt;
    expect(raw_data_array).should_not be(nil)&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  it 'should query the QuizQuestionnaire with team_ids' do&lt;br /&gt;
    team_ids = 1&lt;br /&gt;
    quiz_questionnnaire_ids = []&lt;br /&gt;
    allow( QuizQuestionnaire).to where(:team_id).and_return(quiz_questionnnaires)&lt;br /&gt;
    expect(quiz_questionnnaires).should_not be(nil)&lt;br /&gt;
  end &lt;br /&gt;
  &lt;br /&gt;
  it 'should get the quiz score' do&lt;br /&gt;
      allow(Participant).to find(:reviewer_id).and_return(participant)&lt;br /&gt;
      expect(participant).should_not be(nil)&lt;br /&gt;
      allow(Participant).to find(:response_map).and_return(quiz_score)&lt;br /&gt;
      expect(quiz_score).should_not be(nil)   &lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The above codes achieve the test part of this controller——'''''Reputation_Web_Service_Controller''''', it this controller, there are some methods and we choose two methods do the test: '''''db_query''''' and '''''db_query_with_quiz_score'''''.&lt;/div&gt;</summary>
		<author><name>Hren3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1772_Refactor_reputation_web_service_controller.rb&amp;diff=111590</id>
		<title>CSC/ECE 517 Fall 2017/E1772 Refactor reputation web service controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1772_Refactor_reputation_web_service_controller.rb&amp;diff=111590"/>
		<updated>2017-11-03T01:32:50Z</updated>

		<summary type="html">&lt;p&gt;Hren3: /* RSpec Test */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
==='''Introduction to Expertiza'''===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a peer review based system which provides incremental learning from the class. This project has been developed together by faculty and students using [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create, edit and delete assignments, create new assignment topics, assign them to a particular class or selected students, have students work on teams and then review each other's assignments at the end. For the students, they can signup for topics, form teams, and submit their projects and assignments. &lt;br /&gt;
Students then review the work done by other students and give suggestions to improve. Teams after reviews are allotted scores and they can refer to the peer comments to further improve their work. It also supports submission of different file types for assignments, including the URLs and wiki pages.&lt;br /&gt;
==='''Problem Statement'''===&lt;br /&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 the reputation system. Reputation systems have been deployed as web services, peer-review researchers will be able to use them to calculate scores on assignments, both past and present (past data can be used to tune the algorithms). &lt;br /&gt;
&lt;br /&gt;
For this project, our team's job is to refactor the file: reputation_web_service_controller.rb. This file is the controller to calculate the reputation scores. A “reputation” measures how close a reviewer’s scores are to other reviewers scores. This controller is the sub-class of Application_Controller, in this controller, it implements the calculation and query of reputation scores.&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Issues to be fixed'''==&lt;br /&gt;
&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. 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;
#Replace class variable with a class instance var, and change all other places using these variables.&lt;br /&gt;
#Refactor method db_query&lt;br /&gt;
#Use zero? method instead of == 0&lt;br /&gt;
#Use find_by instead of dynamic method&lt;br /&gt;
#Delete lines which is wrong or useless.&lt;br /&gt;
#Comment lines&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Modified Files'''==&lt;br /&gt;
&lt;br /&gt;
reputation_web_service_controller.rb&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
=='''Approach taken to resolve the issues'''==&lt;br /&gt;
==='''Replace class variable with a class instance var, and change all other places using these variables.'''===&lt;br /&gt;
In ruby, class variables are started with '@@'and this class variable are shared in the whole inherit chain, and class variables are shared by all objects of a class. For instance variables, in Ruby, instance variables are started with '@' and instance variables belong to one object, can not be used by sub-classes. &lt;br /&gt;
&lt;br /&gt;
In the project, we are asked to replace the class variable with a class instance variables. &lt;br /&gt;
So, as the figure 1 shown, in variables declaration part, we changed all class variables to instance variables.&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation code1.png]]&lt;br /&gt;
&lt;br /&gt;
Next, we need to change all other places using these variables.&lt;br /&gt;
&lt;br /&gt;
In action '''send_post_request'''&lt;br /&gt;
&lt;br /&gt;
[[File:Reputaion 2.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Reputaion3.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation4.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation5.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation6.png]]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
==='''Refactor method db_query'''===&lt;br /&gt;
In the Reputation_web_service controller, the action db_query is important, because it implements the query of peer review grade.To refactor the db_query method, we need to firstly focus on the input variables of this method, there are 4 variables need inputs.&lt;br /&gt;
The db_query method is shown as follow:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def db_query(assignment_id, another_assignment_id = 0, round_num, hasTopic)&lt;br /&gt;
      ...&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
There is a problem: Optional arguments should appear at the end of the argument list, in this method, '''''another_assignment_id''''' is a optional arguments, but in the original version, the optional arguments -- '''''another_assignment_id''''' just appear right behind the argument--'''''assignment_id''''', so we need to refactor it.&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation8.png]]&lt;br /&gt;
&lt;br /&gt;
And the same problems occurs when we assigns value to variable '''''@results'''''. We also need to change it.&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation10.png]]&lt;br /&gt;
&lt;br /&gt;
There is another problem in the db_query method, we can see there is a input variable named '''''hasTopic''''', but actually that's not follow the '''&amp;quot;good Ruby and Rails coding practices&amp;quot;''', so we need to refactor it which shown as follow:&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation9.png]]&lt;br /&gt;
&lt;br /&gt;
Finally, The project asked us'' 'Move Line 26-50 before this method''', it's important for code refactor, because it's very inelegant if you put the comments inside the method. If others want to read your codes, it will cost their much more time so that it needs to be changed. Simply, we can just move the whole comments before the method, and that will make the codes easily for reading.&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation11.png]]&lt;br /&gt;
&lt;br /&gt;
==='''Use zero? method instead of == 0.'''===&lt;br /&gt;
&lt;br /&gt;
In the original version of project, every time there is a zero judgement occurs, it use ''''''==0'''''' or ''''''!=0'''''', of course it can achieve the judgement of zero, but according to the security consideration in ruby on rails development, we need to avoid the use of ''''''==0'''''' or ''''''!=0''''''. So the best way to solve it is using the '''''zero?''''' instead of ''''''==0'''''' or ''''''!=0'''''', which shown as follow:&lt;br /&gt;
[[File:Reputation12.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation13.png]]&lt;br /&gt;
&lt;br /&gt;
==='''Use find_by instead of dynamic method.'''===&lt;br /&gt;
This issue is replacing the find_by_id to find_by(id: id). The only difference of this change is syntax and their function worked in the same way. But if the customer want to change the way to find assignment, find_by(id: id) would be easier to change because programmer only need to change the parameter, while find_by_id need to change the whole method and its parameter. Therefore, in this project, using find_by_id is more efficient.&lt;br /&gt;
[[File:refactor15.png]]&lt;br /&gt;
[[File:refactor16.png]]&lt;br /&gt;
&lt;br /&gt;
==='''Delete lines which is wrong or useless.'''===&lt;br /&gt;
In Line 111, the variable inner_msg has never been used, so it can be deleted&lt;br /&gt;
[[File:refactor17.png]]&lt;br /&gt;
From line 164 to 201 and line 204 to 241, cases for reputation value and do not need to handle the case for assign id. req body would change only in the case for 'Add expert grades'. If these two part failed to be deleted, the body would append three times and output wrong result.&lt;br /&gt;
[[File:refactor21.png]]&lt;br /&gt;
[[File:refactor19.png]]&lt;br /&gt;
&lt;br /&gt;
==='''Comment lines.'''===&lt;br /&gt;
The function for controller is not for output but just control and update the change of view. So puts should not appear in controller&lt;br /&gt;
&lt;br /&gt;
[[File:refactor22.png]]&lt;br /&gt;
[[File:refactor23.png]]&lt;br /&gt;
&lt;br /&gt;
==='''RSpec Test'''===&lt;br /&gt;
To finish the Test part, we write some test to ensure the functionality works and also to make sure the refactoring does not break any of the existing functionality. These tests check for the basic functionality of the reputation_web_service_controller.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe ReputationWebServiceController do&lt;br /&gt;
&lt;br /&gt;
  before(:each) do&lt;br /&gt;
    user = build(:instructor)&lt;br /&gt;
    stub_current_user(user, user.role.name, user.role)&lt;br /&gt;
    request.env['HTTP_REFERER'] = 'www.google.com'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  it 'should do execute query' do&lt;br /&gt;
    #controller.json_generator(41,0,2,'peer review grades').should != nil&lt;br /&gt;
    has_topic = !SignUpTopic.where(41).empty?&lt;br /&gt;
    raw_data_array = []&lt;br /&gt;
    raw_data_array = controller.db_query(41,2,has_topic,0)&lt;br /&gt;
    expect(controller.db_query(41,2,has_topic,0)).to be_an_instance_of(Array)&lt;br /&gt;
    expect(controller.db_query(41,2,has_topic,0)).should_not be(nil)&lt;br /&gt;
    expect(raw_data_array).should_not be(nil)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
   it 'should do special query with quiz score' do&lt;br /&gt;
    #controller.json_generator(41,0,2,'peer review grades').should != nil&lt;br /&gt;
    raw_data_array = []&lt;br /&gt;
    raw_data_array = controller.db_query_with_quiz_score(41,0)    &lt;br /&gt;
    expect(controller.db_query_with_quiz_score(41,0)).to be_an_instance_of(Array)&lt;br /&gt;
    expect(controller.db_query_with_quiz_score(41,0)).should_not be(nil)&lt;br /&gt;
    expect(raw_data_array).should_not be(nil)&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  it 'should query the QuizQuestionnaire with team_ids' do&lt;br /&gt;
    team_ids = 1&lt;br /&gt;
    quiz_questionnnaire_ids = []&lt;br /&gt;
    allow( QuizQuestionnaire).to where(:team_id).and_return(quiz_questionnnaires)&lt;br /&gt;
    expect(quiz_questionnnaires).should_not be(nil)&lt;br /&gt;
  end &lt;br /&gt;
  &lt;br /&gt;
  it 'should get the quiz score' do&lt;br /&gt;
      allow(Participant).to find(:reviewer_id).and_return(participant)&lt;br /&gt;
      expect(participant).should_not be(nil)&lt;br /&gt;
      allow(Participant).to find(:response_map).and_return(quiz_score)&lt;br /&gt;
      expect(quiz_score).should_not be(nil)   &lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Hren3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1772_Refactor_reputation_web_service_controller.rb&amp;diff=109352</id>
		<title>CSC/ECE 517 Fall 2017/E1772 Refactor reputation web service controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1772_Refactor_reputation_web_service_controller.rb&amp;diff=109352"/>
		<updated>2017-10-26T04:05:59Z</updated>

		<summary type="html">&lt;p&gt;Hren3: /* Approach taken to resolve the issues */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
==='''Introduction to Expertiza'''===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a peer review based system which provides incremental learning from the class. This project has been developed together by faculty and students using [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create, edit and delete assignments, create new assignment topics, assign them to a particular class or selected students, have students work on teams and then review each other's assignments at the end. For the students, they can signup for topics, form teams, and submit their projects and assignments. &lt;br /&gt;
Students then review the work done by other students and give suggestions to improve. Teams after reviews are allotted scores and they can refer to the peer comments to further improve their work. It also supports submission of different file types for assignments, including the URLs and wiki pages.&lt;br /&gt;
==='''Problem Statement'''===&lt;br /&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 the reputation system. Reputation systems have been deployed as web services, peer-review researchers will be able to use them to calculate scores on assignments, both past and present (past data can be used to tune the algorithms). &lt;br /&gt;
&lt;br /&gt;
For this project, our team's job is to refactor the file: reputation_web_service_controller.rb. This file is the controller to calculate the reputation scores. A “reputation” measures how close a reviewer’s scores are to other reviewers scores. This controller is the sub-class of Application_Controller, in this controller, it implements the calculation and query of reputation scores.&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Issues to be fixed'''==&lt;br /&gt;
&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. 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;
#Replace class variable with a class instance var, and change all other places using these variables.&lt;br /&gt;
#Refactor method db_query&lt;br /&gt;
#Use zero? method instead of == 0&lt;br /&gt;
#Use find_by instead of dynamic method&lt;br /&gt;
#Delete lines which is wrong or useless.&lt;br /&gt;
#Comment lines&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Modified Files'''==&lt;br /&gt;
&lt;br /&gt;
reputation_web_service_controller.rb&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
=='''Approach taken to resolve the issues'''==&lt;br /&gt;
==='''Replace class variable with a class instance var, and change all other places using these variables.'''===&lt;br /&gt;
In ruby, class variables are started with '@@'and this class variable are shared in the whole inherit chain, and class variables are shared by all objects of a class. For instance variables, in Ruby, instance variables are started with '@' and instance variables belong to one object, can not be used by sub-classes. &lt;br /&gt;
&lt;br /&gt;
In the project, we are asked to replace the class variable with a class instance variables. &lt;br /&gt;
So, as the figure 1 shown, in variables declaration part, we changed all class variables to instance variables.&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation code1.png]]&lt;br /&gt;
&lt;br /&gt;
Next, we need to change all other places using these variables.&lt;br /&gt;
&lt;br /&gt;
In action '''send_post_request'''&lt;br /&gt;
&lt;br /&gt;
[[File:Reputaion 2.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Reputaion3.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation4.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation5.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation6.png]]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
==='''Refactor method db_query'''===&lt;br /&gt;
In the Reputation_web_service controller, the action db_query is important, because it implements the query of peer review grade.To refactor the db_query method, we need to firstly focus on the input variables of this method, there are 4 variables need inputs.&lt;br /&gt;
The db_query method is shown as follow:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def db_query(assignment_id, another_assignment_id = 0, round_num, hasTopic)&lt;br /&gt;
      ...&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
There is a problem: Optional arguments should appear at the end of the argument list, in this method, '''''another_assignment_id''''' is a optional arguments, but in the original version, the optional arguments -- '''''another_assignment_id''''' just appear right behind the argument--'''''assignment_id''''', so we need to refactor it.&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation8.png]]&lt;br /&gt;
&lt;br /&gt;
And the same problems occurs when we assigns value to variable '''''@results'''''. We also need to change it.&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation10.png]]&lt;br /&gt;
&lt;br /&gt;
There is another problem in the db_query method, we can see there is a input variable named '''''hasTopic''''', but actually that's not follow the '''&amp;quot;good Ruby and Rails coding practices&amp;quot;''', so we need to refactor it which shown as follow:&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation9.png]]&lt;br /&gt;
&lt;br /&gt;
Finally, The project asked us'' 'Move Line 26-50 before this method''', it's important for code refactor, because it's very inelegant if you put the comments inside the method. If others want to read your codes, it will cost their much more time so that it needs to be changed. Simply, we can just move the whole comments before the method, and that will make the codes easily for reading.&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation11.png]]&lt;br /&gt;
&lt;br /&gt;
==='''Use zero? method instead of == 0.'''===&lt;br /&gt;
&lt;br /&gt;
In the original version of project, every time there is a zero judgement occurs, it use ''''''==0'''''' or ''''''!=0'''''', of course it can achieve the judgement of zero, but according to the security consideration in ruby on rails development, we need to avoid the use of ''''''==0'''''' or ''''''!=0''''''. So the best way to solve it is using the '''''zero?''''' instead of ''''''==0'''''' or ''''''!=0'''''', which shown as follow:&lt;br /&gt;
[[File:Reputation12.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation13.png]]&lt;br /&gt;
&lt;br /&gt;
==='''Use find_by instead of dynamic method.'''===&lt;br /&gt;
&lt;br /&gt;
==='''Delete lines which is wrong or useless.'''===&lt;br /&gt;
&lt;br /&gt;
==='''Comment lines.'''===&lt;/div&gt;</summary>
		<author><name>Hren3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1772_Refactor_reputation_web_service_controller.rb&amp;diff=109351</id>
		<title>CSC/ECE 517 Fall 2017/E1772 Refactor reputation web service controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1772_Refactor_reputation_web_service_controller.rb&amp;diff=109351"/>
		<updated>2017-10-26T04:04:09Z</updated>

		<summary type="html">&lt;p&gt;Hren3: /* Use zero? method instead of == 0. */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
==='''Introduction to Expertiza'''===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a peer review based system which provides incremental learning from the class. This project has been developed together by faculty and students using [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create, edit and delete assignments, create new assignment topics, assign them to a particular class or selected students, have students work on teams and then review each other's assignments at the end. For the students, they can signup for topics, form teams, and submit their projects and assignments. &lt;br /&gt;
Students then review the work done by other students and give suggestions to improve. Teams after reviews are allotted scores and they can refer to the peer comments to further improve their work. It also supports submission of different file types for assignments, including the URLs and wiki pages.&lt;br /&gt;
==='''Problem Statement'''===&lt;br /&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 the reputation system. Reputation systems have been deployed as web services, peer-review researchers will be able to use them to calculate scores on assignments, both past and present (past data can be used to tune the algorithms). &lt;br /&gt;
&lt;br /&gt;
For this project, our team's job is to refactor the file: reputation_web_service_controller.rb. This file is the controller to calculate the reputation scores. A “reputation” measures how close a reviewer’s scores are to other reviewers scores. This controller is the sub-class of Application_Controller, in this controller, it implements the calculation and query of reputation scores.&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Issues to be fixed'''==&lt;br /&gt;
&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. 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;
#Replace class variable with a class instance var, and change all other places using these variables.&lt;br /&gt;
#Refactor method db_query&lt;br /&gt;
#Use zero? method instead of == 0&lt;br /&gt;
#Use find_by instead of dynamic method&lt;br /&gt;
#Delete lines which is wrong or useless.&lt;br /&gt;
#Comment lines&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Modified Files'''==&lt;br /&gt;
&lt;br /&gt;
reputation_web_service_controller.rb&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
=='''Approach taken to resolve the issues'''==&lt;br /&gt;
==='''Replace class variable with a class instance var, and change all other places using these variables.'''===&lt;br /&gt;
In ruby, class variables are started with '@@'and this class variable are shared in the whole inherit chain, and class variables are shared by all objects of a class. For instance variables, in Ruby, instance variables are started with '@' and instance variables belong to one object, can not be used by sub-classes. &lt;br /&gt;
&lt;br /&gt;
In the project, we are asked to replace the class variable with a class instance variables. &lt;br /&gt;
So, as the figure 1 shown, in variables declaration part, we changed all class variables to instance variables.&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation code1.png]]&lt;br /&gt;
&lt;br /&gt;
Next, we need to change all other places using these variables.&lt;br /&gt;
&lt;br /&gt;
In action '''send_post_request'''&lt;br /&gt;
&lt;br /&gt;
[[File:Reputaion 2.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Reputaion3.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation4.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation5.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation6.png]]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
==='''Refactor method db_query'''===&lt;br /&gt;
In the Reputation_web_service controller, the action db_query is important, because it implements the query of peer review grade.To refactor the db_query method, we need to firstly focus on the input variables of this method, there are 4 variables need inputs.&lt;br /&gt;
The db_query method is shown as follow:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def db_query(assignment_id, another_assignment_id = 0, round_num, hasTopic)&lt;br /&gt;
      ...&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
There is a problem: Optional arguments should appear at the end of the argument list, in this method, '''''another_assignment_id''''' is a optional arguments, but in the original version, the optional arguments -- '''''another_assignment_id''''' just appear right behind the argument--'''''assignment_id''''', so we need to refactor it.&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation8.png]]&lt;br /&gt;
&lt;br /&gt;
And the same problems occurs when we assigns value to variable '''''@results'''''. We also need to change it.&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation10.png]]&lt;br /&gt;
&lt;br /&gt;
There is another problem in the db_query method, we can see there is a input variable named '''''hasTopic''''', but actually that's not follow the '''&amp;quot;good Ruby and Rails coding practices&amp;quot;''', so we need to refactor it which shown as follow:&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation9.png]]&lt;br /&gt;
&lt;br /&gt;
Finally, The project asked us'' 'Move Line 26-50 before this method''', it's important for code refactor, because it's very inelegant if you put the comments inside the method. If others want to read your codes, it will cost their much more time so that it needs to be changed. Simply, we can just move the whole comments before the method, and that will make the codes easily for reading.&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation11.png]]&lt;br /&gt;
&lt;br /&gt;
==='''Use zero? method instead of == 0.'''===&lt;br /&gt;
&lt;br /&gt;
In the original version of project, every time there is a zero judgement occurs, it use ''''''==0'''''' or ''''''!=0'''''', of course it can achieve the judgement of zero, but according to the security consideration in ruby on rails development, we need to avoid the use of ''''''==0'''''' or ''''''!=0''''''. So the best way to solve it is using the '''''zero?''''' instead of ''''''==0'''''' or ''''''!=0'''''', which shown as follow:&lt;br /&gt;
[[File:Reputation12.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation13.png]]&lt;br /&gt;
&lt;br /&gt;
==='''Use find_by instead of dynamic method.'''===&lt;br /&gt;
&lt;br /&gt;
==='''Comment lines.'''===&lt;/div&gt;</summary>
		<author><name>Hren3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Reputation13.png&amp;diff=109350</id>
		<title>File:Reputation13.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Reputation13.png&amp;diff=109350"/>
		<updated>2017-10-26T04:03:25Z</updated>

		<summary type="html">&lt;p&gt;Hren3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Hren3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Reputation12.png&amp;diff=109349</id>
		<title>File:Reputation12.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Reputation12.png&amp;diff=109349"/>
		<updated>2017-10-26T04:03:16Z</updated>

		<summary type="html">&lt;p&gt;Hren3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Hren3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1772_Refactor_reputation_web_service_controller.rb&amp;diff=109348</id>
		<title>CSC/ECE 517 Fall 2017/E1772 Refactor reputation web service controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1772_Refactor_reputation_web_service_controller.rb&amp;diff=109348"/>
		<updated>2017-10-26T03:52:03Z</updated>

		<summary type="html">&lt;p&gt;Hren3: /* Approach taken to resolve the issues */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
==='''Introduction to Expertiza'''===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a peer review based system which provides incremental learning from the class. This project has been developed together by faculty and students using [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create, edit and delete assignments, create new assignment topics, assign them to a particular class or selected students, have students work on teams and then review each other's assignments at the end. For the students, they can signup for topics, form teams, and submit their projects and assignments. &lt;br /&gt;
Students then review the work done by other students and give suggestions to improve. Teams after reviews are allotted scores and they can refer to the peer comments to further improve their work. It also supports submission of different file types for assignments, including the URLs and wiki pages.&lt;br /&gt;
==='''Problem Statement'''===&lt;br /&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 the reputation system. Reputation systems have been deployed as web services, peer-review researchers will be able to use them to calculate scores on assignments, both past and present (past data can be used to tune the algorithms). &lt;br /&gt;
&lt;br /&gt;
For this project, our team's job is to refactor the file: reputation_web_service_controller.rb. This file is the controller to calculate the reputation scores. A “reputation” measures how close a reviewer’s scores are to other reviewers scores. This controller is the sub-class of Application_Controller, in this controller, it implements the calculation and query of reputation scores.&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Issues to be fixed'''==&lt;br /&gt;
&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. 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;
#Replace class variable with a class instance var, and change all other places using these variables.&lt;br /&gt;
#Refactor method db_query&lt;br /&gt;
#Use zero? method instead of == 0&lt;br /&gt;
#Use find_by instead of dynamic method&lt;br /&gt;
#Delete lines which is wrong or useless.&lt;br /&gt;
#Comment lines&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Modified Files'''==&lt;br /&gt;
&lt;br /&gt;
reputation_web_service_controller.rb&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
=='''Approach taken to resolve the issues'''==&lt;br /&gt;
==='''Replace class variable with a class instance var, and change all other places using these variables.'''===&lt;br /&gt;
In ruby, class variables are started with '@@'and this class variable are shared in the whole inherit chain, and class variables are shared by all objects of a class. For instance variables, in Ruby, instance variables are started with '@' and instance variables belong to one object, can not be used by sub-classes. &lt;br /&gt;
&lt;br /&gt;
In the project, we are asked to replace the class variable with a class instance variables. &lt;br /&gt;
So, as the figure 1 shown, in variables declaration part, we changed all class variables to instance variables.&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation code1.png]]&lt;br /&gt;
&lt;br /&gt;
Next, we need to change all other places using these variables.&lt;br /&gt;
&lt;br /&gt;
In action '''send_post_request'''&lt;br /&gt;
&lt;br /&gt;
[[File:Reputaion 2.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Reputaion3.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation4.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation5.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation6.png]]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
==='''Refactor method db_query'''===&lt;br /&gt;
In the Reputation_web_service controller, the action db_query is important, because it implements the query of peer review grade.To refactor the db_query method, we need to firstly focus on the input variables of this method, there are 4 variables need inputs.&lt;br /&gt;
The db_query method is shown as follow:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def db_query(assignment_id, another_assignment_id = 0, round_num, hasTopic)&lt;br /&gt;
      ...&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
There is a problem: Optional arguments should appear at the end of the argument list, in this method, '''''another_assignment_id''''' is a optional arguments, but in the original version, the optional arguments -- '''''another_assignment_id''''' just appear right behind the argument--'''''assignment_id''''', so we need to refactor it.&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation8.png]]&lt;br /&gt;
&lt;br /&gt;
And the same problems occurs when we assigns value to variable '''''@results'''''. We also need to change it.&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation10.png]]&lt;br /&gt;
&lt;br /&gt;
There is another problem in the db_query method, we can see there is a input variable named '''''hasTopic''''', but actually that's not follow the '''&amp;quot;good Ruby and Rails coding practices&amp;quot;''', so we need to refactor it which shown as follow:&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation9.png]]&lt;br /&gt;
&lt;br /&gt;
Finally, The project asked us'' 'Move Line 26-50 before this method''', it's important for code refactor, because it's very inelegant if you put the comments inside the method. If others want to read your codes, it will cost their much more time so that it needs to be changed. Simply, we can just move the whole comments before the method, and that will make the codes easily for reading.&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation11.png]]&lt;br /&gt;
&lt;br /&gt;
==='''Use zero? method instead of == 0.'''===&lt;br /&gt;
&lt;br /&gt;
In the original version of project, every time there is a zero judgement occurs, it use ''''''==0'''''' or ''''''!=0''''''&lt;br /&gt;
==='''Use find_by instead of dynamic method.'''===&lt;br /&gt;
&lt;br /&gt;
==='''Comment lines.'''===&lt;/div&gt;</summary>
		<author><name>Hren3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1772_Refactor_reputation_web_service_controller.rb&amp;diff=109345</id>
		<title>CSC/ECE 517 Fall 2017/E1772 Refactor reputation web service controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1772_Refactor_reputation_web_service_controller.rb&amp;diff=109345"/>
		<updated>2017-10-26T03:43:10Z</updated>

		<summary type="html">&lt;p&gt;Hren3: /* Replace class variable with a class instance var, and change all other places using these variables. */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
==='''Introduction to Expertiza'''===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a peer review based system which provides incremental learning from the class. This project has been developed together by faculty and students using [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create, edit and delete assignments, create new assignment topics, assign them to a particular class or selected students, have students work on teams and then review each other's assignments at the end. For the students, they can signup for topics, form teams, and submit their projects and assignments. &lt;br /&gt;
Students then review the work done by other students and give suggestions to improve. Teams after reviews are allotted scores and they can refer to the peer comments to further improve their work. It also supports submission of different file types for assignments, including the URLs and wiki pages.&lt;br /&gt;
==='''Problem Statement'''===&lt;br /&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 the reputation system. Reputation systems have been deployed as web services, peer-review researchers will be able to use them to calculate scores on assignments, both past and present (past data can be used to tune the algorithms). &lt;br /&gt;
&lt;br /&gt;
For this project, our team's job is to refactor the file: reputation_web_service_controller.rb. This file is the controller to calculate the reputation scores. A “reputation” measures how close a reviewer’s scores are to other reviewers scores. This controller is the sub-class of Application_Controller, in this controller, it implements the calculation and query of reputation scores.&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Issues to be fixed'''==&lt;br /&gt;
&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. 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;
#Replace class variable with a class instance var, and change all other places using these variables.&lt;br /&gt;
#Refactor method db_query&lt;br /&gt;
#Use zero? method instead of == 0&lt;br /&gt;
#Use find_by instead of dynamic method&lt;br /&gt;
#Delete lines which is wrong or useless.&lt;br /&gt;
#Comment lines&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Modified Files'''==&lt;br /&gt;
&lt;br /&gt;
reputation_web_service_controller.rb&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
=='''Approach taken to resolve the issues'''==&lt;br /&gt;
==='''Replace class variable with a class instance var, and change all other places using these variables.'''===&lt;br /&gt;
In ruby, class variables are started with '@@'and this class variable are shared in the whole inherit chain, and class variables are shared by all objects of a class. For instance variables, in Ruby, instance variables are started with '@' and instance variables belong to one object, can not be used by sub-classes. &lt;br /&gt;
&lt;br /&gt;
In the project, we are asked to replace the class variable with a class instance variables. &lt;br /&gt;
So, as the figure 1 shown, in variables declaration part, we changed all class variables to instance variables.&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation code1.png]]&lt;br /&gt;
&lt;br /&gt;
Next, we need to change all other places using these variables.&lt;br /&gt;
&lt;br /&gt;
In action '''send_post_request'''&lt;br /&gt;
&lt;br /&gt;
[[File:Reputaion 2.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Reputaion3.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation4.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation5.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation6.png]]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
==='''Refactor method db_query'''===&lt;br /&gt;
In the Reputation_web_service controller, the action db_query is important, because it implements the query of peer review grade.To refactor the db_query method, we need to firstly focus on the input variables of this method, there are 4 variables need inputs.&lt;br /&gt;
The db_query method is shown as follow:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def db_query(assignment_id, another_assignment_id = 0, round_num, hasTopic)&lt;br /&gt;
      ...&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
There is a problem: Optional arguments should appear at the end of the argument list, in this method, '''''another_assignment_id''''' is a optional arguments, but in the original version, the optional arguments -- '''''another_assignment_id''''' just appear right behind the argument--'''''assignment_id''''', so we need to refactor it.&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation8.png]]&lt;br /&gt;
&lt;br /&gt;
And the same problems occurs when we assigns value to variable '''''@results'''''. We also need to change it.&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation10.png]]&lt;br /&gt;
&lt;br /&gt;
There is another problem in the db_query method, we can see there is a input variable named '''''hasTopic''''', but actually that's not follow the '''&amp;quot;good Ruby and Rails coding practices&amp;quot;''', so we need to refactor it which shown as follow:&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation9.png]]&lt;br /&gt;
&lt;br /&gt;
Finally, The project asked us'' 'Move Line 26-50 before this method''', it's important for code refactor, because it's very inelegant if you put the comments inside the method. If others want to read your codes, it will cost their much more time so that it needs to be changed. Simply, we can just move the whole comments before the method, and that will make the codes easily for reading.&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation11.png]]&lt;/div&gt;</summary>
		<author><name>Hren3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1772_Refactor_reputation_web_service_controller.rb&amp;diff=109342</id>
		<title>CSC/ECE 517 Fall 2017/E1772 Refactor reputation web service controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1772_Refactor_reputation_web_service_controller.rb&amp;diff=109342"/>
		<updated>2017-10-26T03:42:00Z</updated>

		<summary type="html">&lt;p&gt;Hren3: /* Refactor method db_query */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
==='''Introduction to Expertiza'''===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a peer review based system which provides incremental learning from the class. This project has been developed together by faculty and students using [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create, edit and delete assignments, create new assignment topics, assign them to a particular class or selected students, have students work on teams and then review each other's assignments at the end. For the students, they can signup for topics, form teams, and submit their projects and assignments. &lt;br /&gt;
Students then review the work done by other students and give suggestions to improve. Teams after reviews are allotted scores and they can refer to the peer comments to further improve their work. It also supports submission of different file types for assignments, including the URLs and wiki pages.&lt;br /&gt;
==='''Problem Statement'''===&lt;br /&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 the reputation system. Reputation systems have been deployed as web services, peer-review researchers will be able to use them to calculate scores on assignments, both past and present (past data can be used to tune the algorithms). &lt;br /&gt;
&lt;br /&gt;
For this project, our team's job is to refactor the file: reputation_web_service_controller.rb. This file is the controller to calculate the reputation scores. A “reputation” measures how close a reviewer’s scores are to other reviewers scores. This controller is the sub-class of Application_Controller, in this controller, it implements the calculation and query of reputation scores.&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Issues to be fixed'''==&lt;br /&gt;
&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. 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;
#Replace class variable with a class instance var, and change all other places using these variables.&lt;br /&gt;
#Refactor method db_query&lt;br /&gt;
#Use zero? method instead of == 0&lt;br /&gt;
#Use find_by instead of dynamic method&lt;br /&gt;
#Delete lines which is wrong or useless.&lt;br /&gt;
#Comment lines&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Modified Files'''==&lt;br /&gt;
&lt;br /&gt;
reputation_web_service_controller.rb&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
=='''Approach taken to resolve the issues'''==&lt;br /&gt;
==='''Replace class variable with a class instance var, and change all other places using these variables.'''===&lt;br /&gt;
In ruby, class variables are started with '@@' and this class variable are shared in the whole inherit chain, and class variables are shared by all objects of a class. For instance variables, in Ruby, instance variables are started with '@' and instance variables belong to one object, can not be used by sub-classes. &lt;br /&gt;
&lt;br /&gt;
In the project, we are asked to replace the class variable with a class instance variables. &lt;br /&gt;
So, as the figure 1 shown, in variables declaration part, we changed all class variables to instance variables.&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation code1.png]]&lt;br /&gt;
&lt;br /&gt;
Next, we need to change all other places using these variables.&lt;br /&gt;
&lt;br /&gt;
In action '''send_post_request'''&lt;br /&gt;
&lt;br /&gt;
[[File:Reputaion 2.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Reputaion3.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation4.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation5.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation6.png]]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''Refactor method db_query'''===&lt;br /&gt;
In the Reputation_web_service controller, the action db_query is important, because it implements the query of peer review grade.To refactor the db_query method, we need to firstly focus on the input variables of this method, there are 4 variables need inputs.&lt;br /&gt;
The db_query method is shown as follow:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def db_query(assignment_id, another_assignment_id = 0, round_num, hasTopic)&lt;br /&gt;
      ...&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
There is a problem: Optional arguments should appear at the end of the argument list, in this method, '''''another_assignment_id''''' is a optional arguments, but in the original version, the optional arguments -- '''''another_assignment_id''''' just appear right behind the argument--'''''assignment_id''''', so we need to refactor it.&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation8.png]]&lt;br /&gt;
&lt;br /&gt;
And the same problems occurs when we assigns value to variable '''''@results'''''. We also need to change it.&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation10.png]]&lt;br /&gt;
&lt;br /&gt;
There is another problem in the db_query method, we can see there is a input variable named '''''hasTopic''''', but actually that's not follow the '''&amp;quot;good Ruby and Rails coding practices&amp;quot;''', so we need to refactor it which shown as follow:&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation9.png]]&lt;br /&gt;
&lt;br /&gt;
Finally, The project asked us'' 'Move Line 26-50 before this method''', it's important for code refactor, because it's very inelegant if you put the comments inside the method. If others want to read your codes, it will cost their much more time so that it needs to be changed. Simply, we can just move the whole comments before the method, and that will make the codes easily for reading.&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation11.png]]&lt;/div&gt;</summary>
		<author><name>Hren3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1772_Refactor_reputation_web_service_controller.rb&amp;diff=109340</id>
		<title>CSC/ECE 517 Fall 2017/E1772 Refactor reputation web service controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1772_Refactor_reputation_web_service_controller.rb&amp;diff=109340"/>
		<updated>2017-10-26T03:40:20Z</updated>

		<summary type="html">&lt;p&gt;Hren3: /* Refactor method db_query */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
==='''Introduction to Expertiza'''===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a peer review based system which provides incremental learning from the class. This project has been developed together by faculty and students using [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create, edit and delete assignments, create new assignment topics, assign them to a particular class or selected students, have students work on teams and then review each other's assignments at the end. For the students, they can signup for topics, form teams, and submit their projects and assignments. &lt;br /&gt;
Students then review the work done by other students and give suggestions to improve. Teams after reviews are allotted scores and they can refer to the peer comments to further improve their work. It also supports submission of different file types for assignments, including the URLs and wiki pages.&lt;br /&gt;
==='''Problem Statement'''===&lt;br /&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 the reputation system. Reputation systems have been deployed as web services, peer-review researchers will be able to use them to calculate scores on assignments, both past and present (past data can be used to tune the algorithms). &lt;br /&gt;
&lt;br /&gt;
For this project, our team's job is to refactor the file: reputation_web_service_controller.rb. This file is the controller to calculate the reputation scores. A “reputation” measures how close a reviewer’s scores are to other reviewers scores. This controller is the sub-class of Application_Controller, in this controller, it implements the calculation and query of reputation scores.&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Issues to be fixed'''==&lt;br /&gt;
&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. 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;
#Replace class variable with a class instance var, and change all other places using these variables.&lt;br /&gt;
#Refactor method db_query&lt;br /&gt;
#Use zero? method instead of == 0&lt;br /&gt;
#Use find_by instead of dynamic method&lt;br /&gt;
#Delete lines which is wrong or useless.&lt;br /&gt;
#Comment lines&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Modified Files'''==&lt;br /&gt;
&lt;br /&gt;
reputation_web_service_controller.rb&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
=='''Approach taken to resolve the issues'''==&lt;br /&gt;
==='''Replace class variable with a class instance var, and change all other places using these variables.'''===&lt;br /&gt;
In ruby, class variables are started with '@@' and this class variable are shared in the whole inherit chain, and class variables are shared by all objects of a class. For instance variables, in Ruby, instance variables are started with '@' and instance variables belong to one object, can not be used by sub-classes. &lt;br /&gt;
&lt;br /&gt;
In the project, we are asked to replace the class variable with a class instance variables. &lt;br /&gt;
So, as the figure 1 shown, in variables declaration part, we changed all class variables to instance variables.&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation code1.png]]&lt;br /&gt;
&lt;br /&gt;
Next, we need to change all other places using these variables.&lt;br /&gt;
&lt;br /&gt;
In action '''send_post_request'''&lt;br /&gt;
&lt;br /&gt;
[[File:Reputaion 2.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Reputaion3.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation4.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation5.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation6.png]]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''Refactor method db_query'''===&lt;br /&gt;
In the Reputation_web_service controller, the action db_query is important, because it implements the query of peer review grade.To refactor the db_query method, we need to firstly focus on the input variables of this method, there are 4 variables need inputs.&lt;br /&gt;
The db_query method is shown as follow:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def db_query(assignment_id, another_assignment_id = 0, round_num, hasTopic)&lt;br /&gt;
      ...&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
There is a problem: Optional arguments should appear at the end of the argument list, in this method, ''another_assignment_id'' is a optional arguments, but in the original version, the optional arguments -- ''another_assignment_id'' just appear right behind the argument--''assignment_id'', so we need to refactor it.&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation8.png]]&lt;br /&gt;
&lt;br /&gt;
And the same problems occurs when we assigns value to variable ''@results''. We also need to change it.&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation10.png]]&lt;br /&gt;
&lt;br /&gt;
There is another problem in the db_query method, we can see there is a input variable named ''hasTopic'', but actually that's not follow the &amp;quot;good Ruby and Rails coding practices&amp;quot;, so we need to refactor it which shown as follow:&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation9.png]]&lt;br /&gt;
&lt;br /&gt;
Finally, The project asked us 'Move Line 26-50 before this method', it's important for code refactor, because it's very inelegant if you put the comments inside the method. If others want to read your codes, it will cost their much more time so that it needs to be changed. Simply, we can just move the whole comments before the method, and that will make the codes easily for reading.&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation11.png]]&lt;/div&gt;</summary>
		<author><name>Hren3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Reputation11.png&amp;diff=109339</id>
		<title>File:Reputation11.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Reputation11.png&amp;diff=109339"/>
		<updated>2017-10-26T03:40:02Z</updated>

		<summary type="html">&lt;p&gt;Hren3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Hren3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1772_Refactor_reputation_web_service_controller.rb&amp;diff=109336</id>
		<title>CSC/ECE 517 Fall 2017/E1772 Refactor reputation web service controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1772_Refactor_reputation_web_service_controller.rb&amp;diff=109336"/>
		<updated>2017-10-26T03:25:00Z</updated>

		<summary type="html">&lt;p&gt;Hren3: /* Refactor method db_query */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
==='''Introduction to Expertiza'''===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a peer review based system which provides incremental learning from the class. This project has been developed together by faculty and students using [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create, edit and delete assignments, create new assignment topics, assign them to a particular class or selected students, have students work on teams and then review each other's assignments at the end. For the students, they can signup for topics, form teams, and submit their projects and assignments. &lt;br /&gt;
Students then review the work done by other students and give suggestions to improve. Teams after reviews are allotted scores and they can refer to the peer comments to further improve their work. It also supports submission of different file types for assignments, including the URLs and wiki pages.&lt;br /&gt;
==='''Problem Statement'''===&lt;br /&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 the reputation system. Reputation systems have been deployed as web services, peer-review researchers will be able to use them to calculate scores on assignments, both past and present (past data can be used to tune the algorithms). &lt;br /&gt;
&lt;br /&gt;
For this project, our team's job is to refactor the file: reputation_web_service_controller.rb. This file is the controller to calculate the reputation scores. A “reputation” measures how close a reviewer’s scores are to other reviewers scores. This controller is the sub-class of Application_Controller, in this controller, it implements the calculation and query of reputation scores.&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Issues to be fixed'''==&lt;br /&gt;
&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. 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;
#Replace class variable with a class instance var, and change all other places using these variables.&lt;br /&gt;
#Refactor method db_query&lt;br /&gt;
#Use zero? method instead of == 0&lt;br /&gt;
#Use find_by instead of dynamic method&lt;br /&gt;
#Delete lines which is wrong or useless.&lt;br /&gt;
#Comment lines&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Modified Files'''==&lt;br /&gt;
&lt;br /&gt;
reputation_web_service_controller.rb&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
=='''Approach taken to resolve the issues'''==&lt;br /&gt;
==='''Replace class variable with a class instance var, and change all other places using these variables.'''===&lt;br /&gt;
In ruby, class variables are started with '@@' and this class variable are shared in the whole inherit chain, and class variables are shared by all objects of a class. For instance variables, in Ruby, instance variables are started with '@' and instance variables belong to one object, can not be used by sub-classes. &lt;br /&gt;
&lt;br /&gt;
In the project, we are asked to replace the class variable with a class instance variables. &lt;br /&gt;
So, as the figure 1 shown, in variables declaration part, we changed all class variables to instance variables.&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation code1.png]]&lt;br /&gt;
&lt;br /&gt;
Next, we need to change all other places using these variables.&lt;br /&gt;
&lt;br /&gt;
In action '''send_post_request'''&lt;br /&gt;
&lt;br /&gt;
[[File:Reputaion 2.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Reputaion3.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation4.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation5.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation6.png]]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''Refactor method db_query'''===&lt;br /&gt;
In the Reputation_web_service controller, the action db_query is important, because it implements the query of peer review grade.To refactor the db_query method, we need to firstly focus on the input variables of this method, there are 4 variables need inputs.&lt;br /&gt;
The db_query method is shown as follow:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def db_query(assignment_id, another_assignment_id = 0, round_num, hasTopic)&lt;br /&gt;
      ...&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
There is a problem: Optional arguments should appear at the end of the argument list, in this method, ''another_assignment_id'' is a optional arguments, but in the original version, the optional arguments -- ''another_assignment_id'' just appear right behind the argument--''assignment_id'', so we need to refactor it.&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation8.png]]&lt;br /&gt;
&lt;br /&gt;
And the same problems occurs when we assigns value to variable ''@results''. We also need to change it.&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation10.png]]&lt;br /&gt;
&lt;br /&gt;
There is another problem in the db_query method, we can see there is a input variable named ''hasTopic'', but actually that's not follow the &amp;quot;good Ruby and Rails coding practices&amp;quot;, so we need to refactor it which shown as follow:&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation9.png]]&lt;/div&gt;</summary>
		<author><name>Hren3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Reputation9.png&amp;diff=109335</id>
		<title>File:Reputation9.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Reputation9.png&amp;diff=109335"/>
		<updated>2017-10-26T03:20:58Z</updated>

		<summary type="html">&lt;p&gt;Hren3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Hren3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Reputation10.png&amp;diff=109334</id>
		<title>File:Reputation10.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Reputation10.png&amp;diff=109334"/>
		<updated>2017-10-26T03:20:49Z</updated>

		<summary type="html">&lt;p&gt;Hren3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Hren3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1772_Refactor_reputation_web_service_controller.rb&amp;diff=109333</id>
		<title>CSC/ECE 517 Fall 2017/E1772 Refactor reputation web service controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1772_Refactor_reputation_web_service_controller.rb&amp;diff=109333"/>
		<updated>2017-10-26T03:11:27Z</updated>

		<summary type="html">&lt;p&gt;Hren3: /* Refactor method db_query */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
==='''Introduction to Expertiza'''===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a peer review based system which provides incremental learning from the class. This project has been developed together by faculty and students using [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create, edit and delete assignments, create new assignment topics, assign them to a particular class or selected students, have students work on teams and then review each other's assignments at the end. For the students, they can signup for topics, form teams, and submit their projects and assignments. &lt;br /&gt;
Students then review the work done by other students and give suggestions to improve. Teams after reviews are allotted scores and they can refer to the peer comments to further improve their work. It also supports submission of different file types for assignments, including the URLs and wiki pages.&lt;br /&gt;
==='''Problem Statement'''===&lt;br /&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 the reputation system. Reputation systems have been deployed as web services, peer-review researchers will be able to use them to calculate scores on assignments, both past and present (past data can be used to tune the algorithms). &lt;br /&gt;
&lt;br /&gt;
For this project, our team's job is to refactor the file: reputation_web_service_controller.rb. This file is the controller to calculate the reputation scores. A “reputation” measures how close a reviewer’s scores are to other reviewers scores. This controller is the sub-class of Application_Controller, in this controller, it implements the calculation and query of reputation scores.&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Issues to be fixed'''==&lt;br /&gt;
&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. 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;
#Replace class variable with a class instance var, and change all other places using these variables.&lt;br /&gt;
#Refactor method db_query&lt;br /&gt;
#Use zero? method instead of == 0&lt;br /&gt;
#Use find_by instead of dynamic method&lt;br /&gt;
#Delete lines which is wrong or useless.&lt;br /&gt;
#Comment lines&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Modified Files'''==&lt;br /&gt;
&lt;br /&gt;
reputation_web_service_controller.rb&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
=='''Approach taken to resolve the issues'''==&lt;br /&gt;
==='''Replace class variable with a class instance var, and change all other places using these variables.'''===&lt;br /&gt;
In ruby, class variables are started with '@@' and this class variable are shared in the whole inherit chain, and class variables are shared by all objects of a class. For instance variables, in Ruby, instance variables are started with '@' and instance variables belong to one object, can not be used by sub-classes. &lt;br /&gt;
&lt;br /&gt;
In the project, we are asked to replace the class variable with a class instance variables. &lt;br /&gt;
So, as the figure 1 shown, in variables declaration part, we changed all class variables to instance variables.&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation code1.png]]&lt;br /&gt;
&lt;br /&gt;
Next, we need to change all other places using these variables.&lt;br /&gt;
&lt;br /&gt;
In action '''send_post_request'''&lt;br /&gt;
&lt;br /&gt;
[[File:Reputaion 2.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Reputaion3.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation4.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation5.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation6.png]]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''Refactor method db_query'''===&lt;br /&gt;
In the Reputation_web_service controller, the action db_query is important, because it implements the query of peer review grade.To refactor the db_query method, we need to firstly focus on the input variables of this method, there are 4 variables need inputs.&lt;br /&gt;
The db_query method is shown as follow:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def db_query(assignment_id, another_assignment_id = 0, round_num, hasTopic)&lt;br /&gt;
      ...&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
There is a problem: Optional arguments should appear at the end of the argument list, in this method, ''another_assignment_id'' is a optional arguments, but in the original version, the optional arguments -- ''another_assignment_id'' just appear right behind the argument--''assignment_id'', so we need to refactor it.&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation8.png]]&lt;/div&gt;</summary>
		<author><name>Hren3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Reputation8.png&amp;diff=109332</id>
		<title>File:Reputation8.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Reputation8.png&amp;diff=109332"/>
		<updated>2017-10-26T03:11:14Z</updated>

		<summary type="html">&lt;p&gt;Hren3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Hren3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1772_Refactor_reputation_web_service_controller.rb&amp;diff=109331</id>
		<title>CSC/ECE 517 Fall 2017/E1772 Refactor reputation web service controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1772_Refactor_reputation_web_service_controller.rb&amp;diff=109331"/>
		<updated>2017-10-26T03:09:16Z</updated>

		<summary type="html">&lt;p&gt;Hren3: /* Refactor method db_query */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
==='''Introduction to Expertiza'''===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a peer review based system which provides incremental learning from the class. This project has been developed together by faculty and students using [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create, edit and delete assignments, create new assignment topics, assign them to a particular class or selected students, have students work on teams and then review each other's assignments at the end. For the students, they can signup for topics, form teams, and submit their projects and assignments. &lt;br /&gt;
Students then review the work done by other students and give suggestions to improve. Teams after reviews are allotted scores and they can refer to the peer comments to further improve their work. It also supports submission of different file types for assignments, including the URLs and wiki pages.&lt;br /&gt;
==='''Problem Statement'''===&lt;br /&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 the reputation system. Reputation systems have been deployed as web services, peer-review researchers will be able to use them to calculate scores on assignments, both past and present (past data can be used to tune the algorithms). &lt;br /&gt;
&lt;br /&gt;
For this project, our team's job is to refactor the file: reputation_web_service_controller.rb. This file is the controller to calculate the reputation scores. A “reputation” measures how close a reviewer’s scores are to other reviewers scores. This controller is the sub-class of Application_Controller, in this controller, it implements the calculation and query of reputation scores.&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Issues to be fixed'''==&lt;br /&gt;
&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. 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;
#Replace class variable with a class instance var, and change all other places using these variables.&lt;br /&gt;
#Refactor method db_query&lt;br /&gt;
#Use zero? method instead of == 0&lt;br /&gt;
#Use find_by instead of dynamic method&lt;br /&gt;
#Delete lines which is wrong or useless.&lt;br /&gt;
#Comment lines&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Modified Files'''==&lt;br /&gt;
&lt;br /&gt;
reputation_web_service_controller.rb&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
=='''Approach taken to resolve the issues'''==&lt;br /&gt;
==='''Replace class variable with a class instance var, and change all other places using these variables.'''===&lt;br /&gt;
In ruby, class variables are started with '@@' and this class variable are shared in the whole inherit chain, and class variables are shared by all objects of a class. For instance variables, in Ruby, instance variables are started with '@' and instance variables belong to one object, can not be used by sub-classes. &lt;br /&gt;
&lt;br /&gt;
In the project, we are asked to replace the class variable with a class instance variables. &lt;br /&gt;
So, as the figure 1 shown, in variables declaration part, we changed all class variables to instance variables.&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation code1.png]]&lt;br /&gt;
&lt;br /&gt;
Next, we need to change all other places using these variables.&lt;br /&gt;
&lt;br /&gt;
In action '''send_post_request'''&lt;br /&gt;
&lt;br /&gt;
[[File:Reputaion 2.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Reputaion3.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation4.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation5.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation6.png]]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''Refactor method db_query'''===&lt;br /&gt;
In the Reputation_web_service controller, the action db_query is important, because it implements the query of peer review grade.To refactor the db_query method, we need to firstly focus on the input variables of this method, there are 4 variables need inputs.&lt;br /&gt;
The db_query method is shown as follow:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def db_query(assignment_id, another_assignment_id = 0, round_num, hasTopic)&lt;br /&gt;
      ...&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
There is a problem: Optional arguments should appear at the end of the argument list, in this method, ''another_assignment_id'' is a optional arguments, but in the original version, the optional arguments -- ''another_assignment_id'' just appear right behind the argument--''assignment_id'', so we need to refactor it.&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation7.png]]&lt;/div&gt;</summary>
		<author><name>Hren3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Reputation7.png&amp;diff=109330</id>
		<title>File:Reputation7.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Reputation7.png&amp;diff=109330"/>
		<updated>2017-10-26T03:06:29Z</updated>

		<summary type="html">&lt;p&gt;Hren3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Hren3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1772_Refactor_reputation_web_service_controller.rb&amp;diff=109329</id>
		<title>CSC/ECE 517 Fall 2017/E1772 Refactor reputation web service controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1772_Refactor_reputation_web_service_controller.rb&amp;diff=109329"/>
		<updated>2017-10-26T02:54:12Z</updated>

		<summary type="html">&lt;p&gt;Hren3: /* Refactor method db_query */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
==='''Introduction to Expertiza'''===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a peer review based system which provides incremental learning from the class. This project has been developed together by faculty and students using [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create, edit and delete assignments, create new assignment topics, assign them to a particular class or selected students, have students work on teams and then review each other's assignments at the end. For the students, they can signup for topics, form teams, and submit their projects and assignments. &lt;br /&gt;
Students then review the work done by other students and give suggestions to improve. Teams after reviews are allotted scores and they can refer to the peer comments to further improve their work. It also supports submission of different file types for assignments, including the URLs and wiki pages.&lt;br /&gt;
==='''Problem Statement'''===&lt;br /&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 the reputation system. Reputation systems have been deployed as web services, peer-review researchers will be able to use them to calculate scores on assignments, both past and present (past data can be used to tune the algorithms). &lt;br /&gt;
&lt;br /&gt;
For this project, our team's job is to refactor the file: reputation_web_service_controller.rb. This file is the controller to calculate the reputation scores. A “reputation” measures how close a reviewer’s scores are to other reviewers scores. This controller is the sub-class of Application_Controller, in this controller, it implements the calculation and query of reputation scores.&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Issues to be fixed'''==&lt;br /&gt;
&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. 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;
#Replace class variable with a class instance var, and change all other places using these variables.&lt;br /&gt;
#Refactor method db_query&lt;br /&gt;
#Use zero? method instead of == 0&lt;br /&gt;
#Use find_by instead of dynamic method&lt;br /&gt;
#Delete lines which is wrong or useless.&lt;br /&gt;
#Comment lines&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Modified Files'''==&lt;br /&gt;
&lt;br /&gt;
reputation_web_service_controller.rb&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
=='''Approach taken to resolve the issues'''==&lt;br /&gt;
==='''Replace class variable with a class instance var, and change all other places using these variables.'''===&lt;br /&gt;
In ruby, class variables are started with '@@' and this class variable are shared in the whole inherit chain, and class variables are shared by all objects of a class. For instance variables, in Ruby, instance variables are started with '@' and instance variables belong to one object, can not be used by sub-classes. &lt;br /&gt;
&lt;br /&gt;
In the project, we are asked to replace the class variable with a class instance variables. &lt;br /&gt;
So, as the figure 1 shown, in variables declaration part, we changed all class variables to instance variables.&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation code1.png]]&lt;br /&gt;
&lt;br /&gt;
Next, we need to change all other places using these variables.&lt;br /&gt;
&lt;br /&gt;
In action '''send_post_request'''&lt;br /&gt;
&lt;br /&gt;
[[File:Reputaion 2.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Reputaion3.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation4.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation5.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation6.png]]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
==='''Refactor method db_query'''===&lt;br /&gt;
In the Reputation_web_service controller, the action db_query is important, because it implements the query of peer review grade.To refactor the db_query method, we need to firstly focus on the input variables of this method, there are 4 variables need inputs:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  Respond_To_Ads(user_id, assignment_id)&lt;br /&gt;
  p_id=Fetch participant_id corressponding to (user_id, assignment_id)&lt;br /&gt;
  Check entries for p_id in table join_team_request_table where status is either &amp;quot;A&amp;quot; or &amp;quot;P&amp;quot;&lt;br /&gt;
  count=number of such entries&lt;br /&gt;
  return count&lt;/div&gt;</summary>
		<author><name>Hren3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1772_Refactor_reputation_web_service_controller.rb&amp;diff=109327</id>
		<title>CSC/ECE 517 Fall 2017/E1772 Refactor reputation web service controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1772_Refactor_reputation_web_service_controller.rb&amp;diff=109327"/>
		<updated>2017-10-26T02:30:09Z</updated>

		<summary type="html">&lt;p&gt;Hren3: /* Approach taken to resolve the issues */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
==='''Introduction to Expertiza'''===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a peer review based system which provides incremental learning from the class. This project has been developed together by faculty and students using [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create, edit and delete assignments, create new assignment topics, assign them to a particular class or selected students, have students work on teams and then review each other's assignments at the end. For the students, they can signup for topics, form teams, and submit their projects and assignments. &lt;br /&gt;
Students then review the work done by other students and give suggestions to improve. Teams after reviews are allotted scores and they can refer to the peer comments to further improve their work. It also supports submission of different file types for assignments, including the URLs and wiki pages.&lt;br /&gt;
==='''Problem Statement'''===&lt;br /&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 the reputation system. Reputation systems have been deployed as web services, peer-review researchers will be able to use them to calculate scores on assignments, both past and present (past data can be used to tune the algorithms). &lt;br /&gt;
&lt;br /&gt;
For this project, our team's job is to refactor the file: reputation_web_service_controller.rb. This file is the controller to calculate the reputation scores. A “reputation” measures how close a reviewer’s scores are to other reviewers scores. This controller is the sub-class of Application_Controller, in this controller, it implements the calculation and query of reputation scores.&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Issues to be fixed'''==&lt;br /&gt;
&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. 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;
#Replace class variable with a class instance var, and change all other places using these variables.&lt;br /&gt;
#Refactor method db_query&lt;br /&gt;
#Use zero? method instead of == 0&lt;br /&gt;
#Use find_by instead of dynamic method&lt;br /&gt;
#Delete lines which is wrong or useless.&lt;br /&gt;
#Comment lines&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Modified Files'''==&lt;br /&gt;
&lt;br /&gt;
reputation_web_service_controller.rb&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
=='''Approach taken to resolve the issues'''==&lt;br /&gt;
==='''Replace class variable with a class instance var, and change all other places using these variables.'''===&lt;br /&gt;
In ruby, class variables are started with '@@' and this class variable are shared in the whole inherit chain, and class variables are shared by all objects of a class. For instance variables, in Ruby, instance variables are started with '@' and instance variables belong to one object, can not be used by sub-classes. &lt;br /&gt;
&lt;br /&gt;
In the project, we are asked to replace the class variable with a class instance variables. &lt;br /&gt;
So, as the figure 1 shown, in variables declaration part, we changed all class variables to instance variables.&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation code1.png]]&lt;br /&gt;
&lt;br /&gt;
Next, we need to change all other places using these variables.&lt;br /&gt;
&lt;br /&gt;
In action '''send_post_request'''&lt;br /&gt;
&lt;br /&gt;
[[File:Reputaion 2.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Reputaion3.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation4.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation5.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation6.png]]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
==='''Refactor method db_query'''===&lt;/div&gt;</summary>
		<author><name>Hren3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1772_Refactor_reputation_web_service_controller.rb&amp;diff=109326</id>
		<title>CSC/ECE 517 Fall 2017/E1772 Refactor reputation web service controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1772_Refactor_reputation_web_service_controller.rb&amp;diff=109326"/>
		<updated>2017-10-26T02:29:08Z</updated>

		<summary type="html">&lt;p&gt;Hren3: /* Replace class variable with a class instance var, and change all other places using these variables. */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
==='''Introduction to Expertiza'''===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a peer review based system which provides incremental learning from the class. This project has been developed together by faculty and students using [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create, edit and delete assignments, create new assignment topics, assign them to a particular class or selected students, have students work on teams and then review each other's assignments at the end. For the students, they can signup for topics, form teams, and submit their projects and assignments. &lt;br /&gt;
Students then review the work done by other students and give suggestions to improve. Teams after reviews are allotted scores and they can refer to the peer comments to further improve their work. It also supports submission of different file types for assignments, including the URLs and wiki pages.&lt;br /&gt;
==='''Problem Statement'''===&lt;br /&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 the reputation system. Reputation systems have been deployed as web services, peer-review researchers will be able to use them to calculate scores on assignments, both past and present (past data can be used to tune the algorithms). &lt;br /&gt;
&lt;br /&gt;
For this project, our team's job is to refactor the file: reputation_web_service_controller.rb. This file is the controller to calculate the reputation scores. A “reputation” measures how close a reviewer’s scores are to other reviewers scores. This controller is the sub-class of Application_Controller, in this controller, it implements the calculation and query of reputation scores.&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Issues to be fixed'''==&lt;br /&gt;
&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. 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;
#Replace class variable with a class instance var, and change all other places using these variables.&lt;br /&gt;
#Refactor method db_query&lt;br /&gt;
#Use zero? method instead of == 0&lt;br /&gt;
#Use find_by instead of dynamic method&lt;br /&gt;
#Delete lines which is wrong or useless.&lt;br /&gt;
#Comment lines&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Modified Files'''==&lt;br /&gt;
&lt;br /&gt;
reputation_web_service_controller.rb&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
=='''Approach taken to resolve the issues'''==&lt;br /&gt;
==='''Replace class variable with a class instance var, and change all other places using these variables.'''===&lt;br /&gt;
In ruby, class variables are started with '@@' and this class variable are shared in the whole inherit chain, and class variables are shared by all objects of a class. For instance variables, in Ruby, instance variables are started with '@' and instance variables belong to one object, can not be used by sub-classes. &lt;br /&gt;
&lt;br /&gt;
In the project, we are asked to replace the class variable with a class instance variables. &lt;br /&gt;
So, as the figure 1 shown, in variables declaration part, we changed all class variables to instance variables.&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation code1.png]]&lt;br /&gt;
&lt;br /&gt;
Next, we need to change all other places using these variables.&lt;br /&gt;
&lt;br /&gt;
In action '''send_post_request'''&lt;br /&gt;
&lt;br /&gt;
[[File:Reputaion 2.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Reputaion3.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation4.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation5.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Reputation6.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;/div&gt;</summary>
		<author><name>Hren3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Reputation6.png&amp;diff=109323</id>
		<title>File:Reputation6.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Reputation6.png&amp;diff=109323"/>
		<updated>2017-10-26T02:23:24Z</updated>

		<summary type="html">&lt;p&gt;Hren3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Hren3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Reputation5.png&amp;diff=109322</id>
		<title>File:Reputation5.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Reputation5.png&amp;diff=109322"/>
		<updated>2017-10-26T02:21:08Z</updated>

		<summary type="html">&lt;p&gt;Hren3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Hren3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Reputation4.png&amp;diff=109320</id>
		<title>File:Reputation4.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Reputation4.png&amp;diff=109320"/>
		<updated>2017-10-26T02:14:58Z</updated>

		<summary type="html">&lt;p&gt;Hren3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Hren3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Reputaion3.png&amp;diff=109319</id>
		<title>File:Reputaion3.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Reputaion3.png&amp;diff=109319"/>
		<updated>2017-10-26T02:12:57Z</updated>

		<summary type="html">&lt;p&gt;Hren3: uploaded a new version of &amp;amp;quot;File:Reputaion3.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Hren3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Reputaion3.png&amp;diff=109318</id>
		<title>File:Reputaion3.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Reputaion3.png&amp;diff=109318"/>
		<updated>2017-10-26T02:11:59Z</updated>

		<summary type="html">&lt;p&gt;Hren3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Hren3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Reputaion_2.png&amp;diff=109316</id>
		<title>File:Reputaion 2.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Reputaion_2.png&amp;diff=109316"/>
		<updated>2017-10-26T02:05:07Z</updated>

		<summary type="html">&lt;p&gt;Hren3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Hren3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1772_Refactor_reputation_web_service_controller.rb&amp;diff=109306</id>
		<title>CSC/ECE 517 Fall 2017/E1772 Refactor reputation web service controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1772_Refactor_reputation_web_service_controller.rb&amp;diff=109306"/>
		<updated>2017-10-26T01:40:43Z</updated>

		<summary type="html">&lt;p&gt;Hren3: /* Replace class variable with a class instance var, and change all other places using these variables. */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
==='''Introduction to Expertiza'''===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a peer review based system which provides incremental learning from the class. This project has been developed together by faculty and students using [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create, edit and delete assignments, create new assignment topics, assign them to a particular class or selected students, have students work on teams and then review each other's assignments at the end. For the students, they can signup for topics, form teams, and submit their projects and assignments. &lt;br /&gt;
Students then review the work done by other students and give suggestions to improve. Teams after reviews are allotted scores and they can refer to the peer comments to further improve their work. It also supports submission of different file types for assignments, including the URLs and wiki pages.&lt;br /&gt;
==='''Problem Statement'''===&lt;br /&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 the reputation system. Reputation systems have been deployed as web services, peer-review researchers will be able to use them to calculate scores on assignments, both past and present (past data can be used to tune the algorithms). &lt;br /&gt;
&lt;br /&gt;
For this project, our team's job is to refactor the file: reputation_web_service_controller.rb. This file is the controller to calculate the reputation scores. A “reputation” measures how close a reviewer’s scores are to other reviewers scores. This controller is the sub-class of Application_Controller, in this controller, it implements the calculation and query of reputation scores.&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Issues to be fixed'''==&lt;br /&gt;
&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. 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;
#Replace class variable with a class instance var, and change all other places using these variables.&lt;br /&gt;
#Refactor method db_query&lt;br /&gt;
#Use zero? method instead of == 0&lt;br /&gt;
#Use find_by instead of dynamic method&lt;br /&gt;
#Delete lines which is wrong or useless.&lt;br /&gt;
#Comment lines&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Modified Files'''==&lt;br /&gt;
&lt;br /&gt;
reputation_web_service_controller.rb&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
=='''Approach taken to resolve the issues'''==&lt;br /&gt;
==='''Replace class variable with a class instance var, and change all other places using these variables.'''===&lt;br /&gt;
[[File:Reputation code1.png]]&lt;br /&gt;
&lt;br /&gt;
----&lt;/div&gt;</summary>
		<author><name>Hren3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Reputation_code1.png&amp;diff=109305</id>
		<title>File:Reputation code1.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Reputation_code1.png&amp;diff=109305"/>
		<updated>2017-10-26T01:39:46Z</updated>

		<summary type="html">&lt;p&gt;Hren3: asdadadsasdasd&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;asdadadsasdasd&lt;/div&gt;</summary>
		<author><name>Hren3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:1.png&amp;diff=109302</id>
		<title>File:1.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:1.png&amp;diff=109302"/>
		<updated>2017-10-26T01:25:46Z</updated>

		<summary type="html">&lt;p&gt;Hren3: uploaded a new version of &amp;amp;quot;File:1.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Distributed Version Control System&lt;/div&gt;</summary>
		<author><name>Hren3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1772_Refactor_reputation_web_service_controller.rb&amp;diff=109301</id>
		<title>CSC/ECE 517 Fall 2017/E1772 Refactor reputation web service controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1772_Refactor_reputation_web_service_controller.rb&amp;diff=109301"/>
		<updated>2017-10-26T01:19:25Z</updated>

		<summary type="html">&lt;p&gt;Hren3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
==='''Introduction to Expertiza'''===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a peer review based system which provides incremental learning from the class. This project has been developed together by faculty and students using [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create, edit and delete assignments, create new assignment topics, assign them to a particular class or selected students, have students work on teams and then review each other's assignments at the end. For the students, they can signup for topics, form teams, and submit their projects and assignments. &lt;br /&gt;
Students then review the work done by other students and give suggestions to improve. Teams after reviews are allotted scores and they can refer to the peer comments to further improve their work. It also supports submission of different file types for assignments, including the URLs and wiki pages.&lt;br /&gt;
==='''Problem Statement'''===&lt;br /&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 the reputation system. Reputation systems have been deployed as web services, peer-review researchers will be able to use them to calculate scores on assignments, both past and present (past data can be used to tune the algorithms). &lt;br /&gt;
&lt;br /&gt;
For this project, our team's job is to refactor the file: reputation_web_service_controller.rb. This file is the controller to calculate the reputation scores. A “reputation” measures how close a reviewer’s scores are to other reviewers scores. This controller is the sub-class of Application_Controller, in this controller, it implements the calculation and query of reputation scores.&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Issues to be fixed'''==&lt;br /&gt;
&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. 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;
#Replace class variable with a class instance var, and change all other places using these variables.&lt;br /&gt;
#Refactor method db_query&lt;br /&gt;
#Use zero? method instead of == 0&lt;br /&gt;
#Use find_by instead of dynamic method&lt;br /&gt;
#Delete lines which is wrong or useless.&lt;br /&gt;
#Comment lines&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Modified Files'''==&lt;br /&gt;
&lt;br /&gt;
reputation_web_service_controller.rb&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
=='''Approach taken to resolve the issues'''==&lt;br /&gt;
==='''Replace class variable with a class instance var, and change all other places using these variables.'''===&lt;br /&gt;
[[File:1.png]]&lt;br /&gt;
&lt;br /&gt;
----&lt;/div&gt;</summary>
		<author><name>Hren3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1772_Refactor_reputation_web_service_controller.rb&amp;diff=109296</id>
		<title>CSC/ECE 517 Fall 2017/E1772 Refactor reputation web service controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1772_Refactor_reputation_web_service_controller.rb&amp;diff=109296"/>
		<updated>2017-10-26T01:03:35Z</updated>

		<summary type="html">&lt;p&gt;Hren3: /* Modified Files */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
==='''Introduction to Expertiza'''===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a peer review based system which provides incremental learning from the class. This project has been developed together by faculty and students using [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create, edit and delete assignments, create new assignment topics, assign them to a particular class or selected students, have students work on teams and then review each other's assignments at the end. For the students, they can signup for topics, form teams, and submit their projects and assignments. &lt;br /&gt;
Students then review the work done by other students and give suggestions to improve. Teams after reviews are allotted scores and they can refer to the peer comments to further improve their work. It also supports submission of different file types for assignments, including the URLs and wiki pages.&lt;br /&gt;
==='''Problem Statement'''===&lt;br /&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 the reputation system. Reputation systems have been deployed as web services, peer-review researchers will be able to use them to calculate scores on assignments, both past and present (past data can be used to tune the algorithms). &lt;br /&gt;
&lt;br /&gt;
For this project, our team's job is to refactor the file: reputation_web_service_controller.rb. This file is the controller to calculate the reputation scores. A “reputation” measures how close a reviewer’s scores are to other reviewers scores. This controller is the sub-class of Application_Controller, in this controller, it implements the calculation and query of reputation scores.&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Issues to be fixed'''==&lt;br /&gt;
&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. 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;
#Replace class variable with a class instance var, and change all other places using these variables.&lt;br /&gt;
#Refactor method db_query&lt;br /&gt;
#Use zero? method instead of == 0&lt;br /&gt;
#Use find_by instead of dynamic method&lt;br /&gt;
#Delete lines which is wrong or useless.&lt;br /&gt;
#Comment lines&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Modified Files'''==&lt;br /&gt;
&lt;br /&gt;
  reputation_web_service_controller.rb&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;/div&gt;</summary>
		<author><name>Hren3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1772_Refactor_reputation_web_service_controller.rb&amp;diff=109293</id>
		<title>CSC/ECE 517 Fall 2017/E1772 Refactor reputation web service controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1772_Refactor_reputation_web_service_controller.rb&amp;diff=109293"/>
		<updated>2017-10-26T01:00:33Z</updated>

		<summary type="html">&lt;p&gt;Hren3: /* Modified Files */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
==='''Introduction to Expertiza'''===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a peer review based system which provides incremental learning from the class. This project has been developed together by faculty and students using [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create, edit and delete assignments, create new assignment topics, assign them to a particular class or selected students, have students work on teams and then review each other's assignments at the end. For the students, they can signup for topics, form teams, and submit their projects and assignments. &lt;br /&gt;
Students then review the work done by other students and give suggestions to improve. Teams after reviews are allotted scores and they can refer to the peer comments to further improve their work. It also supports submission of different file types for assignments, including the URLs and wiki pages.&lt;br /&gt;
==='''Problem Statement'''===&lt;br /&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 the reputation system. Reputation systems have been deployed as web services, peer-review researchers will be able to use them to calculate scores on assignments, both past and present (past data can be used to tune the algorithms). &lt;br /&gt;
&lt;br /&gt;
For this project, our team's job is to refactor the file: reputation_web_service_controller.rb. This file is the controller to calculate the reputation scores. A “reputation” measures how close a reviewer’s scores are to other reviewers scores. This controller is the sub-class of Application_Controller, in this controller, it implements the calculation and query of reputation scores.&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Issues to be fixed'''==&lt;br /&gt;
&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. 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;
#Replace class variable with a class instance var, and change all other places using these variables.&lt;br /&gt;
#Refactor method db_query&lt;br /&gt;
#Use zero? method instead of == 0&lt;br /&gt;
#Use find_by instead of dynamic method&lt;br /&gt;
#Delete lines which is wrong or useless.&lt;br /&gt;
#Comment lines&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Modified Files'''==&lt;br /&gt;
&lt;br /&gt;
1) reputation_web_service_controller.rb&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;/div&gt;</summary>
		<author><name>Hren3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1772_Refactor_reputation_web_service_controller.rb&amp;diff=109292</id>
		<title>CSC/ECE 517 Fall 2017/E1772 Refactor reputation web service controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1772_Refactor_reputation_web_service_controller.rb&amp;diff=109292"/>
		<updated>2017-10-26T00:59:40Z</updated>

		<summary type="html">&lt;p&gt;Hren3: /* Issues to be fixed */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
==='''Introduction to Expertiza'''===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a peer review based system which provides incremental learning from the class. This project has been developed together by faculty and students using [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create, edit and delete assignments, create new assignment topics, assign them to a particular class or selected students, have students work on teams and then review each other's assignments at the end. For the students, they can signup for topics, form teams, and submit their projects and assignments. &lt;br /&gt;
Students then review the work done by other students and give suggestions to improve. Teams after reviews are allotted scores and they can refer to the peer comments to further improve their work. It also supports submission of different file types for assignments, including the URLs and wiki pages.&lt;br /&gt;
==='''Problem Statement'''===&lt;br /&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 the reputation system. Reputation systems have been deployed as web services, peer-review researchers will be able to use them to calculate scores on assignments, both past and present (past data can be used to tune the algorithms). &lt;br /&gt;
&lt;br /&gt;
For this project, our team's job is to refactor the file: reputation_web_service_controller.rb. This file is the controller to calculate the reputation scores. A “reputation” measures how close a reviewer’s scores are to other reviewers scores. This controller is the sub-class of Application_Controller, in this controller, it implements the calculation and query of reputation scores.&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Issues to be fixed'''==&lt;br /&gt;
&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. 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;
#Replace class variable with a class instance var, and change all other places using these variables.&lt;br /&gt;
#Refactor method db_query&lt;br /&gt;
#Use zero? method instead of == 0&lt;br /&gt;
#Use find_by instead of dynamic method&lt;br /&gt;
#Delete lines which is wrong or useless.&lt;br /&gt;
#Comment lines&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Modified Files'''==&lt;br /&gt;
&lt;br /&gt;
1) sign_up_sheet.rb&lt;br /&gt;
&lt;br /&gt;
2) student_teams_helper.rb&lt;br /&gt;
&lt;br /&gt;
3) _table_line.html.erb&lt;br /&gt;
&lt;br /&gt;
4) view.html.erb&lt;br /&gt;
&lt;br /&gt;
----&lt;/div&gt;</summary>
		<author><name>Hren3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1772_Refactor_reputation_web_service_controller.rb&amp;diff=109290</id>
		<title>CSC/ECE 517 Fall 2017/E1772 Refactor reputation web service controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1772_Refactor_reputation_web_service_controller.rb&amp;diff=109290"/>
		<updated>2017-10-26T00:27:58Z</updated>

		<summary type="html">&lt;p&gt;Hren3: /* Problem Statement */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
==='''Introduction to Expertiza'''===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a peer review based system which provides incremental learning from the class. This project has been developed together by faculty and students using [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create, edit and delete assignments, create new assignment topics, assign them to a particular class or selected students, have students work on teams and then review each other's assignments at the end. For the students, they can signup for topics, form teams, and submit their projects and assignments. &lt;br /&gt;
Students then review the work done by other students and give suggestions to improve. Teams after reviews are allotted scores and they can refer to the peer comments to further improve their work. It also supports submission of different file types for assignments, including the URLs and wiki pages.&lt;br /&gt;
==='''Problem Statement'''===&lt;br /&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 the reputation system. Reputation systems have been deployed as web services, peer-review researchers will be able to use them to calculate scores on assignments, both past and present (past data can be used to tune the algorithms). &lt;br /&gt;
&lt;br /&gt;
For this project, our team's job is to refactor the file: reputation_web_service_controller.rb. This file is the controller to calculate the reputation scores. A “reputation” measures how close a reviewer’s scores are to other reviewers scores. This controller is the sub-class of Application_Controller, in this controller, it implements the calculation and query of reputation scores.&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Issues to be fixed'''==&lt;br /&gt;
&lt;br /&gt;
Fix Issue #311: when one respond to an advertisement, (s)he should only be able to respond once. When a team advertises for new members, someone who responds to an ad should only be allowed to respond once. Currently, after someone responds to an ad, they can respond again an unlimited number of times.&lt;br /&gt;
&lt;br /&gt;
Fix Issue #227 : if user A got a topic and user B got no topic, then A join B’s team, A’s topic be  dropped and A and B end up with a new team with no topic. This issue should be handle carefully because we cannot simply add B to A’s team (imagine, if A has teammate X and B has teammate Y...). One of a potential fix is that, for assignment w/ topics, one cannot not post an ad unless (s)he holds a topic, similarly, one cannot sent invitations unless (s)he holds a topic. &lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Modified Files'''==&lt;br /&gt;
&lt;br /&gt;
1) sign_up_sheet.rb&lt;br /&gt;
&lt;br /&gt;
2) student_teams_helper.rb&lt;br /&gt;
&lt;br /&gt;
3) _table_line.html.erb&lt;br /&gt;
&lt;br /&gt;
4) view.html.erb&lt;br /&gt;
&lt;br /&gt;
----&lt;/div&gt;</summary>
		<author><name>Hren3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1772_Refactor_reputation_web_service_controller.rb&amp;diff=109289</id>
		<title>CSC/ECE 517 Fall 2017/E1772 Refactor reputation web service controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1772_Refactor_reputation_web_service_controller.rb&amp;diff=109289"/>
		<updated>2017-10-25T23:55:51Z</updated>

		<summary type="html">&lt;p&gt;Hren3: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
==='''Introduction to Expertiza'''===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a peer review based system which provides incremental learning from the class. This project has been developed together by faculty and students using [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create, edit and delete assignments, create new assignment topics, assign them to a particular class or selected students, have students work on teams and then review each other's assignments at the end. For the students, they can signup for topics, form teams, and submit their projects and assignments. &lt;br /&gt;
Students then review the work done by other students and give suggestions to improve. Teams after reviews are allotted scores and they can refer to the peer comments to further improve their work. It also supports submission of different file types for assignments, including the URLs and wiki pages.&lt;br /&gt;
==='''Problem Statement'''===&lt;br /&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. &lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Issues to be fixed'''==&lt;br /&gt;
&lt;br /&gt;
Fix Issue #311: when one respond to an advertisement, (s)he should only be able to respond once. When a team advertises for new members, someone who responds to an ad should only be allowed to respond once. Currently, after someone responds to an ad, they can respond again an unlimited number of times.&lt;br /&gt;
&lt;br /&gt;
Fix Issue #227 : if user A got a topic and user B got no topic, then A join B’s team, A’s topic be  dropped and A and B end up with a new team with no topic. This issue should be handle carefully because we cannot simply add B to A’s team (imagine, if A has teammate X and B has teammate Y...). One of a potential fix is that, for assignment w/ topics, one cannot not post an ad unless (s)he holds a topic, similarly, one cannot sent invitations unless (s)he holds a topic. &lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Modified Files'''==&lt;br /&gt;
&lt;br /&gt;
1) sign_up_sheet.rb&lt;br /&gt;
&lt;br /&gt;
2) student_teams_helper.rb&lt;br /&gt;
&lt;br /&gt;
3) _table_line.html.erb&lt;br /&gt;
&lt;br /&gt;
4) view.html.erb&lt;br /&gt;
&lt;br /&gt;
----&lt;/div&gt;</summary>
		<author><name>Hren3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1772_Refactor_reputation_web_service_controller.rb&amp;diff=109288</id>
		<title>CSC/ECE 517 Fall 2017/E1772 Refactor reputation web service controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1772_Refactor_reputation_web_service_controller.rb&amp;diff=109288"/>
		<updated>2017-10-25T23:54:25Z</updated>

		<summary type="html">&lt;p&gt;Hren3: /* Problem Statement */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
==='''Problem Statement'''===&lt;br /&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. &lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Issues to be fixed'''==&lt;br /&gt;
&lt;br /&gt;
Fix Issue #311: when one respond to an advertisement, (s)he should only be able to respond once. When a team advertises for new members, someone who responds to an ad should only be allowed to respond once. Currently, after someone responds to an ad, they can respond again an unlimited number of times.&lt;br /&gt;
&lt;br /&gt;
Fix Issue #227 : if user A got a topic and user B got no topic, then A join B’s team, A’s topic be  dropped and A and B end up with a new team with no topic. This issue should be handle carefully because we cannot simply add B to A’s team (imagine, if A has teammate X and B has teammate Y...). One of a potential fix is that, for assignment w/ topics, one cannot not post an ad unless (s)he holds a topic, similarly, one cannot sent invitations unless (s)he holds a topic. &lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Modified Files'''==&lt;br /&gt;
&lt;br /&gt;
1) sign_up_sheet.rb&lt;br /&gt;
&lt;br /&gt;
2) student_teams_helper.rb&lt;br /&gt;
&lt;br /&gt;
3) _table_line.html.erb&lt;br /&gt;
&lt;br /&gt;
4) view.html.erb&lt;br /&gt;
&lt;br /&gt;
----&lt;/div&gt;</summary>
		<author><name>Hren3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1772_Refactor_reputation_web_service_controller.rb&amp;diff=109283</id>
		<title>CSC/ECE 517 Fall 2017/E1772 Refactor reputation web service controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1772_Refactor_reputation_web_service_controller.rb&amp;diff=109283"/>
		<updated>2017-10-25T23:46:59Z</updated>

		<summary type="html">&lt;p&gt;Hren3: Created page with &amp;quot;==Introduction== ==='''Problem Statement'''=== In Expertiza, there are teammate advertisement, invitation and join team request features which facilitate students to form teams. ...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
==='''Problem Statement'''===&lt;br /&gt;
In Expertiza, there are teammate advertisement, invitation and join team request features which facilitate students to form teams. Teammate advertisement works only for assignments with topics. The topic holders can create advertisement and a trumpet icon will show on the signup sheet page. If one respond to the advertisement, a join team request will be created and the topic holder can see it on “Your team” page. After a student gets a team and the team is not full, (s)he should also be able to send invitations to others.&lt;br /&gt;
----&lt;br /&gt;
=='''Issues to be fixed'''==&lt;br /&gt;
&lt;br /&gt;
Fix Issue #311: when one respond to an advertisement, (s)he should only be able to respond once. When a team advertises for new members, someone who responds to an ad should only be allowed to respond once. Currently, after someone responds to an ad, they can respond again an unlimited number of times.&lt;br /&gt;
&lt;br /&gt;
Fix Issue #227 : if user A got a topic and user B got no topic, then A join B’s team, A’s topic be  dropped and A and B end up with a new team with no topic. This issue should be handle carefully because we cannot simply add B to A’s team (imagine, if A has teammate X and B has teammate Y...). One of a potential fix is that, for assignment w/ topics, one cannot not post an ad unless (s)he holds a topic, similarly, one cannot sent invitations unless (s)he holds a topic. &lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Modified Files'''==&lt;br /&gt;
&lt;br /&gt;
1) sign_up_sheet.rb&lt;br /&gt;
&lt;br /&gt;
2) student_teams_helper.rb&lt;br /&gt;
&lt;br /&gt;
3) _table_line.html.erb&lt;br /&gt;
&lt;br /&gt;
4) view.html.erb&lt;br /&gt;
&lt;br /&gt;
----&lt;/div&gt;</summary>
		<author><name>Hren3</name></author>
	</entry>
</feed>