<?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=Sgulati2</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=Sgulati2"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Sgulati2"/>
	<updated>2026-07-10T23:22:51Z</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_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100615</id>
		<title>CSC/ECE 517 Fall 2015 E1586 AnonymousChatBetweenAuthorAndReviewer</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100615"/>
		<updated>2015-12-17T03:47:52Z</updated>

		<summary type="html">&lt;p&gt;Sgulati2: /* Model Testing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1586 AnonymousChatBetweenAuthorAndReviewer'''&lt;br /&gt;
&lt;br /&gt;
This page provides a brief description of the '''Expertiza''' project. The project is aimed at developing an email based anonymous session between author and a reviewer so that reviewers can ask questions to the authors for any doubts related to the assignments during peer reviewing.&lt;br /&gt;
&lt;br /&gt;
==Project==&lt;br /&gt;
&lt;br /&gt;
=== Introduction to Expertiza ===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a peer review based system which provides an incremental class based learning together with the instructors and the peers. This project has been developed together by faculty and students using [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza handles assignment submissions, team formations, assignment reviews and grades, etc.&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
During reviews, many times reviewers will be having questions about the submitted material and if it's a blocker there is no way that the reviewer can progress further with the review.  As a result, reviewers will end up submitting the empty or incomplete review.&lt;br /&gt;
&lt;br /&gt;
=== Scope ===&lt;br /&gt;
This project is limited to an email based conversation for asking questions and answers. The reviewers would ask questions related to assignment submission doubts to which authors can respond. All this would be taken care as email responses using a link provided in the email. This project does not cater to any live interactive session with spontaneous back-to-back questions and responses.&lt;br /&gt;
&lt;br /&gt;
Following tasks would be incorporated in the project:&lt;br /&gt;
* Provide a ‘TextArea’ input field on review forms, where any reviewer can type in their questions.&lt;br /&gt;
* Create a new button ‘Ask for Quick Help’ on the review forms.&lt;br /&gt;
* An email would be send to the author with the link where he can respond to the questions asked by the reviewers for their submitted work.&lt;br /&gt;
* Reviewers would be notified by an email when authors respond to the the questions.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Discussion of Resolution ===&lt;br /&gt;
Following modifications were made to implement the chat feature:- &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Create a new model which will help to extract, store and validate data in the database table which contains information about the interaction between the author/s and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Edit the view which is used by the response controller to incorporate the text area input field on the review form where the reviewer can ask his/her initial query.&lt;br /&gt;
&lt;br /&gt;
*Create a new controller with methods for authentication for a respective chat log only visible to the author and reviewer of a particular assignment, method to submit a response or a follow up query and show the existing interaction log.&lt;br /&gt;
&lt;br /&gt;
*Create a new helper with the e-mail methods for sending to the author and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Create a new view which will facilitate the author to respond to the queries asked by the reviewer. The reviewer can also use this view to ask any follow up questions.&lt;br /&gt;
&lt;br /&gt;
=== Design Patterns ===&lt;br /&gt;
The following design patterns were used for the solution:&lt;br /&gt;
 &lt;br /&gt;
* '''Observer Pattern'''&amp;lt;ref&amp;gt;Observer Design Pattern https://en.wikipedia.org/wiki/Observer_pattern&amp;lt;/ref&amp;gt;: The observer pattern is a software design pattern in which an object, called the subject, maintains a list of its dependents, called observers, and notifies them automatically of any state changes, usually by calling one of their methods. For example, we are notifying the team members whenever the reviewer submits the query.&lt;br /&gt;
&lt;br /&gt;
* '''Iterator Pattern''': In our instance, we need to display the entire chat history of a particular interaction, hence we can use the iterator design pattern to iterate through the previous chat messages.&lt;br /&gt;
&lt;br /&gt;
=== Database Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:Review_chats.png]]&lt;br /&gt;
&lt;br /&gt;
The above figure shows the schema of a new table which will be created in Expertiza to store relevant information about the chat. It contains the following attributes:&lt;br /&gt;
* id: This attribute is auto-generated by rails when we create a table and is auto incremented with each record. It is also the primary key of our table.&lt;br /&gt;
* assignment_id: Stores the ID of the assignment for which the interaction between author and reviewer is taking place.&lt;br /&gt;
* reviewer_id: Stores the ID of the reviewer who asks the questions.&lt;br /&gt;
* team_id: Stores the ID of the team to which the topic belongs.&lt;br /&gt;
* type_flag: Flag which is used to indicate if the particular tuple contains a question or answer. It can take two values, 'Q' for question and 'A' for answer.&lt;br /&gt;
* content: Stores the question asked by the reviewer or the response given by the author/s depending on the value of the type flag.&lt;br /&gt;
&lt;br /&gt;
Records for a particular interaction can be identified by using a combination of assignment_id, reviewer_id and team_id.&lt;br /&gt;
&lt;br /&gt;
=== Use Cases ===&lt;br /&gt;
'''Name:''' Send a question to the author/s about their work.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Reviewer. &amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The reviewer enters his question in the text area which is provided and clicks on the &amp;quot;Ask question&amp;quot; button which is provided as shown in the mock up. On clicking this button an email is sent to the author/s along which a link to answer the question.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''Name:''' Answer the question which has been asked by the reviewer.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Author/s&amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The author/s click on the link received in their email and are redirected to a page where they can answer the question. Once they submit the answer, an email is sent to the reviewer notifying him/her that their question has been answered.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:ARSNUsecase.jpeg]]&lt;br /&gt;
&lt;br /&gt;
=== Proposed Tests ===&lt;br /&gt;
1. For use case 1, test whether all the team members receive email with the question.&amp;lt;br/&amp;gt;&lt;br /&gt;
2. For use case 2, test whether the reviewer receive email with the response.&amp;lt;br/&amp;gt;&lt;br /&gt;
3. Test whether all the previous interactions are displayed as chat history.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
===Code Implementation===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*Create a new model '''review_chat.rb''' for ReviewChat.&lt;br /&gt;
&lt;br /&gt;
'''Validation'''- Check if the query box is not empty and restrict the query length to 255 characters.&lt;br /&gt;
&lt;br /&gt;
  validates_length_of :content , :maximum =&amp;gt; 255,message: &amp;quot;Length must be less that 255 characters&amp;quot;&lt;br /&gt;
  validates_presence_of :content, message: &amp;quot;Content cannot be blank&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*Create a new controller '''review_chats_controller.rb''' with the following methods:&lt;br /&gt;
&lt;br /&gt;
'''action_allowed?'''- Allow chat visibility to the reviewers and the authors of a particular interaction&lt;br /&gt;
&lt;br /&gt;
  def action_allowed?&lt;br /&gt;
    review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    allowed_users=Array.new&lt;br /&gt;
    response_map = ReviewChat.get_response_map(review_chat)&lt;br /&gt;
    team_id = response_map.reviewee_id&lt;br /&gt;
    teams_users = TeamsUser.where(team_id: team_id)&lt;br /&gt;
    teams_users.each do |teams_user|&lt;br /&gt;
      allowed_users &amp;lt;&amp;lt; User.find(teams_user.user_id).id&lt;br /&gt;
    end&lt;br /&gt;
    allowed_users &amp;lt;&amp;lt; Participant.find(response_map.reviewer_id).user_id&lt;br /&gt;
    current_role_name.eql? 'Student' and allowed_users.include?(session[:user].id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''show'''- Show the chat interaction log&lt;br /&gt;
&lt;br /&gt;
  def show&lt;br /&gt;
    @review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    @map_id=@review_chat.response_map_id&lt;br /&gt;
    @chat_log=ReviewChat.get_chat_log(@map_id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''submitted_response'''- Create a chat record and send an email to the reviewer when an author replied to a query asked by the reviewer&lt;br /&gt;
&lt;br /&gt;
  def submitted_response&lt;br /&gt;
    @review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    response_map = ReviewResponseMap.find(@review_chat.response_map_id)&lt;br /&gt;
    @chat_reviewer=Participant.find(response_map.reviewer_id).user_id&lt;br /&gt;
    if(@chat_reviewer==session[:user].id) then&lt;br /&gt;
    	ReviewChat.create(:response_map_id =&amp;gt; @review_chat.response_map_id, :type_flag =&amp;gt; 'Q' , :content =&amp;gt; params[:response_area])&lt;br /&gt;
    	ReviewChatsHelper::chat_email_query(params[:id])&lt;br /&gt;
    	flash[:notice]=&amp;quot;Query has been submitted&amp;quot;	&lt;br /&gt;
    else	&lt;br /&gt;
      	ReviewChat.create(:response_map_id =&amp;gt; @review_chat.response_map_id, :type_flag =&amp;gt; 'A' , :content =&amp;gt; params[:response_area])&lt;br /&gt;
      	ReviewChatsHelper::chat_email_response(@review_chat.id,@chat_reviewer)&lt;br /&gt;
      flash[:notice]=&amp;quot;Response has been submitted&amp;quot;&lt;br /&gt;
    end	&lt;br /&gt;
    redirect_to action: 'show', id: params[:id]&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
*Create a helper file '''review_chats_helper.rb''' with the following methods:&lt;br /&gt;
&lt;br /&gt;
'''chat_email_response'''- Send an email to the author of an assignment when a reviewer posts a query&lt;br /&gt;
&lt;br /&gt;
  def self.chat_email_response(id,reviewer_id,partial=&amp;quot;new_chatemail&amp;quot;)&lt;br /&gt;
    defn = Hash.new&lt;br /&gt;
    defn[:body] = Hash.new&lt;br /&gt;
    defn[:body][:partial_name] = partial&lt;br /&gt;
    reviewer_email=User.find(reviewer_id).email&lt;br /&gt;
    defn[:subject] = &amp;quot;Response posted for submission&amp;quot;&lt;br /&gt;
    defn[:body][:type] = &amp;quot; response has been posted for your query .&lt;br /&gt;
    Please open the below URL to view.&lt;br /&gt;
    http://expertiza.ncsu.edu/review_chats/show/#{id}&amp;quot;&lt;br /&gt;
    defn[:to] = reviewer_email&lt;br /&gt;
    Mailer.sync_message(defn).deliver&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''chat_email_query'''- Send an email to the author of an assignment when a reviewer posts a query&lt;br /&gt;
&lt;br /&gt;
  def self.chat_email_query(id,partial=&amp;quot;new_chatemail&amp;quot;)&lt;br /&gt;
    defn = Hash.new&lt;br /&gt;
    defn[:body] = Hash.new&lt;br /&gt;
    defn[:body][:partial_name] = partial&lt;br /&gt;
    @review_chat=ReviewChat.find(id)&lt;br /&gt;
    response_map = ReviewChat.get_response_map(@review_chat)&lt;br /&gt;
    @team_id = response_map.reviewee_id&lt;br /&gt;
    teams_users = TeamsUser.where(team_id: @team_id)&lt;br /&gt;
    to_mail_list = Array.new&lt;br /&gt;
    teams_users.each do |teams_user|&lt;br /&gt;
    to_mail_list &amp;lt;&amp;lt; User.find(teams_user.user_id).email &lt;br /&gt;
    end&lt;br /&gt;
    defn[:subject] = &amp;quot;Query posted for submission&amp;quot;&lt;br /&gt;
    defn[:body][:type] = &amp;quot; query has been posted for your submission .&lt;br /&gt;
    Please open the below URL to view and respond.&lt;br /&gt;
    http://expertiza.ncsu.edu/review_chats/show/#{id}&amp;quot;&lt;br /&gt;
    defn[:to] = to_mail_list&lt;br /&gt;
    Mailer.sync_message(defn).deliver&lt;br /&gt;
  end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
*Modify existing controller '''response_controller.rb''' and add a new method.&lt;br /&gt;
&lt;br /&gt;
'''initiate_chat'''- Create a chat record and send an email to the authors when a reviewer posts a query.&lt;br /&gt;
  def initiate_chat&lt;br /&gt;
      @map = ResponseMap.find(params[:id])&lt;br /&gt;
      ReviewChat.create( :response_map_id=&amp;gt;@map.id, :type_flag =&amp;gt; 'Q' , :content =&amp;gt; params[:review_question])&lt;br /&gt;
      flash[:notice]=&amp;quot;Question has been submitted to Author&amp;quot;&lt;br /&gt;
      @interaction_id=ReviewChat.where(:response_map_id =&amp;gt; @map.id)&lt;br /&gt;
      ReviewChatsHelper::chat_email_query(@interaction_id.first.id)&lt;br /&gt;
      redirect_to action: 'new', id: params[:id]&lt;br /&gt;
  end&lt;br /&gt;
*Create a new view '''show.html.erb''' to show the existing chat record and a box to respond and ask a follow up query.&lt;br /&gt;
&lt;br /&gt;
===Flowchart===&lt;br /&gt;
&lt;br /&gt;
[[File: ARSNFlowchart1.png]]&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
===User Interface Testing===&lt;br /&gt;
&lt;br /&gt;
* Login to Expertiza with a student account. You can use login id as 'student5700' and password as 'password'.&lt;br /&gt;
* Start reviewing an existing assignment. You would see a small query box at the bottom of the page.&lt;br /&gt;
*The reviewer enters his question in the text area provided and clicks on the &amp;quot;Submit&amp;quot; button.&lt;br /&gt;
[[File: FinalProject1.jpg]]&lt;br /&gt;
*On clicking this button the appropriate method is called in ReviewChats controller which sends an email to all the authors of the topic indicating that a question has been asked about their work. The email contains a link which when clicked on will redirect the author to the appropriate view where he/she can answer the question.&lt;br /&gt;
[[File: FinalProject4.jpg]]&lt;br /&gt;
*On answering the question, the reviewer receives an email indicating that his question has been answered. It also contains a link which redirects the reviewer to the appropriate view where the answer will be displayed.&lt;br /&gt;
*The authorized users will also be able to see a link to open existing chat interaction log.&lt;br /&gt;
[[File: FinalProject3.jpg]]&lt;br /&gt;
*This view also contains the chat history between the author/s and the reviewer for the entire duration of the interaction.&lt;br /&gt;
[[File: FinalProject2.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Model Testing===&lt;br /&gt;
&lt;br /&gt;
* Create a model test file '''review_chat_test.rb''' with the below tests.&lt;br /&gt;
'''Presence of response_map_id'''&lt;br /&gt;
&lt;br /&gt;
  test &amp;quot;response_map_id should be present&amp;quot; do&lt;br /&gt;
    @review_chat.response_map_id = &amp;quot; &amp;quot;&lt;br /&gt;
    assert_not @review_chat.response_map_id?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Presence of content'''&lt;br /&gt;
&lt;br /&gt;
  test &amp;quot;content should be present (nonblank)&amp;quot; do&lt;br /&gt;
    @review_chat.content = &amp;quot; &amp;quot; * 6&lt;br /&gt;
    assert_not @review_chat.valid?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Length of content'''&lt;br /&gt;
&lt;br /&gt;
  test &amp;quot;content should have a maximum length of 255&amp;quot; do&lt;br /&gt;
    @review_chat.content = &amp;quot;a&amp;quot; * 250&lt;br /&gt;
    assert @review_chat.valid?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
* To run the tests,&lt;br /&gt;
  bin/rake test test/models/review_chat_test.rb&lt;br /&gt;
&lt;br /&gt;
===Web Testing===&lt;br /&gt;
&lt;br /&gt;
* Create a browser automation test using [http://imacros.net/overview imacros] in Firefox/Chrome browser.&lt;br /&gt;
* Run the simulation to test the Expertiza chat operation in the browser.&lt;br /&gt;
&lt;br /&gt;
== Suggestions for Future Improvements ==&lt;br /&gt;
&lt;br /&gt;
* This can be extended to a live interactive author-reviewer anonymous chat session inside the Expertiza reviews window.&lt;br /&gt;
* A purging script can be developed which will clear all the interaction records every semester.&lt;br /&gt;
&lt;br /&gt;
==Resources==&lt;br /&gt;
&lt;br /&gt;
* Expertiza Github repository&amp;lt;ref&amp;gt;Expertiza Github repository https://github.com/expertiza/expertiza&amp;lt;/ref&amp;gt;&lt;br /&gt;
* Demo video&amp;lt;ref&amp;gt;Demo video https://www.youtube.com/watch?v=8E-hYiJVoZI&amp;lt;/ref&amp;gt;&lt;br /&gt;
* Github Pull request&amp;lt;ref&amp;gt;Github Pull request https://github.com/expertiza/expertiza/pull/628&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sgulati2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100614</id>
		<title>CSC/ECE 517 Fall 2015 E1586 AnonymousChatBetweenAuthorAndReviewer</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100614"/>
		<updated>2015-12-17T02:46:06Z</updated>

		<summary type="html">&lt;p&gt;Sgulati2: /* Code Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1586 AnonymousChatBetweenAuthorAndReviewer'''&lt;br /&gt;
&lt;br /&gt;
This page provides a brief description of the '''Expertiza''' project. The project is aimed at developing an email based anonymous session between author and a reviewer so that reviewers can ask questions to the authors for any doubts related to the assignments during peer reviewing.&lt;br /&gt;
&lt;br /&gt;
==Project==&lt;br /&gt;
&lt;br /&gt;
=== Introduction to Expertiza ===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a peer review based system which provides an incremental class based learning together with the instructors and the peers. This project has been developed together by faculty and students using [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza handles assignment submissions, team formations, assignment reviews and grades, etc.&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
During reviews, many times reviewers will be having questions about the submitted material and if it's a blocker there is no way that the reviewer can progress further with the review.  As a result, reviewers will end up submitting the empty or incomplete review.&lt;br /&gt;
&lt;br /&gt;
=== Scope ===&lt;br /&gt;
This project is limited to an email based conversation for asking questions and answers. The reviewers would ask questions related to assignment submission doubts to which authors can respond. All this would be taken care as email responses using a link provided in the email. This project does not cater to any live interactive session with spontaneous back-to-back questions and responses.&lt;br /&gt;
&lt;br /&gt;
Following tasks would be incorporated in the project:&lt;br /&gt;
* Provide a ‘TextArea’ input field on review forms, where any reviewer can type in their questions.&lt;br /&gt;
* Create a new button ‘Ask for Quick Help’ on the review forms.&lt;br /&gt;
* An email would be send to the author with the link where he can respond to the questions asked by the reviewers for their submitted work.&lt;br /&gt;
* Reviewers would be notified by an email when authors respond to the the questions.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Discussion of Resolution ===&lt;br /&gt;
Following modifications were made to implement the chat feature:- &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Create a new model which will help to extract, store and validate data in the database table which contains information about the interaction between the author/s and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Edit the view which is used by the response controller to incorporate the text area input field on the review form where the reviewer can ask his/her initial query.&lt;br /&gt;
&lt;br /&gt;
*Create a new controller with methods for authentication for a respective chat log only visible to the author and reviewer of a particular assignment, method to submit a response or a follow up query and show the existing interaction log.&lt;br /&gt;
&lt;br /&gt;
*Create a new helper with the e-mail methods for sending to the author and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Create a new view which will facilitate the author to respond to the queries asked by the reviewer. The reviewer can also use this view to ask any follow up questions.&lt;br /&gt;
&lt;br /&gt;
=== Design Patterns ===&lt;br /&gt;
The following design patterns were used for the solution:&lt;br /&gt;
 &lt;br /&gt;
* '''Observer Pattern'''&amp;lt;ref&amp;gt;Observer Design Pattern https://en.wikipedia.org/wiki/Observer_pattern&amp;lt;/ref&amp;gt;: The observer pattern is a software design pattern in which an object, called the subject, maintains a list of its dependents, called observers, and notifies them automatically of any state changes, usually by calling one of their methods. For example, we are notifying the team members whenever the reviewer submits the query.&lt;br /&gt;
&lt;br /&gt;
* '''Iterator Pattern''': In our instance, we need to display the entire chat history of a particular interaction, hence we can use the iterator design pattern to iterate through the previous chat messages.&lt;br /&gt;
&lt;br /&gt;
=== Database Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:Review_chats.png]]&lt;br /&gt;
&lt;br /&gt;
The above figure shows the schema of a new table which will be created in Expertiza to store relevant information about the chat. It contains the following attributes:&lt;br /&gt;
* id: This attribute is auto-generated by rails when we create a table and is auto incremented with each record. It is also the primary key of our table.&lt;br /&gt;
* assignment_id: Stores the ID of the assignment for which the interaction between author and reviewer is taking place.&lt;br /&gt;
* reviewer_id: Stores the ID of the reviewer who asks the questions.&lt;br /&gt;
* team_id: Stores the ID of the team to which the topic belongs.&lt;br /&gt;
* type_flag: Flag which is used to indicate if the particular tuple contains a question or answer. It can take two values, 'Q' for question and 'A' for answer.&lt;br /&gt;
* content: Stores the question asked by the reviewer or the response given by the author/s depending on the value of the type flag.&lt;br /&gt;
&lt;br /&gt;
Records for a particular interaction can be identified by using a combination of assignment_id, reviewer_id and team_id.&lt;br /&gt;
&lt;br /&gt;
=== Use Cases ===&lt;br /&gt;
'''Name:''' Send a question to the author/s about their work.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Reviewer. &amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The reviewer enters his question in the text area which is provided and clicks on the &amp;quot;Ask question&amp;quot; button which is provided as shown in the mock up. On clicking this button an email is sent to the author/s along which a link to answer the question.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''Name:''' Answer the question which has been asked by the reviewer.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Author/s&amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The author/s click on the link received in their email and are redirected to a page where they can answer the question. Once they submit the answer, an email is sent to the reviewer notifying him/her that their question has been answered.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:ARSNUsecase.jpeg]]&lt;br /&gt;
&lt;br /&gt;
=== Proposed Tests ===&lt;br /&gt;
1. For use case 1, test whether all the team members receive email with the question.&amp;lt;br/&amp;gt;&lt;br /&gt;
2. For use case 2, test whether the reviewer receive email with the response.&amp;lt;br/&amp;gt;&lt;br /&gt;
3. Test whether all the previous interactions are displayed as chat history.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
===Code Implementation===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*Create a new model '''review_chat.rb''' for ReviewChat.&lt;br /&gt;
&lt;br /&gt;
'''Validation'''- Check if the query box is not empty and restrict the query length to 255 characters.&lt;br /&gt;
&lt;br /&gt;
  validates_length_of :content , :maximum =&amp;gt; 255,message: &amp;quot;Length must be less that 255 characters&amp;quot;&lt;br /&gt;
  validates_presence_of :content, message: &amp;quot;Content cannot be blank&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*Create a new controller '''review_chats_controller.rb''' with the following methods:&lt;br /&gt;
&lt;br /&gt;
'''action_allowed?'''- Allow chat visibility to the reviewers and the authors of a particular interaction&lt;br /&gt;
&lt;br /&gt;
  def action_allowed?&lt;br /&gt;
    review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    allowed_users=Array.new&lt;br /&gt;
    response_map = ReviewChat.get_response_map(review_chat)&lt;br /&gt;
    team_id = response_map.reviewee_id&lt;br /&gt;
    teams_users = TeamsUser.where(team_id: team_id)&lt;br /&gt;
    teams_users.each do |teams_user|&lt;br /&gt;
      allowed_users &amp;lt;&amp;lt; User.find(teams_user.user_id).id&lt;br /&gt;
    end&lt;br /&gt;
    allowed_users &amp;lt;&amp;lt; Participant.find(response_map.reviewer_id).user_id&lt;br /&gt;
    current_role_name.eql? 'Student' and allowed_users.include?(session[:user].id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''show'''- Show the chat interaction log&lt;br /&gt;
&lt;br /&gt;
  def show&lt;br /&gt;
    @review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    @map_id=@review_chat.response_map_id&lt;br /&gt;
    @chat_log=ReviewChat.get_chat_log(@map_id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''submitted_response'''- Create a chat record and send an email to the reviewer when an author replied to a query asked by the reviewer&lt;br /&gt;
&lt;br /&gt;
  def submitted_response&lt;br /&gt;
    @review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    response_map = ReviewResponseMap.find(@review_chat.response_map_id)&lt;br /&gt;
    @chat_reviewer=Participant.find(response_map.reviewer_id).user_id&lt;br /&gt;
    if(@chat_reviewer==session[:user].id) then&lt;br /&gt;
    	ReviewChat.create(:response_map_id =&amp;gt; @review_chat.response_map_id, :type_flag =&amp;gt; 'Q' , :content =&amp;gt; params[:response_area])&lt;br /&gt;
    	ReviewChatsHelper::chat_email_query(params[:id])&lt;br /&gt;
    	flash[:notice]=&amp;quot;Query has been submitted&amp;quot;	&lt;br /&gt;
    else	&lt;br /&gt;
      	ReviewChat.create(:response_map_id =&amp;gt; @review_chat.response_map_id, :type_flag =&amp;gt; 'A' , :content =&amp;gt; params[:response_area])&lt;br /&gt;
      	ReviewChatsHelper::chat_email_response(@review_chat.id,@chat_reviewer)&lt;br /&gt;
      flash[:notice]=&amp;quot;Response has been submitted&amp;quot;&lt;br /&gt;
    end	&lt;br /&gt;
    redirect_to action: 'show', id: params[:id]&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
*Create a helper file '''review_chats_helper.rb''' with the following methods:&lt;br /&gt;
&lt;br /&gt;
'''chat_email_response'''- Send an email to the author of an assignment when a reviewer posts a query&lt;br /&gt;
&lt;br /&gt;
  def self.chat_email_response(id,reviewer_id,partial=&amp;quot;new_chatemail&amp;quot;)&lt;br /&gt;
    defn = Hash.new&lt;br /&gt;
    defn[:body] = Hash.new&lt;br /&gt;
    defn[:body][:partial_name] = partial&lt;br /&gt;
    reviewer_email=User.find(reviewer_id).email&lt;br /&gt;
    defn[:subject] = &amp;quot;Response posted for submission&amp;quot;&lt;br /&gt;
    defn[:body][:type] = &amp;quot; response has been posted for your query .&lt;br /&gt;
    Please open the below URL to view.&lt;br /&gt;
    http://expertiza.ncsu.edu/review_chats/show/#{id}&amp;quot;&lt;br /&gt;
    defn[:to] = reviewer_email&lt;br /&gt;
    Mailer.sync_message(defn).deliver&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''chat_email_query'''- Send an email to the author of an assignment when a reviewer posts a query&lt;br /&gt;
&lt;br /&gt;
  def self.chat_email_query(id,partial=&amp;quot;new_chatemail&amp;quot;)&lt;br /&gt;
    defn = Hash.new&lt;br /&gt;
    defn[:body] = Hash.new&lt;br /&gt;
    defn[:body][:partial_name] = partial&lt;br /&gt;
    @review_chat=ReviewChat.find(id)&lt;br /&gt;
    response_map = ReviewChat.get_response_map(@review_chat)&lt;br /&gt;
    @team_id = response_map.reviewee_id&lt;br /&gt;
    teams_users = TeamsUser.where(team_id: @team_id)&lt;br /&gt;
    to_mail_list = Array.new&lt;br /&gt;
    teams_users.each do |teams_user|&lt;br /&gt;
    to_mail_list &amp;lt;&amp;lt; User.find(teams_user.user_id).email &lt;br /&gt;
    end&lt;br /&gt;
    defn[:subject] = &amp;quot;Query posted for submission&amp;quot;&lt;br /&gt;
    defn[:body][:type] = &amp;quot; query has been posted for your submission .&lt;br /&gt;
    Please open the below URL to view and respond.&lt;br /&gt;
    http://expertiza.ncsu.edu/review_chats/show/#{id}&amp;quot;&lt;br /&gt;
    defn[:to] = to_mail_list&lt;br /&gt;
    Mailer.sync_message(defn).deliver&lt;br /&gt;
  end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
*Modify existing controller '''response_controller.rb''' and add a new method.&lt;br /&gt;
&lt;br /&gt;
'''initiate_chat'''- Create a chat record and send an email to the authors when a reviewer posts a query.&lt;br /&gt;
  def initiate_chat&lt;br /&gt;
      @map = ResponseMap.find(params[:id])&lt;br /&gt;
      ReviewChat.create( :response_map_id=&amp;gt;@map.id, :type_flag =&amp;gt; 'Q' , :content =&amp;gt; params[:review_question])&lt;br /&gt;
      flash[:notice]=&amp;quot;Question has been submitted to Author&amp;quot;&lt;br /&gt;
      @interaction_id=ReviewChat.where(:response_map_id =&amp;gt; @map.id)&lt;br /&gt;
      ReviewChatsHelper::chat_email_query(@interaction_id.first.id)&lt;br /&gt;
      redirect_to action: 'new', id: params[:id]&lt;br /&gt;
  end&lt;br /&gt;
*Create a new view '''show.html.erb''' to show the existing chat record and a box to respond and ask a follow up query.&lt;br /&gt;
&lt;br /&gt;
===Flowchart===&lt;br /&gt;
&lt;br /&gt;
[[File: ARSNFlowchart1.png]]&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
===User Interface Testing===&lt;br /&gt;
&lt;br /&gt;
* Login to Expertiza with a student account. You can use login id as 'student5700' and password as 'password'.&lt;br /&gt;
* Start reviewing an existing assignment. You would see a small query box at the bottom of the page.&lt;br /&gt;
*The reviewer enters his question in the text area provided and clicks on the &amp;quot;Submit&amp;quot; button.&lt;br /&gt;
[[File: FinalProject1.jpg]]&lt;br /&gt;
*On clicking this button the appropriate method is called in ReviewChats controller which sends an email to all the authors of the topic indicating that a question has been asked about their work. The email contains a link which when clicked on will redirect the author to the appropriate view where he/she can answer the question.&lt;br /&gt;
[[File: FinalProject4.jpg]]&lt;br /&gt;
*On answering the question, the reviewer receives an email indicating that his question has been answered. It also contains a link which redirects the reviewer to the appropriate view where the answer will be displayed.&lt;br /&gt;
*The authorized users will also be able to see a link to open existing chat interaction log.&lt;br /&gt;
[[File: FinalProject3.jpg]]&lt;br /&gt;
*This view also contains the chat history between the author/s and the reviewer for the entire duration of the interaction.&lt;br /&gt;
[[File: FinalProject2.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Model Testing===&lt;br /&gt;
&lt;br /&gt;
* Create a model test file '''review_chat_test.rb''' with the below tests.&lt;br /&gt;
'''Presence of assignment_id'''&lt;br /&gt;
&lt;br /&gt;
  test &amp;quot;assignment_id should be present&amp;quot; do&lt;br /&gt;
    @review_chat.assignment_id = &amp;quot; &amp;quot;&lt;br /&gt;
    assert_not @review_chat.assignment_id?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Presence of reviewer_id'''&lt;br /&gt;
&lt;br /&gt;
  test &amp;quot;reviewer_id should be present&amp;quot; do&lt;br /&gt;
    @review_chat.reviewer_id = &amp;quot; &amp;quot;&lt;br /&gt;
    assert_not @review_chat.reviewer_id?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Presence of team_id'''&lt;br /&gt;
&lt;br /&gt;
  test &amp;quot;team_id should be present&amp;quot; do&lt;br /&gt;
    @review_chat.team_id = &amp;quot; &amp;quot;&lt;br /&gt;
    assert_not @review_chat.team_id?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Presence of content'''&lt;br /&gt;
&lt;br /&gt;
  test &amp;quot;content should be present (nonblank)&amp;quot; do&lt;br /&gt;
    @review_chat.content = &amp;quot; &amp;quot; * 6&lt;br /&gt;
    assert_not @review_chat.valid?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Length of content'''&lt;br /&gt;
&lt;br /&gt;
  test &amp;quot;content should have a maximum length of 255&amp;quot; do&lt;br /&gt;
    @review_chat.content = &amp;quot;a&amp;quot; * 250&lt;br /&gt;
    assert @review_chat.valid?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
* To run the tests,&lt;br /&gt;
  bin/rake test test/models/review_chat_test.rb&lt;br /&gt;
&lt;br /&gt;
===Web Testing===&lt;br /&gt;
&lt;br /&gt;
* Create a browser automation test using [http://imacros.net/overview imacros] in Firefox/Chrome browser.&lt;br /&gt;
* Run the simulation to test the Expertiza chat operation in the browser.&lt;br /&gt;
&lt;br /&gt;
== Suggestions for Future Improvements ==&lt;br /&gt;
&lt;br /&gt;
* This can be extended to a live interactive author-reviewer anonymous chat session inside the Expertiza reviews window.&lt;br /&gt;
* A purging script can be developed which will clear all the interaction records every semester.&lt;br /&gt;
&lt;br /&gt;
==Resources==&lt;br /&gt;
&lt;br /&gt;
* Expertiza Github repository&amp;lt;ref&amp;gt;Expertiza Github repository https://github.com/expertiza/expertiza&amp;lt;/ref&amp;gt;&lt;br /&gt;
* Demo video&amp;lt;ref&amp;gt;Demo video https://www.youtube.com/watch?v=8E-hYiJVoZI&amp;lt;/ref&amp;gt;&lt;br /&gt;
* Github Pull request&amp;lt;ref&amp;gt;Github Pull request https://github.com/expertiza/expertiza/pull/628&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sgulati2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100613</id>
		<title>CSC/ECE 517 Fall 2015 E1586 AnonymousChatBetweenAuthorAndReviewer</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100613"/>
		<updated>2015-12-17T02:44:11Z</updated>

		<summary type="html">&lt;p&gt;Sgulati2: /* Code Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1586 AnonymousChatBetweenAuthorAndReviewer'''&lt;br /&gt;
&lt;br /&gt;
This page provides a brief description of the '''Expertiza''' project. The project is aimed at developing an email based anonymous session between author and a reviewer so that reviewers can ask questions to the authors for any doubts related to the assignments during peer reviewing.&lt;br /&gt;
&lt;br /&gt;
==Project==&lt;br /&gt;
&lt;br /&gt;
=== Introduction to Expertiza ===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a peer review based system which provides an incremental class based learning together with the instructors and the peers. This project has been developed together by faculty and students using [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza handles assignment submissions, team formations, assignment reviews and grades, etc.&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
During reviews, many times reviewers will be having questions about the submitted material and if it's a blocker there is no way that the reviewer can progress further with the review.  As a result, reviewers will end up submitting the empty or incomplete review.&lt;br /&gt;
&lt;br /&gt;
=== Scope ===&lt;br /&gt;
This project is limited to an email based conversation for asking questions and answers. The reviewers would ask questions related to assignment submission doubts to which authors can respond. All this would be taken care as email responses using a link provided in the email. This project does not cater to any live interactive session with spontaneous back-to-back questions and responses.&lt;br /&gt;
&lt;br /&gt;
Following tasks would be incorporated in the project:&lt;br /&gt;
* Provide a ‘TextArea’ input field on review forms, where any reviewer can type in their questions.&lt;br /&gt;
* Create a new button ‘Ask for Quick Help’ on the review forms.&lt;br /&gt;
* An email would be send to the author with the link where he can respond to the questions asked by the reviewers for their submitted work.&lt;br /&gt;
* Reviewers would be notified by an email when authors respond to the the questions.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Discussion of Resolution ===&lt;br /&gt;
Following modifications were made to implement the chat feature:- &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Create a new model which will help to extract, store and validate data in the database table which contains information about the interaction between the author/s and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Edit the view which is used by the response controller to incorporate the text area input field on the review form where the reviewer can ask his/her initial query.&lt;br /&gt;
&lt;br /&gt;
*Create a new controller with methods for authentication for a respective chat log only visible to the author and reviewer of a particular assignment, method to submit a response or a follow up query and show the existing interaction log.&lt;br /&gt;
&lt;br /&gt;
*Create a new helper with the e-mail methods for sending to the author and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Create a new view which will facilitate the author to respond to the queries asked by the reviewer. The reviewer can also use this view to ask any follow up questions.&lt;br /&gt;
&lt;br /&gt;
=== Design Patterns ===&lt;br /&gt;
The following design patterns were used for the solution:&lt;br /&gt;
 &lt;br /&gt;
* '''Observer Pattern'''&amp;lt;ref&amp;gt;Observer Design Pattern https://en.wikipedia.org/wiki/Observer_pattern&amp;lt;/ref&amp;gt;: The observer pattern is a software design pattern in which an object, called the subject, maintains a list of its dependents, called observers, and notifies them automatically of any state changes, usually by calling one of their methods. For example, we are notifying the team members whenever the reviewer submits the query.&lt;br /&gt;
&lt;br /&gt;
* '''Iterator Pattern''': In our instance, we need to display the entire chat history of a particular interaction, hence we can use the iterator design pattern to iterate through the previous chat messages.&lt;br /&gt;
&lt;br /&gt;
=== Database Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:Review_chats.png]]&lt;br /&gt;
&lt;br /&gt;
The above figure shows the schema of a new table which will be created in Expertiza to store relevant information about the chat. It contains the following attributes:&lt;br /&gt;
* id: This attribute is auto-generated by rails when we create a table and is auto incremented with each record. It is also the primary key of our table.&lt;br /&gt;
* assignment_id: Stores the ID of the assignment for which the interaction between author and reviewer is taking place.&lt;br /&gt;
* reviewer_id: Stores the ID of the reviewer who asks the questions.&lt;br /&gt;
* team_id: Stores the ID of the team to which the topic belongs.&lt;br /&gt;
* type_flag: Flag which is used to indicate if the particular tuple contains a question or answer. It can take two values, 'Q' for question and 'A' for answer.&lt;br /&gt;
* content: Stores the question asked by the reviewer or the response given by the author/s depending on the value of the type flag.&lt;br /&gt;
&lt;br /&gt;
Records for a particular interaction can be identified by using a combination of assignment_id, reviewer_id and team_id.&lt;br /&gt;
&lt;br /&gt;
=== Use Cases ===&lt;br /&gt;
'''Name:''' Send a question to the author/s about their work.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Reviewer. &amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The reviewer enters his question in the text area which is provided and clicks on the &amp;quot;Ask question&amp;quot; button which is provided as shown in the mock up. On clicking this button an email is sent to the author/s along which a link to answer the question.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''Name:''' Answer the question which has been asked by the reviewer.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Author/s&amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The author/s click on the link received in their email and are redirected to a page where they can answer the question. Once they submit the answer, an email is sent to the reviewer notifying him/her that their question has been answered.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:ARSNUsecase.jpeg]]&lt;br /&gt;
&lt;br /&gt;
=== Proposed Tests ===&lt;br /&gt;
1. For use case 1, test whether all the team members receive email with the question.&amp;lt;br/&amp;gt;&lt;br /&gt;
2. For use case 2, test whether the reviewer receive email with the response.&amp;lt;br/&amp;gt;&lt;br /&gt;
3. Test whether all the previous interactions are displayed as chat history.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
===Code Implementation===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*Create a new model '''review_chat.rb''' for ReviewChat.&lt;br /&gt;
&lt;br /&gt;
'''Validation'''- Check if the query box is not empty and restrict the query length to 255 characters.&lt;br /&gt;
&lt;br /&gt;
  validates_length_of :content , :maximum =&amp;gt; 255,message: &amp;quot;Length must be less that 255 characters&amp;quot;&lt;br /&gt;
  validates_presence_of :content, message: &amp;quot;Content cannot be blank&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*Create a new controller '''review_chats_controller.rb''' with the following methods:&lt;br /&gt;
&lt;br /&gt;
'''action_allowed?'''- Allow chat visibility to the reviewers and the authors of a particular interaction&lt;br /&gt;
&lt;br /&gt;
  def action_allowed?&lt;br /&gt;
    review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    allowed_users=Array.new&lt;br /&gt;
    response_map = ReviewChat.get_response_map(review_chat)&lt;br /&gt;
    team_id = response_map.reviewee_id&lt;br /&gt;
    teams_users = TeamsUser.where(team_id: team_id)&lt;br /&gt;
    teams_users.each do |teams_user|&lt;br /&gt;
      allowed_users &amp;lt;&amp;lt; User.find(teams_user.user_id).id&lt;br /&gt;
    end&lt;br /&gt;
    allowed_users &amp;lt;&amp;lt; Participant.find(response_map.reviewer_id).user_id&lt;br /&gt;
    current_role_name.eql? 'Student' and allowed_users.include?(session[:user].id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''show'''- Show the chat interaction log&lt;br /&gt;
&lt;br /&gt;
  def show&lt;br /&gt;
    @review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    @map_id=@review_chat.response_map_id&lt;br /&gt;
    @chat_log=ReviewChat.get_chat_log(@map_id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''submitted_response'''- Create a chat record and send an email to the reviewer when an author replied to a query asked by the reviewer&lt;br /&gt;
&lt;br /&gt;
  def submitted_response&lt;br /&gt;
    @review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    response_map = ReviewResponseMap.find(@review_chat.response_map_id)&lt;br /&gt;
    @chat_reviewer=Participant.find(response_map.reviewer_id).user_id&lt;br /&gt;
    if(@chat_reviewer==session[:user].id) then&lt;br /&gt;
    	ReviewChat.create(:response_map_id =&amp;gt; @review_chat.response_map_id, :type_flag =&amp;gt; 'Q' , :content =&amp;gt; params[:response_area])&lt;br /&gt;
    	ReviewChatsHelper::chat_email_query(params[:id])&lt;br /&gt;
    	flash[:notice]=&amp;quot;Query has been submitted&amp;quot;	&lt;br /&gt;
    else	&lt;br /&gt;
      	ReviewChat.create(:response_map_id =&amp;gt; @review_chat.response_map_id, :type_flag =&amp;gt; 'A' , :content =&amp;gt; params[:response_area])&lt;br /&gt;
      	ReviewChatsHelper::chat_email_response(@review_chat.id,@chat_reviewer)&lt;br /&gt;
      flash[:notice]=&amp;quot;Response has been submitted&amp;quot;&lt;br /&gt;
    end	&lt;br /&gt;
    redirect_to action: 'show', id: params[:id]&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
*Create a helper file '''review_chats_helper.rb''' with the following methods:&lt;br /&gt;
&lt;br /&gt;
'''chat_email_response'''- Send an email to the author of an assignment when a reviewer posts a query&lt;br /&gt;
&lt;br /&gt;
  def self.chat_email_response(id,reviewer_id,partial=&amp;quot;new_chatemail&amp;quot;)&lt;br /&gt;
    defn = Hash.new&lt;br /&gt;
    defn[:body] = Hash.new&lt;br /&gt;
    defn[:body][:partial_name] = partial&lt;br /&gt;
    reviewer_email=User.find(reviewer_id).email&lt;br /&gt;
    defn[:subject] = &amp;quot;Response posted for submission&amp;quot;&lt;br /&gt;
    defn[:body][:type] = &amp;quot; response has been posted for your query .&lt;br /&gt;
    Please open the below URL to view.&lt;br /&gt;
    http://expertiza.ncsu.edu/review_chats/show/#{id}&amp;quot;&lt;br /&gt;
    defn[:to] = reviewer_email&lt;br /&gt;
    Mailer.sync_message(defn).deliver&lt;br /&gt;
  end &lt;br /&gt;
&lt;br /&gt;
'''chat_email_query'''- Send an email to the author of an assignment when a reviewer posts a query&lt;br /&gt;
&lt;br /&gt;
  def self.chat_email_query(id,partial=&amp;quot;new_chatemail&amp;quot;)&lt;br /&gt;
    defn = Hash.new&lt;br /&gt;
    defn[:body] = Hash.new&lt;br /&gt;
    defn[:body][:partial_name] = partial&lt;br /&gt;
    assignment=nil&lt;br /&gt;
    @team_id=ReviewChat.find(id).team_id&lt;br /&gt;
    teams_users = TeamsUser.where(team_id: @team_id)&lt;br /&gt;
    to_mail_list = Array.new&lt;br /&gt;
    teams_users.each do |teams_user|&lt;br /&gt;
    to_mail_list &amp;lt;&amp;lt; User.find(teams_user.user_id).email &lt;br /&gt;
    end&lt;br /&gt;
    defn[:subject] = &amp;quot;Query posted for submission&amp;quot;&lt;br /&gt;
    defn[:body][:type] = &amp;quot; query has been posted for your submission .&lt;br /&gt;
    Please open the below URL to view and respond.&lt;br /&gt;
    http://expertiza.ncsu.edu/review_chats/show/#{id}&amp;quot;&lt;br /&gt;
    defn[:to] = to_mail_list&lt;br /&gt;
    Mailer.sync_message(defn).deliver&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
*Modify existing controller '''response_controller.rb''' and add a new method.&lt;br /&gt;
&lt;br /&gt;
'''initiate_chat'''- Create a chat record and send an email to the authors when a reviewer posts a query.&lt;br /&gt;
  def initiate_chat&lt;br /&gt;
      @map = ResponseMap.find(params[:id])&lt;br /&gt;
      ReviewChat.create( :response_map_id=&amp;gt;@map.id, :type_flag =&amp;gt; 'Q' , :content =&amp;gt; params[:review_question])&lt;br /&gt;
      flash[:notice]=&amp;quot;Question has been submitted to Author&amp;quot;&lt;br /&gt;
      @interaction_id=ReviewChat.where(:response_map_id =&amp;gt; @map.id)&lt;br /&gt;
      ReviewChatsHelper::chat_email_query(@interaction_id.first.id)&lt;br /&gt;
      redirect_to action: 'new', id: params[:id]&lt;br /&gt;
  end&lt;br /&gt;
*Create a new view '''show.html.erb''' to show the existing chat record and a box to respond and ask a follow up query.&lt;br /&gt;
&lt;br /&gt;
===Flowchart===&lt;br /&gt;
&lt;br /&gt;
[[File: ARSNFlowchart1.png]]&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
===User Interface Testing===&lt;br /&gt;
&lt;br /&gt;
* Login to Expertiza with a student account. You can use login id as 'student5700' and password as 'password'.&lt;br /&gt;
* Start reviewing an existing assignment. You would see a small query box at the bottom of the page.&lt;br /&gt;
*The reviewer enters his question in the text area provided and clicks on the &amp;quot;Submit&amp;quot; button.&lt;br /&gt;
[[File: FinalProject1.jpg]]&lt;br /&gt;
*On clicking this button the appropriate method is called in ReviewChats controller which sends an email to all the authors of the topic indicating that a question has been asked about their work. The email contains a link which when clicked on will redirect the author to the appropriate view where he/she can answer the question.&lt;br /&gt;
[[File: FinalProject4.jpg]]&lt;br /&gt;
*On answering the question, the reviewer receives an email indicating that his question has been answered. It also contains a link which redirects the reviewer to the appropriate view where the answer will be displayed.&lt;br /&gt;
*The authorized users will also be able to see a link to open existing chat interaction log.&lt;br /&gt;
[[File: FinalProject3.jpg]]&lt;br /&gt;
*This view also contains the chat history between the author/s and the reviewer for the entire duration of the interaction.&lt;br /&gt;
[[File: FinalProject2.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Model Testing===&lt;br /&gt;
&lt;br /&gt;
* Create a model test file '''review_chat_test.rb''' with the below tests.&lt;br /&gt;
'''Presence of assignment_id'''&lt;br /&gt;
&lt;br /&gt;
  test &amp;quot;assignment_id should be present&amp;quot; do&lt;br /&gt;
    @review_chat.assignment_id = &amp;quot; &amp;quot;&lt;br /&gt;
    assert_not @review_chat.assignment_id?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Presence of reviewer_id'''&lt;br /&gt;
&lt;br /&gt;
  test &amp;quot;reviewer_id should be present&amp;quot; do&lt;br /&gt;
    @review_chat.reviewer_id = &amp;quot; &amp;quot;&lt;br /&gt;
    assert_not @review_chat.reviewer_id?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Presence of team_id'''&lt;br /&gt;
&lt;br /&gt;
  test &amp;quot;team_id should be present&amp;quot; do&lt;br /&gt;
    @review_chat.team_id = &amp;quot; &amp;quot;&lt;br /&gt;
    assert_not @review_chat.team_id?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Presence of content'''&lt;br /&gt;
&lt;br /&gt;
  test &amp;quot;content should be present (nonblank)&amp;quot; do&lt;br /&gt;
    @review_chat.content = &amp;quot; &amp;quot; * 6&lt;br /&gt;
    assert_not @review_chat.valid?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Length of content'''&lt;br /&gt;
&lt;br /&gt;
  test &amp;quot;content should have a maximum length of 255&amp;quot; do&lt;br /&gt;
    @review_chat.content = &amp;quot;a&amp;quot; * 250&lt;br /&gt;
    assert @review_chat.valid?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
* To run the tests,&lt;br /&gt;
  bin/rake test test/models/review_chat_test.rb&lt;br /&gt;
&lt;br /&gt;
===Web Testing===&lt;br /&gt;
&lt;br /&gt;
* Create a browser automation test using [http://imacros.net/overview imacros] in Firefox/Chrome browser.&lt;br /&gt;
* Run the simulation to test the Expertiza chat operation in the browser.&lt;br /&gt;
&lt;br /&gt;
== Suggestions for Future Improvements ==&lt;br /&gt;
&lt;br /&gt;
* This can be extended to a live interactive author-reviewer anonymous chat session inside the Expertiza reviews window.&lt;br /&gt;
* A purging script can be developed which will clear all the interaction records every semester.&lt;br /&gt;
&lt;br /&gt;
==Resources==&lt;br /&gt;
&lt;br /&gt;
* Expertiza Github repository&amp;lt;ref&amp;gt;Expertiza Github repository https://github.com/expertiza/expertiza&amp;lt;/ref&amp;gt;&lt;br /&gt;
* Demo video&amp;lt;ref&amp;gt;Demo video https://www.youtube.com/watch?v=8E-hYiJVoZI&amp;lt;/ref&amp;gt;&lt;br /&gt;
* Github Pull request&amp;lt;ref&amp;gt;Github Pull request https://github.com/expertiza/expertiza/pull/628&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sgulati2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100612</id>
		<title>CSC/ECE 517 Fall 2015 E1586 AnonymousChatBetweenAuthorAndReviewer</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100612"/>
		<updated>2015-12-17T02:42:35Z</updated>

		<summary type="html">&lt;p&gt;Sgulati2: /* Code Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1586 AnonymousChatBetweenAuthorAndReviewer'''&lt;br /&gt;
&lt;br /&gt;
This page provides a brief description of the '''Expertiza''' project. The project is aimed at developing an email based anonymous session between author and a reviewer so that reviewers can ask questions to the authors for any doubts related to the assignments during peer reviewing.&lt;br /&gt;
&lt;br /&gt;
==Project==&lt;br /&gt;
&lt;br /&gt;
=== Introduction to Expertiza ===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a peer review based system which provides an incremental class based learning together with the instructors and the peers. This project has been developed together by faculty and students using [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza handles assignment submissions, team formations, assignment reviews and grades, etc.&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
During reviews, many times reviewers will be having questions about the submitted material and if it's a blocker there is no way that the reviewer can progress further with the review.  As a result, reviewers will end up submitting the empty or incomplete review.&lt;br /&gt;
&lt;br /&gt;
=== Scope ===&lt;br /&gt;
This project is limited to an email based conversation for asking questions and answers. The reviewers would ask questions related to assignment submission doubts to which authors can respond. All this would be taken care as email responses using a link provided in the email. This project does not cater to any live interactive session with spontaneous back-to-back questions and responses.&lt;br /&gt;
&lt;br /&gt;
Following tasks would be incorporated in the project:&lt;br /&gt;
* Provide a ‘TextArea’ input field on review forms, where any reviewer can type in their questions.&lt;br /&gt;
* Create a new button ‘Ask for Quick Help’ on the review forms.&lt;br /&gt;
* An email would be send to the author with the link where he can respond to the questions asked by the reviewers for their submitted work.&lt;br /&gt;
* Reviewers would be notified by an email when authors respond to the the questions.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Discussion of Resolution ===&lt;br /&gt;
Following modifications were made to implement the chat feature:- &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Create a new model which will help to extract, store and validate data in the database table which contains information about the interaction between the author/s and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Edit the view which is used by the response controller to incorporate the text area input field on the review form where the reviewer can ask his/her initial query.&lt;br /&gt;
&lt;br /&gt;
*Create a new controller with methods for authentication for a respective chat log only visible to the author and reviewer of a particular assignment, method to submit a response or a follow up query and show the existing interaction log.&lt;br /&gt;
&lt;br /&gt;
*Create a new helper with the e-mail methods for sending to the author and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Create a new view which will facilitate the author to respond to the queries asked by the reviewer. The reviewer can also use this view to ask any follow up questions.&lt;br /&gt;
&lt;br /&gt;
=== Design Patterns ===&lt;br /&gt;
The following design patterns were used for the solution:&lt;br /&gt;
 &lt;br /&gt;
* '''Observer Pattern'''&amp;lt;ref&amp;gt;Observer Design Pattern https://en.wikipedia.org/wiki/Observer_pattern&amp;lt;/ref&amp;gt;: The observer pattern is a software design pattern in which an object, called the subject, maintains a list of its dependents, called observers, and notifies them automatically of any state changes, usually by calling one of their methods. For example, we are notifying the team members whenever the reviewer submits the query.&lt;br /&gt;
&lt;br /&gt;
* '''Iterator Pattern''': In our instance, we need to display the entire chat history of a particular interaction, hence we can use the iterator design pattern to iterate through the previous chat messages.&lt;br /&gt;
&lt;br /&gt;
=== Database Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:Review_chats.png]]&lt;br /&gt;
&lt;br /&gt;
The above figure shows the schema of a new table which will be created in Expertiza to store relevant information about the chat. It contains the following attributes:&lt;br /&gt;
* id: This attribute is auto-generated by rails when we create a table and is auto incremented with each record. It is also the primary key of our table.&lt;br /&gt;
* assignment_id: Stores the ID of the assignment for which the interaction between author and reviewer is taking place.&lt;br /&gt;
* reviewer_id: Stores the ID of the reviewer who asks the questions.&lt;br /&gt;
* team_id: Stores the ID of the team to which the topic belongs.&lt;br /&gt;
* type_flag: Flag which is used to indicate if the particular tuple contains a question or answer. It can take two values, 'Q' for question and 'A' for answer.&lt;br /&gt;
* content: Stores the question asked by the reviewer or the response given by the author/s depending on the value of the type flag.&lt;br /&gt;
&lt;br /&gt;
Records for a particular interaction can be identified by using a combination of assignment_id, reviewer_id and team_id.&lt;br /&gt;
&lt;br /&gt;
=== Use Cases ===&lt;br /&gt;
'''Name:''' Send a question to the author/s about their work.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Reviewer. &amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The reviewer enters his question in the text area which is provided and clicks on the &amp;quot;Ask question&amp;quot; button which is provided as shown in the mock up. On clicking this button an email is sent to the author/s along which a link to answer the question.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''Name:''' Answer the question which has been asked by the reviewer.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Author/s&amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The author/s click on the link received in their email and are redirected to a page where they can answer the question. Once they submit the answer, an email is sent to the reviewer notifying him/her that their question has been answered.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:ARSNUsecase.jpeg]]&lt;br /&gt;
&lt;br /&gt;
=== Proposed Tests ===&lt;br /&gt;
1. For use case 1, test whether all the team members receive email with the question.&amp;lt;br/&amp;gt;&lt;br /&gt;
2. For use case 2, test whether the reviewer receive email with the response.&amp;lt;br/&amp;gt;&lt;br /&gt;
3. Test whether all the previous interactions are displayed as chat history.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
===Code Implementation===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*Create a new model '''review_chat.rb''' for ReviewChat.&lt;br /&gt;
&lt;br /&gt;
'''Validation'''- Check if the query box is not empty and restrict the query length to 255 characters.&lt;br /&gt;
&lt;br /&gt;
  validates_length_of :content , :maximum =&amp;gt; 255,message: &amp;quot;Length must be less that 255 characters&amp;quot;&lt;br /&gt;
  validates_presence_of :content, message: &amp;quot;Content cannot be blank&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*Create a new controller '''review_chats_controller.rb''' with the following methods:&lt;br /&gt;
&lt;br /&gt;
'''action_allowed?'''- Allow chat visibility to the reviewers and the authors of a particular interaction&lt;br /&gt;
&lt;br /&gt;
  def action_allowed?&lt;br /&gt;
    review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    allowed_users=Array.new&lt;br /&gt;
    team_id=review_chat.team_id&lt;br /&gt;
    teams_users = TeamsUser.where(team_id: team_id)&lt;br /&gt;
    teams_users.each do |teams_user|&lt;br /&gt;
      allowed_users &amp;lt;&amp;lt; User.find(teams_user.user_id).id&lt;br /&gt;
    end&lt;br /&gt;
    allowed_users &amp;lt;&amp;lt; Participant.find(review_chat.reviewer_id).user_id&lt;br /&gt;
    current_role_name.eql? 'Student' and allowed_users.include?(session[:user].id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''show'''- Show the chat interaction log&lt;br /&gt;
&lt;br /&gt;
  def show&lt;br /&gt;
    @review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    @assignment_id=@review_chat.assignment_id&lt;br /&gt;
    @reviewer_id=@review_chat.reviewer_id&lt;br /&gt;
    @team_id=@review_chat.team_id&lt;br /&gt;
    @chat_log=ReviewChat.where(:reviewer_id =&amp;gt; @reviewer_id).where(:team_id =&amp;gt; @team_id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''submitted_response'''- Create a chat record and send an email to the reviewer when an author replied to a query asked by the reviewer&lt;br /&gt;
&lt;br /&gt;
  def submitted_response&lt;br /&gt;
    @review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    @chat_reviewer=Participant.find(@review_chat.reviewer_id).user_id&lt;br /&gt;
    if(@chat_reviewer==session[:user].id) then&lt;br /&gt;
    	ReviewChat.create(:assignment_id =&amp;gt; @review_chat.assignment_id,:reviewer_id =&amp;gt; @review_chat.reviewer_id, :team_id=&amp;gt;@review_chat.team_id, :type_flag =&amp;gt; 'Q' , :content =&amp;gt; params[:response_area])&lt;br /&gt;
    	ReviewChatsHelper::chat_email_query(params[:id])&lt;br /&gt;
    	flash[:notice]=&amp;quot;Query has been submitted&amp;quot;	&lt;br /&gt;
    else	&lt;br /&gt;
      	ReviewChat.create(:assignment_id =&amp;gt; @review_chat.assignment_id,:reviewer_id =&amp;gt; @review_chat.reviewer_id, :team_id=&amp;gt;@review_chat.team_id, :type_flag =&amp;gt; 'A' , :content =&amp;gt; params[:response_area])&lt;br /&gt;
      	ReviewChatsHelper::chat_email_response(@review_chat.id,@chat_reviewer)&lt;br /&gt;
      flash[:notice]=&amp;quot;Response has been submitted&amp;quot;&lt;br /&gt;
    end	&lt;br /&gt;
    redirect_to action: 'show', id: params[:id]&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
*Create a helper file '''review_chats_helper.rb''' with the following methods:&lt;br /&gt;
&lt;br /&gt;
'''chat_email_response'''- Send an email to the author of an assignment when a reviewer posts a query&lt;br /&gt;
&lt;br /&gt;
  def self.chat_email_response(id,reviewer_id,partial=&amp;quot;new_chatemail&amp;quot;)&lt;br /&gt;
    defn = Hash.new&lt;br /&gt;
    defn[:body] = Hash.new&lt;br /&gt;
    defn[:body][:partial_name] = partial&lt;br /&gt;
    reviewer_email=User.find(reviewer_id).email&lt;br /&gt;
    defn[:subject] = &amp;quot;Response posted for submission&amp;quot;&lt;br /&gt;
    defn[:body][:type] = &amp;quot; response has been posted for your query .&lt;br /&gt;
    Please open the below URL to view.&lt;br /&gt;
    http://expertiza.ncsu.edu/review_chats/show/#{id}&amp;quot;&lt;br /&gt;
    defn[:to] = reviewer_email&lt;br /&gt;
    Mailer.sync_message(defn).deliver&lt;br /&gt;
  end &lt;br /&gt;
&lt;br /&gt;
'''chat_email_query'''- Send an email to the author of an assignment when a reviewer posts a query&lt;br /&gt;
&lt;br /&gt;
  def self.chat_email_query(id,partial=&amp;quot;new_chatemail&amp;quot;)&lt;br /&gt;
    defn = Hash.new&lt;br /&gt;
    defn[:body] = Hash.new&lt;br /&gt;
    defn[:body][:partial_name] = partial&lt;br /&gt;
    assignment=nil&lt;br /&gt;
    @team_id=ReviewChat.find(id).team_id&lt;br /&gt;
    teams_users = TeamsUser.where(team_id: @team_id)&lt;br /&gt;
    to_mail_list = Array.new&lt;br /&gt;
    teams_users.each do |teams_user|&lt;br /&gt;
    to_mail_list &amp;lt;&amp;lt; User.find(teams_user.user_id).email &lt;br /&gt;
    end&lt;br /&gt;
    defn[:subject] = &amp;quot;Query posted for submission&amp;quot;&lt;br /&gt;
    defn[:body][:type] = &amp;quot; query has been posted for your submission .&lt;br /&gt;
    Please open the below URL to view and respond.&lt;br /&gt;
    http://expertiza.ncsu.edu/review_chats/show/#{id}&amp;quot;&lt;br /&gt;
    defn[:to] = to_mail_list&lt;br /&gt;
    Mailer.sync_message(defn).deliver&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
*Modify existing controller '''response_controller.rb''' and add a new method.&lt;br /&gt;
&lt;br /&gt;
'''initiate_chat'''- Create a chat record and send an email to the authors when a reviewer posts a query.&lt;br /&gt;
  def initiate_chat&lt;br /&gt;
      @map = ResponseMap.find(params[:id])&lt;br /&gt;
      ReviewChat.create( :response_map_id=&amp;gt;@map.id, :type_flag =&amp;gt; 'Q' , :content =&amp;gt; params[:review_question])&lt;br /&gt;
      flash[:notice]=&amp;quot;Question has been submitted to Author&amp;quot;&lt;br /&gt;
      @interaction_id=ReviewChat.where(:response_map_id =&amp;gt; @map.id)&lt;br /&gt;
      ReviewChatsHelper::chat_email_query(@interaction_id.first.id)&lt;br /&gt;
      redirect_to action: 'new', id: params[:id]&lt;br /&gt;
  end&lt;br /&gt;
*Create a new view '''show.html.erb''' to show the existing chat record and a box to respond and ask a follow up query.&lt;br /&gt;
&lt;br /&gt;
===Flowchart===&lt;br /&gt;
&lt;br /&gt;
[[File: ARSNFlowchart1.png]]&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
===User Interface Testing===&lt;br /&gt;
&lt;br /&gt;
* Login to Expertiza with a student account. You can use login id as 'student5700' and password as 'password'.&lt;br /&gt;
* Start reviewing an existing assignment. You would see a small query box at the bottom of the page.&lt;br /&gt;
*The reviewer enters his question in the text area provided and clicks on the &amp;quot;Submit&amp;quot; button.&lt;br /&gt;
[[File: FinalProject1.jpg]]&lt;br /&gt;
*On clicking this button the appropriate method is called in ReviewChats controller which sends an email to all the authors of the topic indicating that a question has been asked about their work. The email contains a link which when clicked on will redirect the author to the appropriate view where he/she can answer the question.&lt;br /&gt;
[[File: FinalProject4.jpg]]&lt;br /&gt;
*On answering the question, the reviewer receives an email indicating that his question has been answered. It also contains a link which redirects the reviewer to the appropriate view where the answer will be displayed.&lt;br /&gt;
*The authorized users will also be able to see a link to open existing chat interaction log.&lt;br /&gt;
[[File: FinalProject3.jpg]]&lt;br /&gt;
*This view also contains the chat history between the author/s and the reviewer for the entire duration of the interaction.&lt;br /&gt;
[[File: FinalProject2.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Model Testing===&lt;br /&gt;
&lt;br /&gt;
* Create a model test file '''review_chat_test.rb''' with the below tests.&lt;br /&gt;
'''Presence of assignment_id'''&lt;br /&gt;
&lt;br /&gt;
  test &amp;quot;assignment_id should be present&amp;quot; do&lt;br /&gt;
    @review_chat.assignment_id = &amp;quot; &amp;quot;&lt;br /&gt;
    assert_not @review_chat.assignment_id?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Presence of reviewer_id'''&lt;br /&gt;
&lt;br /&gt;
  test &amp;quot;reviewer_id should be present&amp;quot; do&lt;br /&gt;
    @review_chat.reviewer_id = &amp;quot; &amp;quot;&lt;br /&gt;
    assert_not @review_chat.reviewer_id?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Presence of team_id'''&lt;br /&gt;
&lt;br /&gt;
  test &amp;quot;team_id should be present&amp;quot; do&lt;br /&gt;
    @review_chat.team_id = &amp;quot; &amp;quot;&lt;br /&gt;
    assert_not @review_chat.team_id?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Presence of content'''&lt;br /&gt;
&lt;br /&gt;
  test &amp;quot;content should be present (nonblank)&amp;quot; do&lt;br /&gt;
    @review_chat.content = &amp;quot; &amp;quot; * 6&lt;br /&gt;
    assert_not @review_chat.valid?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Length of content'''&lt;br /&gt;
&lt;br /&gt;
  test &amp;quot;content should have a maximum length of 255&amp;quot; do&lt;br /&gt;
    @review_chat.content = &amp;quot;a&amp;quot; * 250&lt;br /&gt;
    assert @review_chat.valid?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
* To run the tests,&lt;br /&gt;
  bin/rake test test/models/review_chat_test.rb&lt;br /&gt;
&lt;br /&gt;
===Web Testing===&lt;br /&gt;
&lt;br /&gt;
* Create a browser automation test using [http://imacros.net/overview imacros] in Firefox/Chrome browser.&lt;br /&gt;
* Run the simulation to test the Expertiza chat operation in the browser.&lt;br /&gt;
&lt;br /&gt;
== Suggestions for Future Improvements ==&lt;br /&gt;
&lt;br /&gt;
* This can be extended to a live interactive author-reviewer anonymous chat session inside the Expertiza reviews window.&lt;br /&gt;
* A purging script can be developed which will clear all the interaction records every semester.&lt;br /&gt;
&lt;br /&gt;
==Resources==&lt;br /&gt;
&lt;br /&gt;
* Expertiza Github repository&amp;lt;ref&amp;gt;Expertiza Github repository https://github.com/expertiza/expertiza&amp;lt;/ref&amp;gt;&lt;br /&gt;
* Demo video&amp;lt;ref&amp;gt;Demo video https://www.youtube.com/watch?v=8E-hYiJVoZI&amp;lt;/ref&amp;gt;&lt;br /&gt;
* Github Pull request&amp;lt;ref&amp;gt;Github Pull request https://github.com/expertiza/expertiza/pull/628&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sgulati2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100396</id>
		<title>CSC/ECE 517 Fall 2015 E1586 AnonymousChatBetweenAuthorAndReviewer</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100396"/>
		<updated>2015-12-07T08:15:41Z</updated>

		<summary type="html">&lt;p&gt;Sgulati2: /* Web Testing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1586 AnonymousChatBetweenAuthorAndReviewer'''&lt;br /&gt;
&lt;br /&gt;
This page provides a brief description of the '''Expertiza''' project. The project is aimed at developing an email based anonymous session between author and a reviewer so that reviewers can ask questions to the authors for any doubts related to the assignments during peer reviewing.&lt;br /&gt;
&lt;br /&gt;
==Project==&lt;br /&gt;
&lt;br /&gt;
=== Introduction to Expertiza ===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a peer review based system which provides an incremental class based learning together with the instructors and the peers. This project has been developed together by faculty and students using [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza handles assignment submissions, team formations, assignment reviews and grades, etc.&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
During reviews, many times reviewers will be having questions about the submitted material and if it's a blocker there is no way that the reviewer can progress further with the review.  As a result, reviewers will end up submitting the empty or incomplete review.&lt;br /&gt;
&lt;br /&gt;
=== Scope ===&lt;br /&gt;
This project is limited to an email based conversation for asking questions and answers. The reviewers would ask questions related to assignment submission doubts to which authors can respond. All this would be taken care as email responses using a link provided in the email. This project does not cater to any live interactive session with spontaneous back-to-back questions and responses.&lt;br /&gt;
&lt;br /&gt;
Following tasks would be incorporated in the project:&lt;br /&gt;
* Provide a ‘TextArea’ input field on review forms, where any reviewer can type in their questions.&lt;br /&gt;
* Create a new button ‘Ask for Quick Help’ on the review forms.&lt;br /&gt;
* An email would be send to the author with the link where he can respond to the questions asked by the reviewers for their submitted work.&lt;br /&gt;
* Reviewers would be notified by an email when authors respond to the the questions.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Discussion of Resolution ===&lt;br /&gt;
Following modifications were made to implement the chat feature:- &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Create a new model which will help to extract, store and validate data in the database table which contains information about the interaction between the author/s and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Edit the view which is used by the response controller to incorporate the text area input field on the review form where the reviewer can ask his/her initial query.&lt;br /&gt;
&lt;br /&gt;
*Create a new controller with methods for authentication for a respective chat log only visible to the author and reviewer of a particular assignment, method to submit a response or a follow up query and show the existing interaction log.&lt;br /&gt;
&lt;br /&gt;
*Create a new helper with the e-mail methods for sending to the author and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Create a new view which will facilitate the author to respond to the queries asked by the reviewer. The reviewer can also use this view to ask any follow up questions.&lt;br /&gt;
&lt;br /&gt;
=== Design Patterns ===&lt;br /&gt;
The following design patterns were used for the solution:&lt;br /&gt;
 &lt;br /&gt;
* '''Observer Pattern'''&amp;lt;ref&amp;gt;Observer Design Pattern https://en.wikipedia.org/wiki/Observer_pattern&amp;lt;/ref&amp;gt;: The observer pattern is a software design pattern in which an object, called the subject, maintains a list of its dependents, called observers, and notifies them automatically of any state changes, usually by calling one of their methods. For example, we are notifying the team members whenever the reviewer submits the query.&lt;br /&gt;
&lt;br /&gt;
* '''Iterator Pattern''': In our instance, we need to display the entire chat history of a particular interaction, hence we can use the iterator design pattern to iterate through the previous chat messages.&lt;br /&gt;
&lt;br /&gt;
=== Database Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:Review_chats.png]]&lt;br /&gt;
&lt;br /&gt;
The above figure shows the schema of a new table which will be created in Expertiza to store relevant information about the chat. It contains the following attributes:&lt;br /&gt;
* id: This attribute is auto-generated by rails when we create a table and is auto incremented with each record. It is also the primary key of our table.&lt;br /&gt;
* assignment_id: Stores the ID of the assignment for which the interaction between author and reviewer is taking place.&lt;br /&gt;
* reviewer_id: Stores the ID of the reviewer who asks the questions.&lt;br /&gt;
* team_id: Stores the ID of the team to which the topic belongs.&lt;br /&gt;
* type_flag: Flag which is used to indicate if the particular tuple contains a question or answer. It can take two values, 'Q' for question and 'A' for answer.&lt;br /&gt;
* content: Stores the question asked by the reviewer or the response given by the author/s depending on the value of the type flag.&lt;br /&gt;
&lt;br /&gt;
Records for a particular interaction can be identified by using a combination of assignment_id, reviewer_id and team_id.&lt;br /&gt;
&lt;br /&gt;
=== Use Cases ===&lt;br /&gt;
'''Name:''' Send a question to the author/s about their work.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Reviewer. &amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The reviewer enters his question in the text area which is provided and clicks on the &amp;quot;Ask question&amp;quot; button which is provided as shown in the mock up. On clicking this button an email is sent to the author/s along which a link to answer the question.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''Name:''' Answer the question which has been asked by the reviewer.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Author/s&amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The author/s click on the link received in their email and are redirected to a page where they can answer the question. Once they submit the answer, an email is sent to the reviewer notifying him/her that their question has been answered.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:ARSNUsecase.jpeg]]&lt;br /&gt;
&lt;br /&gt;
=== Proposed Tests ===&lt;br /&gt;
1. For use case 1, test whether all the team members receive email with the question.&amp;lt;br/&amp;gt;&lt;br /&gt;
2. For use case 2, test whether the reviewer receive email with the response.&amp;lt;br/&amp;gt;&lt;br /&gt;
3. Test whether all the previous interactions are displayed as chat history.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
===Code Implementation===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*Create a new model '''review_chat.rb''' for ReviewChat.&lt;br /&gt;
&lt;br /&gt;
'''Validation'''- Check if the query box is not empty and restrict the query length to 255 characters.&lt;br /&gt;
&lt;br /&gt;
  validates_length_of :content , :maximum =&amp;gt; 255,message: &amp;quot;Length must be less that 255 characters&amp;quot;&lt;br /&gt;
  validates_presence_of :content, message: &amp;quot;Content cannot be blank&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*Create a new controller '''review_chats_controller.rb''' with the following methods:&lt;br /&gt;
&lt;br /&gt;
'''action_allowed?'''- Allow chat visibility to the reviewers and the authors of a particular interaction&lt;br /&gt;
&lt;br /&gt;
  def action_allowed?&lt;br /&gt;
    review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    allowed_users=Array.new&lt;br /&gt;
    team_id=review_chat.team_id&lt;br /&gt;
    teams_users = TeamsUser.where(team_id: team_id)&lt;br /&gt;
    teams_users.each do |teams_user|&lt;br /&gt;
      allowed_users &amp;lt;&amp;lt; User.find(teams_user.user_id).id&lt;br /&gt;
    end&lt;br /&gt;
    allowed_users &amp;lt;&amp;lt; Participant.find(review_chat.reviewer_id).user_id&lt;br /&gt;
    current_role_name.eql? 'Student' and allowed_users.include?(session[:user].id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''show'''- Show the chat interaction log&lt;br /&gt;
&lt;br /&gt;
  def show&lt;br /&gt;
    @review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    @assignment_id=@review_chat.assignment_id&lt;br /&gt;
    @reviewer_id=@review_chat.reviewer_id&lt;br /&gt;
    @team_id=@review_chat.team_id&lt;br /&gt;
    @chat_log=ReviewChat.where(:reviewer_id =&amp;gt; @reviewer_id).where(:team_id =&amp;gt; @team_id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''submitted_response'''- Create a chat record and send an email to the reviewer when an author replied to a query asked by the reviewer&lt;br /&gt;
&lt;br /&gt;
  def submitted_response&lt;br /&gt;
    @review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    @chat_reviewer=Participant.find(@review_chat.reviewer_id).user_id&lt;br /&gt;
    if(@chat_reviewer==session[:user].id) then&lt;br /&gt;
    	ReviewChat.create(:assignment_id =&amp;gt; @review_chat.assignment_id,:reviewer_id =&amp;gt; @review_chat.reviewer_id, :team_id=&amp;gt;@review_chat.team_id, :type_flag =&amp;gt; 'Q' , :content =&amp;gt; params[:response_area])&lt;br /&gt;
    	ReviewChatsHelper::chat_email_query(params[:id])&lt;br /&gt;
    	flash[:notice]=&amp;quot;Query has been submitted&amp;quot;	&lt;br /&gt;
    else	&lt;br /&gt;
      	ReviewChat.create(:assignment_id =&amp;gt; @review_chat.assignment_id,:reviewer_id =&amp;gt; @review_chat.reviewer_id, :team_id=&amp;gt;@review_chat.team_id, :type_flag =&amp;gt; 'A' , :content =&amp;gt; params[:response_area])&lt;br /&gt;
      	ReviewChatsHelper::chat_email_response(@review_chat.id,@chat_reviewer)&lt;br /&gt;
      flash[:notice]=&amp;quot;Response has been submitted&amp;quot;&lt;br /&gt;
    end	&lt;br /&gt;
    redirect_to action: 'show', id: params[:id]&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
*Create a helper file '''review_chats_helper.rb''' with the following methods:&lt;br /&gt;
&lt;br /&gt;
'''chat_email_response'''- Send an email to the author of an assignment when a reviewer posts a query&lt;br /&gt;
&lt;br /&gt;
  def self.chat_email_response(id,reviewer_id,partial=&amp;quot;new_chatemail&amp;quot;)&lt;br /&gt;
    defn = Hash.new&lt;br /&gt;
    defn[:body] = Hash.new&lt;br /&gt;
    defn[:body][:partial_name] = partial&lt;br /&gt;
    reviewer_email=User.find(reviewer_id).email&lt;br /&gt;
    defn[:subject] = &amp;quot;Response posted for submission&amp;quot;&lt;br /&gt;
    defn[:body][:type] = &amp;quot; response has been posted for your query .&lt;br /&gt;
    Please open the below URL to view.&lt;br /&gt;
    http://expertiza.ncsu.edu/review_chats/show/#{id}&amp;quot;&lt;br /&gt;
    defn[:to] = reviewer_email&lt;br /&gt;
    Mailer.sync_message(defn).deliver&lt;br /&gt;
  end &lt;br /&gt;
&lt;br /&gt;
'''chat_email_query'''- Send an email to the author of an assignment when a reviewer posts a query&lt;br /&gt;
&lt;br /&gt;
  def self.chat_email_query(id,partial=&amp;quot;new_chatemail&amp;quot;)&lt;br /&gt;
    defn = Hash.new&lt;br /&gt;
    defn[:body] = Hash.new&lt;br /&gt;
    defn[:body][:partial_name] = partial&lt;br /&gt;
    assignment=nil&lt;br /&gt;
    @team_id=ReviewChat.find(id).team_id&lt;br /&gt;
    teams_users = TeamsUser.where(team_id: @team_id)&lt;br /&gt;
    to_mail_list = Array.new&lt;br /&gt;
    teams_users.each do |teams_user|&lt;br /&gt;
    to_mail_list &amp;lt;&amp;lt; User.find(teams_user.user_id).email &lt;br /&gt;
    end&lt;br /&gt;
    defn[:subject] = &amp;quot;Query posted for submission&amp;quot;&lt;br /&gt;
    defn[:body][:type] = &amp;quot; query has been posted for your submission .&lt;br /&gt;
    Please open the below URL to view and respond.&lt;br /&gt;
    http://expertiza.ncsu.edu/review_chats/show/#{id}&amp;quot;&lt;br /&gt;
    defn[:to] = to_mail_list&lt;br /&gt;
    Mailer.sync_message(defn).deliver&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
*Modify existing controller '''response_controller.rb''' and add a new method.&lt;br /&gt;
&lt;br /&gt;
'''submitted_question'''- Create a chat record and send an email to the authors when a reviewer posts a query.&lt;br /&gt;
  def submitted_question&lt;br /&gt;
      @map = ResponseMap.find(params[:id])&lt;br /&gt;
      ReviewChat.create(:assignment_id =&amp;gt; @map.assignment.id,:reviewer_id =&amp;gt; @map.reviewer_id, :team_id=&amp;gt;@map.reviewee_id, :type_flag =&amp;gt; 'Q' , :content =&amp;gt; params[:review_question])&lt;br /&gt;
      flash[:notice]=&amp;quot;Question has been submitted to Author&amp;quot;&lt;br /&gt;
      @interaction_id=ReviewChat.where(:reviewer_id =&amp;gt; @map.reviewer_id).where(:team_id =&amp;gt; @map.reviewee_id)&lt;br /&gt;
      ReviewChatsHelper::chat_email_query(@interaction_id.first.id)&lt;br /&gt;
      redirect_to action: 'new', id: params[:id]&lt;br /&gt;
  end&lt;br /&gt;
*Create a new view '''show.html.erb''' to show the existing chat record and a box to respond and ask a follow up query.&lt;br /&gt;
&lt;br /&gt;
===Flowchart===&lt;br /&gt;
&lt;br /&gt;
[[File: ARSNFlowchart1.png]]&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
===User Interface Testing===&lt;br /&gt;
&lt;br /&gt;
* Login to Expertiza with a student account. You can use login id as 'student5700' and password as 'password'.&lt;br /&gt;
* Start reviewing an existing assignment. You would see a small query box at the bottom of the page.&lt;br /&gt;
*The reviewer enters his question in the text area provided and clicks on the &amp;quot;Submit&amp;quot; button.&lt;br /&gt;
[[File: FinalProject1.jpg]]&lt;br /&gt;
*On clicking this button the appropriate method is called in ReviewChats controller which sends an email to all the authors of the topic indicating that a question has been asked about their work. The email contains a link which when clicked on will redirect the author to the appropriate view where he/she can answer the question.&lt;br /&gt;
[[File: FinalProject4.jpg]]&lt;br /&gt;
*On answering the question, the reviewer receives an email indicating that his question has been answered. It also contains a link which redirects the reviewer to the appropriate view where the answer will be displayed.&lt;br /&gt;
*The authorized users will also be able to see a link to open existing chat interaction log.&lt;br /&gt;
[[File: FinalProject3.jpg]]&lt;br /&gt;
*This view also contains the chat history between the author/s and the reviewer for the entire duration of the interaction.&lt;br /&gt;
[[File: FinalProject2.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Model Testing===&lt;br /&gt;
&lt;br /&gt;
* Create a model test file '''review_chat_test.rb''' with the below tests.&lt;br /&gt;
'''Presence of assignment_id'''&lt;br /&gt;
&lt;br /&gt;
  test &amp;quot;assignment_id should be present&amp;quot; do&lt;br /&gt;
    @review_chat.assignment_id = &amp;quot; &amp;quot;&lt;br /&gt;
    assert_not @review_chat.assignment_id?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Presence of reviewer_id'''&lt;br /&gt;
&lt;br /&gt;
  test &amp;quot;reviewer_id should be present&amp;quot; do&lt;br /&gt;
    @review_chat.reviewer_id = &amp;quot; &amp;quot;&lt;br /&gt;
    assert_not @review_chat.reviewer_id?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Presence of team_id'''&lt;br /&gt;
&lt;br /&gt;
  test &amp;quot;team_id should be present&amp;quot; do&lt;br /&gt;
    @review_chat.team_id = &amp;quot; &amp;quot;&lt;br /&gt;
    assert_not @review_chat.team_id?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Presence of content'''&lt;br /&gt;
&lt;br /&gt;
  test &amp;quot;content should be present (nonblank)&amp;quot; do&lt;br /&gt;
    @review_chat.content = &amp;quot; &amp;quot; * 6&lt;br /&gt;
    assert_not @review_chat.valid?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Length of content'''&lt;br /&gt;
&lt;br /&gt;
  test &amp;quot;content should have a maximum length of 255&amp;quot; do&lt;br /&gt;
    @review_chat.content = &amp;quot;a&amp;quot; * 250&lt;br /&gt;
    assert @review_chat.valid?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
* To run the tests,&lt;br /&gt;
  bin/rake test test/models/review_chat_test.rb&lt;br /&gt;
&lt;br /&gt;
===Web Testing===&lt;br /&gt;
&lt;br /&gt;
* Create a browser automation test using [http://imacros.net/overview imacros] in Firefox/Chrome browser.&lt;br /&gt;
* Run the simulation to test the Expertiza chat operation in the browser.&lt;br /&gt;
&lt;br /&gt;
== Suggestions for Future Improvements ==&lt;br /&gt;
&lt;br /&gt;
* This can be extended to a live interactive author-reviewer anonymous chat session inside the Expertiza reviews window.&lt;br /&gt;
* A purging script can be developed which will clear all the interaction records every semester.&lt;br /&gt;
&lt;br /&gt;
==Resources==&lt;br /&gt;
&lt;br /&gt;
* Expertiza Github repository&amp;lt;ref&amp;gt;Expertiza Github repository https://github.com/expertiza/expertiza&amp;lt;/ref&amp;gt;&lt;br /&gt;
* Demo video&amp;lt;ref&amp;gt;Demo video https://www.youtube.com/watch?v=8E-hYiJVoZI&amp;lt;/ref&amp;gt;&lt;br /&gt;
* Github Pull request&amp;lt;ref&amp;gt;Github Pull request https://github.com/expertiza/expertiza/pull/628&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sgulati2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100395</id>
		<title>CSC/ECE 517 Fall 2015 E1586 AnonymousChatBetweenAuthorAndReviewer</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100395"/>
		<updated>2015-12-07T08:15:21Z</updated>

		<summary type="html">&lt;p&gt;Sgulati2: /* Web Testing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1586 AnonymousChatBetweenAuthorAndReviewer'''&lt;br /&gt;
&lt;br /&gt;
This page provides a brief description of the '''Expertiza''' project. The project is aimed at developing an email based anonymous session between author and a reviewer so that reviewers can ask questions to the authors for any doubts related to the assignments during peer reviewing.&lt;br /&gt;
&lt;br /&gt;
==Project==&lt;br /&gt;
&lt;br /&gt;
=== Introduction to Expertiza ===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a peer review based system which provides an incremental class based learning together with the instructors and the peers. This project has been developed together by faculty and students using [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza handles assignment submissions, team formations, assignment reviews and grades, etc.&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
During reviews, many times reviewers will be having questions about the submitted material and if it's a blocker there is no way that the reviewer can progress further with the review.  As a result, reviewers will end up submitting the empty or incomplete review.&lt;br /&gt;
&lt;br /&gt;
=== Scope ===&lt;br /&gt;
This project is limited to an email based conversation for asking questions and answers. The reviewers would ask questions related to assignment submission doubts to which authors can respond. All this would be taken care as email responses using a link provided in the email. This project does not cater to any live interactive session with spontaneous back-to-back questions and responses.&lt;br /&gt;
&lt;br /&gt;
Following tasks would be incorporated in the project:&lt;br /&gt;
* Provide a ‘TextArea’ input field on review forms, where any reviewer can type in their questions.&lt;br /&gt;
* Create a new button ‘Ask for Quick Help’ on the review forms.&lt;br /&gt;
* An email would be send to the author with the link where he can respond to the questions asked by the reviewers for their submitted work.&lt;br /&gt;
* Reviewers would be notified by an email when authors respond to the the questions.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Discussion of Resolution ===&lt;br /&gt;
Following modifications were made to implement the chat feature:- &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Create a new model which will help to extract, store and validate data in the database table which contains information about the interaction between the author/s and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Edit the view which is used by the response controller to incorporate the text area input field on the review form where the reviewer can ask his/her initial query.&lt;br /&gt;
&lt;br /&gt;
*Create a new controller with methods for authentication for a respective chat log only visible to the author and reviewer of a particular assignment, method to submit a response or a follow up query and show the existing interaction log.&lt;br /&gt;
&lt;br /&gt;
*Create a new helper with the e-mail methods for sending to the author and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Create a new view which will facilitate the author to respond to the queries asked by the reviewer. The reviewer can also use this view to ask any follow up questions.&lt;br /&gt;
&lt;br /&gt;
=== Design Patterns ===&lt;br /&gt;
The following design patterns were used for the solution:&lt;br /&gt;
 &lt;br /&gt;
* '''Observer Pattern'''&amp;lt;ref&amp;gt;Observer Design Pattern https://en.wikipedia.org/wiki/Observer_pattern&amp;lt;/ref&amp;gt;: The observer pattern is a software design pattern in which an object, called the subject, maintains a list of its dependents, called observers, and notifies them automatically of any state changes, usually by calling one of their methods. For example, we are notifying the team members whenever the reviewer submits the query.&lt;br /&gt;
&lt;br /&gt;
* '''Iterator Pattern''': In our instance, we need to display the entire chat history of a particular interaction, hence we can use the iterator design pattern to iterate through the previous chat messages.&lt;br /&gt;
&lt;br /&gt;
=== Database Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:Review_chats.png]]&lt;br /&gt;
&lt;br /&gt;
The above figure shows the schema of a new table which will be created in Expertiza to store relevant information about the chat. It contains the following attributes:&lt;br /&gt;
* id: This attribute is auto-generated by rails when we create a table and is auto incremented with each record. It is also the primary key of our table.&lt;br /&gt;
* assignment_id: Stores the ID of the assignment for which the interaction between author and reviewer is taking place.&lt;br /&gt;
* reviewer_id: Stores the ID of the reviewer who asks the questions.&lt;br /&gt;
* team_id: Stores the ID of the team to which the topic belongs.&lt;br /&gt;
* type_flag: Flag which is used to indicate if the particular tuple contains a question or answer. It can take two values, 'Q' for question and 'A' for answer.&lt;br /&gt;
* content: Stores the question asked by the reviewer or the response given by the author/s depending on the value of the type flag.&lt;br /&gt;
&lt;br /&gt;
Records for a particular interaction can be identified by using a combination of assignment_id, reviewer_id and team_id.&lt;br /&gt;
&lt;br /&gt;
=== Use Cases ===&lt;br /&gt;
'''Name:''' Send a question to the author/s about their work.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Reviewer. &amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The reviewer enters his question in the text area which is provided and clicks on the &amp;quot;Ask question&amp;quot; button which is provided as shown in the mock up. On clicking this button an email is sent to the author/s along which a link to answer the question.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''Name:''' Answer the question which has been asked by the reviewer.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Author/s&amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The author/s click on the link received in their email and are redirected to a page where they can answer the question. Once they submit the answer, an email is sent to the reviewer notifying him/her that their question has been answered.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:ARSNUsecase.jpeg]]&lt;br /&gt;
&lt;br /&gt;
=== Proposed Tests ===&lt;br /&gt;
1. For use case 1, test whether all the team members receive email with the question.&amp;lt;br/&amp;gt;&lt;br /&gt;
2. For use case 2, test whether the reviewer receive email with the response.&amp;lt;br/&amp;gt;&lt;br /&gt;
3. Test whether all the previous interactions are displayed as chat history.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
===Code Implementation===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*Create a new model '''review_chat.rb''' for ReviewChat.&lt;br /&gt;
&lt;br /&gt;
'''Validation'''- Check if the query box is not empty and restrict the query length to 255 characters.&lt;br /&gt;
&lt;br /&gt;
  validates_length_of :content , :maximum =&amp;gt; 255,message: &amp;quot;Length must be less that 255 characters&amp;quot;&lt;br /&gt;
  validates_presence_of :content, message: &amp;quot;Content cannot be blank&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*Create a new controller '''review_chats_controller.rb''' with the following methods:&lt;br /&gt;
&lt;br /&gt;
'''action_allowed?'''- Allow chat visibility to the reviewers and the authors of a particular interaction&lt;br /&gt;
&lt;br /&gt;
  def action_allowed?&lt;br /&gt;
    review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    allowed_users=Array.new&lt;br /&gt;
    team_id=review_chat.team_id&lt;br /&gt;
    teams_users = TeamsUser.where(team_id: team_id)&lt;br /&gt;
    teams_users.each do |teams_user|&lt;br /&gt;
      allowed_users &amp;lt;&amp;lt; User.find(teams_user.user_id).id&lt;br /&gt;
    end&lt;br /&gt;
    allowed_users &amp;lt;&amp;lt; Participant.find(review_chat.reviewer_id).user_id&lt;br /&gt;
    current_role_name.eql? 'Student' and allowed_users.include?(session[:user].id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''show'''- Show the chat interaction log&lt;br /&gt;
&lt;br /&gt;
  def show&lt;br /&gt;
    @review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    @assignment_id=@review_chat.assignment_id&lt;br /&gt;
    @reviewer_id=@review_chat.reviewer_id&lt;br /&gt;
    @team_id=@review_chat.team_id&lt;br /&gt;
    @chat_log=ReviewChat.where(:reviewer_id =&amp;gt; @reviewer_id).where(:team_id =&amp;gt; @team_id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''submitted_response'''- Create a chat record and send an email to the reviewer when an author replied to a query asked by the reviewer&lt;br /&gt;
&lt;br /&gt;
  def submitted_response&lt;br /&gt;
    @review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    @chat_reviewer=Participant.find(@review_chat.reviewer_id).user_id&lt;br /&gt;
    if(@chat_reviewer==session[:user].id) then&lt;br /&gt;
    	ReviewChat.create(:assignment_id =&amp;gt; @review_chat.assignment_id,:reviewer_id =&amp;gt; @review_chat.reviewer_id, :team_id=&amp;gt;@review_chat.team_id, :type_flag =&amp;gt; 'Q' , :content =&amp;gt; params[:response_area])&lt;br /&gt;
    	ReviewChatsHelper::chat_email_query(params[:id])&lt;br /&gt;
    	flash[:notice]=&amp;quot;Query has been submitted&amp;quot;	&lt;br /&gt;
    else	&lt;br /&gt;
      	ReviewChat.create(:assignment_id =&amp;gt; @review_chat.assignment_id,:reviewer_id =&amp;gt; @review_chat.reviewer_id, :team_id=&amp;gt;@review_chat.team_id, :type_flag =&amp;gt; 'A' , :content =&amp;gt; params[:response_area])&lt;br /&gt;
      	ReviewChatsHelper::chat_email_response(@review_chat.id,@chat_reviewer)&lt;br /&gt;
      flash[:notice]=&amp;quot;Response has been submitted&amp;quot;&lt;br /&gt;
    end	&lt;br /&gt;
    redirect_to action: 'show', id: params[:id]&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
*Create a helper file '''review_chats_helper.rb''' with the following methods:&lt;br /&gt;
&lt;br /&gt;
'''chat_email_response'''- Send an email to the author of an assignment when a reviewer posts a query&lt;br /&gt;
&lt;br /&gt;
  def self.chat_email_response(id,reviewer_id,partial=&amp;quot;new_chatemail&amp;quot;)&lt;br /&gt;
    defn = Hash.new&lt;br /&gt;
    defn[:body] = Hash.new&lt;br /&gt;
    defn[:body][:partial_name] = partial&lt;br /&gt;
    reviewer_email=User.find(reviewer_id).email&lt;br /&gt;
    defn[:subject] = &amp;quot;Response posted for submission&amp;quot;&lt;br /&gt;
    defn[:body][:type] = &amp;quot; response has been posted for your query .&lt;br /&gt;
    Please open the below URL to view.&lt;br /&gt;
    http://expertiza.ncsu.edu/review_chats/show/#{id}&amp;quot;&lt;br /&gt;
    defn[:to] = reviewer_email&lt;br /&gt;
    Mailer.sync_message(defn).deliver&lt;br /&gt;
  end &lt;br /&gt;
&lt;br /&gt;
'''chat_email_query'''- Send an email to the author of an assignment when a reviewer posts a query&lt;br /&gt;
&lt;br /&gt;
  def self.chat_email_query(id,partial=&amp;quot;new_chatemail&amp;quot;)&lt;br /&gt;
    defn = Hash.new&lt;br /&gt;
    defn[:body] = Hash.new&lt;br /&gt;
    defn[:body][:partial_name] = partial&lt;br /&gt;
    assignment=nil&lt;br /&gt;
    @team_id=ReviewChat.find(id).team_id&lt;br /&gt;
    teams_users = TeamsUser.where(team_id: @team_id)&lt;br /&gt;
    to_mail_list = Array.new&lt;br /&gt;
    teams_users.each do |teams_user|&lt;br /&gt;
    to_mail_list &amp;lt;&amp;lt; User.find(teams_user.user_id).email &lt;br /&gt;
    end&lt;br /&gt;
    defn[:subject] = &amp;quot;Query posted for submission&amp;quot;&lt;br /&gt;
    defn[:body][:type] = &amp;quot; query has been posted for your submission .&lt;br /&gt;
    Please open the below URL to view and respond.&lt;br /&gt;
    http://expertiza.ncsu.edu/review_chats/show/#{id}&amp;quot;&lt;br /&gt;
    defn[:to] = to_mail_list&lt;br /&gt;
    Mailer.sync_message(defn).deliver&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
*Modify existing controller '''response_controller.rb''' and add a new method.&lt;br /&gt;
&lt;br /&gt;
'''submitted_question'''- Create a chat record and send an email to the authors when a reviewer posts a query.&lt;br /&gt;
  def submitted_question&lt;br /&gt;
      @map = ResponseMap.find(params[:id])&lt;br /&gt;
      ReviewChat.create(:assignment_id =&amp;gt; @map.assignment.id,:reviewer_id =&amp;gt; @map.reviewer_id, :team_id=&amp;gt;@map.reviewee_id, :type_flag =&amp;gt; 'Q' , :content =&amp;gt; params[:review_question])&lt;br /&gt;
      flash[:notice]=&amp;quot;Question has been submitted to Author&amp;quot;&lt;br /&gt;
      @interaction_id=ReviewChat.where(:reviewer_id =&amp;gt; @map.reviewer_id).where(:team_id =&amp;gt; @map.reviewee_id)&lt;br /&gt;
      ReviewChatsHelper::chat_email_query(@interaction_id.first.id)&lt;br /&gt;
      redirect_to action: 'new', id: params[:id]&lt;br /&gt;
  end&lt;br /&gt;
*Create a new view '''show.html.erb''' to show the existing chat record and a box to respond and ask a follow up query.&lt;br /&gt;
&lt;br /&gt;
===Flowchart===&lt;br /&gt;
&lt;br /&gt;
[[File: ARSNFlowchart1.png]]&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
===User Interface Testing===&lt;br /&gt;
&lt;br /&gt;
* Login to Expertiza with a student account. You can use login id as 'student5700' and password as 'password'.&lt;br /&gt;
* Start reviewing an existing assignment. You would see a small query box at the bottom of the page.&lt;br /&gt;
*The reviewer enters his question in the text area provided and clicks on the &amp;quot;Submit&amp;quot; button.&lt;br /&gt;
[[File: FinalProject1.jpg]]&lt;br /&gt;
*On clicking this button the appropriate method is called in ReviewChats controller which sends an email to all the authors of the topic indicating that a question has been asked about their work. The email contains a link which when clicked on will redirect the author to the appropriate view where he/she can answer the question.&lt;br /&gt;
[[File: FinalProject4.jpg]]&lt;br /&gt;
*On answering the question, the reviewer receives an email indicating that his question has been answered. It also contains a link which redirects the reviewer to the appropriate view where the answer will be displayed.&lt;br /&gt;
*The authorized users will also be able to see a link to open existing chat interaction log.&lt;br /&gt;
[[File: FinalProject3.jpg]]&lt;br /&gt;
*This view also contains the chat history between the author/s and the reviewer for the entire duration of the interaction.&lt;br /&gt;
[[File: FinalProject2.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Model Testing===&lt;br /&gt;
&lt;br /&gt;
* Create a model test file '''review_chat_test.rb''' with the below tests.&lt;br /&gt;
'''Presence of assignment_id'''&lt;br /&gt;
&lt;br /&gt;
  test &amp;quot;assignment_id should be present&amp;quot; do&lt;br /&gt;
    @review_chat.assignment_id = &amp;quot; &amp;quot;&lt;br /&gt;
    assert_not @review_chat.assignment_id?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Presence of reviewer_id'''&lt;br /&gt;
&lt;br /&gt;
  test &amp;quot;reviewer_id should be present&amp;quot; do&lt;br /&gt;
    @review_chat.reviewer_id = &amp;quot; &amp;quot;&lt;br /&gt;
    assert_not @review_chat.reviewer_id?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Presence of team_id'''&lt;br /&gt;
&lt;br /&gt;
  test &amp;quot;team_id should be present&amp;quot; do&lt;br /&gt;
    @review_chat.team_id = &amp;quot; &amp;quot;&lt;br /&gt;
    assert_not @review_chat.team_id?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Presence of content'''&lt;br /&gt;
&lt;br /&gt;
  test &amp;quot;content should be present (nonblank)&amp;quot; do&lt;br /&gt;
    @review_chat.content = &amp;quot; &amp;quot; * 6&lt;br /&gt;
    assert_not @review_chat.valid?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Length of content'''&lt;br /&gt;
&lt;br /&gt;
  test &amp;quot;content should have a maximum length of 255&amp;quot; do&lt;br /&gt;
    @review_chat.content = &amp;quot;a&amp;quot; * 250&lt;br /&gt;
    assert @review_chat.valid?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
* To run the tests,&lt;br /&gt;
  bin/rake test test/models/review_chat_test.rb&lt;br /&gt;
&lt;br /&gt;
===Web Testing===&lt;br /&gt;
&lt;br /&gt;
* Create a browser automation test in [http://imacros.net/overview imacros] in Firefox/Chrome browser.&lt;br /&gt;
* Run the simulation to test the Expertiza chat operation in the browser.&lt;br /&gt;
&lt;br /&gt;
== Suggestions for Future Improvements ==&lt;br /&gt;
&lt;br /&gt;
* This can be extended to a live interactive author-reviewer anonymous chat session inside the Expertiza reviews window.&lt;br /&gt;
* A purging script can be developed which will clear all the interaction records every semester.&lt;br /&gt;
&lt;br /&gt;
==Resources==&lt;br /&gt;
&lt;br /&gt;
* Expertiza Github repository&amp;lt;ref&amp;gt;Expertiza Github repository https://github.com/expertiza/expertiza&amp;lt;/ref&amp;gt;&lt;br /&gt;
* Demo video&amp;lt;ref&amp;gt;Demo video https://www.youtube.com/watch?v=8E-hYiJVoZI&amp;lt;/ref&amp;gt;&lt;br /&gt;
* Github Pull request&amp;lt;ref&amp;gt;Github Pull request https://github.com/expertiza/expertiza/pull/628&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sgulati2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100394</id>
		<title>CSC/ECE 517 Fall 2015 E1586 AnonymousChatBetweenAuthorAndReviewer</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100394"/>
		<updated>2015-12-07T08:14:59Z</updated>

		<summary type="html">&lt;p&gt;Sgulati2: /* Web Testing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1586 AnonymousChatBetweenAuthorAndReviewer'''&lt;br /&gt;
&lt;br /&gt;
This page provides a brief description of the '''Expertiza''' project. The project is aimed at developing an email based anonymous session between author and a reviewer so that reviewers can ask questions to the authors for any doubts related to the assignments during peer reviewing.&lt;br /&gt;
&lt;br /&gt;
==Project==&lt;br /&gt;
&lt;br /&gt;
=== Introduction to Expertiza ===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a peer review based system which provides an incremental class based learning together with the instructors and the peers. This project has been developed together by faculty and students using [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza handles assignment submissions, team formations, assignment reviews and grades, etc.&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
During reviews, many times reviewers will be having questions about the submitted material and if it's a blocker there is no way that the reviewer can progress further with the review.  As a result, reviewers will end up submitting the empty or incomplete review.&lt;br /&gt;
&lt;br /&gt;
=== Scope ===&lt;br /&gt;
This project is limited to an email based conversation for asking questions and answers. The reviewers would ask questions related to assignment submission doubts to which authors can respond. All this would be taken care as email responses using a link provided in the email. This project does not cater to any live interactive session with spontaneous back-to-back questions and responses.&lt;br /&gt;
&lt;br /&gt;
Following tasks would be incorporated in the project:&lt;br /&gt;
* Provide a ‘TextArea’ input field on review forms, where any reviewer can type in their questions.&lt;br /&gt;
* Create a new button ‘Ask for Quick Help’ on the review forms.&lt;br /&gt;
* An email would be send to the author with the link where he can respond to the questions asked by the reviewers for their submitted work.&lt;br /&gt;
* Reviewers would be notified by an email when authors respond to the the questions.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Discussion of Resolution ===&lt;br /&gt;
Following modifications were made to implement the chat feature:- &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Create a new model which will help to extract, store and validate data in the database table which contains information about the interaction between the author/s and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Edit the view which is used by the response controller to incorporate the text area input field on the review form where the reviewer can ask his/her initial query.&lt;br /&gt;
&lt;br /&gt;
*Create a new controller with methods for authentication for a respective chat log only visible to the author and reviewer of a particular assignment, method to submit a response or a follow up query and show the existing interaction log.&lt;br /&gt;
&lt;br /&gt;
*Create a new helper with the e-mail methods for sending to the author and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Create a new view which will facilitate the author to respond to the queries asked by the reviewer. The reviewer can also use this view to ask any follow up questions.&lt;br /&gt;
&lt;br /&gt;
=== Design Patterns ===&lt;br /&gt;
The following design patterns were used for the solution:&lt;br /&gt;
 &lt;br /&gt;
* '''Observer Pattern'''&amp;lt;ref&amp;gt;Observer Design Pattern https://en.wikipedia.org/wiki/Observer_pattern&amp;lt;/ref&amp;gt;: The observer pattern is a software design pattern in which an object, called the subject, maintains a list of its dependents, called observers, and notifies them automatically of any state changes, usually by calling one of their methods. For example, we are notifying the team members whenever the reviewer submits the query.&lt;br /&gt;
&lt;br /&gt;
* '''Iterator Pattern''': In our instance, we need to display the entire chat history of a particular interaction, hence we can use the iterator design pattern to iterate through the previous chat messages.&lt;br /&gt;
&lt;br /&gt;
=== Database Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:Review_chats.png]]&lt;br /&gt;
&lt;br /&gt;
The above figure shows the schema of a new table which will be created in Expertiza to store relevant information about the chat. It contains the following attributes:&lt;br /&gt;
* id: This attribute is auto-generated by rails when we create a table and is auto incremented with each record. It is also the primary key of our table.&lt;br /&gt;
* assignment_id: Stores the ID of the assignment for which the interaction between author and reviewer is taking place.&lt;br /&gt;
* reviewer_id: Stores the ID of the reviewer who asks the questions.&lt;br /&gt;
* team_id: Stores the ID of the team to which the topic belongs.&lt;br /&gt;
* type_flag: Flag which is used to indicate if the particular tuple contains a question or answer. It can take two values, 'Q' for question and 'A' for answer.&lt;br /&gt;
* content: Stores the question asked by the reviewer or the response given by the author/s depending on the value of the type flag.&lt;br /&gt;
&lt;br /&gt;
Records for a particular interaction can be identified by using a combination of assignment_id, reviewer_id and team_id.&lt;br /&gt;
&lt;br /&gt;
=== Use Cases ===&lt;br /&gt;
'''Name:''' Send a question to the author/s about their work.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Reviewer. &amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The reviewer enters his question in the text area which is provided and clicks on the &amp;quot;Ask question&amp;quot; button which is provided as shown in the mock up. On clicking this button an email is sent to the author/s along which a link to answer the question.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''Name:''' Answer the question which has been asked by the reviewer.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Author/s&amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The author/s click on the link received in their email and are redirected to a page where they can answer the question. Once they submit the answer, an email is sent to the reviewer notifying him/her that their question has been answered.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:ARSNUsecase.jpeg]]&lt;br /&gt;
&lt;br /&gt;
=== Proposed Tests ===&lt;br /&gt;
1. For use case 1, test whether all the team members receive email with the question.&amp;lt;br/&amp;gt;&lt;br /&gt;
2. For use case 2, test whether the reviewer receive email with the response.&amp;lt;br/&amp;gt;&lt;br /&gt;
3. Test whether all the previous interactions are displayed as chat history.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
===Code Implementation===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*Create a new model '''review_chat.rb''' for ReviewChat.&lt;br /&gt;
&lt;br /&gt;
'''Validation'''- Check if the query box is not empty and restrict the query length to 255 characters.&lt;br /&gt;
&lt;br /&gt;
  validates_length_of :content , :maximum =&amp;gt; 255,message: &amp;quot;Length must be less that 255 characters&amp;quot;&lt;br /&gt;
  validates_presence_of :content, message: &amp;quot;Content cannot be blank&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*Create a new controller '''review_chats_controller.rb''' with the following methods:&lt;br /&gt;
&lt;br /&gt;
'''action_allowed?'''- Allow chat visibility to the reviewers and the authors of a particular interaction&lt;br /&gt;
&lt;br /&gt;
  def action_allowed?&lt;br /&gt;
    review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    allowed_users=Array.new&lt;br /&gt;
    team_id=review_chat.team_id&lt;br /&gt;
    teams_users = TeamsUser.where(team_id: team_id)&lt;br /&gt;
    teams_users.each do |teams_user|&lt;br /&gt;
      allowed_users &amp;lt;&amp;lt; User.find(teams_user.user_id).id&lt;br /&gt;
    end&lt;br /&gt;
    allowed_users &amp;lt;&amp;lt; Participant.find(review_chat.reviewer_id).user_id&lt;br /&gt;
    current_role_name.eql? 'Student' and allowed_users.include?(session[:user].id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''show'''- Show the chat interaction log&lt;br /&gt;
&lt;br /&gt;
  def show&lt;br /&gt;
    @review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    @assignment_id=@review_chat.assignment_id&lt;br /&gt;
    @reviewer_id=@review_chat.reviewer_id&lt;br /&gt;
    @team_id=@review_chat.team_id&lt;br /&gt;
    @chat_log=ReviewChat.where(:reviewer_id =&amp;gt; @reviewer_id).where(:team_id =&amp;gt; @team_id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''submitted_response'''- Create a chat record and send an email to the reviewer when an author replied to a query asked by the reviewer&lt;br /&gt;
&lt;br /&gt;
  def submitted_response&lt;br /&gt;
    @review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    @chat_reviewer=Participant.find(@review_chat.reviewer_id).user_id&lt;br /&gt;
    if(@chat_reviewer==session[:user].id) then&lt;br /&gt;
    	ReviewChat.create(:assignment_id =&amp;gt; @review_chat.assignment_id,:reviewer_id =&amp;gt; @review_chat.reviewer_id, :team_id=&amp;gt;@review_chat.team_id, :type_flag =&amp;gt; 'Q' , :content =&amp;gt; params[:response_area])&lt;br /&gt;
    	ReviewChatsHelper::chat_email_query(params[:id])&lt;br /&gt;
    	flash[:notice]=&amp;quot;Query has been submitted&amp;quot;	&lt;br /&gt;
    else	&lt;br /&gt;
      	ReviewChat.create(:assignment_id =&amp;gt; @review_chat.assignment_id,:reviewer_id =&amp;gt; @review_chat.reviewer_id, :team_id=&amp;gt;@review_chat.team_id, :type_flag =&amp;gt; 'A' , :content =&amp;gt; params[:response_area])&lt;br /&gt;
      	ReviewChatsHelper::chat_email_response(@review_chat.id,@chat_reviewer)&lt;br /&gt;
      flash[:notice]=&amp;quot;Response has been submitted&amp;quot;&lt;br /&gt;
    end	&lt;br /&gt;
    redirect_to action: 'show', id: params[:id]&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
*Create a helper file '''review_chats_helper.rb''' with the following methods:&lt;br /&gt;
&lt;br /&gt;
'''chat_email_response'''- Send an email to the author of an assignment when a reviewer posts a query&lt;br /&gt;
&lt;br /&gt;
  def self.chat_email_response(id,reviewer_id,partial=&amp;quot;new_chatemail&amp;quot;)&lt;br /&gt;
    defn = Hash.new&lt;br /&gt;
    defn[:body] = Hash.new&lt;br /&gt;
    defn[:body][:partial_name] = partial&lt;br /&gt;
    reviewer_email=User.find(reviewer_id).email&lt;br /&gt;
    defn[:subject] = &amp;quot;Response posted for submission&amp;quot;&lt;br /&gt;
    defn[:body][:type] = &amp;quot; response has been posted for your query .&lt;br /&gt;
    Please open the below URL to view.&lt;br /&gt;
    http://expertiza.ncsu.edu/review_chats/show/#{id}&amp;quot;&lt;br /&gt;
    defn[:to] = reviewer_email&lt;br /&gt;
    Mailer.sync_message(defn).deliver&lt;br /&gt;
  end &lt;br /&gt;
&lt;br /&gt;
'''chat_email_query'''- Send an email to the author of an assignment when a reviewer posts a query&lt;br /&gt;
&lt;br /&gt;
  def self.chat_email_query(id,partial=&amp;quot;new_chatemail&amp;quot;)&lt;br /&gt;
    defn = Hash.new&lt;br /&gt;
    defn[:body] = Hash.new&lt;br /&gt;
    defn[:body][:partial_name] = partial&lt;br /&gt;
    assignment=nil&lt;br /&gt;
    @team_id=ReviewChat.find(id).team_id&lt;br /&gt;
    teams_users = TeamsUser.where(team_id: @team_id)&lt;br /&gt;
    to_mail_list = Array.new&lt;br /&gt;
    teams_users.each do |teams_user|&lt;br /&gt;
    to_mail_list &amp;lt;&amp;lt; User.find(teams_user.user_id).email &lt;br /&gt;
    end&lt;br /&gt;
    defn[:subject] = &amp;quot;Query posted for submission&amp;quot;&lt;br /&gt;
    defn[:body][:type] = &amp;quot; query has been posted for your submission .&lt;br /&gt;
    Please open the below URL to view and respond.&lt;br /&gt;
    http://expertiza.ncsu.edu/review_chats/show/#{id}&amp;quot;&lt;br /&gt;
    defn[:to] = to_mail_list&lt;br /&gt;
    Mailer.sync_message(defn).deliver&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
*Modify existing controller '''response_controller.rb''' and add a new method.&lt;br /&gt;
&lt;br /&gt;
'''submitted_question'''- Create a chat record and send an email to the authors when a reviewer posts a query.&lt;br /&gt;
  def submitted_question&lt;br /&gt;
      @map = ResponseMap.find(params[:id])&lt;br /&gt;
      ReviewChat.create(:assignment_id =&amp;gt; @map.assignment.id,:reviewer_id =&amp;gt; @map.reviewer_id, :team_id=&amp;gt;@map.reviewee_id, :type_flag =&amp;gt; 'Q' , :content =&amp;gt; params[:review_question])&lt;br /&gt;
      flash[:notice]=&amp;quot;Question has been submitted to Author&amp;quot;&lt;br /&gt;
      @interaction_id=ReviewChat.where(:reviewer_id =&amp;gt; @map.reviewer_id).where(:team_id =&amp;gt; @map.reviewee_id)&lt;br /&gt;
      ReviewChatsHelper::chat_email_query(@interaction_id.first.id)&lt;br /&gt;
      redirect_to action: 'new', id: params[:id]&lt;br /&gt;
  end&lt;br /&gt;
*Create a new view '''show.html.erb''' to show the existing chat record and a box to respond and ask a follow up query.&lt;br /&gt;
&lt;br /&gt;
===Flowchart===&lt;br /&gt;
&lt;br /&gt;
[[File: ARSNFlowchart1.png]]&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
===User Interface Testing===&lt;br /&gt;
&lt;br /&gt;
* Login to Expertiza with a student account. You can use login id as 'student5700' and password as 'password'.&lt;br /&gt;
* Start reviewing an existing assignment. You would see a small query box at the bottom of the page.&lt;br /&gt;
*The reviewer enters his question in the text area provided and clicks on the &amp;quot;Submit&amp;quot; button.&lt;br /&gt;
[[File: FinalProject1.jpg]]&lt;br /&gt;
*On clicking this button the appropriate method is called in ReviewChats controller which sends an email to all the authors of the topic indicating that a question has been asked about their work. The email contains a link which when clicked on will redirect the author to the appropriate view where he/she can answer the question.&lt;br /&gt;
[[File: FinalProject4.jpg]]&lt;br /&gt;
*On answering the question, the reviewer receives an email indicating that his question has been answered. It also contains a link which redirects the reviewer to the appropriate view where the answer will be displayed.&lt;br /&gt;
*The authorized users will also be able to see a link to open existing chat interaction log.&lt;br /&gt;
[[File: FinalProject3.jpg]]&lt;br /&gt;
*This view also contains the chat history between the author/s and the reviewer for the entire duration of the interaction.&lt;br /&gt;
[[File: FinalProject2.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Model Testing===&lt;br /&gt;
&lt;br /&gt;
* Create a model test file '''review_chat_test.rb''' with the below tests.&lt;br /&gt;
'''Presence of assignment_id'''&lt;br /&gt;
&lt;br /&gt;
  test &amp;quot;assignment_id should be present&amp;quot; do&lt;br /&gt;
    @review_chat.assignment_id = &amp;quot; &amp;quot;&lt;br /&gt;
    assert_not @review_chat.assignment_id?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Presence of reviewer_id'''&lt;br /&gt;
&lt;br /&gt;
  test &amp;quot;reviewer_id should be present&amp;quot; do&lt;br /&gt;
    @review_chat.reviewer_id = &amp;quot; &amp;quot;&lt;br /&gt;
    assert_not @review_chat.reviewer_id?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Presence of team_id'''&lt;br /&gt;
&lt;br /&gt;
  test &amp;quot;team_id should be present&amp;quot; do&lt;br /&gt;
    @review_chat.team_id = &amp;quot; &amp;quot;&lt;br /&gt;
    assert_not @review_chat.team_id?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Presence of content'''&lt;br /&gt;
&lt;br /&gt;
  test &amp;quot;content should be present (nonblank)&amp;quot; do&lt;br /&gt;
    @review_chat.content = &amp;quot; &amp;quot; * 6&lt;br /&gt;
    assert_not @review_chat.valid?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Length of content'''&lt;br /&gt;
&lt;br /&gt;
  test &amp;quot;content should have a maximum length of 255&amp;quot; do&lt;br /&gt;
    @review_chat.content = &amp;quot;a&amp;quot; * 250&lt;br /&gt;
    assert @review_chat.valid?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
* To run the tests,&lt;br /&gt;
  bin/rake test test/models/review_chat_test.rb&lt;br /&gt;
&lt;br /&gt;
===Web Testing===&lt;br /&gt;
&lt;br /&gt;
* Create a browser automation test in http://imacros.net/overview imacros in Firefox/Chrome browser.&lt;br /&gt;
* Run the simulation to test the Expertiza chat operation in the browser.&lt;br /&gt;
&lt;br /&gt;
== Suggestions for Future Improvements ==&lt;br /&gt;
&lt;br /&gt;
* This can be extended to a live interactive author-reviewer anonymous chat session inside the Expertiza reviews window.&lt;br /&gt;
* A purging script can be developed which will clear all the interaction records every semester.&lt;br /&gt;
&lt;br /&gt;
==Resources==&lt;br /&gt;
&lt;br /&gt;
* Expertiza Github repository&amp;lt;ref&amp;gt;Expertiza Github repository https://github.com/expertiza/expertiza&amp;lt;/ref&amp;gt;&lt;br /&gt;
* Demo video&amp;lt;ref&amp;gt;Demo video https://www.youtube.com/watch?v=8E-hYiJVoZI&amp;lt;/ref&amp;gt;&lt;br /&gt;
* Github Pull request&amp;lt;ref&amp;gt;Github Pull request https://github.com/expertiza/expertiza/pull/628&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sgulati2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100393</id>
		<title>CSC/ECE 517 Fall 2015 E1586 AnonymousChatBetweenAuthorAndReviewer</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100393"/>
		<updated>2015-12-07T08:14:15Z</updated>

		<summary type="html">&lt;p&gt;Sgulati2: /* Testing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1586 AnonymousChatBetweenAuthorAndReviewer'''&lt;br /&gt;
&lt;br /&gt;
This page provides a brief description of the '''Expertiza''' project. The project is aimed at developing an email based anonymous session between author and a reviewer so that reviewers can ask questions to the authors for any doubts related to the assignments during peer reviewing.&lt;br /&gt;
&lt;br /&gt;
==Project==&lt;br /&gt;
&lt;br /&gt;
=== Introduction to Expertiza ===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a peer review based system which provides an incremental class based learning together with the instructors and the peers. This project has been developed together by faculty and students using [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza handles assignment submissions, team formations, assignment reviews and grades, etc.&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
During reviews, many times reviewers will be having questions about the submitted material and if it's a blocker there is no way that the reviewer can progress further with the review.  As a result, reviewers will end up submitting the empty or incomplete review.&lt;br /&gt;
&lt;br /&gt;
=== Scope ===&lt;br /&gt;
This project is limited to an email based conversation for asking questions and answers. The reviewers would ask questions related to assignment submission doubts to which authors can respond. All this would be taken care as email responses using a link provided in the email. This project does not cater to any live interactive session with spontaneous back-to-back questions and responses.&lt;br /&gt;
&lt;br /&gt;
Following tasks would be incorporated in the project:&lt;br /&gt;
* Provide a ‘TextArea’ input field on review forms, where any reviewer can type in their questions.&lt;br /&gt;
* Create a new button ‘Ask for Quick Help’ on the review forms.&lt;br /&gt;
* An email would be send to the author with the link where he can respond to the questions asked by the reviewers for their submitted work.&lt;br /&gt;
* Reviewers would be notified by an email when authors respond to the the questions.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Discussion of Resolution ===&lt;br /&gt;
Following modifications were made to implement the chat feature:- &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Create a new model which will help to extract, store and validate data in the database table which contains information about the interaction between the author/s and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Edit the view which is used by the response controller to incorporate the text area input field on the review form where the reviewer can ask his/her initial query.&lt;br /&gt;
&lt;br /&gt;
*Create a new controller with methods for authentication for a respective chat log only visible to the author and reviewer of a particular assignment, method to submit a response or a follow up query and show the existing interaction log.&lt;br /&gt;
&lt;br /&gt;
*Create a new helper with the e-mail methods for sending to the author and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Create a new view which will facilitate the author to respond to the queries asked by the reviewer. The reviewer can also use this view to ask any follow up questions.&lt;br /&gt;
&lt;br /&gt;
=== Design Patterns ===&lt;br /&gt;
The following design patterns were used for the solution:&lt;br /&gt;
 &lt;br /&gt;
* '''Observer Pattern'''&amp;lt;ref&amp;gt;Observer Design Pattern https://en.wikipedia.org/wiki/Observer_pattern&amp;lt;/ref&amp;gt;: The observer pattern is a software design pattern in which an object, called the subject, maintains a list of its dependents, called observers, and notifies them automatically of any state changes, usually by calling one of their methods. For example, we are notifying the team members whenever the reviewer submits the query.&lt;br /&gt;
&lt;br /&gt;
* '''Iterator Pattern''': In our instance, we need to display the entire chat history of a particular interaction, hence we can use the iterator design pattern to iterate through the previous chat messages.&lt;br /&gt;
&lt;br /&gt;
=== Database Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:Review_chats.png]]&lt;br /&gt;
&lt;br /&gt;
The above figure shows the schema of a new table which will be created in Expertiza to store relevant information about the chat. It contains the following attributes:&lt;br /&gt;
* id: This attribute is auto-generated by rails when we create a table and is auto incremented with each record. It is also the primary key of our table.&lt;br /&gt;
* assignment_id: Stores the ID of the assignment for which the interaction between author and reviewer is taking place.&lt;br /&gt;
* reviewer_id: Stores the ID of the reviewer who asks the questions.&lt;br /&gt;
* team_id: Stores the ID of the team to which the topic belongs.&lt;br /&gt;
* type_flag: Flag which is used to indicate if the particular tuple contains a question or answer. It can take two values, 'Q' for question and 'A' for answer.&lt;br /&gt;
* content: Stores the question asked by the reviewer or the response given by the author/s depending on the value of the type flag.&lt;br /&gt;
&lt;br /&gt;
Records for a particular interaction can be identified by using a combination of assignment_id, reviewer_id and team_id.&lt;br /&gt;
&lt;br /&gt;
=== Use Cases ===&lt;br /&gt;
'''Name:''' Send a question to the author/s about their work.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Reviewer. &amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The reviewer enters his question in the text area which is provided and clicks on the &amp;quot;Ask question&amp;quot; button which is provided as shown in the mock up. On clicking this button an email is sent to the author/s along which a link to answer the question.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''Name:''' Answer the question which has been asked by the reviewer.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Author/s&amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The author/s click on the link received in their email and are redirected to a page where they can answer the question. Once they submit the answer, an email is sent to the reviewer notifying him/her that their question has been answered.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:ARSNUsecase.jpeg]]&lt;br /&gt;
&lt;br /&gt;
=== Proposed Tests ===&lt;br /&gt;
1. For use case 1, test whether all the team members receive email with the question.&amp;lt;br/&amp;gt;&lt;br /&gt;
2. For use case 2, test whether the reviewer receive email with the response.&amp;lt;br/&amp;gt;&lt;br /&gt;
3. Test whether all the previous interactions are displayed as chat history.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
===Code Implementation===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*Create a new model '''review_chat.rb''' for ReviewChat.&lt;br /&gt;
&lt;br /&gt;
'''Validation'''- Check if the query box is not empty and restrict the query length to 255 characters.&lt;br /&gt;
&lt;br /&gt;
  validates_length_of :content , :maximum =&amp;gt; 255,message: &amp;quot;Length must be less that 255 characters&amp;quot;&lt;br /&gt;
  validates_presence_of :content, message: &amp;quot;Content cannot be blank&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*Create a new controller '''review_chats_controller.rb''' with the following methods:&lt;br /&gt;
&lt;br /&gt;
'''action_allowed?'''- Allow chat visibility to the reviewers and the authors of a particular interaction&lt;br /&gt;
&lt;br /&gt;
  def action_allowed?&lt;br /&gt;
    review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    allowed_users=Array.new&lt;br /&gt;
    team_id=review_chat.team_id&lt;br /&gt;
    teams_users = TeamsUser.where(team_id: team_id)&lt;br /&gt;
    teams_users.each do |teams_user|&lt;br /&gt;
      allowed_users &amp;lt;&amp;lt; User.find(teams_user.user_id).id&lt;br /&gt;
    end&lt;br /&gt;
    allowed_users &amp;lt;&amp;lt; Participant.find(review_chat.reviewer_id).user_id&lt;br /&gt;
    current_role_name.eql? 'Student' and allowed_users.include?(session[:user].id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''show'''- Show the chat interaction log&lt;br /&gt;
&lt;br /&gt;
  def show&lt;br /&gt;
    @review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    @assignment_id=@review_chat.assignment_id&lt;br /&gt;
    @reviewer_id=@review_chat.reviewer_id&lt;br /&gt;
    @team_id=@review_chat.team_id&lt;br /&gt;
    @chat_log=ReviewChat.where(:reviewer_id =&amp;gt; @reviewer_id).where(:team_id =&amp;gt; @team_id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''submitted_response'''- Create a chat record and send an email to the reviewer when an author replied to a query asked by the reviewer&lt;br /&gt;
&lt;br /&gt;
  def submitted_response&lt;br /&gt;
    @review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    @chat_reviewer=Participant.find(@review_chat.reviewer_id).user_id&lt;br /&gt;
    if(@chat_reviewer==session[:user].id) then&lt;br /&gt;
    	ReviewChat.create(:assignment_id =&amp;gt; @review_chat.assignment_id,:reviewer_id =&amp;gt; @review_chat.reviewer_id, :team_id=&amp;gt;@review_chat.team_id, :type_flag =&amp;gt; 'Q' , :content =&amp;gt; params[:response_area])&lt;br /&gt;
    	ReviewChatsHelper::chat_email_query(params[:id])&lt;br /&gt;
    	flash[:notice]=&amp;quot;Query has been submitted&amp;quot;	&lt;br /&gt;
    else	&lt;br /&gt;
      	ReviewChat.create(:assignment_id =&amp;gt; @review_chat.assignment_id,:reviewer_id =&amp;gt; @review_chat.reviewer_id, :team_id=&amp;gt;@review_chat.team_id, :type_flag =&amp;gt; 'A' , :content =&amp;gt; params[:response_area])&lt;br /&gt;
      	ReviewChatsHelper::chat_email_response(@review_chat.id,@chat_reviewer)&lt;br /&gt;
      flash[:notice]=&amp;quot;Response has been submitted&amp;quot;&lt;br /&gt;
    end	&lt;br /&gt;
    redirect_to action: 'show', id: params[:id]&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
*Create a helper file '''review_chats_helper.rb''' with the following methods:&lt;br /&gt;
&lt;br /&gt;
'''chat_email_response'''- Send an email to the author of an assignment when a reviewer posts a query&lt;br /&gt;
&lt;br /&gt;
  def self.chat_email_response(id,reviewer_id,partial=&amp;quot;new_chatemail&amp;quot;)&lt;br /&gt;
    defn = Hash.new&lt;br /&gt;
    defn[:body] = Hash.new&lt;br /&gt;
    defn[:body][:partial_name] = partial&lt;br /&gt;
    reviewer_email=User.find(reviewer_id).email&lt;br /&gt;
    defn[:subject] = &amp;quot;Response posted for submission&amp;quot;&lt;br /&gt;
    defn[:body][:type] = &amp;quot; response has been posted for your query .&lt;br /&gt;
    Please open the below URL to view.&lt;br /&gt;
    http://expertiza.ncsu.edu/review_chats/show/#{id}&amp;quot;&lt;br /&gt;
    defn[:to] = reviewer_email&lt;br /&gt;
    Mailer.sync_message(defn).deliver&lt;br /&gt;
  end &lt;br /&gt;
&lt;br /&gt;
'''chat_email_query'''- Send an email to the author of an assignment when a reviewer posts a query&lt;br /&gt;
&lt;br /&gt;
  def self.chat_email_query(id,partial=&amp;quot;new_chatemail&amp;quot;)&lt;br /&gt;
    defn = Hash.new&lt;br /&gt;
    defn[:body] = Hash.new&lt;br /&gt;
    defn[:body][:partial_name] = partial&lt;br /&gt;
    assignment=nil&lt;br /&gt;
    @team_id=ReviewChat.find(id).team_id&lt;br /&gt;
    teams_users = TeamsUser.where(team_id: @team_id)&lt;br /&gt;
    to_mail_list = Array.new&lt;br /&gt;
    teams_users.each do |teams_user|&lt;br /&gt;
    to_mail_list &amp;lt;&amp;lt; User.find(teams_user.user_id).email &lt;br /&gt;
    end&lt;br /&gt;
    defn[:subject] = &amp;quot;Query posted for submission&amp;quot;&lt;br /&gt;
    defn[:body][:type] = &amp;quot; query has been posted for your submission .&lt;br /&gt;
    Please open the below URL to view and respond.&lt;br /&gt;
    http://expertiza.ncsu.edu/review_chats/show/#{id}&amp;quot;&lt;br /&gt;
    defn[:to] = to_mail_list&lt;br /&gt;
    Mailer.sync_message(defn).deliver&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
*Modify existing controller '''response_controller.rb''' and add a new method.&lt;br /&gt;
&lt;br /&gt;
'''submitted_question'''- Create a chat record and send an email to the authors when a reviewer posts a query.&lt;br /&gt;
  def submitted_question&lt;br /&gt;
      @map = ResponseMap.find(params[:id])&lt;br /&gt;
      ReviewChat.create(:assignment_id =&amp;gt; @map.assignment.id,:reviewer_id =&amp;gt; @map.reviewer_id, :team_id=&amp;gt;@map.reviewee_id, :type_flag =&amp;gt; 'Q' , :content =&amp;gt; params[:review_question])&lt;br /&gt;
      flash[:notice]=&amp;quot;Question has been submitted to Author&amp;quot;&lt;br /&gt;
      @interaction_id=ReviewChat.where(:reviewer_id =&amp;gt; @map.reviewer_id).where(:team_id =&amp;gt; @map.reviewee_id)&lt;br /&gt;
      ReviewChatsHelper::chat_email_query(@interaction_id.first.id)&lt;br /&gt;
      redirect_to action: 'new', id: params[:id]&lt;br /&gt;
  end&lt;br /&gt;
*Create a new view '''show.html.erb''' to show the existing chat record and a box to respond and ask a follow up query.&lt;br /&gt;
&lt;br /&gt;
===Flowchart===&lt;br /&gt;
&lt;br /&gt;
[[File: ARSNFlowchart1.png]]&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
===User Interface Testing===&lt;br /&gt;
&lt;br /&gt;
* Login to Expertiza with a student account. You can use login id as 'student5700' and password as 'password'.&lt;br /&gt;
* Start reviewing an existing assignment. You would see a small query box at the bottom of the page.&lt;br /&gt;
*The reviewer enters his question in the text area provided and clicks on the &amp;quot;Submit&amp;quot; button.&lt;br /&gt;
[[File: FinalProject1.jpg]]&lt;br /&gt;
*On clicking this button the appropriate method is called in ReviewChats controller which sends an email to all the authors of the topic indicating that a question has been asked about their work. The email contains a link which when clicked on will redirect the author to the appropriate view where he/she can answer the question.&lt;br /&gt;
[[File: FinalProject4.jpg]]&lt;br /&gt;
*On answering the question, the reviewer receives an email indicating that his question has been answered. It also contains a link which redirects the reviewer to the appropriate view where the answer will be displayed.&lt;br /&gt;
*The authorized users will also be able to see a link to open existing chat interaction log.&lt;br /&gt;
[[File: FinalProject3.jpg]]&lt;br /&gt;
*This view also contains the chat history between the author/s and the reviewer for the entire duration of the interaction.&lt;br /&gt;
[[File: FinalProject2.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Model Testing===&lt;br /&gt;
&lt;br /&gt;
* Create a model test file '''review_chat_test.rb''' with the below tests.&lt;br /&gt;
'''Presence of assignment_id'''&lt;br /&gt;
&lt;br /&gt;
  test &amp;quot;assignment_id should be present&amp;quot; do&lt;br /&gt;
    @review_chat.assignment_id = &amp;quot; &amp;quot;&lt;br /&gt;
    assert_not @review_chat.assignment_id?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Presence of reviewer_id'''&lt;br /&gt;
&lt;br /&gt;
  test &amp;quot;reviewer_id should be present&amp;quot; do&lt;br /&gt;
    @review_chat.reviewer_id = &amp;quot; &amp;quot;&lt;br /&gt;
    assert_not @review_chat.reviewer_id?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Presence of team_id'''&lt;br /&gt;
&lt;br /&gt;
  test &amp;quot;team_id should be present&amp;quot; do&lt;br /&gt;
    @review_chat.team_id = &amp;quot; &amp;quot;&lt;br /&gt;
    assert_not @review_chat.team_id?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Presence of content'''&lt;br /&gt;
&lt;br /&gt;
  test &amp;quot;content should be present (nonblank)&amp;quot; do&lt;br /&gt;
    @review_chat.content = &amp;quot; &amp;quot; * 6&lt;br /&gt;
    assert_not @review_chat.valid?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Length of content'''&lt;br /&gt;
&lt;br /&gt;
  test &amp;quot;content should have a maximum length of 255&amp;quot; do&lt;br /&gt;
    @review_chat.content = &amp;quot;a&amp;quot; * 250&lt;br /&gt;
    assert @review_chat.valid?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
* To run the tests,&lt;br /&gt;
  bin/rake test test/models/review_chat_test.rb&lt;br /&gt;
&lt;br /&gt;
===Web Testing===&lt;br /&gt;
&lt;br /&gt;
* Create a browser automation test in imacros in Firefox/Chrome browser.&lt;br /&gt;
* Run the simulation to test the Expertiza chat operation in the browser.&lt;br /&gt;
&lt;br /&gt;
== Suggestions for Future Improvements ==&lt;br /&gt;
&lt;br /&gt;
* This can be extended to a live interactive author-reviewer anonymous chat session inside the Expertiza reviews window.&lt;br /&gt;
* A purging script can be developed which will clear all the interaction records every semester.&lt;br /&gt;
&lt;br /&gt;
==Resources==&lt;br /&gt;
&lt;br /&gt;
* Expertiza Github repository&amp;lt;ref&amp;gt;Expertiza Github repository https://github.com/expertiza/expertiza&amp;lt;/ref&amp;gt;&lt;br /&gt;
* Demo video&amp;lt;ref&amp;gt;Demo video https://www.youtube.com/watch?v=8E-hYiJVoZI&amp;lt;/ref&amp;gt;&lt;br /&gt;
* Github Pull request&amp;lt;ref&amp;gt;Github Pull request https://github.com/expertiza/expertiza/pull/628&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sgulati2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100392</id>
		<title>CSC/ECE 517 Fall 2015 E1586 AnonymousChatBetweenAuthorAndReviewer</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100392"/>
		<updated>2015-12-07T04:10:22Z</updated>

		<summary type="html">&lt;p&gt;Sgulati2: /* Resources */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1586 AnonymousChatBetweenAuthorAndReviewer'''&lt;br /&gt;
&lt;br /&gt;
This page provides a brief description of the '''Expertiza''' project. The project is aimed at developing an email based anonymous session between author and a reviewer so that reviewers can ask questions to the authors for any doubts related to the assignments during peer reviewing.&lt;br /&gt;
&lt;br /&gt;
==Project==&lt;br /&gt;
&lt;br /&gt;
=== Introduction to Expertiza ===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a peer review based system which provides an incremental class based learning together with the instructors and the peers. This project has been developed together by faculty and students using [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza handles assignment submissions, team formations, assignment reviews and grades, etc.&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
During reviews, many times reviewers will be having questions about the submitted material and if it's a blocker there is no way that the reviewer can progress further with the review.  As a result, reviewers will end up submitting the empty or incomplete review.&lt;br /&gt;
&lt;br /&gt;
=== Scope ===&lt;br /&gt;
This project is limited to an email based conversation for asking questions and answers. The reviewers would ask questions related to assignment submission doubts to which authors can respond. All this would be taken care as email responses using a link provided in the email. This project does not cater to any live interactive session with spontaneous back-to-back questions and responses.&lt;br /&gt;
&lt;br /&gt;
Following tasks would be incorporated in the project:&lt;br /&gt;
* Provide a ‘TextArea’ input field on review forms, where any reviewer can type in their questions.&lt;br /&gt;
* Create a new button ‘Ask for Quick Help’ on the review forms.&lt;br /&gt;
* An email would be send to the author with the link where he can respond to the questions asked by the reviewers for their submitted work.&lt;br /&gt;
* Reviewers would be notified by an email when authors respond to the the questions.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Discussion of Resolution ===&lt;br /&gt;
Following modifications were made to implement the chat feature:- &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Create a new model which will help to extract, store and validate data in the database table which contains information about the interaction between the author/s and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Edit the view which is used by the response controller to incorporate the text area input field on the review form where the reviewer can ask his/her initial query.&lt;br /&gt;
&lt;br /&gt;
*Create a new controller with methods for authentication for a respective chat log only visible to the author and reviewer of a particular assignment, method to submit a response or a follow up query and show the existing interaction log.&lt;br /&gt;
&lt;br /&gt;
*Create a new helper with the e-mail methods for sending to the author and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Create a new view which will facilitate the author to respond to the queries asked by the reviewer. The reviewer can also use this view to ask any follow up questions.&lt;br /&gt;
&lt;br /&gt;
=== Design Patterns ===&lt;br /&gt;
The following design patterns were used for the solution:&lt;br /&gt;
 &lt;br /&gt;
* '''Observer Pattern'''&amp;lt;ref&amp;gt;Observer Design Pattern https://en.wikipedia.org/wiki/Observer_pattern&amp;lt;/ref&amp;gt;: The observer pattern is a software design pattern in which an object, called the subject, maintains a list of its dependents, called observers, and notifies them automatically of any state changes, usually by calling one of their methods. For example, we are notifying the team members whenever the reviewer submits the query.&lt;br /&gt;
&lt;br /&gt;
* '''Iterator Pattern''': In our instance, we need to display the entire chat history of a particular interaction, hence we can use the iterator design pattern to iterate through the previous chat messages.&lt;br /&gt;
&lt;br /&gt;
=== Database Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:Review_chats.png]]&lt;br /&gt;
&lt;br /&gt;
The above figure shows the schema of a new table which will be created in Expertiza to store relevant information about the chat. It contains the following attributes:&lt;br /&gt;
* id: This attribute is auto-generated by rails when we create a table and is auto incremented with each record. It is also the primary key of our table.&lt;br /&gt;
* assignment_id: Stores the ID of the assignment for which the interaction between author and reviewer is taking place.&lt;br /&gt;
* reviewer_id: Stores the ID of the reviewer who asks the questions.&lt;br /&gt;
* team_id: Stores the ID of the team to which the topic belongs.&lt;br /&gt;
* type_flag: Flag which is used to indicate if the particular tuple contains a question or answer. It can take two values, 'Q' for question and 'A' for answer.&lt;br /&gt;
* content: Stores the question asked by the reviewer or the response given by the author/s depending on the value of the type flag.&lt;br /&gt;
&lt;br /&gt;
Records for a particular interaction can be identified by using a combination of assignment_id, reviewer_id and team_id.&lt;br /&gt;
&lt;br /&gt;
=== Use Cases ===&lt;br /&gt;
'''Name:''' Send a question to the author/s about their work.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Reviewer. &amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The reviewer enters his question in the text area which is provided and clicks on the &amp;quot;Ask question&amp;quot; button which is provided as shown in the mock up. On clicking this button an email is sent to the author/s along which a link to answer the question.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''Name:''' Answer the question which has been asked by the reviewer.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Author/s&amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The author/s click on the link received in their email and are redirected to a page where they can answer the question. Once they submit the answer, an email is sent to the reviewer notifying him/her that their question has been answered.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:ARSNUsecase.jpeg]]&lt;br /&gt;
&lt;br /&gt;
=== Proposed Tests ===&lt;br /&gt;
1. For use case 1, test whether all the team members receive email with the question.&amp;lt;br/&amp;gt;&lt;br /&gt;
2. For use case 2, test whether the reviewer receive email with the response.&amp;lt;br/&amp;gt;&lt;br /&gt;
3. Test whether all the previous interactions are displayed as chat history.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
===Code Implementation===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*Create a new model '''review_chat.rb''' for ReviewChat.&lt;br /&gt;
&lt;br /&gt;
'''Validation'''- Check if the query box is not empty and restrict the query length to 255 characters.&lt;br /&gt;
&lt;br /&gt;
  validates_length_of :content , :maximum =&amp;gt; 255,message: &amp;quot;Length must be less that 255 characters&amp;quot;&lt;br /&gt;
  validates_presence_of :content, message: &amp;quot;Content cannot be blank&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*Create a new controller '''review_chats_controller.rb''' with the following methods:&lt;br /&gt;
&lt;br /&gt;
'''action_allowed?'''- Allow chat visibility to the reviewers and the authors of a particular interaction&lt;br /&gt;
&lt;br /&gt;
  def action_allowed?&lt;br /&gt;
    review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    allowed_users=Array.new&lt;br /&gt;
    team_id=review_chat.team_id&lt;br /&gt;
    teams_users = TeamsUser.where(team_id: team_id)&lt;br /&gt;
    teams_users.each do |teams_user|&lt;br /&gt;
      allowed_users &amp;lt;&amp;lt; User.find(teams_user.user_id).id&lt;br /&gt;
    end&lt;br /&gt;
    allowed_users &amp;lt;&amp;lt; Participant.find(review_chat.reviewer_id).user_id&lt;br /&gt;
    current_role_name.eql? 'Student' and allowed_users.include?(session[:user].id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''show'''- Show the chat interaction log&lt;br /&gt;
&lt;br /&gt;
  def show&lt;br /&gt;
    @review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    @assignment_id=@review_chat.assignment_id&lt;br /&gt;
    @reviewer_id=@review_chat.reviewer_id&lt;br /&gt;
    @team_id=@review_chat.team_id&lt;br /&gt;
    @chat_log=ReviewChat.where(:reviewer_id =&amp;gt; @reviewer_id).where(:team_id =&amp;gt; @team_id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''submitted_response'''- Create a chat record and send an email to the reviewer when an author replied to a query asked by the reviewer&lt;br /&gt;
&lt;br /&gt;
  def submitted_response&lt;br /&gt;
    @review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    @chat_reviewer=Participant.find(@review_chat.reviewer_id).user_id&lt;br /&gt;
    if(@chat_reviewer==session[:user].id) then&lt;br /&gt;
    	ReviewChat.create(:assignment_id =&amp;gt; @review_chat.assignment_id,:reviewer_id =&amp;gt; @review_chat.reviewer_id, :team_id=&amp;gt;@review_chat.team_id, :type_flag =&amp;gt; 'Q' , :content =&amp;gt; params[:response_area])&lt;br /&gt;
    	ReviewChatsHelper::chat_email_query(params[:id])&lt;br /&gt;
    	flash[:notice]=&amp;quot;Query has been submitted&amp;quot;	&lt;br /&gt;
    else	&lt;br /&gt;
      	ReviewChat.create(:assignment_id =&amp;gt; @review_chat.assignment_id,:reviewer_id =&amp;gt; @review_chat.reviewer_id, :team_id=&amp;gt;@review_chat.team_id, :type_flag =&amp;gt; 'A' , :content =&amp;gt; params[:response_area])&lt;br /&gt;
      	ReviewChatsHelper::chat_email_response(@review_chat.id,@chat_reviewer)&lt;br /&gt;
      flash[:notice]=&amp;quot;Response has been submitted&amp;quot;&lt;br /&gt;
    end	&lt;br /&gt;
    redirect_to action: 'show', id: params[:id]&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
*Create a helper file '''review_chats_helper.rb''' with the following methods:&lt;br /&gt;
&lt;br /&gt;
'''chat_email_response'''- Send an email to the author of an assignment when a reviewer posts a query&lt;br /&gt;
&lt;br /&gt;
  def self.chat_email_response(id,reviewer_id,partial=&amp;quot;new_chatemail&amp;quot;)&lt;br /&gt;
    defn = Hash.new&lt;br /&gt;
    defn[:body] = Hash.new&lt;br /&gt;
    defn[:body][:partial_name] = partial&lt;br /&gt;
    reviewer_email=User.find(reviewer_id).email&lt;br /&gt;
    defn[:subject] = &amp;quot;Response posted for submission&amp;quot;&lt;br /&gt;
    defn[:body][:type] = &amp;quot; response has been posted for your query .&lt;br /&gt;
    Please open the below URL to view.&lt;br /&gt;
    http://expertiza.ncsu.edu/review_chats/show/#{id}&amp;quot;&lt;br /&gt;
    defn[:to] = reviewer_email&lt;br /&gt;
    Mailer.sync_message(defn).deliver&lt;br /&gt;
  end &lt;br /&gt;
&lt;br /&gt;
'''chat_email_query'''- Send an email to the author of an assignment when a reviewer posts a query&lt;br /&gt;
&lt;br /&gt;
  def self.chat_email_query(id,partial=&amp;quot;new_chatemail&amp;quot;)&lt;br /&gt;
    defn = Hash.new&lt;br /&gt;
    defn[:body] = Hash.new&lt;br /&gt;
    defn[:body][:partial_name] = partial&lt;br /&gt;
    assignment=nil&lt;br /&gt;
    @team_id=ReviewChat.find(id).team_id&lt;br /&gt;
    teams_users = TeamsUser.where(team_id: @team_id)&lt;br /&gt;
    to_mail_list = Array.new&lt;br /&gt;
    teams_users.each do |teams_user|&lt;br /&gt;
    to_mail_list &amp;lt;&amp;lt; User.find(teams_user.user_id).email &lt;br /&gt;
    end&lt;br /&gt;
    defn[:subject] = &amp;quot;Query posted for submission&amp;quot;&lt;br /&gt;
    defn[:body][:type] = &amp;quot; query has been posted for your submission .&lt;br /&gt;
    Please open the below URL to view and respond.&lt;br /&gt;
    http://expertiza.ncsu.edu/review_chats/show/#{id}&amp;quot;&lt;br /&gt;
    defn[:to] = to_mail_list&lt;br /&gt;
    Mailer.sync_message(defn).deliver&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
*Modify existing controller '''response_controller.rb''' and add a new method.&lt;br /&gt;
&lt;br /&gt;
'''submitted_question'''- Create a chat record and send an email to the authors when a reviewer posts a query.&lt;br /&gt;
  def submitted_question&lt;br /&gt;
      @map = ResponseMap.find(params[:id])&lt;br /&gt;
      ReviewChat.create(:assignment_id =&amp;gt; @map.assignment.id,:reviewer_id =&amp;gt; @map.reviewer_id, :team_id=&amp;gt;@map.reviewee_id, :type_flag =&amp;gt; 'Q' , :content =&amp;gt; params[:review_question])&lt;br /&gt;
      flash[:notice]=&amp;quot;Question has been submitted to Author&amp;quot;&lt;br /&gt;
      @interaction_id=ReviewChat.where(:reviewer_id =&amp;gt; @map.reviewer_id).where(:team_id =&amp;gt; @map.reviewee_id)&lt;br /&gt;
      ReviewChatsHelper::chat_email_query(@interaction_id.first.id)&lt;br /&gt;
      redirect_to action: 'new', id: params[:id]&lt;br /&gt;
  end&lt;br /&gt;
*Create a new view '''show.html.erb''' to show the existing chat record and a box to respond and ask a follow up query.&lt;br /&gt;
&lt;br /&gt;
===Flowchart===&lt;br /&gt;
&lt;br /&gt;
[[File: ARSNFlowchart1.png]]&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
===User Interface Testing===&lt;br /&gt;
&lt;br /&gt;
* Login to Expertiza with a student account. You can use login id as 'student5700' and password as 'password'.&lt;br /&gt;
* Start reviewing an existing assignment. You would see a small query box at the bottom of the page.&lt;br /&gt;
*The reviewer enters his question in the text area provided and clicks on the &amp;quot;Submit&amp;quot; button.&lt;br /&gt;
[[File: FinalProject1.jpg]]&lt;br /&gt;
*On clicking this button the appropriate method is called in ReviewChats controller which sends an email to all the authors of the topic indicating that a question has been asked about their work. The email contains a link which when clicked on will redirect the author to the appropriate view where he/she can answer the question.&lt;br /&gt;
[[File: FinalProject4.jpg]]&lt;br /&gt;
*On answering the question, the reviewer receives an email indicating that his question has been answered. It also contains a link which redirects the reviewer to the appropriate view where the answer will be displayed.&lt;br /&gt;
*The authorized users will also be able to see a link to open existing chat interaction log.&lt;br /&gt;
[[File: FinalProject3.jpg]]&lt;br /&gt;
*This view also contains the chat history between the author/s and the reviewer for the entire duration of the interaction.&lt;br /&gt;
[[File: FinalProject2.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Model Testing===&lt;br /&gt;
&lt;br /&gt;
* Create a model test file '''review_chat_test.rb''' with the below tests.&lt;br /&gt;
'''Presence of assignment_id'''&lt;br /&gt;
&lt;br /&gt;
  test &amp;quot;assignment_id should be present&amp;quot; do&lt;br /&gt;
    @review_chat.assignment_id = &amp;quot; &amp;quot;&lt;br /&gt;
    assert_not @review_chat.assignment_id?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Presence of reviewer_id'''&lt;br /&gt;
&lt;br /&gt;
  test &amp;quot;reviewer_id should be present&amp;quot; do&lt;br /&gt;
    @review_chat.reviewer_id = &amp;quot; &amp;quot;&lt;br /&gt;
    assert_not @review_chat.reviewer_id?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Presence of team_id'''&lt;br /&gt;
&lt;br /&gt;
  test &amp;quot;team_id should be present&amp;quot; do&lt;br /&gt;
    @review_chat.team_id = &amp;quot; &amp;quot;&lt;br /&gt;
    assert_not @review_chat.team_id?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Presence of content'''&lt;br /&gt;
&lt;br /&gt;
  test &amp;quot;content should be present (nonblank)&amp;quot; do&lt;br /&gt;
    @review_chat.content = &amp;quot; &amp;quot; * 6&lt;br /&gt;
    assert_not @review_chat.valid?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Length of content'''&lt;br /&gt;
&lt;br /&gt;
  test &amp;quot;content should have a maximum length of 255&amp;quot; do&lt;br /&gt;
    @review_chat.content = &amp;quot;a&amp;quot; * 250&lt;br /&gt;
    assert @review_chat.valid?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
* To run the tests,&lt;br /&gt;
  bin/rake test test/models/review_chat_test.rb&lt;br /&gt;
&lt;br /&gt;
== Suggestions for Future Improvements ==&lt;br /&gt;
&lt;br /&gt;
* This can be extended to a live interactive author-reviewer anonymous chat session inside the Expertiza reviews window.&lt;br /&gt;
* A purging script can be developed which will clear all the interaction records every semester.&lt;br /&gt;
&lt;br /&gt;
==Resources==&lt;br /&gt;
&lt;br /&gt;
* Expertiza Github repository&amp;lt;ref&amp;gt;Expertiza Github repository https://github.com/expertiza/expertiza&amp;lt;/ref&amp;gt;&lt;br /&gt;
* Demo video&amp;lt;ref&amp;gt;Demo video https://www.youtube.com/watch?v=8E-hYiJVoZI&amp;lt;/ref&amp;gt;&lt;br /&gt;
* Github Pull request&amp;lt;ref&amp;gt;Github Pull request https://github.com/expertiza/expertiza/pull/628&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sgulati2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100391</id>
		<title>CSC/ECE 517 Fall 2015 E1586 AnonymousChatBetweenAuthorAndReviewer</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100391"/>
		<updated>2015-12-07T04:09:13Z</updated>

		<summary type="html">&lt;p&gt;Sgulati2: /* Model Testing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1586 AnonymousChatBetweenAuthorAndReviewer'''&lt;br /&gt;
&lt;br /&gt;
This page provides a brief description of the '''Expertiza''' project. The project is aimed at developing an email based anonymous session between author and a reviewer so that reviewers can ask questions to the authors for any doubts related to the assignments during peer reviewing.&lt;br /&gt;
&lt;br /&gt;
==Project==&lt;br /&gt;
&lt;br /&gt;
=== Introduction to Expertiza ===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a peer review based system which provides an incremental class based learning together with the instructors and the peers. This project has been developed together by faculty and students using [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza handles assignment submissions, team formations, assignment reviews and grades, etc.&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
During reviews, many times reviewers will be having questions about the submitted material and if it's a blocker there is no way that the reviewer can progress further with the review.  As a result, reviewers will end up submitting the empty or incomplete review.&lt;br /&gt;
&lt;br /&gt;
=== Scope ===&lt;br /&gt;
This project is limited to an email based conversation for asking questions and answers. The reviewers would ask questions related to assignment submission doubts to which authors can respond. All this would be taken care as email responses using a link provided in the email. This project does not cater to any live interactive session with spontaneous back-to-back questions and responses.&lt;br /&gt;
&lt;br /&gt;
Following tasks would be incorporated in the project:&lt;br /&gt;
* Provide a ‘TextArea’ input field on review forms, where any reviewer can type in their questions.&lt;br /&gt;
* Create a new button ‘Ask for Quick Help’ on the review forms.&lt;br /&gt;
* An email would be send to the author with the link where he can respond to the questions asked by the reviewers for their submitted work.&lt;br /&gt;
* Reviewers would be notified by an email when authors respond to the the questions.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Discussion of Resolution ===&lt;br /&gt;
Following modifications were made to implement the chat feature:- &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Create a new model which will help to extract, store and validate data in the database table which contains information about the interaction between the author/s and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Edit the view which is used by the response controller to incorporate the text area input field on the review form where the reviewer can ask his/her initial query.&lt;br /&gt;
&lt;br /&gt;
*Create a new controller with methods for authentication for a respective chat log only visible to the author and reviewer of a particular assignment, method to submit a response or a follow up query and show the existing interaction log.&lt;br /&gt;
&lt;br /&gt;
*Create a new helper with the e-mail methods for sending to the author and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Create a new view which will facilitate the author to respond to the queries asked by the reviewer. The reviewer can also use this view to ask any follow up questions.&lt;br /&gt;
&lt;br /&gt;
=== Design Patterns ===&lt;br /&gt;
The following design patterns were used for the solution:&lt;br /&gt;
 &lt;br /&gt;
* '''Observer Pattern'''&amp;lt;ref&amp;gt;Observer Design Pattern https://en.wikipedia.org/wiki/Observer_pattern&amp;lt;/ref&amp;gt;: The observer pattern is a software design pattern in which an object, called the subject, maintains a list of its dependents, called observers, and notifies them automatically of any state changes, usually by calling one of their methods. For example, we are notifying the team members whenever the reviewer submits the query.&lt;br /&gt;
&lt;br /&gt;
* '''Iterator Pattern''': In our instance, we need to display the entire chat history of a particular interaction, hence we can use the iterator design pattern to iterate through the previous chat messages.&lt;br /&gt;
&lt;br /&gt;
=== Database Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:Review_chats.png]]&lt;br /&gt;
&lt;br /&gt;
The above figure shows the schema of a new table which will be created in Expertiza to store relevant information about the chat. It contains the following attributes:&lt;br /&gt;
* id: This attribute is auto-generated by rails when we create a table and is auto incremented with each record. It is also the primary key of our table.&lt;br /&gt;
* assignment_id: Stores the ID of the assignment for which the interaction between author and reviewer is taking place.&lt;br /&gt;
* reviewer_id: Stores the ID of the reviewer who asks the questions.&lt;br /&gt;
* team_id: Stores the ID of the team to which the topic belongs.&lt;br /&gt;
* type_flag: Flag which is used to indicate if the particular tuple contains a question or answer. It can take two values, 'Q' for question and 'A' for answer.&lt;br /&gt;
* content: Stores the question asked by the reviewer or the response given by the author/s depending on the value of the type flag.&lt;br /&gt;
&lt;br /&gt;
Records for a particular interaction can be identified by using a combination of assignment_id, reviewer_id and team_id.&lt;br /&gt;
&lt;br /&gt;
=== Use Cases ===&lt;br /&gt;
'''Name:''' Send a question to the author/s about their work.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Reviewer. &amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The reviewer enters his question in the text area which is provided and clicks on the &amp;quot;Ask question&amp;quot; button which is provided as shown in the mock up. On clicking this button an email is sent to the author/s along which a link to answer the question.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''Name:''' Answer the question which has been asked by the reviewer.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Author/s&amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The author/s click on the link received in their email and are redirected to a page where they can answer the question. Once they submit the answer, an email is sent to the reviewer notifying him/her that their question has been answered.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:ARSNUsecase.jpeg]]&lt;br /&gt;
&lt;br /&gt;
=== Proposed Tests ===&lt;br /&gt;
1. For use case 1, test whether all the team members receive email with the question.&amp;lt;br/&amp;gt;&lt;br /&gt;
2. For use case 2, test whether the reviewer receive email with the response.&amp;lt;br/&amp;gt;&lt;br /&gt;
3. Test whether all the previous interactions are displayed as chat history.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
===Code Implementation===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*Create a new model '''review_chat.rb''' for ReviewChat.&lt;br /&gt;
&lt;br /&gt;
'''Validation'''- Check if the query box is not empty and restrict the query length to 255 characters.&lt;br /&gt;
&lt;br /&gt;
  validates_length_of :content , :maximum =&amp;gt; 255,message: &amp;quot;Length must be less that 255 characters&amp;quot;&lt;br /&gt;
  validates_presence_of :content, message: &amp;quot;Content cannot be blank&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*Create a new controller '''review_chats_controller.rb''' with the following methods:&lt;br /&gt;
&lt;br /&gt;
'''action_allowed?'''- Allow chat visibility to the reviewers and the authors of a particular interaction&lt;br /&gt;
&lt;br /&gt;
  def action_allowed?&lt;br /&gt;
    review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    allowed_users=Array.new&lt;br /&gt;
    team_id=review_chat.team_id&lt;br /&gt;
    teams_users = TeamsUser.where(team_id: team_id)&lt;br /&gt;
    teams_users.each do |teams_user|&lt;br /&gt;
      allowed_users &amp;lt;&amp;lt; User.find(teams_user.user_id).id&lt;br /&gt;
    end&lt;br /&gt;
    allowed_users &amp;lt;&amp;lt; Participant.find(review_chat.reviewer_id).user_id&lt;br /&gt;
    current_role_name.eql? 'Student' and allowed_users.include?(session[:user].id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''show'''- Show the chat interaction log&lt;br /&gt;
&lt;br /&gt;
  def show&lt;br /&gt;
    @review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    @assignment_id=@review_chat.assignment_id&lt;br /&gt;
    @reviewer_id=@review_chat.reviewer_id&lt;br /&gt;
    @team_id=@review_chat.team_id&lt;br /&gt;
    @chat_log=ReviewChat.where(:reviewer_id =&amp;gt; @reviewer_id).where(:team_id =&amp;gt; @team_id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''submitted_response'''- Create a chat record and send an email to the reviewer when an author replied to a query asked by the reviewer&lt;br /&gt;
&lt;br /&gt;
  def submitted_response&lt;br /&gt;
    @review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    @chat_reviewer=Participant.find(@review_chat.reviewer_id).user_id&lt;br /&gt;
    if(@chat_reviewer==session[:user].id) then&lt;br /&gt;
    	ReviewChat.create(:assignment_id =&amp;gt; @review_chat.assignment_id,:reviewer_id =&amp;gt; @review_chat.reviewer_id, :team_id=&amp;gt;@review_chat.team_id, :type_flag =&amp;gt; 'Q' , :content =&amp;gt; params[:response_area])&lt;br /&gt;
    	ReviewChatsHelper::chat_email_query(params[:id])&lt;br /&gt;
    	flash[:notice]=&amp;quot;Query has been submitted&amp;quot;	&lt;br /&gt;
    else	&lt;br /&gt;
      	ReviewChat.create(:assignment_id =&amp;gt; @review_chat.assignment_id,:reviewer_id =&amp;gt; @review_chat.reviewer_id, :team_id=&amp;gt;@review_chat.team_id, :type_flag =&amp;gt; 'A' , :content =&amp;gt; params[:response_area])&lt;br /&gt;
      	ReviewChatsHelper::chat_email_response(@review_chat.id,@chat_reviewer)&lt;br /&gt;
      flash[:notice]=&amp;quot;Response has been submitted&amp;quot;&lt;br /&gt;
    end	&lt;br /&gt;
    redirect_to action: 'show', id: params[:id]&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
*Create a helper file '''review_chats_helper.rb''' with the following methods:&lt;br /&gt;
&lt;br /&gt;
'''chat_email_response'''- Send an email to the author of an assignment when a reviewer posts a query&lt;br /&gt;
&lt;br /&gt;
  def self.chat_email_response(id,reviewer_id,partial=&amp;quot;new_chatemail&amp;quot;)&lt;br /&gt;
    defn = Hash.new&lt;br /&gt;
    defn[:body] = Hash.new&lt;br /&gt;
    defn[:body][:partial_name] = partial&lt;br /&gt;
    reviewer_email=User.find(reviewer_id).email&lt;br /&gt;
    defn[:subject] = &amp;quot;Response posted for submission&amp;quot;&lt;br /&gt;
    defn[:body][:type] = &amp;quot; response has been posted for your query .&lt;br /&gt;
    Please open the below URL to view.&lt;br /&gt;
    http://expertiza.ncsu.edu/review_chats/show/#{id}&amp;quot;&lt;br /&gt;
    defn[:to] = reviewer_email&lt;br /&gt;
    Mailer.sync_message(defn).deliver&lt;br /&gt;
  end &lt;br /&gt;
&lt;br /&gt;
'''chat_email_query'''- Send an email to the author of an assignment when a reviewer posts a query&lt;br /&gt;
&lt;br /&gt;
  def self.chat_email_query(id,partial=&amp;quot;new_chatemail&amp;quot;)&lt;br /&gt;
    defn = Hash.new&lt;br /&gt;
    defn[:body] = Hash.new&lt;br /&gt;
    defn[:body][:partial_name] = partial&lt;br /&gt;
    assignment=nil&lt;br /&gt;
    @team_id=ReviewChat.find(id).team_id&lt;br /&gt;
    teams_users = TeamsUser.where(team_id: @team_id)&lt;br /&gt;
    to_mail_list = Array.new&lt;br /&gt;
    teams_users.each do |teams_user|&lt;br /&gt;
    to_mail_list &amp;lt;&amp;lt; User.find(teams_user.user_id).email &lt;br /&gt;
    end&lt;br /&gt;
    defn[:subject] = &amp;quot;Query posted for submission&amp;quot;&lt;br /&gt;
    defn[:body][:type] = &amp;quot; query has been posted for your submission .&lt;br /&gt;
    Please open the below URL to view and respond.&lt;br /&gt;
    http://expertiza.ncsu.edu/review_chats/show/#{id}&amp;quot;&lt;br /&gt;
    defn[:to] = to_mail_list&lt;br /&gt;
    Mailer.sync_message(defn).deliver&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
*Modify existing controller '''response_controller.rb''' and add a new method.&lt;br /&gt;
&lt;br /&gt;
'''submitted_question'''- Create a chat record and send an email to the authors when a reviewer posts a query.&lt;br /&gt;
  def submitted_question&lt;br /&gt;
      @map = ResponseMap.find(params[:id])&lt;br /&gt;
      ReviewChat.create(:assignment_id =&amp;gt; @map.assignment.id,:reviewer_id =&amp;gt; @map.reviewer_id, :team_id=&amp;gt;@map.reviewee_id, :type_flag =&amp;gt; 'Q' , :content =&amp;gt; params[:review_question])&lt;br /&gt;
      flash[:notice]=&amp;quot;Question has been submitted to Author&amp;quot;&lt;br /&gt;
      @interaction_id=ReviewChat.where(:reviewer_id =&amp;gt; @map.reviewer_id).where(:team_id =&amp;gt; @map.reviewee_id)&lt;br /&gt;
      ReviewChatsHelper::chat_email_query(@interaction_id.first.id)&lt;br /&gt;
      redirect_to action: 'new', id: params[:id]&lt;br /&gt;
  end&lt;br /&gt;
*Create a new view '''show.html.erb''' to show the existing chat record and a box to respond and ask a follow up query.&lt;br /&gt;
&lt;br /&gt;
===Flowchart===&lt;br /&gt;
&lt;br /&gt;
[[File: ARSNFlowchart1.png]]&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
===User Interface Testing===&lt;br /&gt;
&lt;br /&gt;
* Login to Expertiza with a student account. You can use login id as 'student5700' and password as 'password'.&lt;br /&gt;
* Start reviewing an existing assignment. You would see a small query box at the bottom of the page.&lt;br /&gt;
*The reviewer enters his question in the text area provided and clicks on the &amp;quot;Submit&amp;quot; button.&lt;br /&gt;
[[File: FinalProject1.jpg]]&lt;br /&gt;
*On clicking this button the appropriate method is called in ReviewChats controller which sends an email to all the authors of the topic indicating that a question has been asked about their work. The email contains a link which when clicked on will redirect the author to the appropriate view where he/she can answer the question.&lt;br /&gt;
[[File: FinalProject4.jpg]]&lt;br /&gt;
*On answering the question, the reviewer receives an email indicating that his question has been answered. It also contains a link which redirects the reviewer to the appropriate view where the answer will be displayed.&lt;br /&gt;
*The authorized users will also be able to see a link to open existing chat interaction log.&lt;br /&gt;
[[File: FinalProject3.jpg]]&lt;br /&gt;
*This view also contains the chat history between the author/s and the reviewer for the entire duration of the interaction.&lt;br /&gt;
[[File: FinalProject2.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Model Testing===&lt;br /&gt;
&lt;br /&gt;
* Create a model test file '''review_chat_test.rb''' with the below tests.&lt;br /&gt;
'''Presence of assignment_id'''&lt;br /&gt;
&lt;br /&gt;
  test &amp;quot;assignment_id should be present&amp;quot; do&lt;br /&gt;
    @review_chat.assignment_id = &amp;quot; &amp;quot;&lt;br /&gt;
    assert_not @review_chat.assignment_id?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Presence of reviewer_id'''&lt;br /&gt;
&lt;br /&gt;
  test &amp;quot;reviewer_id should be present&amp;quot; do&lt;br /&gt;
    @review_chat.reviewer_id = &amp;quot; &amp;quot;&lt;br /&gt;
    assert_not @review_chat.reviewer_id?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Presence of team_id'''&lt;br /&gt;
&lt;br /&gt;
  test &amp;quot;team_id should be present&amp;quot; do&lt;br /&gt;
    @review_chat.team_id = &amp;quot; &amp;quot;&lt;br /&gt;
    assert_not @review_chat.team_id?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Presence of content'''&lt;br /&gt;
&lt;br /&gt;
  test &amp;quot;content should be present (nonblank)&amp;quot; do&lt;br /&gt;
    @review_chat.content = &amp;quot; &amp;quot; * 6&lt;br /&gt;
    assert_not @review_chat.valid?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Length of content'''&lt;br /&gt;
&lt;br /&gt;
  test &amp;quot;content should have a maximum length of 255&amp;quot; do&lt;br /&gt;
    @review_chat.content = &amp;quot;a&amp;quot; * 250&lt;br /&gt;
    assert @review_chat.valid?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
* To run the tests,&lt;br /&gt;
  bin/rake test test/models/review_chat_test.rb&lt;br /&gt;
&lt;br /&gt;
== Suggestions for Future Improvements ==&lt;br /&gt;
&lt;br /&gt;
* This can be extended to a live interactive author-reviewer anonymous chat session inside the Expertiza reviews window.&lt;br /&gt;
* A purging script can be developed which will clear all the interaction records every semester.&lt;br /&gt;
&lt;br /&gt;
==Resources==&lt;br /&gt;
&lt;br /&gt;
* Expertiza Github repository&amp;lt;ref&amp;gt;Expertiza Github repository https://github.com/expertiza/expertiza&amp;lt;/ref&amp;gt;&lt;br /&gt;
* Demo video &amp;lt;ref&amp;gt;Demo video https://www.youtube.com/watch?v=8E-hYiJVoZI&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sgulati2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100223</id>
		<title>CSC/ECE 517 Fall 2015 E1586 AnonymousChatBetweenAuthorAndReviewer</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100223"/>
		<updated>2015-12-05T01:40:59Z</updated>

		<summary type="html">&lt;p&gt;Sgulati2: /* Design Patterns */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1586 AnonymousChatBetweenAuthorAndReviewer'''&lt;br /&gt;
&lt;br /&gt;
This page provides a brief description of the '''Expertiza''' project. The project is aimed at developing an email based anonymous session between author and a reviewer so that reviewers can ask questions to the authors for any doubts related to the assignments during peer reviewing.&lt;br /&gt;
&lt;br /&gt;
==Project==&lt;br /&gt;
&lt;br /&gt;
=== Introduction to Expertiza ===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a peer review based system which provides an incremental class based learning together with the instructors and the peers. This project has been developed together by faculty and students using [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza handles assignment submissions, team formations, assignment reviews and grades, etc.&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
During reviews, many times reviewers will be having questions about the submitted material and if it's a blocker there is no way that the reviewer can progress further with the review.  As a result, reviewers will end up submitting the empty or incomplete review.&lt;br /&gt;
&lt;br /&gt;
=== Scope ===&lt;br /&gt;
This project is limited to an email based conversation for asking questions and answers. The reviewers would ask questions related to assignment submission doubts to which authors can respond. All this would be taken care as email responses using a link provided in the email. This project does not cater to any live interactive session with spontaneous back-to-back questions and responses.&lt;br /&gt;
&lt;br /&gt;
Following tasks would be incorporated in the project:&lt;br /&gt;
* Provide a ‘TextArea’ input field on review forms, where any reviewer can type in their questions.&lt;br /&gt;
* Create a new button ‘Ask for Quick Help’ on the review forms.&lt;br /&gt;
* An email would be send to the author with the link where he can respond to the questions asked by the reviewers for their submitted work.&lt;br /&gt;
* Reviewers would be notified by an email when authors respond to the the questions.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Discussion of Resolution ===&lt;br /&gt;
Following modifications were made to implement the chat feature:- &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Create a new model which will help to extract, store and validate data in the database table which contains information about the interaction between the author/s and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Edit the view which is used by the response controller to incorporate the text area input field on the review form where the reviewer can ask his/her initial query.&lt;br /&gt;
&lt;br /&gt;
*Create a new controller with methods for authentication for a respective chat log only visible to the author and reviewer of a particular assignment, method to submit a response or a follow up query and show the existing interaction log.&lt;br /&gt;
&lt;br /&gt;
*Create a new helper with the e-mail methods for sending to the author and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Create a new view which will facilitate the author to respond to the queries asked by the reviewer. The reviewer can also use this view to ask any follow up questions.&lt;br /&gt;
&lt;br /&gt;
=== Design Patterns ===&lt;br /&gt;
The following design patterns were used for the solution:&lt;br /&gt;
 &lt;br /&gt;
* '''Observer Pattern'''&amp;lt;ref&amp;gt;Observer Design Pattern https://en.wikipedia.org/wiki/Observer_pattern&amp;lt;/ref&amp;gt;: The observer pattern is a software design pattern in which an object, called the subject, maintains a list of its dependents, called observers, and notifies them automatically of any state changes, usually by calling one of their methods. For example, we are notifying the team members whenever the reviewer submits the query.&lt;br /&gt;
&lt;br /&gt;
* '''Iterator Pattern''': In our instance, we need to display the entire chat history of a particular interaction, hence we can use the iterator design pattern to iterate through the previous chat messages.&lt;br /&gt;
&lt;br /&gt;
=== Database Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:Review_chats.png]]&lt;br /&gt;
&lt;br /&gt;
The above figure shows the schema of a new table which will be created in Expertiza to store relevant information about the chat. It contains the following attributes:&lt;br /&gt;
* id: This attribute is auto-generated by rails when we create a table and is auto incremented with each record. It is also the primary key of our table.&lt;br /&gt;
* assignment_id: Stores the ID of the assignment for which the interaction between author and reviewer is taking place.&lt;br /&gt;
* reviewer_id: Stores the ID of the reviewer who asks the questions.&lt;br /&gt;
* team_id: Stores the ID of the team to which the topic belongs.&lt;br /&gt;
* type_flag: Flag which is used to indicate if the particular tuple contains a question or answer. It can take two values, 'Q' for question and 'A' for answer.&lt;br /&gt;
* content: Stores the question asked by the reviewer or the response given by the author/s depending on the value of the type flag.&lt;br /&gt;
&lt;br /&gt;
Records for a particular interaction can be identified by using a combination of assignment_id, reviewer_id and team_id.&lt;br /&gt;
&lt;br /&gt;
=== Use Cases ===&lt;br /&gt;
'''Name:''' Send a question to the author/s about their work.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Reviewer. &amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The reviewer enters his question in the text area which is provided and clicks on the &amp;quot;Ask question&amp;quot; button which is provided as shown in the mock up. On clicking this button an email is sent to the author/s along which a link to answer the question.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''Name:''' Answer the question which has been asked by the reviewer.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Author/s&amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The author/s click on the link received in their email and are redirected to a page where they can answer the question. Once they submit the answer, an email is sent to the reviewer notifying him/her that their question has been answered.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:ARSNUsecase.jpeg]]&lt;br /&gt;
&lt;br /&gt;
=== Proposed Tests ===&lt;br /&gt;
1. For use case 1, test whether all the team members receive email with the question.&amp;lt;br/&amp;gt;&lt;br /&gt;
2. For use case 2, test whether the reviewer receive email with the response.&amp;lt;br/&amp;gt;&lt;br /&gt;
3. Test whether all the previous interactions are displayed as chat history.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
===Code Implementation===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*Create a new model '''review_chat.rb''' for ReviewChat.&lt;br /&gt;
&lt;br /&gt;
'''Validation'''- Check if the query box is not empty and restrict the query length to 255 characters.&lt;br /&gt;
&lt;br /&gt;
  validates_length_of :content , :maximum =&amp;gt; 255,message: &amp;quot;Length must be less that 255 characters&amp;quot;&lt;br /&gt;
  validates_presence_of :content, message: &amp;quot;Content cannot be blank&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*Create a new controller '''review_chats_controller.rb''' with the following methods:&lt;br /&gt;
&lt;br /&gt;
'''action_allowed?'''- Allow chat visibility to the reviewers and the authors of a particular interaction&lt;br /&gt;
&lt;br /&gt;
  def action_allowed?&lt;br /&gt;
    review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    allowed_users=Array.new&lt;br /&gt;
    team_id=review_chat.team_id&lt;br /&gt;
    teams_users = TeamsUser.where(team_id: team_id)&lt;br /&gt;
    teams_users.each do |teams_user|&lt;br /&gt;
      allowed_users &amp;lt;&amp;lt; User.find(teams_user.user_id).id&lt;br /&gt;
    end&lt;br /&gt;
    allowed_users &amp;lt;&amp;lt; Participant.find(review_chat.reviewer_id).user_id&lt;br /&gt;
    current_role_name.eql? 'Student' and allowed_users.include?(session[:user].id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''show'''- Show the chat interaction log&lt;br /&gt;
&lt;br /&gt;
  def show&lt;br /&gt;
    @review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    @assignment_id=@review_chat.assignment_id&lt;br /&gt;
    @reviewer_id=@review_chat.reviewer_id&lt;br /&gt;
    @team_id=@review_chat.team_id&lt;br /&gt;
    @chat_log=ReviewChat.where(:reviewer_id =&amp;gt; @reviewer_id).where(:team_id =&amp;gt; @team_id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''submitted_response'''- Create a chat record and send an email to the reviewer when an author replied to a query asked by the reviewer&lt;br /&gt;
&lt;br /&gt;
  def submitted_response&lt;br /&gt;
    @review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    @chat_reviewer=Participant.find(@review_chat.reviewer_id).user_id&lt;br /&gt;
    if(@chat_reviewer==session[:user].id) then&lt;br /&gt;
    	ReviewChat.create(:assignment_id =&amp;gt; @review_chat.assignment_id,:reviewer_id =&amp;gt; @review_chat.reviewer_id, :team_id=&amp;gt;@review_chat.team_id, :type_flag =&amp;gt; 'Q' , :content =&amp;gt; params[:response_area])&lt;br /&gt;
    	ReviewChatsHelper::chat_email_query(params[:id])&lt;br /&gt;
    	flash[:notice]=&amp;quot;Query has been submitted&amp;quot;	&lt;br /&gt;
    else	&lt;br /&gt;
      	ReviewChat.create(:assignment_id =&amp;gt; @review_chat.assignment_id,:reviewer_id =&amp;gt; @review_chat.reviewer_id, :team_id=&amp;gt;@review_chat.team_id, :type_flag =&amp;gt; 'A' , :content =&amp;gt; params[:response_area])&lt;br /&gt;
      	ReviewChatsHelper::chat_email_response(@review_chat.id,@chat_reviewer)&lt;br /&gt;
      flash[:notice]=&amp;quot;Response has been submitted&amp;quot;&lt;br /&gt;
    end	&lt;br /&gt;
    redirect_to action: 'show', id: params[:id]&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
*Create a helper file '''review_chats_helper.rb''' with the following methods:&lt;br /&gt;
&lt;br /&gt;
'''chat_email_response'''- Send an email to the author of an assignment when a reviewer posts a query&lt;br /&gt;
&lt;br /&gt;
  def self.chat_email_response(id,reviewer_id,partial=&amp;quot;new_chatemail&amp;quot;)&lt;br /&gt;
    defn = Hash.new&lt;br /&gt;
    defn[:body] = Hash.new&lt;br /&gt;
    defn[:body][:partial_name] = partial&lt;br /&gt;
    reviewer_email=User.find(reviewer_id).email&lt;br /&gt;
    defn[:subject] = &amp;quot;Response posted for submission&amp;quot;&lt;br /&gt;
    defn[:body][:type] = &amp;quot; response has been posted for your query .&lt;br /&gt;
    Please open the below URL to view.&lt;br /&gt;
    http://expertiza.ncsu.edu/review_chats/show/#{id}&amp;quot;&lt;br /&gt;
    defn[:to] = reviewer_email&lt;br /&gt;
    Mailer.sync_message(defn).deliver&lt;br /&gt;
  end &lt;br /&gt;
&lt;br /&gt;
'''chat_email_query'''- Send an email to the author of an assignment when a reviewer posts a query&lt;br /&gt;
&lt;br /&gt;
  def self.chat_email_query(id,partial=&amp;quot;new_chatemail&amp;quot;)&lt;br /&gt;
    defn = Hash.new&lt;br /&gt;
    defn[:body] = Hash.new&lt;br /&gt;
    defn[:body][:partial_name] = partial&lt;br /&gt;
    assignment=nil&lt;br /&gt;
    @team_id=ReviewChat.find(id).team_id&lt;br /&gt;
    teams_users = TeamsUser.where(team_id: @team_id)&lt;br /&gt;
    to_mail_list = Array.new&lt;br /&gt;
    teams_users.each do |teams_user|&lt;br /&gt;
    to_mail_list &amp;lt;&amp;lt; User.find(teams_user.user_id).email &lt;br /&gt;
    end&lt;br /&gt;
    defn[:subject] = &amp;quot;Query posted for submission&amp;quot;&lt;br /&gt;
    defn[:body][:type] = &amp;quot; query has been posted for your submission .&lt;br /&gt;
    Please open the below URL to view and respond.&lt;br /&gt;
    http://expertiza.ncsu.edu/review_chats/show/#{id}&amp;quot;&lt;br /&gt;
    defn[:to] = to_mail_list&lt;br /&gt;
    Mailer.sync_message(defn).deliver&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
*Modify existing controller '''response_controller.rb''' and add a new method.&lt;br /&gt;
&lt;br /&gt;
'''submitted_question'''- Create a chat record and send an email to the authors when a reviewer posts a query.&lt;br /&gt;
  def submitted_question&lt;br /&gt;
      @map = ResponseMap.find(params[:id])&lt;br /&gt;
      ReviewChat.create(:assignment_id =&amp;gt; @map.assignment.id,:reviewer_id =&amp;gt; @map.reviewer_id, :team_id=&amp;gt;@map.reviewee_id, :type_flag =&amp;gt; 'Q' , :content =&amp;gt; params[:review_question])&lt;br /&gt;
      flash[:notice]=&amp;quot;Question has been submitted to Author&amp;quot;&lt;br /&gt;
      @interaction_id=ReviewChat.where(:reviewer_id =&amp;gt; @map.reviewer_id).where(:team_id =&amp;gt; @map.reviewee_id)&lt;br /&gt;
      ReviewChatsHelper::chat_email_query(@interaction_id.first.id)&lt;br /&gt;
      redirect_to action: 'new', id: params[:id]&lt;br /&gt;
  end&lt;br /&gt;
*Create a new view '''show.html.erb''' to show the existing chat record and a box to respond and ask a follow up query.&lt;br /&gt;
&lt;br /&gt;
===Flowchart===&lt;br /&gt;
&lt;br /&gt;
[[File: ARSNFlowchart1.png]]&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
===User Interface Testing===&lt;br /&gt;
&lt;br /&gt;
* Login to Expertiza with a student account. You can use login id as 'student5700' and password as 'password'.&lt;br /&gt;
* Start reviewing an existing assignment. You would see a small query box at the bottom of the page.&lt;br /&gt;
*The reviewer enters his question in the text area provided and clicks on the &amp;quot;Submit&amp;quot; button.&lt;br /&gt;
[[File: FinalProject1.jpg]]&lt;br /&gt;
*On clicking this button the appropriate method is called in ReviewChats controller which sends an email to all the authors of the topic indicating that a question has been asked about their work. The email contains a link which when clicked on will redirect the author to the appropriate view where he/she can answer the question.&lt;br /&gt;
[[File: FinalProject4.jpg]]&lt;br /&gt;
*On answering the question, the reviewer receives an email indicating that his question has been answered. It also contains a link which redirects the reviewer to the appropriate view where the answer will be displayed.&lt;br /&gt;
*The authorized users will also be able to see a link to open existing chat interaction log.&lt;br /&gt;
[[File: FinalProject3.jpg]]&lt;br /&gt;
*This view also contains the chat history between the author/s and the reviewer for the entire duration of the interaction.&lt;br /&gt;
[[File: FinalProject2.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Model Testing===&lt;br /&gt;
&lt;br /&gt;
* Create a model test file '''review_chat_test.rb''' and check the below.&lt;br /&gt;
'''Presence of assignment_id'''&lt;br /&gt;
&lt;br /&gt;
  test &amp;quot;assignment_id should be present&amp;quot; do&lt;br /&gt;
    @review_chat.assignment_id = &amp;quot; &amp;quot;&lt;br /&gt;
    assert_not @review_chat.assignment_id?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Presence of reviewer_id'''&lt;br /&gt;
&lt;br /&gt;
  test &amp;quot;reviewer_id should be present&amp;quot; do&lt;br /&gt;
    @review_chat.reviewer_id = &amp;quot; &amp;quot;&lt;br /&gt;
    assert_not @review_chat.reviewer_id?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Presence of team_id'''&lt;br /&gt;
&lt;br /&gt;
  test &amp;quot;team_id should be present&amp;quot; do&lt;br /&gt;
    @review_chat.team_id = &amp;quot; &amp;quot;&lt;br /&gt;
    assert_not @review_chat.team_id?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Presence of content'''&lt;br /&gt;
&lt;br /&gt;
  test &amp;quot;content should be present (nonblank)&amp;quot; do&lt;br /&gt;
    @review_chat.content = &amp;quot; &amp;quot; * 6&lt;br /&gt;
    assert_not @review_chat.valid?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Length of content'''&lt;br /&gt;
&lt;br /&gt;
  test &amp;quot;content should have a maximum length of 255&amp;quot; do&lt;br /&gt;
    @review_chat.content = &amp;quot;a&amp;quot; * 250&lt;br /&gt;
    assert @review_chat.valid?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
== Suggestions for Future Improvements ==&lt;br /&gt;
&lt;br /&gt;
* This can be extended to a live interactive author-reviewer anonymous chat session inside the Expertiza reviews window.&lt;br /&gt;
* A purging script can be developed which will clear all the interaction records every semester.&lt;br /&gt;
&lt;br /&gt;
==Resources==&lt;br /&gt;
&lt;br /&gt;
* Expertiza Github repository&amp;lt;ref&amp;gt;Expertiza Github repository https://github.com/expertiza/expertiza&amp;lt;/ref&amp;gt;&lt;br /&gt;
* Demo video &amp;lt;ref&amp;gt;Demo video https://www.youtube.com/watch?v=8E-hYiJVoZI&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sgulati2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100222</id>
		<title>CSC/ECE 517 Fall 2015 E1586 AnonymousChatBetweenAuthorAndReviewer</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100222"/>
		<updated>2015-12-05T01:40:32Z</updated>

		<summary type="html">&lt;p&gt;Sgulati2: /* Design */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1586 AnonymousChatBetweenAuthorAndReviewer'''&lt;br /&gt;
&lt;br /&gt;
This page provides a brief description of the '''Expertiza''' project. The project is aimed at developing an email based anonymous session between author and a reviewer so that reviewers can ask questions to the authors for any doubts related to the assignments during peer reviewing.&lt;br /&gt;
&lt;br /&gt;
==Project==&lt;br /&gt;
&lt;br /&gt;
=== Introduction to Expertiza ===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a peer review based system which provides an incremental class based learning together with the instructors and the peers. This project has been developed together by faculty and students using [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza handles assignment submissions, team formations, assignment reviews and grades, etc.&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
During reviews, many times reviewers will be having questions about the submitted material and if it's a blocker there is no way that the reviewer can progress further with the review.  As a result, reviewers will end up submitting the empty or incomplete review.&lt;br /&gt;
&lt;br /&gt;
=== Scope ===&lt;br /&gt;
This project is limited to an email based conversation for asking questions and answers. The reviewers would ask questions related to assignment submission doubts to which authors can respond. All this would be taken care as email responses using a link provided in the email. This project does not cater to any live interactive session with spontaneous back-to-back questions and responses.&lt;br /&gt;
&lt;br /&gt;
Following tasks would be incorporated in the project:&lt;br /&gt;
* Provide a ‘TextArea’ input field on review forms, where any reviewer can type in their questions.&lt;br /&gt;
* Create a new button ‘Ask for Quick Help’ on the review forms.&lt;br /&gt;
* An email would be send to the author with the link where he can respond to the questions asked by the reviewers for their submitted work.&lt;br /&gt;
* Reviewers would be notified by an email when authors respond to the the questions.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Discussion of Resolution ===&lt;br /&gt;
Following modifications were made to implement the chat feature:- &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Create a new model which will help to extract, store and validate data in the database table which contains information about the interaction between the author/s and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Edit the view which is used by the response controller to incorporate the text area input field on the review form where the reviewer can ask his/her initial query.&lt;br /&gt;
&lt;br /&gt;
*Create a new controller with methods for authentication for a respective chat log only visible to the author and reviewer of a particular assignment, method to submit a response or a follow up query and show the existing interaction log.&lt;br /&gt;
&lt;br /&gt;
*Create a new helper with the e-mail methods for sending to the author and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Create a new view which will facilitate the author to respond to the queries asked by the reviewer. The reviewer can also use this view to ask any follow up questions.&lt;br /&gt;
&lt;br /&gt;
=== Design Patterns ===&lt;br /&gt;
The implementation team expects that the following design patterns be used in the solution:&lt;br /&gt;
 &lt;br /&gt;
* '''Observer Pattern'''&amp;lt;ref&amp;gt;Observer Design Pattern https://en.wikipedia.org/wiki/Observer_pattern&amp;lt;/ref&amp;gt;: The observer pattern is a software design pattern in which an object, called the subject, maintains a list of its dependents, called observers, and notifies them automatically of any state changes, usually by calling one of their methods. For example, we are notifying the team members whenever the reviewer submits the query.&lt;br /&gt;
&lt;br /&gt;
* '''Iterator Pattern''': In our instance, we need to display the entire chat history of a particular interaction, hence we can use the iterator design pattern to iterate through the previous chat messages.&lt;br /&gt;
&lt;br /&gt;
=== Database Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:Review_chats.png]]&lt;br /&gt;
&lt;br /&gt;
The above figure shows the schema of a new table which will be created in Expertiza to store relevant information about the chat. It contains the following attributes:&lt;br /&gt;
* id: This attribute is auto-generated by rails when we create a table and is auto incremented with each record. It is also the primary key of our table.&lt;br /&gt;
* assignment_id: Stores the ID of the assignment for which the interaction between author and reviewer is taking place.&lt;br /&gt;
* reviewer_id: Stores the ID of the reviewer who asks the questions.&lt;br /&gt;
* team_id: Stores the ID of the team to which the topic belongs.&lt;br /&gt;
* type_flag: Flag which is used to indicate if the particular tuple contains a question or answer. It can take two values, 'Q' for question and 'A' for answer.&lt;br /&gt;
* content: Stores the question asked by the reviewer or the response given by the author/s depending on the value of the type flag.&lt;br /&gt;
&lt;br /&gt;
Records for a particular interaction can be identified by using a combination of assignment_id, reviewer_id and team_id.&lt;br /&gt;
&lt;br /&gt;
=== Use Cases ===&lt;br /&gt;
'''Name:''' Send a question to the author/s about their work.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Reviewer. &amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The reviewer enters his question in the text area which is provided and clicks on the &amp;quot;Ask question&amp;quot; button which is provided as shown in the mock up. On clicking this button an email is sent to the author/s along which a link to answer the question.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''Name:''' Answer the question which has been asked by the reviewer.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Author/s&amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The author/s click on the link received in their email and are redirected to a page where they can answer the question. Once they submit the answer, an email is sent to the reviewer notifying him/her that their question has been answered.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:ARSNUsecase.jpeg]]&lt;br /&gt;
&lt;br /&gt;
=== Proposed Tests ===&lt;br /&gt;
1. For use case 1, test whether all the team members receive email with the question.&amp;lt;br/&amp;gt;&lt;br /&gt;
2. For use case 2, test whether the reviewer receive email with the response.&amp;lt;br/&amp;gt;&lt;br /&gt;
3. Test whether all the previous interactions are displayed as chat history.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
===Code Implementation===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*Create a new model '''review_chat.rb''' for ReviewChat.&lt;br /&gt;
&lt;br /&gt;
'''Validation'''- Check if the query box is not empty and restrict the query length to 255 characters.&lt;br /&gt;
&lt;br /&gt;
  validates_length_of :content , :maximum =&amp;gt; 255,message: &amp;quot;Length must be less that 255 characters&amp;quot;&lt;br /&gt;
  validates_presence_of :content, message: &amp;quot;Content cannot be blank&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*Create a new controller '''review_chats_controller.rb''' with the following methods:&lt;br /&gt;
&lt;br /&gt;
'''action_allowed?'''- Allow chat visibility to the reviewers and the authors of a particular interaction&lt;br /&gt;
&lt;br /&gt;
  def action_allowed?&lt;br /&gt;
    review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    allowed_users=Array.new&lt;br /&gt;
    team_id=review_chat.team_id&lt;br /&gt;
    teams_users = TeamsUser.where(team_id: team_id)&lt;br /&gt;
    teams_users.each do |teams_user|&lt;br /&gt;
      allowed_users &amp;lt;&amp;lt; User.find(teams_user.user_id).id&lt;br /&gt;
    end&lt;br /&gt;
    allowed_users &amp;lt;&amp;lt; Participant.find(review_chat.reviewer_id).user_id&lt;br /&gt;
    current_role_name.eql? 'Student' and allowed_users.include?(session[:user].id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''show'''- Show the chat interaction log&lt;br /&gt;
&lt;br /&gt;
  def show&lt;br /&gt;
    @review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    @assignment_id=@review_chat.assignment_id&lt;br /&gt;
    @reviewer_id=@review_chat.reviewer_id&lt;br /&gt;
    @team_id=@review_chat.team_id&lt;br /&gt;
    @chat_log=ReviewChat.where(:reviewer_id =&amp;gt; @reviewer_id).where(:team_id =&amp;gt; @team_id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''submitted_response'''- Create a chat record and send an email to the reviewer when an author replied to a query asked by the reviewer&lt;br /&gt;
&lt;br /&gt;
  def submitted_response&lt;br /&gt;
    @review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    @chat_reviewer=Participant.find(@review_chat.reviewer_id).user_id&lt;br /&gt;
    if(@chat_reviewer==session[:user].id) then&lt;br /&gt;
    	ReviewChat.create(:assignment_id =&amp;gt; @review_chat.assignment_id,:reviewer_id =&amp;gt; @review_chat.reviewer_id, :team_id=&amp;gt;@review_chat.team_id, :type_flag =&amp;gt; 'Q' , :content =&amp;gt; params[:response_area])&lt;br /&gt;
    	ReviewChatsHelper::chat_email_query(params[:id])&lt;br /&gt;
    	flash[:notice]=&amp;quot;Query has been submitted&amp;quot;	&lt;br /&gt;
    else	&lt;br /&gt;
      	ReviewChat.create(:assignment_id =&amp;gt; @review_chat.assignment_id,:reviewer_id =&amp;gt; @review_chat.reviewer_id, :team_id=&amp;gt;@review_chat.team_id, :type_flag =&amp;gt; 'A' , :content =&amp;gt; params[:response_area])&lt;br /&gt;
      	ReviewChatsHelper::chat_email_response(@review_chat.id,@chat_reviewer)&lt;br /&gt;
      flash[:notice]=&amp;quot;Response has been submitted&amp;quot;&lt;br /&gt;
    end	&lt;br /&gt;
    redirect_to action: 'show', id: params[:id]&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
*Create a helper file '''review_chats_helper.rb''' with the following methods:&lt;br /&gt;
&lt;br /&gt;
'''chat_email_response'''- Send an email to the author of an assignment when a reviewer posts a query&lt;br /&gt;
&lt;br /&gt;
  def self.chat_email_response(id,reviewer_id,partial=&amp;quot;new_chatemail&amp;quot;)&lt;br /&gt;
    defn = Hash.new&lt;br /&gt;
    defn[:body] = Hash.new&lt;br /&gt;
    defn[:body][:partial_name] = partial&lt;br /&gt;
    reviewer_email=User.find(reviewer_id).email&lt;br /&gt;
    defn[:subject] = &amp;quot;Response posted for submission&amp;quot;&lt;br /&gt;
    defn[:body][:type] = &amp;quot; response has been posted for your query .&lt;br /&gt;
    Please open the below URL to view.&lt;br /&gt;
    http://expertiza.ncsu.edu/review_chats/show/#{id}&amp;quot;&lt;br /&gt;
    defn[:to] = reviewer_email&lt;br /&gt;
    Mailer.sync_message(defn).deliver&lt;br /&gt;
  end &lt;br /&gt;
&lt;br /&gt;
'''chat_email_query'''- Send an email to the author of an assignment when a reviewer posts a query&lt;br /&gt;
&lt;br /&gt;
  def self.chat_email_query(id,partial=&amp;quot;new_chatemail&amp;quot;)&lt;br /&gt;
    defn = Hash.new&lt;br /&gt;
    defn[:body] = Hash.new&lt;br /&gt;
    defn[:body][:partial_name] = partial&lt;br /&gt;
    assignment=nil&lt;br /&gt;
    @team_id=ReviewChat.find(id).team_id&lt;br /&gt;
    teams_users = TeamsUser.where(team_id: @team_id)&lt;br /&gt;
    to_mail_list = Array.new&lt;br /&gt;
    teams_users.each do |teams_user|&lt;br /&gt;
    to_mail_list &amp;lt;&amp;lt; User.find(teams_user.user_id).email &lt;br /&gt;
    end&lt;br /&gt;
    defn[:subject] = &amp;quot;Query posted for submission&amp;quot;&lt;br /&gt;
    defn[:body][:type] = &amp;quot; query has been posted for your submission .&lt;br /&gt;
    Please open the below URL to view and respond.&lt;br /&gt;
    http://expertiza.ncsu.edu/review_chats/show/#{id}&amp;quot;&lt;br /&gt;
    defn[:to] = to_mail_list&lt;br /&gt;
    Mailer.sync_message(defn).deliver&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
*Modify existing controller '''response_controller.rb''' and add a new method.&lt;br /&gt;
&lt;br /&gt;
'''submitted_question'''- Create a chat record and send an email to the authors when a reviewer posts a query.&lt;br /&gt;
  def submitted_question&lt;br /&gt;
      @map = ResponseMap.find(params[:id])&lt;br /&gt;
      ReviewChat.create(:assignment_id =&amp;gt; @map.assignment.id,:reviewer_id =&amp;gt; @map.reviewer_id, :team_id=&amp;gt;@map.reviewee_id, :type_flag =&amp;gt; 'Q' , :content =&amp;gt; params[:review_question])&lt;br /&gt;
      flash[:notice]=&amp;quot;Question has been submitted to Author&amp;quot;&lt;br /&gt;
      @interaction_id=ReviewChat.where(:reviewer_id =&amp;gt; @map.reviewer_id).where(:team_id =&amp;gt; @map.reviewee_id)&lt;br /&gt;
      ReviewChatsHelper::chat_email_query(@interaction_id.first.id)&lt;br /&gt;
      redirect_to action: 'new', id: params[:id]&lt;br /&gt;
  end&lt;br /&gt;
*Create a new view '''show.html.erb''' to show the existing chat record and a box to respond and ask a follow up query.&lt;br /&gt;
&lt;br /&gt;
===Flowchart===&lt;br /&gt;
&lt;br /&gt;
[[File: ARSNFlowchart1.png]]&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
===User Interface Testing===&lt;br /&gt;
&lt;br /&gt;
* Login to Expertiza with a student account. You can use login id as 'student5700' and password as 'password'.&lt;br /&gt;
* Start reviewing an existing assignment. You would see a small query box at the bottom of the page.&lt;br /&gt;
*The reviewer enters his question in the text area provided and clicks on the &amp;quot;Submit&amp;quot; button.&lt;br /&gt;
[[File: FinalProject1.jpg]]&lt;br /&gt;
*On clicking this button the appropriate method is called in ReviewChats controller which sends an email to all the authors of the topic indicating that a question has been asked about their work. The email contains a link which when clicked on will redirect the author to the appropriate view where he/she can answer the question.&lt;br /&gt;
[[File: FinalProject4.jpg]]&lt;br /&gt;
*On answering the question, the reviewer receives an email indicating that his question has been answered. It also contains a link which redirects the reviewer to the appropriate view where the answer will be displayed.&lt;br /&gt;
*The authorized users will also be able to see a link to open existing chat interaction log.&lt;br /&gt;
[[File: FinalProject3.jpg]]&lt;br /&gt;
*This view also contains the chat history between the author/s and the reviewer for the entire duration of the interaction.&lt;br /&gt;
[[File: FinalProject2.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Model Testing===&lt;br /&gt;
&lt;br /&gt;
* Create a model test file '''review_chat_test.rb''' and check the below.&lt;br /&gt;
'''Presence of assignment_id'''&lt;br /&gt;
&lt;br /&gt;
  test &amp;quot;assignment_id should be present&amp;quot; do&lt;br /&gt;
    @review_chat.assignment_id = &amp;quot; &amp;quot;&lt;br /&gt;
    assert_not @review_chat.assignment_id?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Presence of reviewer_id'''&lt;br /&gt;
&lt;br /&gt;
  test &amp;quot;reviewer_id should be present&amp;quot; do&lt;br /&gt;
    @review_chat.reviewer_id = &amp;quot; &amp;quot;&lt;br /&gt;
    assert_not @review_chat.reviewer_id?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Presence of team_id'''&lt;br /&gt;
&lt;br /&gt;
  test &amp;quot;team_id should be present&amp;quot; do&lt;br /&gt;
    @review_chat.team_id = &amp;quot; &amp;quot;&lt;br /&gt;
    assert_not @review_chat.team_id?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Presence of content'''&lt;br /&gt;
&lt;br /&gt;
  test &amp;quot;content should be present (nonblank)&amp;quot; do&lt;br /&gt;
    @review_chat.content = &amp;quot; &amp;quot; * 6&lt;br /&gt;
    assert_not @review_chat.valid?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Length of content'''&lt;br /&gt;
&lt;br /&gt;
  test &amp;quot;content should have a maximum length of 255&amp;quot; do&lt;br /&gt;
    @review_chat.content = &amp;quot;a&amp;quot; * 250&lt;br /&gt;
    assert @review_chat.valid?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
== Suggestions for Future Improvements ==&lt;br /&gt;
&lt;br /&gt;
* This can be extended to a live interactive author-reviewer anonymous chat session inside the Expertiza reviews window.&lt;br /&gt;
* A purging script can be developed which will clear all the interaction records every semester.&lt;br /&gt;
&lt;br /&gt;
==Resources==&lt;br /&gt;
&lt;br /&gt;
* Expertiza Github repository&amp;lt;ref&amp;gt;Expertiza Github repository https://github.com/expertiza/expertiza&amp;lt;/ref&amp;gt;&lt;br /&gt;
* Demo video &amp;lt;ref&amp;gt;Demo video https://www.youtube.com/watch?v=8E-hYiJVoZI&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sgulati2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100213</id>
		<title>CSC/ECE 517 Fall 2015 E1586 AnonymousChatBetweenAuthorAndReviewer</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100213"/>
		<updated>2015-12-05T01:29:06Z</updated>

		<summary type="html">&lt;p&gt;Sgulati2: /* Code Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1586 AnonymousChatBetweenAuthorAndReviewer'''&lt;br /&gt;
&lt;br /&gt;
This page provides a brief description of the '''Expertiza''' project. The project is aimed at developing an email based anonymous session between author and a reviewer so that reviewers can ask questions to the authors for any doubts related to the assignments during peer reviewing.&lt;br /&gt;
&lt;br /&gt;
==Project==&lt;br /&gt;
&lt;br /&gt;
=== Introduction to Expertiza ===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a peer review based system which provides an incremental class based learning together with the instructors and the peers. This project has been developed together by faculty and students using [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza handles assignment submissions, team formations, assignment reviews and grades, etc.&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
During reviews, many times reviewers will be having questions about the submitted material and if it's a blocker there is no way that the reviewer can progress further with the review.  As a result, reviewers will end up submitting the empty or incomplete review.&lt;br /&gt;
&lt;br /&gt;
=== Scope ===&lt;br /&gt;
This project is limited to an email based conversation for asking questions and answers. The reviewers would ask questions related to assignment submission doubts to which authors can respond. All this would be taken care as email responses using a link provided in the email. This project does not cater to any live interactive session with spontaneous back-to-back questions and responses.&lt;br /&gt;
&lt;br /&gt;
Following tasks would be incorporated in the project:&lt;br /&gt;
* Provide a ‘TextArea’ input field on review forms, where any reviewer can type in their questions.&lt;br /&gt;
* Create a new button ‘Ask for Quick Help’ on the review forms.&lt;br /&gt;
* An email would be send to the author with the link where he can respond to the questions asked by the reviewers for their submitted work.&lt;br /&gt;
* Reviewers would be notified by an email when authors respond to the the questions.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Discussion of Resolution ===&lt;br /&gt;
&lt;br /&gt;
We will make the following modifications to implement the chat feature:- &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Create a new model which will help to extract, store and validate data in the database table which contains information about the interaction between the author/s and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Edit the view which is used by the response controller to incorporate the text area input field on the review form where the reviewer can ask his/her initial query.&lt;br /&gt;
&lt;br /&gt;
*Create a new controller with methods for authentication for a respective chat log only visible to the author and reviewer of a particular assignment, method to submit a response or a follow up query and show the existing interaction log.&lt;br /&gt;
&lt;br /&gt;
*Create a new helper with the e-mail methods for sending to the author and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Create a new view which will facilitate the author to respond to the queries asked by the reviewer. The reviewer can also use this view to ask any follow up questions.&lt;br /&gt;
&lt;br /&gt;
=== Design Patterns ===&lt;br /&gt;
The implementation team expects that the following design patterns be used in the solution:&lt;br /&gt;
 &lt;br /&gt;
* '''Observer Pattern'''&amp;lt;ref&amp;gt;Observer Design Pattern https://en.wikipedia.org/wiki/Observer_pattern&amp;lt;/ref&amp;gt;: The observer pattern is a software design pattern in which an object, called the subject, maintains a list of its dependents, called observers, and notifies them automatically of any state changes, usually by calling one of their methods. For example, we are notifying the team members whenever the reviewer submits the query.&lt;br /&gt;
&lt;br /&gt;
* '''Iterator Pattern''': In our instance, we need to display the entire chat history of a particular interaction, hence we can use the iterator design pattern to iterate through the previous chat messages.&lt;br /&gt;
&lt;br /&gt;
=== Database Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:Review_chats.png]]&lt;br /&gt;
&lt;br /&gt;
The above figure shows the schema of a new table which will be created in Expertiza to store relevant information about the chat. It contains the following attributes:&lt;br /&gt;
* id: This attribute is auto-generated by rails when we create a table and is auto incremented with each record. It is also the primary key of our table.&lt;br /&gt;
* assignment_id: Stores the ID of the assignment for which the interaction between author and reviewer is taking place.&lt;br /&gt;
* reviewer_id: Stores the ID of the reviewer who asks the questions.&lt;br /&gt;
* team_id: Stores the ID of the team to which the topic belongs.&lt;br /&gt;
* type_flag: Flag which is used to indicate if the particular tuple contains a question or answer. It can take two values, 'Q' for question and 'A' for answer.&lt;br /&gt;
* content: Stores the question asked by the reviewer or the response given by the author/s depending on the value of the type flag.&lt;br /&gt;
&lt;br /&gt;
Records for a particular interaction can be identified by using a combination of assignment_id, reviewer_id and team_id.&lt;br /&gt;
&lt;br /&gt;
=== Use Cases ===&lt;br /&gt;
'''Name:''' Send a question to the author/s about their work.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Reviewer. &amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The reviewer enters his question in the text area which is provided and clicks on the &amp;quot;Ask question&amp;quot; button which is provided as shown in the mock up. On clicking this button an email is sent to the author/s along which a link to answer the question.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''Name:''' Answer the question which has been asked by the reviewer.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Author/s&amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The author/s click on the link received in their email and are redirected to a page where they can answer the question. Once they submit the answer, an email is sent to the reviewer notifying him/her that their question has been answered.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:ARSNUsecase.jpeg]]&lt;br /&gt;
&lt;br /&gt;
=== Proposed Tests ===&lt;br /&gt;
1. For use case 1, test whether all the team members receive email with the question.&amp;lt;br/&amp;gt;&lt;br /&gt;
2. For use case 2, test whether the reviewer receive email with the response.&amp;lt;br/&amp;gt;&lt;br /&gt;
3. Test whether all the previous interactions are displayed as chat history.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
===Code Implementation===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*Create a new model '''review_chat.rb''' for ReviewChat.&lt;br /&gt;
&lt;br /&gt;
'''Validation'''- Check if the query box is not empty and restrict the query length to 255 characters.&lt;br /&gt;
&lt;br /&gt;
  validates_length_of :content , :maximum =&amp;gt; 255,message: &amp;quot;Length must be less that 255 characters&amp;quot;&lt;br /&gt;
  validates_presence_of :content, message: &amp;quot;Content cannot be blank&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*Create a new controller '''review_chats_controller.rb''' with the following methods:&lt;br /&gt;
&lt;br /&gt;
'''action_allowed?'''- Allow chat visibility to the reviewers and the authors of a particular interaction&lt;br /&gt;
&lt;br /&gt;
  def action_allowed?&lt;br /&gt;
    review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    allowed_users=Array.new&lt;br /&gt;
    team_id=review_chat.team_id&lt;br /&gt;
    teams_users = TeamsUser.where(team_id: team_id)&lt;br /&gt;
    teams_users.each do |teams_user|&lt;br /&gt;
      allowed_users &amp;lt;&amp;lt; User.find(teams_user.user_id).id&lt;br /&gt;
    end&lt;br /&gt;
    allowed_users &amp;lt;&amp;lt; Participant.find(review_chat.reviewer_id).user_id&lt;br /&gt;
    current_role_name.eql? 'Student' and allowed_users.include?(session[:user].id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''show'''- Show the chat interaction log&lt;br /&gt;
&lt;br /&gt;
  def show&lt;br /&gt;
    @review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    @assignment_id=@review_chat.assignment_id&lt;br /&gt;
    @reviewer_id=@review_chat.reviewer_id&lt;br /&gt;
    @team_id=@review_chat.team_id&lt;br /&gt;
    @chat_log=ReviewChat.where(:reviewer_id =&amp;gt; @reviewer_id).where(:team_id =&amp;gt; @team_id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''submitted_response'''- Create a chat record and send an email to the reviewer when an author replied to a query asked by the reviewer&lt;br /&gt;
&lt;br /&gt;
  def submitted_response&lt;br /&gt;
    @review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    @chat_reviewer=Participant.find(@review_chat.reviewer_id).user_id&lt;br /&gt;
    if(@chat_reviewer==session[:user].id) then&lt;br /&gt;
    	ReviewChat.create(:assignment_id =&amp;gt; @review_chat.assignment_id,:reviewer_id =&amp;gt; @review_chat.reviewer_id, :team_id=&amp;gt;@review_chat.team_id, :type_flag =&amp;gt; 'Q' , :content =&amp;gt; params[:response_area])&lt;br /&gt;
    	ReviewChatsHelper::chat_email_query(params[:id])&lt;br /&gt;
    	flash[:notice]=&amp;quot;Query has been submitted&amp;quot;	&lt;br /&gt;
    else	&lt;br /&gt;
      	ReviewChat.create(:assignment_id =&amp;gt; @review_chat.assignment_id,:reviewer_id =&amp;gt; @review_chat.reviewer_id, :team_id=&amp;gt;@review_chat.team_id, :type_flag =&amp;gt; 'A' , :content =&amp;gt; params[:response_area])&lt;br /&gt;
      	ReviewChatsHelper::chat_email_response(@review_chat.id,@chat_reviewer)&lt;br /&gt;
      flash[:notice]=&amp;quot;Response has been submitted&amp;quot;&lt;br /&gt;
    end	&lt;br /&gt;
    redirect_to action: 'show', id: params[:id]&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
*Create a helper file '''review_chats_helper.rb''' with the following methods:&lt;br /&gt;
&lt;br /&gt;
'''chat_email_response'''- Send an email to the author of an assignment when a reviewer posts a query&lt;br /&gt;
&lt;br /&gt;
  def self.chat_email_response(id,reviewer_id,partial=&amp;quot;new_chatemail&amp;quot;)&lt;br /&gt;
    defn = Hash.new&lt;br /&gt;
    defn[:body] = Hash.new&lt;br /&gt;
    defn[:body][:partial_name] = partial&lt;br /&gt;
    reviewer_email=User.find(reviewer_id).email&lt;br /&gt;
    defn[:subject] = &amp;quot;Response posted for submission&amp;quot;&lt;br /&gt;
    defn[:body][:type] = &amp;quot; response has been posted for your query .&lt;br /&gt;
    Please open the below URL to view.&lt;br /&gt;
    http://expertiza.ncsu.edu/review_chats/show/#{id}&amp;quot;&lt;br /&gt;
    defn[:to] = reviewer_email&lt;br /&gt;
    Mailer.sync_message(defn).deliver&lt;br /&gt;
  end &lt;br /&gt;
&lt;br /&gt;
'''chat_email_query'''- Send an email to the author of an assignment when a reviewer posts a query&lt;br /&gt;
&lt;br /&gt;
  def self.chat_email_query(id,partial=&amp;quot;new_chatemail&amp;quot;)&lt;br /&gt;
    defn = Hash.new&lt;br /&gt;
    defn[:body] = Hash.new&lt;br /&gt;
    defn[:body][:partial_name] = partial&lt;br /&gt;
    assignment=nil&lt;br /&gt;
    @team_id=ReviewChat.find(id).team_id&lt;br /&gt;
    teams_users = TeamsUser.where(team_id: @team_id)&lt;br /&gt;
    to_mail_list = Array.new&lt;br /&gt;
    teams_users.each do |teams_user|&lt;br /&gt;
    to_mail_list &amp;lt;&amp;lt; User.find(teams_user.user_id).email &lt;br /&gt;
    end&lt;br /&gt;
    defn[:subject] = &amp;quot;Query posted for submission&amp;quot;&lt;br /&gt;
    defn[:body][:type] = &amp;quot; query has been posted for your submission .&lt;br /&gt;
    Please open the below URL to view and respond.&lt;br /&gt;
    http://expertiza.ncsu.edu/review_chats/show/#{id}&amp;quot;&lt;br /&gt;
    defn[:to] = to_mail_list&lt;br /&gt;
    Mailer.sync_message(defn).deliver&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
*Modify existing controller '''response_controller.rb''' and add a new method.&lt;br /&gt;
&lt;br /&gt;
'''submitted_question'''- Create a chat record and send an email to the authors when a reviewer posts a query.&lt;br /&gt;
  def submitted_question&lt;br /&gt;
      @map = ResponseMap.find(params[:id])&lt;br /&gt;
      ReviewChat.create(:assignment_id =&amp;gt; @map.assignment.id,:reviewer_id =&amp;gt; @map.reviewer_id, :team_id=&amp;gt;@map.reviewee_id, :type_flag =&amp;gt; 'Q' , :content =&amp;gt; params[:review_question])&lt;br /&gt;
      flash[:notice]=&amp;quot;Question has been submitted to Author&amp;quot;&lt;br /&gt;
      @interaction_id=ReviewChat.where(:reviewer_id =&amp;gt; @map.reviewer_id).where(:team_id =&amp;gt; @map.reviewee_id)&lt;br /&gt;
      ReviewChatsHelper::chat_email_query(@interaction_id.first.id)&lt;br /&gt;
      redirect_to action: 'new', id: params[:id]&lt;br /&gt;
  end&lt;br /&gt;
*Create a new view '''show.html.erb''' to show the existing chat record and a box to respond and ask a follow up query.&lt;br /&gt;
&lt;br /&gt;
===Flowchart===&lt;br /&gt;
&lt;br /&gt;
[[File: ARSNFlowchart1.png]]&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
===User Interface Testing===&lt;br /&gt;
&lt;br /&gt;
* Login to Expertiza with a student account. You can use login id as 'student5700' and password as 'password'.&lt;br /&gt;
* Start reviewing an existing assignment. You would see a small query box at the bottom of the page.&lt;br /&gt;
*The reviewer enters his question in the text area provided and clicks on the &amp;quot;Submit&amp;quot; button.&lt;br /&gt;
[[File: FinalProject1.jpg]]&lt;br /&gt;
*On clicking this button the appropriate method is called in ReviewChats controller which sends an email to all the authors of the topic indicating that a question has been asked about their work. The email contains a link which when clicked on will redirect the author to the appropriate view where he/she can answer the question.&lt;br /&gt;
[[File: FinalProject4.jpg]]&lt;br /&gt;
*On answering the question, the reviewer receives an email indicating that his question has been answered. It also contains a link which redirects the reviewer to the appropriate view where the answer will be displayed.&lt;br /&gt;
*The authorized users will also be able to see a link to open existing chat interaction log.&lt;br /&gt;
[[File: FinalProject3.jpg]]&lt;br /&gt;
*This view also contains the chat history between the author/s and the reviewer for the entire duration of the interaction.&lt;br /&gt;
[[File: FinalProject2.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Model Testing===&lt;br /&gt;
&lt;br /&gt;
* Create a model test file '''review_chat_test.rb''' and check the below.&lt;br /&gt;
'''Presence of assignment_id'''&lt;br /&gt;
&lt;br /&gt;
  test &amp;quot;assignment_id should be present&amp;quot; do&lt;br /&gt;
    @review_chat.assignment_id = &amp;quot; &amp;quot;&lt;br /&gt;
    assert_not @review_chat.assignment_id?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Presence of reviewer_id'''&lt;br /&gt;
&lt;br /&gt;
  test &amp;quot;reviewer_id should be present&amp;quot; do&lt;br /&gt;
    @review_chat.reviewer_id = &amp;quot; &amp;quot;&lt;br /&gt;
    assert_not @review_chat.reviewer_id?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Presence of team_id'''&lt;br /&gt;
&lt;br /&gt;
  test &amp;quot;team_id should be present&amp;quot; do&lt;br /&gt;
    @review_chat.team_id = &amp;quot; &amp;quot;&lt;br /&gt;
    assert_not @review_chat.team_id?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Presence of content'''&lt;br /&gt;
&lt;br /&gt;
  test &amp;quot;content should be present (nonblank)&amp;quot; do&lt;br /&gt;
    @review_chat.content = &amp;quot; &amp;quot; * 6&lt;br /&gt;
    assert_not @review_chat.valid?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Length of content'''&lt;br /&gt;
&lt;br /&gt;
  test &amp;quot;content should have a maximum length of 255&amp;quot; do&lt;br /&gt;
    @review_chat.content = &amp;quot;a&amp;quot; * 250&lt;br /&gt;
    assert @review_chat.valid?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
== Suggestions for Future Improvements ==&lt;br /&gt;
&lt;br /&gt;
* This can be extended to a live interactive author-reviewer anonymous chat session inside the Expertiza reviews window.&lt;br /&gt;
* A purging script can be developed which will clear all the interaction records every semester.&lt;br /&gt;
&lt;br /&gt;
==Resources==&lt;br /&gt;
&lt;br /&gt;
* Expertiza Github repository&amp;lt;ref&amp;gt;Expertiza Github repository https://github.com/expertiza/expertiza&amp;lt;/ref&amp;gt;&lt;br /&gt;
* Demo video &amp;lt;ref&amp;gt;Demo video https://www.youtube.com/watch?v=8E-hYiJVoZI&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sgulati2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100212</id>
		<title>CSC/ECE 517 Fall 2015 E1586 AnonymousChatBetweenAuthorAndReviewer</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100212"/>
		<updated>2015-12-05T01:28:35Z</updated>

		<summary type="html">&lt;p&gt;Sgulati2: /* Code Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1586 AnonymousChatBetweenAuthorAndReviewer'''&lt;br /&gt;
&lt;br /&gt;
This page provides a brief description of the '''Expertiza''' project. The project is aimed at developing an email based anonymous session between author and a reviewer so that reviewers can ask questions to the authors for any doubts related to the assignments during peer reviewing.&lt;br /&gt;
&lt;br /&gt;
==Project==&lt;br /&gt;
&lt;br /&gt;
=== Introduction to Expertiza ===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a peer review based system which provides an incremental class based learning together with the instructors and the peers. This project has been developed together by faculty and students using [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza handles assignment submissions, team formations, assignment reviews and grades, etc.&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
During reviews, many times reviewers will be having questions about the submitted material and if it's a blocker there is no way that the reviewer can progress further with the review.  As a result, reviewers will end up submitting the empty or incomplete review.&lt;br /&gt;
&lt;br /&gt;
=== Scope ===&lt;br /&gt;
This project is limited to an email based conversation for asking questions and answers. The reviewers would ask questions related to assignment submission doubts to which authors can respond. All this would be taken care as email responses using a link provided in the email. This project does not cater to any live interactive session with spontaneous back-to-back questions and responses.&lt;br /&gt;
&lt;br /&gt;
Following tasks would be incorporated in the project:&lt;br /&gt;
* Provide a ‘TextArea’ input field on review forms, where any reviewer can type in their questions.&lt;br /&gt;
* Create a new button ‘Ask for Quick Help’ on the review forms.&lt;br /&gt;
* An email would be send to the author with the link where he can respond to the questions asked by the reviewers for their submitted work.&lt;br /&gt;
* Reviewers would be notified by an email when authors respond to the the questions.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Discussion of Resolution ===&lt;br /&gt;
&lt;br /&gt;
We will make the following modifications to implement the chat feature:- &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Create a new model which will help to extract, store and validate data in the database table which contains information about the interaction between the author/s and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Edit the view which is used by the response controller to incorporate the text area input field on the review form where the reviewer can ask his/her initial query.&lt;br /&gt;
&lt;br /&gt;
*Create a new controller with methods for authentication for a respective chat log only visible to the author and reviewer of a particular assignment, method to submit a response or a follow up query and show the existing interaction log.&lt;br /&gt;
&lt;br /&gt;
*Create a new helper with the e-mail methods for sending to the author and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Create a new view which will facilitate the author to respond to the queries asked by the reviewer. The reviewer can also use this view to ask any follow up questions.&lt;br /&gt;
&lt;br /&gt;
=== Design Patterns ===&lt;br /&gt;
The implementation team expects that the following design patterns be used in the solution:&lt;br /&gt;
 &lt;br /&gt;
* '''Observer Pattern'''&amp;lt;ref&amp;gt;Observer Design Pattern https://en.wikipedia.org/wiki/Observer_pattern&amp;lt;/ref&amp;gt;: The observer pattern is a software design pattern in which an object, called the subject, maintains a list of its dependents, called observers, and notifies them automatically of any state changes, usually by calling one of their methods. For example, we are notifying the team members whenever the reviewer submits the query.&lt;br /&gt;
&lt;br /&gt;
* '''Iterator Pattern''': In our instance, we need to display the entire chat history of a particular interaction, hence we can use the iterator design pattern to iterate through the previous chat messages.&lt;br /&gt;
&lt;br /&gt;
=== Database Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:Review_chats.png]]&lt;br /&gt;
&lt;br /&gt;
The above figure shows the schema of a new table which will be created in Expertiza to store relevant information about the chat. It contains the following attributes:&lt;br /&gt;
* id: This attribute is auto-generated by rails when we create a table and is auto incremented with each record. It is also the primary key of our table.&lt;br /&gt;
* assignment_id: Stores the ID of the assignment for which the interaction between author and reviewer is taking place.&lt;br /&gt;
* reviewer_id: Stores the ID of the reviewer who asks the questions.&lt;br /&gt;
* team_id: Stores the ID of the team to which the topic belongs.&lt;br /&gt;
* type_flag: Flag which is used to indicate if the particular tuple contains a question or answer. It can take two values, 'Q' for question and 'A' for answer.&lt;br /&gt;
* content: Stores the question asked by the reviewer or the response given by the author/s depending on the value of the type flag.&lt;br /&gt;
&lt;br /&gt;
Records for a particular interaction can be identified by using a combination of assignment_id, reviewer_id and team_id.&lt;br /&gt;
&lt;br /&gt;
=== Use Cases ===&lt;br /&gt;
'''Name:''' Send a question to the author/s about their work.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Reviewer. &amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The reviewer enters his question in the text area which is provided and clicks on the &amp;quot;Ask question&amp;quot; button which is provided as shown in the mock up. On clicking this button an email is sent to the author/s along which a link to answer the question.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''Name:''' Answer the question which has been asked by the reviewer.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Author/s&amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The author/s click on the link received in their email and are redirected to a page where they can answer the question. Once they submit the answer, an email is sent to the reviewer notifying him/her that their question has been answered.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:ARSNUsecase.jpeg]]&lt;br /&gt;
&lt;br /&gt;
=== Proposed Tests ===&lt;br /&gt;
1. For use case 1, test whether all the team members receive email with the question.&amp;lt;br/&amp;gt;&lt;br /&gt;
2. For use case 2, test whether the reviewer receive email with the response.&amp;lt;br/&amp;gt;&lt;br /&gt;
3. Test whether all the previous interactions are displayed as chat history.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
===Code Implementation===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*Create a new model '''review_chat.rb''' for ReviewChat.&lt;br /&gt;
&lt;br /&gt;
'''Validation'''- Check if the query box is not empty and restrict the query length to 255 characters.&lt;br /&gt;
&lt;br /&gt;
  validates_length_of :content , :maximum =&amp;gt; 255,message: &amp;quot;Length must be less that 255 characters&amp;quot;&lt;br /&gt;
  validates_presence_of :content, message: &amp;quot;Content cannot be blank&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*Create a new controller '''review_chats_controller.rb''' with the following methods:&lt;br /&gt;
&lt;br /&gt;
'''action_allowed?'''- Allow chat visibility to the reviewers and the authors of a particular interaction&lt;br /&gt;
&lt;br /&gt;
  def action_allowed?&lt;br /&gt;
    review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    allowed_users=Array.new&lt;br /&gt;
    team_id=review_chat.team_id&lt;br /&gt;
    teams_users = TeamsUser.where(team_id: team_id)&lt;br /&gt;
    teams_users.each do |teams_user|&lt;br /&gt;
      allowed_users &amp;lt;&amp;lt; User.find(teams_user.user_id).id&lt;br /&gt;
    end&lt;br /&gt;
    allowed_users &amp;lt;&amp;lt; Participant.find(review_chat.reviewer_id).user_id&lt;br /&gt;
    current_role_name.eql? 'Student' and allowed_users.include?(session[:user].id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''show'''- Show the chat interaction log&lt;br /&gt;
&lt;br /&gt;
  def show&lt;br /&gt;
    @review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    @assignment_id=@review_chat.assignment_id&lt;br /&gt;
    @reviewer_id=@review_chat.reviewer_id&lt;br /&gt;
    @team_id=@review_chat.team_id&lt;br /&gt;
    @chat_log=ReviewChat.where(:reviewer_id =&amp;gt; @reviewer_id).where(:team_id =&amp;gt; @team_id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''submitted_response'''- Create a chat record and send an email to the reviewer when an author replied to a query asked by the reviewer&lt;br /&gt;
&lt;br /&gt;
  def submitted_response&lt;br /&gt;
    @review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    @chat_reviewer=Participant.find(@review_chat.reviewer_id).user_id&lt;br /&gt;
    if(@chat_reviewer==session[:user].id) then&lt;br /&gt;
    	ReviewChat.create(:assignment_id =&amp;gt; @review_chat.assignment_id,:reviewer_id =&amp;gt; @review_chat.reviewer_id, :team_id=&amp;gt;@review_chat.team_id, :type_flag =&amp;gt; 'Q' , :content =&amp;gt; params[:response_area])&lt;br /&gt;
    	ReviewChatsHelper::chat_email_query(params[:id])&lt;br /&gt;
    	flash[:notice]=&amp;quot;Query has been submitted&amp;quot;	&lt;br /&gt;
    else	&lt;br /&gt;
      	ReviewChat.create(:assignment_id =&amp;gt; @review_chat.assignment_id,:reviewer_id =&amp;gt; @review_chat.reviewer_id, :team_id=&amp;gt;@review_chat.team_id, :type_flag =&amp;gt; 'A' , :content =&amp;gt; params[:response_area])&lt;br /&gt;
      	ReviewChatsHelper::chat_email_response(@review_chat.id,@chat_reviewer)&lt;br /&gt;
      flash[:notice]=&amp;quot;Response has been submitted&amp;quot;&lt;br /&gt;
    end	&lt;br /&gt;
    redirect_to action: 'show', id: params[:id]&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
*Methods in the helper file '''review_chats_helper.rb'''&lt;br /&gt;
&lt;br /&gt;
'''chat_email_response'''- Send an email to the author of an assignment when a reviewer posts a query&lt;br /&gt;
&lt;br /&gt;
  def self.chat_email_response(id,reviewer_id,partial=&amp;quot;new_chatemail&amp;quot;)&lt;br /&gt;
    defn = Hash.new&lt;br /&gt;
    defn[:body] = Hash.new&lt;br /&gt;
    defn[:body][:partial_name] = partial&lt;br /&gt;
    reviewer_email=User.find(reviewer_id).email&lt;br /&gt;
    defn[:subject] = &amp;quot;Response posted for submission&amp;quot;&lt;br /&gt;
    defn[:body][:type] = &amp;quot; response has been posted for your query .&lt;br /&gt;
    Please open the below URL to view.&lt;br /&gt;
    http://expertiza.ncsu.edu/review_chats/show/#{id}&amp;quot;&lt;br /&gt;
    defn[:to] = reviewer_email&lt;br /&gt;
    Mailer.sync_message(defn).deliver&lt;br /&gt;
  end &lt;br /&gt;
&lt;br /&gt;
'''chat_email_query'''- Send an email to the author of an assignment when a reviewer posts a query&lt;br /&gt;
&lt;br /&gt;
  def self.chat_email_query(id,partial=&amp;quot;new_chatemail&amp;quot;)&lt;br /&gt;
    defn = Hash.new&lt;br /&gt;
    defn[:body] = Hash.new&lt;br /&gt;
    defn[:body][:partial_name] = partial&lt;br /&gt;
    assignment=nil&lt;br /&gt;
    @team_id=ReviewChat.find(id).team_id&lt;br /&gt;
    teams_users = TeamsUser.where(team_id: @team_id)&lt;br /&gt;
    to_mail_list = Array.new&lt;br /&gt;
    teams_users.each do |teams_user|&lt;br /&gt;
    to_mail_list &amp;lt;&amp;lt; User.find(teams_user.user_id).email &lt;br /&gt;
    end&lt;br /&gt;
    defn[:subject] = &amp;quot;Query posted for submission&amp;quot;&lt;br /&gt;
    defn[:body][:type] = &amp;quot; query has been posted for your submission .&lt;br /&gt;
    Please open the below URL to view and respond.&lt;br /&gt;
    http://expertiza.ncsu.edu/review_chats/show/#{id}&amp;quot;&lt;br /&gt;
    defn[:to] = to_mail_list&lt;br /&gt;
    Mailer.sync_message(defn).deliver&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
*Modify existing controller '''response_controller.rb''' and add a new method.&lt;br /&gt;
&lt;br /&gt;
'''submitted_question'''- Create a chat record and send an email to the authors when a reviewer posts a query.&lt;br /&gt;
  def submitted_question&lt;br /&gt;
      @map = ResponseMap.find(params[:id])&lt;br /&gt;
      ReviewChat.create(:assignment_id =&amp;gt; @map.assignment.id,:reviewer_id =&amp;gt; @map.reviewer_id, :team_id=&amp;gt;@map.reviewee_id, :type_flag =&amp;gt; 'Q' , :content =&amp;gt; params[:review_question])&lt;br /&gt;
      flash[:notice]=&amp;quot;Question has been submitted to Author&amp;quot;&lt;br /&gt;
      @interaction_id=ReviewChat.where(:reviewer_id =&amp;gt; @map.reviewer_id).where(:team_id =&amp;gt; @map.reviewee_id)&lt;br /&gt;
      ReviewChatsHelper::chat_email_query(@interaction_id.first.id)&lt;br /&gt;
      redirect_to action: 'new', id: params[:id]&lt;br /&gt;
  end&lt;br /&gt;
*Create a new view '''show.html.erb''' to show the existing chat record and a box to respond and ask a follow up query.&lt;br /&gt;
&lt;br /&gt;
===Flowchart===&lt;br /&gt;
&lt;br /&gt;
[[File: ARSNFlowchart1.png]]&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
===User Interface Testing===&lt;br /&gt;
&lt;br /&gt;
* Login to Expertiza with a student account. You can use login id as 'student5700' and password as 'password'.&lt;br /&gt;
* Start reviewing an existing assignment. You would see a small query box at the bottom of the page.&lt;br /&gt;
*The reviewer enters his question in the text area provided and clicks on the &amp;quot;Submit&amp;quot; button.&lt;br /&gt;
[[File: FinalProject1.jpg]]&lt;br /&gt;
*On clicking this button the appropriate method is called in ReviewChats controller which sends an email to all the authors of the topic indicating that a question has been asked about their work. The email contains a link which when clicked on will redirect the author to the appropriate view where he/she can answer the question.&lt;br /&gt;
[[File: FinalProject4.jpg]]&lt;br /&gt;
*On answering the question, the reviewer receives an email indicating that his question has been answered. It also contains a link which redirects the reviewer to the appropriate view where the answer will be displayed.&lt;br /&gt;
*The authorized users will also be able to see a link to open existing chat interaction log.&lt;br /&gt;
[[File: FinalProject3.jpg]]&lt;br /&gt;
*This view also contains the chat history between the author/s and the reviewer for the entire duration of the interaction.&lt;br /&gt;
[[File: FinalProject2.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Model Testing===&lt;br /&gt;
&lt;br /&gt;
* Create a model test file '''review_chat_test.rb''' and check the below.&lt;br /&gt;
'''Presence of assignment_id'''&lt;br /&gt;
&lt;br /&gt;
  test &amp;quot;assignment_id should be present&amp;quot; do&lt;br /&gt;
    @review_chat.assignment_id = &amp;quot; &amp;quot;&lt;br /&gt;
    assert_not @review_chat.assignment_id?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Presence of reviewer_id'''&lt;br /&gt;
&lt;br /&gt;
  test &amp;quot;reviewer_id should be present&amp;quot; do&lt;br /&gt;
    @review_chat.reviewer_id = &amp;quot; &amp;quot;&lt;br /&gt;
    assert_not @review_chat.reviewer_id?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Presence of team_id'''&lt;br /&gt;
&lt;br /&gt;
  test &amp;quot;team_id should be present&amp;quot; do&lt;br /&gt;
    @review_chat.team_id = &amp;quot; &amp;quot;&lt;br /&gt;
    assert_not @review_chat.team_id?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Presence of content'''&lt;br /&gt;
&lt;br /&gt;
  test &amp;quot;content should be present (nonblank)&amp;quot; do&lt;br /&gt;
    @review_chat.content = &amp;quot; &amp;quot; * 6&lt;br /&gt;
    assert_not @review_chat.valid?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Length of content'''&lt;br /&gt;
&lt;br /&gt;
  test &amp;quot;content should have a maximum length of 255&amp;quot; do&lt;br /&gt;
    @review_chat.content = &amp;quot;a&amp;quot; * 250&lt;br /&gt;
    assert @review_chat.valid?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
== Suggestions for Future Improvements ==&lt;br /&gt;
&lt;br /&gt;
* This can be extended to a live interactive author-reviewer anonymous chat session inside the Expertiza reviews window.&lt;br /&gt;
* A purging script can be developed which will clear all the interaction records every semester.&lt;br /&gt;
&lt;br /&gt;
==Resources==&lt;br /&gt;
&lt;br /&gt;
* Expertiza Github repository&amp;lt;ref&amp;gt;Expertiza Github repository https://github.com/expertiza/expertiza&amp;lt;/ref&amp;gt;&lt;br /&gt;
* Demo video &amp;lt;ref&amp;gt;Demo video https://www.youtube.com/watch?v=8E-hYiJVoZI&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sgulati2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100211</id>
		<title>CSC/ECE 517 Fall 2015 E1586 AnonymousChatBetweenAuthorAndReviewer</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100211"/>
		<updated>2015-12-05T01:27:06Z</updated>

		<summary type="html">&lt;p&gt;Sgulati2: /* Proposed Tests */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1586 AnonymousChatBetweenAuthorAndReviewer'''&lt;br /&gt;
&lt;br /&gt;
This page provides a brief description of the '''Expertiza''' project. The project is aimed at developing an email based anonymous session between author and a reviewer so that reviewers can ask questions to the authors for any doubts related to the assignments during peer reviewing.&lt;br /&gt;
&lt;br /&gt;
==Project==&lt;br /&gt;
&lt;br /&gt;
=== Introduction to Expertiza ===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a peer review based system which provides an incremental class based learning together with the instructors and the peers. This project has been developed together by faculty and students using [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza handles assignment submissions, team formations, assignment reviews and grades, etc.&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
During reviews, many times reviewers will be having questions about the submitted material and if it's a blocker there is no way that the reviewer can progress further with the review.  As a result, reviewers will end up submitting the empty or incomplete review.&lt;br /&gt;
&lt;br /&gt;
=== Scope ===&lt;br /&gt;
This project is limited to an email based conversation for asking questions and answers. The reviewers would ask questions related to assignment submission doubts to which authors can respond. All this would be taken care as email responses using a link provided in the email. This project does not cater to any live interactive session with spontaneous back-to-back questions and responses.&lt;br /&gt;
&lt;br /&gt;
Following tasks would be incorporated in the project:&lt;br /&gt;
* Provide a ‘TextArea’ input field on review forms, where any reviewer can type in their questions.&lt;br /&gt;
* Create a new button ‘Ask for Quick Help’ on the review forms.&lt;br /&gt;
* An email would be send to the author with the link where he can respond to the questions asked by the reviewers for their submitted work.&lt;br /&gt;
* Reviewers would be notified by an email when authors respond to the the questions.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Discussion of Resolution ===&lt;br /&gt;
&lt;br /&gt;
We will make the following modifications to implement the chat feature:- &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Create a new model which will help to extract, store and validate data in the database table which contains information about the interaction between the author/s and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Edit the view which is used by the response controller to incorporate the text area input field on the review form where the reviewer can ask his/her initial query.&lt;br /&gt;
&lt;br /&gt;
*Create a new controller with methods for authentication for a respective chat log only visible to the author and reviewer of a particular assignment, method to submit a response or a follow up query and show the existing interaction log.&lt;br /&gt;
&lt;br /&gt;
*Create a new helper with the e-mail methods for sending to the author and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Create a new view which will facilitate the author to respond to the queries asked by the reviewer. The reviewer can also use this view to ask any follow up questions.&lt;br /&gt;
&lt;br /&gt;
=== Design Patterns ===&lt;br /&gt;
The implementation team expects that the following design patterns be used in the solution:&lt;br /&gt;
 &lt;br /&gt;
* '''Observer Pattern'''&amp;lt;ref&amp;gt;Observer Design Pattern https://en.wikipedia.org/wiki/Observer_pattern&amp;lt;/ref&amp;gt;: The observer pattern is a software design pattern in which an object, called the subject, maintains a list of its dependents, called observers, and notifies them automatically of any state changes, usually by calling one of their methods. For example, we are notifying the team members whenever the reviewer submits the query.&lt;br /&gt;
&lt;br /&gt;
* '''Iterator Pattern''': In our instance, we need to display the entire chat history of a particular interaction, hence we can use the iterator design pattern to iterate through the previous chat messages.&lt;br /&gt;
&lt;br /&gt;
=== Database Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:Review_chats.png]]&lt;br /&gt;
&lt;br /&gt;
The above figure shows the schema of a new table which will be created in Expertiza to store relevant information about the chat. It contains the following attributes:&lt;br /&gt;
* id: This attribute is auto-generated by rails when we create a table and is auto incremented with each record. It is also the primary key of our table.&lt;br /&gt;
* assignment_id: Stores the ID of the assignment for which the interaction between author and reviewer is taking place.&lt;br /&gt;
* reviewer_id: Stores the ID of the reviewer who asks the questions.&lt;br /&gt;
* team_id: Stores the ID of the team to which the topic belongs.&lt;br /&gt;
* type_flag: Flag which is used to indicate if the particular tuple contains a question or answer. It can take two values, 'Q' for question and 'A' for answer.&lt;br /&gt;
* content: Stores the question asked by the reviewer or the response given by the author/s depending on the value of the type flag.&lt;br /&gt;
&lt;br /&gt;
Records for a particular interaction can be identified by using a combination of assignment_id, reviewer_id and team_id.&lt;br /&gt;
&lt;br /&gt;
=== Use Cases ===&lt;br /&gt;
'''Name:''' Send a question to the author/s about their work.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Reviewer. &amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The reviewer enters his question in the text area which is provided and clicks on the &amp;quot;Ask question&amp;quot; button which is provided as shown in the mock up. On clicking this button an email is sent to the author/s along which a link to answer the question.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''Name:''' Answer the question which has been asked by the reviewer.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Author/s&amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The author/s click on the link received in their email and are redirected to a page where they can answer the question. Once they submit the answer, an email is sent to the reviewer notifying him/her that their question has been answered.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:ARSNUsecase.jpeg]]&lt;br /&gt;
&lt;br /&gt;
=== Proposed Tests ===&lt;br /&gt;
1. For use case 1, test whether all the team members receive email with the question.&amp;lt;br/&amp;gt;&lt;br /&gt;
2. For use case 2, test whether the reviewer receive email with the response.&amp;lt;br/&amp;gt;&lt;br /&gt;
3. Test whether all the previous interactions are displayed as chat history.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
===Code Implementation===&lt;br /&gt;
&lt;br /&gt;
*Create a new model '''review_chat.rb''' for ReviewChat.&lt;br /&gt;
&lt;br /&gt;
'''Validation'''- Check if the query box is not empty and restrict the query length to 255 characters.&lt;br /&gt;
&lt;br /&gt;
  validates_length_of :content , :maximum =&amp;gt; 255,message: &amp;quot;Length must be less that 255 characters&amp;quot;&lt;br /&gt;
  validates_presence_of :content, message: &amp;quot;Content cannot be blank&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*Create a new controller '''review_chats_controller.rb''' with the following methods:&lt;br /&gt;
&lt;br /&gt;
'''action_allowed?'''- Allow chat visibility to the reviewers and the authors of a particular interaction&lt;br /&gt;
&lt;br /&gt;
  def action_allowed?&lt;br /&gt;
    review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    allowed_users=Array.new&lt;br /&gt;
    team_id=review_chat.team_id&lt;br /&gt;
    teams_users = TeamsUser.where(team_id: team_id)&lt;br /&gt;
    teams_users.each do |teams_user|&lt;br /&gt;
      allowed_users &amp;lt;&amp;lt; User.find(teams_user.user_id).id&lt;br /&gt;
    end&lt;br /&gt;
    allowed_users &amp;lt;&amp;lt; Participant.find(review_chat.reviewer_id).user_id&lt;br /&gt;
    current_role_name.eql? 'Student' and allowed_users.include?(session[:user].id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''show'''- Show the chat interaction log&lt;br /&gt;
&lt;br /&gt;
  def show&lt;br /&gt;
    @review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    @assignment_id=@review_chat.assignment_id&lt;br /&gt;
    @reviewer_id=@review_chat.reviewer_id&lt;br /&gt;
    @team_id=@review_chat.team_id&lt;br /&gt;
    @chat_log=ReviewChat.where(:reviewer_id =&amp;gt; @reviewer_id).where(:team_id =&amp;gt; @team_id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''submitted_response'''- Create a chat record and send an email to the reviewer when an author replied to a query asked by the reviewer&lt;br /&gt;
&lt;br /&gt;
  def submitted_response&lt;br /&gt;
    @review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    @chat_reviewer=Participant.find(@review_chat.reviewer_id).user_id&lt;br /&gt;
    if(@chat_reviewer==session[:user].id) then&lt;br /&gt;
    	ReviewChat.create(:assignment_id =&amp;gt; @review_chat.assignment_id,:reviewer_id =&amp;gt; @review_chat.reviewer_id, :team_id=&amp;gt;@review_chat.team_id, :type_flag =&amp;gt; 'Q' , :content =&amp;gt; params[:response_area])&lt;br /&gt;
    	ReviewChatsHelper::chat_email_query(params[:id])&lt;br /&gt;
    	flash[:notice]=&amp;quot;Query has been submitted&amp;quot;	&lt;br /&gt;
    else	&lt;br /&gt;
      	ReviewChat.create(:assignment_id =&amp;gt; @review_chat.assignment_id,:reviewer_id =&amp;gt; @review_chat.reviewer_id, :team_id=&amp;gt;@review_chat.team_id, :type_flag =&amp;gt; 'A' , :content =&amp;gt; params[:response_area])&lt;br /&gt;
      	ReviewChatsHelper::chat_email_response(@review_chat.id,@chat_reviewer)&lt;br /&gt;
      flash[:notice]=&amp;quot;Response has been submitted&amp;quot;&lt;br /&gt;
    end	&lt;br /&gt;
    redirect_to action: 'show', id: params[:id]&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
*Methods in the helper file '''review_chats_helper.rb'''&lt;br /&gt;
&lt;br /&gt;
'''chat_email_response'''- Send an email to the author of an assignment when a reviewer posts a query&lt;br /&gt;
&lt;br /&gt;
  def self.chat_email_response(id,reviewer_id,partial=&amp;quot;new_chatemail&amp;quot;)&lt;br /&gt;
    defn = Hash.new&lt;br /&gt;
    defn[:body] = Hash.new&lt;br /&gt;
    defn[:body][:partial_name] = partial&lt;br /&gt;
    reviewer_email=User.find(reviewer_id).email&lt;br /&gt;
    defn[:subject] = &amp;quot;Response posted for submission&amp;quot;&lt;br /&gt;
    defn[:body][:type] = &amp;quot; response has been posted for your query .&lt;br /&gt;
    Please open the below URL to view.&lt;br /&gt;
    http://expertiza.ncsu.edu/review_chats/show/#{id}&amp;quot;&lt;br /&gt;
    defn[:to] = reviewer_email&lt;br /&gt;
    Mailer.sync_message(defn).deliver&lt;br /&gt;
  end &lt;br /&gt;
&lt;br /&gt;
'''chat_email_query'''- Send an email to the author of an assignment when a reviewer posts a query&lt;br /&gt;
&lt;br /&gt;
  def self.chat_email_query(id,partial=&amp;quot;new_chatemail&amp;quot;)&lt;br /&gt;
    defn = Hash.new&lt;br /&gt;
    defn[:body] = Hash.new&lt;br /&gt;
    defn[:body][:partial_name] = partial&lt;br /&gt;
    assignment=nil&lt;br /&gt;
    @team_id=ReviewChat.find(id).team_id&lt;br /&gt;
    teams_users = TeamsUser.where(team_id: @team_id)&lt;br /&gt;
    to_mail_list = Array.new&lt;br /&gt;
    teams_users.each do |teams_user|&lt;br /&gt;
    to_mail_list &amp;lt;&amp;lt; User.find(teams_user.user_id).email &lt;br /&gt;
    end&lt;br /&gt;
    defn[:subject] = &amp;quot;Query posted for submission&amp;quot;&lt;br /&gt;
    defn[:body][:type] = &amp;quot; query has been posted for your submission .&lt;br /&gt;
    Please open the below URL to view and respond.&lt;br /&gt;
    http://expertiza.ncsu.edu/review_chats/show/#{id}&amp;quot;&lt;br /&gt;
    defn[:to] = to_mail_list&lt;br /&gt;
    Mailer.sync_message(defn).deliver&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
*Modify existing controller '''response_controller.rb''' and add a new method.&lt;br /&gt;
&lt;br /&gt;
'''submitted_question'''- Create a chat record and send an email to the authors when a reviewer posts a query.&lt;br /&gt;
  def submitted_question&lt;br /&gt;
      @map = ResponseMap.find(params[:id])&lt;br /&gt;
      ReviewChat.create(:assignment_id =&amp;gt; @map.assignment.id,:reviewer_id =&amp;gt; @map.reviewer_id, :team_id=&amp;gt;@map.reviewee_id, :type_flag =&amp;gt; 'Q' , :content =&amp;gt; params[:review_question])&lt;br /&gt;
      flash[:notice]=&amp;quot;Question has been submitted to Author&amp;quot;&lt;br /&gt;
      @interaction_id=ReviewChat.where(:reviewer_id =&amp;gt; @map.reviewer_id).where(:team_id =&amp;gt; @map.reviewee_id)&lt;br /&gt;
      ReviewChatsHelper::chat_email_query(@interaction_id.first.id)&lt;br /&gt;
      redirect_to action: 'new', id: params[:id]&lt;br /&gt;
  end&lt;br /&gt;
*Create a new view '''show.html.erb''' to show the existing chat record and a box to respond and ask a follow up query.&lt;br /&gt;
&lt;br /&gt;
===Flowchart===&lt;br /&gt;
&lt;br /&gt;
[[File: ARSNFlowchart1.png]]&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
===User Interface Testing===&lt;br /&gt;
&lt;br /&gt;
* Login to Expertiza with a student account. You can use login id as 'student5700' and password as 'password'.&lt;br /&gt;
* Start reviewing an existing assignment. You would see a small query box at the bottom of the page.&lt;br /&gt;
*The reviewer enters his question in the text area provided and clicks on the &amp;quot;Submit&amp;quot; button.&lt;br /&gt;
[[File: FinalProject1.jpg]]&lt;br /&gt;
*On clicking this button the appropriate method is called in ReviewChats controller which sends an email to all the authors of the topic indicating that a question has been asked about their work. The email contains a link which when clicked on will redirect the author to the appropriate view where he/she can answer the question.&lt;br /&gt;
[[File: FinalProject4.jpg]]&lt;br /&gt;
*On answering the question, the reviewer receives an email indicating that his question has been answered. It also contains a link which redirects the reviewer to the appropriate view where the answer will be displayed.&lt;br /&gt;
*The authorized users will also be able to see a link to open existing chat interaction log.&lt;br /&gt;
[[File: FinalProject3.jpg]]&lt;br /&gt;
*This view also contains the chat history between the author/s and the reviewer for the entire duration of the interaction.&lt;br /&gt;
[[File: FinalProject2.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Model Testing===&lt;br /&gt;
&lt;br /&gt;
* Create a model test file '''review_chat_test.rb''' and check the below.&lt;br /&gt;
'''Presence of assignment_id'''&lt;br /&gt;
&lt;br /&gt;
  test &amp;quot;assignment_id should be present&amp;quot; do&lt;br /&gt;
    @review_chat.assignment_id = &amp;quot; &amp;quot;&lt;br /&gt;
    assert_not @review_chat.assignment_id?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Presence of reviewer_id'''&lt;br /&gt;
&lt;br /&gt;
  test &amp;quot;reviewer_id should be present&amp;quot; do&lt;br /&gt;
    @review_chat.reviewer_id = &amp;quot; &amp;quot;&lt;br /&gt;
    assert_not @review_chat.reviewer_id?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Presence of team_id'''&lt;br /&gt;
&lt;br /&gt;
  test &amp;quot;team_id should be present&amp;quot; do&lt;br /&gt;
    @review_chat.team_id = &amp;quot; &amp;quot;&lt;br /&gt;
    assert_not @review_chat.team_id?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Presence of content'''&lt;br /&gt;
&lt;br /&gt;
  test &amp;quot;content should be present (nonblank)&amp;quot; do&lt;br /&gt;
    @review_chat.content = &amp;quot; &amp;quot; * 6&lt;br /&gt;
    assert_not @review_chat.valid?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Length of content'''&lt;br /&gt;
&lt;br /&gt;
  test &amp;quot;content should have a maximum length of 255&amp;quot; do&lt;br /&gt;
    @review_chat.content = &amp;quot;a&amp;quot; * 250&lt;br /&gt;
    assert @review_chat.valid?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
== Suggestions for Future Improvements ==&lt;br /&gt;
&lt;br /&gt;
* This can be extended to a live interactive author-reviewer anonymous chat session inside the Expertiza reviews window.&lt;br /&gt;
* A purging script can be developed which will clear all the interaction records every semester.&lt;br /&gt;
&lt;br /&gt;
==Resources==&lt;br /&gt;
&lt;br /&gt;
* Expertiza Github repository&amp;lt;ref&amp;gt;Expertiza Github repository https://github.com/expertiza/expertiza&amp;lt;/ref&amp;gt;&lt;br /&gt;
* Demo video &amp;lt;ref&amp;gt;Demo video https://www.youtube.com/watch?v=8E-hYiJVoZI&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sgulati2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100209</id>
		<title>CSC/ECE 517 Fall 2015 E1586 AnonymousChatBetweenAuthorAndReviewer</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100209"/>
		<updated>2015-12-05T01:26:16Z</updated>

		<summary type="html">&lt;p&gt;Sgulati2: /* Resources */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1586 AnonymousChatBetweenAuthorAndReviewer'''&lt;br /&gt;
&lt;br /&gt;
This page provides a brief description of the '''Expertiza''' project. The project is aimed at developing an email based anonymous session between author and a reviewer so that reviewers can ask questions to the authors for any doubts related to the assignments during peer reviewing.&lt;br /&gt;
&lt;br /&gt;
==Project==&lt;br /&gt;
&lt;br /&gt;
=== Introduction to Expertiza ===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a peer review based system which provides an incremental class based learning together with the instructors and the peers. This project has been developed together by faculty and students using [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza handles assignment submissions, team formations, assignment reviews and grades, etc.&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
During reviews, many times reviewers will be having questions about the submitted material and if it's a blocker there is no way that the reviewer can progress further with the review.  As a result, reviewers will end up submitting the empty or incomplete review.&lt;br /&gt;
&lt;br /&gt;
=== Scope ===&lt;br /&gt;
This project is limited to an email based conversation for asking questions and answers. The reviewers would ask questions related to assignment submission doubts to which authors can respond. All this would be taken care as email responses using a link provided in the email. This project does not cater to any live interactive session with spontaneous back-to-back questions and responses.&lt;br /&gt;
&lt;br /&gt;
Following tasks would be incorporated in the project:&lt;br /&gt;
* Provide a ‘TextArea’ input field on review forms, where any reviewer can type in their questions.&lt;br /&gt;
* Create a new button ‘Ask for Quick Help’ on the review forms.&lt;br /&gt;
* An email would be send to the author with the link where he can respond to the questions asked by the reviewers for their submitted work.&lt;br /&gt;
* Reviewers would be notified by an email when authors respond to the the questions.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Discussion of Resolution ===&lt;br /&gt;
&lt;br /&gt;
We will make the following modifications to implement the chat feature:- &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Create a new model which will help to extract, store and validate data in the database table which contains information about the interaction between the author/s and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Edit the view which is used by the response controller to incorporate the text area input field on the review form where the reviewer can ask his/her initial query.&lt;br /&gt;
&lt;br /&gt;
*Create a new controller with methods for authentication for a respective chat log only visible to the author and reviewer of a particular assignment, method to submit a response or a follow up query and show the existing interaction log.&lt;br /&gt;
&lt;br /&gt;
*Create a new helper with the e-mail methods for sending to the author and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Create a new view which will facilitate the author to respond to the queries asked by the reviewer. The reviewer can also use this view to ask any follow up questions.&lt;br /&gt;
&lt;br /&gt;
=== Design Patterns ===&lt;br /&gt;
The implementation team expects that the following design patterns be used in the solution:&lt;br /&gt;
 &lt;br /&gt;
* '''Observer Pattern'''&amp;lt;ref&amp;gt;Observer Design Pattern https://en.wikipedia.org/wiki/Observer_pattern&amp;lt;/ref&amp;gt;: The observer pattern is a software design pattern in which an object, called the subject, maintains a list of its dependents, called observers, and notifies them automatically of any state changes, usually by calling one of their methods. For example, we are notifying the team members whenever the reviewer submits the query.&lt;br /&gt;
&lt;br /&gt;
* '''Iterator Pattern''': In our instance, we need to display the entire chat history of a particular interaction, hence we can use the iterator design pattern to iterate through the previous chat messages.&lt;br /&gt;
&lt;br /&gt;
=== Database Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:Review_chats.png]]&lt;br /&gt;
&lt;br /&gt;
The above figure shows the schema of a new table which will be created in Expertiza to store relevant information about the chat. It contains the following attributes:&lt;br /&gt;
* id: This attribute is auto-generated by rails when we create a table and is auto incremented with each record. It is also the primary key of our table.&lt;br /&gt;
* assignment_id: Stores the ID of the assignment for which the interaction between author and reviewer is taking place.&lt;br /&gt;
* reviewer_id: Stores the ID of the reviewer who asks the questions.&lt;br /&gt;
* team_id: Stores the ID of the team to which the topic belongs.&lt;br /&gt;
* type_flag: Flag which is used to indicate if the particular tuple contains a question or answer. It can take two values, 'Q' for question and 'A' for answer.&lt;br /&gt;
* content: Stores the question asked by the reviewer or the response given by the author/s depending on the value of the type flag.&lt;br /&gt;
&lt;br /&gt;
Records for a particular interaction can be identified by using a combination of assignment_id, reviewer_id and team_id.&lt;br /&gt;
&lt;br /&gt;
=== Use Cases ===&lt;br /&gt;
'''Name:''' Send a question to the author/s about their work.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Reviewer. &amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The reviewer enters his question in the text area which is provided and clicks on the &amp;quot;Ask question&amp;quot; button which is provided as shown in the mock up. On clicking this button an email is sent to the author/s along which a link to answer the question.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''Name:''' Answer the question which has been asked by the reviewer.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Author/s&amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The author/s click on the link received in their email and are redirected to a page where they can answer the question. Once they submit the answer, an email is sent to the reviewer notifying him/her that their question has been answered.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:ARSNUsecase.jpeg]]&lt;br /&gt;
&lt;br /&gt;
=== Proposed Tests ===&lt;br /&gt;
1. For use case 1, test whether all the team members receive email with the question.&amp;lt;br/&amp;gt;&lt;br /&gt;
2. For use case 2, test whether the reviewer receive email with the response.&amp;lt;br/&amp;gt;&lt;br /&gt;
3. Test whether all the previous interactions are displayed as chat history.&amp;lt;br/&amp;gt;&lt;br /&gt;
4. The 'Ask Question' button should not be enabled until some text has been entered in the text area.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
===Code Implementation===&lt;br /&gt;
&lt;br /&gt;
*Create a new model '''review_chat.rb''' for ReviewChat.&lt;br /&gt;
&lt;br /&gt;
'''Validation'''- Check if the query box is not empty and restrict the query length to 255 characters.&lt;br /&gt;
&lt;br /&gt;
  validates_length_of :content , :maximum =&amp;gt; 255,message: &amp;quot;Length must be less that 255 characters&amp;quot;&lt;br /&gt;
  validates_presence_of :content, message: &amp;quot;Content cannot be blank&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*Create a new controller '''review_chats_controller.rb''' with the following methods:&lt;br /&gt;
&lt;br /&gt;
'''action_allowed?'''- Allow chat visibility to the reviewers and the authors of a particular interaction&lt;br /&gt;
&lt;br /&gt;
  def action_allowed?&lt;br /&gt;
    review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    allowed_users=Array.new&lt;br /&gt;
    team_id=review_chat.team_id&lt;br /&gt;
    teams_users = TeamsUser.where(team_id: team_id)&lt;br /&gt;
    teams_users.each do |teams_user|&lt;br /&gt;
      allowed_users &amp;lt;&amp;lt; User.find(teams_user.user_id).id&lt;br /&gt;
    end&lt;br /&gt;
    allowed_users &amp;lt;&amp;lt; Participant.find(review_chat.reviewer_id).user_id&lt;br /&gt;
    current_role_name.eql? 'Student' and allowed_users.include?(session[:user].id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''show'''- Show the chat interaction log&lt;br /&gt;
&lt;br /&gt;
  def show&lt;br /&gt;
    @review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    @assignment_id=@review_chat.assignment_id&lt;br /&gt;
    @reviewer_id=@review_chat.reviewer_id&lt;br /&gt;
    @team_id=@review_chat.team_id&lt;br /&gt;
    @chat_log=ReviewChat.where(:reviewer_id =&amp;gt; @reviewer_id).where(:team_id =&amp;gt; @team_id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''submitted_response'''- Create a chat record and send an email to the reviewer when an author replied to a query asked by the reviewer&lt;br /&gt;
&lt;br /&gt;
  def submitted_response&lt;br /&gt;
    @review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    @chat_reviewer=Participant.find(@review_chat.reviewer_id).user_id&lt;br /&gt;
    if(@chat_reviewer==session[:user].id) then&lt;br /&gt;
    	ReviewChat.create(:assignment_id =&amp;gt; @review_chat.assignment_id,:reviewer_id =&amp;gt; @review_chat.reviewer_id, :team_id=&amp;gt;@review_chat.team_id, :type_flag =&amp;gt; 'Q' , :content =&amp;gt; params[:response_area])&lt;br /&gt;
    	ReviewChatsHelper::chat_email_query(params[:id])&lt;br /&gt;
    	flash[:notice]=&amp;quot;Query has been submitted&amp;quot;	&lt;br /&gt;
    else	&lt;br /&gt;
      	ReviewChat.create(:assignment_id =&amp;gt; @review_chat.assignment_id,:reviewer_id =&amp;gt; @review_chat.reviewer_id, :team_id=&amp;gt;@review_chat.team_id, :type_flag =&amp;gt; 'A' , :content =&amp;gt; params[:response_area])&lt;br /&gt;
      	ReviewChatsHelper::chat_email_response(@review_chat.id,@chat_reviewer)&lt;br /&gt;
      flash[:notice]=&amp;quot;Response has been submitted&amp;quot;&lt;br /&gt;
    end	&lt;br /&gt;
    redirect_to action: 'show', id: params[:id]&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
*Methods in the helper file '''review_chats_helper.rb'''&lt;br /&gt;
&lt;br /&gt;
'''chat_email_response'''- Send an email to the author of an assignment when a reviewer posts a query&lt;br /&gt;
&lt;br /&gt;
  def self.chat_email_response(id,reviewer_id,partial=&amp;quot;new_chatemail&amp;quot;)&lt;br /&gt;
    defn = Hash.new&lt;br /&gt;
    defn[:body] = Hash.new&lt;br /&gt;
    defn[:body][:partial_name] = partial&lt;br /&gt;
    reviewer_email=User.find(reviewer_id).email&lt;br /&gt;
    defn[:subject] = &amp;quot;Response posted for submission&amp;quot;&lt;br /&gt;
    defn[:body][:type] = &amp;quot; response has been posted for your query .&lt;br /&gt;
    Please open the below URL to view.&lt;br /&gt;
    http://expertiza.ncsu.edu/review_chats/show/#{id}&amp;quot;&lt;br /&gt;
    defn[:to] = reviewer_email&lt;br /&gt;
    Mailer.sync_message(defn).deliver&lt;br /&gt;
  end &lt;br /&gt;
&lt;br /&gt;
'''chat_email_query'''- Send an email to the author of an assignment when a reviewer posts a query&lt;br /&gt;
&lt;br /&gt;
  def self.chat_email_query(id,partial=&amp;quot;new_chatemail&amp;quot;)&lt;br /&gt;
    defn = Hash.new&lt;br /&gt;
    defn[:body] = Hash.new&lt;br /&gt;
    defn[:body][:partial_name] = partial&lt;br /&gt;
    assignment=nil&lt;br /&gt;
    @team_id=ReviewChat.find(id).team_id&lt;br /&gt;
    teams_users = TeamsUser.where(team_id: @team_id)&lt;br /&gt;
    to_mail_list = Array.new&lt;br /&gt;
    teams_users.each do |teams_user|&lt;br /&gt;
    to_mail_list &amp;lt;&amp;lt; User.find(teams_user.user_id).email &lt;br /&gt;
    end&lt;br /&gt;
    defn[:subject] = &amp;quot;Query posted for submission&amp;quot;&lt;br /&gt;
    defn[:body][:type] = &amp;quot; query has been posted for your submission .&lt;br /&gt;
    Please open the below URL to view and respond.&lt;br /&gt;
    http://expertiza.ncsu.edu/review_chats/show/#{id}&amp;quot;&lt;br /&gt;
    defn[:to] = to_mail_list&lt;br /&gt;
    Mailer.sync_message(defn).deliver&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
*Modify existing controller '''response_controller.rb''' and add a new method.&lt;br /&gt;
&lt;br /&gt;
'''submitted_question'''- Create a chat record and send an email to the authors when a reviewer posts a query.&lt;br /&gt;
  def submitted_question&lt;br /&gt;
      @map = ResponseMap.find(params[:id])&lt;br /&gt;
      ReviewChat.create(:assignment_id =&amp;gt; @map.assignment.id,:reviewer_id =&amp;gt; @map.reviewer_id, :team_id=&amp;gt;@map.reviewee_id, :type_flag =&amp;gt; 'Q' , :content =&amp;gt; params[:review_question])&lt;br /&gt;
      flash[:notice]=&amp;quot;Question has been submitted to Author&amp;quot;&lt;br /&gt;
      @interaction_id=ReviewChat.where(:reviewer_id =&amp;gt; @map.reviewer_id).where(:team_id =&amp;gt; @map.reviewee_id)&lt;br /&gt;
      ReviewChatsHelper::chat_email_query(@interaction_id.first.id)&lt;br /&gt;
      redirect_to action: 'new', id: params[:id]&lt;br /&gt;
  end&lt;br /&gt;
*Create a new view '''show.html.erb''' to show the existing chat record and a box to respond and ask a follow up query.&lt;br /&gt;
&lt;br /&gt;
===Flowchart===&lt;br /&gt;
&lt;br /&gt;
[[File: ARSNFlowchart1.png]]&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
===User Interface Testing===&lt;br /&gt;
&lt;br /&gt;
* Login to Expertiza with a student account. You can use login id as 'student5700' and password as 'password'.&lt;br /&gt;
* Start reviewing an existing assignment. You would see a small query box at the bottom of the page.&lt;br /&gt;
*The reviewer enters his question in the text area provided and clicks on the &amp;quot;Submit&amp;quot; button.&lt;br /&gt;
[[File: FinalProject1.jpg]]&lt;br /&gt;
*On clicking this button the appropriate method is called in ReviewChats controller which sends an email to all the authors of the topic indicating that a question has been asked about their work. The email contains a link which when clicked on will redirect the author to the appropriate view where he/she can answer the question.&lt;br /&gt;
[[File: FinalProject4.jpg]]&lt;br /&gt;
*On answering the question, the reviewer receives an email indicating that his question has been answered. It also contains a link which redirects the reviewer to the appropriate view where the answer will be displayed.&lt;br /&gt;
*The authorized users will also be able to see a link to open existing chat interaction log.&lt;br /&gt;
[[File: FinalProject3.jpg]]&lt;br /&gt;
*This view also contains the chat history between the author/s and the reviewer for the entire duration of the interaction.&lt;br /&gt;
[[File: FinalProject2.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Model Testing===&lt;br /&gt;
&lt;br /&gt;
* Create a model test file '''review_chat_test.rb''' and check the below.&lt;br /&gt;
'''Presence of assignment_id'''&lt;br /&gt;
&lt;br /&gt;
  test &amp;quot;assignment_id should be present&amp;quot; do&lt;br /&gt;
    @review_chat.assignment_id = &amp;quot; &amp;quot;&lt;br /&gt;
    assert_not @review_chat.assignment_id?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Presence of reviewer_id'''&lt;br /&gt;
&lt;br /&gt;
  test &amp;quot;reviewer_id should be present&amp;quot; do&lt;br /&gt;
    @review_chat.reviewer_id = &amp;quot; &amp;quot;&lt;br /&gt;
    assert_not @review_chat.reviewer_id?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Presence of team_id'''&lt;br /&gt;
&lt;br /&gt;
  test &amp;quot;team_id should be present&amp;quot; do&lt;br /&gt;
    @review_chat.team_id = &amp;quot; &amp;quot;&lt;br /&gt;
    assert_not @review_chat.team_id?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Presence of content'''&lt;br /&gt;
&lt;br /&gt;
  test &amp;quot;content should be present (nonblank)&amp;quot; do&lt;br /&gt;
    @review_chat.content = &amp;quot; &amp;quot; * 6&lt;br /&gt;
    assert_not @review_chat.valid?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Length of content'''&lt;br /&gt;
&lt;br /&gt;
  test &amp;quot;content should have a maximum length of 255&amp;quot; do&lt;br /&gt;
    @review_chat.content = &amp;quot;a&amp;quot; * 250&lt;br /&gt;
    assert @review_chat.valid?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
== Suggestions for Future Improvements ==&lt;br /&gt;
&lt;br /&gt;
* This can be extended to a live interactive author-reviewer anonymous chat session inside the Expertiza reviews window.&lt;br /&gt;
* A purging script can be developed which will clear all the interaction records every semester.&lt;br /&gt;
&lt;br /&gt;
==Resources==&lt;br /&gt;
&lt;br /&gt;
* Expertiza Github repository&amp;lt;ref&amp;gt;Expertiza Github repository https://github.com/expertiza/expertiza&amp;lt;/ref&amp;gt;&lt;br /&gt;
* Demo video &amp;lt;ref&amp;gt;Demo video https://www.youtube.com/watch?v=8E-hYiJVoZI&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sgulati2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100206</id>
		<title>CSC/ECE 517 Fall 2015 E1586 AnonymousChatBetweenAuthorAndReviewer</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100206"/>
		<updated>2015-12-05T01:25:31Z</updated>

		<summary type="html">&lt;p&gt;Sgulati2: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1586 AnonymousChatBetweenAuthorAndReviewer'''&lt;br /&gt;
&lt;br /&gt;
This page provides a brief description of the '''Expertiza''' project. The project is aimed at developing an email based anonymous session between author and a reviewer so that reviewers can ask questions to the authors for any doubts related to the assignments during peer reviewing.&lt;br /&gt;
&lt;br /&gt;
==Project==&lt;br /&gt;
&lt;br /&gt;
=== Introduction to Expertiza ===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a peer review based system which provides an incremental class based learning together with the instructors and the peers. This project has been developed together by faculty and students using [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza handles assignment submissions, team formations, assignment reviews and grades, etc.&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
During reviews, many times reviewers will be having questions about the submitted material and if it's a blocker there is no way that the reviewer can progress further with the review.  As a result, reviewers will end up submitting the empty or incomplete review.&lt;br /&gt;
&lt;br /&gt;
=== Scope ===&lt;br /&gt;
This project is limited to an email based conversation for asking questions and answers. The reviewers would ask questions related to assignment submission doubts to which authors can respond. All this would be taken care as email responses using a link provided in the email. This project does not cater to any live interactive session with spontaneous back-to-back questions and responses.&lt;br /&gt;
&lt;br /&gt;
Following tasks would be incorporated in the project:&lt;br /&gt;
* Provide a ‘TextArea’ input field on review forms, where any reviewer can type in their questions.&lt;br /&gt;
* Create a new button ‘Ask for Quick Help’ on the review forms.&lt;br /&gt;
* An email would be send to the author with the link where he can respond to the questions asked by the reviewers for their submitted work.&lt;br /&gt;
* Reviewers would be notified by an email when authors respond to the the questions.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Discussion of Resolution ===&lt;br /&gt;
&lt;br /&gt;
We will make the following modifications to implement the chat feature:- &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Create a new model which will help to extract, store and validate data in the database table which contains information about the interaction between the author/s and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Edit the view which is used by the response controller to incorporate the text area input field on the review form where the reviewer can ask his/her initial query.&lt;br /&gt;
&lt;br /&gt;
*Create a new controller with methods for authentication for a respective chat log only visible to the author and reviewer of a particular assignment, method to submit a response or a follow up query and show the existing interaction log.&lt;br /&gt;
&lt;br /&gt;
*Create a new helper with the e-mail methods for sending to the author and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Create a new view which will facilitate the author to respond to the queries asked by the reviewer. The reviewer can also use this view to ask any follow up questions.&lt;br /&gt;
&lt;br /&gt;
=== Design Patterns ===&lt;br /&gt;
The implementation team expects that the following design patterns be used in the solution:&lt;br /&gt;
 &lt;br /&gt;
* '''Observer Pattern'''&amp;lt;ref&amp;gt;Observer Design Pattern https://en.wikipedia.org/wiki/Observer_pattern&amp;lt;/ref&amp;gt;: The observer pattern is a software design pattern in which an object, called the subject, maintains a list of its dependents, called observers, and notifies them automatically of any state changes, usually by calling one of their methods. For example, we are notifying the team members whenever the reviewer submits the query.&lt;br /&gt;
&lt;br /&gt;
* '''Iterator Pattern''': In our instance, we need to display the entire chat history of a particular interaction, hence we can use the iterator design pattern to iterate through the previous chat messages.&lt;br /&gt;
&lt;br /&gt;
=== Database Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:Review_chats.png]]&lt;br /&gt;
&lt;br /&gt;
The above figure shows the schema of a new table which will be created in Expertiza to store relevant information about the chat. It contains the following attributes:&lt;br /&gt;
* id: This attribute is auto-generated by rails when we create a table and is auto incremented with each record. It is also the primary key of our table.&lt;br /&gt;
* assignment_id: Stores the ID of the assignment for which the interaction between author and reviewer is taking place.&lt;br /&gt;
* reviewer_id: Stores the ID of the reviewer who asks the questions.&lt;br /&gt;
* team_id: Stores the ID of the team to which the topic belongs.&lt;br /&gt;
* type_flag: Flag which is used to indicate if the particular tuple contains a question or answer. It can take two values, 'Q' for question and 'A' for answer.&lt;br /&gt;
* content: Stores the question asked by the reviewer or the response given by the author/s depending on the value of the type flag.&lt;br /&gt;
&lt;br /&gt;
Records for a particular interaction can be identified by using a combination of assignment_id, reviewer_id and team_id.&lt;br /&gt;
&lt;br /&gt;
=== Use Cases ===&lt;br /&gt;
'''Name:''' Send a question to the author/s about their work.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Reviewer. &amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The reviewer enters his question in the text area which is provided and clicks on the &amp;quot;Ask question&amp;quot; button which is provided as shown in the mock up. On clicking this button an email is sent to the author/s along which a link to answer the question.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''Name:''' Answer the question which has been asked by the reviewer.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Author/s&amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The author/s click on the link received in their email and are redirected to a page where they can answer the question. Once they submit the answer, an email is sent to the reviewer notifying him/her that their question has been answered.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:ARSNUsecase.jpeg]]&lt;br /&gt;
&lt;br /&gt;
=== Proposed Tests ===&lt;br /&gt;
1. For use case 1, test whether all the team members receive email with the question.&amp;lt;br/&amp;gt;&lt;br /&gt;
2. For use case 2, test whether the reviewer receive email with the response.&amp;lt;br/&amp;gt;&lt;br /&gt;
3. Test whether all the previous interactions are displayed as chat history.&amp;lt;br/&amp;gt;&lt;br /&gt;
4. The 'Ask Question' button should not be enabled until some text has been entered in the text area.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
===Code Implementation===&lt;br /&gt;
&lt;br /&gt;
*Create a new model '''review_chat.rb''' for ReviewChat.&lt;br /&gt;
&lt;br /&gt;
'''Validation'''- Check if the query box is not empty and restrict the query length to 255 characters.&lt;br /&gt;
&lt;br /&gt;
  validates_length_of :content , :maximum =&amp;gt; 255,message: &amp;quot;Length must be less that 255 characters&amp;quot;&lt;br /&gt;
  validates_presence_of :content, message: &amp;quot;Content cannot be blank&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*Create a new controller '''review_chats_controller.rb''' with the following methods:&lt;br /&gt;
&lt;br /&gt;
'''action_allowed?'''- Allow chat visibility to the reviewers and the authors of a particular interaction&lt;br /&gt;
&lt;br /&gt;
  def action_allowed?&lt;br /&gt;
    review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    allowed_users=Array.new&lt;br /&gt;
    team_id=review_chat.team_id&lt;br /&gt;
    teams_users = TeamsUser.where(team_id: team_id)&lt;br /&gt;
    teams_users.each do |teams_user|&lt;br /&gt;
      allowed_users &amp;lt;&amp;lt; User.find(teams_user.user_id).id&lt;br /&gt;
    end&lt;br /&gt;
    allowed_users &amp;lt;&amp;lt; Participant.find(review_chat.reviewer_id).user_id&lt;br /&gt;
    current_role_name.eql? 'Student' and allowed_users.include?(session[:user].id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''show'''- Show the chat interaction log&lt;br /&gt;
&lt;br /&gt;
  def show&lt;br /&gt;
    @review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    @assignment_id=@review_chat.assignment_id&lt;br /&gt;
    @reviewer_id=@review_chat.reviewer_id&lt;br /&gt;
    @team_id=@review_chat.team_id&lt;br /&gt;
    @chat_log=ReviewChat.where(:reviewer_id =&amp;gt; @reviewer_id).where(:team_id =&amp;gt; @team_id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''submitted_response'''- Create a chat record and send an email to the reviewer when an author replied to a query asked by the reviewer&lt;br /&gt;
&lt;br /&gt;
  def submitted_response&lt;br /&gt;
    @review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    @chat_reviewer=Participant.find(@review_chat.reviewer_id).user_id&lt;br /&gt;
    if(@chat_reviewer==session[:user].id) then&lt;br /&gt;
    	ReviewChat.create(:assignment_id =&amp;gt; @review_chat.assignment_id,:reviewer_id =&amp;gt; @review_chat.reviewer_id, :team_id=&amp;gt;@review_chat.team_id, :type_flag =&amp;gt; 'Q' , :content =&amp;gt; params[:response_area])&lt;br /&gt;
    	ReviewChatsHelper::chat_email_query(params[:id])&lt;br /&gt;
    	flash[:notice]=&amp;quot;Query has been submitted&amp;quot;	&lt;br /&gt;
    else	&lt;br /&gt;
      	ReviewChat.create(:assignment_id =&amp;gt; @review_chat.assignment_id,:reviewer_id =&amp;gt; @review_chat.reviewer_id, :team_id=&amp;gt;@review_chat.team_id, :type_flag =&amp;gt; 'A' , :content =&amp;gt; params[:response_area])&lt;br /&gt;
      	ReviewChatsHelper::chat_email_response(@review_chat.id,@chat_reviewer)&lt;br /&gt;
      flash[:notice]=&amp;quot;Response has been submitted&amp;quot;&lt;br /&gt;
    end	&lt;br /&gt;
    redirect_to action: 'show', id: params[:id]&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
*Methods in the helper file '''review_chats_helper.rb'''&lt;br /&gt;
&lt;br /&gt;
'''chat_email_response'''- Send an email to the author of an assignment when a reviewer posts a query&lt;br /&gt;
&lt;br /&gt;
  def self.chat_email_response(id,reviewer_id,partial=&amp;quot;new_chatemail&amp;quot;)&lt;br /&gt;
    defn = Hash.new&lt;br /&gt;
    defn[:body] = Hash.new&lt;br /&gt;
    defn[:body][:partial_name] = partial&lt;br /&gt;
    reviewer_email=User.find(reviewer_id).email&lt;br /&gt;
    defn[:subject] = &amp;quot;Response posted for submission&amp;quot;&lt;br /&gt;
    defn[:body][:type] = &amp;quot; response has been posted for your query .&lt;br /&gt;
    Please open the below URL to view.&lt;br /&gt;
    http://expertiza.ncsu.edu/review_chats/show/#{id}&amp;quot;&lt;br /&gt;
    defn[:to] = reviewer_email&lt;br /&gt;
    Mailer.sync_message(defn).deliver&lt;br /&gt;
  end &lt;br /&gt;
&lt;br /&gt;
'''chat_email_query'''- Send an email to the author of an assignment when a reviewer posts a query&lt;br /&gt;
&lt;br /&gt;
  def self.chat_email_query(id,partial=&amp;quot;new_chatemail&amp;quot;)&lt;br /&gt;
    defn = Hash.new&lt;br /&gt;
    defn[:body] = Hash.new&lt;br /&gt;
    defn[:body][:partial_name] = partial&lt;br /&gt;
    assignment=nil&lt;br /&gt;
    @team_id=ReviewChat.find(id).team_id&lt;br /&gt;
    teams_users = TeamsUser.where(team_id: @team_id)&lt;br /&gt;
    to_mail_list = Array.new&lt;br /&gt;
    teams_users.each do |teams_user|&lt;br /&gt;
    to_mail_list &amp;lt;&amp;lt; User.find(teams_user.user_id).email &lt;br /&gt;
    end&lt;br /&gt;
    defn[:subject] = &amp;quot;Query posted for submission&amp;quot;&lt;br /&gt;
    defn[:body][:type] = &amp;quot; query has been posted for your submission .&lt;br /&gt;
    Please open the below URL to view and respond.&lt;br /&gt;
    http://expertiza.ncsu.edu/review_chats/show/#{id}&amp;quot;&lt;br /&gt;
    defn[:to] = to_mail_list&lt;br /&gt;
    Mailer.sync_message(defn).deliver&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
*Modify existing controller '''response_controller.rb''' and add a new method.&lt;br /&gt;
&lt;br /&gt;
'''submitted_question'''- Create a chat record and send an email to the authors when a reviewer posts a query.&lt;br /&gt;
  def submitted_question&lt;br /&gt;
      @map = ResponseMap.find(params[:id])&lt;br /&gt;
      ReviewChat.create(:assignment_id =&amp;gt; @map.assignment.id,:reviewer_id =&amp;gt; @map.reviewer_id, :team_id=&amp;gt;@map.reviewee_id, :type_flag =&amp;gt; 'Q' , :content =&amp;gt; params[:review_question])&lt;br /&gt;
      flash[:notice]=&amp;quot;Question has been submitted to Author&amp;quot;&lt;br /&gt;
      @interaction_id=ReviewChat.where(:reviewer_id =&amp;gt; @map.reviewer_id).where(:team_id =&amp;gt; @map.reviewee_id)&lt;br /&gt;
      ReviewChatsHelper::chat_email_query(@interaction_id.first.id)&lt;br /&gt;
      redirect_to action: 'new', id: params[:id]&lt;br /&gt;
  end&lt;br /&gt;
*Create a new view '''show.html.erb''' to show the existing chat record and a box to respond and ask a follow up query.&lt;br /&gt;
&lt;br /&gt;
===Flowchart===&lt;br /&gt;
&lt;br /&gt;
[[File: ARSNFlowchart1.png]]&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
===User Interface Testing===&lt;br /&gt;
&lt;br /&gt;
* Login to Expertiza with a student account. You can use login id as 'student5700' and password as 'password'.&lt;br /&gt;
* Start reviewing an existing assignment. You would see a small query box at the bottom of the page.&lt;br /&gt;
*The reviewer enters his question in the text area provided and clicks on the &amp;quot;Submit&amp;quot; button.&lt;br /&gt;
[[File: FinalProject1.jpg]]&lt;br /&gt;
*On clicking this button the appropriate method is called in ReviewChats controller which sends an email to all the authors of the topic indicating that a question has been asked about their work. The email contains a link which when clicked on will redirect the author to the appropriate view where he/she can answer the question.&lt;br /&gt;
[[File: FinalProject4.jpg]]&lt;br /&gt;
*On answering the question, the reviewer receives an email indicating that his question has been answered. It also contains a link which redirects the reviewer to the appropriate view where the answer will be displayed.&lt;br /&gt;
*The authorized users will also be able to see a link to open existing chat interaction log.&lt;br /&gt;
[[File: FinalProject3.jpg]]&lt;br /&gt;
*This view also contains the chat history between the author/s and the reviewer for the entire duration of the interaction.&lt;br /&gt;
[[File: FinalProject2.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Model Testing===&lt;br /&gt;
&lt;br /&gt;
* Create a model test file '''review_chat_test.rb''' and check the below.&lt;br /&gt;
'''Presence of assignment_id'''&lt;br /&gt;
&lt;br /&gt;
  test &amp;quot;assignment_id should be present&amp;quot; do&lt;br /&gt;
    @review_chat.assignment_id = &amp;quot; &amp;quot;&lt;br /&gt;
    assert_not @review_chat.assignment_id?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Presence of reviewer_id'''&lt;br /&gt;
&lt;br /&gt;
  test &amp;quot;reviewer_id should be present&amp;quot; do&lt;br /&gt;
    @review_chat.reviewer_id = &amp;quot; &amp;quot;&lt;br /&gt;
    assert_not @review_chat.reviewer_id?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Presence of team_id'''&lt;br /&gt;
&lt;br /&gt;
  test &amp;quot;team_id should be present&amp;quot; do&lt;br /&gt;
    @review_chat.team_id = &amp;quot; &amp;quot;&lt;br /&gt;
    assert_not @review_chat.team_id?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Presence of content'''&lt;br /&gt;
&lt;br /&gt;
  test &amp;quot;content should be present (nonblank)&amp;quot; do&lt;br /&gt;
    @review_chat.content = &amp;quot; &amp;quot; * 6&lt;br /&gt;
    assert_not @review_chat.valid?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Length of content'''&lt;br /&gt;
&lt;br /&gt;
  test &amp;quot;content should have a maximum length of 255&amp;quot; do&lt;br /&gt;
    @review_chat.content = &amp;quot;a&amp;quot; * 250&lt;br /&gt;
    assert @review_chat.valid?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
== Suggestions for Future Improvements ==&lt;br /&gt;
&lt;br /&gt;
* This can be extended to a live interactive author-reviewer anonymous chat session inside the Expertiza reviews window.&lt;br /&gt;
* A purging script can be developed which will clear all the interaction records every semester.&lt;br /&gt;
&lt;br /&gt;
==Resources==&lt;br /&gt;
&lt;br /&gt;
* Expertiza Github repository&amp;lt;ref&amp;gt;Expertiza Github repository https://github.com/expertiza/expertiza&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sgulati2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100205</id>
		<title>CSC/ECE 517 Fall 2015 E1586 AnonymousChatBetweenAuthorAndReviewer</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100205"/>
		<updated>2015-12-05T01:25:07Z</updated>

		<summary type="html">&lt;p&gt;Sgulati2: /* Model Testing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1586 AnonymousChatBetweenAuthorAndReviewer'''&lt;br /&gt;
&lt;br /&gt;
This page provides a brief description of the '''Expertiza''' project. The project is aimed at developing an email based anonymous session between author and a reviewer so that reviewers can ask questions to the authors for any doubts related to the assignments during peer reviewing.&lt;br /&gt;
&lt;br /&gt;
==Project==&lt;br /&gt;
&lt;br /&gt;
=== Introduction to Expertiza ===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a peer review based system which provides an incremental class based learning together with the instructors and the peers. This project has been developed together by faculty and students using [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza handles assignment submissions, team formations, assignment reviews and grades, etc.&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
During reviews, many times reviewers will be having questions about the submitted material and if it's a blocker there is no way that the reviewer can progress further with the review.  As a result, reviewers will end up submitting the empty or incomplete review.&lt;br /&gt;
&lt;br /&gt;
=== Scope ===&lt;br /&gt;
This project is limited to an email based conversation for asking questions and answers. The reviewers would ask questions related to assignment submission doubts to which authors can respond. All this would be taken care as email responses using a link provided in the email. This project does not cater to any live interactive session with spontaneous back-to-back questions and responses.&lt;br /&gt;
&lt;br /&gt;
Following tasks would be incorporated in the project:&lt;br /&gt;
* Provide a ‘TextArea’ input field on review forms, where any reviewer can type in their questions.&lt;br /&gt;
* Create a new button ‘Ask for Quick Help’ on the review forms.&lt;br /&gt;
* An email would be send to the author with the link where he can respond to the questions asked by the reviewers for their submitted work.&lt;br /&gt;
* Reviewers would be notified by an email when authors respond to the the questions.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Discussion of Resolution ===&lt;br /&gt;
&lt;br /&gt;
We will make the following modifications to implement the chat feature:- &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Create a new model which will help to extract, store and validate data in the database table which contains information about the interaction between the author/s and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Edit the view which is used by the response controller to incorporate the text area input field on the review form where the reviewer can ask his/her initial query.&lt;br /&gt;
&lt;br /&gt;
*Create a new controller with methods for authentication for a respective chat log only visible to the author and reviewer of a particular assignment, method to submit a response or a follow up query and show the existing interaction log.&lt;br /&gt;
&lt;br /&gt;
*Create a new helper with the e-mail methods for sending to the author and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Create a new view which will facilitate the author to respond to the queries asked by the reviewer. The reviewer can also use this view to ask any follow up questions.&lt;br /&gt;
&lt;br /&gt;
=== Design Patterns ===&lt;br /&gt;
The implementation team expects that the following design patterns be used in the solution:&lt;br /&gt;
 &lt;br /&gt;
* '''Observer Pattern'''&amp;lt;ref&amp;gt;Observer Design Pattern https://en.wikipedia.org/wiki/Observer_pattern&amp;lt;/ref&amp;gt;: The observer pattern is a software design pattern in which an object, called the subject, maintains a list of its dependents, called observers, and notifies them automatically of any state changes, usually by calling one of their methods. For example, we are notifying the team members whenever the reviewer submits the query.&lt;br /&gt;
&lt;br /&gt;
* '''Iterator Pattern''': In our instance, we need to display the entire chat history of a particular interaction, hence we can use the iterator design pattern to iterate through the previous chat messages.&lt;br /&gt;
&lt;br /&gt;
=== Database Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:Review_chats.png]]&lt;br /&gt;
&lt;br /&gt;
The above figure shows the schema of a new table which will be created in Expertiza to store relevant information about the chat. It contains the following attributes:&lt;br /&gt;
* id: This attribute is auto-generated by rails when we create a table and is auto incremented with each record. It is also the primary key of our table.&lt;br /&gt;
* assignment_id: Stores the ID of the assignment for which the interaction between author and reviewer is taking place.&lt;br /&gt;
* reviewer_id: Stores the ID of the reviewer who asks the questions.&lt;br /&gt;
* team_id: Stores the ID of the team to which the topic belongs.&lt;br /&gt;
* type_flag: Flag which is used to indicate if the particular tuple contains a question or answer. It can take two values, 'Q' for question and 'A' for answer.&lt;br /&gt;
* content: Stores the question asked by the reviewer or the response given by the author/s depending on the value of the type flag.&lt;br /&gt;
&lt;br /&gt;
Records for a particular interaction can be identified by using a combination of assignment_id, reviewer_id and team_id.&lt;br /&gt;
&lt;br /&gt;
=== Use Cases ===&lt;br /&gt;
'''Name:''' Send a question to the author/s about their work.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Reviewer. &amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The reviewer enters his question in the text area which is provided and clicks on the &amp;quot;Ask question&amp;quot; button which is provided as shown in the mock up. On clicking this button an email is sent to the author/s along which a link to answer the question.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''Name:''' Answer the question which has been asked by the reviewer.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Author/s&amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The author/s click on the link received in their email and are redirected to a page where they can answer the question. Once they submit the answer, an email is sent to the reviewer notifying him/her that their question has been answered.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:ARSNUsecase.jpeg]]&lt;br /&gt;
&lt;br /&gt;
=== Proposed Tests ===&lt;br /&gt;
1. For use case 1, test whether all the team members receive email with the question.&amp;lt;br/&amp;gt;&lt;br /&gt;
2. For use case 2, test whether the reviewer receive email with the response.&amp;lt;br/&amp;gt;&lt;br /&gt;
3. Test whether all the previous interactions are displayed as chat history.&amp;lt;br/&amp;gt;&lt;br /&gt;
4. The 'Ask Question' button should not be enabled until some text has been entered in the text area.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
===Code Implementation===&lt;br /&gt;
&lt;br /&gt;
*Create a new model '''review_chat.rb''' for ReviewChat.&lt;br /&gt;
&lt;br /&gt;
'''Validation'''- Check if the query box is not empty and restrict the query length to 255 characters.&lt;br /&gt;
&lt;br /&gt;
  validates_length_of :content , :maximum =&amp;gt; 255,message: &amp;quot;Length must be less that 255 characters&amp;quot;&lt;br /&gt;
  validates_presence_of :content, message: &amp;quot;Content cannot be blank&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*Create a new controller '''review_chats_controller.rb''' with the following methods:&lt;br /&gt;
&lt;br /&gt;
'''action_allowed?'''- Allow chat visibility to the reviewers and the authors of a particular interaction&lt;br /&gt;
&lt;br /&gt;
  def action_allowed?&lt;br /&gt;
    review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    allowed_users=Array.new&lt;br /&gt;
    team_id=review_chat.team_id&lt;br /&gt;
    teams_users = TeamsUser.where(team_id: team_id)&lt;br /&gt;
    teams_users.each do |teams_user|&lt;br /&gt;
      allowed_users &amp;lt;&amp;lt; User.find(teams_user.user_id).id&lt;br /&gt;
    end&lt;br /&gt;
    allowed_users &amp;lt;&amp;lt; Participant.find(review_chat.reviewer_id).user_id&lt;br /&gt;
    current_role_name.eql? 'Student' and allowed_users.include?(session[:user].id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''show'''- Show the chat interaction log&lt;br /&gt;
&lt;br /&gt;
  def show&lt;br /&gt;
    @review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    @assignment_id=@review_chat.assignment_id&lt;br /&gt;
    @reviewer_id=@review_chat.reviewer_id&lt;br /&gt;
    @team_id=@review_chat.team_id&lt;br /&gt;
    @chat_log=ReviewChat.where(:reviewer_id =&amp;gt; @reviewer_id).where(:team_id =&amp;gt; @team_id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''submitted_response'''- Create a chat record and send an email to the reviewer when an author replied to a query asked by the reviewer&lt;br /&gt;
&lt;br /&gt;
  def submitted_response&lt;br /&gt;
    @review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    @chat_reviewer=Participant.find(@review_chat.reviewer_id).user_id&lt;br /&gt;
    if(@chat_reviewer==session[:user].id) then&lt;br /&gt;
    	ReviewChat.create(:assignment_id =&amp;gt; @review_chat.assignment_id,:reviewer_id =&amp;gt; @review_chat.reviewer_id, :team_id=&amp;gt;@review_chat.team_id, :type_flag =&amp;gt; 'Q' , :content =&amp;gt; params[:response_area])&lt;br /&gt;
    	ReviewChatsHelper::chat_email_query(params[:id])&lt;br /&gt;
    	flash[:notice]=&amp;quot;Query has been submitted&amp;quot;	&lt;br /&gt;
    else	&lt;br /&gt;
      	ReviewChat.create(:assignment_id =&amp;gt; @review_chat.assignment_id,:reviewer_id =&amp;gt; @review_chat.reviewer_id, :team_id=&amp;gt;@review_chat.team_id, :type_flag =&amp;gt; 'A' , :content =&amp;gt; params[:response_area])&lt;br /&gt;
      	ReviewChatsHelper::chat_email_response(@review_chat.id,@chat_reviewer)&lt;br /&gt;
      flash[:notice]=&amp;quot;Response has been submitted&amp;quot;&lt;br /&gt;
    end	&lt;br /&gt;
    redirect_to action: 'show', id: params[:id]&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
*Methods in the helper file '''review_chats_helper.rb'''&lt;br /&gt;
&lt;br /&gt;
'''chat_email_response'''- Send an email to the author of an assignment when a reviewer posts a query&lt;br /&gt;
&lt;br /&gt;
  def self.chat_email_response(id,reviewer_id,partial=&amp;quot;new_chatemail&amp;quot;)&lt;br /&gt;
    defn = Hash.new&lt;br /&gt;
    defn[:body] = Hash.new&lt;br /&gt;
    defn[:body][:partial_name] = partial&lt;br /&gt;
    reviewer_email=User.find(reviewer_id).email&lt;br /&gt;
    defn[:subject] = &amp;quot;Response posted for submission&amp;quot;&lt;br /&gt;
    defn[:body][:type] = &amp;quot; response has been posted for your query .&lt;br /&gt;
    Please open the below URL to view.&lt;br /&gt;
    http://expertiza.ncsu.edu/review_chats/show/#{id}&amp;quot;&lt;br /&gt;
    defn[:to] = reviewer_email&lt;br /&gt;
    Mailer.sync_message(defn).deliver&lt;br /&gt;
  end &lt;br /&gt;
&lt;br /&gt;
'''chat_email_query'''- Send an email to the author of an assignment when a reviewer posts a query&lt;br /&gt;
&lt;br /&gt;
  def self.chat_email_query(id,partial=&amp;quot;new_chatemail&amp;quot;)&lt;br /&gt;
    defn = Hash.new&lt;br /&gt;
    defn[:body] = Hash.new&lt;br /&gt;
    defn[:body][:partial_name] = partial&lt;br /&gt;
    assignment=nil&lt;br /&gt;
    @team_id=ReviewChat.find(id).team_id&lt;br /&gt;
    teams_users = TeamsUser.where(team_id: @team_id)&lt;br /&gt;
    to_mail_list = Array.new&lt;br /&gt;
    teams_users.each do |teams_user|&lt;br /&gt;
    to_mail_list &amp;lt;&amp;lt; User.find(teams_user.user_id).email &lt;br /&gt;
    end&lt;br /&gt;
    defn[:subject] = &amp;quot;Query posted for submission&amp;quot;&lt;br /&gt;
    defn[:body][:type] = &amp;quot; query has been posted for your submission .&lt;br /&gt;
    Please open the below URL to view and respond.&lt;br /&gt;
    http://expertiza.ncsu.edu/review_chats/show/#{id}&amp;quot;&lt;br /&gt;
    defn[:to] = to_mail_list&lt;br /&gt;
    Mailer.sync_message(defn).deliver&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
*Modify existing controller '''response_controller.rb''' and add a new method.&lt;br /&gt;
&lt;br /&gt;
'''submitted_question'''- Create a chat record and send an email to the authors when a reviewer posts a query.&lt;br /&gt;
  def submitted_question&lt;br /&gt;
      @map = ResponseMap.find(params[:id])&lt;br /&gt;
      ReviewChat.create(:assignment_id =&amp;gt; @map.assignment.id,:reviewer_id =&amp;gt; @map.reviewer_id, :team_id=&amp;gt;@map.reviewee_id, :type_flag =&amp;gt; 'Q' , :content =&amp;gt; params[:review_question])&lt;br /&gt;
      flash[:notice]=&amp;quot;Question has been submitted to Author&amp;quot;&lt;br /&gt;
      @interaction_id=ReviewChat.where(:reviewer_id =&amp;gt; @map.reviewer_id).where(:team_id =&amp;gt; @map.reviewee_id)&lt;br /&gt;
      ReviewChatsHelper::chat_email_query(@interaction_id.first.id)&lt;br /&gt;
      redirect_to action: 'new', id: params[:id]&lt;br /&gt;
  end&lt;br /&gt;
*Create a new view '''show.html.erb''' to show the existing chat record and a box to respond and ask a follow up query.&lt;br /&gt;
&lt;br /&gt;
===Flowchart===&lt;br /&gt;
&lt;br /&gt;
[[File: ARSNFlowchart1.png]]&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
===User Interface Testing===&lt;br /&gt;
&lt;br /&gt;
* Login to Expertiza with a student account. You can use login id as 'student5700' and password as 'password'.&lt;br /&gt;
* Start reviewing an existing assignment. You would see a small query box at the bottom of the page.&lt;br /&gt;
*The reviewer enters his question in the text area provided and clicks on the &amp;quot;Submit&amp;quot; button.&lt;br /&gt;
[[File: FinalProject1.jpg]]&lt;br /&gt;
*On clicking this button the appropriate method is called in ReviewChats controller which sends an email to all the authors of the topic indicating that a question has been asked about their work. The email contains a link which when clicked on will redirect the author to the appropriate view where he/she can answer the question.&lt;br /&gt;
[[File: FinalProject4.jpg]]&lt;br /&gt;
*On answering the question, the reviewer receives an email indicating that his question has been answered. It also contains a link which redirects the reviewer to the appropriate view where the answer will be displayed.&lt;br /&gt;
*The authorized users will also be able to see a link to open existing chat interaction log.&lt;br /&gt;
[[File: FinalProject3.jpg]]&lt;br /&gt;
*This view also contains the chat history between the author/s and the reviewer for the entire duration of the interaction.&lt;br /&gt;
[[File: FinalProject2.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Model Testing===&lt;br /&gt;
&lt;br /&gt;
* Create a model test file '''review_chat_test.rb''' and check the below.&lt;br /&gt;
'''Presence of assignment_id'''&lt;br /&gt;
&lt;br /&gt;
  test &amp;quot;assignment_id should be present&amp;quot; do&lt;br /&gt;
    @review_chat.assignment_id = &amp;quot; &amp;quot;&lt;br /&gt;
    assert_not @review_chat.assignment_id?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Presence of reviewer_id'''&lt;br /&gt;
&lt;br /&gt;
  test &amp;quot;reviewer_id should be present&amp;quot; do&lt;br /&gt;
    @review_chat.reviewer_id = &amp;quot; &amp;quot;&lt;br /&gt;
    assert_not @review_chat.reviewer_id?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Presence of team_id'''&lt;br /&gt;
&lt;br /&gt;
  test &amp;quot;team_id should be present&amp;quot; do&lt;br /&gt;
    @review_chat.team_id = &amp;quot; &amp;quot;&lt;br /&gt;
    assert_not @review_chat.team_id?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Presence of content'''&lt;br /&gt;
&lt;br /&gt;
  test &amp;quot;content should be present (nonblank)&amp;quot; do&lt;br /&gt;
    @review_chat.content = &amp;quot; &amp;quot; * 6&lt;br /&gt;
    assert_not @review_chat.valid?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Length of content'''&lt;br /&gt;
&lt;br /&gt;
  test &amp;quot;content should have a maximum length of 255&amp;quot; do&lt;br /&gt;
    @review_chat.content = &amp;quot;a&amp;quot; * 250&lt;br /&gt;
    assert @review_chat.valid?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
== Suggestions for Future Improvements ==&lt;br /&gt;
&lt;br /&gt;
* This can be extended to a live interactive author-reviewer anonymous chat session inside the Expertiza reviews window.&lt;br /&gt;
* A purging script can be developed which will clear all the interaction records every semester.&lt;br /&gt;
&lt;br /&gt;
==Resources==&lt;br /&gt;
&lt;br /&gt;
* Expertiza Github repository&amp;lt;ref&amp;gt;Expertiza Github repository https://github.com/expertiza/expertiza&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
[https://www.youtube.com/watch?v=8E-hYiJVoZI Demo Video]&lt;/div&gt;</summary>
		<author><name>Sgulati2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100203</id>
		<title>CSC/ECE 517 Fall 2015 E1586 AnonymousChatBetweenAuthorAndReviewer</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100203"/>
		<updated>2015-12-05T01:24:34Z</updated>

		<summary type="html">&lt;p&gt;Sgulati2: /* Model Testing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1586 AnonymousChatBetweenAuthorAndReviewer'''&lt;br /&gt;
&lt;br /&gt;
This page provides a brief description of the '''Expertiza''' project. The project is aimed at developing an email based anonymous session between author and a reviewer so that reviewers can ask questions to the authors for any doubts related to the assignments during peer reviewing.&lt;br /&gt;
&lt;br /&gt;
==Project==&lt;br /&gt;
&lt;br /&gt;
=== Introduction to Expertiza ===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a peer review based system which provides an incremental class based learning together with the instructors and the peers. This project has been developed together by faculty and students using [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza handles assignment submissions, team formations, assignment reviews and grades, etc.&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
During reviews, many times reviewers will be having questions about the submitted material and if it's a blocker there is no way that the reviewer can progress further with the review.  As a result, reviewers will end up submitting the empty or incomplete review.&lt;br /&gt;
&lt;br /&gt;
=== Scope ===&lt;br /&gt;
This project is limited to an email based conversation for asking questions and answers. The reviewers would ask questions related to assignment submission doubts to which authors can respond. All this would be taken care as email responses using a link provided in the email. This project does not cater to any live interactive session with spontaneous back-to-back questions and responses.&lt;br /&gt;
&lt;br /&gt;
Following tasks would be incorporated in the project:&lt;br /&gt;
* Provide a ‘TextArea’ input field on review forms, where any reviewer can type in their questions.&lt;br /&gt;
* Create a new button ‘Ask for Quick Help’ on the review forms.&lt;br /&gt;
* An email would be send to the author with the link where he can respond to the questions asked by the reviewers for their submitted work.&lt;br /&gt;
* Reviewers would be notified by an email when authors respond to the the questions.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Discussion of Resolution ===&lt;br /&gt;
&lt;br /&gt;
We will make the following modifications to implement the chat feature:- &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Create a new model which will help to extract, store and validate data in the database table which contains information about the interaction between the author/s and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Edit the view which is used by the response controller to incorporate the text area input field on the review form where the reviewer can ask his/her initial query.&lt;br /&gt;
&lt;br /&gt;
*Create a new controller with methods for authentication for a respective chat log only visible to the author and reviewer of a particular assignment, method to submit a response or a follow up query and show the existing interaction log.&lt;br /&gt;
&lt;br /&gt;
*Create a new helper with the e-mail methods for sending to the author and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Create a new view which will facilitate the author to respond to the queries asked by the reviewer. The reviewer can also use this view to ask any follow up questions.&lt;br /&gt;
&lt;br /&gt;
=== Design Patterns ===&lt;br /&gt;
The implementation team expects that the following design patterns be used in the solution:&lt;br /&gt;
 &lt;br /&gt;
* '''Observer Pattern'''&amp;lt;ref&amp;gt;Observer Design Pattern https://en.wikipedia.org/wiki/Observer_pattern&amp;lt;/ref&amp;gt;: The observer pattern is a software design pattern in which an object, called the subject, maintains a list of its dependents, called observers, and notifies them automatically of any state changes, usually by calling one of their methods. For example, we are notifying the team members whenever the reviewer submits the query.&lt;br /&gt;
&lt;br /&gt;
* '''Iterator Pattern''': In our instance, we need to display the entire chat history of a particular interaction, hence we can use the iterator design pattern to iterate through the previous chat messages.&lt;br /&gt;
&lt;br /&gt;
=== Database Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:Review_chats.png]]&lt;br /&gt;
&lt;br /&gt;
The above figure shows the schema of a new table which will be created in Expertiza to store relevant information about the chat. It contains the following attributes:&lt;br /&gt;
* id: This attribute is auto-generated by rails when we create a table and is auto incremented with each record. It is also the primary key of our table.&lt;br /&gt;
* assignment_id: Stores the ID of the assignment for which the interaction between author and reviewer is taking place.&lt;br /&gt;
* reviewer_id: Stores the ID of the reviewer who asks the questions.&lt;br /&gt;
* team_id: Stores the ID of the team to which the topic belongs.&lt;br /&gt;
* type_flag: Flag which is used to indicate if the particular tuple contains a question or answer. It can take two values, 'Q' for question and 'A' for answer.&lt;br /&gt;
* content: Stores the question asked by the reviewer or the response given by the author/s depending on the value of the type flag.&lt;br /&gt;
&lt;br /&gt;
Records for a particular interaction can be identified by using a combination of assignment_id, reviewer_id and team_id.&lt;br /&gt;
&lt;br /&gt;
=== Use Cases ===&lt;br /&gt;
'''Name:''' Send a question to the author/s about their work.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Reviewer. &amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The reviewer enters his question in the text area which is provided and clicks on the &amp;quot;Ask question&amp;quot; button which is provided as shown in the mock up. On clicking this button an email is sent to the author/s along which a link to answer the question.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''Name:''' Answer the question which has been asked by the reviewer.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Author/s&amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The author/s click on the link received in their email and are redirected to a page where they can answer the question. Once they submit the answer, an email is sent to the reviewer notifying him/her that their question has been answered.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:ARSNUsecase.jpeg]]&lt;br /&gt;
&lt;br /&gt;
=== Proposed Tests ===&lt;br /&gt;
1. For use case 1, test whether all the team members receive email with the question.&amp;lt;br/&amp;gt;&lt;br /&gt;
2. For use case 2, test whether the reviewer receive email with the response.&amp;lt;br/&amp;gt;&lt;br /&gt;
3. Test whether all the previous interactions are displayed as chat history.&amp;lt;br/&amp;gt;&lt;br /&gt;
4. The 'Ask Question' button should not be enabled until some text has been entered in the text area.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
===Code Implementation===&lt;br /&gt;
&lt;br /&gt;
*Create a new model '''review_chat.rb''' for ReviewChat.&lt;br /&gt;
&lt;br /&gt;
'''Validation'''- Check if the query box is not empty and restrict the query length to 255 characters.&lt;br /&gt;
&lt;br /&gt;
  validates_length_of :content , :maximum =&amp;gt; 255,message: &amp;quot;Length must be less that 255 characters&amp;quot;&lt;br /&gt;
  validates_presence_of :content, message: &amp;quot;Content cannot be blank&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*Create a new controller '''review_chats_controller.rb''' with the following methods:&lt;br /&gt;
&lt;br /&gt;
'''action_allowed?'''- Allow chat visibility to the reviewers and the authors of a particular interaction&lt;br /&gt;
&lt;br /&gt;
  def action_allowed?&lt;br /&gt;
    review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    allowed_users=Array.new&lt;br /&gt;
    team_id=review_chat.team_id&lt;br /&gt;
    teams_users = TeamsUser.where(team_id: team_id)&lt;br /&gt;
    teams_users.each do |teams_user|&lt;br /&gt;
      allowed_users &amp;lt;&amp;lt; User.find(teams_user.user_id).id&lt;br /&gt;
    end&lt;br /&gt;
    allowed_users &amp;lt;&amp;lt; Participant.find(review_chat.reviewer_id).user_id&lt;br /&gt;
    current_role_name.eql? 'Student' and allowed_users.include?(session[:user].id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''show'''- Show the chat interaction log&lt;br /&gt;
&lt;br /&gt;
  def show&lt;br /&gt;
    @review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    @assignment_id=@review_chat.assignment_id&lt;br /&gt;
    @reviewer_id=@review_chat.reviewer_id&lt;br /&gt;
    @team_id=@review_chat.team_id&lt;br /&gt;
    @chat_log=ReviewChat.where(:reviewer_id =&amp;gt; @reviewer_id).where(:team_id =&amp;gt; @team_id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''submitted_response'''- Create a chat record and send an email to the reviewer when an author replied to a query asked by the reviewer&lt;br /&gt;
&lt;br /&gt;
  def submitted_response&lt;br /&gt;
    @review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    @chat_reviewer=Participant.find(@review_chat.reviewer_id).user_id&lt;br /&gt;
    if(@chat_reviewer==session[:user].id) then&lt;br /&gt;
    	ReviewChat.create(:assignment_id =&amp;gt; @review_chat.assignment_id,:reviewer_id =&amp;gt; @review_chat.reviewer_id, :team_id=&amp;gt;@review_chat.team_id, :type_flag =&amp;gt; 'Q' , :content =&amp;gt; params[:response_area])&lt;br /&gt;
    	ReviewChatsHelper::chat_email_query(params[:id])&lt;br /&gt;
    	flash[:notice]=&amp;quot;Query has been submitted&amp;quot;	&lt;br /&gt;
    else	&lt;br /&gt;
      	ReviewChat.create(:assignment_id =&amp;gt; @review_chat.assignment_id,:reviewer_id =&amp;gt; @review_chat.reviewer_id, :team_id=&amp;gt;@review_chat.team_id, :type_flag =&amp;gt; 'A' , :content =&amp;gt; params[:response_area])&lt;br /&gt;
      	ReviewChatsHelper::chat_email_response(@review_chat.id,@chat_reviewer)&lt;br /&gt;
      flash[:notice]=&amp;quot;Response has been submitted&amp;quot;&lt;br /&gt;
    end	&lt;br /&gt;
    redirect_to action: 'show', id: params[:id]&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
*Methods in the helper file '''review_chats_helper.rb'''&lt;br /&gt;
&lt;br /&gt;
'''chat_email_response'''- Send an email to the author of an assignment when a reviewer posts a query&lt;br /&gt;
&lt;br /&gt;
  def self.chat_email_response(id,reviewer_id,partial=&amp;quot;new_chatemail&amp;quot;)&lt;br /&gt;
    defn = Hash.new&lt;br /&gt;
    defn[:body] = Hash.new&lt;br /&gt;
    defn[:body][:partial_name] = partial&lt;br /&gt;
    reviewer_email=User.find(reviewer_id).email&lt;br /&gt;
    defn[:subject] = &amp;quot;Response posted for submission&amp;quot;&lt;br /&gt;
    defn[:body][:type] = &amp;quot; response has been posted for your query .&lt;br /&gt;
    Please open the below URL to view.&lt;br /&gt;
    http://expertiza.ncsu.edu/review_chats/show/#{id}&amp;quot;&lt;br /&gt;
    defn[:to] = reviewer_email&lt;br /&gt;
    Mailer.sync_message(defn).deliver&lt;br /&gt;
  end &lt;br /&gt;
&lt;br /&gt;
'''chat_email_query'''- Send an email to the author of an assignment when a reviewer posts a query&lt;br /&gt;
&lt;br /&gt;
  def self.chat_email_query(id,partial=&amp;quot;new_chatemail&amp;quot;)&lt;br /&gt;
    defn = Hash.new&lt;br /&gt;
    defn[:body] = Hash.new&lt;br /&gt;
    defn[:body][:partial_name] = partial&lt;br /&gt;
    assignment=nil&lt;br /&gt;
    @team_id=ReviewChat.find(id).team_id&lt;br /&gt;
    teams_users = TeamsUser.where(team_id: @team_id)&lt;br /&gt;
    to_mail_list = Array.new&lt;br /&gt;
    teams_users.each do |teams_user|&lt;br /&gt;
    to_mail_list &amp;lt;&amp;lt; User.find(teams_user.user_id).email &lt;br /&gt;
    end&lt;br /&gt;
    defn[:subject] = &amp;quot;Query posted for submission&amp;quot;&lt;br /&gt;
    defn[:body][:type] = &amp;quot; query has been posted for your submission .&lt;br /&gt;
    Please open the below URL to view and respond.&lt;br /&gt;
    http://expertiza.ncsu.edu/review_chats/show/#{id}&amp;quot;&lt;br /&gt;
    defn[:to] = to_mail_list&lt;br /&gt;
    Mailer.sync_message(defn).deliver&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
*Modify existing controller '''response_controller.rb''' and add a new method.&lt;br /&gt;
&lt;br /&gt;
'''submitted_question'''- Create a chat record and send an email to the authors when a reviewer posts a query.&lt;br /&gt;
  def submitted_question&lt;br /&gt;
      @map = ResponseMap.find(params[:id])&lt;br /&gt;
      ReviewChat.create(:assignment_id =&amp;gt; @map.assignment.id,:reviewer_id =&amp;gt; @map.reviewer_id, :team_id=&amp;gt;@map.reviewee_id, :type_flag =&amp;gt; 'Q' , :content =&amp;gt; params[:review_question])&lt;br /&gt;
      flash[:notice]=&amp;quot;Question has been submitted to Author&amp;quot;&lt;br /&gt;
      @interaction_id=ReviewChat.where(:reviewer_id =&amp;gt; @map.reviewer_id).where(:team_id =&amp;gt; @map.reviewee_id)&lt;br /&gt;
      ReviewChatsHelper::chat_email_query(@interaction_id.first.id)&lt;br /&gt;
      redirect_to action: 'new', id: params[:id]&lt;br /&gt;
  end&lt;br /&gt;
*Create a new view '''show.html.erb''' to show the existing chat record and a box to respond and ask a follow up query.&lt;br /&gt;
&lt;br /&gt;
===Flowchart===&lt;br /&gt;
&lt;br /&gt;
[[File: ARSNFlowchart1.png]]&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
===User Interface Testing===&lt;br /&gt;
&lt;br /&gt;
* Login to Expertiza with a student account. You can use login id as 'student5700' and password as 'password'.&lt;br /&gt;
* Start reviewing an existing assignment. You would see a small query box at the bottom of the page.&lt;br /&gt;
*The reviewer enters his question in the text area provided and clicks on the &amp;quot;Submit&amp;quot; button.&lt;br /&gt;
[[File: FinalProject1.jpg]]&lt;br /&gt;
*On clicking this button the appropriate method is called in ReviewChats controller which sends an email to all the authors of the topic indicating that a question has been asked about their work. The email contains a link which when clicked on will redirect the author to the appropriate view where he/she can answer the question.&lt;br /&gt;
[[File: FinalProject4.jpg]]&lt;br /&gt;
*On answering the question, the reviewer receives an email indicating that his question has been answered. It also contains a link which redirects the reviewer to the appropriate view where the answer will be displayed.&lt;br /&gt;
*The authorized users will also be able to see a link to open existing chat interaction log.&lt;br /&gt;
[[File: FinalProject3.jpg]]&lt;br /&gt;
*This view also contains the chat history between the author/s and the reviewer for the entire duration of the interaction.&lt;br /&gt;
[[File: FinalProject2.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Model Testing===&lt;br /&gt;
&lt;br /&gt;
* Create a model test file '''review_chat_test.rb''' and check the below.&lt;br /&gt;
'''Presence of assignment_id'''&lt;br /&gt;
&lt;br /&gt;
  test &amp;quot;assignment_id should be present&amp;quot; do&lt;br /&gt;
    @review_chat.assignment_id = &amp;quot; &amp;quot;&lt;br /&gt;
    assert_not @review_chat.assignment_id?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Presence of reviewer_id'''&lt;br /&gt;
&lt;br /&gt;
	test &amp;quot;reviewer_id should be present&amp;quot; do&lt;br /&gt;
	@review_chat.reviewer_id = &amp;quot; &amp;quot;&lt;br /&gt;
	assert_not @review_chat.reviewer_id?&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
'''Presence of team_id'''&lt;br /&gt;
&lt;br /&gt;
	test &amp;quot;team_id should be present&amp;quot; do&lt;br /&gt;
	@review_chat.team_id = &amp;quot; &amp;quot;&lt;br /&gt;
	assert_not @review_chat.team_id?&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
'''Presence of content'''&lt;br /&gt;
&lt;br /&gt;
	test &amp;quot;content should be present (nonblank)&amp;quot; do&lt;br /&gt;
	@review_chat.content = &amp;quot; &amp;quot; * 6&lt;br /&gt;
	assert_not @review_chat.valid?&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
'''Length of content'''&lt;br /&gt;
&lt;br /&gt;
	test &amp;quot;content should have a maximum length of 255&amp;quot; do&lt;br /&gt;
	@review_chat.content = &amp;quot;a&amp;quot; * 250&lt;br /&gt;
	assert @review_chat.valid?&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
== Suggestions for Future Improvements ==&lt;br /&gt;
&lt;br /&gt;
* This can be extended to a live interactive author-reviewer anonymous chat session inside the Expertiza reviews window.&lt;br /&gt;
* A purging script can be developed which will clear all the interaction records every semester.&lt;br /&gt;
&lt;br /&gt;
==Resources==&lt;br /&gt;
&lt;br /&gt;
* Expertiza Github repository&amp;lt;ref&amp;gt;Expertiza Github repository https://github.com/expertiza/expertiza&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
[https://www.youtube.com/watch?v=8E-hYiJVoZI Demo Video]&lt;/div&gt;</summary>
		<author><name>Sgulati2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100200</id>
		<title>CSC/ECE 517 Fall 2015 E1586 AnonymousChatBetweenAuthorAndReviewer</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100200"/>
		<updated>2015-12-05T01:24:11Z</updated>

		<summary type="html">&lt;p&gt;Sgulati2: /* Testing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1586 AnonymousChatBetweenAuthorAndReviewer'''&lt;br /&gt;
&lt;br /&gt;
This page provides a brief description of the '''Expertiza''' project. The project is aimed at developing an email based anonymous session between author and a reviewer so that reviewers can ask questions to the authors for any doubts related to the assignments during peer reviewing.&lt;br /&gt;
&lt;br /&gt;
==Project==&lt;br /&gt;
&lt;br /&gt;
=== Introduction to Expertiza ===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a peer review based system which provides an incremental class based learning together with the instructors and the peers. This project has been developed together by faculty and students using [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza handles assignment submissions, team formations, assignment reviews and grades, etc.&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
During reviews, many times reviewers will be having questions about the submitted material and if it's a blocker there is no way that the reviewer can progress further with the review.  As a result, reviewers will end up submitting the empty or incomplete review.&lt;br /&gt;
&lt;br /&gt;
=== Scope ===&lt;br /&gt;
This project is limited to an email based conversation for asking questions and answers. The reviewers would ask questions related to assignment submission doubts to which authors can respond. All this would be taken care as email responses using a link provided in the email. This project does not cater to any live interactive session with spontaneous back-to-back questions and responses.&lt;br /&gt;
&lt;br /&gt;
Following tasks would be incorporated in the project:&lt;br /&gt;
* Provide a ‘TextArea’ input field on review forms, where any reviewer can type in their questions.&lt;br /&gt;
* Create a new button ‘Ask for Quick Help’ on the review forms.&lt;br /&gt;
* An email would be send to the author with the link where he can respond to the questions asked by the reviewers for their submitted work.&lt;br /&gt;
* Reviewers would be notified by an email when authors respond to the the questions.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Discussion of Resolution ===&lt;br /&gt;
&lt;br /&gt;
We will make the following modifications to implement the chat feature:- &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Create a new model which will help to extract, store and validate data in the database table which contains information about the interaction between the author/s and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Edit the view which is used by the response controller to incorporate the text area input field on the review form where the reviewer can ask his/her initial query.&lt;br /&gt;
&lt;br /&gt;
*Create a new controller with methods for authentication for a respective chat log only visible to the author and reviewer of a particular assignment, method to submit a response or a follow up query and show the existing interaction log.&lt;br /&gt;
&lt;br /&gt;
*Create a new helper with the e-mail methods for sending to the author and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Create a new view which will facilitate the author to respond to the queries asked by the reviewer. The reviewer can also use this view to ask any follow up questions.&lt;br /&gt;
&lt;br /&gt;
=== Design Patterns ===&lt;br /&gt;
The implementation team expects that the following design patterns be used in the solution:&lt;br /&gt;
 &lt;br /&gt;
* '''Observer Pattern'''&amp;lt;ref&amp;gt;Observer Design Pattern https://en.wikipedia.org/wiki/Observer_pattern&amp;lt;/ref&amp;gt;: The observer pattern is a software design pattern in which an object, called the subject, maintains a list of its dependents, called observers, and notifies them automatically of any state changes, usually by calling one of their methods. For example, we are notifying the team members whenever the reviewer submits the query.&lt;br /&gt;
&lt;br /&gt;
* '''Iterator Pattern''': In our instance, we need to display the entire chat history of a particular interaction, hence we can use the iterator design pattern to iterate through the previous chat messages.&lt;br /&gt;
&lt;br /&gt;
=== Database Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:Review_chats.png]]&lt;br /&gt;
&lt;br /&gt;
The above figure shows the schema of a new table which will be created in Expertiza to store relevant information about the chat. It contains the following attributes:&lt;br /&gt;
* id: This attribute is auto-generated by rails when we create a table and is auto incremented with each record. It is also the primary key of our table.&lt;br /&gt;
* assignment_id: Stores the ID of the assignment for which the interaction between author and reviewer is taking place.&lt;br /&gt;
* reviewer_id: Stores the ID of the reviewer who asks the questions.&lt;br /&gt;
* team_id: Stores the ID of the team to which the topic belongs.&lt;br /&gt;
* type_flag: Flag which is used to indicate if the particular tuple contains a question or answer. It can take two values, 'Q' for question and 'A' for answer.&lt;br /&gt;
* content: Stores the question asked by the reviewer or the response given by the author/s depending on the value of the type flag.&lt;br /&gt;
&lt;br /&gt;
Records for a particular interaction can be identified by using a combination of assignment_id, reviewer_id and team_id.&lt;br /&gt;
&lt;br /&gt;
=== Use Cases ===&lt;br /&gt;
'''Name:''' Send a question to the author/s about their work.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Reviewer. &amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The reviewer enters his question in the text area which is provided and clicks on the &amp;quot;Ask question&amp;quot; button which is provided as shown in the mock up. On clicking this button an email is sent to the author/s along which a link to answer the question.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''Name:''' Answer the question which has been asked by the reviewer.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Author/s&amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The author/s click on the link received in their email and are redirected to a page where they can answer the question. Once they submit the answer, an email is sent to the reviewer notifying him/her that their question has been answered.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:ARSNUsecase.jpeg]]&lt;br /&gt;
&lt;br /&gt;
=== Proposed Tests ===&lt;br /&gt;
1. For use case 1, test whether all the team members receive email with the question.&amp;lt;br/&amp;gt;&lt;br /&gt;
2. For use case 2, test whether the reviewer receive email with the response.&amp;lt;br/&amp;gt;&lt;br /&gt;
3. Test whether all the previous interactions are displayed as chat history.&amp;lt;br/&amp;gt;&lt;br /&gt;
4. The 'Ask Question' button should not be enabled until some text has been entered in the text area.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
===Code Implementation===&lt;br /&gt;
&lt;br /&gt;
*Create a new model '''review_chat.rb''' for ReviewChat.&lt;br /&gt;
&lt;br /&gt;
'''Validation'''- Check if the query box is not empty and restrict the query length to 255 characters.&lt;br /&gt;
&lt;br /&gt;
  validates_length_of :content , :maximum =&amp;gt; 255,message: &amp;quot;Length must be less that 255 characters&amp;quot;&lt;br /&gt;
  validates_presence_of :content, message: &amp;quot;Content cannot be blank&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*Create a new controller '''review_chats_controller.rb''' with the following methods:&lt;br /&gt;
&lt;br /&gt;
'''action_allowed?'''- Allow chat visibility to the reviewers and the authors of a particular interaction&lt;br /&gt;
&lt;br /&gt;
  def action_allowed?&lt;br /&gt;
    review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    allowed_users=Array.new&lt;br /&gt;
    team_id=review_chat.team_id&lt;br /&gt;
    teams_users = TeamsUser.where(team_id: team_id)&lt;br /&gt;
    teams_users.each do |teams_user|&lt;br /&gt;
      allowed_users &amp;lt;&amp;lt; User.find(teams_user.user_id).id&lt;br /&gt;
    end&lt;br /&gt;
    allowed_users &amp;lt;&amp;lt; Participant.find(review_chat.reviewer_id).user_id&lt;br /&gt;
    current_role_name.eql? 'Student' and allowed_users.include?(session[:user].id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''show'''- Show the chat interaction log&lt;br /&gt;
&lt;br /&gt;
  def show&lt;br /&gt;
    @review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    @assignment_id=@review_chat.assignment_id&lt;br /&gt;
    @reviewer_id=@review_chat.reviewer_id&lt;br /&gt;
    @team_id=@review_chat.team_id&lt;br /&gt;
    @chat_log=ReviewChat.where(:reviewer_id =&amp;gt; @reviewer_id).where(:team_id =&amp;gt; @team_id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''submitted_response'''- Create a chat record and send an email to the reviewer when an author replied to a query asked by the reviewer&lt;br /&gt;
&lt;br /&gt;
  def submitted_response&lt;br /&gt;
    @review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    @chat_reviewer=Participant.find(@review_chat.reviewer_id).user_id&lt;br /&gt;
    if(@chat_reviewer==session[:user].id) then&lt;br /&gt;
    	ReviewChat.create(:assignment_id =&amp;gt; @review_chat.assignment_id,:reviewer_id =&amp;gt; @review_chat.reviewer_id, :team_id=&amp;gt;@review_chat.team_id, :type_flag =&amp;gt; 'Q' , :content =&amp;gt; params[:response_area])&lt;br /&gt;
    	ReviewChatsHelper::chat_email_query(params[:id])&lt;br /&gt;
    	flash[:notice]=&amp;quot;Query has been submitted&amp;quot;	&lt;br /&gt;
    else	&lt;br /&gt;
      	ReviewChat.create(:assignment_id =&amp;gt; @review_chat.assignment_id,:reviewer_id =&amp;gt; @review_chat.reviewer_id, :team_id=&amp;gt;@review_chat.team_id, :type_flag =&amp;gt; 'A' , :content =&amp;gt; params[:response_area])&lt;br /&gt;
      	ReviewChatsHelper::chat_email_response(@review_chat.id,@chat_reviewer)&lt;br /&gt;
      flash[:notice]=&amp;quot;Response has been submitted&amp;quot;&lt;br /&gt;
    end	&lt;br /&gt;
    redirect_to action: 'show', id: params[:id]&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
*Methods in the helper file '''review_chats_helper.rb'''&lt;br /&gt;
&lt;br /&gt;
'''chat_email_response'''- Send an email to the author of an assignment when a reviewer posts a query&lt;br /&gt;
&lt;br /&gt;
  def self.chat_email_response(id,reviewer_id,partial=&amp;quot;new_chatemail&amp;quot;)&lt;br /&gt;
    defn = Hash.new&lt;br /&gt;
    defn[:body] = Hash.new&lt;br /&gt;
    defn[:body][:partial_name] = partial&lt;br /&gt;
    reviewer_email=User.find(reviewer_id).email&lt;br /&gt;
    defn[:subject] = &amp;quot;Response posted for submission&amp;quot;&lt;br /&gt;
    defn[:body][:type] = &amp;quot; response has been posted for your query .&lt;br /&gt;
    Please open the below URL to view.&lt;br /&gt;
    http://expertiza.ncsu.edu/review_chats/show/#{id}&amp;quot;&lt;br /&gt;
    defn[:to] = reviewer_email&lt;br /&gt;
    Mailer.sync_message(defn).deliver&lt;br /&gt;
  end &lt;br /&gt;
&lt;br /&gt;
'''chat_email_query'''- Send an email to the author of an assignment when a reviewer posts a query&lt;br /&gt;
&lt;br /&gt;
  def self.chat_email_query(id,partial=&amp;quot;new_chatemail&amp;quot;)&lt;br /&gt;
    defn = Hash.new&lt;br /&gt;
    defn[:body] = Hash.new&lt;br /&gt;
    defn[:body][:partial_name] = partial&lt;br /&gt;
    assignment=nil&lt;br /&gt;
    @team_id=ReviewChat.find(id).team_id&lt;br /&gt;
    teams_users = TeamsUser.where(team_id: @team_id)&lt;br /&gt;
    to_mail_list = Array.new&lt;br /&gt;
    teams_users.each do |teams_user|&lt;br /&gt;
    to_mail_list &amp;lt;&amp;lt; User.find(teams_user.user_id).email &lt;br /&gt;
    end&lt;br /&gt;
    defn[:subject] = &amp;quot;Query posted for submission&amp;quot;&lt;br /&gt;
    defn[:body][:type] = &amp;quot; query has been posted for your submission .&lt;br /&gt;
    Please open the below URL to view and respond.&lt;br /&gt;
    http://expertiza.ncsu.edu/review_chats/show/#{id}&amp;quot;&lt;br /&gt;
    defn[:to] = to_mail_list&lt;br /&gt;
    Mailer.sync_message(defn).deliver&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
*Modify existing controller '''response_controller.rb''' and add a new method.&lt;br /&gt;
&lt;br /&gt;
'''submitted_question'''- Create a chat record and send an email to the authors when a reviewer posts a query.&lt;br /&gt;
  def submitted_question&lt;br /&gt;
      @map = ResponseMap.find(params[:id])&lt;br /&gt;
      ReviewChat.create(:assignment_id =&amp;gt; @map.assignment.id,:reviewer_id =&amp;gt; @map.reviewer_id, :team_id=&amp;gt;@map.reviewee_id, :type_flag =&amp;gt; 'Q' , :content =&amp;gt; params[:review_question])&lt;br /&gt;
      flash[:notice]=&amp;quot;Question has been submitted to Author&amp;quot;&lt;br /&gt;
      @interaction_id=ReviewChat.where(:reviewer_id =&amp;gt; @map.reviewer_id).where(:team_id =&amp;gt; @map.reviewee_id)&lt;br /&gt;
      ReviewChatsHelper::chat_email_query(@interaction_id.first.id)&lt;br /&gt;
      redirect_to action: 'new', id: params[:id]&lt;br /&gt;
  end&lt;br /&gt;
*Create a new view '''show.html.erb''' to show the existing chat record and a box to respond and ask a follow up query.&lt;br /&gt;
&lt;br /&gt;
===Flowchart===&lt;br /&gt;
&lt;br /&gt;
[[File: ARSNFlowchart1.png]]&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
===User Interface Testing===&lt;br /&gt;
&lt;br /&gt;
* Login to Expertiza with a student account. You can use login id as 'student5700' and password as 'password'.&lt;br /&gt;
* Start reviewing an existing assignment. You would see a small query box at the bottom of the page.&lt;br /&gt;
*The reviewer enters his question in the text area provided and clicks on the &amp;quot;Submit&amp;quot; button.&lt;br /&gt;
[[File: FinalProject1.jpg]]&lt;br /&gt;
*On clicking this button the appropriate method is called in ReviewChats controller which sends an email to all the authors of the topic indicating that a question has been asked about their work. The email contains a link which when clicked on will redirect the author to the appropriate view where he/she can answer the question.&lt;br /&gt;
[[File: FinalProject4.jpg]]&lt;br /&gt;
*On answering the question, the reviewer receives an email indicating that his question has been answered. It also contains a link which redirects the reviewer to the appropriate view where the answer will be displayed.&lt;br /&gt;
*The authorized users will also be able to see a link to open existing chat interaction log.&lt;br /&gt;
[[File: FinalProject3.jpg]]&lt;br /&gt;
*This view also contains the chat history between the author/s and the reviewer for the entire duration of the interaction.&lt;br /&gt;
[[File: FinalProject2.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Model Testing===&lt;br /&gt;
&lt;br /&gt;
* Create a model test file '''review_chat_test.rb''' and check the below.&lt;br /&gt;
'''Presence of assignment_id'''&lt;br /&gt;
&lt;br /&gt;
test &amp;quot;assignment_id should be present&amp;quot; do&lt;br /&gt;
	@review_chat.assignment_id = &amp;quot; &amp;quot;&lt;br /&gt;
	assert_not @review_chat.assignment_id?&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
'''Presence of reviewer_id'''&lt;br /&gt;
&lt;br /&gt;
	test &amp;quot;reviewer_id should be present&amp;quot; do&lt;br /&gt;
	@review_chat.reviewer_id = &amp;quot; &amp;quot;&lt;br /&gt;
	assert_not @review_chat.reviewer_id?&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
'''Presence of team_id'''&lt;br /&gt;
&lt;br /&gt;
	test &amp;quot;team_id should be present&amp;quot; do&lt;br /&gt;
	@review_chat.team_id = &amp;quot; &amp;quot;&lt;br /&gt;
	assert_not @review_chat.team_id?&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
'''Presence of content'''&lt;br /&gt;
&lt;br /&gt;
	test &amp;quot;content should be present (nonblank)&amp;quot; do&lt;br /&gt;
	@review_chat.content = &amp;quot; &amp;quot; * 6&lt;br /&gt;
	assert_not @review_chat.valid?&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
'''Length of content'''&lt;br /&gt;
&lt;br /&gt;
	test &amp;quot;content should have a maximum length of 255&amp;quot; do&lt;br /&gt;
	@review_chat.content = &amp;quot;a&amp;quot; * 250&lt;br /&gt;
	assert @review_chat.valid?&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
== Suggestions for Future Improvements ==&lt;br /&gt;
&lt;br /&gt;
* This can be extended to a live interactive author-reviewer anonymous chat session inside the Expertiza reviews window.&lt;br /&gt;
* A purging script can be developed which will clear all the interaction records every semester.&lt;br /&gt;
&lt;br /&gt;
==Resources==&lt;br /&gt;
&lt;br /&gt;
* Expertiza Github repository&amp;lt;ref&amp;gt;Expertiza Github repository https://github.com/expertiza/expertiza&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
[https://www.youtube.com/watch?v=8E-hYiJVoZI Demo Video]&lt;/div&gt;</summary>
		<author><name>Sgulati2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100199</id>
		<title>CSC/ECE 517 Fall 2015 E1586 AnonymousChatBetweenAuthorAndReviewer</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100199"/>
		<updated>2015-12-05T01:20:55Z</updated>

		<summary type="html">&lt;p&gt;Sgulati2: /* Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1586 AnonymousChatBetweenAuthorAndReviewer'''&lt;br /&gt;
&lt;br /&gt;
This page provides a brief description of the '''Expertiza''' project. The project is aimed at developing an email based anonymous session between author and a reviewer so that reviewers can ask questions to the authors for any doubts related to the assignments during peer reviewing.&lt;br /&gt;
&lt;br /&gt;
==Project==&lt;br /&gt;
&lt;br /&gt;
=== Introduction to Expertiza ===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a peer review based system which provides an incremental class based learning together with the instructors and the peers. This project has been developed together by faculty and students using [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza handles assignment submissions, team formations, assignment reviews and grades, etc.&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
During reviews, many times reviewers will be having questions about the submitted material and if it's a blocker there is no way that the reviewer can progress further with the review.  As a result, reviewers will end up submitting the empty or incomplete review.&lt;br /&gt;
&lt;br /&gt;
=== Scope ===&lt;br /&gt;
This project is limited to an email based conversation for asking questions and answers. The reviewers would ask questions related to assignment submission doubts to which authors can respond. All this would be taken care as email responses using a link provided in the email. This project does not cater to any live interactive session with spontaneous back-to-back questions and responses.&lt;br /&gt;
&lt;br /&gt;
Following tasks would be incorporated in the project:&lt;br /&gt;
* Provide a ‘TextArea’ input field on review forms, where any reviewer can type in their questions.&lt;br /&gt;
* Create a new button ‘Ask for Quick Help’ on the review forms.&lt;br /&gt;
* An email would be send to the author with the link where he can respond to the questions asked by the reviewers for their submitted work.&lt;br /&gt;
* Reviewers would be notified by an email when authors respond to the the questions.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Discussion of Resolution ===&lt;br /&gt;
&lt;br /&gt;
We will make the following modifications to implement the chat feature:- &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Create a new model which will help to extract, store and validate data in the database table which contains information about the interaction between the author/s and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Edit the view which is used by the response controller to incorporate the text area input field on the review form where the reviewer can ask his/her initial query.&lt;br /&gt;
&lt;br /&gt;
*Create a new controller with methods for authentication for a respective chat log only visible to the author and reviewer of a particular assignment, method to submit a response or a follow up query and show the existing interaction log.&lt;br /&gt;
&lt;br /&gt;
*Create a new helper with the e-mail methods for sending to the author and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Create a new view which will facilitate the author to respond to the queries asked by the reviewer. The reviewer can also use this view to ask any follow up questions.&lt;br /&gt;
&lt;br /&gt;
=== Design Patterns ===&lt;br /&gt;
The implementation team expects that the following design patterns be used in the solution:&lt;br /&gt;
 &lt;br /&gt;
* '''Observer Pattern'''&amp;lt;ref&amp;gt;Observer Design Pattern https://en.wikipedia.org/wiki/Observer_pattern&amp;lt;/ref&amp;gt;: The observer pattern is a software design pattern in which an object, called the subject, maintains a list of its dependents, called observers, and notifies them automatically of any state changes, usually by calling one of their methods. For example, we are notifying the team members whenever the reviewer submits the query.&lt;br /&gt;
&lt;br /&gt;
* '''Iterator Pattern''': In our instance, we need to display the entire chat history of a particular interaction, hence we can use the iterator design pattern to iterate through the previous chat messages.&lt;br /&gt;
&lt;br /&gt;
=== Database Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:Review_chats.png]]&lt;br /&gt;
&lt;br /&gt;
The above figure shows the schema of a new table which will be created in Expertiza to store relevant information about the chat. It contains the following attributes:&lt;br /&gt;
* id: This attribute is auto-generated by rails when we create a table and is auto incremented with each record. It is also the primary key of our table.&lt;br /&gt;
* assignment_id: Stores the ID of the assignment for which the interaction between author and reviewer is taking place.&lt;br /&gt;
* reviewer_id: Stores the ID of the reviewer who asks the questions.&lt;br /&gt;
* team_id: Stores the ID of the team to which the topic belongs.&lt;br /&gt;
* type_flag: Flag which is used to indicate if the particular tuple contains a question or answer. It can take two values, 'Q' for question and 'A' for answer.&lt;br /&gt;
* content: Stores the question asked by the reviewer or the response given by the author/s depending on the value of the type flag.&lt;br /&gt;
&lt;br /&gt;
Records for a particular interaction can be identified by using a combination of assignment_id, reviewer_id and team_id.&lt;br /&gt;
&lt;br /&gt;
=== Use Cases ===&lt;br /&gt;
'''Name:''' Send a question to the author/s about their work.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Reviewer. &amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The reviewer enters his question in the text area which is provided and clicks on the &amp;quot;Ask question&amp;quot; button which is provided as shown in the mock up. On clicking this button an email is sent to the author/s along which a link to answer the question.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''Name:''' Answer the question which has been asked by the reviewer.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Author/s&amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The author/s click on the link received in their email and are redirected to a page where they can answer the question. Once they submit the answer, an email is sent to the reviewer notifying him/her that their question has been answered.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:ARSNUsecase.jpeg]]&lt;br /&gt;
&lt;br /&gt;
=== Proposed Tests ===&lt;br /&gt;
1. For use case 1, test whether all the team members receive email with the question.&amp;lt;br/&amp;gt;&lt;br /&gt;
2. For use case 2, test whether the reviewer receive email with the response.&amp;lt;br/&amp;gt;&lt;br /&gt;
3. Test whether all the previous interactions are displayed as chat history.&amp;lt;br/&amp;gt;&lt;br /&gt;
4. The 'Ask Question' button should not be enabled until some text has been entered in the text area.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
===Code Implementation===&lt;br /&gt;
&lt;br /&gt;
*Create a new model '''review_chat.rb''' for ReviewChat.&lt;br /&gt;
&lt;br /&gt;
'''Validation'''- Check if the query box is not empty and restrict the query length to 255 characters.&lt;br /&gt;
&lt;br /&gt;
  validates_length_of :content , :maximum =&amp;gt; 255,message: &amp;quot;Length must be less that 255 characters&amp;quot;&lt;br /&gt;
  validates_presence_of :content, message: &amp;quot;Content cannot be blank&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*Create a new controller '''review_chats_controller.rb''' with the following methods:&lt;br /&gt;
&lt;br /&gt;
'''action_allowed?'''- Allow chat visibility to the reviewers and the authors of a particular interaction&lt;br /&gt;
&lt;br /&gt;
  def action_allowed?&lt;br /&gt;
    review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    allowed_users=Array.new&lt;br /&gt;
    team_id=review_chat.team_id&lt;br /&gt;
    teams_users = TeamsUser.where(team_id: team_id)&lt;br /&gt;
    teams_users.each do |teams_user|&lt;br /&gt;
      allowed_users &amp;lt;&amp;lt; User.find(teams_user.user_id).id&lt;br /&gt;
    end&lt;br /&gt;
    allowed_users &amp;lt;&amp;lt; Participant.find(review_chat.reviewer_id).user_id&lt;br /&gt;
    current_role_name.eql? 'Student' and allowed_users.include?(session[:user].id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''show'''- Show the chat interaction log&lt;br /&gt;
&lt;br /&gt;
  def show&lt;br /&gt;
    @review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    @assignment_id=@review_chat.assignment_id&lt;br /&gt;
    @reviewer_id=@review_chat.reviewer_id&lt;br /&gt;
    @team_id=@review_chat.team_id&lt;br /&gt;
    @chat_log=ReviewChat.where(:reviewer_id =&amp;gt; @reviewer_id).where(:team_id =&amp;gt; @team_id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''submitted_response'''- Create a chat record and send an email to the reviewer when an author replied to a query asked by the reviewer&lt;br /&gt;
&lt;br /&gt;
  def submitted_response&lt;br /&gt;
    @review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    @chat_reviewer=Participant.find(@review_chat.reviewer_id).user_id&lt;br /&gt;
    if(@chat_reviewer==session[:user].id) then&lt;br /&gt;
    	ReviewChat.create(:assignment_id =&amp;gt; @review_chat.assignment_id,:reviewer_id =&amp;gt; @review_chat.reviewer_id, :team_id=&amp;gt;@review_chat.team_id, :type_flag =&amp;gt; 'Q' , :content =&amp;gt; params[:response_area])&lt;br /&gt;
    	ReviewChatsHelper::chat_email_query(params[:id])&lt;br /&gt;
    	flash[:notice]=&amp;quot;Query has been submitted&amp;quot;	&lt;br /&gt;
    else	&lt;br /&gt;
      	ReviewChat.create(:assignment_id =&amp;gt; @review_chat.assignment_id,:reviewer_id =&amp;gt; @review_chat.reviewer_id, :team_id=&amp;gt;@review_chat.team_id, :type_flag =&amp;gt; 'A' , :content =&amp;gt; params[:response_area])&lt;br /&gt;
      	ReviewChatsHelper::chat_email_response(@review_chat.id,@chat_reviewer)&lt;br /&gt;
      flash[:notice]=&amp;quot;Response has been submitted&amp;quot;&lt;br /&gt;
    end	&lt;br /&gt;
    redirect_to action: 'show', id: params[:id]&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
*Methods in the helper file '''review_chats_helper.rb'''&lt;br /&gt;
&lt;br /&gt;
'''chat_email_response'''- Send an email to the author of an assignment when a reviewer posts a query&lt;br /&gt;
&lt;br /&gt;
  def self.chat_email_response(id,reviewer_id,partial=&amp;quot;new_chatemail&amp;quot;)&lt;br /&gt;
    defn = Hash.new&lt;br /&gt;
    defn[:body] = Hash.new&lt;br /&gt;
    defn[:body][:partial_name] = partial&lt;br /&gt;
    reviewer_email=User.find(reviewer_id).email&lt;br /&gt;
    defn[:subject] = &amp;quot;Response posted for submission&amp;quot;&lt;br /&gt;
    defn[:body][:type] = &amp;quot; response has been posted for your query .&lt;br /&gt;
    Please open the below URL to view.&lt;br /&gt;
    http://expertiza.ncsu.edu/review_chats/show/#{id}&amp;quot;&lt;br /&gt;
    defn[:to] = reviewer_email&lt;br /&gt;
    Mailer.sync_message(defn).deliver&lt;br /&gt;
  end &lt;br /&gt;
&lt;br /&gt;
'''chat_email_query'''- Send an email to the author of an assignment when a reviewer posts a query&lt;br /&gt;
&lt;br /&gt;
  def self.chat_email_query(id,partial=&amp;quot;new_chatemail&amp;quot;)&lt;br /&gt;
    defn = Hash.new&lt;br /&gt;
    defn[:body] = Hash.new&lt;br /&gt;
    defn[:body][:partial_name] = partial&lt;br /&gt;
    assignment=nil&lt;br /&gt;
    @team_id=ReviewChat.find(id).team_id&lt;br /&gt;
    teams_users = TeamsUser.where(team_id: @team_id)&lt;br /&gt;
    to_mail_list = Array.new&lt;br /&gt;
    teams_users.each do |teams_user|&lt;br /&gt;
    to_mail_list &amp;lt;&amp;lt; User.find(teams_user.user_id).email &lt;br /&gt;
    end&lt;br /&gt;
    defn[:subject] = &amp;quot;Query posted for submission&amp;quot;&lt;br /&gt;
    defn[:body][:type] = &amp;quot; query has been posted for your submission .&lt;br /&gt;
    Please open the below URL to view and respond.&lt;br /&gt;
    http://expertiza.ncsu.edu/review_chats/show/#{id}&amp;quot;&lt;br /&gt;
    defn[:to] = to_mail_list&lt;br /&gt;
    Mailer.sync_message(defn).deliver&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
*Modify existing controller '''response_controller.rb''' and add a new method.&lt;br /&gt;
&lt;br /&gt;
'''submitted_question'''- Create a chat record and send an email to the authors when a reviewer posts a query.&lt;br /&gt;
  def submitted_question&lt;br /&gt;
      @map = ResponseMap.find(params[:id])&lt;br /&gt;
      ReviewChat.create(:assignment_id =&amp;gt; @map.assignment.id,:reviewer_id =&amp;gt; @map.reviewer_id, :team_id=&amp;gt;@map.reviewee_id, :type_flag =&amp;gt; 'Q' , :content =&amp;gt; params[:review_question])&lt;br /&gt;
      flash[:notice]=&amp;quot;Question has been submitted to Author&amp;quot;&lt;br /&gt;
      @interaction_id=ReviewChat.where(:reviewer_id =&amp;gt; @map.reviewer_id).where(:team_id =&amp;gt; @map.reviewee_id)&lt;br /&gt;
      ReviewChatsHelper::chat_email_query(@interaction_id.first.id)&lt;br /&gt;
      redirect_to action: 'new', id: params[:id]&lt;br /&gt;
  end&lt;br /&gt;
*Create a new view '''show.html.erb''' to show the existing chat record and a box to respond and ask a follow up query.&lt;br /&gt;
&lt;br /&gt;
===Flowchart===&lt;br /&gt;
&lt;br /&gt;
[[File: ARSNFlowchart1.png]]&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
===User Interface Testing===&lt;br /&gt;
&lt;br /&gt;
* Login to Expertiza with a student account. You can use login id as 'student5700' and password as 'password'.&lt;br /&gt;
* Start reviewing an existing assignment. You would see a small query box at the bottom of the page.&lt;br /&gt;
*The reviewer enters his question in the text area provided and clicks on the &amp;quot;Submit&amp;quot; button.&lt;br /&gt;
[[File: FinalProject1.jpg]]&lt;br /&gt;
*On clicking this button the appropriate method is called in ReviewChats controller which sends an email to all the authors of the topic indicating that a question has been asked about their work. The email contains a link which when clicked on will redirect the author to the appropriate view where he/she can answer the question.&lt;br /&gt;
[[File: FinalProject4.jpg]]&lt;br /&gt;
*On answering the question, the reviewer receives an email indicating that his question has been answered. It also contains a link which redirects the reviewer to the appropriate view where the answer will be displayed.&lt;br /&gt;
*The authorized users will also be able to see a link to open existing chat interaction log.&lt;br /&gt;
[[File: FinalProject3.jpg]]&lt;br /&gt;
*This view also contains the chat history between the author/s and the reviewer for the entire duration of the interaction.&lt;br /&gt;
[[File: FinalProject2.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Suggestions for Future Improvements ==&lt;br /&gt;
&lt;br /&gt;
* This can be extended to a live interactive author-reviewer anonymous chat session inside the Expertiza reviews window.&lt;br /&gt;
* A purging script can be developed which will clear all the interaction records every semester.&lt;br /&gt;
&lt;br /&gt;
==Resources==&lt;br /&gt;
&lt;br /&gt;
* Expertiza Github repository&amp;lt;ref&amp;gt;Expertiza Github repository https://github.com/expertiza/expertiza&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
[https://www.youtube.com/watch?v=8E-hYiJVoZI Demo Video]&lt;/div&gt;</summary>
		<author><name>Sgulati2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100197</id>
		<title>CSC/ECE 517 Fall 2015 E1586 AnonymousChatBetweenAuthorAndReviewer</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100197"/>
		<updated>2015-12-05T01:19:59Z</updated>

		<summary type="html">&lt;p&gt;Sgulati2: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1586 AnonymousChatBetweenAuthorAndReviewer'''&lt;br /&gt;
&lt;br /&gt;
This page provides a brief description of the '''Expertiza''' project. The project is aimed at developing an email based anonymous session between author and a reviewer so that reviewers can ask questions to the authors for any doubts related to the assignments during peer reviewing.&lt;br /&gt;
&lt;br /&gt;
==Project==&lt;br /&gt;
&lt;br /&gt;
=== Introduction to Expertiza ===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a peer review based system which provides an incremental class based learning together with the instructors and the peers. This project has been developed together by faculty and students using [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza handles assignment submissions, team formations, assignment reviews and grades, etc.&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
During reviews, many times reviewers will be having questions about the submitted material and if it's a blocker there is no way that the reviewer can progress further with the review.  As a result, reviewers will end up submitting the empty or incomplete review.&lt;br /&gt;
&lt;br /&gt;
=== Scope ===&lt;br /&gt;
This project is limited to an email based conversation for asking questions and answers. The reviewers would ask questions related to assignment submission doubts to which authors can respond. All this would be taken care as email responses using a link provided in the email. This project does not cater to any live interactive session with spontaneous back-to-back questions and responses.&lt;br /&gt;
&lt;br /&gt;
Following tasks would be incorporated in the project:&lt;br /&gt;
* Provide a ‘TextArea’ input field on review forms, where any reviewer can type in their questions.&lt;br /&gt;
* Create a new button ‘Ask for Quick Help’ on the review forms.&lt;br /&gt;
* An email would be send to the author with the link where he can respond to the questions asked by the reviewers for their submitted work.&lt;br /&gt;
* Reviewers would be notified by an email when authors respond to the the questions.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Discussion of Resolution ===&lt;br /&gt;
&lt;br /&gt;
We will make the following modifications to implement the chat feature:- &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Create a new model which will help to extract, store and validate data in the database table which contains information about the interaction between the author/s and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Edit the view which is used by the response controller to incorporate the text area input field on the review form where the reviewer can ask his/her initial query.&lt;br /&gt;
&lt;br /&gt;
*Create a new controller with methods for authentication for a respective chat log only visible to the author and reviewer of a particular assignment, method to submit a response or a follow up query and show the existing interaction log.&lt;br /&gt;
&lt;br /&gt;
*Create a new helper with the e-mail methods for sending to the author and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Create a new view which will facilitate the author to respond to the queries asked by the reviewer. The reviewer can also use this view to ask any follow up questions.&lt;br /&gt;
&lt;br /&gt;
=== Design Patterns ===&lt;br /&gt;
The implementation team expects that the following design patterns be used in the solution:&lt;br /&gt;
 &lt;br /&gt;
* '''Observer Pattern'''&amp;lt;ref&amp;gt;Observer Design Pattern https://en.wikipedia.org/wiki/Observer_pattern&amp;lt;/ref&amp;gt;: The observer pattern is a software design pattern in which an object, called the subject, maintains a list of its dependents, called observers, and notifies them automatically of any state changes, usually by calling one of their methods. For example, we are notifying the team members whenever the reviewer submits the query.&lt;br /&gt;
&lt;br /&gt;
* '''Iterator Pattern''': In our instance, we need to display the entire chat history of a particular interaction, hence we can use the iterator design pattern to iterate through the previous chat messages.&lt;br /&gt;
&lt;br /&gt;
=== Database Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:Review_chats.png]]&lt;br /&gt;
&lt;br /&gt;
The above figure shows the schema of a new table which will be created in Expertiza to store relevant information about the chat. It contains the following attributes:&lt;br /&gt;
* id: This attribute is auto-generated by rails when we create a table and is auto incremented with each record. It is also the primary key of our table.&lt;br /&gt;
* assignment_id: Stores the ID of the assignment for which the interaction between author and reviewer is taking place.&lt;br /&gt;
* reviewer_id: Stores the ID of the reviewer who asks the questions.&lt;br /&gt;
* team_id: Stores the ID of the team to which the topic belongs.&lt;br /&gt;
* type_flag: Flag which is used to indicate if the particular tuple contains a question or answer. It can take two values, 'Q' for question and 'A' for answer.&lt;br /&gt;
* content: Stores the question asked by the reviewer or the response given by the author/s depending on the value of the type flag.&lt;br /&gt;
&lt;br /&gt;
Records for a particular interaction can be identified by using a combination of assignment_id, reviewer_id and team_id.&lt;br /&gt;
&lt;br /&gt;
=== Use Cases ===&lt;br /&gt;
'''Name:''' Send a question to the author/s about their work.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Reviewer. &amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The reviewer enters his question in the text area which is provided and clicks on the &amp;quot;Ask question&amp;quot; button which is provided as shown in the mock up. On clicking this button an email is sent to the author/s along which a link to answer the question.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''Name:''' Answer the question which has been asked by the reviewer.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Author/s&amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The author/s click on the link received in their email and are redirected to a page where they can answer the question. Once they submit the answer, an email is sent to the reviewer notifying him/her that their question has been answered.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:ARSNUsecase.jpeg]]&lt;br /&gt;
&lt;br /&gt;
=== Proposed Tests ===&lt;br /&gt;
1. For use case 1, test whether all the team members receive email with the question.&amp;lt;br/&amp;gt;&lt;br /&gt;
2. For use case 2, test whether the reviewer receive email with the response.&amp;lt;br/&amp;gt;&lt;br /&gt;
3. Test whether all the previous interactions are displayed as chat history.&amp;lt;br/&amp;gt;&lt;br /&gt;
4. The 'Ask Question' button should not be enabled until some text has been entered in the text area.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
===Code Implementation===&lt;br /&gt;
&lt;br /&gt;
*Create a new model '''review_chat.rb''' for ReviewChat.&lt;br /&gt;
&lt;br /&gt;
'''Validation'''- Check if the query box is not empty and restrict the query length to 255 characters.&lt;br /&gt;
&lt;br /&gt;
  validates_length_of :content , :maximum =&amp;gt; 255,message: &amp;quot;Length must be less that 255 characters&amp;quot;&lt;br /&gt;
  validates_presence_of :content, message: &amp;quot;Content cannot be blank&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*Create a new controller '''review_chats_controller.rb''' with the following methods:&lt;br /&gt;
&lt;br /&gt;
'''action_allowed?'''- Allow chat visibility to the reviewers and the authors of a particular interaction&lt;br /&gt;
&lt;br /&gt;
  def action_allowed?&lt;br /&gt;
    review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    allowed_users=Array.new&lt;br /&gt;
    team_id=review_chat.team_id&lt;br /&gt;
    teams_users = TeamsUser.where(team_id: team_id)&lt;br /&gt;
    teams_users.each do |teams_user|&lt;br /&gt;
      allowed_users &amp;lt;&amp;lt; User.find(teams_user.user_id).id&lt;br /&gt;
    end&lt;br /&gt;
    allowed_users &amp;lt;&amp;lt; Participant.find(review_chat.reviewer_id).user_id&lt;br /&gt;
    current_role_name.eql? 'Student' and allowed_users.include?(session[:user].id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''show'''- Show the chat interaction log&lt;br /&gt;
&lt;br /&gt;
  def show&lt;br /&gt;
    @review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    @assignment_id=@review_chat.assignment_id&lt;br /&gt;
    @reviewer_id=@review_chat.reviewer_id&lt;br /&gt;
    @team_id=@review_chat.team_id&lt;br /&gt;
    @chat_log=ReviewChat.where(:reviewer_id =&amp;gt; @reviewer_id).where(:team_id =&amp;gt; @team_id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''submitted_response'''- Create a chat record and send an email to the reviewer when an author replied to a query asked by the reviewer&lt;br /&gt;
&lt;br /&gt;
  def submitted_response&lt;br /&gt;
    @review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    @chat_reviewer=Participant.find(@review_chat.reviewer_id).user_id&lt;br /&gt;
    if(@chat_reviewer==session[:user].id) then&lt;br /&gt;
    	ReviewChat.create(:assignment_id =&amp;gt; @review_chat.assignment_id,:reviewer_id =&amp;gt; @review_chat.reviewer_id, :team_id=&amp;gt;@review_chat.team_id, :type_flag =&amp;gt; 'Q' , :content =&amp;gt; params[:response_area])&lt;br /&gt;
    	ReviewChatsHelper::chat_email_query(params[:id])&lt;br /&gt;
    	flash[:notice]=&amp;quot;Query has been submitted&amp;quot;	&lt;br /&gt;
    else	&lt;br /&gt;
      	ReviewChat.create(:assignment_id =&amp;gt; @review_chat.assignment_id,:reviewer_id =&amp;gt; @review_chat.reviewer_id, :team_id=&amp;gt;@review_chat.team_id, :type_flag =&amp;gt; 'A' , :content =&amp;gt; params[:response_area])&lt;br /&gt;
      	ReviewChatsHelper::chat_email_response(@review_chat.id,@chat_reviewer)&lt;br /&gt;
      flash[:notice]=&amp;quot;Response has been submitted&amp;quot;&lt;br /&gt;
    end	&lt;br /&gt;
    redirect_to action: 'show', id: params[:id]&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
*Methods in the helper file '''review_chats_helper.rb'''&lt;br /&gt;
&lt;br /&gt;
'''chat_email_response'''- Send an email to the author of an assignment when a reviewer posts a query&lt;br /&gt;
&lt;br /&gt;
  def self.chat_email_response(id,reviewer_id,partial=&amp;quot;new_chatemail&amp;quot;)&lt;br /&gt;
    defn = Hash.new&lt;br /&gt;
    defn[:body] = Hash.new&lt;br /&gt;
    defn[:body][:partial_name] = partial&lt;br /&gt;
    reviewer_email=User.find(reviewer_id).email&lt;br /&gt;
    defn[:subject] = &amp;quot;Response posted for submission&amp;quot;&lt;br /&gt;
    defn[:body][:type] = &amp;quot; response has been posted for your query .&lt;br /&gt;
    Please open the below URL to view.&lt;br /&gt;
    http://expertiza.ncsu.edu/review_chats/show/#{id}&amp;quot;&lt;br /&gt;
    defn[:to] = reviewer_email&lt;br /&gt;
    Mailer.sync_message(defn).deliver&lt;br /&gt;
  end &lt;br /&gt;
&lt;br /&gt;
'''chat_email_query'''- Send an email to the author of an assignment when a reviewer posts a query&lt;br /&gt;
&lt;br /&gt;
  def self.chat_email_query(id,partial=&amp;quot;new_chatemail&amp;quot;)&lt;br /&gt;
    defn = Hash.new&lt;br /&gt;
    defn[:body] = Hash.new&lt;br /&gt;
    defn[:body][:partial_name] = partial&lt;br /&gt;
    assignment=nil&lt;br /&gt;
    @team_id=ReviewChat.find(id).team_id&lt;br /&gt;
    teams_users = TeamsUser.where(team_id: @team_id)&lt;br /&gt;
    to_mail_list = Array.new&lt;br /&gt;
    teams_users.each do |teams_user|&lt;br /&gt;
    to_mail_list &amp;lt;&amp;lt; User.find(teams_user.user_id).email &lt;br /&gt;
    end&lt;br /&gt;
    defn[:subject] = &amp;quot;Query posted for submission&amp;quot;&lt;br /&gt;
    defn[:body][:type] = &amp;quot; query has been posted for your submission .&lt;br /&gt;
    Please open the below URL to view and respond.&lt;br /&gt;
    http://expertiza.ncsu.edu/review_chats/show/#{id}&amp;quot;&lt;br /&gt;
    defn[:to] = to_mail_list&lt;br /&gt;
    Mailer.sync_message(defn).deliver&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
*Modify existing controller '''response_controller.rb''' and add a new method.&lt;br /&gt;
&lt;br /&gt;
'''submitted_question'''- Create a chat record and send an email to the authors when a reviewer posts a query.&lt;br /&gt;
  def submitted_question&lt;br /&gt;
      @map = ResponseMap.find(params[:id])&lt;br /&gt;
      ReviewChat.create(:assignment_id =&amp;gt; @map.assignment.id,:reviewer_id =&amp;gt; @map.reviewer_id, :team_id=&amp;gt;@map.reviewee_id, :type_flag =&amp;gt; 'Q' , :content =&amp;gt; params[:review_question])&lt;br /&gt;
      flash[:notice]=&amp;quot;Question has been submitted to Author&amp;quot;&lt;br /&gt;
      @interaction_id=ReviewChat.where(:reviewer_id =&amp;gt; @map.reviewer_id).where(:team_id =&amp;gt; @map.reviewee_id)&lt;br /&gt;
      ReviewChatsHelper::chat_email_query(@interaction_id.first.id)&lt;br /&gt;
      redirect_to action: 'new', id: params[:id]&lt;br /&gt;
  end&lt;br /&gt;
*Create a new view '''show.html.erb''' to show the existing chat record and a box to respond and ask a follow up query.&lt;br /&gt;
&lt;br /&gt;
===Flowchart===&lt;br /&gt;
&lt;br /&gt;
[[File: ARSNFlowchart1.png]]&lt;br /&gt;
&lt;br /&gt;
===User Interface testing with screenshots===&lt;br /&gt;
&lt;br /&gt;
* Login to Expertiza with a student account. You can use login id as 'student5700' and password as 'password'.&lt;br /&gt;
* Start reviewing an existing assignment. You would see a small query box at the bottom of the page.&lt;br /&gt;
*The reviewer enters his question in the text area provided and clicks on the &amp;quot;Submit&amp;quot; button.&lt;br /&gt;
[[File: FinalProject1.jpg]]&lt;br /&gt;
*On clicking this button the appropriate method is called in ReviewChats controller which sends an email to all the authors of the topic indicating that a question has been asked about their work. The email contains a link which when clicked on will redirect the author to the appropriate view where he/she can answer the question.&lt;br /&gt;
[[File: FinalProject4.jpg]]&lt;br /&gt;
*On answering the question, the reviewer receives an email indicating that his question has been answered. It also contains a link which redirects the reviewer to the appropriate view where the answer will be displayed.&lt;br /&gt;
*The authorized users will also be able to see a link to open existing chat interaction log.&lt;br /&gt;
[[File: FinalProject3.jpg]]&lt;br /&gt;
*This view also contains the chat history between the author/s and the reviewer for the entire duration of the interaction.&lt;br /&gt;
[[File: FinalProject2.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Suggestions for Future Improvements ==&lt;br /&gt;
&lt;br /&gt;
* This can be extended to a live interactive author-reviewer anonymous chat session inside the Expertiza reviews window.&lt;br /&gt;
* A purging script can be developed which will clear all the interaction records every semester.&lt;br /&gt;
&lt;br /&gt;
==Resources==&lt;br /&gt;
&lt;br /&gt;
* Expertiza Github repository&amp;lt;ref&amp;gt;Expertiza Github repository https://github.com/expertiza/expertiza&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
[https://www.youtube.com/watch?v=8E-hYiJVoZI Demo Video]&lt;/div&gt;</summary>
		<author><name>Sgulati2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100195</id>
		<title>CSC/ECE 517 Fall 2015 E1586 AnonymousChatBetweenAuthorAndReviewer</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100195"/>
		<updated>2015-12-05T01:19:20Z</updated>

		<summary type="html">&lt;p&gt;Sgulati2: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1586 AnonymousChatBetweenAuthorAndReviewer'''&lt;br /&gt;
&lt;br /&gt;
This page provides a brief description of the '''Expertiza''' project. The project is aimed at developing an email based anonymous session between author and a reviewer so that reviewers can ask questions to the authors for any doubts related to the assignments during peer reviewing.&lt;br /&gt;
&lt;br /&gt;
==Project==&lt;br /&gt;
&lt;br /&gt;
=== Introduction to Expertiza ===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a peer review based system which provides an incremental class based learning together with the instructors and the peers. This project has been developed together by faculty and students using [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza handles assignment submissions, team formations, assignment reviews and grades, etc.&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
During reviews, many times reviewers will be having questions about the submitted material and if it's a blocker there is no way that the reviewer can progress further with the review.  As a result, reviewers will end up submitting the empty or incomplete review.&lt;br /&gt;
&lt;br /&gt;
=== Scope ===&lt;br /&gt;
This project is limited to an email based conversation for asking questions and answers. The reviewers would ask questions related to assignment submission doubts to which authors can respond. All this would be taken care as email responses using a link provided in the email. This project does not cater to any live interactive session with spontaneous back-to-back questions and responses.&lt;br /&gt;
&lt;br /&gt;
Following tasks would be incorporated in the project:&lt;br /&gt;
* Provide a ‘TextArea’ input field on review forms, where any reviewer can type in their questions.&lt;br /&gt;
* Create a new button ‘Ask for Quick Help’ on the review forms.&lt;br /&gt;
* An email would be send to the author with the link where he can respond to the questions asked by the reviewers for their submitted work.&lt;br /&gt;
* Reviewers would be notified by an email when authors respond to the the questions.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Discussion of Resolution ===&lt;br /&gt;
&lt;br /&gt;
We will make the following modifications to implement the chat feature:- &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Create a new model which will help to extract, store and validate data in the database table which contains information about the interaction between the author/s and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Edit the view which is used by the response controller to incorporate the text area input field on the review form where the reviewer can ask his/her initial query.&lt;br /&gt;
&lt;br /&gt;
*Create a new controller with methods for authentication for a respective chat log only visible to the author and reviewer of a particular assignment, method to submit a response or a follow up query and show the existing interaction log.&lt;br /&gt;
&lt;br /&gt;
*Create a new helper with the e-mail methods for sending to the author and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Create a new view which will facilitate the author to respond to the queries asked by the reviewer. The reviewer can also use this view to ask any follow up questions.&lt;br /&gt;
&lt;br /&gt;
=== Design Patterns ===&lt;br /&gt;
The implementation team expects that the following design patterns be used in the solution:&lt;br /&gt;
 &lt;br /&gt;
* '''Observer Pattern'''&amp;lt;ref&amp;gt;Observer Design Pattern https://en.wikipedia.org/wiki/Observer_pattern&amp;lt;/ref&amp;gt;: The observer pattern is a software design pattern in which an object, called the subject, maintains a list of its dependents, called observers, and notifies them automatically of any state changes, usually by calling one of their methods. For example, we are notifying the team members whenever the reviewer submits the query.&lt;br /&gt;
&lt;br /&gt;
* '''Iterator Pattern''': In our instance, we need to display the entire chat history of a particular interaction, hence we can use the iterator design pattern to iterate through the previous chat messages.&lt;br /&gt;
&lt;br /&gt;
=== Database Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:Review_chats.png]]&lt;br /&gt;
&lt;br /&gt;
The above figure shows the schema of a new table which will be created in Expertiza to store relevant information about the chat. It contains the following attributes:&lt;br /&gt;
* id: This attribute is auto-generated by rails when we create a table and is auto incremented with each record. It is also the primary key of our table.&lt;br /&gt;
* assignment_id: Stores the ID of the assignment for which the interaction between author and reviewer is taking place.&lt;br /&gt;
* reviewer_id: Stores the ID of the reviewer who asks the questions.&lt;br /&gt;
* team_id: Stores the ID of the team to which the topic belongs.&lt;br /&gt;
* type_flag: Flag which is used to indicate if the particular tuple contains a question or answer. It can take two values, 'Q' for question and 'A' for answer.&lt;br /&gt;
* content: Stores the question asked by the reviewer or the response given by the author/s depending on the value of the type flag.&lt;br /&gt;
&lt;br /&gt;
Records for a particular interaction can be identified by using a combination of assignment_id, reviewer_id and team_id.&lt;br /&gt;
&lt;br /&gt;
=== Use Cases ===&lt;br /&gt;
'''Name:''' Send a question to the author/s about their work.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Reviewer. &amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The reviewer enters his question in the text area which is provided and clicks on the &amp;quot;Ask question&amp;quot; button which is provided as shown in the mock up. On clicking this button an email is sent to the author/s along which a link to answer the question.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''Name:''' Answer the question which has been asked by the reviewer.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Author/s&amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The author/s click on the link received in their email and are redirected to a page where they can answer the question. Once they submit the answer, an email is sent to the reviewer notifying him/her that their question has been answered.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:ARSNUsecase.jpeg]]&lt;br /&gt;
&lt;br /&gt;
=== Proposed Tests ===&lt;br /&gt;
1. For use case 1, test whether all the team members receive email with the question.&amp;lt;br/&amp;gt;&lt;br /&gt;
2. For use case 2, test whether the reviewer receive email with the response.&amp;lt;br/&amp;gt;&lt;br /&gt;
3. Test whether all the previous interactions are displayed as chat history.&amp;lt;br/&amp;gt;&lt;br /&gt;
4. The 'Ask Question' button should not be enabled until some text has been entered in the text area.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
===Code Implementation===&lt;br /&gt;
&lt;br /&gt;
*Create a new model '''review_chat.rb''' for ReviewChat.&lt;br /&gt;
&lt;br /&gt;
'''Validation'''- Check if the query box is not empty and restrict the query length to 255 characters.&lt;br /&gt;
&lt;br /&gt;
  validates_length_of :content , :maximum =&amp;gt; 255,message: &amp;quot;Length must be less that 255 characters&amp;quot;&lt;br /&gt;
  validates_presence_of :content, message: &amp;quot;Content cannot be blank&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*Create a new controller '''review_chats_controller.rb''' with the following methods:&lt;br /&gt;
&lt;br /&gt;
'''action_allowed?'''- Allow chat visibility to the reviewers and the authors of a particular interaction&lt;br /&gt;
&lt;br /&gt;
  def action_allowed?&lt;br /&gt;
    review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    allowed_users=Array.new&lt;br /&gt;
    team_id=review_chat.team_id&lt;br /&gt;
    teams_users = TeamsUser.where(team_id: team_id)&lt;br /&gt;
    teams_users.each do |teams_user|&lt;br /&gt;
      allowed_users &amp;lt;&amp;lt; User.find(teams_user.user_id).id&lt;br /&gt;
    end&lt;br /&gt;
    allowed_users &amp;lt;&amp;lt; Participant.find(review_chat.reviewer_id).user_id&lt;br /&gt;
    current_role_name.eql? 'Student' and allowed_users.include?(session[:user].id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''show'''- Show the chat interaction log&lt;br /&gt;
&lt;br /&gt;
  def show&lt;br /&gt;
    @review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    @assignment_id=@review_chat.assignment_id&lt;br /&gt;
    @reviewer_id=@review_chat.reviewer_id&lt;br /&gt;
    @team_id=@review_chat.team_id&lt;br /&gt;
    @chat_log=ReviewChat.where(:reviewer_id =&amp;gt; @reviewer_id).where(:team_id =&amp;gt; @team_id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''submitted_response'''- Create a chat record and send an email to the reviewer when an author replied to a query asked by the reviewer&lt;br /&gt;
&lt;br /&gt;
  def submitted_response&lt;br /&gt;
    @review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    @chat_reviewer=Participant.find(@review_chat.reviewer_id).user_id&lt;br /&gt;
    if(@chat_reviewer==session[:user].id) then&lt;br /&gt;
    	ReviewChat.create(:assignment_id =&amp;gt; @review_chat.assignment_id,:reviewer_id =&amp;gt; @review_chat.reviewer_id, :team_id=&amp;gt;@review_chat.team_id, :type_flag =&amp;gt; 'Q' , :content =&amp;gt; params[:response_area])&lt;br /&gt;
    	ReviewChatsHelper::chat_email_query(params[:id])&lt;br /&gt;
    	flash[:notice]=&amp;quot;Query has been submitted&amp;quot;	&lt;br /&gt;
    else	&lt;br /&gt;
      	ReviewChat.create(:assignment_id =&amp;gt; @review_chat.assignment_id,:reviewer_id =&amp;gt; @review_chat.reviewer_id, :team_id=&amp;gt;@review_chat.team_id, :type_flag =&amp;gt; 'A' , :content =&amp;gt; params[:response_area])&lt;br /&gt;
      	ReviewChatsHelper::chat_email_response(@review_chat.id,@chat_reviewer)&lt;br /&gt;
      flash[:notice]=&amp;quot;Response has been submitted&amp;quot;&lt;br /&gt;
    end	&lt;br /&gt;
    redirect_to action: 'show', id: params[:id]&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
*Methods in the helper file '''review_chats_helper.rb'''&lt;br /&gt;
&lt;br /&gt;
'''chat_email_response'''- Send an email to the author of an assignment when a reviewer posts a query&lt;br /&gt;
&lt;br /&gt;
  def self.chat_email_response(id,reviewer_id,partial=&amp;quot;new_chatemail&amp;quot;)&lt;br /&gt;
    defn = Hash.new&lt;br /&gt;
    defn[:body] = Hash.new&lt;br /&gt;
    defn[:body][:partial_name] = partial&lt;br /&gt;
    reviewer_email=User.find(reviewer_id).email&lt;br /&gt;
    defn[:subject] = &amp;quot;Response posted for submission&amp;quot;&lt;br /&gt;
    defn[:body][:type] = &amp;quot; response has been posted for your query .&lt;br /&gt;
    Please open the below URL to view.&lt;br /&gt;
    http://expertiza.ncsu.edu/review_chats/show/#{id}&amp;quot;&lt;br /&gt;
    defn[:to] = reviewer_email&lt;br /&gt;
    Mailer.sync_message(defn).deliver&lt;br /&gt;
  end &lt;br /&gt;
&lt;br /&gt;
'''chat_email_query'''- Send an email to the author of an assignment when a reviewer posts a query&lt;br /&gt;
&lt;br /&gt;
  def self.chat_email_query(id,partial=&amp;quot;new_chatemail&amp;quot;)&lt;br /&gt;
    defn = Hash.new&lt;br /&gt;
    defn[:body] = Hash.new&lt;br /&gt;
    defn[:body][:partial_name] = partial&lt;br /&gt;
    assignment=nil&lt;br /&gt;
    @team_id=ReviewChat.find(id).team_id&lt;br /&gt;
    teams_users = TeamsUser.where(team_id: @team_id)&lt;br /&gt;
    to_mail_list = Array.new&lt;br /&gt;
    teams_users.each do |teams_user|&lt;br /&gt;
    to_mail_list &amp;lt;&amp;lt; User.find(teams_user.user_id).email &lt;br /&gt;
    end&lt;br /&gt;
    defn[:subject] = &amp;quot;Query posted for submission&amp;quot;&lt;br /&gt;
    defn[:body][:type] = &amp;quot; query has been posted for your submission .&lt;br /&gt;
    Please open the below URL to view and respond.&lt;br /&gt;
    http://expertiza.ncsu.edu/review_chats/show/#{id}&amp;quot;&lt;br /&gt;
    defn[:to] = to_mail_list&lt;br /&gt;
    Mailer.sync_message(defn).deliver&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
*Modify existing controller '''response_controller.rb''' and add a new method.&lt;br /&gt;
&lt;br /&gt;
'''submitted_question'''- Create a chat record and send an email to the authors when a reviewer posts a query.&lt;br /&gt;
  def submitted_question&lt;br /&gt;
      @map = ResponseMap.find(params[:id])&lt;br /&gt;
      ReviewChat.create(:assignment_id =&amp;gt; @map.assignment.id,:reviewer_id =&amp;gt; @map.reviewer_id, :team_id=&amp;gt;@map.reviewee_id, :type_flag =&amp;gt; 'Q' , :content =&amp;gt; params[:review_question])&lt;br /&gt;
      flash[:notice]=&amp;quot;Question has been submitted to Author&amp;quot;&lt;br /&gt;
      @interaction_id=ReviewChat.where(:reviewer_id =&amp;gt; @map.reviewer_id).where(:team_id =&amp;gt; @map.reviewee_id)&lt;br /&gt;
      ReviewChatsHelper::chat_email_query(@interaction_id.first.id)&lt;br /&gt;
      redirect_to action: 'new', id: params[:id]&lt;br /&gt;
  end&lt;br /&gt;
*Create a new view '''show.html.erb''' to show the existing chat record and a box to respond and ask a follow up query.&lt;br /&gt;
&lt;br /&gt;
===Flowchart===&lt;br /&gt;
&lt;br /&gt;
[[File: ARSNFlowchart1.png]]&lt;br /&gt;
&lt;br /&gt;
===User Interface testing with screenshots===&lt;br /&gt;
&lt;br /&gt;
* Login to Expertiza with a student account. You can use login id as 'student5700' and password as 'password'.&lt;br /&gt;
* Start reviewing an existing assignment. You would see a small query box at the bottom of the page.&lt;br /&gt;
*The reviewer enters his question in the text area provided and clicks on the &amp;quot;Submit&amp;quot; button.&lt;br /&gt;
[[File: FinalProject1.jpg]]&lt;br /&gt;
*On clicking this button the appropriate method is called in ReviewChats controller which sends an email to all the authors of the topic indicating that a question has been asked about their work. The email contains a link which when clicked on will redirect the author to the appropriate view where he/she can answer the question.&lt;br /&gt;
[[File: FinalProject4.jpg]]&lt;br /&gt;
*On answering the question, the reviewer receives an email indicating that his question has been answered. It also contains a link which redirects the reviewer to the appropriate view where the answer will be displayed.&lt;br /&gt;
*The authorized users will also be able to see a link to open existing chat interaction log.&lt;br /&gt;
[[File: FinalProject3.jpg]]&lt;br /&gt;
*This view also contains the chat history between the author/s and the reviewer for the entire duration of the interaction.&lt;br /&gt;
[[File: FinalProject2.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Suggestions for Future Improvements ==&lt;br /&gt;
&lt;br /&gt;
* This can be extended to a live interactive author-reviewer anonymous chat session inside the Expertiza reviews window.&lt;br /&gt;
* A purging script can be developed which will clear all the interaction records every semester.&lt;br /&gt;
&lt;br /&gt;
==Resources==&lt;br /&gt;
&lt;br /&gt;
* Expertiza Github repository&amp;lt;ref&amp;gt;Expertiza Github repository https://github.com/expertiza/expertiza&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
https://www.youtube.com/watch?v=8E-hYiJVoZI&lt;/div&gt;</summary>
		<author><name>Sgulati2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100194</id>
		<title>CSC/ECE 517 Fall 2015 E1586 AnonymousChatBetweenAuthorAndReviewer</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100194"/>
		<updated>2015-12-05T01:19:09Z</updated>

		<summary type="html">&lt;p&gt;Sgulati2: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1586 AnonymousChatBetweenAuthorAndReviewer'''&lt;br /&gt;
&lt;br /&gt;
This page provides a brief description of the '''Expertiza''' project. The project is aimed at developing an email based anonymous session between author and a reviewer so that reviewers can ask questions to the authors for any doubts related to the assignments during peer reviewing.&lt;br /&gt;
&lt;br /&gt;
==Project==&lt;br /&gt;
&lt;br /&gt;
=== Introduction to Expertiza ===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a peer review based system which provides an incremental class based learning together with the instructors and the peers. This project has been developed together by faculty and students using [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza handles assignment submissions, team formations, assignment reviews and grades, etc.&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
During reviews, many times reviewers will be having questions about the submitted material and if it's a blocker there is no way that the reviewer can progress further with the review.  As a result, reviewers will end up submitting the empty or incomplete review.&lt;br /&gt;
&lt;br /&gt;
=== Scope ===&lt;br /&gt;
This project is limited to an email based conversation for asking questions and answers. The reviewers would ask questions related to assignment submission doubts to which authors can respond. All this would be taken care as email responses using a link provided in the email. This project does not cater to any live interactive session with spontaneous back-to-back questions and responses.&lt;br /&gt;
&lt;br /&gt;
Following tasks would be incorporated in the project:&lt;br /&gt;
* Provide a ‘TextArea’ input field on review forms, where any reviewer can type in their questions.&lt;br /&gt;
* Create a new button ‘Ask for Quick Help’ on the review forms.&lt;br /&gt;
* An email would be send to the author with the link where he can respond to the questions asked by the reviewers for their submitted work.&lt;br /&gt;
* Reviewers would be notified by an email when authors respond to the the questions.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Discussion of Resolution ===&lt;br /&gt;
&lt;br /&gt;
We will make the following modifications to implement the chat feature:- &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Create a new model which will help to extract, store and validate data in the database table which contains information about the interaction between the author/s and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Edit the view which is used by the response controller to incorporate the text area input field on the review form where the reviewer can ask his/her initial query.&lt;br /&gt;
&lt;br /&gt;
*Create a new controller with methods for authentication for a respective chat log only visible to the author and reviewer of a particular assignment, method to submit a response or a follow up query and show the existing interaction log.&lt;br /&gt;
&lt;br /&gt;
*Create a new helper with the e-mail methods for sending to the author and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Create a new view which will facilitate the author to respond to the queries asked by the reviewer. The reviewer can also use this view to ask any follow up questions.&lt;br /&gt;
&lt;br /&gt;
=== Design Patterns ===&lt;br /&gt;
The implementation team expects that the following design patterns be used in the solution:&lt;br /&gt;
 &lt;br /&gt;
* '''Observer Pattern'''&amp;lt;ref&amp;gt;Observer Design Pattern https://en.wikipedia.org/wiki/Observer_pattern&amp;lt;/ref&amp;gt;: The observer pattern is a software design pattern in which an object, called the subject, maintains a list of its dependents, called observers, and notifies them automatically of any state changes, usually by calling one of their methods. For example, we are notifying the team members whenever the reviewer submits the query.&lt;br /&gt;
&lt;br /&gt;
* '''Iterator Pattern''': In our instance, we need to display the entire chat history of a particular interaction, hence we can use the iterator design pattern to iterate through the previous chat messages.&lt;br /&gt;
&lt;br /&gt;
=== Database Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:Review_chats.png]]&lt;br /&gt;
&lt;br /&gt;
The above figure shows the schema of a new table which will be created in Expertiza to store relevant information about the chat. It contains the following attributes:&lt;br /&gt;
* id: This attribute is auto-generated by rails when we create a table and is auto incremented with each record. It is also the primary key of our table.&lt;br /&gt;
* assignment_id: Stores the ID of the assignment for which the interaction between author and reviewer is taking place.&lt;br /&gt;
* reviewer_id: Stores the ID of the reviewer who asks the questions.&lt;br /&gt;
* team_id: Stores the ID of the team to which the topic belongs.&lt;br /&gt;
* type_flag: Flag which is used to indicate if the particular tuple contains a question or answer. It can take two values, 'Q' for question and 'A' for answer.&lt;br /&gt;
* content: Stores the question asked by the reviewer or the response given by the author/s depending on the value of the type flag.&lt;br /&gt;
&lt;br /&gt;
Records for a particular interaction can be identified by using a combination of assignment_id, reviewer_id and team_id.&lt;br /&gt;
&lt;br /&gt;
=== Use Cases ===&lt;br /&gt;
'''Name:''' Send a question to the author/s about their work.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Reviewer. &amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The reviewer enters his question in the text area which is provided and clicks on the &amp;quot;Ask question&amp;quot; button which is provided as shown in the mock up. On clicking this button an email is sent to the author/s along which a link to answer the question.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''Name:''' Answer the question which has been asked by the reviewer.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Author/s&amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The author/s click on the link received in their email and are redirected to a page where they can answer the question. Once they submit the answer, an email is sent to the reviewer notifying him/her that their question has been answered.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:ARSNUsecase.jpeg]]&lt;br /&gt;
&lt;br /&gt;
=== Proposed Tests ===&lt;br /&gt;
1. For use case 1, test whether all the team members receive email with the question.&amp;lt;br/&amp;gt;&lt;br /&gt;
2. For use case 2, test whether the reviewer receive email with the response.&amp;lt;br/&amp;gt;&lt;br /&gt;
3. Test whether all the previous interactions are displayed as chat history.&amp;lt;br/&amp;gt;&lt;br /&gt;
4. The 'Ask Question' button should not be enabled until some text has been entered in the text area.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
===Code Implementation===&lt;br /&gt;
&lt;br /&gt;
*Create a new model '''review_chat.rb''' for ReviewChat.&lt;br /&gt;
&lt;br /&gt;
'''Validation'''- Check if the query box is not empty and restrict the query length to 255 characters.&lt;br /&gt;
&lt;br /&gt;
  validates_length_of :content , :maximum =&amp;gt; 255,message: &amp;quot;Length must be less that 255 characters&amp;quot;&lt;br /&gt;
  validates_presence_of :content, message: &amp;quot;Content cannot be blank&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*Create a new controller '''review_chats_controller.rb''' with the following methods:&lt;br /&gt;
&lt;br /&gt;
'''action_allowed?'''- Allow chat visibility to the reviewers and the authors of a particular interaction&lt;br /&gt;
&lt;br /&gt;
  def action_allowed?&lt;br /&gt;
    review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    allowed_users=Array.new&lt;br /&gt;
    team_id=review_chat.team_id&lt;br /&gt;
    teams_users = TeamsUser.where(team_id: team_id)&lt;br /&gt;
    teams_users.each do |teams_user|&lt;br /&gt;
      allowed_users &amp;lt;&amp;lt; User.find(teams_user.user_id).id&lt;br /&gt;
    end&lt;br /&gt;
    allowed_users &amp;lt;&amp;lt; Participant.find(review_chat.reviewer_id).user_id&lt;br /&gt;
    current_role_name.eql? 'Student' and allowed_users.include?(session[:user].id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''show'''- Show the chat interaction log&lt;br /&gt;
&lt;br /&gt;
  def show&lt;br /&gt;
    @review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    @assignment_id=@review_chat.assignment_id&lt;br /&gt;
    @reviewer_id=@review_chat.reviewer_id&lt;br /&gt;
    @team_id=@review_chat.team_id&lt;br /&gt;
    @chat_log=ReviewChat.where(:reviewer_id =&amp;gt; @reviewer_id).where(:team_id =&amp;gt; @team_id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''submitted_response'''- Create a chat record and send an email to the reviewer when an author replied to a query asked by the reviewer&lt;br /&gt;
&lt;br /&gt;
  def submitted_response&lt;br /&gt;
    @review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    @chat_reviewer=Participant.find(@review_chat.reviewer_id).user_id&lt;br /&gt;
    if(@chat_reviewer==session[:user].id) then&lt;br /&gt;
    	ReviewChat.create(:assignment_id =&amp;gt; @review_chat.assignment_id,:reviewer_id =&amp;gt; @review_chat.reviewer_id, :team_id=&amp;gt;@review_chat.team_id, :type_flag =&amp;gt; 'Q' , :content =&amp;gt; params[:response_area])&lt;br /&gt;
    	ReviewChatsHelper::chat_email_query(params[:id])&lt;br /&gt;
    	flash[:notice]=&amp;quot;Query has been submitted&amp;quot;	&lt;br /&gt;
    else	&lt;br /&gt;
      	ReviewChat.create(:assignment_id =&amp;gt; @review_chat.assignment_id,:reviewer_id =&amp;gt; @review_chat.reviewer_id, :team_id=&amp;gt;@review_chat.team_id, :type_flag =&amp;gt; 'A' , :content =&amp;gt; params[:response_area])&lt;br /&gt;
      	ReviewChatsHelper::chat_email_response(@review_chat.id,@chat_reviewer)&lt;br /&gt;
      flash[:notice]=&amp;quot;Response has been submitted&amp;quot;&lt;br /&gt;
    end	&lt;br /&gt;
    redirect_to action: 'show', id: params[:id]&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
*Methods in the helper file '''review_chats_helper.rb'''&lt;br /&gt;
&lt;br /&gt;
'''chat_email_response'''- Send an email to the author of an assignment when a reviewer posts a query&lt;br /&gt;
&lt;br /&gt;
  def self.chat_email_response(id,reviewer_id,partial=&amp;quot;new_chatemail&amp;quot;)&lt;br /&gt;
    defn = Hash.new&lt;br /&gt;
    defn[:body] = Hash.new&lt;br /&gt;
    defn[:body][:partial_name] = partial&lt;br /&gt;
    reviewer_email=User.find(reviewer_id).email&lt;br /&gt;
    defn[:subject] = &amp;quot;Response posted for submission&amp;quot;&lt;br /&gt;
    defn[:body][:type] = &amp;quot; response has been posted for your query .&lt;br /&gt;
    Please open the below URL to view.&lt;br /&gt;
    http://expertiza.ncsu.edu/review_chats/show/#{id}&amp;quot;&lt;br /&gt;
    defn[:to] = reviewer_email&lt;br /&gt;
    Mailer.sync_message(defn).deliver&lt;br /&gt;
  end &lt;br /&gt;
&lt;br /&gt;
'''chat_email_query'''- Send an email to the author of an assignment when a reviewer posts a query&lt;br /&gt;
&lt;br /&gt;
  def self.chat_email_query(id,partial=&amp;quot;new_chatemail&amp;quot;)&lt;br /&gt;
    defn = Hash.new&lt;br /&gt;
    defn[:body] = Hash.new&lt;br /&gt;
    defn[:body][:partial_name] = partial&lt;br /&gt;
    assignment=nil&lt;br /&gt;
    @team_id=ReviewChat.find(id).team_id&lt;br /&gt;
    teams_users = TeamsUser.where(team_id: @team_id)&lt;br /&gt;
    to_mail_list = Array.new&lt;br /&gt;
    teams_users.each do |teams_user|&lt;br /&gt;
    to_mail_list &amp;lt;&amp;lt; User.find(teams_user.user_id).email &lt;br /&gt;
    end&lt;br /&gt;
    defn[:subject] = &amp;quot;Query posted for submission&amp;quot;&lt;br /&gt;
    defn[:body][:type] = &amp;quot; query has been posted for your submission .&lt;br /&gt;
    Please open the below URL to view and respond.&lt;br /&gt;
    http://expertiza.ncsu.edu/review_chats/show/#{id}&amp;quot;&lt;br /&gt;
    defn[:to] = to_mail_list&lt;br /&gt;
    Mailer.sync_message(defn).deliver&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
*Modify existing controller '''response_controller.rb''' and add a new method.&lt;br /&gt;
&lt;br /&gt;
'''submitted_question'''- Create a chat record and send an email to the authors when a reviewer posts a query.&lt;br /&gt;
  def submitted_question&lt;br /&gt;
      @map = ResponseMap.find(params[:id])&lt;br /&gt;
      ReviewChat.create(:assignment_id =&amp;gt; @map.assignment.id,:reviewer_id =&amp;gt; @map.reviewer_id, :team_id=&amp;gt;@map.reviewee_id, :type_flag =&amp;gt; 'Q' , :content =&amp;gt; params[:review_question])&lt;br /&gt;
      flash[:notice]=&amp;quot;Question has been submitted to Author&amp;quot;&lt;br /&gt;
      @interaction_id=ReviewChat.where(:reviewer_id =&amp;gt; @map.reviewer_id).where(:team_id =&amp;gt; @map.reviewee_id)&lt;br /&gt;
      ReviewChatsHelper::chat_email_query(@interaction_id.first.id)&lt;br /&gt;
      redirect_to action: 'new', id: params[:id]&lt;br /&gt;
  end&lt;br /&gt;
*Create a new view '''show.html.erb''' to show the existing chat record and a box to respond and ask a follow up query.&lt;br /&gt;
&lt;br /&gt;
===Flowchart===&lt;br /&gt;
&lt;br /&gt;
[[File: ARSNFlowchart1.png]]&lt;br /&gt;
&lt;br /&gt;
===User Interface testing with screenshots===&lt;br /&gt;
&lt;br /&gt;
* Login to Expertiza with a student account. You can use login id as 'student5700' and password as 'password'.&lt;br /&gt;
* Start reviewing an existing assignment. You would see a small query box at the bottom of the page.&lt;br /&gt;
*The reviewer enters his question in the text area provided and clicks on the &amp;quot;Submit&amp;quot; button.&lt;br /&gt;
[[File: FinalProject1.jpg]]&lt;br /&gt;
*On clicking this button the appropriate method is called in ReviewChats controller which sends an email to all the authors of the topic indicating that a question has been asked about their work. The email contains a link which when clicked on will redirect the author to the appropriate view where he/she can answer the question.&lt;br /&gt;
[[File: FinalProject4.jpg]]&lt;br /&gt;
*On answering the question, the reviewer receives an email indicating that his question has been answered. It also contains a link which redirects the reviewer to the appropriate view where the answer will be displayed.&lt;br /&gt;
*The authorized users will also be able to see a link to open existing chat interaction log.&lt;br /&gt;
[[File: FinalProject3.jpg]]&lt;br /&gt;
*This view also contains the chat history between the author/s and the reviewer for the entire duration of the interaction.&lt;br /&gt;
[[File: FinalProject2.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Suggestions for Future Improvements ==&lt;br /&gt;
&lt;br /&gt;
* This can be extended to a live interactive author-reviewer anonymous chat session inside the Expertiza reviews window.&lt;br /&gt;
* A purging script can be developed which will clear all the interaction records every semester.&lt;br /&gt;
&lt;br /&gt;
==Resources==&lt;br /&gt;
&lt;br /&gt;
* Expertiza Github repository&amp;lt;ref&amp;gt;Expertiza Github repository https://github.com/expertiza/expertiza&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
&amp;lt;ref&amp;gt; https://www.youtube.com/watch?v=8E-hYiJVoZI &amp;lt;/ref&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sgulati2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100191</id>
		<title>CSC/ECE 517 Fall 2015 E1586 AnonymousChatBetweenAuthorAndReviewer</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100191"/>
		<updated>2015-12-05T01:18:14Z</updated>

		<summary type="html">&lt;p&gt;Sgulati2: /* Screenshots */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1586 AnonymousChatBetweenAuthorAndReviewer'''&lt;br /&gt;
&lt;br /&gt;
This page provides a brief description of the '''Expertiza''' project. The project is aimed at developing an email based anonymous session between author and a reviewer so that reviewers can ask questions to the authors for any doubts related to the assignments during peer reviewing.&lt;br /&gt;
&lt;br /&gt;
==Project==&lt;br /&gt;
&lt;br /&gt;
=== Introduction to Expertiza ===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a peer review based system which provides an incremental class based learning together with the instructors and the peers. This project has been developed together by faculty and students using [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza handles assignment submissions, team formations, assignment reviews and grades, etc.&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
During reviews, many times reviewers will be having questions about the submitted material and if it's a blocker there is no way that the reviewer can progress further with the review.  As a result, reviewers will end up submitting the empty or incomplete review.&lt;br /&gt;
&lt;br /&gt;
=== Scope ===&lt;br /&gt;
This project is limited to an email based conversation for asking questions and answers. The reviewers would ask questions related to assignment submission doubts to which authors can respond. All this would be taken care as email responses using a link provided in the email. This project does not cater to any live interactive session with spontaneous back-to-back questions and responses.&lt;br /&gt;
&lt;br /&gt;
Following tasks would be incorporated in the project:&lt;br /&gt;
* Provide a ‘TextArea’ input field on review forms, where any reviewer can type in their questions.&lt;br /&gt;
* Create a new button ‘Ask for Quick Help’ on the review forms.&lt;br /&gt;
* An email would be send to the author with the link where he can respond to the questions asked by the reviewers for their submitted work.&lt;br /&gt;
* Reviewers would be notified by an email when authors respond to the the questions.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Discussion of Resolution ===&lt;br /&gt;
&lt;br /&gt;
We will make the following modifications to implement the chat feature:- &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Create a new model which will help to extract, store and validate data in the database table which contains information about the interaction between the author/s and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Edit the view which is used by the response controller to incorporate the text area input field on the review form where the reviewer can ask his/her initial query.&lt;br /&gt;
&lt;br /&gt;
*Create a new controller with methods for authentication for a respective chat log only visible to the author and reviewer of a particular assignment, method to submit a response or a follow up query and show the existing interaction log.&lt;br /&gt;
&lt;br /&gt;
*Create a new helper with the e-mail methods for sending to the author and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Create a new view which will facilitate the author to respond to the queries asked by the reviewer. The reviewer can also use this view to ask any follow up questions.&lt;br /&gt;
&lt;br /&gt;
=== Design Patterns ===&lt;br /&gt;
The implementation team expects that the following design patterns be used in the solution:&lt;br /&gt;
 &lt;br /&gt;
* '''Observer Pattern'''&amp;lt;ref&amp;gt;Observer Design Pattern https://en.wikipedia.org/wiki/Observer_pattern&amp;lt;/ref&amp;gt;: The observer pattern is a software design pattern in which an object, called the subject, maintains a list of its dependents, called observers, and notifies them automatically of any state changes, usually by calling one of their methods. For example, we are notifying the team members whenever the reviewer submits the query.&lt;br /&gt;
&lt;br /&gt;
* '''Iterator Pattern''': In our instance, we need to display the entire chat history of a particular interaction, hence we can use the iterator design pattern to iterate through the previous chat messages.&lt;br /&gt;
&lt;br /&gt;
=== Database Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:Review_chats.png]]&lt;br /&gt;
&lt;br /&gt;
The above figure shows the schema of a new table which will be created in Expertiza to store relevant information about the chat. It contains the following attributes:&lt;br /&gt;
* id: This attribute is auto-generated by rails when we create a table and is auto incremented with each record. It is also the primary key of our table.&lt;br /&gt;
* assignment_id: Stores the ID of the assignment for which the interaction between author and reviewer is taking place.&lt;br /&gt;
* reviewer_id: Stores the ID of the reviewer who asks the questions.&lt;br /&gt;
* team_id: Stores the ID of the team to which the topic belongs.&lt;br /&gt;
* type_flag: Flag which is used to indicate if the particular tuple contains a question or answer. It can take two values, 'Q' for question and 'A' for answer.&lt;br /&gt;
* content: Stores the question asked by the reviewer or the response given by the author/s depending on the value of the type flag.&lt;br /&gt;
&lt;br /&gt;
Records for a particular interaction can be identified by using a combination of assignment_id, reviewer_id and team_id.&lt;br /&gt;
&lt;br /&gt;
=== Use Cases ===&lt;br /&gt;
'''Name:''' Send a question to the author/s about their work.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Reviewer. &amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The reviewer enters his question in the text area which is provided and clicks on the &amp;quot;Ask question&amp;quot; button which is provided as shown in the mock up. On clicking this button an email is sent to the author/s along which a link to answer the question.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''Name:''' Answer the question which has been asked by the reviewer.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Author/s&amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The author/s click on the link received in their email and are redirected to a page where they can answer the question. Once they submit the answer, an email is sent to the reviewer notifying him/her that their question has been answered.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:ARSNUsecase.jpeg]]&lt;br /&gt;
&lt;br /&gt;
=== Proposed Tests ===&lt;br /&gt;
1. For use case 1, test whether all the team members receive email with the question.&amp;lt;br/&amp;gt;&lt;br /&gt;
2. For use case 2, test whether the reviewer receive email with the response.&amp;lt;br/&amp;gt;&lt;br /&gt;
3. Test whether all the previous interactions are displayed as chat history.&amp;lt;br/&amp;gt;&lt;br /&gt;
4. The 'Ask Question' button should not be enabled until some text has been entered in the text area.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
===Code Implementation===&lt;br /&gt;
&lt;br /&gt;
*Create a new model '''review_chat.rb''' for ReviewChat.&lt;br /&gt;
&lt;br /&gt;
'''Validation'''- Check if the query box is not empty and restrict the query length to 255 characters.&lt;br /&gt;
&lt;br /&gt;
  validates_length_of :content , :maximum =&amp;gt; 255,message: &amp;quot;Length must be less that 255 characters&amp;quot;&lt;br /&gt;
  validates_presence_of :content, message: &amp;quot;Content cannot be blank&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*Create a new controller '''review_chats_controller.rb''' with the following methods:&lt;br /&gt;
&lt;br /&gt;
'''action_allowed?'''- Allow chat visibility to the reviewers and the authors of a particular interaction&lt;br /&gt;
&lt;br /&gt;
  def action_allowed?&lt;br /&gt;
    review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    allowed_users=Array.new&lt;br /&gt;
    team_id=review_chat.team_id&lt;br /&gt;
    teams_users = TeamsUser.where(team_id: team_id)&lt;br /&gt;
    teams_users.each do |teams_user|&lt;br /&gt;
      allowed_users &amp;lt;&amp;lt; User.find(teams_user.user_id).id&lt;br /&gt;
    end&lt;br /&gt;
    allowed_users &amp;lt;&amp;lt; Participant.find(review_chat.reviewer_id).user_id&lt;br /&gt;
    current_role_name.eql? 'Student' and allowed_users.include?(session[:user].id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''show'''- Show the chat interaction log&lt;br /&gt;
&lt;br /&gt;
  def show&lt;br /&gt;
    @review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    @assignment_id=@review_chat.assignment_id&lt;br /&gt;
    @reviewer_id=@review_chat.reviewer_id&lt;br /&gt;
    @team_id=@review_chat.team_id&lt;br /&gt;
    @chat_log=ReviewChat.where(:reviewer_id =&amp;gt; @reviewer_id).where(:team_id =&amp;gt; @team_id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''submitted_response'''- Create a chat record and send an email to the reviewer when an author replied to a query asked by the reviewer&lt;br /&gt;
&lt;br /&gt;
  def submitted_response&lt;br /&gt;
    @review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    @chat_reviewer=Participant.find(@review_chat.reviewer_id).user_id&lt;br /&gt;
    if(@chat_reviewer==session[:user].id) then&lt;br /&gt;
    	ReviewChat.create(:assignment_id =&amp;gt; @review_chat.assignment_id,:reviewer_id =&amp;gt; @review_chat.reviewer_id, :team_id=&amp;gt;@review_chat.team_id, :type_flag =&amp;gt; 'Q' , :content =&amp;gt; params[:response_area])&lt;br /&gt;
    	ReviewChatsHelper::chat_email_query(params[:id])&lt;br /&gt;
    	flash[:notice]=&amp;quot;Query has been submitted&amp;quot;	&lt;br /&gt;
    else	&lt;br /&gt;
      	ReviewChat.create(:assignment_id =&amp;gt; @review_chat.assignment_id,:reviewer_id =&amp;gt; @review_chat.reviewer_id, :team_id=&amp;gt;@review_chat.team_id, :type_flag =&amp;gt; 'A' , :content =&amp;gt; params[:response_area])&lt;br /&gt;
      	ReviewChatsHelper::chat_email_response(@review_chat.id,@chat_reviewer)&lt;br /&gt;
      flash[:notice]=&amp;quot;Response has been submitted&amp;quot;&lt;br /&gt;
    end	&lt;br /&gt;
    redirect_to action: 'show', id: params[:id]&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
*Methods in the helper file '''review_chats_helper.rb'''&lt;br /&gt;
&lt;br /&gt;
'''chat_email_response'''- Send an email to the author of an assignment when a reviewer posts a query&lt;br /&gt;
&lt;br /&gt;
  def self.chat_email_response(id,reviewer_id,partial=&amp;quot;new_chatemail&amp;quot;)&lt;br /&gt;
    defn = Hash.new&lt;br /&gt;
    defn[:body] = Hash.new&lt;br /&gt;
    defn[:body][:partial_name] = partial&lt;br /&gt;
    reviewer_email=User.find(reviewer_id).email&lt;br /&gt;
    defn[:subject] = &amp;quot;Response posted for submission&amp;quot;&lt;br /&gt;
    defn[:body][:type] = &amp;quot; response has been posted for your query .&lt;br /&gt;
    Please open the below URL to view.&lt;br /&gt;
    http://expertiza.ncsu.edu/review_chats/show/#{id}&amp;quot;&lt;br /&gt;
    defn[:to] = reviewer_email&lt;br /&gt;
    Mailer.sync_message(defn).deliver&lt;br /&gt;
  end &lt;br /&gt;
&lt;br /&gt;
'''chat_email_query'''- Send an email to the author of an assignment when a reviewer posts a query&lt;br /&gt;
&lt;br /&gt;
  def self.chat_email_query(id,partial=&amp;quot;new_chatemail&amp;quot;)&lt;br /&gt;
    defn = Hash.new&lt;br /&gt;
    defn[:body] = Hash.new&lt;br /&gt;
    defn[:body][:partial_name] = partial&lt;br /&gt;
    assignment=nil&lt;br /&gt;
    @team_id=ReviewChat.find(id).team_id&lt;br /&gt;
    teams_users = TeamsUser.where(team_id: @team_id)&lt;br /&gt;
    to_mail_list = Array.new&lt;br /&gt;
    teams_users.each do |teams_user|&lt;br /&gt;
    to_mail_list &amp;lt;&amp;lt; User.find(teams_user.user_id).email &lt;br /&gt;
    end&lt;br /&gt;
    defn[:subject] = &amp;quot;Query posted for submission&amp;quot;&lt;br /&gt;
    defn[:body][:type] = &amp;quot; query has been posted for your submission .&lt;br /&gt;
    Please open the below URL to view and respond.&lt;br /&gt;
    http://expertiza.ncsu.edu/review_chats/show/#{id}&amp;quot;&lt;br /&gt;
    defn[:to] = to_mail_list&lt;br /&gt;
    Mailer.sync_message(defn).deliver&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
*Modify existing controller '''response_controller.rb''' and add a new method.&lt;br /&gt;
&lt;br /&gt;
'''submitted_question'''- Create a chat record and send an email to the authors when a reviewer posts a query.&lt;br /&gt;
  def submitted_question&lt;br /&gt;
      @map = ResponseMap.find(params[:id])&lt;br /&gt;
      ReviewChat.create(:assignment_id =&amp;gt; @map.assignment.id,:reviewer_id =&amp;gt; @map.reviewer_id, :team_id=&amp;gt;@map.reviewee_id, :type_flag =&amp;gt; 'Q' , :content =&amp;gt; params[:review_question])&lt;br /&gt;
      flash[:notice]=&amp;quot;Question has been submitted to Author&amp;quot;&lt;br /&gt;
      @interaction_id=ReviewChat.where(:reviewer_id =&amp;gt; @map.reviewer_id).where(:team_id =&amp;gt; @map.reviewee_id)&lt;br /&gt;
      ReviewChatsHelper::chat_email_query(@interaction_id.first.id)&lt;br /&gt;
      redirect_to action: 'new', id: params[:id]&lt;br /&gt;
  end&lt;br /&gt;
*Create a new view '''show.html.erb''' to show the existing chat record and a box to respond and ask a follow up query.&lt;br /&gt;
&lt;br /&gt;
===Flowchart===&lt;br /&gt;
&lt;br /&gt;
[[File: ARSNFlowchart1.png]]&lt;br /&gt;
&lt;br /&gt;
===User Interface testing with screenshots===&lt;br /&gt;
&lt;br /&gt;
* Login to Expertiza with a student account. You can use login id as 'student5700' and password as 'password'.&lt;br /&gt;
* Start reviewing an existing assignment. You would see a small query box at the bottom of the page.&lt;br /&gt;
*The reviewer enters his question in the text area provided and clicks on the &amp;quot;Submit&amp;quot; button.&lt;br /&gt;
[[File: FinalProject1.jpg]]&lt;br /&gt;
*On clicking this button the appropriate method is called in ReviewChats controller which sends an email to all the authors of the topic indicating that a question has been asked about their work. The email contains a link which when clicked on will redirect the author to the appropriate view where he/she can answer the question.&lt;br /&gt;
[[File: FinalProject4.jpg]]&lt;br /&gt;
*On answering the question, the reviewer receives an email indicating that his question has been answered. It also contains a link which redirects the reviewer to the appropriate view where the answer will be displayed.&lt;br /&gt;
*The authorized users will also be able to see a link to open existing chat interaction log.&lt;br /&gt;
[[File: FinalProject3.jpg]]&lt;br /&gt;
*This view also contains the chat history between the author/s and the reviewer for the entire duration of the interaction.&lt;br /&gt;
[[File: FinalProject2.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Suggestions for Future Improvements ==&lt;br /&gt;
&lt;br /&gt;
* This can be extended to a live interactive author-reviewer anonymous chat session inside the Expertiza reviews window.&lt;br /&gt;
* A purging script can be developed which will clear all the interaction records every semester.&lt;br /&gt;
&lt;br /&gt;
==Resources==&lt;br /&gt;
&lt;br /&gt;
* Expertiza Github repository&amp;lt;ref&amp;gt;Expertiza Github repository https://github.com/expertiza/expertiza&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sgulati2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100189</id>
		<title>CSC/ECE 517 Fall 2015 E1586 AnonymousChatBetweenAuthorAndReviewer</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100189"/>
		<updated>2015-12-05T01:16:28Z</updated>

		<summary type="html">&lt;p&gt;Sgulati2: /* Code Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1586 AnonymousChatBetweenAuthorAndReviewer'''&lt;br /&gt;
&lt;br /&gt;
This page provides a brief description of the '''Expertiza''' project. The project is aimed at developing an email based anonymous session between author and a reviewer so that reviewers can ask questions to the authors for any doubts related to the assignments during peer reviewing.&lt;br /&gt;
&lt;br /&gt;
==Project==&lt;br /&gt;
&lt;br /&gt;
=== Introduction to Expertiza ===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a peer review based system which provides an incremental class based learning together with the instructors and the peers. This project has been developed together by faculty and students using [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza handles assignment submissions, team formations, assignment reviews and grades, etc.&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
During reviews, many times reviewers will be having questions about the submitted material and if it's a blocker there is no way that the reviewer can progress further with the review.  As a result, reviewers will end up submitting the empty or incomplete review.&lt;br /&gt;
&lt;br /&gt;
=== Scope ===&lt;br /&gt;
This project is limited to an email based conversation for asking questions and answers. The reviewers would ask questions related to assignment submission doubts to which authors can respond. All this would be taken care as email responses using a link provided in the email. This project does not cater to any live interactive session with spontaneous back-to-back questions and responses.&lt;br /&gt;
&lt;br /&gt;
Following tasks would be incorporated in the project:&lt;br /&gt;
* Provide a ‘TextArea’ input field on review forms, where any reviewer can type in their questions.&lt;br /&gt;
* Create a new button ‘Ask for Quick Help’ on the review forms.&lt;br /&gt;
* An email would be send to the author with the link where he can respond to the questions asked by the reviewers for their submitted work.&lt;br /&gt;
* Reviewers would be notified by an email when authors respond to the the questions.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Discussion of Resolution ===&lt;br /&gt;
&lt;br /&gt;
We will make the following modifications to implement the chat feature:- &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Create a new model which will help to extract, store and validate data in the database table which contains information about the interaction between the author/s and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Edit the view which is used by the response controller to incorporate the text area input field on the review form where the reviewer can ask his/her initial query.&lt;br /&gt;
&lt;br /&gt;
*Create a new controller with methods for authentication for a respective chat log only visible to the author and reviewer of a particular assignment, method to submit a response or a follow up query and show the existing interaction log.&lt;br /&gt;
&lt;br /&gt;
*Create a new helper with the e-mail methods for sending to the author and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Create a new view which will facilitate the author to respond to the queries asked by the reviewer. The reviewer can also use this view to ask any follow up questions.&lt;br /&gt;
&lt;br /&gt;
=== Design Patterns ===&lt;br /&gt;
The implementation team expects that the following design patterns be used in the solution:&lt;br /&gt;
 &lt;br /&gt;
* '''Observer Pattern'''&amp;lt;ref&amp;gt;Observer Design Pattern https://en.wikipedia.org/wiki/Observer_pattern&amp;lt;/ref&amp;gt;: The observer pattern is a software design pattern in which an object, called the subject, maintains a list of its dependents, called observers, and notifies them automatically of any state changes, usually by calling one of their methods. For example, we are notifying the team members whenever the reviewer submits the query.&lt;br /&gt;
&lt;br /&gt;
* '''Iterator Pattern''': In our instance, we need to display the entire chat history of a particular interaction, hence we can use the iterator design pattern to iterate through the previous chat messages.&lt;br /&gt;
&lt;br /&gt;
=== Database Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:Review_chats.png]]&lt;br /&gt;
&lt;br /&gt;
The above figure shows the schema of a new table which will be created in Expertiza to store relevant information about the chat. It contains the following attributes:&lt;br /&gt;
* id: This attribute is auto-generated by rails when we create a table and is auto incremented with each record. It is also the primary key of our table.&lt;br /&gt;
* assignment_id: Stores the ID of the assignment for which the interaction between author and reviewer is taking place.&lt;br /&gt;
* reviewer_id: Stores the ID of the reviewer who asks the questions.&lt;br /&gt;
* team_id: Stores the ID of the team to which the topic belongs.&lt;br /&gt;
* type_flag: Flag which is used to indicate if the particular tuple contains a question or answer. It can take two values, 'Q' for question and 'A' for answer.&lt;br /&gt;
* content: Stores the question asked by the reviewer or the response given by the author/s depending on the value of the type flag.&lt;br /&gt;
&lt;br /&gt;
Records for a particular interaction can be identified by using a combination of assignment_id, reviewer_id and team_id.&lt;br /&gt;
&lt;br /&gt;
=== Use Cases ===&lt;br /&gt;
'''Name:''' Send a question to the author/s about their work.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Reviewer. &amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The reviewer enters his question in the text area which is provided and clicks on the &amp;quot;Ask question&amp;quot; button which is provided as shown in the mock up. On clicking this button an email is sent to the author/s along which a link to answer the question.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''Name:''' Answer the question which has been asked by the reviewer.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Author/s&amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The author/s click on the link received in their email and are redirected to a page where they can answer the question. Once they submit the answer, an email is sent to the reviewer notifying him/her that their question has been answered.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:ARSNUsecase.jpeg]]&lt;br /&gt;
&lt;br /&gt;
=== Proposed Tests ===&lt;br /&gt;
1. For use case 1, test whether all the team members receive email with the question.&amp;lt;br/&amp;gt;&lt;br /&gt;
2. For use case 2, test whether the reviewer receive email with the response.&amp;lt;br/&amp;gt;&lt;br /&gt;
3. Test whether all the previous interactions are displayed as chat history.&amp;lt;br/&amp;gt;&lt;br /&gt;
4. The 'Ask Question' button should not be enabled until some text has been entered in the text area.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
===Code Implementation===&lt;br /&gt;
&lt;br /&gt;
*Create a new model '''review_chat.rb''' for ReviewChat.&lt;br /&gt;
&lt;br /&gt;
'''Validation'''- Check if the query box is not empty and restrict the query length to 255 characters.&lt;br /&gt;
&lt;br /&gt;
  validates_length_of :content , :maximum =&amp;gt; 255,message: &amp;quot;Length must be less that 255 characters&amp;quot;&lt;br /&gt;
  validates_presence_of :content, message: &amp;quot;Content cannot be blank&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*Create a new controller '''review_chats_controller.rb''' with the following methods:&lt;br /&gt;
&lt;br /&gt;
'''action_allowed?'''- Allow chat visibility to the reviewers and the authors of a particular interaction&lt;br /&gt;
&lt;br /&gt;
  def action_allowed?&lt;br /&gt;
    review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    allowed_users=Array.new&lt;br /&gt;
    team_id=review_chat.team_id&lt;br /&gt;
    teams_users = TeamsUser.where(team_id: team_id)&lt;br /&gt;
    teams_users.each do |teams_user|&lt;br /&gt;
      allowed_users &amp;lt;&amp;lt; User.find(teams_user.user_id).id&lt;br /&gt;
    end&lt;br /&gt;
    allowed_users &amp;lt;&amp;lt; Participant.find(review_chat.reviewer_id).user_id&lt;br /&gt;
    current_role_name.eql? 'Student' and allowed_users.include?(session[:user].id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''show'''- Show the chat interaction log&lt;br /&gt;
&lt;br /&gt;
  def show&lt;br /&gt;
    @review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    @assignment_id=@review_chat.assignment_id&lt;br /&gt;
    @reviewer_id=@review_chat.reviewer_id&lt;br /&gt;
    @team_id=@review_chat.team_id&lt;br /&gt;
    @chat_log=ReviewChat.where(:reviewer_id =&amp;gt; @reviewer_id).where(:team_id =&amp;gt; @team_id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''submitted_response'''- Create a chat record and send an email to the reviewer when an author replied to a query asked by the reviewer&lt;br /&gt;
&lt;br /&gt;
  def submitted_response&lt;br /&gt;
    @review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    @chat_reviewer=Participant.find(@review_chat.reviewer_id).user_id&lt;br /&gt;
    if(@chat_reviewer==session[:user].id) then&lt;br /&gt;
    	ReviewChat.create(:assignment_id =&amp;gt; @review_chat.assignment_id,:reviewer_id =&amp;gt; @review_chat.reviewer_id, :team_id=&amp;gt;@review_chat.team_id, :type_flag =&amp;gt; 'Q' , :content =&amp;gt; params[:response_area])&lt;br /&gt;
    	ReviewChatsHelper::chat_email_query(params[:id])&lt;br /&gt;
    	flash[:notice]=&amp;quot;Query has been submitted&amp;quot;	&lt;br /&gt;
    else	&lt;br /&gt;
      	ReviewChat.create(:assignment_id =&amp;gt; @review_chat.assignment_id,:reviewer_id =&amp;gt; @review_chat.reviewer_id, :team_id=&amp;gt;@review_chat.team_id, :type_flag =&amp;gt; 'A' , :content =&amp;gt; params[:response_area])&lt;br /&gt;
      	ReviewChatsHelper::chat_email_response(@review_chat.id,@chat_reviewer)&lt;br /&gt;
      flash[:notice]=&amp;quot;Response has been submitted&amp;quot;&lt;br /&gt;
    end	&lt;br /&gt;
    redirect_to action: 'show', id: params[:id]&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
*Methods in the helper file '''review_chats_helper.rb'''&lt;br /&gt;
&lt;br /&gt;
'''chat_email_response'''- Send an email to the author of an assignment when a reviewer posts a query&lt;br /&gt;
&lt;br /&gt;
  def self.chat_email_response(id,reviewer_id,partial=&amp;quot;new_chatemail&amp;quot;)&lt;br /&gt;
    defn = Hash.new&lt;br /&gt;
    defn[:body] = Hash.new&lt;br /&gt;
    defn[:body][:partial_name] = partial&lt;br /&gt;
    reviewer_email=User.find(reviewer_id).email&lt;br /&gt;
    defn[:subject] = &amp;quot;Response posted for submission&amp;quot;&lt;br /&gt;
    defn[:body][:type] = &amp;quot; response has been posted for your query .&lt;br /&gt;
    Please open the below URL to view.&lt;br /&gt;
    http://expertiza.ncsu.edu/review_chats/show/#{id}&amp;quot;&lt;br /&gt;
    defn[:to] = reviewer_email&lt;br /&gt;
    Mailer.sync_message(defn).deliver&lt;br /&gt;
  end &lt;br /&gt;
&lt;br /&gt;
'''chat_email_query'''- Send an email to the author of an assignment when a reviewer posts a query&lt;br /&gt;
&lt;br /&gt;
  def self.chat_email_query(id,partial=&amp;quot;new_chatemail&amp;quot;)&lt;br /&gt;
    defn = Hash.new&lt;br /&gt;
    defn[:body] = Hash.new&lt;br /&gt;
    defn[:body][:partial_name] = partial&lt;br /&gt;
    assignment=nil&lt;br /&gt;
    @team_id=ReviewChat.find(id).team_id&lt;br /&gt;
    teams_users = TeamsUser.where(team_id: @team_id)&lt;br /&gt;
    to_mail_list = Array.new&lt;br /&gt;
    teams_users.each do |teams_user|&lt;br /&gt;
    to_mail_list &amp;lt;&amp;lt; User.find(teams_user.user_id).email &lt;br /&gt;
    end&lt;br /&gt;
    defn[:subject] = &amp;quot;Query posted for submission&amp;quot;&lt;br /&gt;
    defn[:body][:type] = &amp;quot; query has been posted for your submission .&lt;br /&gt;
    Please open the below URL to view and respond.&lt;br /&gt;
    http://expertiza.ncsu.edu/review_chats/show/#{id}&amp;quot;&lt;br /&gt;
    defn[:to] = to_mail_list&lt;br /&gt;
    Mailer.sync_message(defn).deliver&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
*Modify existing controller '''response_controller.rb''' and add a new method.&lt;br /&gt;
&lt;br /&gt;
'''submitted_question'''- Create a chat record and send an email to the authors when a reviewer posts a query.&lt;br /&gt;
  def submitted_question&lt;br /&gt;
      @map = ResponseMap.find(params[:id])&lt;br /&gt;
      ReviewChat.create(:assignment_id =&amp;gt; @map.assignment.id,:reviewer_id =&amp;gt; @map.reviewer_id, :team_id=&amp;gt;@map.reviewee_id, :type_flag =&amp;gt; 'Q' , :content =&amp;gt; params[:review_question])&lt;br /&gt;
      flash[:notice]=&amp;quot;Question has been submitted to Author&amp;quot;&lt;br /&gt;
      @interaction_id=ReviewChat.where(:reviewer_id =&amp;gt; @map.reviewer_id).where(:team_id =&amp;gt; @map.reviewee_id)&lt;br /&gt;
      ReviewChatsHelper::chat_email_query(@interaction_id.first.id)&lt;br /&gt;
      redirect_to action: 'new', id: params[:id]&lt;br /&gt;
  end&lt;br /&gt;
*Create a new view '''show.html.erb''' to show the existing chat record and a box to respond and ask a follow up query.&lt;br /&gt;
&lt;br /&gt;
===Flowchart===&lt;br /&gt;
&lt;br /&gt;
[[File: ARSNFlowchart1.png]]&lt;br /&gt;
&lt;br /&gt;
===Screenshots===&lt;br /&gt;
&lt;br /&gt;
*The reviewer enters his question in the text area provided and clicks on the &amp;quot;Submit&amp;quot; button.&lt;br /&gt;
[[File: FinalProject1.jpg]]&lt;br /&gt;
*On clicking this button the appropriate method is called in ReviewChats controller which sends an email to all the authors of the topic indicating that a question has been asked about their work. The email contains a link which when clicked on will redirect the author to the appropriate view where he/she can answer the question.&lt;br /&gt;
[[File: FinalProject4.jpg]]&lt;br /&gt;
*On answering the question, the reviewer receives an email indicating that his question has been answered. It also contains a link which redirects the reviewer to the appropriate view where the answer will be displayed.&lt;br /&gt;
*The authorized users will also be able to see a link to open existing chat interaction log.&lt;br /&gt;
[[File: FinalProject3.jpg]]&lt;br /&gt;
*This view also contains the chat history between the author/s and the reviewer for the entire duration of the interaction.&lt;br /&gt;
[[File: FinalProject2.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Suggestions for Future Improvements ==&lt;br /&gt;
&lt;br /&gt;
* This can be extended to a live interactive author-reviewer anonymous chat session inside the Expertiza reviews window.&lt;br /&gt;
* A purging script can be developed which will clear all the interaction records every semester.&lt;br /&gt;
&lt;br /&gt;
==Resources==&lt;br /&gt;
&lt;br /&gt;
* Expertiza Github repository&amp;lt;ref&amp;gt;Expertiza Github repository https://github.com/expertiza/expertiza&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sgulati2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100187</id>
		<title>CSC/ECE 517 Fall 2015 E1586 AnonymousChatBetweenAuthorAndReviewer</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100187"/>
		<updated>2015-12-05T01:16:17Z</updated>

		<summary type="html">&lt;p&gt;Sgulati2: /* Code Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1586 AnonymousChatBetweenAuthorAndReviewer'''&lt;br /&gt;
&lt;br /&gt;
This page provides a brief description of the '''Expertiza''' project. The project is aimed at developing an email based anonymous session between author and a reviewer so that reviewers can ask questions to the authors for any doubts related to the assignments during peer reviewing.&lt;br /&gt;
&lt;br /&gt;
==Project==&lt;br /&gt;
&lt;br /&gt;
=== Introduction to Expertiza ===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a peer review based system which provides an incremental class based learning together with the instructors and the peers. This project has been developed together by faculty and students using [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza handles assignment submissions, team formations, assignment reviews and grades, etc.&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
During reviews, many times reviewers will be having questions about the submitted material and if it's a blocker there is no way that the reviewer can progress further with the review.  As a result, reviewers will end up submitting the empty or incomplete review.&lt;br /&gt;
&lt;br /&gt;
=== Scope ===&lt;br /&gt;
This project is limited to an email based conversation for asking questions and answers. The reviewers would ask questions related to assignment submission doubts to which authors can respond. All this would be taken care as email responses using a link provided in the email. This project does not cater to any live interactive session with spontaneous back-to-back questions and responses.&lt;br /&gt;
&lt;br /&gt;
Following tasks would be incorporated in the project:&lt;br /&gt;
* Provide a ‘TextArea’ input field on review forms, where any reviewer can type in their questions.&lt;br /&gt;
* Create a new button ‘Ask for Quick Help’ on the review forms.&lt;br /&gt;
* An email would be send to the author with the link where he can respond to the questions asked by the reviewers for their submitted work.&lt;br /&gt;
* Reviewers would be notified by an email when authors respond to the the questions.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Discussion of Resolution ===&lt;br /&gt;
&lt;br /&gt;
We will make the following modifications to implement the chat feature:- &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Create a new model which will help to extract, store and validate data in the database table which contains information about the interaction between the author/s and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Edit the view which is used by the response controller to incorporate the text area input field on the review form where the reviewer can ask his/her initial query.&lt;br /&gt;
&lt;br /&gt;
*Create a new controller with methods for authentication for a respective chat log only visible to the author and reviewer of a particular assignment, method to submit a response or a follow up query and show the existing interaction log.&lt;br /&gt;
&lt;br /&gt;
*Create a new helper with the e-mail methods for sending to the author and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Create a new view which will facilitate the author to respond to the queries asked by the reviewer. The reviewer can also use this view to ask any follow up questions.&lt;br /&gt;
&lt;br /&gt;
=== Design Patterns ===&lt;br /&gt;
The implementation team expects that the following design patterns be used in the solution:&lt;br /&gt;
 &lt;br /&gt;
* '''Observer Pattern'''&amp;lt;ref&amp;gt;Observer Design Pattern https://en.wikipedia.org/wiki/Observer_pattern&amp;lt;/ref&amp;gt;: The observer pattern is a software design pattern in which an object, called the subject, maintains a list of its dependents, called observers, and notifies them automatically of any state changes, usually by calling one of their methods. For example, we are notifying the team members whenever the reviewer submits the query.&lt;br /&gt;
&lt;br /&gt;
* '''Iterator Pattern''': In our instance, we need to display the entire chat history of a particular interaction, hence we can use the iterator design pattern to iterate through the previous chat messages.&lt;br /&gt;
&lt;br /&gt;
=== Database Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:Review_chats.png]]&lt;br /&gt;
&lt;br /&gt;
The above figure shows the schema of a new table which will be created in Expertiza to store relevant information about the chat. It contains the following attributes:&lt;br /&gt;
* id: This attribute is auto-generated by rails when we create a table and is auto incremented with each record. It is also the primary key of our table.&lt;br /&gt;
* assignment_id: Stores the ID of the assignment for which the interaction between author and reviewer is taking place.&lt;br /&gt;
* reviewer_id: Stores the ID of the reviewer who asks the questions.&lt;br /&gt;
* team_id: Stores the ID of the team to which the topic belongs.&lt;br /&gt;
* type_flag: Flag which is used to indicate if the particular tuple contains a question or answer. It can take two values, 'Q' for question and 'A' for answer.&lt;br /&gt;
* content: Stores the question asked by the reviewer or the response given by the author/s depending on the value of the type flag.&lt;br /&gt;
&lt;br /&gt;
Records for a particular interaction can be identified by using a combination of assignment_id, reviewer_id and team_id.&lt;br /&gt;
&lt;br /&gt;
=== Use Cases ===&lt;br /&gt;
'''Name:''' Send a question to the author/s about their work.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Reviewer. &amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The reviewer enters his question in the text area which is provided and clicks on the &amp;quot;Ask question&amp;quot; button which is provided as shown in the mock up. On clicking this button an email is sent to the author/s along which a link to answer the question.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''Name:''' Answer the question which has been asked by the reviewer.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Author/s&amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The author/s click on the link received in their email and are redirected to a page where they can answer the question. Once they submit the answer, an email is sent to the reviewer notifying him/her that their question has been answered.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:ARSNUsecase.jpeg]]&lt;br /&gt;
&lt;br /&gt;
=== Proposed Tests ===&lt;br /&gt;
1. For use case 1, test whether all the team members receive email with the question.&amp;lt;br/&amp;gt;&lt;br /&gt;
2. For use case 2, test whether the reviewer receive email with the response.&amp;lt;br/&amp;gt;&lt;br /&gt;
3. Test whether all the previous interactions are displayed as chat history.&amp;lt;br/&amp;gt;&lt;br /&gt;
4. The 'Ask Question' button should not be enabled until some text has been entered in the text area.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
===Code Implementation===&lt;br /&gt;
&lt;br /&gt;
*Create a new model '''review_chat.rb''' for ReviewChat.&lt;br /&gt;
&lt;br /&gt;
'''Validation'''- Check if the query box is not empty and restrict the query length to 255 characters.&lt;br /&gt;
&lt;br /&gt;
  validates_length_of :content , :maximum =&amp;gt; 255,message: &amp;quot;Length must be less that 255 characters&amp;quot;&lt;br /&gt;
  validates_presence_of :content, message: &amp;quot;Content cannot be blank&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*Create a new controller '''review_chats_controller.rb''' with the following methods:&lt;br /&gt;
&lt;br /&gt;
'''action_allowed?'''- Allow chat visibility to the reviewers and the authors of a particular interaction&lt;br /&gt;
&lt;br /&gt;
  def action_allowed?&lt;br /&gt;
    review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    allowed_users=Array.new&lt;br /&gt;
    team_id=review_chat.team_id&lt;br /&gt;
    teams_users = TeamsUser.where(team_id: team_id)&lt;br /&gt;
    teams_users.each do |teams_user|&lt;br /&gt;
      allowed_users &amp;lt;&amp;lt; User.find(teams_user.user_id).id&lt;br /&gt;
    end&lt;br /&gt;
    allowed_users &amp;lt;&amp;lt; Participant.find(review_chat.reviewer_id).user_id&lt;br /&gt;
    current_role_name.eql? 'Student' and allowed_users.include?(session[:user].id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''show'''- Show the chat interaction log&lt;br /&gt;
&lt;br /&gt;
  def show&lt;br /&gt;
    @review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    @assignment_id=@review_chat.assignment_id&lt;br /&gt;
    @reviewer_id=@review_chat.reviewer_id&lt;br /&gt;
    @team_id=@review_chat.team_id&lt;br /&gt;
    @chat_log=ReviewChat.where(:reviewer_id =&amp;gt; @reviewer_id).where(:team_id =&amp;gt; @team_id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''submitted_response'''- Create a chat record and send an email to the reviewer when an author replied to a query asked by the reviewer&lt;br /&gt;
&lt;br /&gt;
  def submitted_response&lt;br /&gt;
    @review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    @chat_reviewer=Participant.find(@review_chat.reviewer_id).user_id&lt;br /&gt;
    if(@chat_reviewer==session[:user].id) then&lt;br /&gt;
    	ReviewChat.create(:assignment_id =&amp;gt; @review_chat.assignment_id,:reviewer_id =&amp;gt; @review_chat.reviewer_id, :team_id=&amp;gt;@review_chat.team_id, :type_flag =&amp;gt; 'Q' , :content =&amp;gt; params[:response_area])&lt;br /&gt;
    	ReviewChatsHelper::chat_email_query(params[:id])&lt;br /&gt;
    	flash[:notice]=&amp;quot;Query has been submitted&amp;quot;	&lt;br /&gt;
    else	&lt;br /&gt;
      	ReviewChat.create(:assignment_id =&amp;gt; @review_chat.assignment_id,:reviewer_id =&amp;gt; @review_chat.reviewer_id, :team_id=&amp;gt;@review_chat.team_id, :type_flag =&amp;gt; 'A' , :content =&amp;gt; params[:response_area])&lt;br /&gt;
      	ReviewChatsHelper::chat_email_response(@review_chat.id,@chat_reviewer)&lt;br /&gt;
      flash[:notice]=&amp;quot;Response has been submitted&amp;quot;&lt;br /&gt;
    end	&lt;br /&gt;
    redirect_to action: 'show', id: params[:id]&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
*Methods in the helper file '''review_chats_helper.rb'''&lt;br /&gt;
&lt;br /&gt;
'''chat_email_response'''- Send an email to the author of an assignment when a reviewer posts a query&lt;br /&gt;
&lt;br /&gt;
  def self.chat_email_response(id,reviewer_id,partial=&amp;quot;new_chatemail&amp;quot;)&lt;br /&gt;
    defn = Hash.new&lt;br /&gt;
    defn[:body] = Hash.new&lt;br /&gt;
    defn[:body][:partial_name] = partial&lt;br /&gt;
    reviewer_email=User.find(reviewer_id).email&lt;br /&gt;
    defn[:subject] = &amp;quot;Response posted for submission&amp;quot;&lt;br /&gt;
    defn[:body][:type] = &amp;quot; response has been posted for your query .&lt;br /&gt;
    Please open the below URL to view.&lt;br /&gt;
    http://expertiza.ncsu.edu/review_chats/show/#{id}&amp;quot;&lt;br /&gt;
    defn[:to] = reviewer_email&lt;br /&gt;
    Mailer.sync_message(defn).deliver&lt;br /&gt;
  end &lt;br /&gt;
&lt;br /&gt;
'''chat_email_query'''- Send an email to the author of an assignment when a reviewer posts a query&lt;br /&gt;
&lt;br /&gt;
  def self.chat_email_query(id,partial=&amp;quot;new_chatemail&amp;quot;)&lt;br /&gt;
    defn = Hash.new&lt;br /&gt;
    defn[:body] = Hash.new&lt;br /&gt;
    defn[:body][:partial_name] = partial&lt;br /&gt;
    assignment=nil&lt;br /&gt;
    @team_id=ReviewChat.find(id).team_id&lt;br /&gt;
    teams_users = TeamsUser.where(team_id: @team_id)&lt;br /&gt;
    to_mail_list = Array.new&lt;br /&gt;
    teams_users.each do |teams_user|&lt;br /&gt;
    to_mail_list &amp;lt;&amp;lt; User.find(teams_user.user_id).email &lt;br /&gt;
    end&lt;br /&gt;
    defn[:subject] = &amp;quot;Query posted for submission&amp;quot;&lt;br /&gt;
    defn[:body][:type] = &amp;quot; query has been posted for your submission .&lt;br /&gt;
    Please open the below URL to view and respond.&lt;br /&gt;
    http://expertiza.ncsu.edu/review_chats/show/#{id}&amp;quot;&lt;br /&gt;
    defn[:to] = to_mail_list&lt;br /&gt;
    Mailer.sync_message(defn).deliver&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
*Modify existing controller '''response_controller.rb''' and add a new method.&lt;br /&gt;
&lt;br /&gt;
'''submitted_question'''- Create a chat record and send an email to the authors when a reviewer posts a query.&lt;br /&gt;
  def submitted_question&lt;br /&gt;
      @map = ResponseMap.find(params[:id])&lt;br /&gt;
      ReviewChat.create(:assignment_id =&amp;gt; @map.assignment.id,:reviewer_id =&amp;gt; @map.reviewer_id, :team_id=&amp;gt;@map.reviewee_id, :type_flag =&amp;gt; 'Q' , :content =&amp;gt; params[:review_question])&lt;br /&gt;
      flash[:notice]=&amp;quot;Question has been submitted to Author&amp;quot;&lt;br /&gt;
      @interaction_id=ReviewChat.where(:reviewer_id =&amp;gt; @map.reviewer_id).where(:team_id =&amp;gt; @map.reviewee_id)&lt;br /&gt;
      ReviewChatsHelper::chat_email_query(@interaction_id.first.id)&lt;br /&gt;
      redirect_to action: 'new', id: params[:id]&lt;br /&gt;
  end&lt;br /&gt;
*Create a new view '''ahow.html.erb''' to show the existing chat record and a box to respond and ask a follow up query.&lt;br /&gt;
&lt;br /&gt;
===Flowchart===&lt;br /&gt;
&lt;br /&gt;
[[File: ARSNFlowchart1.png]]&lt;br /&gt;
&lt;br /&gt;
===Screenshots===&lt;br /&gt;
&lt;br /&gt;
*The reviewer enters his question in the text area provided and clicks on the &amp;quot;Submit&amp;quot; button.&lt;br /&gt;
[[File: FinalProject1.jpg]]&lt;br /&gt;
*On clicking this button the appropriate method is called in ReviewChats controller which sends an email to all the authors of the topic indicating that a question has been asked about their work. The email contains a link which when clicked on will redirect the author to the appropriate view where he/she can answer the question.&lt;br /&gt;
[[File: FinalProject4.jpg]]&lt;br /&gt;
*On answering the question, the reviewer receives an email indicating that his question has been answered. It also contains a link which redirects the reviewer to the appropriate view where the answer will be displayed.&lt;br /&gt;
*The authorized users will also be able to see a link to open existing chat interaction log.&lt;br /&gt;
[[File: FinalProject3.jpg]]&lt;br /&gt;
*This view also contains the chat history between the author/s and the reviewer for the entire duration of the interaction.&lt;br /&gt;
[[File: FinalProject2.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Suggestions for Future Improvements ==&lt;br /&gt;
&lt;br /&gt;
* This can be extended to a live interactive author-reviewer anonymous chat session inside the Expertiza reviews window.&lt;br /&gt;
* A purging script can be developed which will clear all the interaction records every semester.&lt;br /&gt;
&lt;br /&gt;
==Resources==&lt;br /&gt;
&lt;br /&gt;
* Expertiza Github repository&amp;lt;ref&amp;gt;Expertiza Github repository https://github.com/expertiza/expertiza&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sgulati2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100186</id>
		<title>CSC/ECE 517 Fall 2015 E1586 AnonymousChatBetweenAuthorAndReviewer</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100186"/>
		<updated>2015-12-05T01:15:58Z</updated>

		<summary type="html">&lt;p&gt;Sgulati2: /* Code Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1586 AnonymousChatBetweenAuthorAndReviewer'''&lt;br /&gt;
&lt;br /&gt;
This page provides a brief description of the '''Expertiza''' project. The project is aimed at developing an email based anonymous session between author and a reviewer so that reviewers can ask questions to the authors for any doubts related to the assignments during peer reviewing.&lt;br /&gt;
&lt;br /&gt;
==Project==&lt;br /&gt;
&lt;br /&gt;
=== Introduction to Expertiza ===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a peer review based system which provides an incremental class based learning together with the instructors and the peers. This project has been developed together by faculty and students using [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza handles assignment submissions, team formations, assignment reviews and grades, etc.&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
During reviews, many times reviewers will be having questions about the submitted material and if it's a blocker there is no way that the reviewer can progress further with the review.  As a result, reviewers will end up submitting the empty or incomplete review.&lt;br /&gt;
&lt;br /&gt;
=== Scope ===&lt;br /&gt;
This project is limited to an email based conversation for asking questions and answers. The reviewers would ask questions related to assignment submission doubts to which authors can respond. All this would be taken care as email responses using a link provided in the email. This project does not cater to any live interactive session with spontaneous back-to-back questions and responses.&lt;br /&gt;
&lt;br /&gt;
Following tasks would be incorporated in the project:&lt;br /&gt;
* Provide a ‘TextArea’ input field on review forms, where any reviewer can type in their questions.&lt;br /&gt;
* Create a new button ‘Ask for Quick Help’ on the review forms.&lt;br /&gt;
* An email would be send to the author with the link where he can respond to the questions asked by the reviewers for their submitted work.&lt;br /&gt;
* Reviewers would be notified by an email when authors respond to the the questions.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Discussion of Resolution ===&lt;br /&gt;
&lt;br /&gt;
We will make the following modifications to implement the chat feature:- &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Create a new model which will help to extract, store and validate data in the database table which contains information about the interaction between the author/s and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Edit the view which is used by the response controller to incorporate the text area input field on the review form where the reviewer can ask his/her initial query.&lt;br /&gt;
&lt;br /&gt;
*Create a new controller with methods for authentication for a respective chat log only visible to the author and reviewer of a particular assignment, method to submit a response or a follow up query and show the existing interaction log.&lt;br /&gt;
&lt;br /&gt;
*Create a new helper with the e-mail methods for sending to the author and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Create a new view which will facilitate the author to respond to the queries asked by the reviewer. The reviewer can also use this view to ask any follow up questions.&lt;br /&gt;
&lt;br /&gt;
=== Design Patterns ===&lt;br /&gt;
The implementation team expects that the following design patterns be used in the solution:&lt;br /&gt;
 &lt;br /&gt;
* '''Observer Pattern'''&amp;lt;ref&amp;gt;Observer Design Pattern https://en.wikipedia.org/wiki/Observer_pattern&amp;lt;/ref&amp;gt;: The observer pattern is a software design pattern in which an object, called the subject, maintains a list of its dependents, called observers, and notifies them automatically of any state changes, usually by calling one of their methods. For example, we are notifying the team members whenever the reviewer submits the query.&lt;br /&gt;
&lt;br /&gt;
* '''Iterator Pattern''': In our instance, we need to display the entire chat history of a particular interaction, hence we can use the iterator design pattern to iterate through the previous chat messages.&lt;br /&gt;
&lt;br /&gt;
=== Database Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:Review_chats.png]]&lt;br /&gt;
&lt;br /&gt;
The above figure shows the schema of a new table which will be created in Expertiza to store relevant information about the chat. It contains the following attributes:&lt;br /&gt;
* id: This attribute is auto-generated by rails when we create a table and is auto incremented with each record. It is also the primary key of our table.&lt;br /&gt;
* assignment_id: Stores the ID of the assignment for which the interaction between author and reviewer is taking place.&lt;br /&gt;
* reviewer_id: Stores the ID of the reviewer who asks the questions.&lt;br /&gt;
* team_id: Stores the ID of the team to which the topic belongs.&lt;br /&gt;
* type_flag: Flag which is used to indicate if the particular tuple contains a question or answer. It can take two values, 'Q' for question and 'A' for answer.&lt;br /&gt;
* content: Stores the question asked by the reviewer or the response given by the author/s depending on the value of the type flag.&lt;br /&gt;
&lt;br /&gt;
Records for a particular interaction can be identified by using a combination of assignment_id, reviewer_id and team_id.&lt;br /&gt;
&lt;br /&gt;
=== Use Cases ===&lt;br /&gt;
'''Name:''' Send a question to the author/s about their work.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Reviewer. &amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The reviewer enters his question in the text area which is provided and clicks on the &amp;quot;Ask question&amp;quot; button which is provided as shown in the mock up. On clicking this button an email is sent to the author/s along which a link to answer the question.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''Name:''' Answer the question which has been asked by the reviewer.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Author/s&amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The author/s click on the link received in their email and are redirected to a page where they can answer the question. Once they submit the answer, an email is sent to the reviewer notifying him/her that their question has been answered.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:ARSNUsecase.jpeg]]&lt;br /&gt;
&lt;br /&gt;
=== Proposed Tests ===&lt;br /&gt;
1. For use case 1, test whether all the team members receive email with the question.&amp;lt;br/&amp;gt;&lt;br /&gt;
2. For use case 2, test whether the reviewer receive email with the response.&amp;lt;br/&amp;gt;&lt;br /&gt;
3. Test whether all the previous interactions are displayed as chat history.&amp;lt;br/&amp;gt;&lt;br /&gt;
4. The 'Ask Question' button should not be enabled until some text has been entered in the text area.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
===Code Implementation===&lt;br /&gt;
&lt;br /&gt;
*Create a new model '''review_chat.rb''' for ReviewChat.&lt;br /&gt;
&lt;br /&gt;
'''Validation'''- Check if the query box is not empty and restrict the query length to 255 characters.&lt;br /&gt;
&lt;br /&gt;
  validates_length_of :content , :maximum =&amp;gt; 255,message: &amp;quot;Length must be less that 255 characters&amp;quot;&lt;br /&gt;
  validates_presence_of :content, message: &amp;quot;Content cannot be blank&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*Create a new controller '''review_chats_controller.rb''' with the following methods:&lt;br /&gt;
&lt;br /&gt;
'''action_allowed?'''- Allow chat visibility to the reviewers and the authors of a particular interaction&lt;br /&gt;
&lt;br /&gt;
  def action_allowed?&lt;br /&gt;
    review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    allowed_users=Array.new&lt;br /&gt;
    team_id=review_chat.team_id&lt;br /&gt;
    teams_users = TeamsUser.where(team_id: team_id)&lt;br /&gt;
    teams_users.each do |teams_user|&lt;br /&gt;
      allowed_users &amp;lt;&amp;lt; User.find(teams_user.user_id).id&lt;br /&gt;
    end&lt;br /&gt;
    allowed_users &amp;lt;&amp;lt; Participant.find(review_chat.reviewer_id).user_id&lt;br /&gt;
    current_role_name.eql? 'Student' and allowed_users.include?(session[:user].id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''show'''- Show the chat interaction log&lt;br /&gt;
&lt;br /&gt;
  def show&lt;br /&gt;
    @review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    @assignment_id=@review_chat.assignment_id&lt;br /&gt;
    @reviewer_id=@review_chat.reviewer_id&lt;br /&gt;
    @team_id=@review_chat.team_id&lt;br /&gt;
    @chat_log=ReviewChat.where(:reviewer_id =&amp;gt; @reviewer_id).where(:team_id =&amp;gt; @team_id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''submitted_response'''- Create a chat record and send an email to the reviewer when an author replied to a query asked by the reviewer&lt;br /&gt;
&lt;br /&gt;
  def submitted_response&lt;br /&gt;
    @review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    @chat_reviewer=Participant.find(@review_chat.reviewer_id).user_id&lt;br /&gt;
    if(@chat_reviewer==session[:user].id) then&lt;br /&gt;
    	ReviewChat.create(:assignment_id =&amp;gt; @review_chat.assignment_id,:reviewer_id =&amp;gt; @review_chat.reviewer_id, :team_id=&amp;gt;@review_chat.team_id, :type_flag =&amp;gt; 'Q' , :content =&amp;gt; params[:response_area])&lt;br /&gt;
    	ReviewChatsHelper::chat_email_query(params[:id])&lt;br /&gt;
    	flash[:notice]=&amp;quot;Query has been submitted&amp;quot;	&lt;br /&gt;
    else	&lt;br /&gt;
      	ReviewChat.create(:assignment_id =&amp;gt; @review_chat.assignment_id,:reviewer_id =&amp;gt; @review_chat.reviewer_id, :team_id=&amp;gt;@review_chat.team_id, :type_flag =&amp;gt; 'A' , :content =&amp;gt; params[:response_area])&lt;br /&gt;
      	ReviewChatsHelper::chat_email_response(@review_chat.id,@chat_reviewer)&lt;br /&gt;
      flash[:notice]=&amp;quot;Response has been submitted&amp;quot;&lt;br /&gt;
    end	&lt;br /&gt;
    redirect_to action: 'show', id: params[:id]&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
*Methods in the helper file '''review_chats_helper.rb'''&lt;br /&gt;
&lt;br /&gt;
'''chat_email_response'''- Send an email to the author of an assignment when a reviewer posts a query&lt;br /&gt;
&lt;br /&gt;
  def self.chat_email_response(id,reviewer_id,partial=&amp;quot;new_chatemail&amp;quot;)&lt;br /&gt;
    defn = Hash.new&lt;br /&gt;
    defn[:body] = Hash.new&lt;br /&gt;
    defn[:body][:partial_name] = partial&lt;br /&gt;
    reviewer_email=User.find(reviewer_id).email&lt;br /&gt;
    defn[:subject] = &amp;quot;Response posted for submission&amp;quot;&lt;br /&gt;
    defn[:body][:type] = &amp;quot; response has been posted for your query .&lt;br /&gt;
    Please open the below URL to view.&lt;br /&gt;
    http://expertiza.ncsu.edu/review_chats/show/#{id}&amp;quot;&lt;br /&gt;
    defn[:to] = reviewer_email&lt;br /&gt;
    Mailer.sync_message(defn).deliver&lt;br /&gt;
  end &lt;br /&gt;
&lt;br /&gt;
'''chat_email_query'''- Send an email to the author of an assignment when a reviewer posts a query&lt;br /&gt;
&lt;br /&gt;
  def self.chat_email_query(id,partial=&amp;quot;new_chatemail&amp;quot;)&lt;br /&gt;
    defn = Hash.new&lt;br /&gt;
    defn[:body] = Hash.new&lt;br /&gt;
    defn[:body][:partial_name] = partial&lt;br /&gt;
    assignment=nil&lt;br /&gt;
    @team_id=ReviewChat.find(id).team_id&lt;br /&gt;
    teams_users = TeamsUser.where(team_id: @team_id)&lt;br /&gt;
    to_mail_list = Array.new&lt;br /&gt;
    teams_users.each do |teams_user|&lt;br /&gt;
    to_mail_list &amp;lt;&amp;lt; User.find(teams_user.user_id).email &lt;br /&gt;
    end&lt;br /&gt;
    defn[:subject] = &amp;quot;Query posted for submission&amp;quot;&lt;br /&gt;
    defn[:body][:type] = &amp;quot; query has been posted for your submission .&lt;br /&gt;
    Please open the below URL to view and respond.&lt;br /&gt;
    http://expertiza.ncsu.edu/review_chats/show/#{id}&amp;quot;&lt;br /&gt;
    defn[:to] = to_mail_list&lt;br /&gt;
    Mailer.sync_message(defn).deliver&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
*Modify existing controller '''response_controller.rb''' and add a new method.&lt;br /&gt;
&lt;br /&gt;
'''submitted_question'''- Create a chat record and send an email to the authors when a reviewer posts a query.&lt;br /&gt;
  def submitted_question&lt;br /&gt;
      @map = ResponseMap.find(params[:id])&lt;br /&gt;
      ReviewChat.create(:assignment_id =&amp;gt; @map.assignment.id,:reviewer_id =&amp;gt; @map.reviewer_id, :team_id=&amp;gt;@map.reviewee_id, :type_flag =&amp;gt; 'Q' , :content =&amp;gt; params[:review_question])&lt;br /&gt;
      flash[:notice]=&amp;quot;Question has been submitted to Author&amp;quot;&lt;br /&gt;
      @interaction_id=ReviewChat.where(:reviewer_id =&amp;gt; @map.reviewer_id).where(:team_id =&amp;gt; @map.reviewee_id)&lt;br /&gt;
      ReviewChatsHelper::chat_email_query(@interaction_id.first.id)&lt;br /&gt;
      redirect_to action: 'new', id: params[:id]&lt;br /&gt;
  end&lt;br /&gt;
*Create new view '''Show.html.erb''' to show the existing chat record and a box to respond and ask a follow up query.&lt;br /&gt;
&lt;br /&gt;
===Flowchart===&lt;br /&gt;
&lt;br /&gt;
[[File: ARSNFlowchart1.png]]&lt;br /&gt;
&lt;br /&gt;
===Screenshots===&lt;br /&gt;
&lt;br /&gt;
*The reviewer enters his question in the text area provided and clicks on the &amp;quot;Submit&amp;quot; button.&lt;br /&gt;
[[File: FinalProject1.jpg]]&lt;br /&gt;
*On clicking this button the appropriate method is called in ReviewChats controller which sends an email to all the authors of the topic indicating that a question has been asked about their work. The email contains a link which when clicked on will redirect the author to the appropriate view where he/she can answer the question.&lt;br /&gt;
[[File: FinalProject4.jpg]]&lt;br /&gt;
*On answering the question, the reviewer receives an email indicating that his question has been answered. It also contains a link which redirects the reviewer to the appropriate view where the answer will be displayed.&lt;br /&gt;
*The authorized users will also be able to see a link to open existing chat interaction log.&lt;br /&gt;
[[File: FinalProject3.jpg]]&lt;br /&gt;
*This view also contains the chat history between the author/s and the reviewer for the entire duration of the interaction.&lt;br /&gt;
[[File: FinalProject2.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Suggestions for Future Improvements ==&lt;br /&gt;
&lt;br /&gt;
* This can be extended to a live interactive author-reviewer anonymous chat session inside the Expertiza reviews window.&lt;br /&gt;
* A purging script can be developed which will clear all the interaction records every semester.&lt;br /&gt;
&lt;br /&gt;
==Resources==&lt;br /&gt;
&lt;br /&gt;
* Expertiza Github repository&amp;lt;ref&amp;gt;Expertiza Github repository https://github.com/expertiza/expertiza&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sgulati2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100185</id>
		<title>CSC/ECE 517 Fall 2015 E1586 AnonymousChatBetweenAuthorAndReviewer</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100185"/>
		<updated>2015-12-05T01:14:08Z</updated>

		<summary type="html">&lt;p&gt;Sgulati2: /* Code Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1586 AnonymousChatBetweenAuthorAndReviewer'''&lt;br /&gt;
&lt;br /&gt;
This page provides a brief description of the '''Expertiza''' project. The project is aimed at developing an email based anonymous session between author and a reviewer so that reviewers can ask questions to the authors for any doubts related to the assignments during peer reviewing.&lt;br /&gt;
&lt;br /&gt;
==Project==&lt;br /&gt;
&lt;br /&gt;
=== Introduction to Expertiza ===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a peer review based system which provides an incremental class based learning together with the instructors and the peers. This project has been developed together by faculty and students using [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza handles assignment submissions, team formations, assignment reviews and grades, etc.&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
During reviews, many times reviewers will be having questions about the submitted material and if it's a blocker there is no way that the reviewer can progress further with the review.  As a result, reviewers will end up submitting the empty or incomplete review.&lt;br /&gt;
&lt;br /&gt;
=== Scope ===&lt;br /&gt;
This project is limited to an email based conversation for asking questions and answers. The reviewers would ask questions related to assignment submission doubts to which authors can respond. All this would be taken care as email responses using a link provided in the email. This project does not cater to any live interactive session with spontaneous back-to-back questions and responses.&lt;br /&gt;
&lt;br /&gt;
Following tasks would be incorporated in the project:&lt;br /&gt;
* Provide a ‘TextArea’ input field on review forms, where any reviewer can type in their questions.&lt;br /&gt;
* Create a new button ‘Ask for Quick Help’ on the review forms.&lt;br /&gt;
* An email would be send to the author with the link where he can respond to the questions asked by the reviewers for their submitted work.&lt;br /&gt;
* Reviewers would be notified by an email when authors respond to the the questions.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Discussion of Resolution ===&lt;br /&gt;
&lt;br /&gt;
We will make the following modifications to implement the chat feature:- &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Create a new model which will help to extract, store and validate data in the database table which contains information about the interaction between the author/s and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Edit the view which is used by the response controller to incorporate the text area input field on the review form where the reviewer can ask his/her initial query.&lt;br /&gt;
&lt;br /&gt;
*Create a new controller with methods for authentication for a respective chat log only visible to the author and reviewer of a particular assignment, method to submit a response or a follow up query and show the existing interaction log.&lt;br /&gt;
&lt;br /&gt;
*Create a new helper with the e-mail methods for sending to the author and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Create a new view which will facilitate the author to respond to the queries asked by the reviewer. The reviewer can also use this view to ask any follow up questions.&lt;br /&gt;
&lt;br /&gt;
=== Design Patterns ===&lt;br /&gt;
The implementation team expects that the following design patterns be used in the solution:&lt;br /&gt;
 &lt;br /&gt;
* '''Observer Pattern'''&amp;lt;ref&amp;gt;Observer Design Pattern https://en.wikipedia.org/wiki/Observer_pattern&amp;lt;/ref&amp;gt;: The observer pattern is a software design pattern in which an object, called the subject, maintains a list of its dependents, called observers, and notifies them automatically of any state changes, usually by calling one of their methods. For example, we are notifying the team members whenever the reviewer submits the query.&lt;br /&gt;
&lt;br /&gt;
* '''Iterator Pattern''': In our instance, we need to display the entire chat history of a particular interaction, hence we can use the iterator design pattern to iterate through the previous chat messages.&lt;br /&gt;
&lt;br /&gt;
=== Database Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:Review_chats.png]]&lt;br /&gt;
&lt;br /&gt;
The above figure shows the schema of a new table which will be created in Expertiza to store relevant information about the chat. It contains the following attributes:&lt;br /&gt;
* id: This attribute is auto-generated by rails when we create a table and is auto incremented with each record. It is also the primary key of our table.&lt;br /&gt;
* assignment_id: Stores the ID of the assignment for which the interaction between author and reviewer is taking place.&lt;br /&gt;
* reviewer_id: Stores the ID of the reviewer who asks the questions.&lt;br /&gt;
* team_id: Stores the ID of the team to which the topic belongs.&lt;br /&gt;
* type_flag: Flag which is used to indicate if the particular tuple contains a question or answer. It can take two values, 'Q' for question and 'A' for answer.&lt;br /&gt;
* content: Stores the question asked by the reviewer or the response given by the author/s depending on the value of the type flag.&lt;br /&gt;
&lt;br /&gt;
Records for a particular interaction can be identified by using a combination of assignment_id, reviewer_id and team_id.&lt;br /&gt;
&lt;br /&gt;
=== Use Cases ===&lt;br /&gt;
'''Name:''' Send a question to the author/s about their work.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Reviewer. &amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The reviewer enters his question in the text area which is provided and clicks on the &amp;quot;Ask question&amp;quot; button which is provided as shown in the mock up. On clicking this button an email is sent to the author/s along which a link to answer the question.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''Name:''' Answer the question which has been asked by the reviewer.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Author/s&amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The author/s click on the link received in their email and are redirected to a page where they can answer the question. Once they submit the answer, an email is sent to the reviewer notifying him/her that their question has been answered.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:ARSNUsecase.jpeg]]&lt;br /&gt;
&lt;br /&gt;
=== Proposed Tests ===&lt;br /&gt;
1. For use case 1, test whether all the team members receive email with the question.&amp;lt;br/&amp;gt;&lt;br /&gt;
2. For use case 2, test whether the reviewer receive email with the response.&amp;lt;br/&amp;gt;&lt;br /&gt;
3. Test whether all the previous interactions are displayed as chat history.&amp;lt;br/&amp;gt;&lt;br /&gt;
4. The 'Ask Question' button should not be enabled until some text has been entered in the text area.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
===Code Implementation===&lt;br /&gt;
&lt;br /&gt;
*Model '''review_chat.rb''' to validate if the query box is empty and restrict the query length to 255 characters.&lt;br /&gt;
&lt;br /&gt;
  validates_length_of :content , :maximum =&amp;gt; 255,message: &amp;quot;Length must be less that 255 characters&amp;quot;&lt;br /&gt;
  validates_presence_of :content, message: &amp;quot;Content cannot be blank&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*Methods in the controller '''review_chats_controller.rb'''&lt;br /&gt;
&lt;br /&gt;
'''action_allowed?'''- Allow chat visibility to the reviewers and the authors of a particular interaction&lt;br /&gt;
&lt;br /&gt;
  def action_allowed?&lt;br /&gt;
    review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    allowed_users=Array.new&lt;br /&gt;
    team_id=review_chat.team_id&lt;br /&gt;
    teams_users = TeamsUser.where(team_id: team_id)&lt;br /&gt;
    teams_users.each do |teams_user|&lt;br /&gt;
      allowed_users &amp;lt;&amp;lt; User.find(teams_user.user_id).id&lt;br /&gt;
    end&lt;br /&gt;
    allowed_users &amp;lt;&amp;lt; Participant.find(review_chat.reviewer_id).user_id&lt;br /&gt;
    current_role_name.eql? 'Student' and allowed_users.include?(session[:user].id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''show'''- Show the chat interaction log&lt;br /&gt;
&lt;br /&gt;
  def show&lt;br /&gt;
    @review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    @assignment_id=@review_chat.assignment_id&lt;br /&gt;
    @reviewer_id=@review_chat.reviewer_id&lt;br /&gt;
    @team_id=@review_chat.team_id&lt;br /&gt;
    @chat_log=ReviewChat.where(:reviewer_id =&amp;gt; @reviewer_id).where(:team_id =&amp;gt; @team_id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''submitted_response'''- Create a chat record and send an email to the reviewer when an author replied to a query asked by the reviewer&lt;br /&gt;
&lt;br /&gt;
  def submitted_response&lt;br /&gt;
    @review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    @chat_reviewer=Participant.find(@review_chat.reviewer_id).user_id&lt;br /&gt;
    if(@chat_reviewer==session[:user].id) then&lt;br /&gt;
    	ReviewChat.create(:assignment_id =&amp;gt; @review_chat.assignment_id,:reviewer_id =&amp;gt; @review_chat.reviewer_id, :team_id=&amp;gt;@review_chat.team_id, :type_flag =&amp;gt; 'Q' , :content =&amp;gt; params[:response_area])&lt;br /&gt;
    	ReviewChatsHelper::chat_email_query(params[:id])&lt;br /&gt;
    	flash[:notice]=&amp;quot;Query has been submitted&amp;quot;	&lt;br /&gt;
    else	&lt;br /&gt;
      	ReviewChat.create(:assignment_id =&amp;gt; @review_chat.assignment_id,:reviewer_id =&amp;gt; @review_chat.reviewer_id, :team_id=&amp;gt;@review_chat.team_id, :type_flag =&amp;gt; 'A' , :content =&amp;gt; params[:response_area])&lt;br /&gt;
      	ReviewChatsHelper::chat_email_response(@review_chat.id,@chat_reviewer)&lt;br /&gt;
      flash[:notice]=&amp;quot;Response has been submitted&amp;quot;&lt;br /&gt;
    end	&lt;br /&gt;
    redirect_to action: 'show', id: params[:id]&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
*Methods in the helper file '''review_chats_helper.rb'''&lt;br /&gt;
&lt;br /&gt;
'''chat_email_response'''- Send an email to the author of an assignment when a reviewer posts a query&lt;br /&gt;
&lt;br /&gt;
  def self.chat_email_response(id,reviewer_id,partial=&amp;quot;new_chatemail&amp;quot;)&lt;br /&gt;
    defn = Hash.new&lt;br /&gt;
    defn[:body] = Hash.new&lt;br /&gt;
    defn[:body][:partial_name] = partial&lt;br /&gt;
    reviewer_email=User.find(reviewer_id).email&lt;br /&gt;
    defn[:subject] = &amp;quot;Response posted for submission&amp;quot;&lt;br /&gt;
    defn[:body][:type] = &amp;quot; response has been posted for your query .&lt;br /&gt;
    Please open the below URL to view.&lt;br /&gt;
    http://expertiza.ncsu.edu/review_chats/show/#{id}&amp;quot;&lt;br /&gt;
    defn[:to] = reviewer_email&lt;br /&gt;
    Mailer.sync_message(defn).deliver&lt;br /&gt;
  end &lt;br /&gt;
&lt;br /&gt;
'''chat_email_query'''- Send an email to the author of an assignment when a reviewer posts a query&lt;br /&gt;
&lt;br /&gt;
  def self.chat_email_query(id,partial=&amp;quot;new_chatemail&amp;quot;)&lt;br /&gt;
    defn = Hash.new&lt;br /&gt;
    defn[:body] = Hash.new&lt;br /&gt;
    defn[:body][:partial_name] = partial&lt;br /&gt;
    assignment=nil&lt;br /&gt;
    @team_id=ReviewChat.find(id).team_id&lt;br /&gt;
    teams_users = TeamsUser.where(team_id: @team_id)&lt;br /&gt;
    to_mail_list = Array.new&lt;br /&gt;
    teams_users.each do |teams_user|&lt;br /&gt;
    to_mail_list &amp;lt;&amp;lt; User.find(teams_user.user_id).email &lt;br /&gt;
    end&lt;br /&gt;
    defn[:subject] = &amp;quot;Query posted for submission&amp;quot;&lt;br /&gt;
    defn[:body][:type] = &amp;quot; query has been posted for your submission .&lt;br /&gt;
    Please open the below URL to view and respond.&lt;br /&gt;
    http://expertiza.ncsu.edu/review_chats/show/#{id}&amp;quot;&lt;br /&gt;
    defn[:to] = to_mail_list&lt;br /&gt;
    Mailer.sync_message(defn).deliver&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
*New method in existing controller '''response_controller.rb'''&lt;br /&gt;
&lt;br /&gt;
'''submitted_question'''- Create a chat record and send an email to the authors when a reviewer posts a query.&lt;br /&gt;
  def submitted_question&lt;br /&gt;
      @map = ResponseMap.find(params[:id])&lt;br /&gt;
      ReviewChat.create(:assignment_id =&amp;gt; @map.assignment.id,:reviewer_id =&amp;gt; @map.reviewer_id, :team_id=&amp;gt;@map.reviewee_id, :type_flag =&amp;gt; 'Q' , :content =&amp;gt; params[:review_question])&lt;br /&gt;
      flash[:notice]=&amp;quot;Question has been submitted to Author&amp;quot;&lt;br /&gt;
      @interaction_id=ReviewChat.where(:reviewer_id =&amp;gt; @map.reviewer_id).where(:team_id =&amp;gt; @map.reviewee_id)&lt;br /&gt;
      ReviewChatsHelper::chat_email_query(@interaction_id.first.id)&lt;br /&gt;
      redirect_to action: 'new', id: params[:id]&lt;br /&gt;
  end&lt;br /&gt;
*Create new view '''Show.html.erb''' to show the existing chat record and a box to respond and ask a follow up query.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h1&amp;gt; Chat Log &amp;lt;/h1&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 cellpadding=&amp;quot;30&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;th style = &amp;quot;width:160px;padding-left:5px;padding-right:5px&amp;quot;&amp;gt; Q/A &amp;lt;/th&amp;gt;&lt;br /&gt;
      &amp;lt;th style = &amp;quot;width:500px;padding-left:5px;padding-right:5px&amp;quot;&amp;gt; Content&amp;lt;/th&amp;gt;&lt;br /&gt;
      &amp;lt;th style = &amp;quot;padding-left:5px;padding-right:5px&amp;quot;&amp;gt; Timestamp&amp;lt;/th&amp;gt;&lt;br /&gt;
     &amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
     &amp;lt;% @chat_log.each do |chat_log| %&amp;gt;&lt;br /&gt;
      &amp;lt;tr&amp;gt;&lt;br /&gt;
        &amp;lt;% if chat_log.type_flag == 'Q' %&amp;gt;&lt;br /&gt;
        &amp;lt;td style = &amp;quot;width:160px;padding-left:5px;padding-right:5px&amp;quot; &amp;gt; Query &amp;lt;/td&amp;gt;&lt;br /&gt;
        &amp;lt;%else%&amp;gt;&lt;br /&gt;
        &amp;lt;td style = &amp;quot;width:160px;padding-left:5px;padding-right:5px&amp;quot; &amp;gt; Response &amp;lt;/td&amp;gt;&lt;br /&gt;
        &amp;lt;%end%&amp;gt;&lt;br /&gt;
        &amp;lt;td style = &amp;quot;width:500px;padding-left:5px;padding-right:5px&amp;quot; &amp;gt; &amp;lt;%= chat_log.content %&amp;gt; &amp;lt;/td&amp;gt;&lt;br /&gt;
        &amp;lt;td style = &amp;quot;padding-left:5px;padding-right:5px&amp;quot;&amp;gt; &amp;lt;%= chat_log.created_at.strftime(&amp;quot;%Y-%m-%d %I:%M:%S %p&amp;quot;) %&amp;gt; &amp;lt;/td&amp;gt;&lt;br /&gt;
        &amp;lt;%end%&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p style=&amp;quot;position:fixed; bottom:0px; right:100px &amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;%= form_tag :action =&amp;gt; &amp;quot;submitted_response&amp;quot; , :id =&amp;gt; params[:id] do %&amp;gt;&lt;br /&gt;
      &amp;lt;label for=&amp;quot;response&amp;quot;&amp;gt;Post your query/response&amp;lt;/label&amp;gt;&amp;lt;BR/&amp;gt;&lt;br /&gt;
      &amp;lt;textarea cols=&amp;quot;30&amp;quot; rows=&amp;quot;4&amp;quot; id=&amp;quot;response_area&amp;quot; name=&amp;quot;response_area&amp;quot; style=&amp;quot;overflow:hidden;&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;/textarea&amp;gt; &amp;lt;br/&amp;gt; &lt;br /&gt;
 &amp;lt;%= submit_tag &amp;quot;Submit&amp;quot;, :name =&amp;gt; &amp;quot;submit_response&amp;quot; %&amp;gt;&amp;lt;% end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Modify view expertiza/app/views/response/response.html.erb to incorporate text box and corresponding submit button.&lt;br /&gt;
&lt;br /&gt;
===Flowchart===&lt;br /&gt;
&lt;br /&gt;
[[File: ARSNFlowchart1.png]]&lt;br /&gt;
&lt;br /&gt;
===Screenshots===&lt;br /&gt;
&lt;br /&gt;
*The reviewer enters his question in the text area provided and clicks on the &amp;quot;Submit&amp;quot; button.&lt;br /&gt;
[[File: FinalProject1.jpg]]&lt;br /&gt;
*On clicking this button the appropriate method is called in ReviewChats controller which sends an email to all the authors of the topic indicating that a question has been asked about their work. The email contains a link which when clicked on will redirect the author to the appropriate view where he/she can answer the question.&lt;br /&gt;
[[File: FinalProject4.jpg]]&lt;br /&gt;
*On answering the question, the reviewer receives an email indicating that his question has been answered. It also contains a link which redirects the reviewer to the appropriate view where the answer will be displayed.&lt;br /&gt;
*The authorized users will also be able to see a link to open existing chat interaction log.&lt;br /&gt;
[[File: FinalProject3.jpg]]&lt;br /&gt;
*This view also contains the chat history between the author/s and the reviewer for the entire duration of the interaction.&lt;br /&gt;
[[File: FinalProject2.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Suggestions for Future Improvements ==&lt;br /&gt;
&lt;br /&gt;
* This can be extended to a live interactive author-reviewer anonymous chat session inside the Expertiza reviews window.&lt;br /&gt;
* A purging script can be developed which will clear all the interaction records every semester.&lt;br /&gt;
&lt;br /&gt;
==Resources==&lt;br /&gt;
&lt;br /&gt;
* Expertiza Github repository&amp;lt;ref&amp;gt;Expertiza Github repository https://github.com/expertiza/expertiza&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sgulati2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100184</id>
		<title>CSC/ECE 517 Fall 2015 E1586 AnonymousChatBetweenAuthorAndReviewer</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100184"/>
		<updated>2015-12-05T01:12:20Z</updated>

		<summary type="html">&lt;p&gt;Sgulati2: /* Code Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1586 AnonymousChatBetweenAuthorAndReviewer'''&lt;br /&gt;
&lt;br /&gt;
This page provides a brief description of the '''Expertiza''' project. The project is aimed at developing an email based anonymous session between author and a reviewer so that reviewers can ask questions to the authors for any doubts related to the assignments during peer reviewing.&lt;br /&gt;
&lt;br /&gt;
==Project==&lt;br /&gt;
&lt;br /&gt;
=== Introduction to Expertiza ===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a peer review based system which provides an incremental class based learning together with the instructors and the peers. This project has been developed together by faculty and students using [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza handles assignment submissions, team formations, assignment reviews and grades, etc.&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
During reviews, many times reviewers will be having questions about the submitted material and if it's a blocker there is no way that the reviewer can progress further with the review.  As a result, reviewers will end up submitting the empty or incomplete review.&lt;br /&gt;
&lt;br /&gt;
=== Scope ===&lt;br /&gt;
This project is limited to an email based conversation for asking questions and answers. The reviewers would ask questions related to assignment submission doubts to which authors can respond. All this would be taken care as email responses using a link provided in the email. This project does not cater to any live interactive session with spontaneous back-to-back questions and responses.&lt;br /&gt;
&lt;br /&gt;
Following tasks would be incorporated in the project:&lt;br /&gt;
* Provide a ‘TextArea’ input field on review forms, where any reviewer can type in their questions.&lt;br /&gt;
* Create a new button ‘Ask for Quick Help’ on the review forms.&lt;br /&gt;
* An email would be send to the author with the link where he can respond to the questions asked by the reviewers for their submitted work.&lt;br /&gt;
* Reviewers would be notified by an email when authors respond to the the questions.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Discussion of Resolution ===&lt;br /&gt;
&lt;br /&gt;
We will make the following modifications to implement the chat feature:- &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Create a new model which will help to extract, store and validate data in the database table which contains information about the interaction between the author/s and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Edit the view which is used by the response controller to incorporate the text area input field on the review form where the reviewer can ask his/her initial query.&lt;br /&gt;
&lt;br /&gt;
*Create a new controller with methods for authentication for a respective chat log only visible to the author and reviewer of a particular assignment, method to submit a response or a follow up query and show the existing interaction log.&lt;br /&gt;
&lt;br /&gt;
*Create a new helper with the e-mail methods for sending to the author and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Create a new view which will facilitate the author to respond to the queries asked by the reviewer. The reviewer can also use this view to ask any follow up questions.&lt;br /&gt;
&lt;br /&gt;
=== Design Patterns ===&lt;br /&gt;
The implementation team expects that the following design patterns be used in the solution:&lt;br /&gt;
 &lt;br /&gt;
* '''Observer Pattern'''&amp;lt;ref&amp;gt;Observer Design Pattern https://en.wikipedia.org/wiki/Observer_pattern&amp;lt;/ref&amp;gt;: The observer pattern is a software design pattern in which an object, called the subject, maintains a list of its dependents, called observers, and notifies them automatically of any state changes, usually by calling one of their methods. For example, we are notifying the team members whenever the reviewer submits the query.&lt;br /&gt;
&lt;br /&gt;
* '''Iterator Pattern''': In our instance, we need to display the entire chat history of a particular interaction, hence we can use the iterator design pattern to iterate through the previous chat messages.&lt;br /&gt;
&lt;br /&gt;
=== Database Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:Review_chats.png]]&lt;br /&gt;
&lt;br /&gt;
The above figure shows the schema of a new table which will be created in Expertiza to store relevant information about the chat. It contains the following attributes:&lt;br /&gt;
* id: This attribute is auto-generated by rails when we create a table and is auto incremented with each record. It is also the primary key of our table.&lt;br /&gt;
* assignment_id: Stores the ID of the assignment for which the interaction between author and reviewer is taking place.&lt;br /&gt;
* reviewer_id: Stores the ID of the reviewer who asks the questions.&lt;br /&gt;
* team_id: Stores the ID of the team to which the topic belongs.&lt;br /&gt;
* type_flag: Flag which is used to indicate if the particular tuple contains a question or answer. It can take two values, 'Q' for question and 'A' for answer.&lt;br /&gt;
* content: Stores the question asked by the reviewer or the response given by the author/s depending on the value of the type flag.&lt;br /&gt;
&lt;br /&gt;
Records for a particular interaction can be identified by using a combination of assignment_id, reviewer_id and team_id.&lt;br /&gt;
&lt;br /&gt;
=== Use Cases ===&lt;br /&gt;
'''Name:''' Send a question to the author/s about their work.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Reviewer. &amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The reviewer enters his question in the text area which is provided and clicks on the &amp;quot;Ask question&amp;quot; button which is provided as shown in the mock up. On clicking this button an email is sent to the author/s along which a link to answer the question.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''Name:''' Answer the question which has been asked by the reviewer.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Author/s&amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The author/s click on the link received in their email and are redirected to a page where they can answer the question. Once they submit the answer, an email is sent to the reviewer notifying him/her that their question has been answered.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:ARSNUsecase.jpeg]]&lt;br /&gt;
&lt;br /&gt;
=== Proposed Tests ===&lt;br /&gt;
1. For use case 1, test whether all the team members receive email with the question.&amp;lt;br/&amp;gt;&lt;br /&gt;
2. For use case 2, test whether the reviewer receive email with the response.&amp;lt;br/&amp;gt;&lt;br /&gt;
3. Test whether all the previous interactions are displayed as chat history.&amp;lt;br/&amp;gt;&lt;br /&gt;
4. The 'Ask Question' button should not be enabled until some text has been entered in the text area.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
===Code Implementation===&lt;br /&gt;
&lt;br /&gt;
*Model '''review_chat.rb''' to validate if the query box is empty and restrict the query length to 255 characters.&lt;br /&gt;
&lt;br /&gt;
  validates_length_of :content , :maximum =&amp;gt; 255,message: &amp;quot;Length must be less that 255 characters&amp;quot;&lt;br /&gt;
  validates_presence_of :content, message: &amp;quot;Content cannot be blank&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*Methods in the controller '''review_chats_controller.rb'''&lt;br /&gt;
&lt;br /&gt;
'''action_allowed?'''- Allow chat visibility to the reviewers and the authors of a particular interaction&lt;br /&gt;
&lt;br /&gt;
  def action_allowed?&lt;br /&gt;
    review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    allowed_users=Array.new&lt;br /&gt;
    team_id=review_chat.team_id&lt;br /&gt;
    teams_users = TeamsUser.where(team_id: team_id)&lt;br /&gt;
    teams_users.each do |teams_user|&lt;br /&gt;
      allowed_users &amp;lt;&amp;lt; User.find(teams_user.user_id).id&lt;br /&gt;
    end&lt;br /&gt;
    allowed_users &amp;lt;&amp;lt; Participant.find(review_chat.reviewer_id).user_id&lt;br /&gt;
    current_role_name.eql? 'Student' and allowed_users.include?(session[:user].id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''show'''- Show the chat interaction log&lt;br /&gt;
&lt;br /&gt;
  def show&lt;br /&gt;
    @review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    @assignment_id=@review_chat.assignment_id&lt;br /&gt;
    @reviewer_id=@review_chat.reviewer_id&lt;br /&gt;
    @team_id=@review_chat.team_id&lt;br /&gt;
    @chat_log=ReviewChat.where(:reviewer_id =&amp;gt; @reviewer_id).where(:team_id =&amp;gt; @team_id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''submitted_response'''- Create a chat record and send an email to the reviewer when an author replied to a query asked by the reviewer&lt;br /&gt;
&lt;br /&gt;
  def submitted_response&lt;br /&gt;
    @review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    @chat_reviewer=Participant.find(@review_chat.reviewer_id).user_id&lt;br /&gt;
    if(@chat_reviewer==session[:user].id) then&lt;br /&gt;
    	ReviewChat.create(:assignment_id =&amp;gt; @review_chat.assignment_id,:reviewer_id =&amp;gt; @review_chat.reviewer_id, :team_id=&amp;gt;@review_chat.team_id, :type_flag =&amp;gt; 'Q' , :content =&amp;gt; params[:response_area])&lt;br /&gt;
    	ReviewChatsHelper::chat_email_query(params[:id])&lt;br /&gt;
    	flash[:notice]=&amp;quot;Query has been submitted&amp;quot;	&lt;br /&gt;
    else	&lt;br /&gt;
      	ReviewChat.create(:assignment_id =&amp;gt; @review_chat.assignment_id,:reviewer_id =&amp;gt; @review_chat.reviewer_id, :team_id=&amp;gt;@review_chat.team_id, :type_flag =&amp;gt; 'A' , :content =&amp;gt; params[:response_area])&lt;br /&gt;
      	ReviewChatsHelper::chat_email_response(@review_chat.id,@chat_reviewer)&lt;br /&gt;
      flash[:notice]=&amp;quot;Response has been submitted&amp;quot;&lt;br /&gt;
    end	&lt;br /&gt;
    redirect_to action: 'show', id: params[:id]&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
*Methods in the helper file '''review_chats_helper.rb'''&lt;br /&gt;
&lt;br /&gt;
'''chat_email_response'''- Send an email to the author of an assignment when a reviewer posts a query&lt;br /&gt;
&lt;br /&gt;
  def self.chat_email_response(id,reviewer_id,partial=&amp;quot;new_chatemail&amp;quot;)&lt;br /&gt;
    defn = Hash.new&lt;br /&gt;
    defn[:body] = Hash.new&lt;br /&gt;
    defn[:body][:partial_name] = partial&lt;br /&gt;
    reviewer_email=User.find(reviewer_id).email&lt;br /&gt;
    defn[:subject] = &amp;quot;Response posted for submission&amp;quot;&lt;br /&gt;
    defn[:body][:type] = &amp;quot; response has been posted for your query .&lt;br /&gt;
    Please open the below URL to view.&lt;br /&gt;
    http://expertiza.ncsu.edu/review_chats/show/#{id}&amp;quot;&lt;br /&gt;
    defn[:to] = reviewer_email&lt;br /&gt;
    Mailer.sync_message(defn).deliver&lt;br /&gt;
  end &lt;br /&gt;
&lt;br /&gt;
'''chat_email_query'''- Send an email to the author of an assignment when a reviewer posts a query&lt;br /&gt;
&lt;br /&gt;
  def self.chat_email_query(id,partial=&amp;quot;new_chatemail&amp;quot;)&lt;br /&gt;
    defn = Hash.new&lt;br /&gt;
    defn[:body] = Hash.new&lt;br /&gt;
    defn[:body][:partial_name] = partial&lt;br /&gt;
    assignment=nil&lt;br /&gt;
    @team_id=ReviewChat.find(id).team_id&lt;br /&gt;
    teams_users = TeamsUser.where(team_id: @team_id)&lt;br /&gt;
    to_mail_list = Array.new&lt;br /&gt;
    teams_users.each do |teams_user|&lt;br /&gt;
    to_mail_list &amp;lt;&amp;lt; User.find(teams_user.user_id).email &lt;br /&gt;
    end&lt;br /&gt;
    defn[:subject] = &amp;quot;Query posted for submission&amp;quot;&lt;br /&gt;
    defn[:body][:type] = &amp;quot; query has been posted for your submission .&lt;br /&gt;
    Please open the below URL to view and respond.&lt;br /&gt;
    http://expertiza.ncsu.edu/review_chats/show/#{id}&amp;quot;&lt;br /&gt;
    defn[:to] = to_mail_list&lt;br /&gt;
    Mailer.sync_message(defn).deliver&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
*New method in &lt;br /&gt;
&lt;br /&gt;
'''submitted_question'''- Create a chat record and send an email to the authors when a reviewer posts a query.&lt;br /&gt;
  def submitted_question&lt;br /&gt;
      @map = ResponseMap.find(params[:id])&lt;br /&gt;
      ReviewChat.create(:assignment_id =&amp;gt; @map.assignment.id,:reviewer_id =&amp;gt; @map.reviewer_id, :team_id=&amp;gt;@map.reviewee_id, :type_flag =&amp;gt; 'Q' , :content =&amp;gt; params[:review_question])&lt;br /&gt;
      flash[:notice]=&amp;quot;Question has been submitted to Author&amp;quot;&lt;br /&gt;
      @interaction_id=ReviewChat.where(:reviewer_id =&amp;gt; @map.reviewer_id).where(:team_id =&amp;gt; @map.reviewee_id)&lt;br /&gt;
      ReviewChatsHelper::chat_email_query(@interaction_id.first.id)&lt;br /&gt;
      redirect_to action: 'new', id: params[:id]&lt;br /&gt;
  end&lt;br /&gt;
*Create new views as discussed in the design.&lt;br /&gt;
&lt;br /&gt;
*Modify view expertiza/app/views/response/response.html.erb to incorporate text box and corresponding submit button.&lt;br /&gt;
&lt;br /&gt;
===Flowchart===&lt;br /&gt;
&lt;br /&gt;
[[File: ARSNFlowchart1.png]]&lt;br /&gt;
&lt;br /&gt;
===Screenshots===&lt;br /&gt;
&lt;br /&gt;
*The reviewer enters his question in the text area provided and clicks on the &amp;quot;Submit&amp;quot; button.&lt;br /&gt;
[[File: FinalProject1.jpg]]&lt;br /&gt;
*On clicking this button the appropriate method is called in ReviewChats controller which sends an email to all the authors of the topic indicating that a question has been asked about their work. The email contains a link which when clicked on will redirect the author to the appropriate view where he/she can answer the question.&lt;br /&gt;
[[File: FinalProject4.jpg]]&lt;br /&gt;
*On answering the question, the reviewer receives an email indicating that his question has been answered. It also contains a link which redirects the reviewer to the appropriate view where the answer will be displayed.&lt;br /&gt;
*The authorized users will also be able to see a link to open existing chat interaction log.&lt;br /&gt;
[[File: FinalProject3.jpg]]&lt;br /&gt;
*This view also contains the chat history between the author/s and the reviewer for the entire duration of the interaction.&lt;br /&gt;
[[File: FinalProject2.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Suggestions for Future Improvements ==&lt;br /&gt;
&lt;br /&gt;
* This can be extended to a live interactive author-reviewer anonymous chat session inside the Expertiza reviews window.&lt;br /&gt;
* A purging script can be developed which will clear all the interaction records every semester.&lt;br /&gt;
&lt;br /&gt;
==Resources==&lt;br /&gt;
&lt;br /&gt;
* Expertiza Github repository&amp;lt;ref&amp;gt;Expertiza Github repository https://github.com/expertiza/expertiza&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sgulati2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100183</id>
		<title>CSC/ECE 517 Fall 2015 E1586 AnonymousChatBetweenAuthorAndReviewer</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100183"/>
		<updated>2015-12-05T01:08:38Z</updated>

		<summary type="html">&lt;p&gt;Sgulati2: /* Code Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1586 AnonymousChatBetweenAuthorAndReviewer'''&lt;br /&gt;
&lt;br /&gt;
This page provides a brief description of the '''Expertiza''' project. The project is aimed at developing an email based anonymous session between author and a reviewer so that reviewers can ask questions to the authors for any doubts related to the assignments during peer reviewing.&lt;br /&gt;
&lt;br /&gt;
==Project==&lt;br /&gt;
&lt;br /&gt;
=== Introduction to Expertiza ===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a peer review based system which provides an incremental class based learning together with the instructors and the peers. This project has been developed together by faculty and students using [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza handles assignment submissions, team formations, assignment reviews and grades, etc.&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
During reviews, many times reviewers will be having questions about the submitted material and if it's a blocker there is no way that the reviewer can progress further with the review.  As a result, reviewers will end up submitting the empty or incomplete review.&lt;br /&gt;
&lt;br /&gt;
=== Scope ===&lt;br /&gt;
This project is limited to an email based conversation for asking questions and answers. The reviewers would ask questions related to assignment submission doubts to which authors can respond. All this would be taken care as email responses using a link provided in the email. This project does not cater to any live interactive session with spontaneous back-to-back questions and responses.&lt;br /&gt;
&lt;br /&gt;
Following tasks would be incorporated in the project:&lt;br /&gt;
* Provide a ‘TextArea’ input field on review forms, where any reviewer can type in their questions.&lt;br /&gt;
* Create a new button ‘Ask for Quick Help’ on the review forms.&lt;br /&gt;
* An email would be send to the author with the link where he can respond to the questions asked by the reviewers for their submitted work.&lt;br /&gt;
* Reviewers would be notified by an email when authors respond to the the questions.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Discussion of Resolution ===&lt;br /&gt;
&lt;br /&gt;
We will make the following modifications to implement the chat feature:- &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Create a new model which will help to extract, store and validate data in the database table which contains information about the interaction between the author/s and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Edit the view which is used by the response controller to incorporate the text area input field on the review form where the reviewer can ask his/her initial query.&lt;br /&gt;
&lt;br /&gt;
*Create a new controller with methods for authentication for a respective chat log only visible to the author and reviewer of a particular assignment, method to submit a response or a follow up query and show the existing interaction log.&lt;br /&gt;
&lt;br /&gt;
*Create a new helper with the e-mail methods for sending to the author and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Create a new view which will facilitate the author to respond to the queries asked by the reviewer. The reviewer can also use this view to ask any follow up questions.&lt;br /&gt;
&lt;br /&gt;
=== Design Patterns ===&lt;br /&gt;
The implementation team expects that the following design patterns be used in the solution:&lt;br /&gt;
 &lt;br /&gt;
* '''Observer Pattern'''&amp;lt;ref&amp;gt;Observer Design Pattern https://en.wikipedia.org/wiki/Observer_pattern&amp;lt;/ref&amp;gt;: The observer pattern is a software design pattern in which an object, called the subject, maintains a list of its dependents, called observers, and notifies them automatically of any state changes, usually by calling one of their methods. For example, we are notifying the team members whenever the reviewer submits the query.&lt;br /&gt;
&lt;br /&gt;
* '''Iterator Pattern''': In our instance, we need to display the entire chat history of a particular interaction, hence we can use the iterator design pattern to iterate through the previous chat messages.&lt;br /&gt;
&lt;br /&gt;
=== Database Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:Review_chats.png]]&lt;br /&gt;
&lt;br /&gt;
The above figure shows the schema of a new table which will be created in Expertiza to store relevant information about the chat. It contains the following attributes:&lt;br /&gt;
* id: This attribute is auto-generated by rails when we create a table and is auto incremented with each record. It is also the primary key of our table.&lt;br /&gt;
* assignment_id: Stores the ID of the assignment for which the interaction between author and reviewer is taking place.&lt;br /&gt;
* reviewer_id: Stores the ID of the reviewer who asks the questions.&lt;br /&gt;
* team_id: Stores the ID of the team to which the topic belongs.&lt;br /&gt;
* type_flag: Flag which is used to indicate if the particular tuple contains a question or answer. It can take two values, 'Q' for question and 'A' for answer.&lt;br /&gt;
* content: Stores the question asked by the reviewer or the response given by the author/s depending on the value of the type flag.&lt;br /&gt;
&lt;br /&gt;
Records for a particular interaction can be identified by using a combination of assignment_id, reviewer_id and team_id.&lt;br /&gt;
&lt;br /&gt;
=== Use Cases ===&lt;br /&gt;
'''Name:''' Send a question to the author/s about their work.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Reviewer. &amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The reviewer enters his question in the text area which is provided and clicks on the &amp;quot;Ask question&amp;quot; button which is provided as shown in the mock up. On clicking this button an email is sent to the author/s along which a link to answer the question.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''Name:''' Answer the question which has been asked by the reviewer.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Author/s&amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The author/s click on the link received in their email and are redirected to a page where they can answer the question. Once they submit the answer, an email is sent to the reviewer notifying him/her that their question has been answered.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:ARSNUsecase.jpeg]]&lt;br /&gt;
&lt;br /&gt;
=== Proposed Tests ===&lt;br /&gt;
1. For use case 1, test whether all the team members receive email with the question.&amp;lt;br/&amp;gt;&lt;br /&gt;
2. For use case 2, test whether the reviewer receive email with the response.&amp;lt;br/&amp;gt;&lt;br /&gt;
3. Test whether all the previous interactions are displayed as chat history.&amp;lt;br/&amp;gt;&lt;br /&gt;
4. The 'Ask Question' button should not be enabled until some text has been entered in the text area.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
===Code Implementation===&lt;br /&gt;
&lt;br /&gt;
*Model '''review_chat.rb''' to validate if the query box is empty and restrict the query length to 255 characters.&lt;br /&gt;
&lt;br /&gt;
  validates_length_of :content , :maximum =&amp;gt; 255,message: &amp;quot;Length must be less that 255 characters&amp;quot;&lt;br /&gt;
  validates_presence_of :content, message: &amp;quot;Content cannot be blank&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*Methods in the controller '''review_chats_controller.rb'''&lt;br /&gt;
&lt;br /&gt;
'''action_allowed?'''- Allow chat visibility to the reviewers and the authors of a particular interaction&lt;br /&gt;
&lt;br /&gt;
  def action_allowed?&lt;br /&gt;
    review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    allowed_users=Array.new&lt;br /&gt;
    team_id=review_chat.team_id&lt;br /&gt;
    teams_users = TeamsUser.where(team_id: team_id)&lt;br /&gt;
    teams_users.each do |teams_user|&lt;br /&gt;
      allowed_users &amp;lt;&amp;lt; User.find(teams_user.user_id).id&lt;br /&gt;
    end&lt;br /&gt;
    allowed_users &amp;lt;&amp;lt; Participant.find(review_chat.reviewer_id).user_id&lt;br /&gt;
    current_role_name.eql? 'Student' and allowed_users.include?(session[:user].id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''show'''- Show the chat interaction log&lt;br /&gt;
&lt;br /&gt;
  def show&lt;br /&gt;
    @review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    @assignment_id=@review_chat.assignment_id&lt;br /&gt;
    @reviewer_id=@review_chat.reviewer_id&lt;br /&gt;
    @team_id=@review_chat.team_id&lt;br /&gt;
    @chat_log=ReviewChat.where(:reviewer_id =&amp;gt; @reviewer_id).where(:team_id =&amp;gt; @team_id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''submitted_response'''- Send an email to the reviewer when an author replied to a query asked by the reviewer&lt;br /&gt;
&lt;br /&gt;
  def submitted_response&lt;br /&gt;
    @review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    @chat_reviewer=Participant.find(@review_chat.reviewer_id).user_id&lt;br /&gt;
    if(@chat_reviewer==session[:user].id) then&lt;br /&gt;
    	ReviewChat.create(:assignment_id =&amp;gt; @review_chat.assignment_id,:reviewer_id =&amp;gt; @review_chat.reviewer_id, :team_id=&amp;gt;@review_chat.team_id, :type_flag =&amp;gt; 'Q' , :content =&amp;gt; params[:response_area])&lt;br /&gt;
    	ReviewChatsHelper::chat_email_query(params[:id])&lt;br /&gt;
    	flash[:notice]=&amp;quot;Query has been submitted&amp;quot;	&lt;br /&gt;
    else	&lt;br /&gt;
      	ReviewChat.create(:assignment_id =&amp;gt; @review_chat.assignment_id,:reviewer_id =&amp;gt; @review_chat.reviewer_id, :team_id=&amp;gt;@review_chat.team_id, :type_flag =&amp;gt; 'A' , :content =&amp;gt; params[:response_area])&lt;br /&gt;
      	ReviewChatsHelper::chat_email_response(@review_chat.id,@chat_reviewer)&lt;br /&gt;
      flash[:notice]=&amp;quot;Response has been submitted&amp;quot;&lt;br /&gt;
    end	&lt;br /&gt;
    redirect_to action: 'show', id: params[:id]&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
*Methods in the helper file '''review_chats_helper.rb'''&lt;br /&gt;
&lt;br /&gt;
'''chat_email_response'''- Send an email to the author of an assignment when a reviewer posts a query&lt;br /&gt;
&lt;br /&gt;
  def self.chat_email_response(id,reviewer_id,partial=&amp;quot;new_chatemail&amp;quot;)&lt;br /&gt;
    defn = Hash.new&lt;br /&gt;
    defn[:body] = Hash.new&lt;br /&gt;
    defn[:body][:partial_name] = partial&lt;br /&gt;
    reviewer_email=User.find(reviewer_id).email&lt;br /&gt;
    defn[:subject] = &amp;quot;Response posted for submission&amp;quot;&lt;br /&gt;
    defn[:body][:type] = &amp;quot; response has been posted for your query .&lt;br /&gt;
    Please open the below URL to view.&lt;br /&gt;
    http://expertiza.ncsu.edu/review_chats/show/#{id}&amp;quot;&lt;br /&gt;
    defn[:to] = reviewer_email&lt;br /&gt;
    Mailer.sync_message(defn).deliver&lt;br /&gt;
  end &lt;br /&gt;
&lt;br /&gt;
'''chat_email_query'''- Send an email to the author of an assignment when a reviewer posts a query&lt;br /&gt;
&lt;br /&gt;
  def self.chat_email_query(id,partial=&amp;quot;new_chatemail&amp;quot;)&lt;br /&gt;
    defn = Hash.new&lt;br /&gt;
    defn[:body] = Hash.new&lt;br /&gt;
    defn[:body][:partial_name] = partial&lt;br /&gt;
    assignment=nil&lt;br /&gt;
    @team_id=ReviewChat.find(id).team_id&lt;br /&gt;
    teams_users = TeamsUser.where(team_id: @team_id)&lt;br /&gt;
    to_mail_list = Array.new&lt;br /&gt;
    teams_users.each do |teams_user|&lt;br /&gt;
    to_mail_list &amp;lt;&amp;lt; User.find(teams_user.user_id).email &lt;br /&gt;
    end&lt;br /&gt;
    defn[:subject] = &amp;quot;Query posted for submission&amp;quot;&lt;br /&gt;
    defn[:body][:type] = &amp;quot; query has been posted for your submission .&lt;br /&gt;
    Please open the below URL to view and respond.&lt;br /&gt;
    http://expertiza.ncsu.edu/review_chats/show/#{id}&amp;quot;&lt;br /&gt;
    defn[:to] = to_mail_list&lt;br /&gt;
    Mailer.sync_message(defn).deliver&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
*Create new views as discussed in the design.&lt;br /&gt;
&lt;br /&gt;
*Modify view expertiza/app/views/response/response.html.erb to incorporate text box and corresponding submit button.&lt;br /&gt;
&lt;br /&gt;
===Flowchart===&lt;br /&gt;
&lt;br /&gt;
[[File: ARSNFlowchart1.png]]&lt;br /&gt;
&lt;br /&gt;
===Screenshots===&lt;br /&gt;
&lt;br /&gt;
*The reviewer enters his question in the text area provided and clicks on the &amp;quot;Submit&amp;quot; button.&lt;br /&gt;
[[File: FinalProject1.jpg]]&lt;br /&gt;
*On clicking this button the appropriate method is called in ReviewChats controller which sends an email to all the authors of the topic indicating that a question has been asked about their work. The email contains a link which when clicked on will redirect the author to the appropriate view where he/she can answer the question.&lt;br /&gt;
[[File: FinalProject4.jpg]]&lt;br /&gt;
*On answering the question, the reviewer receives an email indicating that his question has been answered. It also contains a link which redirects the reviewer to the appropriate view where the answer will be displayed.&lt;br /&gt;
*The authorized users will also be able to see a link to open existing chat interaction log.&lt;br /&gt;
[[File: FinalProject3.jpg]]&lt;br /&gt;
*This view also contains the chat history between the author/s and the reviewer for the entire duration of the interaction.&lt;br /&gt;
[[File: FinalProject2.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Suggestions for Future Improvements ==&lt;br /&gt;
&lt;br /&gt;
* This can be extended to a live interactive author-reviewer anonymous chat session inside the Expertiza reviews window.&lt;br /&gt;
* A purging script can be developed which will clear all the interaction records every semester.&lt;br /&gt;
&lt;br /&gt;
==Resources==&lt;br /&gt;
&lt;br /&gt;
* Expertiza Github repository&amp;lt;ref&amp;gt;Expertiza Github repository https://github.com/expertiza/expertiza&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sgulati2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100182</id>
		<title>CSC/ECE 517 Fall 2015 E1586 AnonymousChatBetweenAuthorAndReviewer</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100182"/>
		<updated>2015-12-05T01:07:38Z</updated>

		<summary type="html">&lt;p&gt;Sgulati2: /* Code Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1586 AnonymousChatBetweenAuthorAndReviewer'''&lt;br /&gt;
&lt;br /&gt;
This page provides a brief description of the '''Expertiza''' project. The project is aimed at developing an email based anonymous session between author and a reviewer so that reviewers can ask questions to the authors for any doubts related to the assignments during peer reviewing.&lt;br /&gt;
&lt;br /&gt;
==Project==&lt;br /&gt;
&lt;br /&gt;
=== Introduction to Expertiza ===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a peer review based system which provides an incremental class based learning together with the instructors and the peers. This project has been developed together by faculty and students using [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza handles assignment submissions, team formations, assignment reviews and grades, etc.&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
During reviews, many times reviewers will be having questions about the submitted material and if it's a blocker there is no way that the reviewer can progress further with the review.  As a result, reviewers will end up submitting the empty or incomplete review.&lt;br /&gt;
&lt;br /&gt;
=== Scope ===&lt;br /&gt;
This project is limited to an email based conversation for asking questions and answers. The reviewers would ask questions related to assignment submission doubts to which authors can respond. All this would be taken care as email responses using a link provided in the email. This project does not cater to any live interactive session with spontaneous back-to-back questions and responses.&lt;br /&gt;
&lt;br /&gt;
Following tasks would be incorporated in the project:&lt;br /&gt;
* Provide a ‘TextArea’ input field on review forms, where any reviewer can type in their questions.&lt;br /&gt;
* Create a new button ‘Ask for Quick Help’ on the review forms.&lt;br /&gt;
* An email would be send to the author with the link where he can respond to the questions asked by the reviewers for their submitted work.&lt;br /&gt;
* Reviewers would be notified by an email when authors respond to the the questions.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Discussion of Resolution ===&lt;br /&gt;
&lt;br /&gt;
We will make the following modifications to implement the chat feature:- &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Create a new model which will help to extract, store and validate data in the database table which contains information about the interaction between the author/s and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Edit the view which is used by the response controller to incorporate the text area input field on the review form where the reviewer can ask his/her initial query.&lt;br /&gt;
&lt;br /&gt;
*Create a new controller with methods for authentication for a respective chat log only visible to the author and reviewer of a particular assignment, method to submit a response or a follow up query and show the existing interaction log.&lt;br /&gt;
&lt;br /&gt;
*Create a new helper with the e-mail methods for sending to the author and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Create a new view which will facilitate the author to respond to the queries asked by the reviewer. The reviewer can also use this view to ask any follow up questions.&lt;br /&gt;
&lt;br /&gt;
=== Design Patterns ===&lt;br /&gt;
The implementation team expects that the following design patterns be used in the solution:&lt;br /&gt;
 &lt;br /&gt;
* '''Observer Pattern'''&amp;lt;ref&amp;gt;Observer Design Pattern https://en.wikipedia.org/wiki/Observer_pattern&amp;lt;/ref&amp;gt;: The observer pattern is a software design pattern in which an object, called the subject, maintains a list of its dependents, called observers, and notifies them automatically of any state changes, usually by calling one of their methods. For example, we are notifying the team members whenever the reviewer submits the query.&lt;br /&gt;
&lt;br /&gt;
* '''Iterator Pattern''': In our instance, we need to display the entire chat history of a particular interaction, hence we can use the iterator design pattern to iterate through the previous chat messages.&lt;br /&gt;
&lt;br /&gt;
=== Database Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:Review_chats.png]]&lt;br /&gt;
&lt;br /&gt;
The above figure shows the schema of a new table which will be created in Expertiza to store relevant information about the chat. It contains the following attributes:&lt;br /&gt;
* id: This attribute is auto-generated by rails when we create a table and is auto incremented with each record. It is also the primary key of our table.&lt;br /&gt;
* assignment_id: Stores the ID of the assignment for which the interaction between author and reviewer is taking place.&lt;br /&gt;
* reviewer_id: Stores the ID of the reviewer who asks the questions.&lt;br /&gt;
* team_id: Stores the ID of the team to which the topic belongs.&lt;br /&gt;
* type_flag: Flag which is used to indicate if the particular tuple contains a question or answer. It can take two values, 'Q' for question and 'A' for answer.&lt;br /&gt;
* content: Stores the question asked by the reviewer or the response given by the author/s depending on the value of the type flag.&lt;br /&gt;
&lt;br /&gt;
Records for a particular interaction can be identified by using a combination of assignment_id, reviewer_id and team_id.&lt;br /&gt;
&lt;br /&gt;
=== Use Cases ===&lt;br /&gt;
'''Name:''' Send a question to the author/s about their work.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Reviewer. &amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The reviewer enters his question in the text area which is provided and clicks on the &amp;quot;Ask question&amp;quot; button which is provided as shown in the mock up. On clicking this button an email is sent to the author/s along which a link to answer the question.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''Name:''' Answer the question which has been asked by the reviewer.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Author/s&amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The author/s click on the link received in their email and are redirected to a page where they can answer the question. Once they submit the answer, an email is sent to the reviewer notifying him/her that their question has been answered.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:ARSNUsecase.jpeg]]&lt;br /&gt;
&lt;br /&gt;
=== Proposed Tests ===&lt;br /&gt;
1. For use case 1, test whether all the team members receive email with the question.&amp;lt;br/&amp;gt;&lt;br /&gt;
2. For use case 2, test whether the reviewer receive email with the response.&amp;lt;br/&amp;gt;&lt;br /&gt;
3. Test whether all the previous interactions are displayed as chat history.&amp;lt;br/&amp;gt;&lt;br /&gt;
4. The 'Ask Question' button should not be enabled until some text has been entered in the text area.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
===Code Implementation===&lt;br /&gt;
&lt;br /&gt;
*Model '''review_chat.rb''' to validate if the query box is empty and restrict the query length to 255 characters.&lt;br /&gt;
&lt;br /&gt;
  validates_length_of :content , :maximum =&amp;gt; 255,message: &amp;quot;Length must be less that 255 characters&amp;quot;&lt;br /&gt;
  validates_presence_of :content, message: &amp;quot;Content cannot be blank&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*Methods in the controller '''review_chats_controller.rb'''&lt;br /&gt;
&lt;br /&gt;
'''action_allowed?'''- Allow chat visibility to the reviewers and the authors of a particular interaction&lt;br /&gt;
&lt;br /&gt;
  def action_allowed?&lt;br /&gt;
    review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    allowed_users=Array.new&lt;br /&gt;
    team_id=review_chat.team_id&lt;br /&gt;
    teams_users = TeamsUser.where(team_id: team_id)&lt;br /&gt;
    teams_users.each do |teams_user|&lt;br /&gt;
      allowed_users &amp;lt;&amp;lt; User.find(teams_user.user_id).id&lt;br /&gt;
    end&lt;br /&gt;
    allowed_users &amp;lt;&amp;lt; Participant.find(review_chat.reviewer_id).user_id&lt;br /&gt;
    current_role_name.eql? 'Student' and allowed_users.include?(session[:user].id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''show'''- Show the chat interaction log&lt;br /&gt;
&lt;br /&gt;
  def show&lt;br /&gt;
    @review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    @assignment_id=@review_chat.assignment_id&lt;br /&gt;
    @reviewer_id=@review_chat.reviewer_id&lt;br /&gt;
    @team_id=@review_chat.team_id&lt;br /&gt;
    @chat_log=ReviewChat.where(:reviewer_id =&amp;gt; @reviewer_id).where(:team_id =&amp;gt; @team_id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''submitted_response'''- Send an email to the reviewer when an author replied to a query asked by the reviewer&lt;br /&gt;
&lt;br /&gt;
  def submitted_response&lt;br /&gt;
    @review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    @chat_reviewer=Participant.find(@review_chat.reviewer_id).user_id&lt;br /&gt;
    if(@chat_reviewer==session[:user].id) then&lt;br /&gt;
    	ReviewChat.create(:assignment_id =&amp;gt; @review_chat.assignment_id,:reviewer_id =&amp;gt; @review_chat.reviewer_id, :team_id=&amp;gt;@review_chat.team_id, :type_flag =&amp;gt; 'Q' , :content =&amp;gt; params[:response_area])&lt;br /&gt;
    	ReviewChatsHelper::chat_email_query(params[:id])&lt;br /&gt;
    	flash[:notice]=&amp;quot;Query has been submitted&amp;quot;	&lt;br /&gt;
    else	&lt;br /&gt;
      	ReviewChat.create(:assignment_id =&amp;gt; @review_chat.assignment_id,:reviewer_id =&amp;gt; @review_chat.reviewer_id, :team_id=&amp;gt;@review_chat.team_id, :type_flag =&amp;gt; 'A' , :content =&amp;gt; params[:response_area])&lt;br /&gt;
      	ReviewChatsHelper::chat_email_response(@review_chat.id,@chat_reviewer)&lt;br /&gt;
      flash[:notice]=&amp;quot;Response has been submitted&amp;quot;&lt;br /&gt;
    end	&lt;br /&gt;
    redirect_to action: 'show', id: params[:id]&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
*Methods in the helper file '''review_chats_helper.rb'''&lt;br /&gt;
&lt;br /&gt;
'''chat_email_response'''- Send an email to the author of an assignment when a reviewer posts a query&lt;br /&gt;
&lt;br /&gt;
def self.chat_email_response(id,reviewer_id,partial=&amp;quot;new_chatemail&amp;quot;)&lt;br /&gt;
    defn = Hash.new&lt;br /&gt;
    defn[:body] = Hash.new&lt;br /&gt;
    defn[:body][:partial_name] = partial&lt;br /&gt;
    reviewer_email=User.find(reviewer_id).email&lt;br /&gt;
    defn[:subject] = &amp;quot;Response posted for submission&amp;quot;&lt;br /&gt;
    defn[:body][:type] = &amp;quot; response has been posted for your query .&lt;br /&gt;
    Please open the below URL to view.&lt;br /&gt;
    http://expertiza.ncsu.edu/review_chats/show/#{id}&amp;quot;&lt;br /&gt;
    defn[:to] = reviewer_email&lt;br /&gt;
    Mailer.sync_message(defn).deliver&lt;br /&gt;
  end &lt;br /&gt;
&lt;br /&gt;
'''chat_email_query'''- Send an email to the author of an assignment when a reviewer posts a query&lt;br /&gt;
&lt;br /&gt;
def self.chat_email_query(id,partial=&amp;quot;new_chatemail&amp;quot;)&lt;br /&gt;
  defn = Hash.new&lt;br /&gt;
  defn[:body] = Hash.new&lt;br /&gt;
  defn[:body][:partial_name] = partial&lt;br /&gt;
  assignment=nil&lt;br /&gt;
  @team_id=ReviewChat.find(id).team_id&lt;br /&gt;
  teams_users = TeamsUser.where(team_id: @team_id)&lt;br /&gt;
  to_mail_list = Array.new&lt;br /&gt;
  teams_users.each do |teams_user|&lt;br /&gt;
  to_mail_list &amp;lt;&amp;lt; User.find(teams_user.user_id).email &lt;br /&gt;
  end&lt;br /&gt;
  defn[:subject] = &amp;quot;Query posted for submission&amp;quot;&lt;br /&gt;
  defn[:body][:type] = &amp;quot; query has been posted for your submission .&lt;br /&gt;
  Please open the below URL to view and respond.&lt;br /&gt;
  http://expertiza.ncsu.edu/review_chats/show/#{id}&amp;quot;&lt;br /&gt;
  defn[:to] = to_mail_list&lt;br /&gt;
  Mailer.sync_message(defn).deliver&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
*Create new views as discussed in the design.&lt;br /&gt;
&lt;br /&gt;
*Modify view expertiza/app/views/response/response.html.erb to incorporate text box and corresponding submit button.&lt;br /&gt;
&lt;br /&gt;
===Flowchart===&lt;br /&gt;
&lt;br /&gt;
[[File: ARSNFlowchart1.png]]&lt;br /&gt;
&lt;br /&gt;
===Screenshots===&lt;br /&gt;
&lt;br /&gt;
*The reviewer enters his question in the text area provided and clicks on the &amp;quot;Submit&amp;quot; button.&lt;br /&gt;
[[File: FinalProject1.jpg]]&lt;br /&gt;
*On clicking this button the appropriate method is called in ReviewChats controller which sends an email to all the authors of the topic indicating that a question has been asked about their work. The email contains a link which when clicked on will redirect the author to the appropriate view where he/she can answer the question.&lt;br /&gt;
[[File: FinalProject4.jpg]]&lt;br /&gt;
*On answering the question, the reviewer receives an email indicating that his question has been answered. It also contains a link which redirects the reviewer to the appropriate view where the answer will be displayed.&lt;br /&gt;
*The authorized users will also be able to see a link to open existing chat interaction log.&lt;br /&gt;
[[File: FinalProject3.jpg]]&lt;br /&gt;
*This view also contains the chat history between the author/s and the reviewer for the entire duration of the interaction.&lt;br /&gt;
[[File: FinalProject2.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Suggestions for Future Improvements ==&lt;br /&gt;
&lt;br /&gt;
* This can be extended to a live interactive author-reviewer anonymous chat session inside the Expertiza reviews window.&lt;br /&gt;
* A purging script can be developed which will clear all the interaction records every semester.&lt;br /&gt;
&lt;br /&gt;
==Resources==&lt;br /&gt;
&lt;br /&gt;
* Expertiza Github repository&amp;lt;ref&amp;gt;Expertiza Github repository https://github.com/expertiza/expertiza&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sgulati2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100181</id>
		<title>CSC/ECE 517 Fall 2015 E1586 AnonymousChatBetweenAuthorAndReviewer</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100181"/>
		<updated>2015-12-05T01:06:46Z</updated>

		<summary type="html">&lt;p&gt;Sgulati2: /* Code Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1586 AnonymousChatBetweenAuthorAndReviewer'''&lt;br /&gt;
&lt;br /&gt;
This page provides a brief description of the '''Expertiza''' project. The project is aimed at developing an email based anonymous session between author and a reviewer so that reviewers can ask questions to the authors for any doubts related to the assignments during peer reviewing.&lt;br /&gt;
&lt;br /&gt;
==Project==&lt;br /&gt;
&lt;br /&gt;
=== Introduction to Expertiza ===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a peer review based system which provides an incremental class based learning together with the instructors and the peers. This project has been developed together by faculty and students using [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza handles assignment submissions, team formations, assignment reviews and grades, etc.&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
During reviews, many times reviewers will be having questions about the submitted material and if it's a blocker there is no way that the reviewer can progress further with the review.  As a result, reviewers will end up submitting the empty or incomplete review.&lt;br /&gt;
&lt;br /&gt;
=== Scope ===&lt;br /&gt;
This project is limited to an email based conversation for asking questions and answers. The reviewers would ask questions related to assignment submission doubts to which authors can respond. All this would be taken care as email responses using a link provided in the email. This project does not cater to any live interactive session with spontaneous back-to-back questions and responses.&lt;br /&gt;
&lt;br /&gt;
Following tasks would be incorporated in the project:&lt;br /&gt;
* Provide a ‘TextArea’ input field on review forms, where any reviewer can type in their questions.&lt;br /&gt;
* Create a new button ‘Ask for Quick Help’ on the review forms.&lt;br /&gt;
* An email would be send to the author with the link where he can respond to the questions asked by the reviewers for their submitted work.&lt;br /&gt;
* Reviewers would be notified by an email when authors respond to the the questions.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Discussion of Resolution ===&lt;br /&gt;
&lt;br /&gt;
We will make the following modifications to implement the chat feature:- &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Create a new model which will help to extract, store and validate data in the database table which contains information about the interaction between the author/s and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Edit the view which is used by the response controller to incorporate the text area input field on the review form where the reviewer can ask his/her initial query.&lt;br /&gt;
&lt;br /&gt;
*Create a new controller with methods for authentication for a respective chat log only visible to the author and reviewer of a particular assignment, method to submit a response or a follow up query and show the existing interaction log.&lt;br /&gt;
&lt;br /&gt;
*Create a new helper with the e-mail methods for sending to the author and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Create a new view which will facilitate the author to respond to the queries asked by the reviewer. The reviewer can also use this view to ask any follow up questions.&lt;br /&gt;
&lt;br /&gt;
=== Design Patterns ===&lt;br /&gt;
The implementation team expects that the following design patterns be used in the solution:&lt;br /&gt;
 &lt;br /&gt;
* '''Observer Pattern'''&amp;lt;ref&amp;gt;Observer Design Pattern https://en.wikipedia.org/wiki/Observer_pattern&amp;lt;/ref&amp;gt;: The observer pattern is a software design pattern in which an object, called the subject, maintains a list of its dependents, called observers, and notifies them automatically of any state changes, usually by calling one of their methods. For example, we are notifying the team members whenever the reviewer submits the query.&lt;br /&gt;
&lt;br /&gt;
* '''Iterator Pattern''': In our instance, we need to display the entire chat history of a particular interaction, hence we can use the iterator design pattern to iterate through the previous chat messages.&lt;br /&gt;
&lt;br /&gt;
=== Database Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:Review_chats.png]]&lt;br /&gt;
&lt;br /&gt;
The above figure shows the schema of a new table which will be created in Expertiza to store relevant information about the chat. It contains the following attributes:&lt;br /&gt;
* id: This attribute is auto-generated by rails when we create a table and is auto incremented with each record. It is also the primary key of our table.&lt;br /&gt;
* assignment_id: Stores the ID of the assignment for which the interaction between author and reviewer is taking place.&lt;br /&gt;
* reviewer_id: Stores the ID of the reviewer who asks the questions.&lt;br /&gt;
* team_id: Stores the ID of the team to which the topic belongs.&lt;br /&gt;
* type_flag: Flag which is used to indicate if the particular tuple contains a question or answer. It can take two values, 'Q' for question and 'A' for answer.&lt;br /&gt;
* content: Stores the question asked by the reviewer or the response given by the author/s depending on the value of the type flag.&lt;br /&gt;
&lt;br /&gt;
Records for a particular interaction can be identified by using a combination of assignment_id, reviewer_id and team_id.&lt;br /&gt;
&lt;br /&gt;
=== Use Cases ===&lt;br /&gt;
'''Name:''' Send a question to the author/s about their work.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Reviewer. &amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The reviewer enters his question in the text area which is provided and clicks on the &amp;quot;Ask question&amp;quot; button which is provided as shown in the mock up. On clicking this button an email is sent to the author/s along which a link to answer the question.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''Name:''' Answer the question which has been asked by the reviewer.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Author/s&amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The author/s click on the link received in their email and are redirected to a page where they can answer the question. Once they submit the answer, an email is sent to the reviewer notifying him/her that their question has been answered.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:ARSNUsecase.jpeg]]&lt;br /&gt;
&lt;br /&gt;
=== Proposed Tests ===&lt;br /&gt;
1. For use case 1, test whether all the team members receive email with the question.&amp;lt;br/&amp;gt;&lt;br /&gt;
2. For use case 2, test whether the reviewer receive email with the response.&amp;lt;br/&amp;gt;&lt;br /&gt;
3. Test whether all the previous interactions are displayed as chat history.&amp;lt;br/&amp;gt;&lt;br /&gt;
4. The 'Ask Question' button should not be enabled until some text has been entered in the text area.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
===Code Implementation===&lt;br /&gt;
&lt;br /&gt;
*Model '''review_chat.rb''' to validate if the query box is empty and restrict the query length to 255 characters.&lt;br /&gt;
&lt;br /&gt;
  validates_length_of :content , :maximum =&amp;gt; 255,message: &amp;quot;Length must be less that 255 characters&amp;quot;&lt;br /&gt;
  validates_presence_of :content, message: &amp;quot;Content cannot be blank&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*Methods in the controller '''review_chats_controller.rb'''&lt;br /&gt;
&lt;br /&gt;
'''action_allowed?'''- Allow chat visibility to the reviewers and the authors of a particular interaction&lt;br /&gt;
&lt;br /&gt;
  def action_allowed?&lt;br /&gt;
    review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    allowed_users=Array.new&lt;br /&gt;
    team_id=review_chat.team_id&lt;br /&gt;
    teams_users = TeamsUser.where(team_id: team_id)&lt;br /&gt;
    teams_users.each do |teams_user|&lt;br /&gt;
      allowed_users &amp;lt;&amp;lt; User.find(teams_user.user_id).id&lt;br /&gt;
    end&lt;br /&gt;
    allowed_users &amp;lt;&amp;lt; Participant.find(review_chat.reviewer_id).user_id&lt;br /&gt;
    current_role_name.eql? 'Student' and allowed_users.include?(session[:user].id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''show'''- Show the chat interaction log&lt;br /&gt;
&lt;br /&gt;
  def show&lt;br /&gt;
    @review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    @assignment_id=@review_chat.assignment_id&lt;br /&gt;
    @reviewer_id=@review_chat.reviewer_id&lt;br /&gt;
    @team_id=@review_chat.team_id&lt;br /&gt;
    @chat_log=ReviewChat.where(:reviewer_id =&amp;gt; @reviewer_id).where(:team_id =&amp;gt; @team_id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''submitted_response'''- Send an email to the reviewer when an author replied to a query asked by the reviewer. &lt;br /&gt;
&lt;br /&gt;
  def submitted_response&lt;br /&gt;
    @review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    @chat_reviewer=Participant.find(@review_chat.reviewer_id).user_id&lt;br /&gt;
    if(@chat_reviewer==session[:user].id) then&lt;br /&gt;
    	ReviewChat.create(:assignment_id =&amp;gt; @review_chat.assignment_id,:reviewer_id =&amp;gt; @review_chat.reviewer_id, :team_id=&amp;gt;@review_chat.team_id, :type_flag =&amp;gt; 'Q' , :content =&amp;gt; params[:response_area])&lt;br /&gt;
    	ReviewChatsHelper::chat_email_query(params[:id])&lt;br /&gt;
    	flash[:notice]=&amp;quot;Query has been submitted&amp;quot;	&lt;br /&gt;
    else	&lt;br /&gt;
      	ReviewChat.create(:assignment_id =&amp;gt; @review_chat.assignment_id,:reviewer_id =&amp;gt; @review_chat.reviewer_id, :team_id=&amp;gt;@review_chat.team_id, :type_flag =&amp;gt; 'A' , :content =&amp;gt; params[:response_area])&lt;br /&gt;
      	ReviewChatsHelper::chat_email_response(@review_chat.id,@chat_reviewer)&lt;br /&gt;
      flash[:notice]=&amp;quot;Response has been submitted&amp;quot;&lt;br /&gt;
    end	&lt;br /&gt;
    redirect_to action: 'show', id: params[:id]&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
*Methods in the helper file '''review_chats_helper.rb'''&lt;br /&gt;
&lt;br /&gt;
'''chat_email_response'''- Send an email to the author of an assignment when a reviewer posts a query.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def self.chat_email_response(id,reviewer_id,partial=&amp;quot;new_chatemail&amp;quot;)&lt;br /&gt;
    defn = Hash.new&lt;br /&gt;
    defn[:body] = Hash.new&lt;br /&gt;
    defn[:body][:partial_name] = partial&lt;br /&gt;
    reviewer_email=User.find(reviewer_id).email&lt;br /&gt;
    defn[:subject] = &amp;quot;Response posted for submission&amp;quot;&lt;br /&gt;
    defn[:body][:type] = &amp;quot; response has been posted for your query .&lt;br /&gt;
    Please open the below URL to view.&lt;br /&gt;
    http://expertiza.ncsu.edu/review_chats/show/#{id}&amp;quot;&lt;br /&gt;
    defn[:to] = reviewer_email&lt;br /&gt;
    Mailer.sync_message(defn).deliver&lt;br /&gt;
  end &lt;br /&gt;
&lt;br /&gt;
'''chat_email_query'''- Send an email to the author of an assignment when a reviewer posts a query.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def self.chat_email_query(id,partial=&amp;quot;new_chatemail&amp;quot;)&lt;br /&gt;
  defn = Hash.new&lt;br /&gt;
  defn[:body] = Hash.new&lt;br /&gt;
  defn[:body][:partial_name] = partial&lt;br /&gt;
  assignment=nil&lt;br /&gt;
  @team_id=ReviewChat.find(id).team_id&lt;br /&gt;
  teams_users = TeamsUser.where(team_id: @team_id)&lt;br /&gt;
  to_mail_list = Array.new&lt;br /&gt;
  teams_users.each do |teams_user|&lt;br /&gt;
  to_mail_list &amp;lt;&amp;lt; User.find(teams_user.user_id).email &lt;br /&gt;
  end&lt;br /&gt;
  defn[:subject] = &amp;quot;Query posted for submission&amp;quot;&lt;br /&gt;
  defn[:body][:type] = &amp;quot; query has been posted for your submission .&lt;br /&gt;
  Please open the below URL to view and respond.&lt;br /&gt;
  http://expertiza.ncsu.edu/review_chats/show/#{id}&amp;quot;&lt;br /&gt;
  defn[:to] = to_mail_list&lt;br /&gt;
  Mailer.sync_message(defn).deliver&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
*Create new views as discussed in the design.&lt;br /&gt;
&lt;br /&gt;
*Modify view expertiza/app/views/response/response.html.erb to incorporate text box and corresponding submit button.&lt;br /&gt;
&lt;br /&gt;
===Flowchart===&lt;br /&gt;
&lt;br /&gt;
[[File: ARSNFlowchart1.png]]&lt;br /&gt;
&lt;br /&gt;
===Screenshots===&lt;br /&gt;
&lt;br /&gt;
*The reviewer enters his question in the text area provided and clicks on the &amp;quot;Submit&amp;quot; button.&lt;br /&gt;
[[File: FinalProject1.jpg]]&lt;br /&gt;
*On clicking this button the appropriate method is called in ReviewChats controller which sends an email to all the authors of the topic indicating that a question has been asked about their work. The email contains a link which when clicked on will redirect the author to the appropriate view where he/she can answer the question.&lt;br /&gt;
[[File: FinalProject4.jpg]]&lt;br /&gt;
*On answering the question, the reviewer receives an email indicating that his question has been answered. It also contains a link which redirects the reviewer to the appropriate view where the answer will be displayed.&lt;br /&gt;
*The authorized users will also be able to see a link to open existing chat interaction log.&lt;br /&gt;
[[File: FinalProject3.jpg]]&lt;br /&gt;
*This view also contains the chat history between the author/s and the reviewer for the entire duration of the interaction.&lt;br /&gt;
[[File: FinalProject2.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Suggestions for Future Improvements ==&lt;br /&gt;
&lt;br /&gt;
* This can be extended to a live interactive author-reviewer anonymous chat session inside the Expertiza reviews window.&lt;br /&gt;
* A purging script can be developed which will clear all the interaction records every semester.&lt;br /&gt;
&lt;br /&gt;
==Resources==&lt;br /&gt;
&lt;br /&gt;
* Expertiza Github repository&amp;lt;ref&amp;gt;Expertiza Github repository https://github.com/expertiza/expertiza&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sgulati2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100180</id>
		<title>CSC/ECE 517 Fall 2015 E1586 AnonymousChatBetweenAuthorAndReviewer</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100180"/>
		<updated>2015-12-05T01:06:12Z</updated>

		<summary type="html">&lt;p&gt;Sgulati2: /* Code Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1586 AnonymousChatBetweenAuthorAndReviewer'''&lt;br /&gt;
&lt;br /&gt;
This page provides a brief description of the '''Expertiza''' project. The project is aimed at developing an email based anonymous session between author and a reviewer so that reviewers can ask questions to the authors for any doubts related to the assignments during peer reviewing.&lt;br /&gt;
&lt;br /&gt;
==Project==&lt;br /&gt;
&lt;br /&gt;
=== Introduction to Expertiza ===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a peer review based system which provides an incremental class based learning together with the instructors and the peers. This project has been developed together by faculty and students using [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza handles assignment submissions, team formations, assignment reviews and grades, etc.&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
During reviews, many times reviewers will be having questions about the submitted material and if it's a blocker there is no way that the reviewer can progress further with the review.  As a result, reviewers will end up submitting the empty or incomplete review.&lt;br /&gt;
&lt;br /&gt;
=== Scope ===&lt;br /&gt;
This project is limited to an email based conversation for asking questions and answers. The reviewers would ask questions related to assignment submission doubts to which authors can respond. All this would be taken care as email responses using a link provided in the email. This project does not cater to any live interactive session with spontaneous back-to-back questions and responses.&lt;br /&gt;
&lt;br /&gt;
Following tasks would be incorporated in the project:&lt;br /&gt;
* Provide a ‘TextArea’ input field on review forms, where any reviewer can type in their questions.&lt;br /&gt;
* Create a new button ‘Ask for Quick Help’ on the review forms.&lt;br /&gt;
* An email would be send to the author with the link where he can respond to the questions asked by the reviewers for their submitted work.&lt;br /&gt;
* Reviewers would be notified by an email when authors respond to the the questions.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Discussion of Resolution ===&lt;br /&gt;
&lt;br /&gt;
We will make the following modifications to implement the chat feature:- &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Create a new model which will help to extract, store and validate data in the database table which contains information about the interaction between the author/s and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Edit the view which is used by the response controller to incorporate the text area input field on the review form where the reviewer can ask his/her initial query.&lt;br /&gt;
&lt;br /&gt;
*Create a new controller with methods for authentication for a respective chat log only visible to the author and reviewer of a particular assignment, method to submit a response or a follow up query and show the existing interaction log.&lt;br /&gt;
&lt;br /&gt;
*Create a new helper with the e-mail methods for sending to the author and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Create a new view which will facilitate the author to respond to the queries asked by the reviewer. The reviewer can also use this view to ask any follow up questions.&lt;br /&gt;
&lt;br /&gt;
=== Design Patterns ===&lt;br /&gt;
The implementation team expects that the following design patterns be used in the solution:&lt;br /&gt;
 &lt;br /&gt;
* '''Observer Pattern'''&amp;lt;ref&amp;gt;Observer Design Pattern https://en.wikipedia.org/wiki/Observer_pattern&amp;lt;/ref&amp;gt;: The observer pattern is a software design pattern in which an object, called the subject, maintains a list of its dependents, called observers, and notifies them automatically of any state changes, usually by calling one of their methods. For example, we are notifying the team members whenever the reviewer submits the query.&lt;br /&gt;
&lt;br /&gt;
* '''Iterator Pattern''': In our instance, we need to display the entire chat history of a particular interaction, hence we can use the iterator design pattern to iterate through the previous chat messages.&lt;br /&gt;
&lt;br /&gt;
=== Database Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:Review_chats.png]]&lt;br /&gt;
&lt;br /&gt;
The above figure shows the schema of a new table which will be created in Expertiza to store relevant information about the chat. It contains the following attributes:&lt;br /&gt;
* id: This attribute is auto-generated by rails when we create a table and is auto incremented with each record. It is also the primary key of our table.&lt;br /&gt;
* assignment_id: Stores the ID of the assignment for which the interaction between author and reviewer is taking place.&lt;br /&gt;
* reviewer_id: Stores the ID of the reviewer who asks the questions.&lt;br /&gt;
* team_id: Stores the ID of the team to which the topic belongs.&lt;br /&gt;
* type_flag: Flag which is used to indicate if the particular tuple contains a question or answer. It can take two values, 'Q' for question and 'A' for answer.&lt;br /&gt;
* content: Stores the question asked by the reviewer or the response given by the author/s depending on the value of the type flag.&lt;br /&gt;
&lt;br /&gt;
Records for a particular interaction can be identified by using a combination of assignment_id, reviewer_id and team_id.&lt;br /&gt;
&lt;br /&gt;
=== Use Cases ===&lt;br /&gt;
'''Name:''' Send a question to the author/s about their work.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Reviewer. &amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The reviewer enters his question in the text area which is provided and clicks on the &amp;quot;Ask question&amp;quot; button which is provided as shown in the mock up. On clicking this button an email is sent to the author/s along which a link to answer the question.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''Name:''' Answer the question which has been asked by the reviewer.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Author/s&amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The author/s click on the link received in their email and are redirected to a page where they can answer the question. Once they submit the answer, an email is sent to the reviewer notifying him/her that their question has been answered.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:ARSNUsecase.jpeg]]&lt;br /&gt;
&lt;br /&gt;
=== Proposed Tests ===&lt;br /&gt;
1. For use case 1, test whether all the team members receive email with the question.&amp;lt;br/&amp;gt;&lt;br /&gt;
2. For use case 2, test whether the reviewer receive email with the response.&amp;lt;br/&amp;gt;&lt;br /&gt;
3. Test whether all the previous interactions are displayed as chat history.&amp;lt;br/&amp;gt;&lt;br /&gt;
4. The 'Ask Question' button should not be enabled until some text has been entered in the text area.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
===Code Implementation===&lt;br /&gt;
&lt;br /&gt;
*Model '''review_chat.rb''' to validate if the query box is empty and restrict the query length to 255 characters.&lt;br /&gt;
&lt;br /&gt;
  validates_length_of :content , :maximum =&amp;gt; 255,message: &amp;quot;Length must be less that 255 characters&amp;quot;&lt;br /&gt;
  validates_presence_of :content, message: &amp;quot;Content cannot be blank&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*Methods in the controller '''review_chats_controller.rb'''&lt;br /&gt;
&lt;br /&gt;
'''action_allowed?'''- Allow chat visibility to the reviewers and the authors of a particular interaction&lt;br /&gt;
&lt;br /&gt;
  def action_allowed?&lt;br /&gt;
    review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    allowed_users=Array.new&lt;br /&gt;
    team_id=review_chat.team_id&lt;br /&gt;
    teams_users = TeamsUser.where(team_id: team_id)&lt;br /&gt;
    teams_users.each do |teams_user|&lt;br /&gt;
      allowed_users &amp;lt;&amp;lt; User.find(teams_user.user_id).id&lt;br /&gt;
    end&lt;br /&gt;
    allowed_users &amp;lt;&amp;lt; Participant.find(review_chat.reviewer_id).user_id&lt;br /&gt;
    current_role_name.eql? 'Student' and allowed_users.include?(session[:user].id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''show'''- Show the chat interaction log&lt;br /&gt;
&lt;br /&gt;
  def show&lt;br /&gt;
    @review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    @assignment_id=@review_chat.assignment_id&lt;br /&gt;
    @reviewer_id=@review_chat.reviewer_id&lt;br /&gt;
    @team_id=@review_chat.team_id&lt;br /&gt;
    @chat_log=ReviewChat.where(:reviewer_id =&amp;gt; @reviewer_id).where(:team_id =&amp;gt; @team_id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''submitted_response'''- Send an email to the reviewer when an author replied to a query asked by the reviewer. &lt;br /&gt;
&lt;br /&gt;
  def submitted_response&lt;br /&gt;
    @review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    @chat_reviewer=Participant.find(@review_chat.reviewer_id).user_id&lt;br /&gt;
    if(@chat_reviewer==session[:user].id) then&lt;br /&gt;
    	ReviewChat.create(:assignment_id =&amp;gt; @review_chat.assignment_id,:reviewer_id =&amp;gt; @review_chat.reviewer_id, :team_id=&amp;gt;@review_chat.team_id, :type_flag =&amp;gt; 'Q' , :content =&amp;gt; params[:response_area])&lt;br /&gt;
    	ReviewChatsHelper::chat_email_query(params[:id])&lt;br /&gt;
    	flash[:notice]=&amp;quot;Query has been submitted&amp;quot;	&lt;br /&gt;
    else	&lt;br /&gt;
      	ReviewChat.create(:assignment_id =&amp;gt; @review_chat.assignment_id,:reviewer_id =&amp;gt; @review_chat.reviewer_id, :team_id=&amp;gt;@review_chat.team_id, :type_flag =&amp;gt; 'A' , :content =&amp;gt; params[:response_area])&lt;br /&gt;
      	ReviewChatsHelper::chat_email_response(@review_chat.id,@chat_reviewer)&lt;br /&gt;
      flash[:notice]=&amp;quot;Response has been submitted&amp;quot;&lt;br /&gt;
    end	&lt;br /&gt;
    redirect_to action: 'show', id: params[:id]&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
*Methods in the helper file '''review_chats_helper.rb'''&lt;br /&gt;
&lt;br /&gt;
'''chat_email_response'''- Send an email to the author of an assignment when a reviewer posts a query.&lt;br /&gt;
&lt;br /&gt;
def self.chat_email_response(id,reviewer_id,partial=&amp;quot;new_chatemail&amp;quot;)&lt;br /&gt;
    defn = Hash.new&lt;br /&gt;
    defn[:body] = Hash.new&lt;br /&gt;
    defn[:body][:partial_name] = partial&lt;br /&gt;
    reviewer_email=User.find(reviewer_id).email&lt;br /&gt;
    defn[:subject] = &amp;quot;Response posted for submission&amp;quot;&lt;br /&gt;
    defn[:body][:type] = &amp;quot; response has been posted for your query .&lt;br /&gt;
    Please open the below URL to view.&lt;br /&gt;
    http://expertiza.ncsu.edu/review_chats/show/#{id}&amp;quot;&lt;br /&gt;
    defn[:to] = reviewer_email&lt;br /&gt;
    Mailer.sync_message(defn).deliver&lt;br /&gt;
  end &lt;br /&gt;
&lt;br /&gt;
'''chat_email_query'''- Send an email to the author of an assignment when a reviewer posts a query.&lt;br /&gt;
&lt;br /&gt;
def self.chat_email_query(id,partial=&amp;quot;new_chatemail&amp;quot;)&lt;br /&gt;
  defn = Hash.new&lt;br /&gt;
  defn[:body] = Hash.new&lt;br /&gt;
  defn[:body][:partial_name] = partial&lt;br /&gt;
  assignment=nil&lt;br /&gt;
  @team_id=ReviewChat.find(id).team_id&lt;br /&gt;
  teams_users = TeamsUser.where(team_id: @team_id)&lt;br /&gt;
  to_mail_list = Array.new&lt;br /&gt;
  teams_users.each do |teams_user|&lt;br /&gt;
  to_mail_list &amp;lt;&amp;lt; User.find(teams_user.user_id).email &lt;br /&gt;
  end&lt;br /&gt;
  defn[:subject] = &amp;quot;Query posted for submission&amp;quot;&lt;br /&gt;
  defn[:body][:type] = &amp;quot; query has been posted for your submission .&lt;br /&gt;
  Please open the below URL to view and respond.&lt;br /&gt;
  http://expertiza.ncsu.edu/review_chats/show/#{id}&amp;quot;&lt;br /&gt;
  defn[:to] = to_mail_list&lt;br /&gt;
  Mailer.sync_message(defn).deliver&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
*Create new views as discussed in the design.&lt;br /&gt;
&lt;br /&gt;
*Modify view expertiza/app/views/response/response.html.erb to incorporate text box and corresponding submit button.&lt;br /&gt;
&lt;br /&gt;
===Flowchart===&lt;br /&gt;
&lt;br /&gt;
[[File: ARSNFlowchart1.png]]&lt;br /&gt;
&lt;br /&gt;
===Screenshots===&lt;br /&gt;
&lt;br /&gt;
*The reviewer enters his question in the text area provided and clicks on the &amp;quot;Submit&amp;quot; button.&lt;br /&gt;
[[File: FinalProject1.jpg]]&lt;br /&gt;
*On clicking this button the appropriate method is called in ReviewChats controller which sends an email to all the authors of the topic indicating that a question has been asked about their work. The email contains a link which when clicked on will redirect the author to the appropriate view where he/she can answer the question.&lt;br /&gt;
[[File: FinalProject4.jpg]]&lt;br /&gt;
*On answering the question, the reviewer receives an email indicating that his question has been answered. It also contains a link which redirects the reviewer to the appropriate view where the answer will be displayed.&lt;br /&gt;
*The authorized users will also be able to see a link to open existing chat interaction log.&lt;br /&gt;
[[File: FinalProject3.jpg]]&lt;br /&gt;
*This view also contains the chat history between the author/s and the reviewer for the entire duration of the interaction.&lt;br /&gt;
[[File: FinalProject2.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Suggestions for Future Improvements ==&lt;br /&gt;
&lt;br /&gt;
* This can be extended to a live interactive author-reviewer anonymous chat session inside the Expertiza reviews window.&lt;br /&gt;
* A purging script can be developed which will clear all the interaction records every semester.&lt;br /&gt;
&lt;br /&gt;
==Resources==&lt;br /&gt;
&lt;br /&gt;
* Expertiza Github repository&amp;lt;ref&amp;gt;Expertiza Github repository https://github.com/expertiza/expertiza&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sgulati2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100178</id>
		<title>CSC/ECE 517 Fall 2015 E1586 AnonymousChatBetweenAuthorAndReviewer</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100178"/>
		<updated>2015-12-05T01:03:04Z</updated>

		<summary type="html">&lt;p&gt;Sgulati2: /* Code Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1586 AnonymousChatBetweenAuthorAndReviewer'''&lt;br /&gt;
&lt;br /&gt;
This page provides a brief description of the '''Expertiza''' project. The project is aimed at developing an email based anonymous session between author and a reviewer so that reviewers can ask questions to the authors for any doubts related to the assignments during peer reviewing.&lt;br /&gt;
&lt;br /&gt;
==Project==&lt;br /&gt;
&lt;br /&gt;
=== Introduction to Expertiza ===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a peer review based system which provides an incremental class based learning together with the instructors and the peers. This project has been developed together by faculty and students using [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza handles assignment submissions, team formations, assignment reviews and grades, etc.&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
During reviews, many times reviewers will be having questions about the submitted material and if it's a blocker there is no way that the reviewer can progress further with the review.  As a result, reviewers will end up submitting the empty or incomplete review.&lt;br /&gt;
&lt;br /&gt;
=== Scope ===&lt;br /&gt;
This project is limited to an email based conversation for asking questions and answers. The reviewers would ask questions related to assignment submission doubts to which authors can respond. All this would be taken care as email responses using a link provided in the email. This project does not cater to any live interactive session with spontaneous back-to-back questions and responses.&lt;br /&gt;
&lt;br /&gt;
Following tasks would be incorporated in the project:&lt;br /&gt;
* Provide a ‘TextArea’ input field on review forms, where any reviewer can type in their questions.&lt;br /&gt;
* Create a new button ‘Ask for Quick Help’ on the review forms.&lt;br /&gt;
* An email would be send to the author with the link where he can respond to the questions asked by the reviewers for their submitted work.&lt;br /&gt;
* Reviewers would be notified by an email when authors respond to the the questions.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Discussion of Resolution ===&lt;br /&gt;
&lt;br /&gt;
We will make the following modifications to implement the chat feature:- &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Create a new model which will help to extract, store and validate data in the database table which contains information about the interaction between the author/s and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Edit the view which is used by the response controller to incorporate the text area input field on the review form where the reviewer can ask his/her initial query.&lt;br /&gt;
&lt;br /&gt;
*Create a new controller with methods for authentication for a respective chat log only visible to the author and reviewer of a particular assignment, method to submit a response or a follow up query and show the existing interaction log.&lt;br /&gt;
&lt;br /&gt;
*Create a new helper with the e-mail methods for sending to the author and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Create a new view which will facilitate the author to respond to the queries asked by the reviewer. The reviewer can also use this view to ask any follow up questions.&lt;br /&gt;
&lt;br /&gt;
=== Design Patterns ===&lt;br /&gt;
The implementation team expects that the following design patterns be used in the solution:&lt;br /&gt;
 &lt;br /&gt;
* '''Observer Pattern'''&amp;lt;ref&amp;gt;Observer Design Pattern https://en.wikipedia.org/wiki/Observer_pattern&amp;lt;/ref&amp;gt;: The observer pattern is a software design pattern in which an object, called the subject, maintains a list of its dependents, called observers, and notifies them automatically of any state changes, usually by calling one of their methods. For example, we are notifying the team members whenever the reviewer submits the query.&lt;br /&gt;
&lt;br /&gt;
* '''Iterator Pattern''': In our instance, we need to display the entire chat history of a particular interaction, hence we can use the iterator design pattern to iterate through the previous chat messages.&lt;br /&gt;
&lt;br /&gt;
=== Database Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:Review_chats.png]]&lt;br /&gt;
&lt;br /&gt;
The above figure shows the schema of a new table which will be created in Expertiza to store relevant information about the chat. It contains the following attributes:&lt;br /&gt;
* id: This attribute is auto-generated by rails when we create a table and is auto incremented with each record. It is also the primary key of our table.&lt;br /&gt;
* assignment_id: Stores the ID of the assignment for which the interaction between author and reviewer is taking place.&lt;br /&gt;
* reviewer_id: Stores the ID of the reviewer who asks the questions.&lt;br /&gt;
* team_id: Stores the ID of the team to which the topic belongs.&lt;br /&gt;
* type_flag: Flag which is used to indicate if the particular tuple contains a question or answer. It can take two values, 'Q' for question and 'A' for answer.&lt;br /&gt;
* content: Stores the question asked by the reviewer or the response given by the author/s depending on the value of the type flag.&lt;br /&gt;
&lt;br /&gt;
Records for a particular interaction can be identified by using a combination of assignment_id, reviewer_id and team_id.&lt;br /&gt;
&lt;br /&gt;
=== Use Cases ===&lt;br /&gt;
'''Name:''' Send a question to the author/s about their work.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Reviewer. &amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The reviewer enters his question in the text area which is provided and clicks on the &amp;quot;Ask question&amp;quot; button which is provided as shown in the mock up. On clicking this button an email is sent to the author/s along which a link to answer the question.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''Name:''' Answer the question which has been asked by the reviewer.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Author/s&amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The author/s click on the link received in their email and are redirected to a page where they can answer the question. Once they submit the answer, an email is sent to the reviewer notifying him/her that their question has been answered.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:ARSNUsecase.jpeg]]&lt;br /&gt;
&lt;br /&gt;
=== Proposed Tests ===&lt;br /&gt;
1. For use case 1, test whether all the team members receive email with the question.&amp;lt;br/&amp;gt;&lt;br /&gt;
2. For use case 2, test whether the reviewer receive email with the response.&amp;lt;br/&amp;gt;&lt;br /&gt;
3. Test whether all the previous interactions are displayed as chat history.&amp;lt;br/&amp;gt;&lt;br /&gt;
4. The 'Ask Question' button should not be enabled until some text has been entered in the text area.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
===Code Implementation===&lt;br /&gt;
&lt;br /&gt;
*Model '''review_chat.rb''' to validate if the query box is empty and restrict the query length to 255 characters.&lt;br /&gt;
&lt;br /&gt;
  validates_length_of :content , :maximum =&amp;gt; 255,message: &amp;quot;Length must be less that 255 characters&amp;quot;&lt;br /&gt;
  validates_presence_of :content, message: &amp;quot;Content cannot be blank&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*Methods in the controller '''review_chats_controller.rb'''&lt;br /&gt;
&lt;br /&gt;
'''action_allowed?'''- Allow chat visibility to the reviewers and the authors of a particular interaction&lt;br /&gt;
&lt;br /&gt;
  def action_allowed?&lt;br /&gt;
    review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    allowed_users=Array.new&lt;br /&gt;
    team_id=review_chat.team_id&lt;br /&gt;
    teams_users = TeamsUser.where(team_id: team_id)&lt;br /&gt;
    teams_users.each do |teams_user|&lt;br /&gt;
      allowed_users &amp;lt;&amp;lt; User.find(teams_user.user_id).id&lt;br /&gt;
    end&lt;br /&gt;
    allowed_users &amp;lt;&amp;lt; Participant.find(review_chat.reviewer_id).user_id&lt;br /&gt;
    current_role_name.eql? 'Student' and allowed_users.include?(session[:user].id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''show'''- Show the chat interaction log&lt;br /&gt;
&lt;br /&gt;
  def show&lt;br /&gt;
    @review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    @assignment_id=@review_chat.assignment_id&lt;br /&gt;
    @reviewer_id=@review_chat.reviewer_id&lt;br /&gt;
    @team_id=@review_chat.team_id&lt;br /&gt;
    @chat_log=ReviewChat.where(:reviewer_id =&amp;gt; @reviewer_id).where(:team_id =&amp;gt; @team_id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''submitted_response'''- Submit a response from an author or post a follow-up query from the reviewer&lt;br /&gt;
&lt;br /&gt;
  def submitted_response&lt;br /&gt;
    @review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    @chat_reviewer=Participant.find(@review_chat.reviewer_id).user_id&lt;br /&gt;
    if(@chat_reviewer==session[:user].id) then&lt;br /&gt;
    	ReviewChat.create(:assignment_id =&amp;gt; @review_chat.assignment_id,:reviewer_id =&amp;gt; @review_chat.reviewer_id, :team_id=&amp;gt;@review_chat.team_id, :type_flag =&amp;gt; 'Q' , :content =&amp;gt; params[:response_area])&lt;br /&gt;
    	ReviewChatsHelper::chat_email_query(params[:id])&lt;br /&gt;
    	flash[:notice]=&amp;quot;Query has been submitted&amp;quot;	&lt;br /&gt;
    else	&lt;br /&gt;
      	ReviewChat.create(:assignment_id =&amp;gt; @review_chat.assignment_id,:reviewer_id =&amp;gt; @review_chat.reviewer_id, :team_id=&amp;gt;@review_chat.team_id, :type_flag =&amp;gt; 'A' , :content =&amp;gt; params[:response_area])&lt;br /&gt;
      	ReviewChatsHelper::chat_email_response(@review_chat.id,@chat_reviewer)&lt;br /&gt;
      flash[:notice]=&amp;quot;Response has been submitted&amp;quot;&lt;br /&gt;
    end	&lt;br /&gt;
    redirect_to action: 'show', id: params[:id]&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
*Create new views as discussed in the design.&lt;br /&gt;
&lt;br /&gt;
*Modify view expertiza/app/views/response/response.html.erb to incorporate text box and corresponding submit button.&lt;br /&gt;
&lt;br /&gt;
===Flowchart===&lt;br /&gt;
&lt;br /&gt;
[[File: ARSNFlowchart1.png]]&lt;br /&gt;
&lt;br /&gt;
===Screenshots===&lt;br /&gt;
&lt;br /&gt;
*The reviewer enters his question in the text area provided and clicks on the &amp;quot;Submit&amp;quot; button.&lt;br /&gt;
[[File: FinalProject1.jpg]]&lt;br /&gt;
*On clicking this button the appropriate method is called in ReviewChats controller which sends an email to all the authors of the topic indicating that a question has been asked about their work. The email contains a link which when clicked on will redirect the author to the appropriate view where he/she can answer the question.&lt;br /&gt;
[[File: FinalProject4.jpg]]&lt;br /&gt;
*On answering the question, the reviewer receives an email indicating that his question has been answered. It also contains a link which redirects the reviewer to the appropriate view where the answer will be displayed.&lt;br /&gt;
*The authorized users will also be able to see a link to open existing chat interaction log.&lt;br /&gt;
[[File: FinalProject3.jpg]]&lt;br /&gt;
*This view also contains the chat history between the author/s and the reviewer for the entire duration of the interaction.&lt;br /&gt;
[[File: FinalProject2.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Suggestions for Future Improvements ==&lt;br /&gt;
&lt;br /&gt;
* This can be extended to a live interactive author-reviewer anonymous chat session inside the Expertiza reviews window.&lt;br /&gt;
* A purging script can be developed which will clear all the interaction records every semester.&lt;br /&gt;
&lt;br /&gt;
==Resources==&lt;br /&gt;
&lt;br /&gt;
* Expertiza Github repository&amp;lt;ref&amp;gt;Expertiza Github repository https://github.com/expertiza/expertiza&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sgulati2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100177</id>
		<title>CSC/ECE 517 Fall 2015 E1586 AnonymousChatBetweenAuthorAndReviewer</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100177"/>
		<updated>2015-12-05T01:02:46Z</updated>

		<summary type="html">&lt;p&gt;Sgulati2: /* Code Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1586 AnonymousChatBetweenAuthorAndReviewer'''&lt;br /&gt;
&lt;br /&gt;
This page provides a brief description of the '''Expertiza''' project. The project is aimed at developing an email based anonymous session between author and a reviewer so that reviewers can ask questions to the authors for any doubts related to the assignments during peer reviewing.&lt;br /&gt;
&lt;br /&gt;
==Project==&lt;br /&gt;
&lt;br /&gt;
=== Introduction to Expertiza ===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a peer review based system which provides an incremental class based learning together with the instructors and the peers. This project has been developed together by faculty and students using [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza handles assignment submissions, team formations, assignment reviews and grades, etc.&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
During reviews, many times reviewers will be having questions about the submitted material and if it's a blocker there is no way that the reviewer can progress further with the review.  As a result, reviewers will end up submitting the empty or incomplete review.&lt;br /&gt;
&lt;br /&gt;
=== Scope ===&lt;br /&gt;
This project is limited to an email based conversation for asking questions and answers. The reviewers would ask questions related to assignment submission doubts to which authors can respond. All this would be taken care as email responses using a link provided in the email. This project does not cater to any live interactive session with spontaneous back-to-back questions and responses.&lt;br /&gt;
&lt;br /&gt;
Following tasks would be incorporated in the project:&lt;br /&gt;
* Provide a ‘TextArea’ input field on review forms, where any reviewer can type in their questions.&lt;br /&gt;
* Create a new button ‘Ask for Quick Help’ on the review forms.&lt;br /&gt;
* An email would be send to the author with the link where he can respond to the questions asked by the reviewers for their submitted work.&lt;br /&gt;
* Reviewers would be notified by an email when authors respond to the the questions.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Discussion of Resolution ===&lt;br /&gt;
&lt;br /&gt;
We will make the following modifications to implement the chat feature:- &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Create a new model which will help to extract, store and validate data in the database table which contains information about the interaction between the author/s and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Edit the view which is used by the response controller to incorporate the text area input field on the review form where the reviewer can ask his/her initial query.&lt;br /&gt;
&lt;br /&gt;
*Create a new controller with methods for authentication for a respective chat log only visible to the author and reviewer of a particular assignment, method to submit a response or a follow up query and show the existing interaction log.&lt;br /&gt;
&lt;br /&gt;
*Create a new helper with the e-mail methods for sending to the author and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Create a new view which will facilitate the author to respond to the queries asked by the reviewer. The reviewer can also use this view to ask any follow up questions.&lt;br /&gt;
&lt;br /&gt;
=== Design Patterns ===&lt;br /&gt;
The implementation team expects that the following design patterns be used in the solution:&lt;br /&gt;
 &lt;br /&gt;
* '''Observer Pattern'''&amp;lt;ref&amp;gt;Observer Design Pattern https://en.wikipedia.org/wiki/Observer_pattern&amp;lt;/ref&amp;gt;: The observer pattern is a software design pattern in which an object, called the subject, maintains a list of its dependents, called observers, and notifies them automatically of any state changes, usually by calling one of their methods. For example, we are notifying the team members whenever the reviewer submits the query.&lt;br /&gt;
&lt;br /&gt;
* '''Iterator Pattern''': In our instance, we need to display the entire chat history of a particular interaction, hence we can use the iterator design pattern to iterate through the previous chat messages.&lt;br /&gt;
&lt;br /&gt;
=== Database Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:Review_chats.png]]&lt;br /&gt;
&lt;br /&gt;
The above figure shows the schema of a new table which will be created in Expertiza to store relevant information about the chat. It contains the following attributes:&lt;br /&gt;
* id: This attribute is auto-generated by rails when we create a table and is auto incremented with each record. It is also the primary key of our table.&lt;br /&gt;
* assignment_id: Stores the ID of the assignment for which the interaction between author and reviewer is taking place.&lt;br /&gt;
* reviewer_id: Stores the ID of the reviewer who asks the questions.&lt;br /&gt;
* team_id: Stores the ID of the team to which the topic belongs.&lt;br /&gt;
* type_flag: Flag which is used to indicate if the particular tuple contains a question or answer. It can take two values, 'Q' for question and 'A' for answer.&lt;br /&gt;
* content: Stores the question asked by the reviewer or the response given by the author/s depending on the value of the type flag.&lt;br /&gt;
&lt;br /&gt;
Records for a particular interaction can be identified by using a combination of assignment_id, reviewer_id and team_id.&lt;br /&gt;
&lt;br /&gt;
=== Use Cases ===&lt;br /&gt;
'''Name:''' Send a question to the author/s about their work.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Reviewer. &amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The reviewer enters his question in the text area which is provided and clicks on the &amp;quot;Ask question&amp;quot; button which is provided as shown in the mock up. On clicking this button an email is sent to the author/s along which a link to answer the question.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''Name:''' Answer the question which has been asked by the reviewer.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Author/s&amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The author/s click on the link received in their email and are redirected to a page where they can answer the question. Once they submit the answer, an email is sent to the reviewer notifying him/her that their question has been answered.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:ARSNUsecase.jpeg]]&lt;br /&gt;
&lt;br /&gt;
=== Proposed Tests ===&lt;br /&gt;
1. For use case 1, test whether all the team members receive email with the question.&amp;lt;br/&amp;gt;&lt;br /&gt;
2. For use case 2, test whether the reviewer receive email with the response.&amp;lt;br/&amp;gt;&lt;br /&gt;
3. Test whether all the previous interactions are displayed as chat history.&amp;lt;br/&amp;gt;&lt;br /&gt;
4. The 'Ask Question' button should not be enabled until some text has been entered in the text area.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
===Code Implementation===&lt;br /&gt;
&lt;br /&gt;
*Model '''review_chat.rb''' to validate if the query box is empty and restrict the query length to 255 characters.&lt;br /&gt;
&lt;br /&gt;
  validates_length_of :content , :maximum =&amp;gt; 255,message: &amp;quot;Length must be less that 255 characters&amp;quot;&lt;br /&gt;
  validates_presence_of :content, message: &amp;quot;Content cannot be blank&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*Controller '''review_chats_controller.rb'''&lt;br /&gt;
&lt;br /&gt;
'''action_allowed?'''- Allow chat visibility to the reviewers and the authors of a particular interaction&lt;br /&gt;
&lt;br /&gt;
  def action_allowed?&lt;br /&gt;
    review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    allowed_users=Array.new&lt;br /&gt;
    team_id=review_chat.team_id&lt;br /&gt;
    teams_users = TeamsUser.where(team_id: team_id)&lt;br /&gt;
    teams_users.each do |teams_user|&lt;br /&gt;
      allowed_users &amp;lt;&amp;lt; User.find(teams_user.user_id).id&lt;br /&gt;
    end&lt;br /&gt;
    allowed_users &amp;lt;&amp;lt; Participant.find(review_chat.reviewer_id).user_id&lt;br /&gt;
    current_role_name.eql? 'Student' and allowed_users.include?(session[:user].id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''show'''- Show the chat interaction log&lt;br /&gt;
&lt;br /&gt;
  def show&lt;br /&gt;
    @review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    @assignment_id=@review_chat.assignment_id&lt;br /&gt;
    @reviewer_id=@review_chat.reviewer_id&lt;br /&gt;
    @team_id=@review_chat.team_id&lt;br /&gt;
    @chat_log=ReviewChat.where(:reviewer_id =&amp;gt; @reviewer_id).where(:team_id =&amp;gt; @team_id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''submitted_response'''- Submit a response from an author or post a follow-up query from the reviewer&lt;br /&gt;
&lt;br /&gt;
  def submitted_response&lt;br /&gt;
    @review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    @chat_reviewer=Participant.find(@review_chat.reviewer_id).user_id&lt;br /&gt;
    if(@chat_reviewer==session[:user].id) then&lt;br /&gt;
    	ReviewChat.create(:assignment_id =&amp;gt; @review_chat.assignment_id,:reviewer_id =&amp;gt; @review_chat.reviewer_id, :team_id=&amp;gt;@review_chat.team_id, :type_flag =&amp;gt; 'Q' , :content =&amp;gt; params[:response_area])&lt;br /&gt;
    	ReviewChatsHelper::chat_email_query(params[:id])&lt;br /&gt;
    	flash[:notice]=&amp;quot;Query has been submitted&amp;quot;	&lt;br /&gt;
    else	&lt;br /&gt;
      	ReviewChat.create(:assignment_id =&amp;gt; @review_chat.assignment_id,:reviewer_id =&amp;gt; @review_chat.reviewer_id, :team_id=&amp;gt;@review_chat.team_id, :type_flag =&amp;gt; 'A' , :content =&amp;gt; params[:response_area])&lt;br /&gt;
      	ReviewChatsHelper::chat_email_response(@review_chat.id,@chat_reviewer)&lt;br /&gt;
      flash[:notice]=&amp;quot;Response has been submitted&amp;quot;&lt;br /&gt;
    end	&lt;br /&gt;
    redirect_to action: 'show', id: params[:id]&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
*Create new views as discussed in the design.&lt;br /&gt;
&lt;br /&gt;
*Modify view expertiza/app/views/response/response.html.erb to incorporate text box and corresponding submit button.&lt;br /&gt;
&lt;br /&gt;
===Flowchart===&lt;br /&gt;
&lt;br /&gt;
[[File: ARSNFlowchart1.png]]&lt;br /&gt;
&lt;br /&gt;
===Screenshots===&lt;br /&gt;
&lt;br /&gt;
*The reviewer enters his question in the text area provided and clicks on the &amp;quot;Submit&amp;quot; button.&lt;br /&gt;
[[File: FinalProject1.jpg]]&lt;br /&gt;
*On clicking this button the appropriate method is called in ReviewChats controller which sends an email to all the authors of the topic indicating that a question has been asked about their work. The email contains a link which when clicked on will redirect the author to the appropriate view where he/she can answer the question.&lt;br /&gt;
[[File: FinalProject4.jpg]]&lt;br /&gt;
*On answering the question, the reviewer receives an email indicating that his question has been answered. It also contains a link which redirects the reviewer to the appropriate view where the answer will be displayed.&lt;br /&gt;
*The authorized users will also be able to see a link to open existing chat interaction log.&lt;br /&gt;
[[File: FinalProject3.jpg]]&lt;br /&gt;
*This view also contains the chat history between the author/s and the reviewer for the entire duration of the interaction.&lt;br /&gt;
[[File: FinalProject2.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Suggestions for Future Improvements ==&lt;br /&gt;
&lt;br /&gt;
* This can be extended to a live interactive author-reviewer anonymous chat session inside the Expertiza reviews window.&lt;br /&gt;
* A purging script can be developed which will clear all the interaction records every semester.&lt;br /&gt;
&lt;br /&gt;
==Resources==&lt;br /&gt;
&lt;br /&gt;
* Expertiza Github repository&amp;lt;ref&amp;gt;Expertiza Github repository https://github.com/expertiza/expertiza&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sgulati2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100174</id>
		<title>CSC/ECE 517 Fall 2015 E1586 AnonymousChatBetweenAuthorAndReviewer</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100174"/>
		<updated>2015-12-05T01:00:40Z</updated>

		<summary type="html">&lt;p&gt;Sgulati2: /* Code Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1586 AnonymousChatBetweenAuthorAndReviewer'''&lt;br /&gt;
&lt;br /&gt;
This page provides a brief description of the '''Expertiza''' project. The project is aimed at developing an email based anonymous session between author and a reviewer so that reviewers can ask questions to the authors for any doubts related to the assignments during peer reviewing.&lt;br /&gt;
&lt;br /&gt;
==Project==&lt;br /&gt;
&lt;br /&gt;
=== Introduction to Expertiza ===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a peer review based system which provides an incremental class based learning together with the instructors and the peers. This project has been developed together by faculty and students using [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza handles assignment submissions, team formations, assignment reviews and grades, etc.&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
During reviews, many times reviewers will be having questions about the submitted material and if it's a blocker there is no way that the reviewer can progress further with the review.  As a result, reviewers will end up submitting the empty or incomplete review.&lt;br /&gt;
&lt;br /&gt;
=== Scope ===&lt;br /&gt;
This project is limited to an email based conversation for asking questions and answers. The reviewers would ask questions related to assignment submission doubts to which authors can respond. All this would be taken care as email responses using a link provided in the email. This project does not cater to any live interactive session with spontaneous back-to-back questions and responses.&lt;br /&gt;
&lt;br /&gt;
Following tasks would be incorporated in the project:&lt;br /&gt;
* Provide a ‘TextArea’ input field on review forms, where any reviewer can type in their questions.&lt;br /&gt;
* Create a new button ‘Ask for Quick Help’ on the review forms.&lt;br /&gt;
* An email would be send to the author with the link where he can respond to the questions asked by the reviewers for their submitted work.&lt;br /&gt;
* Reviewers would be notified by an email when authors respond to the the questions.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Discussion of Resolution ===&lt;br /&gt;
&lt;br /&gt;
We will make the following modifications to implement the chat feature:- &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Create a new model which will help to extract, store and validate data in the database table which contains information about the interaction between the author/s and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Edit the view which is used by the response controller to incorporate the text area input field on the review form where the reviewer can ask his/her initial query.&lt;br /&gt;
&lt;br /&gt;
*Create a new controller with methods for authentication for a respective chat log only visible to the author and reviewer of a particular assignment, method to submit a response or a follow up query and show the existing interaction log.&lt;br /&gt;
&lt;br /&gt;
*Create a new helper with the e-mail methods for sending to the author and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Create a new view which will facilitate the author to respond to the queries asked by the reviewer. The reviewer can also use this view to ask any follow up questions.&lt;br /&gt;
&lt;br /&gt;
=== Design Patterns ===&lt;br /&gt;
The implementation team expects that the following design patterns be used in the solution:&lt;br /&gt;
 &lt;br /&gt;
* '''Observer Pattern'''&amp;lt;ref&amp;gt;Observer Design Pattern https://en.wikipedia.org/wiki/Observer_pattern&amp;lt;/ref&amp;gt;: The observer pattern is a software design pattern in which an object, called the subject, maintains a list of its dependents, called observers, and notifies them automatically of any state changes, usually by calling one of their methods. For example, we are notifying the team members whenever the reviewer submits the query.&lt;br /&gt;
&lt;br /&gt;
* '''Iterator Pattern''': In our instance, we need to display the entire chat history of a particular interaction, hence we can use the iterator design pattern to iterate through the previous chat messages.&lt;br /&gt;
&lt;br /&gt;
=== Database Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:Review_chats.png]]&lt;br /&gt;
&lt;br /&gt;
The above figure shows the schema of a new table which will be created in Expertiza to store relevant information about the chat. It contains the following attributes:&lt;br /&gt;
* id: This attribute is auto-generated by rails when we create a table and is auto incremented with each record. It is also the primary key of our table.&lt;br /&gt;
* assignment_id: Stores the ID of the assignment for which the interaction between author and reviewer is taking place.&lt;br /&gt;
* reviewer_id: Stores the ID of the reviewer who asks the questions.&lt;br /&gt;
* team_id: Stores the ID of the team to which the topic belongs.&lt;br /&gt;
* type_flag: Flag which is used to indicate if the particular tuple contains a question or answer. It can take two values, 'Q' for question and 'A' for answer.&lt;br /&gt;
* content: Stores the question asked by the reviewer or the response given by the author/s depending on the value of the type flag.&lt;br /&gt;
&lt;br /&gt;
Records for a particular interaction can be identified by using a combination of assignment_id, reviewer_id and team_id.&lt;br /&gt;
&lt;br /&gt;
=== Use Cases ===&lt;br /&gt;
'''Name:''' Send a question to the author/s about their work.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Reviewer. &amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The reviewer enters his question in the text area which is provided and clicks on the &amp;quot;Ask question&amp;quot; button which is provided as shown in the mock up. On clicking this button an email is sent to the author/s along which a link to answer the question.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''Name:''' Answer the question which has been asked by the reviewer.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Author/s&amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The author/s click on the link received in their email and are redirected to a page where they can answer the question. Once they submit the answer, an email is sent to the reviewer notifying him/her that their question has been answered.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:ARSNUsecase.jpeg]]&lt;br /&gt;
&lt;br /&gt;
=== Proposed Tests ===&lt;br /&gt;
1. For use case 1, test whether all the team members receive email with the question.&amp;lt;br/&amp;gt;&lt;br /&gt;
2. For use case 2, test whether the reviewer receive email with the response.&amp;lt;br/&amp;gt;&lt;br /&gt;
3. Test whether all the previous interactions are displayed as chat history.&amp;lt;br/&amp;gt;&lt;br /&gt;
4. The 'Ask Question' button should not be enabled until some text has been entered in the text area.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
===Code Implementation===&lt;br /&gt;
&lt;br /&gt;
*Create a new model '''ReviewChat''' .&lt;br /&gt;
&lt;br /&gt;
*Methods implemented in controller '''review_chats_controller.rb'''&lt;br /&gt;
&lt;br /&gt;
'''action_allowed?'''- Allow chat visibility to the reviewers and the authors of a particular interaction&lt;br /&gt;
&lt;br /&gt;
  def action_allowed?&lt;br /&gt;
    review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    allowed_users=Array.new&lt;br /&gt;
    team_id=review_chat.team_id&lt;br /&gt;
    teams_users = TeamsUser.where(team_id: team_id)&lt;br /&gt;
    teams_users.each do |teams_user|&lt;br /&gt;
      allowed_users &amp;lt;&amp;lt; User.find(teams_user.user_id).id&lt;br /&gt;
    end&lt;br /&gt;
    allowed_users &amp;lt;&amp;lt; Participant.find(review_chat.reviewer_id).user_id&lt;br /&gt;
    current_role_name.eql? 'Student' and allowed_users.include?(session[:user].id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''show'''- Show the chat interaction log&lt;br /&gt;
&lt;br /&gt;
  def show&lt;br /&gt;
    @review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    @assignment_id=@review_chat.assignment_id&lt;br /&gt;
    @reviewer_id=@review_chat.reviewer_id&lt;br /&gt;
    @team_id=@review_chat.team_id&lt;br /&gt;
    @chat_log=ReviewChat.where(:reviewer_id =&amp;gt; @reviewer_id).where(:team_id =&amp;gt; @team_id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''submitted_response'''- Submit a response from an author or post a follow-up query from the reviewer&lt;br /&gt;
&lt;br /&gt;
  def submitted_response&lt;br /&gt;
    @review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    @chat_reviewer=Participant.find(@review_chat.reviewer_id).user_id&lt;br /&gt;
    if(@chat_reviewer==session[:user].id) then&lt;br /&gt;
    	ReviewChat.create(:assignment_id =&amp;gt; @review_chat.assignment_id,:reviewer_id =&amp;gt; @review_chat.reviewer_id, :team_id=&amp;gt;@review_chat.team_id, :type_flag =&amp;gt; 'Q' , :content =&amp;gt; params[:response_area])&lt;br /&gt;
    	ReviewChatsHelper::chat_email_query(params[:id])&lt;br /&gt;
    	flash[:notice]=&amp;quot;Query has been submitted&amp;quot;	&lt;br /&gt;
    else	&lt;br /&gt;
      	ReviewChat.create(:assignment_id =&amp;gt; @review_chat.assignment_id,:reviewer_id =&amp;gt; @review_chat.reviewer_id, :team_id=&amp;gt;@review_chat.team_id, :type_flag =&amp;gt; 'A' , :content =&amp;gt; params[:response_area])&lt;br /&gt;
      	ReviewChatsHelper::chat_email_response(@review_chat.id,@chat_reviewer)&lt;br /&gt;
      flash[:notice]=&amp;quot;Response has been submitted&amp;quot;&lt;br /&gt;
    end	&lt;br /&gt;
    redirect_to action: 'show', id: params[:id]&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
*Create new views as discussed in the design.&lt;br /&gt;
&lt;br /&gt;
*Modify view expertiza/app/views/response/response.html.erb to incorporate text box and corresponding submit button.&lt;br /&gt;
&lt;br /&gt;
===Flowchart===&lt;br /&gt;
&lt;br /&gt;
[[File: ARSNFlowchart1.png]]&lt;br /&gt;
&lt;br /&gt;
===Screenshots===&lt;br /&gt;
&lt;br /&gt;
*The reviewer enters his question in the text area provided and clicks on the &amp;quot;Submit&amp;quot; button.&lt;br /&gt;
[[File: FinalProject1.jpg]]&lt;br /&gt;
*On clicking this button the appropriate method is called in ReviewChats controller which sends an email to all the authors of the topic indicating that a question has been asked about their work. The email contains a link which when clicked on will redirect the author to the appropriate view where he/she can answer the question.&lt;br /&gt;
[[File: FinalProject4.jpg]]&lt;br /&gt;
*On answering the question, the reviewer receives an email indicating that his question has been answered. It also contains a link which redirects the reviewer to the appropriate view where the answer will be displayed.&lt;br /&gt;
*The authorized users will also be able to see a link to open existing chat interaction log.&lt;br /&gt;
[[File: FinalProject3.jpg]]&lt;br /&gt;
*This view also contains the chat history between the author/s and the reviewer for the entire duration of the interaction.&lt;br /&gt;
[[File: FinalProject2.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Suggestions for Future Improvements ==&lt;br /&gt;
&lt;br /&gt;
* This can be extended to a live interactive author-reviewer anonymous chat session inside the Expertiza reviews window.&lt;br /&gt;
* A purging script can be developed which will clear all the interaction records every semester.&lt;br /&gt;
&lt;br /&gt;
==Resources==&lt;br /&gt;
&lt;br /&gt;
* Expertiza Github repository&amp;lt;ref&amp;gt;Expertiza Github repository https://github.com/expertiza/expertiza&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sgulati2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100172</id>
		<title>CSC/ECE 517 Fall 2015 E1586 AnonymousChatBetweenAuthorAndReviewer</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100172"/>
		<updated>2015-12-05T00:59:46Z</updated>

		<summary type="html">&lt;p&gt;Sgulati2: /* Code Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1586 AnonymousChatBetweenAuthorAndReviewer'''&lt;br /&gt;
&lt;br /&gt;
This page provides a brief description of the '''Expertiza''' project. The project is aimed at developing an email based anonymous session between author and a reviewer so that reviewers can ask questions to the authors for any doubts related to the assignments during peer reviewing.&lt;br /&gt;
&lt;br /&gt;
==Project==&lt;br /&gt;
&lt;br /&gt;
=== Introduction to Expertiza ===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a peer review based system which provides an incremental class based learning together with the instructors and the peers. This project has been developed together by faculty and students using [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza handles assignment submissions, team formations, assignment reviews and grades, etc.&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
During reviews, many times reviewers will be having questions about the submitted material and if it's a blocker there is no way that the reviewer can progress further with the review.  As a result, reviewers will end up submitting the empty or incomplete review.&lt;br /&gt;
&lt;br /&gt;
=== Scope ===&lt;br /&gt;
This project is limited to an email based conversation for asking questions and answers. The reviewers would ask questions related to assignment submission doubts to which authors can respond. All this would be taken care as email responses using a link provided in the email. This project does not cater to any live interactive session with spontaneous back-to-back questions and responses.&lt;br /&gt;
&lt;br /&gt;
Following tasks would be incorporated in the project:&lt;br /&gt;
* Provide a ‘TextArea’ input field on review forms, where any reviewer can type in their questions.&lt;br /&gt;
* Create a new button ‘Ask for Quick Help’ on the review forms.&lt;br /&gt;
* An email would be send to the author with the link where he can respond to the questions asked by the reviewers for their submitted work.&lt;br /&gt;
* Reviewers would be notified by an email when authors respond to the the questions.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Discussion of Resolution ===&lt;br /&gt;
&lt;br /&gt;
We will make the following modifications to implement the chat feature:- &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Create a new model which will help to extract, store and validate data in the database table which contains information about the interaction between the author/s and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Edit the view which is used by the response controller to incorporate the text area input field on the review form where the reviewer can ask his/her initial query.&lt;br /&gt;
&lt;br /&gt;
*Create a new controller with methods for authentication for a respective chat log only visible to the author and reviewer of a particular assignment, method to submit a response or a follow up query and show the existing interaction log.&lt;br /&gt;
&lt;br /&gt;
*Create a new helper with the e-mail methods for sending to the author and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Create a new view which will facilitate the author to respond to the queries asked by the reviewer. The reviewer can also use this view to ask any follow up questions.&lt;br /&gt;
&lt;br /&gt;
=== Design Patterns ===&lt;br /&gt;
The implementation team expects that the following design patterns be used in the solution:&lt;br /&gt;
 &lt;br /&gt;
* '''Observer Pattern'''&amp;lt;ref&amp;gt;Observer Design Pattern https://en.wikipedia.org/wiki/Observer_pattern&amp;lt;/ref&amp;gt;: The observer pattern is a software design pattern in which an object, called the subject, maintains a list of its dependents, called observers, and notifies them automatically of any state changes, usually by calling one of their methods. For example, we are notifying the team members whenever the reviewer submits the query.&lt;br /&gt;
&lt;br /&gt;
* '''Iterator Pattern''': In our instance, we need to display the entire chat history of a particular interaction, hence we can use the iterator design pattern to iterate through the previous chat messages.&lt;br /&gt;
&lt;br /&gt;
=== Database Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:Review_chats.png]]&lt;br /&gt;
&lt;br /&gt;
The above figure shows the schema of a new table which will be created in Expertiza to store relevant information about the chat. It contains the following attributes:&lt;br /&gt;
* id: This attribute is auto-generated by rails when we create a table and is auto incremented with each record. It is also the primary key of our table.&lt;br /&gt;
* assignment_id: Stores the ID of the assignment for which the interaction between author and reviewer is taking place.&lt;br /&gt;
* reviewer_id: Stores the ID of the reviewer who asks the questions.&lt;br /&gt;
* team_id: Stores the ID of the team to which the topic belongs.&lt;br /&gt;
* type_flag: Flag which is used to indicate if the particular tuple contains a question or answer. It can take two values, 'Q' for question and 'A' for answer.&lt;br /&gt;
* content: Stores the question asked by the reviewer or the response given by the author/s depending on the value of the type flag.&lt;br /&gt;
&lt;br /&gt;
Records for a particular interaction can be identified by using a combination of assignment_id, reviewer_id and team_id.&lt;br /&gt;
&lt;br /&gt;
=== Use Cases ===&lt;br /&gt;
'''Name:''' Send a question to the author/s about their work.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Reviewer. &amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The reviewer enters his question in the text area which is provided and clicks on the &amp;quot;Ask question&amp;quot; button which is provided as shown in the mock up. On clicking this button an email is sent to the author/s along which a link to answer the question.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''Name:''' Answer the question which has been asked by the reviewer.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Author/s&amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The author/s click on the link received in their email and are redirected to a page where they can answer the question. Once they submit the answer, an email is sent to the reviewer notifying him/her that their question has been answered.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:ARSNUsecase.jpeg]]&lt;br /&gt;
&lt;br /&gt;
=== Proposed Tests ===&lt;br /&gt;
1. For use case 1, test whether all the team members receive email with the question.&amp;lt;br/&amp;gt;&lt;br /&gt;
2. For use case 2, test whether the reviewer receive email with the response.&amp;lt;br/&amp;gt;&lt;br /&gt;
3. Test whether all the previous interactions are displayed as chat history.&amp;lt;br/&amp;gt;&lt;br /&gt;
4. The 'Ask Question' button should not be enabled until some text has been entered in the text area.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
===Code Implementation===&lt;br /&gt;
&lt;br /&gt;
*Create a new model '''ReviewChat''' .&lt;br /&gt;
&lt;br /&gt;
*Methods implemented in controller '''review_chats_controller.rb'''&lt;br /&gt;
&lt;br /&gt;
'''action_allowed?'''- Allow chat visibility to the reviewers and the authors of a particular interaction.&lt;br /&gt;
&lt;br /&gt;
  def action_allowed?&lt;br /&gt;
    review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    allowed_users=Array.new&lt;br /&gt;
    team_id=review_chat.team_id&lt;br /&gt;
    teams_users = TeamsUser.where(team_id: team_id)&lt;br /&gt;
    teams_users.each do |teams_user|&lt;br /&gt;
      allowed_users &amp;lt;&amp;lt; User.find(teams_user.user_id).id&lt;br /&gt;
    end&lt;br /&gt;
    allowed_users &amp;lt;&amp;lt; Participant.find(review_chat.reviewer_id).user_id&lt;br /&gt;
    current_role_name.eql? 'Student' and allowed_users.include?(session[:user].id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''def show'''&lt;br /&gt;
&lt;br /&gt;
  def show&lt;br /&gt;
    @review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    @assignment_id=@review_chat.assignment_id&lt;br /&gt;
    @reviewer_id=@review_chat.reviewer_id&lt;br /&gt;
    @team_id=@review_chat.team_id&lt;br /&gt;
    @chat_log=ReviewChat.where(:reviewer_id =&amp;gt; @reviewer_id).where(:team_id =&amp;gt; @team_id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''def submitted_response'''&lt;br /&gt;
&lt;br /&gt;
  def submitted_response&lt;br /&gt;
    @review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    @chat_reviewer=Participant.find(@review_chat.reviewer_id).user_id&lt;br /&gt;
    if(@chat_reviewer==session[:user].id) then&lt;br /&gt;
    	ReviewChat.create(:assignment_id =&amp;gt; @review_chat.assignment_id,:reviewer_id =&amp;gt; @review_chat.reviewer_id, :team_id=&amp;gt;@review_chat.team_id, :type_flag =&amp;gt; 'Q' , :content =&amp;gt; params[:response_area])&lt;br /&gt;
    	ReviewChatsHelper::chat_email_query(params[:id])&lt;br /&gt;
    	flash[:notice]=&amp;quot;Query has been submitted&amp;quot;	&lt;br /&gt;
    else	&lt;br /&gt;
      	ReviewChat.create(:assignment_id =&amp;gt; @review_chat.assignment_id,:reviewer_id =&amp;gt; @review_chat.reviewer_id, :team_id=&amp;gt;@review_chat.team_id, :type_flag =&amp;gt; 'A' , :content =&amp;gt; params[:response_area])&lt;br /&gt;
      	ReviewChatsHelper::chat_email_response(@review_chat.id,@chat_reviewer)&lt;br /&gt;
      flash[:notice]=&amp;quot;Response has been submitted&amp;quot;&lt;br /&gt;
    end	&lt;br /&gt;
    redirect_to action: 'show', id: params[:id]&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
*Create new views as discussed in the design.&lt;br /&gt;
&lt;br /&gt;
*Modify view expertiza/app/views/response/response.html.erb to incorporate text box and corresponding submit button.&lt;br /&gt;
&lt;br /&gt;
===Flowchart===&lt;br /&gt;
&lt;br /&gt;
[[File: ARSNFlowchart1.png]]&lt;br /&gt;
&lt;br /&gt;
===Screenshots===&lt;br /&gt;
&lt;br /&gt;
*The reviewer enters his question in the text area provided and clicks on the &amp;quot;Submit&amp;quot; button.&lt;br /&gt;
[[File: FinalProject1.jpg]]&lt;br /&gt;
*On clicking this button the appropriate method is called in ReviewChats controller which sends an email to all the authors of the topic indicating that a question has been asked about their work. The email contains a link which when clicked on will redirect the author to the appropriate view where he/she can answer the question.&lt;br /&gt;
[[File: FinalProject4.jpg]]&lt;br /&gt;
*On answering the question, the reviewer receives an email indicating that his question has been answered. It also contains a link which redirects the reviewer to the appropriate view where the answer will be displayed.&lt;br /&gt;
*The authorized users will also be able to see a link to open existing chat interaction log.&lt;br /&gt;
[[File: FinalProject3.jpg]]&lt;br /&gt;
*This view also contains the chat history between the author/s and the reviewer for the entire duration of the interaction.&lt;br /&gt;
[[File: FinalProject2.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Suggestions for Future Improvements ==&lt;br /&gt;
&lt;br /&gt;
* This can be extended to a live interactive author-reviewer anonymous chat session inside the Expertiza reviews window.&lt;br /&gt;
* A purging script can be developed which will clear all the interaction records every semester.&lt;br /&gt;
&lt;br /&gt;
==Resources==&lt;br /&gt;
&lt;br /&gt;
* Expertiza Github repository&amp;lt;ref&amp;gt;Expertiza Github repository https://github.com/expertiza/expertiza&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sgulati2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100171</id>
		<title>CSC/ECE 517 Fall 2015 E1586 AnonymousChatBetweenAuthorAndReviewer</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100171"/>
		<updated>2015-12-05T00:59:32Z</updated>

		<summary type="html">&lt;p&gt;Sgulati2: /* Code Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1586 AnonymousChatBetweenAuthorAndReviewer'''&lt;br /&gt;
&lt;br /&gt;
This page provides a brief description of the '''Expertiza''' project. The project is aimed at developing an email based anonymous session between author and a reviewer so that reviewers can ask questions to the authors for any doubts related to the assignments during peer reviewing.&lt;br /&gt;
&lt;br /&gt;
==Project==&lt;br /&gt;
&lt;br /&gt;
=== Introduction to Expertiza ===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a peer review based system which provides an incremental class based learning together with the instructors and the peers. This project has been developed together by faculty and students using [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza handles assignment submissions, team formations, assignment reviews and grades, etc.&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
During reviews, many times reviewers will be having questions about the submitted material and if it's a blocker there is no way that the reviewer can progress further with the review.  As a result, reviewers will end up submitting the empty or incomplete review.&lt;br /&gt;
&lt;br /&gt;
=== Scope ===&lt;br /&gt;
This project is limited to an email based conversation for asking questions and answers. The reviewers would ask questions related to assignment submission doubts to which authors can respond. All this would be taken care as email responses using a link provided in the email. This project does not cater to any live interactive session with spontaneous back-to-back questions and responses.&lt;br /&gt;
&lt;br /&gt;
Following tasks would be incorporated in the project:&lt;br /&gt;
* Provide a ‘TextArea’ input field on review forms, where any reviewer can type in their questions.&lt;br /&gt;
* Create a new button ‘Ask for Quick Help’ on the review forms.&lt;br /&gt;
* An email would be send to the author with the link where he can respond to the questions asked by the reviewers for their submitted work.&lt;br /&gt;
* Reviewers would be notified by an email when authors respond to the the questions.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Discussion of Resolution ===&lt;br /&gt;
&lt;br /&gt;
We will make the following modifications to implement the chat feature:- &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Create a new model which will help to extract, store and validate data in the database table which contains information about the interaction between the author/s and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Edit the view which is used by the response controller to incorporate the text area input field on the review form where the reviewer can ask his/her initial query.&lt;br /&gt;
&lt;br /&gt;
*Create a new controller with methods for authentication for a respective chat log only visible to the author and reviewer of a particular assignment, method to submit a response or a follow up query and show the existing interaction log.&lt;br /&gt;
&lt;br /&gt;
*Create a new helper with the e-mail methods for sending to the author and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Create a new view which will facilitate the author to respond to the queries asked by the reviewer. The reviewer can also use this view to ask any follow up questions.&lt;br /&gt;
&lt;br /&gt;
=== Design Patterns ===&lt;br /&gt;
The implementation team expects that the following design patterns be used in the solution:&lt;br /&gt;
 &lt;br /&gt;
* '''Observer Pattern'''&amp;lt;ref&amp;gt;Observer Design Pattern https://en.wikipedia.org/wiki/Observer_pattern&amp;lt;/ref&amp;gt;: The observer pattern is a software design pattern in which an object, called the subject, maintains a list of its dependents, called observers, and notifies them automatically of any state changes, usually by calling one of their methods. For example, we are notifying the team members whenever the reviewer submits the query.&lt;br /&gt;
&lt;br /&gt;
* '''Iterator Pattern''': In our instance, we need to display the entire chat history of a particular interaction, hence we can use the iterator design pattern to iterate through the previous chat messages.&lt;br /&gt;
&lt;br /&gt;
=== Database Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:Review_chats.png]]&lt;br /&gt;
&lt;br /&gt;
The above figure shows the schema of a new table which will be created in Expertiza to store relevant information about the chat. It contains the following attributes:&lt;br /&gt;
* id: This attribute is auto-generated by rails when we create a table and is auto incremented with each record. It is also the primary key of our table.&lt;br /&gt;
* assignment_id: Stores the ID of the assignment for which the interaction between author and reviewer is taking place.&lt;br /&gt;
* reviewer_id: Stores the ID of the reviewer who asks the questions.&lt;br /&gt;
* team_id: Stores the ID of the team to which the topic belongs.&lt;br /&gt;
* type_flag: Flag which is used to indicate if the particular tuple contains a question or answer. It can take two values, 'Q' for question and 'A' for answer.&lt;br /&gt;
* content: Stores the question asked by the reviewer or the response given by the author/s depending on the value of the type flag.&lt;br /&gt;
&lt;br /&gt;
Records for a particular interaction can be identified by using a combination of assignment_id, reviewer_id and team_id.&lt;br /&gt;
&lt;br /&gt;
=== Use Cases ===&lt;br /&gt;
'''Name:''' Send a question to the author/s about their work.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Reviewer. &amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The reviewer enters his question in the text area which is provided and clicks on the &amp;quot;Ask question&amp;quot; button which is provided as shown in the mock up. On clicking this button an email is sent to the author/s along which a link to answer the question.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''Name:''' Answer the question which has been asked by the reviewer.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Author/s&amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The author/s click on the link received in their email and are redirected to a page where they can answer the question. Once they submit the answer, an email is sent to the reviewer notifying him/her that their question has been answered.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:ARSNUsecase.jpeg]]&lt;br /&gt;
&lt;br /&gt;
=== Proposed Tests ===&lt;br /&gt;
1. For use case 1, test whether all the team members receive email with the question.&amp;lt;br/&amp;gt;&lt;br /&gt;
2. For use case 2, test whether the reviewer receive email with the response.&amp;lt;br/&amp;gt;&lt;br /&gt;
3. Test whether all the previous interactions are displayed as chat history.&amp;lt;br/&amp;gt;&lt;br /&gt;
4. The 'Ask Question' button should not be enabled until some text has been entered in the text area.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
===Code Implementation===&lt;br /&gt;
&lt;br /&gt;
*Create a new model '''ReviewChat''' .&lt;br /&gt;
&lt;br /&gt;
*Methods implemented in controller '''review_chats_controller.rb'''&lt;br /&gt;
&lt;br /&gt;
'''def action_allowed?'''- Allow chat visibility to the reviewers and the authors of a particular interaction.&lt;br /&gt;
&lt;br /&gt;
  def action_allowed?&lt;br /&gt;
    review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    allowed_users=Array.new&lt;br /&gt;
    team_id=review_chat.team_id&lt;br /&gt;
    teams_users = TeamsUser.where(team_id: team_id)&lt;br /&gt;
    teams_users.each do |teams_user|&lt;br /&gt;
      allowed_users &amp;lt;&amp;lt; User.find(teams_user.user_id).id&lt;br /&gt;
    end&lt;br /&gt;
    allowed_users &amp;lt;&amp;lt; Participant.find(review_chat.reviewer_id).user_id&lt;br /&gt;
    current_role_name.eql? 'Student' and allowed_users.include?(session[:user].id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''def show'''&lt;br /&gt;
&lt;br /&gt;
  def show&lt;br /&gt;
    @review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    @assignment_id=@review_chat.assignment_id&lt;br /&gt;
    @reviewer_id=@review_chat.reviewer_id&lt;br /&gt;
    @team_id=@review_chat.team_id&lt;br /&gt;
    @chat_log=ReviewChat.where(:reviewer_id =&amp;gt; @reviewer_id).where(:team_id =&amp;gt; @team_id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''def submitted_response'''&lt;br /&gt;
&lt;br /&gt;
  def submitted_response&lt;br /&gt;
    @review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    @chat_reviewer=Participant.find(@review_chat.reviewer_id).user_id&lt;br /&gt;
    if(@chat_reviewer==session[:user].id) then&lt;br /&gt;
    	ReviewChat.create(:assignment_id =&amp;gt; @review_chat.assignment_id,:reviewer_id =&amp;gt; @review_chat.reviewer_id, :team_id=&amp;gt;@review_chat.team_id, :type_flag =&amp;gt; 'Q' , :content =&amp;gt; params[:response_area])&lt;br /&gt;
    	ReviewChatsHelper::chat_email_query(params[:id])&lt;br /&gt;
    	flash[:notice]=&amp;quot;Query has been submitted&amp;quot;	&lt;br /&gt;
    else	&lt;br /&gt;
      	ReviewChat.create(:assignment_id =&amp;gt; @review_chat.assignment_id,:reviewer_id =&amp;gt; @review_chat.reviewer_id, :team_id=&amp;gt;@review_chat.team_id, :type_flag =&amp;gt; 'A' , :content =&amp;gt; params[:response_area])&lt;br /&gt;
      	ReviewChatsHelper::chat_email_response(@review_chat.id,@chat_reviewer)&lt;br /&gt;
      flash[:notice]=&amp;quot;Response has been submitted&amp;quot;&lt;br /&gt;
    end	&lt;br /&gt;
    redirect_to action: 'show', id: params[:id]&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
*Create new views as discussed in the design.&lt;br /&gt;
&lt;br /&gt;
*Modify view expertiza/app/views/response/response.html.erb to incorporate text box and corresponding submit button.&lt;br /&gt;
&lt;br /&gt;
===Flowchart===&lt;br /&gt;
&lt;br /&gt;
[[File: ARSNFlowchart1.png]]&lt;br /&gt;
&lt;br /&gt;
===Screenshots===&lt;br /&gt;
&lt;br /&gt;
*The reviewer enters his question in the text area provided and clicks on the &amp;quot;Submit&amp;quot; button.&lt;br /&gt;
[[File: FinalProject1.jpg]]&lt;br /&gt;
*On clicking this button the appropriate method is called in ReviewChats controller which sends an email to all the authors of the topic indicating that a question has been asked about their work. The email contains a link which when clicked on will redirect the author to the appropriate view where he/she can answer the question.&lt;br /&gt;
[[File: FinalProject4.jpg]]&lt;br /&gt;
*On answering the question, the reviewer receives an email indicating that his question has been answered. It also contains a link which redirects the reviewer to the appropriate view where the answer will be displayed.&lt;br /&gt;
*The authorized users will also be able to see a link to open existing chat interaction log.&lt;br /&gt;
[[File: FinalProject3.jpg]]&lt;br /&gt;
*This view also contains the chat history between the author/s and the reviewer for the entire duration of the interaction.&lt;br /&gt;
[[File: FinalProject2.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Suggestions for Future Improvements ==&lt;br /&gt;
&lt;br /&gt;
* This can be extended to a live interactive author-reviewer anonymous chat session inside the Expertiza reviews window.&lt;br /&gt;
* A purging script can be developed which will clear all the interaction records every semester.&lt;br /&gt;
&lt;br /&gt;
==Resources==&lt;br /&gt;
&lt;br /&gt;
* Expertiza Github repository&amp;lt;ref&amp;gt;Expertiza Github repository https://github.com/expertiza/expertiza&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sgulati2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100169</id>
		<title>CSC/ECE 517 Fall 2015 E1586 AnonymousChatBetweenAuthorAndReviewer</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100169"/>
		<updated>2015-12-05T00:59:15Z</updated>

		<summary type="html">&lt;p&gt;Sgulati2: /* Code Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1586 AnonymousChatBetweenAuthorAndReviewer'''&lt;br /&gt;
&lt;br /&gt;
This page provides a brief description of the '''Expertiza''' project. The project is aimed at developing an email based anonymous session between author and a reviewer so that reviewers can ask questions to the authors for any doubts related to the assignments during peer reviewing.&lt;br /&gt;
&lt;br /&gt;
==Project==&lt;br /&gt;
&lt;br /&gt;
=== Introduction to Expertiza ===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a peer review based system which provides an incremental class based learning together with the instructors and the peers. This project has been developed together by faculty and students using [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza handles assignment submissions, team formations, assignment reviews and grades, etc.&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
During reviews, many times reviewers will be having questions about the submitted material and if it's a blocker there is no way that the reviewer can progress further with the review.  As a result, reviewers will end up submitting the empty or incomplete review.&lt;br /&gt;
&lt;br /&gt;
=== Scope ===&lt;br /&gt;
This project is limited to an email based conversation for asking questions and answers. The reviewers would ask questions related to assignment submission doubts to which authors can respond. All this would be taken care as email responses using a link provided in the email. This project does not cater to any live interactive session with spontaneous back-to-back questions and responses.&lt;br /&gt;
&lt;br /&gt;
Following tasks would be incorporated in the project:&lt;br /&gt;
* Provide a ‘TextArea’ input field on review forms, where any reviewer can type in their questions.&lt;br /&gt;
* Create a new button ‘Ask for Quick Help’ on the review forms.&lt;br /&gt;
* An email would be send to the author with the link where he can respond to the questions asked by the reviewers for their submitted work.&lt;br /&gt;
* Reviewers would be notified by an email when authors respond to the the questions.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Discussion of Resolution ===&lt;br /&gt;
&lt;br /&gt;
We will make the following modifications to implement the chat feature:- &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Create a new model which will help to extract, store and validate data in the database table which contains information about the interaction between the author/s and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Edit the view which is used by the response controller to incorporate the text area input field on the review form where the reviewer can ask his/her initial query.&lt;br /&gt;
&lt;br /&gt;
*Create a new controller with methods for authentication for a respective chat log only visible to the author and reviewer of a particular assignment, method to submit a response or a follow up query and show the existing interaction log.&lt;br /&gt;
&lt;br /&gt;
*Create a new helper with the e-mail methods for sending to the author and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Create a new view which will facilitate the author to respond to the queries asked by the reviewer. The reviewer can also use this view to ask any follow up questions.&lt;br /&gt;
&lt;br /&gt;
=== Design Patterns ===&lt;br /&gt;
The implementation team expects that the following design patterns be used in the solution:&lt;br /&gt;
 &lt;br /&gt;
* '''Observer Pattern'''&amp;lt;ref&amp;gt;Observer Design Pattern https://en.wikipedia.org/wiki/Observer_pattern&amp;lt;/ref&amp;gt;: The observer pattern is a software design pattern in which an object, called the subject, maintains a list of its dependents, called observers, and notifies them automatically of any state changes, usually by calling one of their methods. For example, we are notifying the team members whenever the reviewer submits the query.&lt;br /&gt;
&lt;br /&gt;
* '''Iterator Pattern''': In our instance, we need to display the entire chat history of a particular interaction, hence we can use the iterator design pattern to iterate through the previous chat messages.&lt;br /&gt;
&lt;br /&gt;
=== Database Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:Review_chats.png]]&lt;br /&gt;
&lt;br /&gt;
The above figure shows the schema of a new table which will be created in Expertiza to store relevant information about the chat. It contains the following attributes:&lt;br /&gt;
* id: This attribute is auto-generated by rails when we create a table and is auto incremented with each record. It is also the primary key of our table.&lt;br /&gt;
* assignment_id: Stores the ID of the assignment for which the interaction between author and reviewer is taking place.&lt;br /&gt;
* reviewer_id: Stores the ID of the reviewer who asks the questions.&lt;br /&gt;
* team_id: Stores the ID of the team to which the topic belongs.&lt;br /&gt;
* type_flag: Flag which is used to indicate if the particular tuple contains a question or answer. It can take two values, 'Q' for question and 'A' for answer.&lt;br /&gt;
* content: Stores the question asked by the reviewer or the response given by the author/s depending on the value of the type flag.&lt;br /&gt;
&lt;br /&gt;
Records for a particular interaction can be identified by using a combination of assignment_id, reviewer_id and team_id.&lt;br /&gt;
&lt;br /&gt;
=== Use Cases ===&lt;br /&gt;
'''Name:''' Send a question to the author/s about their work.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Reviewer. &amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The reviewer enters his question in the text area which is provided and clicks on the &amp;quot;Ask question&amp;quot; button which is provided as shown in the mock up. On clicking this button an email is sent to the author/s along which a link to answer the question.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''Name:''' Answer the question which has been asked by the reviewer.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Author/s&amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The author/s click on the link received in their email and are redirected to a page where they can answer the question. Once they submit the answer, an email is sent to the reviewer notifying him/her that their question has been answered.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:ARSNUsecase.jpeg]]&lt;br /&gt;
&lt;br /&gt;
=== Proposed Tests ===&lt;br /&gt;
1. For use case 1, test whether all the team members receive email with the question.&amp;lt;br/&amp;gt;&lt;br /&gt;
2. For use case 2, test whether the reviewer receive email with the response.&amp;lt;br/&amp;gt;&lt;br /&gt;
3. Test whether all the previous interactions are displayed as chat history.&amp;lt;br/&amp;gt;&lt;br /&gt;
4. The 'Ask Question' button should not be enabled until some text has been entered in the text area.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
===Code Implementation===&lt;br /&gt;
&lt;br /&gt;
*Create a new model '''ReviewChat''' .&lt;br /&gt;
&lt;br /&gt;
*Methods implemented in controller '''review_chats_controller.rb'''&lt;br /&gt;
&lt;br /&gt;
'''def action_allowed?''' to allow chat visibility to the reviewers and the authors of a particular interaction.&lt;br /&gt;
&lt;br /&gt;
  def action_allowed?&lt;br /&gt;
    review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    allowed_users=Array.new&lt;br /&gt;
    team_id=review_chat.team_id&lt;br /&gt;
    teams_users = TeamsUser.where(team_id: team_id)&lt;br /&gt;
    teams_users.each do |teams_user|&lt;br /&gt;
      allowed_users &amp;lt;&amp;lt; User.find(teams_user.user_id).id&lt;br /&gt;
    end&lt;br /&gt;
    allowed_users &amp;lt;&amp;lt; Participant.find(review_chat.reviewer_id).user_id&lt;br /&gt;
    current_role_name.eql? 'Student' and allowed_users.include?(session[:user].id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''def show'''&lt;br /&gt;
&lt;br /&gt;
  def show&lt;br /&gt;
    @review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    @assignment_id=@review_chat.assignment_id&lt;br /&gt;
    @reviewer_id=@review_chat.reviewer_id&lt;br /&gt;
    @team_id=@review_chat.team_id&lt;br /&gt;
    @chat_log=ReviewChat.where(:reviewer_id =&amp;gt; @reviewer_id).where(:team_id =&amp;gt; @team_id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''def submitted_response'''&lt;br /&gt;
&lt;br /&gt;
  def submitted_response&lt;br /&gt;
    @review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    @chat_reviewer=Participant.find(@review_chat.reviewer_id).user_id&lt;br /&gt;
    if(@chat_reviewer==session[:user].id) then&lt;br /&gt;
    	ReviewChat.create(:assignment_id =&amp;gt; @review_chat.assignment_id,:reviewer_id =&amp;gt; @review_chat.reviewer_id, :team_id=&amp;gt;@review_chat.team_id, :type_flag =&amp;gt; 'Q' , :content =&amp;gt; params[:response_area])&lt;br /&gt;
    	ReviewChatsHelper::chat_email_query(params[:id])&lt;br /&gt;
    	flash[:notice]=&amp;quot;Query has been submitted&amp;quot;	&lt;br /&gt;
    else	&lt;br /&gt;
      	ReviewChat.create(:assignment_id =&amp;gt; @review_chat.assignment_id,:reviewer_id =&amp;gt; @review_chat.reviewer_id, :team_id=&amp;gt;@review_chat.team_id, :type_flag =&amp;gt; 'A' , :content =&amp;gt; params[:response_area])&lt;br /&gt;
      	ReviewChatsHelper::chat_email_response(@review_chat.id,@chat_reviewer)&lt;br /&gt;
      flash[:notice]=&amp;quot;Response has been submitted&amp;quot;&lt;br /&gt;
    end	&lt;br /&gt;
    redirect_to action: 'show', id: params[:id]&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
*Create new views as discussed in the design.&lt;br /&gt;
&lt;br /&gt;
*Modify view expertiza/app/views/response/response.html.erb to incorporate text box and corresponding submit button.&lt;br /&gt;
&lt;br /&gt;
===Flowchart===&lt;br /&gt;
&lt;br /&gt;
[[File: ARSNFlowchart1.png]]&lt;br /&gt;
&lt;br /&gt;
===Screenshots===&lt;br /&gt;
&lt;br /&gt;
*The reviewer enters his question in the text area provided and clicks on the &amp;quot;Submit&amp;quot; button.&lt;br /&gt;
[[File: FinalProject1.jpg]]&lt;br /&gt;
*On clicking this button the appropriate method is called in ReviewChats controller which sends an email to all the authors of the topic indicating that a question has been asked about their work. The email contains a link which when clicked on will redirect the author to the appropriate view where he/she can answer the question.&lt;br /&gt;
[[File: FinalProject4.jpg]]&lt;br /&gt;
*On answering the question, the reviewer receives an email indicating that his question has been answered. It also contains a link which redirects the reviewer to the appropriate view where the answer will be displayed.&lt;br /&gt;
*The authorized users will also be able to see a link to open existing chat interaction log.&lt;br /&gt;
[[File: FinalProject3.jpg]]&lt;br /&gt;
*This view also contains the chat history between the author/s and the reviewer for the entire duration of the interaction.&lt;br /&gt;
[[File: FinalProject2.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Suggestions for Future Improvements ==&lt;br /&gt;
&lt;br /&gt;
* This can be extended to a live interactive author-reviewer anonymous chat session inside the Expertiza reviews window.&lt;br /&gt;
* A purging script can be developed which will clear all the interaction records every semester.&lt;br /&gt;
&lt;br /&gt;
==Resources==&lt;br /&gt;
&lt;br /&gt;
* Expertiza Github repository&amp;lt;ref&amp;gt;Expertiza Github repository https://github.com/expertiza/expertiza&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sgulati2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100167</id>
		<title>CSC/ECE 517 Fall 2015 E1586 AnonymousChatBetweenAuthorAndReviewer</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100167"/>
		<updated>2015-12-05T00:58:27Z</updated>

		<summary type="html">&lt;p&gt;Sgulati2: /* Code Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1586 AnonymousChatBetweenAuthorAndReviewer'''&lt;br /&gt;
&lt;br /&gt;
This page provides a brief description of the '''Expertiza''' project. The project is aimed at developing an email based anonymous session between author and a reviewer so that reviewers can ask questions to the authors for any doubts related to the assignments during peer reviewing.&lt;br /&gt;
&lt;br /&gt;
==Project==&lt;br /&gt;
&lt;br /&gt;
=== Introduction to Expertiza ===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a peer review based system which provides an incremental class based learning together with the instructors and the peers. This project has been developed together by faculty and students using [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza handles assignment submissions, team formations, assignment reviews and grades, etc.&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
During reviews, many times reviewers will be having questions about the submitted material and if it's a blocker there is no way that the reviewer can progress further with the review.  As a result, reviewers will end up submitting the empty or incomplete review.&lt;br /&gt;
&lt;br /&gt;
=== Scope ===&lt;br /&gt;
This project is limited to an email based conversation for asking questions and answers. The reviewers would ask questions related to assignment submission doubts to which authors can respond. All this would be taken care as email responses using a link provided in the email. This project does not cater to any live interactive session with spontaneous back-to-back questions and responses.&lt;br /&gt;
&lt;br /&gt;
Following tasks would be incorporated in the project:&lt;br /&gt;
* Provide a ‘TextArea’ input field on review forms, where any reviewer can type in their questions.&lt;br /&gt;
* Create a new button ‘Ask for Quick Help’ on the review forms.&lt;br /&gt;
* An email would be send to the author with the link where he can respond to the questions asked by the reviewers for their submitted work.&lt;br /&gt;
* Reviewers would be notified by an email when authors respond to the the questions.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Discussion of Resolution ===&lt;br /&gt;
&lt;br /&gt;
We will make the following modifications to implement the chat feature:- &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Create a new model which will help to extract, store and validate data in the database table which contains information about the interaction between the author/s and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Edit the view which is used by the response controller to incorporate the text area input field on the review form where the reviewer can ask his/her initial query.&lt;br /&gt;
&lt;br /&gt;
*Create a new controller with methods for authentication for a respective chat log only visible to the author and reviewer of a particular assignment, method to submit a response or a follow up query and show the existing interaction log.&lt;br /&gt;
&lt;br /&gt;
*Create a new helper with the e-mail methods for sending to the author and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Create a new view which will facilitate the author to respond to the queries asked by the reviewer. The reviewer can also use this view to ask any follow up questions.&lt;br /&gt;
&lt;br /&gt;
=== Design Patterns ===&lt;br /&gt;
The implementation team expects that the following design patterns be used in the solution:&lt;br /&gt;
 &lt;br /&gt;
* '''Observer Pattern'''&amp;lt;ref&amp;gt;Observer Design Pattern https://en.wikipedia.org/wiki/Observer_pattern&amp;lt;/ref&amp;gt;: The observer pattern is a software design pattern in which an object, called the subject, maintains a list of its dependents, called observers, and notifies them automatically of any state changes, usually by calling one of their methods. For example, we are notifying the team members whenever the reviewer submits the query.&lt;br /&gt;
&lt;br /&gt;
* '''Iterator Pattern''': In our instance, we need to display the entire chat history of a particular interaction, hence we can use the iterator design pattern to iterate through the previous chat messages.&lt;br /&gt;
&lt;br /&gt;
=== Database Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:Review_chats.png]]&lt;br /&gt;
&lt;br /&gt;
The above figure shows the schema of a new table which will be created in Expertiza to store relevant information about the chat. It contains the following attributes:&lt;br /&gt;
* id: This attribute is auto-generated by rails when we create a table and is auto incremented with each record. It is also the primary key of our table.&lt;br /&gt;
* assignment_id: Stores the ID of the assignment for which the interaction between author and reviewer is taking place.&lt;br /&gt;
* reviewer_id: Stores the ID of the reviewer who asks the questions.&lt;br /&gt;
* team_id: Stores the ID of the team to which the topic belongs.&lt;br /&gt;
* type_flag: Flag which is used to indicate if the particular tuple contains a question or answer. It can take two values, 'Q' for question and 'A' for answer.&lt;br /&gt;
* content: Stores the question asked by the reviewer or the response given by the author/s depending on the value of the type flag.&lt;br /&gt;
&lt;br /&gt;
Records for a particular interaction can be identified by using a combination of assignment_id, reviewer_id and team_id.&lt;br /&gt;
&lt;br /&gt;
=== Use Cases ===&lt;br /&gt;
'''Name:''' Send a question to the author/s about their work.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Reviewer. &amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The reviewer enters his question in the text area which is provided and clicks on the &amp;quot;Ask question&amp;quot; button which is provided as shown in the mock up. On clicking this button an email is sent to the author/s along which a link to answer the question.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''Name:''' Answer the question which has been asked by the reviewer.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Author/s&amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The author/s click on the link received in their email and are redirected to a page where they can answer the question. Once they submit the answer, an email is sent to the reviewer notifying him/her that their question has been answered.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:ARSNUsecase.jpeg]]&lt;br /&gt;
&lt;br /&gt;
=== Proposed Tests ===&lt;br /&gt;
1. For use case 1, test whether all the team members receive email with the question.&amp;lt;br/&amp;gt;&lt;br /&gt;
2. For use case 2, test whether the reviewer receive email with the response.&amp;lt;br/&amp;gt;&lt;br /&gt;
3. Test whether all the previous interactions are displayed as chat history.&amp;lt;br/&amp;gt;&lt;br /&gt;
4. The 'Ask Question' button should not be enabled until some text has been entered in the text area.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
===Code Implementation===&lt;br /&gt;
&lt;br /&gt;
*Create a new model '''ReviewChat''' .&lt;br /&gt;
&lt;br /&gt;
*Methods implemented in controller '''review_chats_controller.rb'''&lt;br /&gt;
&lt;br /&gt;
'''def action_allowed?'''&lt;br /&gt;
&lt;br /&gt;
  def action_allowed?&lt;br /&gt;
    review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    allowed_users=Array.new&lt;br /&gt;
    team_id=review_chat.team_id&lt;br /&gt;
    teams_users = TeamsUser.where(team_id: team_id)&lt;br /&gt;
    teams_users.each do |teams_user|&lt;br /&gt;
      allowed_users &amp;lt;&amp;lt; User.find(teams_user.user_id).id&lt;br /&gt;
    end&lt;br /&gt;
    allowed_users &amp;lt;&amp;lt; Participant.find(review_chat.reviewer_id).user_id&lt;br /&gt;
    current_role_name.eql? 'Student' and allowed_users.include?(session[:user].id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''def show'''&lt;br /&gt;
&lt;br /&gt;
  def show&lt;br /&gt;
    @review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    @assignment_id=@review_chat.assignment_id&lt;br /&gt;
    @reviewer_id=@review_chat.reviewer_id&lt;br /&gt;
    @team_id=@review_chat.team_id&lt;br /&gt;
    @chat_log=ReviewChat.where(:reviewer_id =&amp;gt; @reviewer_id).where(:team_id =&amp;gt; @team_id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''def submitted_response'''&lt;br /&gt;
&lt;br /&gt;
  def submitted_response&lt;br /&gt;
    @review_chat = ReviewChat.find(params[:id])&lt;br /&gt;
    @chat_reviewer=Participant.find(@review_chat.reviewer_id).user_id&lt;br /&gt;
    if(@chat_reviewer==session[:user].id) then&lt;br /&gt;
    	ReviewChat.create(:assignment_id =&amp;gt; @review_chat.assignment_id,:reviewer_id =&amp;gt; @review_chat.reviewer_id, :team_id=&amp;gt;@review_chat.team_id, :type_flag =&amp;gt; 'Q' , :content =&amp;gt; params[:response_area])&lt;br /&gt;
    	ReviewChatsHelper::chat_email_query(params[:id])&lt;br /&gt;
    	flash[:notice]=&amp;quot;Query has been submitted&amp;quot;	&lt;br /&gt;
    else	&lt;br /&gt;
      	ReviewChat.create(:assignment_id =&amp;gt; @review_chat.assignment_id,:reviewer_id =&amp;gt; @review_chat.reviewer_id, :team_id=&amp;gt;@review_chat.team_id, :type_flag =&amp;gt; 'A' , :content =&amp;gt; params[:response_area])&lt;br /&gt;
      	ReviewChatsHelper::chat_email_response(@review_chat.id,@chat_reviewer)&lt;br /&gt;
      flash[:notice]=&amp;quot;Response has been submitted&amp;quot;&lt;br /&gt;
    end	&lt;br /&gt;
    redirect_to action: 'show', id: params[:id]&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
*Create new views as discussed in the design.&lt;br /&gt;
&lt;br /&gt;
*Modify view expertiza/app/views/response/response.html.erb to incorporate text box and corresponding submit button.&lt;br /&gt;
&lt;br /&gt;
===Flowchart===&lt;br /&gt;
&lt;br /&gt;
[[File: ARSNFlowchart1.png]]&lt;br /&gt;
&lt;br /&gt;
===Screenshots===&lt;br /&gt;
&lt;br /&gt;
*The reviewer enters his question in the text area provided and clicks on the &amp;quot;Submit&amp;quot; button.&lt;br /&gt;
[[File: FinalProject1.jpg]]&lt;br /&gt;
*On clicking this button the appropriate method is called in ReviewChats controller which sends an email to all the authors of the topic indicating that a question has been asked about their work. The email contains a link which when clicked on will redirect the author to the appropriate view where he/she can answer the question.&lt;br /&gt;
[[File: FinalProject4.jpg]]&lt;br /&gt;
*On answering the question, the reviewer receives an email indicating that his question has been answered. It also contains a link which redirects the reviewer to the appropriate view where the answer will be displayed.&lt;br /&gt;
*The authorized users will also be able to see a link to open existing chat interaction log.&lt;br /&gt;
[[File: FinalProject3.jpg]]&lt;br /&gt;
*This view also contains the chat history between the author/s and the reviewer for the entire duration of the interaction.&lt;br /&gt;
[[File: FinalProject2.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Suggestions for Future Improvements ==&lt;br /&gt;
&lt;br /&gt;
* This can be extended to a live interactive author-reviewer anonymous chat session inside the Expertiza reviews window.&lt;br /&gt;
* A purging script can be developed which will clear all the interaction records every semester.&lt;br /&gt;
&lt;br /&gt;
==Resources==&lt;br /&gt;
&lt;br /&gt;
* Expertiza Github repository&amp;lt;ref&amp;gt;Expertiza Github repository https://github.com/expertiza/expertiza&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sgulati2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100164</id>
		<title>CSC/ECE 517 Fall 2015 E1586 AnonymousChatBetweenAuthorAndReviewer</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100164"/>
		<updated>2015-12-05T00:57:02Z</updated>

		<summary type="html">&lt;p&gt;Sgulati2: /* Code Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1586 AnonymousChatBetweenAuthorAndReviewer'''&lt;br /&gt;
&lt;br /&gt;
This page provides a brief description of the '''Expertiza''' project. The project is aimed at developing an email based anonymous session between author and a reviewer so that reviewers can ask questions to the authors for any doubts related to the assignments during peer reviewing.&lt;br /&gt;
&lt;br /&gt;
==Project==&lt;br /&gt;
&lt;br /&gt;
=== Introduction to Expertiza ===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a peer review based system which provides an incremental class based learning together with the instructors and the peers. This project has been developed together by faculty and students using [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza handles assignment submissions, team formations, assignment reviews and grades, etc.&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
During reviews, many times reviewers will be having questions about the submitted material and if it's a blocker there is no way that the reviewer can progress further with the review.  As a result, reviewers will end up submitting the empty or incomplete review.&lt;br /&gt;
&lt;br /&gt;
=== Scope ===&lt;br /&gt;
This project is limited to an email based conversation for asking questions and answers. The reviewers would ask questions related to assignment submission doubts to which authors can respond. All this would be taken care as email responses using a link provided in the email. This project does not cater to any live interactive session with spontaneous back-to-back questions and responses.&lt;br /&gt;
&lt;br /&gt;
Following tasks would be incorporated in the project:&lt;br /&gt;
* Provide a ‘TextArea’ input field on review forms, where any reviewer can type in their questions.&lt;br /&gt;
* Create a new button ‘Ask for Quick Help’ on the review forms.&lt;br /&gt;
* An email would be send to the author with the link where he can respond to the questions asked by the reviewers for their submitted work.&lt;br /&gt;
* Reviewers would be notified by an email when authors respond to the the questions.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Discussion of Resolution ===&lt;br /&gt;
&lt;br /&gt;
We will make the following modifications to implement the chat feature:- &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Create a new model which will help to extract, store and validate data in the database table which contains information about the interaction between the author/s and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Edit the view which is used by the response controller to incorporate the text area input field on the review form where the reviewer can ask his/her initial query.&lt;br /&gt;
&lt;br /&gt;
*Create a new controller with methods for authentication for a respective chat log only visible to the author and reviewer of a particular assignment, method to submit a response or a follow up query and show the existing interaction log.&lt;br /&gt;
&lt;br /&gt;
*Create a new helper with the e-mail methods for sending to the author and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Create a new view which will facilitate the author to respond to the queries asked by the reviewer. The reviewer can also use this view to ask any follow up questions.&lt;br /&gt;
&lt;br /&gt;
=== Design Patterns ===&lt;br /&gt;
The implementation team expects that the following design patterns be used in the solution:&lt;br /&gt;
 &lt;br /&gt;
* '''Observer Pattern'''&amp;lt;ref&amp;gt;Observer Design Pattern https://en.wikipedia.org/wiki/Observer_pattern&amp;lt;/ref&amp;gt;: The observer pattern is a software design pattern in which an object, called the subject, maintains a list of its dependents, called observers, and notifies them automatically of any state changes, usually by calling one of their methods. For example, we are notifying the team members whenever the reviewer submits the query.&lt;br /&gt;
&lt;br /&gt;
* '''Iterator Pattern''': In our instance, we need to display the entire chat history of a particular interaction, hence we can use the iterator design pattern to iterate through the previous chat messages.&lt;br /&gt;
&lt;br /&gt;
=== Database Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:Review_chats.png]]&lt;br /&gt;
&lt;br /&gt;
The above figure shows the schema of a new table which will be created in Expertiza to store relevant information about the chat. It contains the following attributes:&lt;br /&gt;
* id: This attribute is auto-generated by rails when we create a table and is auto incremented with each record. It is also the primary key of our table.&lt;br /&gt;
* assignment_id: Stores the ID of the assignment for which the interaction between author and reviewer is taking place.&lt;br /&gt;
* reviewer_id: Stores the ID of the reviewer who asks the questions.&lt;br /&gt;
* team_id: Stores the ID of the team to which the topic belongs.&lt;br /&gt;
* type_flag: Flag which is used to indicate if the particular tuple contains a question or answer. It can take two values, 'Q' for question and 'A' for answer.&lt;br /&gt;
* content: Stores the question asked by the reviewer or the response given by the author/s depending on the value of the type flag.&lt;br /&gt;
&lt;br /&gt;
Records for a particular interaction can be identified by using a combination of assignment_id, reviewer_id and team_id.&lt;br /&gt;
&lt;br /&gt;
=== Use Cases ===&lt;br /&gt;
'''Name:''' Send a question to the author/s about their work.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Reviewer. &amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The reviewer enters his question in the text area which is provided and clicks on the &amp;quot;Ask question&amp;quot; button which is provided as shown in the mock up. On clicking this button an email is sent to the author/s along which a link to answer the question.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''Name:''' Answer the question which has been asked by the reviewer.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Author/s&amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The author/s click on the link received in their email and are redirected to a page where they can answer the question. Once they submit the answer, an email is sent to the reviewer notifying him/her that their question has been answered.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:ARSNUsecase.jpeg]]&lt;br /&gt;
&lt;br /&gt;
=== Proposed Tests ===&lt;br /&gt;
1. For use case 1, test whether all the team members receive email with the question.&amp;lt;br/&amp;gt;&lt;br /&gt;
2. For use case 2, test whether the reviewer receive email with the response.&amp;lt;br/&amp;gt;&lt;br /&gt;
3. Test whether all the previous interactions are displayed as chat history.&amp;lt;br/&amp;gt;&lt;br /&gt;
4. The 'Ask Question' button should not be enabled until some text has been entered in the text area.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
===Code Implementation===&lt;br /&gt;
&lt;br /&gt;
*Create a new model '''ReviewChat''' .&lt;br /&gt;
&lt;br /&gt;
*Methods implemented in controller '''review_chats_controller.rb'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*Create new views as discussed in the design.&lt;br /&gt;
&lt;br /&gt;
*Modify view expertiza/app/views/response/response.html.erb to incorporate text box and corresponding submit button.&lt;br /&gt;
&lt;br /&gt;
===Flowchart===&lt;br /&gt;
&lt;br /&gt;
[[File: ARSNFlowchart1.png]]&lt;br /&gt;
&lt;br /&gt;
===Screenshots===&lt;br /&gt;
&lt;br /&gt;
*The reviewer enters his question in the text area provided and clicks on the &amp;quot;Submit&amp;quot; button.&lt;br /&gt;
[[File: FinalProject1.jpg]]&lt;br /&gt;
*On clicking this button the appropriate method is called in ReviewChats controller which sends an email to all the authors of the topic indicating that a question has been asked about their work. The email contains a link which when clicked on will redirect the author to the appropriate view where he/she can answer the question.&lt;br /&gt;
[[File: FinalProject4.jpg]]&lt;br /&gt;
*On answering the question, the reviewer receives an email indicating that his question has been answered. It also contains a link which redirects the reviewer to the appropriate view where the answer will be displayed.&lt;br /&gt;
*The authorized users will also be able to see a link to open existing chat interaction log.&lt;br /&gt;
[[File: FinalProject3.jpg]]&lt;br /&gt;
*This view also contains the chat history between the author/s and the reviewer for the entire duration of the interaction.&lt;br /&gt;
[[File: FinalProject2.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Suggestions for Future Improvements ==&lt;br /&gt;
&lt;br /&gt;
* This can be extended to a live interactive author-reviewer anonymous chat session inside the Expertiza reviews window.&lt;br /&gt;
* A purging script can be developed which will clear all the interaction records every semester.&lt;br /&gt;
&lt;br /&gt;
==Resources==&lt;br /&gt;
&lt;br /&gt;
* Expertiza Github repository&amp;lt;ref&amp;gt;Expertiza Github repository https://github.com/expertiza/expertiza&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sgulati2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100162</id>
		<title>CSC/ECE 517 Fall 2015 E1586 AnonymousChatBetweenAuthorAndReviewer</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100162"/>
		<updated>2015-12-05T00:55:40Z</updated>

		<summary type="html">&lt;p&gt;Sgulati2: /* Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1586 AnonymousChatBetweenAuthorAndReviewer'''&lt;br /&gt;
&lt;br /&gt;
This page provides a brief description of the '''Expertiza''' project. The project is aimed at developing an email based anonymous session between author and a reviewer so that reviewers can ask questions to the authors for any doubts related to the assignments during peer reviewing.&lt;br /&gt;
&lt;br /&gt;
==Project==&lt;br /&gt;
&lt;br /&gt;
=== Introduction to Expertiza ===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a peer review based system which provides an incremental class based learning together with the instructors and the peers. This project has been developed together by faculty and students using [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza handles assignment submissions, team formations, assignment reviews and grades, etc.&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
During reviews, many times reviewers will be having questions about the submitted material and if it's a blocker there is no way that the reviewer can progress further with the review.  As a result, reviewers will end up submitting the empty or incomplete review.&lt;br /&gt;
&lt;br /&gt;
=== Scope ===&lt;br /&gt;
This project is limited to an email based conversation for asking questions and answers. The reviewers would ask questions related to assignment submission doubts to which authors can respond. All this would be taken care as email responses using a link provided in the email. This project does not cater to any live interactive session with spontaneous back-to-back questions and responses.&lt;br /&gt;
&lt;br /&gt;
Following tasks would be incorporated in the project:&lt;br /&gt;
* Provide a ‘TextArea’ input field on review forms, where any reviewer can type in their questions.&lt;br /&gt;
* Create a new button ‘Ask for Quick Help’ on the review forms.&lt;br /&gt;
* An email would be send to the author with the link where he can respond to the questions asked by the reviewers for their submitted work.&lt;br /&gt;
* Reviewers would be notified by an email when authors respond to the the questions.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Discussion of Resolution ===&lt;br /&gt;
&lt;br /&gt;
We will make the following modifications to implement the chat feature:- &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Create a new model which will help to extract, store and validate data in the database table which contains information about the interaction between the author/s and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Edit the view which is used by the response controller to incorporate the text area input field on the review form where the reviewer can ask his/her initial query.&lt;br /&gt;
&lt;br /&gt;
*Create a new controller with methods for authentication for a respective chat log only visible to the author and reviewer of a particular assignment, method to submit a response or a follow up query and show the existing interaction log.&lt;br /&gt;
&lt;br /&gt;
*Create a new helper with the e-mail methods for sending to the author and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Create a new view which will facilitate the author to respond to the queries asked by the reviewer. The reviewer can also use this view to ask any follow up questions.&lt;br /&gt;
&lt;br /&gt;
=== Design Patterns ===&lt;br /&gt;
The implementation team expects that the following design patterns be used in the solution:&lt;br /&gt;
 &lt;br /&gt;
* '''Observer Pattern'''&amp;lt;ref&amp;gt;Observer Design Pattern https://en.wikipedia.org/wiki/Observer_pattern&amp;lt;/ref&amp;gt;: The observer pattern is a software design pattern in which an object, called the subject, maintains a list of its dependents, called observers, and notifies them automatically of any state changes, usually by calling one of their methods. For example, we are notifying the team members whenever the reviewer submits the query.&lt;br /&gt;
&lt;br /&gt;
* '''Iterator Pattern''': In our instance, we need to display the entire chat history of a particular interaction, hence we can use the iterator design pattern to iterate through the previous chat messages.&lt;br /&gt;
&lt;br /&gt;
=== Database Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:Review_chats.png]]&lt;br /&gt;
&lt;br /&gt;
The above figure shows the schema of a new table which will be created in Expertiza to store relevant information about the chat. It contains the following attributes:&lt;br /&gt;
* id: This attribute is auto-generated by rails when we create a table and is auto incremented with each record. It is also the primary key of our table.&lt;br /&gt;
* assignment_id: Stores the ID of the assignment for which the interaction between author and reviewer is taking place.&lt;br /&gt;
* reviewer_id: Stores the ID of the reviewer who asks the questions.&lt;br /&gt;
* team_id: Stores the ID of the team to which the topic belongs.&lt;br /&gt;
* type_flag: Flag which is used to indicate if the particular tuple contains a question or answer. It can take two values, 'Q' for question and 'A' for answer.&lt;br /&gt;
* content: Stores the question asked by the reviewer or the response given by the author/s depending on the value of the type flag.&lt;br /&gt;
&lt;br /&gt;
Records for a particular interaction can be identified by using a combination of assignment_id, reviewer_id and team_id.&lt;br /&gt;
&lt;br /&gt;
=== Use Cases ===&lt;br /&gt;
'''Name:''' Send a question to the author/s about their work.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Reviewer. &amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The reviewer enters his question in the text area which is provided and clicks on the &amp;quot;Ask question&amp;quot; button which is provided as shown in the mock up. On clicking this button an email is sent to the author/s along which a link to answer the question.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''Name:''' Answer the question which has been asked by the reviewer.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Author/s&amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The author/s click on the link received in their email and are redirected to a page where they can answer the question. Once they submit the answer, an email is sent to the reviewer notifying him/her that their question has been answered.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:ARSNUsecase.jpeg]]&lt;br /&gt;
&lt;br /&gt;
=== Proposed Tests ===&lt;br /&gt;
1. For use case 1, test whether all the team members receive email with the question.&amp;lt;br/&amp;gt;&lt;br /&gt;
2. For use case 2, test whether the reviewer receive email with the response.&amp;lt;br/&amp;gt;&lt;br /&gt;
3. Test whether all the previous interactions are displayed as chat history.&amp;lt;br/&amp;gt;&lt;br /&gt;
4. The 'Ask Question' button should not be enabled until some text has been entered in the text area.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
===Code Implementation===&lt;br /&gt;
&lt;br /&gt;
*Create a new model '''ReviewChat''' .&lt;br /&gt;
&lt;br /&gt;
*Create a new controller '''ReviewChats'''.&lt;br /&gt;
&lt;br /&gt;
*Create new views as discussed in the design.&lt;br /&gt;
&lt;br /&gt;
*Modify view expertiza/app/views/response/response.html.erb to incorporate text box and corresponding submit button.&lt;br /&gt;
&lt;br /&gt;
===Flowchart===&lt;br /&gt;
&lt;br /&gt;
[[File: ARSNFlowchart1.png]]&lt;br /&gt;
&lt;br /&gt;
===Screenshots===&lt;br /&gt;
&lt;br /&gt;
*The reviewer enters his question in the text area provided and clicks on the &amp;quot;Submit&amp;quot; button.&lt;br /&gt;
[[File: FinalProject1.jpg]]&lt;br /&gt;
*On clicking this button the appropriate method is called in ReviewChats controller which sends an email to all the authors of the topic indicating that a question has been asked about their work. The email contains a link which when clicked on will redirect the author to the appropriate view where he/she can answer the question.&lt;br /&gt;
[[File: FinalProject4.jpg]]&lt;br /&gt;
*On answering the question, the reviewer receives an email indicating that his question has been answered. It also contains a link which redirects the reviewer to the appropriate view where the answer will be displayed.&lt;br /&gt;
*The authorized users will also be able to see a link to open existing chat interaction log.&lt;br /&gt;
[[File: FinalProject3.jpg]]&lt;br /&gt;
*This view also contains the chat history between the author/s and the reviewer for the entire duration of the interaction.&lt;br /&gt;
[[File: FinalProject2.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Suggestions for Future Improvements ==&lt;br /&gt;
&lt;br /&gt;
* This can be extended to a live interactive author-reviewer anonymous chat session inside the Expertiza reviews window.&lt;br /&gt;
* A purging script can be developed which will clear all the interaction records every semester.&lt;br /&gt;
&lt;br /&gt;
==Resources==&lt;br /&gt;
&lt;br /&gt;
* Expertiza Github repository&amp;lt;ref&amp;gt;Expertiza Github repository https://github.com/expertiza/expertiza&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sgulati2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100161</id>
		<title>CSC/ECE 517 Fall 2015 E1586 AnonymousChatBetweenAuthorAndReviewer</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100161"/>
		<updated>2015-12-05T00:55:16Z</updated>

		<summary type="html">&lt;p&gt;Sgulati2: /* Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1586 AnonymousChatBetweenAuthorAndReviewer'''&lt;br /&gt;
&lt;br /&gt;
This page provides a brief description of the '''Expertiza''' project. The project is aimed at developing an email based anonymous session between author and a reviewer so that reviewers can ask questions to the authors for any doubts related to the assignments during peer reviewing.&lt;br /&gt;
&lt;br /&gt;
==Project==&lt;br /&gt;
&lt;br /&gt;
=== Introduction to Expertiza ===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a peer review based system which provides an incremental class based learning together with the instructors and the peers. This project has been developed together by faculty and students using [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza handles assignment submissions, team formations, assignment reviews and grades, etc.&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
During reviews, many times reviewers will be having questions about the submitted material and if it's a blocker there is no way that the reviewer can progress further with the review.  As a result, reviewers will end up submitting the empty or incomplete review.&lt;br /&gt;
&lt;br /&gt;
=== Scope ===&lt;br /&gt;
This project is limited to an email based conversation for asking questions and answers. The reviewers would ask questions related to assignment submission doubts to which authors can respond. All this would be taken care as email responses using a link provided in the email. This project does not cater to any live interactive session with spontaneous back-to-back questions and responses.&lt;br /&gt;
&lt;br /&gt;
Following tasks would be incorporated in the project:&lt;br /&gt;
* Provide a ‘TextArea’ input field on review forms, where any reviewer can type in their questions.&lt;br /&gt;
* Create a new button ‘Ask for Quick Help’ on the review forms.&lt;br /&gt;
* An email would be send to the author with the link where he can respond to the questions asked by the reviewers for their submitted work.&lt;br /&gt;
* Reviewers would be notified by an email when authors respond to the the questions.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Discussion of Resolution ===&lt;br /&gt;
&lt;br /&gt;
We will make the following modifications to implement the chat feature:- &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Create a new model which will help to extract, store and validate data in the database table which contains information about the interaction between the author/s and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Edit the view which is used by the response controller to incorporate the text area input field on the review form where the reviewer can ask his/her initial query.&lt;br /&gt;
&lt;br /&gt;
*Create a new controller with methods for authentication for a respective chat log only visible to the author and reviewer of a particular assignment, method to submit a response or a follow up query and show the existing interaction log.&lt;br /&gt;
&lt;br /&gt;
*Create a new helper with the e-mail methods for sending to the author and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Create a new view which will facilitate the author to respond to the queries asked by the reviewer. The reviewer can also use this view to ask any follow up questions.&lt;br /&gt;
&lt;br /&gt;
=== Design Patterns ===&lt;br /&gt;
The implementation team expects that the following design patterns be used in the solution:&lt;br /&gt;
 &lt;br /&gt;
* '''Observer Pattern'''&amp;lt;ref&amp;gt;Observer Design Pattern https://en.wikipedia.org/wiki/Observer_pattern&amp;lt;/ref&amp;gt;: The observer pattern is a software design pattern in which an object, called the subject, maintains a list of its dependents, called observers, and notifies them automatically of any state changes, usually by calling one of their methods. For example, we are notifying the team members whenever the reviewer submits the query.&lt;br /&gt;
&lt;br /&gt;
* '''Iterator Pattern''': In our instance, we need to display the entire chat history of a particular interaction, hence we can use the iterator design pattern to iterate through the previous chat messages.&lt;br /&gt;
&lt;br /&gt;
=== Database Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:Review_chats.png]]&lt;br /&gt;
&lt;br /&gt;
The above figure shows the schema of a new table which will be created in Expertiza to store relevant information about the chat. It contains the following attributes:&lt;br /&gt;
* id: This attribute is auto-generated by rails when we create a table and is auto incremented with each record. It is also the primary key of our table.&lt;br /&gt;
* assignment_id: Stores the ID of the assignment for which the interaction between author and reviewer is taking place.&lt;br /&gt;
* reviewer_id: Stores the ID of the reviewer who asks the questions.&lt;br /&gt;
* team_id: Stores the ID of the team to which the topic belongs.&lt;br /&gt;
* type_flag: Flag which is used to indicate if the particular tuple contains a question or answer. It can take two values, 'Q' for question and 'A' for answer.&lt;br /&gt;
* content: Stores the question asked by the reviewer or the response given by the author/s depending on the value of the type flag.&lt;br /&gt;
&lt;br /&gt;
Records for a particular interaction can be identified by using a combination of assignment_id, reviewer_id and team_id.&lt;br /&gt;
&lt;br /&gt;
=== Use Cases ===&lt;br /&gt;
'''Name:''' Send a question to the author/s about their work.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Reviewer. &amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The reviewer enters his question in the text area which is provided and clicks on the &amp;quot;Ask question&amp;quot; button which is provided as shown in the mock up. On clicking this button an email is sent to the author/s along which a link to answer the question.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''Name:''' Answer the question which has been asked by the reviewer.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Author/s&amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The author/s click on the link received in their email and are redirected to a page where they can answer the question. Once they submit the answer, an email is sent to the reviewer notifying him/her that their question has been answered.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:ARSNUsecase.jpeg]]&lt;br /&gt;
&lt;br /&gt;
=== Proposed Tests ===&lt;br /&gt;
1. For use case 1, test whether all the team members receive email with the question.&amp;lt;br/&amp;gt;&lt;br /&gt;
2. For use case 2, test whether the reviewer receive email with the response.&amp;lt;br/&amp;gt;&lt;br /&gt;
3. Test whether all the previous interactions are displayed as chat history.&amp;lt;br/&amp;gt;&lt;br /&gt;
4. The 'Ask Question' button should not be enabled until some text has been entered in the text area.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
''Code Implementation''&lt;br /&gt;
&lt;br /&gt;
*Create a new model '''ReviewChat''' .&lt;br /&gt;
&lt;br /&gt;
*Create a new controller '''ReviewChats'''.&lt;br /&gt;
&lt;br /&gt;
*Create new views as discussed in the design.&lt;br /&gt;
&lt;br /&gt;
*Modify view expertiza/app/views/response/response.html.erb to incorporate text box and corresponding submit button.&lt;br /&gt;
&lt;br /&gt;
'''Flowchart'''&lt;br /&gt;
&lt;br /&gt;
[[File: ARSNFlowchart1.png]]&lt;br /&gt;
&lt;br /&gt;
'''Screenshots'''&lt;br /&gt;
&lt;br /&gt;
*The reviewer enters his question in the text area provided and clicks on the &amp;quot;Submit&amp;quot; button.&lt;br /&gt;
[[File: FinalProject1.jpg]]&lt;br /&gt;
*On clicking this button the appropriate method is called in ReviewChats controller which sends an email to all the authors of the topic indicating that a question has been asked about their work. The email contains a link which when clicked on will redirect the author to the appropriate view where he/she can answer the question.&lt;br /&gt;
[[File: FinalProject4.jpg]]&lt;br /&gt;
*On answering the question, the reviewer receives an email indicating that his question has been answered. It also contains a link which redirects the reviewer to the appropriate view where the answer will be displayed.&lt;br /&gt;
*The authorized users will also be able to see a link to open existing chat interaction log.&lt;br /&gt;
[[File: FinalProject3.jpg]]&lt;br /&gt;
*This view also contains the chat history between the author/s and the reviewer for the entire duration of the interaction.&lt;br /&gt;
[[File: FinalProject2.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Suggestions for Future Improvements ==&lt;br /&gt;
&lt;br /&gt;
* This can be extended to a live interactive author-reviewer anonymous chat session inside the Expertiza reviews window.&lt;br /&gt;
* A purging script can be developed which will clear all the interaction records every semester.&lt;br /&gt;
&lt;br /&gt;
==Resources==&lt;br /&gt;
&lt;br /&gt;
* Expertiza Github repository&amp;lt;ref&amp;gt;Expertiza Github repository https://github.com/expertiza/expertiza&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sgulati2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100160</id>
		<title>CSC/ECE 517 Fall 2015 E1586 AnonymousChatBetweenAuthorAndReviewer</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100160"/>
		<updated>2015-12-05T00:54:28Z</updated>

		<summary type="html">&lt;p&gt;Sgulati2: /* Design */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1586 AnonymousChatBetweenAuthorAndReviewer'''&lt;br /&gt;
&lt;br /&gt;
This page provides a brief description of the '''Expertiza''' project. The project is aimed at developing an email based anonymous session between author and a reviewer so that reviewers can ask questions to the authors for any doubts related to the assignments during peer reviewing.&lt;br /&gt;
&lt;br /&gt;
==Project==&lt;br /&gt;
&lt;br /&gt;
=== Introduction to Expertiza ===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a peer review based system which provides an incremental class based learning together with the instructors and the peers. This project has been developed together by faculty and students using [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza handles assignment submissions, team formations, assignment reviews and grades, etc.&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
During reviews, many times reviewers will be having questions about the submitted material and if it's a blocker there is no way that the reviewer can progress further with the review.  As a result, reviewers will end up submitting the empty or incomplete review.&lt;br /&gt;
&lt;br /&gt;
=== Scope ===&lt;br /&gt;
This project is limited to an email based conversation for asking questions and answers. The reviewers would ask questions related to assignment submission doubts to which authors can respond. All this would be taken care as email responses using a link provided in the email. This project does not cater to any live interactive session with spontaneous back-to-back questions and responses.&lt;br /&gt;
&lt;br /&gt;
Following tasks would be incorporated in the project:&lt;br /&gt;
* Provide a ‘TextArea’ input field on review forms, where any reviewer can type in their questions.&lt;br /&gt;
* Create a new button ‘Ask for Quick Help’ on the review forms.&lt;br /&gt;
* An email would be send to the author with the link where he can respond to the questions asked by the reviewers for their submitted work.&lt;br /&gt;
* Reviewers would be notified by an email when authors respond to the the questions.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Discussion of Resolution ===&lt;br /&gt;
&lt;br /&gt;
We will make the following modifications to implement the chat feature:- &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Create a new model which will help to extract, store and validate data in the database table which contains information about the interaction between the author/s and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Edit the view which is used by the response controller to incorporate the text area input field on the review form where the reviewer can ask his/her initial query.&lt;br /&gt;
&lt;br /&gt;
*Create a new controller with methods for authentication for a respective chat log only visible to the author and reviewer of a particular assignment, method to submit a response or a follow up query and show the existing interaction log.&lt;br /&gt;
&lt;br /&gt;
*Create a new helper with the e-mail methods for sending to the author and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Create a new view which will facilitate the author to respond to the queries asked by the reviewer. The reviewer can also use this view to ask any follow up questions.&lt;br /&gt;
&lt;br /&gt;
=== Design Patterns ===&lt;br /&gt;
The implementation team expects that the following design patterns be used in the solution:&lt;br /&gt;
 &lt;br /&gt;
* '''Observer Pattern'''&amp;lt;ref&amp;gt;Observer Design Pattern https://en.wikipedia.org/wiki/Observer_pattern&amp;lt;/ref&amp;gt;: The observer pattern is a software design pattern in which an object, called the subject, maintains a list of its dependents, called observers, and notifies them automatically of any state changes, usually by calling one of their methods. For example, we are notifying the team members whenever the reviewer submits the query.&lt;br /&gt;
&lt;br /&gt;
* '''Iterator Pattern''': In our instance, we need to display the entire chat history of a particular interaction, hence we can use the iterator design pattern to iterate through the previous chat messages.&lt;br /&gt;
&lt;br /&gt;
=== Database Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:Review_chats.png]]&lt;br /&gt;
&lt;br /&gt;
The above figure shows the schema of a new table which will be created in Expertiza to store relevant information about the chat. It contains the following attributes:&lt;br /&gt;
* id: This attribute is auto-generated by rails when we create a table and is auto incremented with each record. It is also the primary key of our table.&lt;br /&gt;
* assignment_id: Stores the ID of the assignment for which the interaction between author and reviewer is taking place.&lt;br /&gt;
* reviewer_id: Stores the ID of the reviewer who asks the questions.&lt;br /&gt;
* team_id: Stores the ID of the team to which the topic belongs.&lt;br /&gt;
* type_flag: Flag which is used to indicate if the particular tuple contains a question or answer. It can take two values, 'Q' for question and 'A' for answer.&lt;br /&gt;
* content: Stores the question asked by the reviewer or the response given by the author/s depending on the value of the type flag.&lt;br /&gt;
&lt;br /&gt;
Records for a particular interaction can be identified by using a combination of assignment_id, reviewer_id and team_id.&lt;br /&gt;
&lt;br /&gt;
=== Use Cases ===&lt;br /&gt;
'''Name:''' Send a question to the author/s about their work.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Reviewer. &amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The reviewer enters his question in the text area which is provided and clicks on the &amp;quot;Ask question&amp;quot; button which is provided as shown in the mock up. On clicking this button an email is sent to the author/s along which a link to answer the question.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''Name:''' Answer the question which has been asked by the reviewer.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Author/s&amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The author/s click on the link received in their email and are redirected to a page where they can answer the question. Once they submit the answer, an email is sent to the reviewer notifying him/her that their question has been answered.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:ARSNUsecase.jpeg]]&lt;br /&gt;
&lt;br /&gt;
=== Proposed Tests ===&lt;br /&gt;
1. For use case 1, test whether all the team members receive email with the question.&amp;lt;br/&amp;gt;&lt;br /&gt;
2. For use case 2, test whether the reviewer receive email with the response.&amp;lt;br/&amp;gt;&lt;br /&gt;
3. Test whether all the previous interactions are displayed as chat history.&amp;lt;br/&amp;gt;&lt;br /&gt;
4. The 'Ask Question' button should not be enabled until some text has been entered in the text area.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
'''Files created/modified'''&lt;br /&gt;
&lt;br /&gt;
*Create a new model '''ReviewChat''' .&lt;br /&gt;
&lt;br /&gt;
*Create a new controller '''ReviewChats'''.&lt;br /&gt;
&lt;br /&gt;
*Create new views as discussed in the design.&lt;br /&gt;
&lt;br /&gt;
*Modify view expertiza/app/views/response/response.html.erb to incorporate text box and corresponding submit button.&lt;br /&gt;
&lt;br /&gt;
'''Flowchart'''&lt;br /&gt;
&lt;br /&gt;
[[File: ARSNFlowchart1.png]]&lt;br /&gt;
&lt;br /&gt;
'''Flow'''&lt;br /&gt;
&lt;br /&gt;
*The reviewer enters his question in the text area provided and clicks on the &amp;quot;Submit&amp;quot; button.&lt;br /&gt;
[[File: FinalProject1.jpg]]&lt;br /&gt;
*On clicking this button the appropriate method is called in ReviewChats controller which sends an email to all the authors of the topic indicating that a question has been asked about their work. The email contains a link which when clicked on will redirect the author to the appropriate view where he/she can answer the question.&lt;br /&gt;
[[File: FinalProject4.jpg]]&lt;br /&gt;
*On answering the question, the reviewer receives an email indicating that his question has been answered. It also contains a link which redirects the reviewer to the appropriate view where the answer will be displayed.&lt;br /&gt;
*The authorized users will also be able to see a link to open existing chat interaction log.&lt;br /&gt;
[[File: FinalProject3.jpg]]&lt;br /&gt;
*This view also contains the chat history between the author/s and the reviewer for the entire duration of the interaction.&lt;br /&gt;
[[File: FinalProject2.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Suggestions for Future Improvements ==&lt;br /&gt;
&lt;br /&gt;
* This can be extended to a live interactive author-reviewer anonymous chat session inside the Expertiza reviews window.&lt;br /&gt;
* A purging script can be developed which will clear all the interaction records every semester.&lt;br /&gt;
&lt;br /&gt;
==Resources==&lt;br /&gt;
&lt;br /&gt;
* Expertiza Github repository&amp;lt;ref&amp;gt;Expertiza Github repository https://github.com/expertiza/expertiza&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sgulati2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100159</id>
		<title>CSC/ECE 517 Fall 2015 E1586 AnonymousChatBetweenAuthorAndReviewer</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100159"/>
		<updated>2015-12-05T00:54:00Z</updated>

		<summary type="html">&lt;p&gt;Sgulati2: /* Discussion of Resolution */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1586 AnonymousChatBetweenAuthorAndReviewer'''&lt;br /&gt;
&lt;br /&gt;
This page provides a brief description of the '''Expertiza''' project. The project is aimed at developing an email based anonymous session between author and a reviewer so that reviewers can ask questions to the authors for any doubts related to the assignments during peer reviewing.&lt;br /&gt;
&lt;br /&gt;
==Project==&lt;br /&gt;
&lt;br /&gt;
=== Introduction to Expertiza ===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a peer review based system which provides an incremental class based learning together with the instructors and the peers. This project has been developed together by faculty and students using [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza handles assignment submissions, team formations, assignment reviews and grades, etc.&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
During reviews, many times reviewers will be having questions about the submitted material and if it's a blocker there is no way that the reviewer can progress further with the review.  As a result, reviewers will end up submitting the empty or incomplete review.&lt;br /&gt;
&lt;br /&gt;
=== Scope ===&lt;br /&gt;
This project is limited to an email based conversation for asking questions and answers. The reviewers would ask questions related to assignment submission doubts to which authors can respond. All this would be taken care as email responses using a link provided in the email. This project does not cater to any live interactive session with spontaneous back-to-back questions and responses.&lt;br /&gt;
&lt;br /&gt;
Following tasks would be incorporated in the project:&lt;br /&gt;
* Provide a ‘TextArea’ input field on review forms, where any reviewer can type in their questions.&lt;br /&gt;
* Create a new button ‘Ask for Quick Help’ on the review forms.&lt;br /&gt;
* An email would be send to the author with the link where he can respond to the questions asked by the reviewers for their submitted work.&lt;br /&gt;
* Reviewers would be notified by an email when authors respond to the the questions.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Discussion of Resolution ===&lt;br /&gt;
&lt;br /&gt;
We will make the following modifications to implement the chat feature:- &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Create a new model which will help to extract, store and validate data in the database table which contains information about the interaction between the author/s and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Edit the view which is used by the response controller to incorporate the text area input field on the review form where the reviewer can ask his/her initial query.&lt;br /&gt;
&lt;br /&gt;
*Create a new controller with methods for authentication for a respective chat log only visible to the author and reviewer of a particular assignment, method to submit a response or a follow up query and show the existing interaction log.&lt;br /&gt;
&lt;br /&gt;
*Create a new helper with the e-mail methods for sending to the author and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Create a new view which will facilitate the author to respond to the queries asked by the reviewer. The reviewer can also use this view to ask any follow up questions.&lt;br /&gt;
&lt;br /&gt;
=== Mock-Ups ===&lt;br /&gt;
The sample question box would look like:&lt;br /&gt;
&lt;br /&gt;
[[File: ARSNMockup1.JPG]]&lt;br /&gt;
&lt;br /&gt;
An interface with the question would be displayed on opening a link from the email.&lt;br /&gt;
The authors can reply the query which reviewers ask.&lt;br /&gt;
&lt;br /&gt;
[[File: ARSNMockup2.JPG]]&lt;br /&gt;
&lt;br /&gt;
=== Design Patterns ===&lt;br /&gt;
The implementation team expects that the following design patterns be used in the solution:&lt;br /&gt;
 &lt;br /&gt;
* '''Observer Pattern'''&amp;lt;ref&amp;gt;Observer Design Pattern https://en.wikipedia.org/wiki/Observer_pattern&amp;lt;/ref&amp;gt;: The observer pattern is a software design pattern in which an object, called the subject, maintains a list of its dependents, called observers, and notifies them automatically of any state changes, usually by calling one of their methods. For example, we are notifying the team members whenever the reviewer submits the query.&lt;br /&gt;
&lt;br /&gt;
* '''Iterator Pattern''': In our instance, we need to display the entire chat history of a particular interaction, hence we can use the iterator design pattern to iterate through the previous chat messages.&lt;br /&gt;
&lt;br /&gt;
=== Database Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:Review_chats.png]]&lt;br /&gt;
&lt;br /&gt;
The above figure shows the schema of a new table which will be created in Expertiza to store relevant information about the chat. It contains the following attributes:&lt;br /&gt;
* id: This attribute is auto-generated by rails when we create a table and is auto incremented with each record. It is also the primary key of our table.&lt;br /&gt;
* assignment_id: Stores the ID of the assignment for which the interaction between author and reviewer is taking place.&lt;br /&gt;
* reviewer_id: Stores the ID of the reviewer who asks the questions.&lt;br /&gt;
* team_id: Stores the ID of the team to which the topic belongs.&lt;br /&gt;
* type_flag: Flag which is used to indicate if the particular tuple contains a question or answer. It can take two values, 'Q' for question and 'A' for answer.&lt;br /&gt;
* content: Stores the question asked by the reviewer or the response given by the author/s depending on the value of the type flag.&lt;br /&gt;
&lt;br /&gt;
Records for a particular interaction can be identified by using a combination of assignment_id, reviewer_id and team_id.&lt;br /&gt;
&lt;br /&gt;
=== Use Cases ===&lt;br /&gt;
'''Name:''' Send a question to the author/s about their work.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Reviewer. &amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The reviewer enters his question in the text area which is provided and clicks on the &amp;quot;Ask question&amp;quot; button which is provided as shown in the mock up. On clicking this button an email is sent to the author/s along which a link to answer the question.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''Name:''' Answer the question which has been asked by the reviewer.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Author/s&amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The author/s click on the link received in their email and are redirected to a page where they can answer the question. Once they submit the answer, an email is sent to the reviewer notifying him/her that their question has been answered.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:ARSNUsecase.jpeg]]&lt;br /&gt;
&lt;br /&gt;
=== Proposed Tests ===&lt;br /&gt;
1. For use case 1, test whether all the team members receive email with the question.&amp;lt;br/&amp;gt;&lt;br /&gt;
2. For use case 2, test whether the reviewer receive email with the response.&amp;lt;br/&amp;gt;&lt;br /&gt;
3. Test whether all the previous interactions are displayed as chat history.&amp;lt;br/&amp;gt;&lt;br /&gt;
4. The 'Ask Question' button should not be enabled until some text has been entered in the text area.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
'''Files created/modified'''&lt;br /&gt;
&lt;br /&gt;
*Create a new model '''ReviewChat''' .&lt;br /&gt;
&lt;br /&gt;
*Create a new controller '''ReviewChats'''.&lt;br /&gt;
&lt;br /&gt;
*Create new views as discussed in the design.&lt;br /&gt;
&lt;br /&gt;
*Modify view expertiza/app/views/response/response.html.erb to incorporate text box and corresponding submit button.&lt;br /&gt;
&lt;br /&gt;
'''Flowchart'''&lt;br /&gt;
&lt;br /&gt;
[[File: ARSNFlowchart1.png]]&lt;br /&gt;
&lt;br /&gt;
'''Flow'''&lt;br /&gt;
&lt;br /&gt;
*The reviewer enters his question in the text area provided and clicks on the &amp;quot;Submit&amp;quot; button.&lt;br /&gt;
[[File: FinalProject1.jpg]]&lt;br /&gt;
*On clicking this button the appropriate method is called in ReviewChats controller which sends an email to all the authors of the topic indicating that a question has been asked about their work. The email contains a link which when clicked on will redirect the author to the appropriate view where he/she can answer the question.&lt;br /&gt;
[[File: FinalProject4.jpg]]&lt;br /&gt;
*On answering the question, the reviewer receives an email indicating that his question has been answered. It also contains a link which redirects the reviewer to the appropriate view where the answer will be displayed.&lt;br /&gt;
*The authorized users will also be able to see a link to open existing chat interaction log.&lt;br /&gt;
[[File: FinalProject3.jpg]]&lt;br /&gt;
*This view also contains the chat history between the author/s and the reviewer for the entire duration of the interaction.&lt;br /&gt;
[[File: FinalProject2.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Suggestions for Future Improvements ==&lt;br /&gt;
&lt;br /&gt;
* This can be extended to a live interactive author-reviewer anonymous chat session inside the Expertiza reviews window.&lt;br /&gt;
* A purging script can be developed which will clear all the interaction records every semester.&lt;br /&gt;
&lt;br /&gt;
==Resources==&lt;br /&gt;
&lt;br /&gt;
* Expertiza Github repository&amp;lt;ref&amp;gt;Expertiza Github repository https://github.com/expertiza/expertiza&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sgulati2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100068</id>
		<title>CSC/ECE 517 Fall 2015 E1586 AnonymousChatBetweenAuthorAndReviewer</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100068"/>
		<updated>2015-12-04T05:16:08Z</updated>

		<summary type="html">&lt;p&gt;Sgulati2: /* Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1586 AnonymousChatBetweenAuthorAndReviewer'''&lt;br /&gt;
&lt;br /&gt;
This page provides a brief description of the '''Expertiza''' project. The project is aimed at developing an email based anonymous session between author and a reviewer so that reviewers can ask questions to the authors for any doubts related to the assignments during peer reviewing.&lt;br /&gt;
&lt;br /&gt;
==Project==&lt;br /&gt;
&lt;br /&gt;
=== Introduction to Expertiza ===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a peer review based system which provides an incremental class based learning together with the instructors and the peers. This project has been developed together by faculty and students using [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza handles assignment submissions, team formations, assignment reviews and grades, etc.&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
During reviews, many times reviewers will be having questions about the submitted material and if it's a blocker there is no way that the reviewer can progress further with the review.  As a result, reviewers will end up submitting the empty or incomplete review.&lt;br /&gt;
&lt;br /&gt;
=== Scope ===&lt;br /&gt;
This project is limited to an email based conversation for asking questions and answers. The reviewers would ask questions related to assignment submission doubts to which authors can respond. All this would be taken care as email responses using a link provided in the email. This project does not cater to any live interactive session with spontaneous back-to-back questions and responses.&lt;br /&gt;
&lt;br /&gt;
Following tasks would be incorporated in the project:&lt;br /&gt;
* Provide a ‘TextArea’ input field on review forms, where any reviewer can type in their questions.&lt;br /&gt;
* Create a new button ‘Ask for Quick Help’ on the review forms.&lt;br /&gt;
* An email would be send to the author with the link where he can respond to the questions asked by the reviewers for their submitted work.&lt;br /&gt;
* Reviewers would be notified by an email when authors respond to the the questions.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Discussion of Resolution ===&lt;br /&gt;
&lt;br /&gt;
We will make the following modifications to implement the chat feature:- &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Create a new model which will help to extract, store and validate data in the database table which contains information about the interaction between the author/s and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Edit the view which is used by the response controller to incorporate the text area input field on the review form where the reviewer can ask his/her initial query.&lt;br /&gt;
&lt;br /&gt;
*Create a new controller which will contain methods to send emails to the author and reviewers as well as retrieve and display the chat history between the two.&lt;br /&gt;
&lt;br /&gt;
*Create a new view which will facilitate the author to respond to the queries asked by the reviewer. The reviewer can also use this view to ask any follow up questions.&lt;br /&gt;
&lt;br /&gt;
=== Mock-Ups ===&lt;br /&gt;
The sample question box would look like:&lt;br /&gt;
&lt;br /&gt;
[[File: ARSNMockup1.JPG]]&lt;br /&gt;
&lt;br /&gt;
An interface with the question would be displayed on opening a link from the email.&lt;br /&gt;
The authors can reply the query which reviewers ask.&lt;br /&gt;
&lt;br /&gt;
[[File: ARSNMockup2.JPG]]&lt;br /&gt;
&lt;br /&gt;
=== Design Patterns ===&lt;br /&gt;
The implementation team expects that the following design patterns be used in the solution:&lt;br /&gt;
 &lt;br /&gt;
* '''Observer Pattern'''&amp;lt;ref&amp;gt;Observer Design Pattern https://en.wikipedia.org/wiki/Observer_pattern&amp;lt;/ref&amp;gt;: The observer pattern is a software design pattern in which an object, called the subject, maintains a list of its dependents, called observers, and notifies them automatically of any state changes, usually by calling one of their methods. For example, we are notifying the team members whenever the reviewer submits the query.&lt;br /&gt;
&lt;br /&gt;
* '''Iterator Pattern''': In our instance, we need to display the entire chat history of a particular interaction, hence we can use the iterator design pattern to iterate through the previous chat messages.&lt;br /&gt;
&lt;br /&gt;
=== Database Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:DatabaseTable.jpg]]&lt;br /&gt;
&lt;br /&gt;
The above figure shows the schema of a new table which will be created in Expertiza to store relevant information about the chat. It contains the following attributes:&lt;br /&gt;
* id: This attribute is auto-generated by rails when we create a table and is auto incremented with each record. It is also the primary key of our table.&lt;br /&gt;
* assignment_id: Stores the ID of the assignment for which the interaction between author and reviewer is taking place.&lt;br /&gt;
* reviewer_id: Stores the ID of the reviewer who asks the questions.&lt;br /&gt;
* team_id: Stores the ID of the team to which the topic belongs.&lt;br /&gt;
* type_flag: Flag which is used to indicate if the particular tuple contains a question or answer. It can take two values, 'Q' for question and 'A' for answer.&lt;br /&gt;
* content: Stores the question asked by the reviewer or the response given by the author/s depending on the value of the type flag.&lt;br /&gt;
&lt;br /&gt;
Records for a particular interaction can be identified by using a combination of assignment_id, reviewer_id and team_id.&lt;br /&gt;
&lt;br /&gt;
=== Use Cases ===&lt;br /&gt;
'''Name:''' Send a question to the author/s about their work.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Reviewer. &amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The reviewer enters his question in the text area which is provided and clicks on the &amp;quot;Ask question&amp;quot; button which is provided as shown in the mock up. On clicking this button an email is sent to the author/s along which a link to answer the question.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''Name:''' Answer the question which has been asked by the reviewer.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Author/s&amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The author/s click on the link received in their email and are redirected to a page where they can answer the question. Once they submit the answer, an email is sent to the reviewer notifying him/her that their question has been answered.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:ARSNUsecase.jpeg]]&lt;br /&gt;
&lt;br /&gt;
=== Proposed Tests ===&lt;br /&gt;
1. For use case 1, test whether all the team members receive email with the question.&amp;lt;br/&amp;gt;&lt;br /&gt;
2. For use case 2, test whether the reviewer receive email with the response.&amp;lt;br/&amp;gt;&lt;br /&gt;
3. Test whether all the previous interactions are displayed as chat history.&amp;lt;br/&amp;gt;&lt;br /&gt;
4. The 'Ask Question' button should not be enabled until some text has been entered in the text area.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
'''Files created/modified'''&lt;br /&gt;
&lt;br /&gt;
*Create a new model '''ReviewChat''' .&lt;br /&gt;
&lt;br /&gt;
*Create a new controller '''ReviewChats'''.&lt;br /&gt;
&lt;br /&gt;
*Create new views as discussed in the design.&lt;br /&gt;
&lt;br /&gt;
*Modify view expertiza/app/views/response/response.html.erb to incorporate text box and corresponding submit button.&lt;br /&gt;
&lt;br /&gt;
'''Flowchart'''&lt;br /&gt;
&lt;br /&gt;
[[File: ARSNFlowchart1.png]]&lt;br /&gt;
&lt;br /&gt;
'''Flow'''&lt;br /&gt;
&lt;br /&gt;
*The reviewer enters his question in the text area provided and clicks on the &amp;quot;Submit&amp;quot; button.&lt;br /&gt;
[[File: FinalProject1.jpg]]&lt;br /&gt;
*On clicking this button the appropriate method is called in ReviewChats controller which sends an email to all the authors of the topic indicating that a question has been asked about their work. The email contains a link which when clicked on will redirect the author to the appropriate view where he/she can answer the question.&lt;br /&gt;
[[File: FinalProject4.jpg]]&lt;br /&gt;
*On answering the question, the reviewer receives an email indicating that his question has been answered. It also contains a link which redirects the reviewer to the appropriate view where the answer will be displayed.&lt;br /&gt;
*The authorized users will also be able to see a link to open existing chat interaction log.&lt;br /&gt;
[[File: FinalProject3.jpg]]&lt;br /&gt;
*This view also contains the chat history between the author/s and the reviewer for the entire duration of the interaction.&lt;br /&gt;
[[File: FinalProject2.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Suggestions for Future Improvements ==&lt;br /&gt;
&lt;br /&gt;
* This can be extended to a live interactive author-reviewer anonymous chat session inside the Expertiza reviews window.&lt;br /&gt;
* A purging script can be developed which will clear all the interaction records every semester.&lt;br /&gt;
&lt;br /&gt;
==Resources==&lt;br /&gt;
&lt;br /&gt;
* Expertiza Github repository&amp;lt;ref&amp;gt;Expertiza Github repository https://github.com/expertiza/expertiza&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sgulati2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100067</id>
		<title>CSC/ECE 517 Fall 2015 E1586 AnonymousChatBetweenAuthorAndReviewer</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100067"/>
		<updated>2015-12-04T05:15:06Z</updated>

		<summary type="html">&lt;p&gt;Sgulati2: /* Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1586 AnonymousChatBetweenAuthorAndReviewer'''&lt;br /&gt;
&lt;br /&gt;
This page provides a brief description of the '''Expertiza''' project. The project is aimed at developing an email based anonymous session between author and a reviewer so that reviewers can ask questions to the authors for any doubts related to the assignments during peer reviewing.&lt;br /&gt;
&lt;br /&gt;
==Project==&lt;br /&gt;
&lt;br /&gt;
=== Introduction to Expertiza ===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a peer review based system which provides an incremental class based learning together with the instructors and the peers. This project has been developed together by faculty and students using [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza handles assignment submissions, team formations, assignment reviews and grades, etc.&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
During reviews, many times reviewers will be having questions about the submitted material and if it's a blocker there is no way that the reviewer can progress further with the review.  As a result, reviewers will end up submitting the empty or incomplete review.&lt;br /&gt;
&lt;br /&gt;
=== Scope ===&lt;br /&gt;
This project is limited to an email based conversation for asking questions and answers. The reviewers would ask questions related to assignment submission doubts to which authors can respond. All this would be taken care as email responses using a link provided in the email. This project does not cater to any live interactive session with spontaneous back-to-back questions and responses.&lt;br /&gt;
&lt;br /&gt;
Following tasks would be incorporated in the project:&lt;br /&gt;
* Provide a ‘TextArea’ input field on review forms, where any reviewer can type in their questions.&lt;br /&gt;
* Create a new button ‘Ask for Quick Help’ on the review forms.&lt;br /&gt;
* An email would be send to the author with the link where he can respond to the questions asked by the reviewers for their submitted work.&lt;br /&gt;
* Reviewers would be notified by an email when authors respond to the the questions.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Discussion of Resolution ===&lt;br /&gt;
&lt;br /&gt;
We will make the following modifications to implement the chat feature:- &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Create a new model which will help to extract, store and validate data in the database table which contains information about the interaction between the author/s and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Edit the view which is used by the response controller to incorporate the text area input field on the review form where the reviewer can ask his/her initial query.&lt;br /&gt;
&lt;br /&gt;
*Create a new controller which will contain methods to send emails to the author and reviewers as well as retrieve and display the chat history between the two.&lt;br /&gt;
&lt;br /&gt;
*Create a new view which will facilitate the author to respond to the queries asked by the reviewer. The reviewer can also use this view to ask any follow up questions.&lt;br /&gt;
&lt;br /&gt;
=== Mock-Ups ===&lt;br /&gt;
The sample question box would look like:&lt;br /&gt;
&lt;br /&gt;
[[File: ARSNMockup1.JPG]]&lt;br /&gt;
&lt;br /&gt;
An interface with the question would be displayed on opening a link from the email.&lt;br /&gt;
The authors can reply the query which reviewers ask.&lt;br /&gt;
&lt;br /&gt;
[[File: ARSNMockup2.JPG]]&lt;br /&gt;
&lt;br /&gt;
=== Design Patterns ===&lt;br /&gt;
The implementation team expects that the following design patterns be used in the solution:&lt;br /&gt;
 &lt;br /&gt;
* '''Observer Pattern'''&amp;lt;ref&amp;gt;Observer Design Pattern https://en.wikipedia.org/wiki/Observer_pattern&amp;lt;/ref&amp;gt;: The observer pattern is a software design pattern in which an object, called the subject, maintains a list of its dependents, called observers, and notifies them automatically of any state changes, usually by calling one of their methods. For example, we are notifying the team members whenever the reviewer submits the query.&lt;br /&gt;
&lt;br /&gt;
* '''Iterator Pattern''': In our instance, we need to display the entire chat history of a particular interaction, hence we can use the iterator design pattern to iterate through the previous chat messages.&lt;br /&gt;
&lt;br /&gt;
=== Database Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:DatabaseTable.jpg]]&lt;br /&gt;
&lt;br /&gt;
The above figure shows the schema of a new table which will be created in Expertiza to store relevant information about the chat. It contains the following attributes:&lt;br /&gt;
* id: This attribute is auto-generated by rails when we create a table and is auto incremented with each record. It is also the primary key of our table.&lt;br /&gt;
* assignment_id: Stores the ID of the assignment for which the interaction between author and reviewer is taking place.&lt;br /&gt;
* reviewer_id: Stores the ID of the reviewer who asks the questions.&lt;br /&gt;
* team_id: Stores the ID of the team to which the topic belongs.&lt;br /&gt;
* type_flag: Flag which is used to indicate if the particular tuple contains a question or answer. It can take two values, 'Q' for question and 'A' for answer.&lt;br /&gt;
* content: Stores the question asked by the reviewer or the response given by the author/s depending on the value of the type flag.&lt;br /&gt;
&lt;br /&gt;
Records for a particular interaction can be identified by using a combination of assignment_id, reviewer_id and team_id.&lt;br /&gt;
&lt;br /&gt;
=== Use Cases ===&lt;br /&gt;
'''Name:''' Send a question to the author/s about their work.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Reviewer. &amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The reviewer enters his question in the text area which is provided and clicks on the &amp;quot;Ask question&amp;quot; button which is provided as shown in the mock up. On clicking this button an email is sent to the author/s along which a link to answer the question.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''Name:''' Answer the question which has been asked by the reviewer.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Author/s&amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The author/s click on the link received in their email and are redirected to a page where they can answer the question. Once they submit the answer, an email is sent to the reviewer notifying him/her that their question has been answered.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:ARSNUsecase.jpeg]]&lt;br /&gt;
&lt;br /&gt;
=== Proposed Tests ===&lt;br /&gt;
1. For use case 1, test whether all the team members receive email with the question.&amp;lt;br/&amp;gt;&lt;br /&gt;
2. For use case 2, test whether the reviewer receive email with the response.&amp;lt;br/&amp;gt;&lt;br /&gt;
3. Test whether all the previous interactions are displayed as chat history.&amp;lt;br/&amp;gt;&lt;br /&gt;
4. The 'Ask Question' button should not be enabled until some text has been entered in the text area.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
'''Files created/modified'''&lt;br /&gt;
&lt;br /&gt;
*Create a new model '''ReviewChat''' .&lt;br /&gt;
&lt;br /&gt;
*Create a new controller '''ReviewChats'''.&lt;br /&gt;
&lt;br /&gt;
*Create new views as discussed in the design.&lt;br /&gt;
&lt;br /&gt;
*Modify view expertiza/app/views/response/response.html.erb to incorporate text box and corresponding submit button.&lt;br /&gt;
&lt;br /&gt;
'''Flowchart'''&lt;br /&gt;
&lt;br /&gt;
[[File: ARSNFlowchart1.png]]&lt;br /&gt;
&lt;br /&gt;
'''Flow'''&lt;br /&gt;
&lt;br /&gt;
*The reviewer enters his question in the text area provided and clicks on the &amp;quot;Submit&amp;quot; button.&lt;br /&gt;
[[File: FinalProject1.jpg]]&lt;br /&gt;
*On clicking this button the appropriate method is called in ReviewChats controller which sends an email to all the authors of the topic indicating that a question has been asked about their work. The email contains a link which when clicked on will redirect the author to the appropriate view where he/she can answer the question.&lt;br /&gt;
[[File: FinalProject4.jpg]]&lt;br /&gt;
*On answering the question, the reviewer receives an email indicating that his question has been answered. It also contains a link which redirects the reviewer to the appropriate view where the answer will be displayed.&lt;br /&gt;
*This view also contains the chat history between the author/s and the reviewer for the entire duration of the interaction.&lt;br /&gt;
[[File: FinalProject2.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Suggestions for Future Improvements ==&lt;br /&gt;
&lt;br /&gt;
* This can be extended to a live interactive author-reviewer anonymous chat session inside the Expertiza reviews window.&lt;br /&gt;
* A purging script can be developed which will clear all the interaction records every semester.&lt;br /&gt;
&lt;br /&gt;
==Resources==&lt;br /&gt;
&lt;br /&gt;
* Expertiza Github repository&amp;lt;ref&amp;gt;Expertiza Github repository https://github.com/expertiza/expertiza&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sgulati2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100066</id>
		<title>CSC/ECE 517 Fall 2015 E1586 AnonymousChatBetweenAuthorAndReviewer</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100066"/>
		<updated>2015-12-04T05:12:48Z</updated>

		<summary type="html">&lt;p&gt;Sgulati2: /* Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1586 AnonymousChatBetweenAuthorAndReviewer'''&lt;br /&gt;
&lt;br /&gt;
This page provides a brief description of the '''Expertiza''' project. The project is aimed at developing an email based anonymous session between author and a reviewer so that reviewers can ask questions to the authors for any doubts related to the assignments during peer reviewing.&lt;br /&gt;
&lt;br /&gt;
==Project==&lt;br /&gt;
&lt;br /&gt;
=== Introduction to Expertiza ===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a peer review based system which provides an incremental class based learning together with the instructors and the peers. This project has been developed together by faculty and students using [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza handles assignment submissions, team formations, assignment reviews and grades, etc.&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
During reviews, many times reviewers will be having questions about the submitted material and if it's a blocker there is no way that the reviewer can progress further with the review.  As a result, reviewers will end up submitting the empty or incomplete review.&lt;br /&gt;
&lt;br /&gt;
=== Scope ===&lt;br /&gt;
This project is limited to an email based conversation for asking questions and answers. The reviewers would ask questions related to assignment submission doubts to which authors can respond. All this would be taken care as email responses using a link provided in the email. This project does not cater to any live interactive session with spontaneous back-to-back questions and responses.&lt;br /&gt;
&lt;br /&gt;
Following tasks would be incorporated in the project:&lt;br /&gt;
* Provide a ‘TextArea’ input field on review forms, where any reviewer can type in their questions.&lt;br /&gt;
* Create a new button ‘Ask for Quick Help’ on the review forms.&lt;br /&gt;
* An email would be send to the author with the link where he can respond to the questions asked by the reviewers for their submitted work.&lt;br /&gt;
* Reviewers would be notified by an email when authors respond to the the questions.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Discussion of Resolution ===&lt;br /&gt;
&lt;br /&gt;
We will make the following modifications to implement the chat feature:- &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Create a new model which will help to extract, store and validate data in the database table which contains information about the interaction between the author/s and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Edit the view which is used by the response controller to incorporate the text area input field on the review form where the reviewer can ask his/her initial query.&lt;br /&gt;
&lt;br /&gt;
*Create a new controller which will contain methods to send emails to the author and reviewers as well as retrieve and display the chat history between the two.&lt;br /&gt;
&lt;br /&gt;
*Create a new view which will facilitate the author to respond to the queries asked by the reviewer. The reviewer can also use this view to ask any follow up questions.&lt;br /&gt;
&lt;br /&gt;
=== Mock-Ups ===&lt;br /&gt;
The sample question box would look like:&lt;br /&gt;
&lt;br /&gt;
[[File: ARSNMockup1.JPG]]&lt;br /&gt;
&lt;br /&gt;
An interface with the question would be displayed on opening a link from the email.&lt;br /&gt;
The authors can reply the query which reviewers ask.&lt;br /&gt;
&lt;br /&gt;
[[File: ARSNMockup2.JPG]]&lt;br /&gt;
&lt;br /&gt;
=== Design Patterns ===&lt;br /&gt;
The implementation team expects that the following design patterns be used in the solution:&lt;br /&gt;
 &lt;br /&gt;
* '''Observer Pattern'''&amp;lt;ref&amp;gt;Observer Design Pattern https://en.wikipedia.org/wiki/Observer_pattern&amp;lt;/ref&amp;gt;: The observer pattern is a software design pattern in which an object, called the subject, maintains a list of its dependents, called observers, and notifies them automatically of any state changes, usually by calling one of their methods. For example, we are notifying the team members whenever the reviewer submits the query.&lt;br /&gt;
&lt;br /&gt;
* '''Iterator Pattern''': In our instance, we need to display the entire chat history of a particular interaction, hence we can use the iterator design pattern to iterate through the previous chat messages.&lt;br /&gt;
&lt;br /&gt;
=== Database Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:DatabaseTable.jpg]]&lt;br /&gt;
&lt;br /&gt;
The above figure shows the schema of a new table which will be created in Expertiza to store relevant information about the chat. It contains the following attributes:&lt;br /&gt;
* id: This attribute is auto-generated by rails when we create a table and is auto incremented with each record. It is also the primary key of our table.&lt;br /&gt;
* assignment_id: Stores the ID of the assignment for which the interaction between author and reviewer is taking place.&lt;br /&gt;
* reviewer_id: Stores the ID of the reviewer who asks the questions.&lt;br /&gt;
* team_id: Stores the ID of the team to which the topic belongs.&lt;br /&gt;
* type_flag: Flag which is used to indicate if the particular tuple contains a question or answer. It can take two values, 'Q' for question and 'A' for answer.&lt;br /&gt;
* content: Stores the question asked by the reviewer or the response given by the author/s depending on the value of the type flag.&lt;br /&gt;
&lt;br /&gt;
Records for a particular interaction can be identified by using a combination of assignment_id, reviewer_id and team_id.&lt;br /&gt;
&lt;br /&gt;
=== Use Cases ===&lt;br /&gt;
'''Name:''' Send a question to the author/s about their work.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Reviewer. &amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The reviewer enters his question in the text area which is provided and clicks on the &amp;quot;Ask question&amp;quot; button which is provided as shown in the mock up. On clicking this button an email is sent to the author/s along which a link to answer the question.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''Name:''' Answer the question which has been asked by the reviewer.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Author/s&amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The author/s click on the link received in their email and are redirected to a page where they can answer the question. Once they submit the answer, an email is sent to the reviewer notifying him/her that their question has been answered.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:ARSNUsecase.jpeg]]&lt;br /&gt;
&lt;br /&gt;
=== Proposed Tests ===&lt;br /&gt;
1. For use case 1, test whether all the team members receive email with the question.&amp;lt;br/&amp;gt;&lt;br /&gt;
2. For use case 2, test whether the reviewer receive email with the response.&amp;lt;br/&amp;gt;&lt;br /&gt;
3. Test whether all the previous interactions are displayed as chat history.&amp;lt;br/&amp;gt;&lt;br /&gt;
4. The 'Ask Question' button should not be enabled until some text has been entered in the text area.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
'''Files created/modified'''&lt;br /&gt;
&lt;br /&gt;
*Create a new model '''ReviewChat''' .&lt;br /&gt;
&lt;br /&gt;
*Create a new controller '''ReviewChats'''.&lt;br /&gt;
&lt;br /&gt;
*Create new views as discussed in the design.&lt;br /&gt;
&lt;br /&gt;
*Modify view expertiza/app/views/response/response.html.erb to incorporate text box and corresponding submit button.&lt;br /&gt;
&lt;br /&gt;
'''Flowchart'''&lt;br /&gt;
&lt;br /&gt;
[[File: ARSNFlowchart1.png]]&lt;br /&gt;
&lt;br /&gt;
'''Flow'''&lt;br /&gt;
&lt;br /&gt;
*The reviewer enters his question in the text area provided and clicks on the &amp;quot;Ask Question&amp;quot; button.&lt;br /&gt;
[[File: FinalProject1.jpg]]&lt;br /&gt;
*On clicking this button the appropriate method is called in ReviewChats controller which sends an email to all the authors of the topic indicating that a question has been asked about their work. The email contains a link which when clicked on will redirect the author to the appropriate view where he/she can answer the question.&lt;br /&gt;
[[File: FinalProject4.jpg]]&lt;br /&gt;
*On answering the question, the reviewer receives an email indicating that his question has been answered. It also contains a link which redirects the reviewer to the appropriate view where the answer will be displayed.&lt;br /&gt;
*This view also contains the chat history between the author/s and the reviewer for the entire duration of the interaction.&lt;br /&gt;
[[File: FinalProject2.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Suggestions for Future Improvements ==&lt;br /&gt;
&lt;br /&gt;
* This can be extended to a live interactive author-reviewer anonymous chat session inside the Expertiza reviews window.&lt;br /&gt;
* A purging script can be developed which will clear all the interaction records every semester.&lt;br /&gt;
&lt;br /&gt;
==Resources==&lt;br /&gt;
&lt;br /&gt;
* Expertiza Github repository&amp;lt;ref&amp;gt;Expertiza Github repository https://github.com/expertiza/expertiza&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sgulati2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100065</id>
		<title>CSC/ECE 517 Fall 2015 E1586 AnonymousChatBetweenAuthorAndReviewer</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100065"/>
		<updated>2015-12-04T05:10:49Z</updated>

		<summary type="html">&lt;p&gt;Sgulati2: /* Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1586 AnonymousChatBetweenAuthorAndReviewer'''&lt;br /&gt;
&lt;br /&gt;
This page provides a brief description of the '''Expertiza''' project. The project is aimed at developing an email based anonymous session between author and a reviewer so that reviewers can ask questions to the authors for any doubts related to the assignments during peer reviewing.&lt;br /&gt;
&lt;br /&gt;
==Project==&lt;br /&gt;
&lt;br /&gt;
=== Introduction to Expertiza ===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a peer review based system which provides an incremental class based learning together with the instructors and the peers. This project has been developed together by faculty and students using [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza handles assignment submissions, team formations, assignment reviews and grades, etc.&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
During reviews, many times reviewers will be having questions about the submitted material and if it's a blocker there is no way that the reviewer can progress further with the review.  As a result, reviewers will end up submitting the empty or incomplete review.&lt;br /&gt;
&lt;br /&gt;
=== Scope ===&lt;br /&gt;
This project is limited to an email based conversation for asking questions and answers. The reviewers would ask questions related to assignment submission doubts to which authors can respond. All this would be taken care as email responses using a link provided in the email. This project does not cater to any live interactive session with spontaneous back-to-back questions and responses.&lt;br /&gt;
&lt;br /&gt;
Following tasks would be incorporated in the project:&lt;br /&gt;
* Provide a ‘TextArea’ input field on review forms, where any reviewer can type in their questions.&lt;br /&gt;
* Create a new button ‘Ask for Quick Help’ on the review forms.&lt;br /&gt;
* An email would be send to the author with the link where he can respond to the questions asked by the reviewers for their submitted work.&lt;br /&gt;
* Reviewers would be notified by an email when authors respond to the the questions.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Discussion of Resolution ===&lt;br /&gt;
&lt;br /&gt;
We will make the following modifications to implement the chat feature:- &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Create a new model which will help to extract, store and validate data in the database table which contains information about the interaction between the author/s and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Edit the view which is used by the response controller to incorporate the text area input field on the review form where the reviewer can ask his/her initial query.&lt;br /&gt;
&lt;br /&gt;
*Create a new controller which will contain methods to send emails to the author and reviewers as well as retrieve and display the chat history between the two.&lt;br /&gt;
&lt;br /&gt;
*Create a new view which will facilitate the author to respond to the queries asked by the reviewer. The reviewer can also use this view to ask any follow up questions.&lt;br /&gt;
&lt;br /&gt;
=== Mock-Ups ===&lt;br /&gt;
The sample question box would look like:&lt;br /&gt;
&lt;br /&gt;
[[File: ARSNMockup1.JPG]]&lt;br /&gt;
&lt;br /&gt;
An interface with the question would be displayed on opening a link from the email.&lt;br /&gt;
The authors can reply the query which reviewers ask.&lt;br /&gt;
&lt;br /&gt;
[[File: ARSNMockup2.JPG]]&lt;br /&gt;
&lt;br /&gt;
=== Design Patterns ===&lt;br /&gt;
The implementation team expects that the following design patterns be used in the solution:&lt;br /&gt;
 &lt;br /&gt;
* '''Observer Pattern'''&amp;lt;ref&amp;gt;Observer Design Pattern https://en.wikipedia.org/wiki/Observer_pattern&amp;lt;/ref&amp;gt;: The observer pattern is a software design pattern in which an object, called the subject, maintains a list of its dependents, called observers, and notifies them automatically of any state changes, usually by calling one of their methods. For example, we are notifying the team members whenever the reviewer submits the query.&lt;br /&gt;
&lt;br /&gt;
* '''Iterator Pattern''': In our instance, we need to display the entire chat history of a particular interaction, hence we can use the iterator design pattern to iterate through the previous chat messages.&lt;br /&gt;
&lt;br /&gt;
=== Database Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:DatabaseTable.jpg]]&lt;br /&gt;
&lt;br /&gt;
The above figure shows the schema of a new table which will be created in Expertiza to store relevant information about the chat. It contains the following attributes:&lt;br /&gt;
* id: This attribute is auto-generated by rails when we create a table and is auto incremented with each record. It is also the primary key of our table.&lt;br /&gt;
* assignment_id: Stores the ID of the assignment for which the interaction between author and reviewer is taking place.&lt;br /&gt;
* reviewer_id: Stores the ID of the reviewer who asks the questions.&lt;br /&gt;
* team_id: Stores the ID of the team to which the topic belongs.&lt;br /&gt;
* type_flag: Flag which is used to indicate if the particular tuple contains a question or answer. It can take two values, 'Q' for question and 'A' for answer.&lt;br /&gt;
* content: Stores the question asked by the reviewer or the response given by the author/s depending on the value of the type flag.&lt;br /&gt;
&lt;br /&gt;
Records for a particular interaction can be identified by using a combination of assignment_id, reviewer_id and team_id.&lt;br /&gt;
&lt;br /&gt;
=== Use Cases ===&lt;br /&gt;
'''Name:''' Send a question to the author/s about their work.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Reviewer. &amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The reviewer enters his question in the text area which is provided and clicks on the &amp;quot;Ask question&amp;quot; button which is provided as shown in the mock up. On clicking this button an email is sent to the author/s along which a link to answer the question.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''Name:''' Answer the question which has been asked by the reviewer.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Author/s&amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The author/s click on the link received in their email and are redirected to a page where they can answer the question. Once they submit the answer, an email is sent to the reviewer notifying him/her that their question has been answered.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:ARSNUsecase.jpeg]]&lt;br /&gt;
&lt;br /&gt;
=== Proposed Tests ===&lt;br /&gt;
1. For use case 1, test whether all the team members receive email with the question.&amp;lt;br/&amp;gt;&lt;br /&gt;
2. For use case 2, test whether the reviewer receive email with the response.&amp;lt;br/&amp;gt;&lt;br /&gt;
3. Test whether all the previous interactions are displayed as chat history.&amp;lt;br/&amp;gt;&lt;br /&gt;
4. The 'Ask Question' button should not be enabled until some text has been entered in the text area.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
'''Files created/modified'''&lt;br /&gt;
&lt;br /&gt;
*Create a new model '''ReviewChat''' .&lt;br /&gt;
&lt;br /&gt;
*Create a new controller '''ReviewChats'''.&lt;br /&gt;
&lt;br /&gt;
*Create new views as discussed in the design.&lt;br /&gt;
&lt;br /&gt;
*Modify view expertiza/app/views/response/response.html.erb to incorporate text box and corresponding submit button.&lt;br /&gt;
&lt;br /&gt;
'''Flowchart'''&lt;br /&gt;
&lt;br /&gt;
[[File: ARSNFlowchart1.png]]&lt;br /&gt;
&lt;br /&gt;
'''Flow'''&lt;br /&gt;
&lt;br /&gt;
*The reviewer enters his question in the text area provided and clicks on the &amp;quot;Ask Question&amp;quot; button.&lt;br /&gt;
[[File: FinalProject1.jpg]]&lt;br /&gt;
*On clicking this button the appropriate method is called in ReviewChats controller which sends an email to all the authors of the topic indicating that a question has been asked about their work. The email contains a link which when clicked on will redirect the author to the appropriate view where he/she can answer the question.&lt;br /&gt;
*On answering the question, the reviewer receives an email indicating that his question has been answered. It also contains a link which redirects the reviewer to the appropriate view where the answer will be displayed.&lt;br /&gt;
*This view also contains the chat history between the author/s and the reviewer for the entire duration of the interaction.&lt;br /&gt;
&lt;br /&gt;
== Suggestions for Future Improvements ==&lt;br /&gt;
&lt;br /&gt;
* This can be extended to a live interactive author-reviewer anonymous chat session inside the Expertiza reviews window.&lt;br /&gt;
* A purging script can be developed which will clear all the interaction records every semester.&lt;br /&gt;
&lt;br /&gt;
==Resources==&lt;br /&gt;
&lt;br /&gt;
* Expertiza Github repository&amp;lt;ref&amp;gt;Expertiza Github repository https://github.com/expertiza/expertiza&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sgulati2</name></author>
	</entry>
</feed>