CSC/ECE 517 Spring 2022 - E2246: Email your authors/reviewers, with complete tests

From Expertiza_Wiki
Jump to navigation Jump to search

Introduction

Problem Statement

This project adds a new feature which will enable a reviewer to send an Email to authors from inside Expertiza or for the author to email all those reviewing them. Often when reviewing another team’s submissions, a reviewer might notice that their deployment link is broken or there is some other issue. Currently, there is no way to email the authors. This features is proposed to solve this issue.

Scope of the Feature

- The feature allows authors to send a common Email to all the reviewers to report any issues or updates to their project to be reviewed.
- It can allow a reviewer to send an email to a particular author if the reviewer wants to convey any issues found with that particular project.
- Reviewers will be anonymous to authors.

Flowchart

Author's View : The flow for authors to email reviewers regarding the work they have been reviewed for:


Reviewer's View : The flow for reviewers to email authors whose work they have reviewed:


UML Diagrams

Reviewers use case


Author's use case



Proposed Changes

Code Implementation

Expertiza code base already contains a module 'MailerHelper' which makes use of ActionMailer and contains methods to send emails to different users. email_author_reviewers(subject, body, email) will be added which can be used in both the workflows to send an Email.
From the Reviewer's perspective, the following files will be updated and a new view will be created.

1. app/views/response/view.html.erb : link to the new view will be added to this file.
2. app/controllers/response_controller.rb : implementation of the action method for the send button will be added here. Methods from MailerHelper will be used here.
3. app/views/response/author.html.erb : This is the new UI page. A mock up for the view is presented in the UI section.

From Author's perspective, the following files will be updated and a new partial will be created to render the new view.

1. app/views/student_task/view.html.erb : link to the new view will be added to this file.
2. app/controllers/student_task controller.rb : implementation of the action method for the send button will be added here. Methods from MailerHelper will be used here.
3. app/views/student_task/email_reviewers.html.erb : This is the new UI page. A mockup for the view is presented in the UI section.

UI

As depicted below, Authors will be given a link on their main Assignment page “Send Email to Reviewers” which will take them to a new page where they are given a text box for typing and sending an email to all their reviewers.





Reviewers will be given a similar text box link on their “Other’s Work” page next to each review that they are doing.




Implememtation

The following are the screenshots of the changes that we made in the codebase.


Send Email Method in MailerHelper

We created a new method called send_mail_to_author_reviewers(subject, body, email), which accepts 3 parameters; subject, body and email. We used the same method for both sending emails to authors and reviewers.


Email from Reviewer to Author

View

We modified the view to add a link that redirects the author to the form.


To create the author view, we created a new view called author.html.erb and created a form in that file, which asks the user to enter the subject and body.

Controller

We created a method called send_email in the response_controller which handles the functionality for sending an email. The method also contains validations that throw an error if the user is trying to submit the form without filling out the subject or body. If there are no validation errors, we pass the subject, body, and email from the view to the controller and send them to a method called send_mail_to_author_reviewers which is a part of MailerHelper. This method is responsible for sending emails to the author.


Email from Author to Reviewers

View

We modified the view to add a link that redirects the reviewer to the form.


To create the reviewer view, we created a new view called email_reviewers.html.erb where we created a form that asks the user to enter the subject and body of the email.

Controller

To send an email to all the reviewers, we created a method called send_email in the student_task_controller. The method also contains validations that throw an error if the user is trying to submit the form without filling out the subject or body. If there are no validation errors, we go ahead and pass the parameters; subject, body, and reviewer.email to the send_mail_to_author_reviewers method from MailerHelper.


Testing

RSPEC Testing

We tested the send_email method used in response_controller.rb and student_task_controller.rb which we have added to achieve the functionality of sending email to reviewers and authors. We have considered four scenarios which can occur while an email has to be sent, namely, user might not give the subject but the body, subject present but no body, both subject and body are present as desired in which case the email is sent on send email button click and the user is redirected to the student task list page and lastly, if there is no subject or body of the email is given, the user is flashed a message and is kept on the same page to fill in the desired fields. Below are the different test scenarios described above:

Test 1:


Test 2:


Test 3:


Test 4:


Test Result: We ran the test file using the command bundle exec rspec spec/controllers/response_controller_spec.rb and below is the test result.


Manual Testing

For testing purposes, we are using the 'expertiza.debugging@gmail.com' as both author and reviewer. There are two views that need to be tested manually.

1. Author View:

The author must follow the following steps:

1. Go to the Assignments page.
2. Click on the project for which they want to send email to the reviewers, in the student task view page then click on the right corner of the page where we have the link "send email to reviewers".
3. On clicking the above link, the author must be redirected to a page which will ask then for subject of email and text for the body of email.
4. Type the email subject, message and click on send.
5. Author can log in to the email to check if the message is received from receivers. 

2. Reviewer View:

The reviewer must follow the following steps:

1. Go to the other's work page.
2. Next to every review that the reviewer is doing, will be a link on the right corner of the page called "send email to author".
3. On clicking the above link, the reviewer will be redirected to a page with text box for subject and message. 
4. Type the email subject, message and click on send. 
5. Log in to the email to check if the message is received.

Future Scope

1. Currently, only a subject and a text message are provided to send an Email, in future the above functionality can be extended to include attachments in the Email. For example, Reviewer can send an image/screenshot for a failure they have come across to the Author.

2. New functionality to send messages within expertiza

Team Members

Ashritha Bommagani (abommag@ncsu.edu)

Abhishek Arvindkumar Upadhyay (aaupadhy@ncsu.edu)

Harini Bharata (hbharat@ncsu.edu)

Sri Pallavi Damuluri (sdamulu@ncsu.edu)