CSC/ECE 517 Fall 2015 E1586 AnonymousChatBetweenAuthorAndReviewer: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
Line 240: Line 240:
===Web Testing===
===Web Testing===


* Create a browser automation test in http://imacros.net/overview imacros in Firefox/Chrome browser.
* Create a browser automation test in [http://imacros.net/overview imacros] in Firefox/Chrome browser.
* Run the simulation to test the Expertiza chat operation in the browser.
* Run the simulation to test the Expertiza chat operation in the browser.



Revision as of 08:15, 7 December 2015

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

Following modifications were made 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 following design patterns were used for 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.

Implementation

Code Implementation

  • Create a new model review_chat.rb for ReviewChat.

Validation- Check if the query box is not 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"
  • Create a new controller review_chats_controller.rb with the following methods:

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- Create a chat record and 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
  • Create a helper file review_chats_helper.rb with the following methods:

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
  • Modify existing controller response_controller.rb and add a new method.

submitted_question- Create a chat record and send an email to the authors when a reviewer posts a query.

 def submitted_question
     @map = ResponseMap.find(params[:id])
     ReviewChat.create(:assignment_id => @map.assignment.id,:reviewer_id => @map.reviewer_id, :team_id=>@map.reviewee_id, :type_flag => 'Q' , :content => params[:review_question])
     flash[:notice]="Question has been submitted to Author"
     @interaction_id=ReviewChat.where(:reviewer_id => @map.reviewer_id).where(:team_id => @map.reviewee_id)
     ReviewChatsHelper::chat_email_query(@interaction_id.first.id)
     redirect_to action: 'new', id: params[:id]
 end
  • Create a new view show.html.erb to show the existing chat record and a box to respond and ask a follow up query.

Flowchart

Testing

User Interface Testing

  • Login to Expertiza with a student account. You can use login id as 'student5700' and password as 'password'.
  • Start reviewing an existing assignment. You would see a small query box at the bottom of the page.
  • 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.

Model Testing

  • Create a model test file review_chat_test.rb with the below tests.

Presence of assignment_id

 test "assignment_id should be present" do
   @review_chat.assignment_id = " "
   assert_not @review_chat.assignment_id?
 end

Presence of reviewer_id

 test "reviewer_id should be present" do
   @review_chat.reviewer_id = " "
   assert_not @review_chat.reviewer_id?
 end

Presence of team_id

 test "team_id should be present" do
   @review_chat.team_id = " "
   assert_not @review_chat.team_id?
 end

Presence of content

 test "content should be present (nonblank)" do
   @review_chat.content = " " * 6
   assert_not @review_chat.valid?
 end

Length of content

 test "content should have a maximum length of 255" do
   @review_chat.content = "a" * 250
   assert @review_chat.valid?
 end
  • To run the tests,
 bin/rake test test/models/review_chat_test.rb

Web Testing

  • Create a browser automation test in imacros in Firefox/Chrome browser.
  • Run the simulation to test the Expertiza chat operation in the browser.

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/>