CSC/ECE 517 Fall 2015 E1586 AnonymousChatBetweenAuthorAndReviewer

From Expertiza_Wiki
Jump to navigation Jump to search

E1586 AnonymousChatBetweenAuthorAndReviewer

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.

Project

Introduction to Expertiza

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 Ruby on Rails framework. Expertiza handles assignment submissions, team formations, assignment reviews and grades, etc.

Purpose

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.

Scope

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.

Following tasks would be incorporated in the project:

  • Provide a ‘TextArea’ input field on review forms, where any reviewer can type in their questions.
  • Create a new button ‘Ask for Quick Help’ on the review forms.
  • 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.
  • Reviewers would be notified by an email when authors respond to the the questions.

Design

Discussion of Resolution

We will make the following modifications to implement the chat feature:-

  • 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.
  • 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.
  • 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.
  • Create a new helper with the e-mail methods for sending to the author and reviewer.
  • 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.

Design Patterns

The implementation team expects that the following design patterns be used in the solution:

  • Observer Pattern<ref>Observer Design Pattern https://en.wikipedia.org/wiki/Observer_pattern</ref>: 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.
  • 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.

Database Design

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:

  • 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.
  • assignment_id: Stores the ID of the assignment for which the interaction between author and reviewer is taking place.
  • reviewer_id: Stores the ID of the reviewer who asks the questions.
  • team_id: Stores the ID of the team to which the topic belongs.
  • 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.
  • content: Stores the question asked by the reviewer or the response given by the author/s depending on the value of the type flag.

Records for a particular interaction can be identified by using a combination of assignment_id, reviewer_id and team_id.

Use Cases

Name: Send a question to the author/s about their work.
Actor: Reviewer.
Description: The reviewer enters his question in the text area which is provided and clicks on the "Ask question" 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.

Name: Answer the question which has been asked by the reviewer.
Actor: Author/s
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.

Proposed Tests

1. For use case 1, test whether all the team members receive email with the question.
2. For use case 2, test whether the reviewer receive email with the response.
3. Test whether all the previous interactions are displayed as chat history.
4. The 'Ask Question' button should not be enabled until some text has been entered in the text area.

Implementation

Code Implementation

  • Model review_chat.rb to validate if the query box is empty and restrict the query length to 255 characters.
 validates_length_of :content , :maximum => 255,message: "Length must be less that 255 characters"
 validates_presence_of :content, message: "Content cannot be blank"
  • Methods in the controller review_chats_controller.rb

action_allowed?- Allow chat visibility to the reviewers and the authors of a particular interaction

 def action_allowed?
   review_chat = ReviewChat.find(params[:id])
   allowed_users=Array.new
   team_id=review_chat.team_id
   teams_users = TeamsUser.where(team_id: team_id)
   teams_users.each do |teams_user|
     allowed_users << User.find(teams_user.user_id).id
   end
   allowed_users << Participant.find(review_chat.reviewer_id).user_id
   current_role_name.eql? 'Student' and allowed_users.include?(session[:user].id)
 end

show- Show the chat interaction log

 def show
   @review_chat = ReviewChat.find(params[:id])
   @assignment_id=@review_chat.assignment_id
   @reviewer_id=@review_chat.reviewer_id
   @team_id=@review_chat.team_id
   @chat_log=ReviewChat.where(:reviewer_id => @reviewer_id).where(:team_id => @team_id)
 end

submitted_response- Send an email to the reviewer when an author replied to a query asked by the reviewer.

 def submitted_response
   @review_chat = ReviewChat.find(params[:id])
   @chat_reviewer=Participant.find(@review_chat.reviewer_id).user_id
   if(@chat_reviewer==session[:user].id) then
   	ReviewChat.create(:assignment_id => @review_chat.assignment_id,:reviewer_id => @review_chat.reviewer_id, :team_id=>@review_chat.team_id, :type_flag => 'Q' , :content => params[:response_area])
   	ReviewChatsHelper::chat_email_query(params[:id])
   	flash[:notice]="Query has been submitted"	
   else	
     	ReviewChat.create(:assignment_id => @review_chat.assignment_id,:reviewer_id => @review_chat.reviewer_id, :team_id=>@review_chat.team_id, :type_flag => 'A' , :content => params[:response_area])
     	ReviewChatsHelper::chat_email_response(@review_chat.id,@chat_reviewer)
     flash[:notice]="Response has been submitted"
   end	
   redirect_to action: 'show', id: params[:id]
 end
  • Methods in the helper file review_chats_helper.rb

chat_email_response- Send an email to the author of an assignment when a reviewer posts a query.

def self.chat_email_response(id,reviewer_id,partial="new_chatemail")

   defn = Hash.new
   defn[:body] = Hash.new
   defn[:body][:partial_name] = partial
   reviewer_email=User.find(reviewer_id).email
   defn[:subject] = "Response posted for submission"
   defn[:body][:type] = " response has been posted for your query .
   Please open the below URL to view.
   http://expertiza.ncsu.edu/review_chats/show/#{id}"
   defn[:to] = reviewer_email
   Mailer.sync_message(defn).deliver
 end 

chat_email_query- Send an email to the author of an assignment when a reviewer posts a query.

def self.chat_email_query(id,partial="new_chatemail")

 defn = Hash.new
 defn[:body] = Hash.new
 defn[:body][:partial_name] = partial
 assignment=nil
 @team_id=ReviewChat.find(id).team_id
 teams_users = TeamsUser.where(team_id: @team_id)
 to_mail_list = Array.new
 teams_users.each do |teams_user|
 to_mail_list << User.find(teams_user.user_id).email 
 end
 defn[:subject] = "Query posted for submission"
 defn[:body][:type] = " query has been posted for your submission .
 Please open the below URL to view and respond.
 http://expertiza.ncsu.edu/review_chats/show/#{id}"
 defn[:to] = to_mail_list
 Mailer.sync_message(defn).deliver
 end
  • Create new views as discussed in the design.
  • Modify view expertiza/app/views/response/response.html.erb to incorporate text box and corresponding submit button.

Flowchart

Screenshots

  • The reviewer enters his question in the text area provided and clicks on the "Submit" button.

  • 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.

  • 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.
  • The authorized users will also be able to see a link to open existing chat interaction log.

  • This view also contains the chat history between the author/s and the reviewer for the entire duration of the interaction.

Suggestions for Future Improvements

  • This can be extended to a live interactive author-reviewer anonymous chat session inside the Expertiza reviews window.
  • A purging script can be developed which will clear all the interaction records every semester.

Resources

References

<references/>