CSC/ECE 517 Fall 2016 E1689: Anonymous Chat Between Author and Reviewer: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
(skeleton)
(controller)
Line 65: Line 65:


===Added===
===Added===
 
A new controller messages_controller.rb was added. The major functionality this controller provides is that via sync gem, it syncs a new message to the corresponding chat as soon as the new message has been saved which facilitates the real time chat.
====MessagesHelper====
A new helper module messages_helper.rb has been added. It contains 2 methods self_or_other(message) and reviewee_or_reviewer(message) which take the message object as input and return whether the current_user sent the message and whether message was sent by reviewee_or_reviewer. Using the output of these methods,
various css classes are added to the message div to provide UI enhancements.
===Modified===
===Modified===
The student_task_controller.rb has been modified to add a chat_mappings instance variable in the view method which makes the chat objects associated with the reviee team available for the view.


==Views==
==Views==

Revision as of 05:29, 3 December 2016

Introduction to Expertiza

Expertiza is a peer review based system which provides incremental learning from the class. This project has been developed together by faculty and students using Ruby on Rails framework. Expertiza allows the instructor to create, edit and delete assignments, create new assignment topics, assign them to a particular class or selected students, have students work on teams and then review each other's assignments at the end. For the students, they can signup for topics, form teams, and submit their projects and assignments. Students then review the work done by other students and give suggestions to improve. Teams after reviews are allotted scores and they can refer to the peer comments to further improve their work. It also supports submission of different file types for assignments, including the URLs and wiki pages.

Problem Statement

During reviews, many a time, reviewers may have questions about the submitted material or the authors may want to give some instructions to the reviewers. It may sometimes block the reviewers from progressing with the review. Reviewers can end up submitting empty review forms with all 0s if they cannot figure something out. The aim of this project is to provide a mini-discussion platform for each submission so that reviewers and authors can ask/answer questions in the form of a real-time chat window. For example, if the server on which the application is deployed is down, then the reviewer can send a message that the server is down to the authors and then the authors can get the server up and running and send a message to the reviewer informing the same rather than receiving low grade on that review.

Implementation details

Database Design

To implement the chat feature , we are creating 2 new models i.e Chat and Message. The associations for these models are Chat belongs to ReviewResponseMap and has many messages while Message belongs to Chat. The already existing ReviewResponseMap model contains the review responses, assignment_id, group id and reviewer id . Now, the Chat model will contain the response_map_id element. Using this element , the values of assignment_id, group_id and reviewer_id can be filled in the Chat database.

Tables and Schema

  • Chat (belongs to ReviewResponseMap)
  • id - primary key - int
  • response_map_id - id of the response_map - int
  • Message (belongs to Chat)
  • id - primary key - int
  • body - contains the message body - text
  • sender_id - userid of the sender. hidden from the UI. - int

Use case diagram

Modifications in UI

Changes in existing views

1)Scenario 1: When the reviewer has a doubt and wants to send a message to the reviewee group.
A new link for chat will be provided along with the view and edit options of a review.

2)Scenario 2: When the reviewee group wants to view their messages or send a message to one of the reviewers.
A new link for messages will be provided beside "Your work" where the group can view their chats and can send messages.

New views

The plan is to add views which facilitate the chat between author and reviewer as shown below:

  • When the reviewee clicks on Messages link, all of his/her conversations are shown. When a particular conversation is clicked , the message log pops up in the lower right corner similar to a facebook/gmail chat application.
  • When the reviewer clicks on chat link, the message log for that particular reviewee group pops up in a similar fashion as mentioned above.

When clicked on test,the next view pops up.

Technologies proposed

Most of the web uses Http which uses TCP/IP transports. This means that the connection is initialed by client, server responds to the request and becomes idle. For implementing a chat feature using the above technique requires the client to keep on poling so that it receives the latest messages from the server. Apart from this, there are ways that server initiates the communication with the client when there is data which is called push or comet. Both these techniques involve overhead of http and isn't a very good way for low latency applications.

For a better way, we will use web sockets into place which provides persistent connections between a server and a client, which enables both to send data at any time.

To implement this we are planning to use a ruby gem Faye which is a messaging system with publish-subscribe. It works on Bayeux protocol.

We will have the messages of the chat displayed in a partial which is updated using Sync - Realtime Rails Partials.

Files Added/Modified

Models

Added

Two new models chat.rb and message.rb have been added. The dependency between them is a one-to-many relationship , i.e a Chat has many messages and Message belongs to Chat. The message model also has a many-to-one relation with User while Chat has a one-to-one relationship with ReviewResponseMap.

Modified

Barring minor modifications in User, ReviewResponseMap and ResponseMap to implement the above mentioned associations, we have added a create_chat method in the ReviewResponseMap.rb so that a chat corresponding to that particular reviewresponsemap is created whenever the reviewresponsemap is created. So, whenever a reviewer signs up to review a topic ,a reviewresponsemap and a chat associated with that reviewresponsemap is created which facilitates the reviewee team and reviewer to send messages back and forth.

Controllers

Added

A new controller messages_controller.rb was added. The major functionality this controller provides is that via sync gem, it syncs a new message to the corresponding chat as soon as the new message has been saved which facilitates the real time chat.

MessagesHelper

A new helper module messages_helper.rb has been added. It contains 2 methods self_or_other(message) and reviewee_or_reviewer(message) which take the message object as input and return whether the current_user sent the message and whether message was sent by reviewee_or_reviewer. Using the output of these methods, various css classes are added to the message div to provide UI enhancements.

Modified

The student_task_controller.rb has been modified to add a chat_mappings instance variable in the view method which makes the chat objects associated with the reviee team available for the view.

Views

Added

Modified

Test

Feature Tests

Team Online Chat Reviewer starts the chat and all the team members should be able to see messages/send messages to review. All team members are online and as soon as a message is sent, it should appear in all the members participating in the chat.

Team Offline Chat Reviewer starts the chat and all the team members should be able to see messages/send messages to review. Some of the team mates are offline and should be able to see these messages when they login, and send messages.

Parallel Chat A person can simultaneously chat in different chats in a single assignment. He can be a reviewer chatting with two teams in two independent chats and he can be also a author talking to two reviewers in two chats. All these chats should be independent, message sent in one chat should only appear in that chat.

Unit Tests

Testing the newly added controllers - ChatsController,MessagesController

Testing the newly added Models - Chat,Message

Reference links