User:Cbaruah: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
 
(55 intermediate revisions by 3 users not shown)
Line 1: Line 1:
= CSC/ECE 517 Fall 2016 E1655/OSS Improve e-mail notification =
= CSC/ECE 517 Fall 2016 E1655/OSS Improve e-mail notification =


Line 8: Line 7:
* Instructor Login: Username: instructor6 , password: password
* Instructor Login: Username: instructor6 , password: password
* Student Login: Username: student5432 , password: password
* Student Login: Username: student5432 , password: password
* Student Login: Username: testing11, password: password
 
* Student Login: Username: testing12, password: password
We would request you to create at least 3-4 users more to test all the functionality pertaining to this project.
This is because teams can be created and all the functionality with respect to email notifications can be tested.


===Expertiza Background===
===Expertiza Background===


Expertiza is an open source project based on Ruby on Rails framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.
Expertiza is an open-source project based on Ruby on Rails framework. Expertiza allows the instructor to create and customize new or existing assignments and courses. It also allows the instructor to create a list of topics the students can sign up for, add users, add reviewers, add teams. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other student's submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.


Mailers in Expertiza have their association with many other components like Users, Courses,Reviews,Participants and Invitations. The Mailer Helper in specific invokes methods which perform mailer related functions like sending mail to newly created user, sending mail to reviewer etc.  
Mailers in Expertiza have their association with many other components like Users, Courses, Reviews, Participants and Invitations. The Mailer Helper in specific invokes methods which perform mailer related functions like sending email to newly created user, sending email to reviewer etc.


===Motivation===
===Motivation===


This project in particular intends that the students collaborate with each other and work on making enhancements to the code base by applying the concepts of Rails,RSpec, DRY code,Test driven development etc. This provides an opportunity for students to contribute to an open source project and learn further about software deployment etc.
This project in particular intends that the students collaborate and work on making enhancements to the code base by applying the concepts of Rails, RSpec, DRY code,Test driven development etc. This provides an opportunity for students to contribute to an open source project and learn further about software deployment etc.


Currently, the mailer notifies the participants when a new user is created, to the reviewer when a submission of work is done. The scope of this project is to improve the present mail notifications and also plug gaps in some implementations.
Currently, the mailer notifies the students on their account creation and to the reviewer when a submission of work is done. The scope of this project is to improve the present email notifications and also plug gaps in some implementations.


===Current Implementation===
===Current Implementation===


* When students' accounts are created by importing a CSV file on the Users page, they receive e-mails with their user-ID and password. But if an account is created by adding them as participants to an assignment when they don't already have an account, e-mail is not sent. So this functionality of account creation was fixed. No mail is triggered to the concerned user whenever their account is created regardless of how their account is created. The listed files were manipulated for updating this functionality
1. When students' accounts are created by importing a CSV file on the Users page, they receive e-mails with their user-ID and password. But if an account is created by adding them as participants to an assignment when they don't already have an account, e-mail is not sent. So, this issue is fixed by implementing the functionality of sending e-mail when account creation is done in this case. Now, e-mail is getting triggered to the concerned user whenever their account is created regardless of how their account is created. The listed files were manipulated for updating this functionality.
*# controllers/import_file_controller.rb  
 
*# helpers/import_file_helper  
#''controllers/import_file_controller.rb''
#''helpers/import_file_helper''
 
2. Evidently, if a file is revised after review, the system e-mails the reviewer saying to revise the review. The method to implement this was in place but wasn't working. This issue is fixed. Note that the e-mail is only triggered for a file submission and there is no mailer functionality in place for URL submission. Also, after the last round of review is completed, e-mail is no longer is getting triggered as desired. The listed files were updated or created to get the functionality working.
 
#''controllers/submitted_content_controller''
#''helpers/mailer_helper''
#''app/views/mailer/partials/_file_submission_plain.html.erb''
#''app/views/mailer/partials/_file_submission_html.html.erb''
 
3. The message body of the e-mail now includes the round of the review stage for which the review is provided along with a link to the site. Files changed are same as mentioned in second point.
 
4.1 E-mail is triggered to an invitee whenever a participant sends out an invitation to another participant to join a team. The listed files were updated or created to get the functionality working.


* Evidently if a file is revised after review,  the system e-mails the reviewer saying to revise the review. This method was provided but wasn't working. This functionality was fixed and successfully implemented(Mail is only triggered for a file submission. For link submission their is no mailer functionalities). Also after the last round of review is over, mail is no longer triggered. The listed files were updated or created to get the functionality working.
#''controllers/invitation_controller''
*# controllers/submitted_content_controller
#''helpers/participants_helper''
*# helpers/mailer_helper
#''app/views/mailer/partials/_team_join_invite_html.html.erb''
*# app/views/mailer/partials/_file_submission_plain.html.erb
#''app/views/mailer/partials/_team_join_invite_plain.html.erb''
*# app/views/mailer/partials/_file_submission_html.html.erb


* The message body of the mail is fixed to include the round of the review stage for which the review is provided along with a link to the site. Files are same as mentioned in second point.
4.2 Whenever the invitee accepts the invitation, the student who issued the invitation gets a mail stating that the invitee has accepted his/her invitation. The controller and helper class are same as mentioned in the 4th point. New views are created for this functionality
* Email is triggered to an invitee whenever a participant sends out an invitation to another participant to join a team. The listed files were updated or created to get the functionality working.
 
*# controllers/invitation_controller
#''app/views/mailer/partials/_team_accept_invite_html.html.erb''
*# helpers/participants_helper
#''app/views/mailer/partials/_team_accept_invite_plain.html.erb''
*# app/views/mailer/partials/_team_join_invite_html.html.erb
 
*# app/views/mailer/partials/_team_join_invite_plain.html.erb
5. Mail is also getting triggered when a student responds to a teammate advertisement. The controller and helper class changed are same as mentioned in the 4th point. New views are created for this functionality.
* Whenever the invitee accepts the invitation, the student who issued the invitation gets a mail stating that the invitee has accepted his/her invitation. The controller and helper class are the same as mentioned in the 4th point. Although new views had to be created for this functionality
 
*# app/views/mailer/partials/_team_accept_invite_html.html.erb
#''controllers/join_team_request_controller''
*# app/views/mailer/partials/_team_accept_invite_plain.html.erb  
#''app/views/mailer/partials/_response_to_advertisement.html.erb''
* Mail is also triggered when a student responds to a teammate advertisement. The controller and helper class are the same as mentioned in the 4th point. Although new views had to be created for this functionality.
#''app/views/mailer/partials/_response_to_advertisement.html.erb''
*# app/views/mailer/partials/_response_to_advertisement.html.erb
*# app/views/mailer/partials/_response_to_advertisement.html.erb


===Files modified in current project===
===Files modified in current project===
Line 64: Line 73:


This controller also derives from the Application Controller. It states the CRUD operations on submitting the file or hyperlink for assignment. It provides functionality to download, create folder and delete folder after submission. It provides the functionality for submitting links and submitting hyperlinks separately.
This controller also derives from the Application Controller. It states the CRUD operations on submitting the file or hyperlink for assignment. It provides functionality to download, create folder and delete folder after submission. It provides the functionality for submitting links and submitting hyperlinks separately.
    prepared_mail = MailerHelper.send_sync_message(User.find(participant.user_id), "A new submission is available", "file_submission", "file  submission", Assignment.find(participant.parent_id).name)
    prepared_mail.deliver


==== About invitation_controller ====
==== About invitation_controller ====
This controller also derives from the Application Controller. It states the CRUD as well as other basic operations when an invitation is sent by an user to any participant to join their team. It provides the functionality to send and accept invitations as well as to reject invitations and leave team.
This controller also derives from the Application Controller. It states the CRUD as well as other basic operations when an invitation is sent by an user to any participant to join their team. It provides the functionality to send and accept invitations as well as to reject invitations and leave team.
# To send mail request to invitees to join team
prepared_mail = MailerHelper.send_sync_message(user, "Invitation to join team", "team_join_invite", "invitation to join", student.name)
prepared_mail.deliver
==== About join_team_request_controller ====
This controller also derives from the Application Controller. It states the CRUD operations when an invitation is sent by an user to any participant to join their team. It provides the functionality to send and accept invitations as well as to reject invitations and leave team. It is also used when a participant is responding to an advertisement for a teammate created by another participant.
# To send mail for advertisment
prepared_mail = MailerHelper.send_sync_message(user, "Response for Team Advertisement", "response_to_advertisement", "request to join team", participant.name)
prepared_mail.deliver


==== About import_file_helper ====
==== About import_file_helper ====
This is a helper file for the '''import_file_controller''' class which stores the attributes from the controller class as well as creates new users when user are created by importing a CSV file.
This is a helper file for the '''import_file_controller''' class which stores the attributes from the controller class as well as creates new users when user are created by importing a CSV file.
def self.create_new_user(attributes, session)
    user = User.new(attributes)
    user.parent_id = (session[:user]).id
    user.timezonepref = User.find(user.parent_id).timezonepref
    user.save!
    prepared_mail = MailerHelper.send_mail_to_user(user, "Your Expertiza account and password have been created.", "user_welcome", user.password)
    prepared_mail.deliver
    user
end


==== About participants_helper ====
==== About participants_helper ====
This is a helper file for the '''participants_controller''' class. It provides some of the basic functionalities that is required to create participants that are added to expertiza.
This is a helper file for the '''participants_controller''' class. It provides some of the basic functionalities that is required to create participants that are added to expertiza.
  def self.create_new_user(attrs, session)
    user = User.new
    user.update_attributes attrs
    user.parent_id = (session[:user]).id
    user.save
    password = @user.reset_password
    prepared_mail = MailerHelper.send_mail_to_user(@user, "Your Expertiza account and password have been created.", "user_welcome", password)
    prepared_mail.deliver
    flash[:success] = "A new password has been sent to new user's e-mail address."
    user
  end


==== About mailer_helper ====
==== About mailer_helper ====
This helper file is for the '''mailer''' class. Its creates the structure of the mail body that is needed by the mailer class to send mails. It also holds all the attributes that are required to send a mail.
This helper file is for the '''mailer''' class. Its creates the structure of the mail body that is needed by the mailer class to send mails. It also holds all the attributes that are required to send a mail.
def self.send_sync_message(user, subject, partial_name, type, obj_name)
    Mailer.sync_message ({
      to: user.email,
      subject: subject,
      body: {
        type: type,
        obj_name: obj_name,
        user: user,
        first_name: ApplicationHelper.get_user_first_name(user),
        partial_name: partial_name
      }
    })
  end


=== Files created in current project ===
=== Files created in current project ===
Line 87: Line 146:
* app/views/mailer/partials/_team_accept_invite_plain.html.erb
* app/views/mailer/partials/_team_accept_invite_plain.html.erb


===Drawbacks and Solutions===
===Demo Video===
 
The following link is of a video uploaded in Youtube.
Link: https://youtu.be/6xP5_lkTsPk
 
This video will provide a walkthrough on the changes implemented as part of this project.
This will show all the email notifications that the user receives.
 
===Testing Details===
 
==== UI testing of participant  addition via CSV file and e-mail delivery check ====
* Login as instructor. Create a new course and assignment.
* Add new participant not having expertiza account to an assignment using a import file option.
* An e-mail is triggered for participant who do not have an expertiza account.
 
[[file:Capture61.PNG]]
 
==== UI testing of file submission ====
* Login as student. Go to assignment and open your work page.
* Upload a new file submission. If the submission is made in review stage, an e-mail is sent to a reviewer saying a new submission is available for a particular review round. Thus, the reviewer will be able to see the review round number.


Drawback: Presently if users are added by adding them as participants to an assignment, the email for user creation is not sent.
[[File:Capture53.PNG]]


Solution: Moving the call to the mailer from users controller to the point where import file is called. Therefore regardless of the method of the user creation, email is sent to the new user.
==== UI testing for sending/accepting invitation to join team ====
* Login as student. Go to assignment and open your team page.
* Search for a student with whom you want to team up and click on send invite. An e-mail is getting triggered to that student saying a new invite has been sent.
* When the other student accepts it, another e-mail is triggered back to the invitee saying the invite has been accepted.


Drawback: In the existing implementation, mail functionality did not exist when a new submission was made by the user. Such mail functionality was required because a reviewer would be unaware of any new submission made by the user in the review period.
[[File:Capture63.PNG]]
[[File:Capture65.PNG]]


Solution: Mail is sent to the reviewer specifying the assignment name and the round of review in which the submission was made. A link is also provided which takes the reviewer directly to expertiza.
==== UI testing for response to an advertisement ====
* Login as student. Go to assignment page.
* Go to your team and create an advertisement for this assignment.
* Login as some other student who is the participant of the same assignment. Go to assignment page and open sign up sheet.
* For the topic assigned to the student who created advertisement, an icon will appear in advertisement tab.
* Clicking on this icon will redirect the student to page where student can request to join the team of students who created advertisement.
* On click of request button, an e-mail of this response to the advertisement will be sent to the students who created advertisement.


===Testing Details===
[[File:Capture64.PNG]]


===Scope for Future Improvement===
===Scope for Future Improvement===
* An e-mail is being triggered only when a file is submitted for revision. But on the submission of a link, no such e-mail is sent. So, this is one of the areas which can be improved in the future.


===References===
===References===
*https://github.com/cbaruah/expertiza.git
*https://expertiza.ncsu.edu
*http://research.csc.ncsu.edu/efg/expertiza
*[https://www.youtube.com/channel/UCdKXzox7hrWjfOMML6FzTWg YouTube channel]
*[https://hub.docker.com/r/winbobob/expertiza-fall2016/ How to install and run image file in docker]

Latest revision as of 20:05, 4 November 2016

CSC/ECE 517 Fall 2016 E1655/OSS Improve e-mail notification

Peer Review Information

For users intending to view the deployed Expertiza associated with this assignment, the credentials are as follows:

  • Instructor Login: Username: instructor6 , password: password
  • Student Login: Username: student5432 , password: password

We would request you to create at least 3-4 users more to test all the functionality pertaining to this project. This is because teams can be created and all the functionality with respect to email notifications can be tested.

Expertiza Background

Expertiza is an open-source project based on Ruby on Rails framework. Expertiza allows the instructor to create and customize new or existing assignments and courses. It also allows the instructor to create a list of topics the students can sign up for, add users, add reviewers, add teams. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other student's submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.

Mailers in Expertiza have their association with many other components like Users, Courses, Reviews, Participants and Invitations. The Mailer Helper in specific invokes methods which perform mailer related functions like sending email to newly created user, sending email to reviewer etc.

Motivation

This project in particular intends that the students collaborate and work on making enhancements to the code base by applying the concepts of Rails, RSpec, DRY code,Test driven development etc. This provides an opportunity for students to contribute to an open source project and learn further about software deployment etc.

Currently, the mailer notifies the students on their account creation and to the reviewer when a submission of work is done. The scope of this project is to improve the present email notifications and also plug gaps in some implementations.

Current Implementation

1. When students' accounts are created by importing a CSV file on the Users page, they receive e-mails with their user-ID and password. But if an account is created by adding them as participants to an assignment when they don't already have an account, e-mail is not sent. So, this issue is fixed by implementing the functionality of sending e-mail when account creation is done in this case. Now, e-mail is getting triggered to the concerned user whenever their account is created regardless of how their account is created. The listed files were manipulated for updating this functionality.

  1. controllers/import_file_controller.rb
  2. helpers/import_file_helper

2. Evidently, if a file is revised after review, the system e-mails the reviewer saying to revise the review. The method to implement this was in place but wasn't working. This issue is fixed. Note that the e-mail is only triggered for a file submission and there is no mailer functionality in place for URL submission. Also, after the last round of review is completed, e-mail is no longer is getting triggered as desired. The listed files were updated or created to get the functionality working.

  1. controllers/submitted_content_controller
  2. helpers/mailer_helper
  3. app/views/mailer/partials/_file_submission_plain.html.erb
  4. app/views/mailer/partials/_file_submission_html.html.erb

3. The message body of the e-mail now includes the round of the review stage for which the review is provided along with a link to the site. Files changed are same as mentioned in second point.

4.1 E-mail is triggered to an invitee whenever a participant sends out an invitation to another participant to join a team. The listed files were updated or created to get the functionality working.

  1. controllers/invitation_controller
  2. helpers/participants_helper
  3. app/views/mailer/partials/_team_join_invite_html.html.erb
  4. app/views/mailer/partials/_team_join_invite_plain.html.erb

4.2 Whenever the invitee accepts the invitation, the student who issued the invitation gets a mail stating that the invitee has accepted his/her invitation. The controller and helper class are same as mentioned in the 4th point. New views are created for this functionality

  1. app/views/mailer/partials/_team_accept_invite_html.html.erb
  2. app/views/mailer/partials/_team_accept_invite_plain.html.erb

5. Mail is also getting triggered when a student responds to a teammate advertisement. The controller and helper class changed are same as mentioned in the 4th point. New views are created for this functionality.

  1. controllers/join_team_request_controller
  2. app/views/mailer/partials/_response_to_advertisement.html.erb
  3. app/views/mailer/partials/_response_to_advertisement.html.erb

Files modified in current project

Classes

  • controllers/import_file_controller
  • controllers/submitted_content_controller
  • controllers/invitation_controller
  • helpers/import_file_helper
  • helpers/participants_helper
  • helpers/mailer_helper

About import_file_controller

This controller derives from the Application Controller. It states the functionality of importing any kind of file like csv, xls, doc into the application. It defines the import function which takes the 'session' and 'params' as output and provides success message on successful import. It also provides the functionality of specifying the delimiter in the file which is being imported. The ImportFile method defined in the controller reads the file row by row based on the model concerned.

About submitted_content_controller

This controller also derives from the Application Controller. It states the CRUD operations on submitting the file or hyperlink for assignment. It provides functionality to download, create folder and delete folder after submission. It provides the functionality for submitting links and submitting hyperlinks separately.

   prepared_mail = MailerHelper.send_sync_message(User.find(participant.user_id), "A new submission is available", "file_submission", "file  submission", Assignment.find(participant.parent_id).name)
   prepared_mail.deliver

About invitation_controller

This controller also derives from the Application Controller. It states the CRUD as well as other basic operations when an invitation is sent by an user to any participant to join their team. It provides the functionality to send and accept invitations as well as to reject invitations and leave team.

# To send mail request to invitees to join team
prepared_mail = MailerHelper.send_sync_message(user, "Invitation to join team", "team_join_invite", "invitation to join", student.name)
prepared_mail.deliver

About join_team_request_controller

This controller also derives from the Application Controller. It states the CRUD operations when an invitation is sent by an user to any participant to join their team. It provides the functionality to send and accept invitations as well as to reject invitations and leave team. It is also used when a participant is responding to an advertisement for a teammate created by another participant.

# To send mail for advertisment
prepared_mail = MailerHelper.send_sync_message(user, "Response for Team Advertisement", "response_to_advertisement", "request to join team", participant.name)
prepared_mail.deliver

About import_file_helper

This is a helper file for the import_file_controller class which stores the attributes from the controller class as well as creates new users when user are created by importing a CSV file.

def self.create_new_user(attributes, session)
   user = User.new(attributes)
   user.parent_id = (session[:user]).id
   user.timezonepref = User.find(user.parent_id).timezonepref
   user.save!
   prepared_mail = MailerHelper.send_mail_to_user(user, "Your Expertiza account and password have been created.", "user_welcome", user.password)
   prepared_mail.deliver
   user
end

About participants_helper

This is a helper file for the participants_controller class. It provides some of the basic functionalities that is required to create participants that are added to expertiza.

  def self.create_new_user(attrs, session)
   user = User.new
   user.update_attributes attrs
   user.parent_id = (session[:user]).id
   user.save
   password = @user.reset_password
   prepared_mail = MailerHelper.send_mail_to_user(@user, "Your Expertiza account and password have been created.", "user_welcome", password)
   prepared_mail.deliver
   flash[:success] = "A new password has been sent to new user's e-mail address."
   user
 end

About mailer_helper

This helper file is for the mailer class. Its creates the structure of the mail body that is needed by the mailer class to send mails. It also holds all the attributes that are required to send a mail.

def self.send_sync_message(user, subject, partial_name, type, obj_name)
   Mailer.sync_message ({
     to: user.email,
     subject: subject,
     body: {
       type: type,
       obj_name: obj_name,
       user: user,
       first_name: ApplicationHelper.get_user_first_name(user),
       partial_name: partial_name
     }
   })
 end

Files created in current project

  • app/views/mailer/partials/_file_submission_plain.html.erb
  • app/views/mailer/partials/_file_submission_html.html.erb
  • app/views/mailer/partials/_team_join_invite_html.html.erb
  • app/views/mailer/partials/_team_join_invite_plain.html.erb
  • app/views/mailer/partials/_file_submission_html.html.erb
  • app/views/mailer/partials/_file_submission_plain.html.erb
  • app/views/mailer/partials/_team_accept_invite_html.html.erb
  • app/views/mailer/partials/_team_accept_invite_plain.html.erb

Demo Video

The following link is of a video uploaded in Youtube. Link: https://youtu.be/6xP5_lkTsPk

This video will provide a walkthrough on the changes implemented as part of this project. This will show all the email notifications that the user receives.

Testing Details

UI testing of participant addition via CSV file and e-mail delivery check

  • Login as instructor. Create a new course and assignment.
  • Add new participant not having expertiza account to an assignment using a import file option.
  • An e-mail is triggered for participant who do not have an expertiza account.

UI testing of file submission

  • Login as student. Go to assignment and open your work page.
  • Upload a new file submission. If the submission is made in review stage, an e-mail is sent to a reviewer saying a new submission is available for a particular review round. Thus, the reviewer will be able to see the review round number.

UI testing for sending/accepting invitation to join team

  • Login as student. Go to assignment and open your team page.
  • Search for a student with whom you want to team up and click on send invite. An e-mail is getting triggered to that student saying a new invite has been sent.
  • When the other student accepts it, another e-mail is triggered back to the invitee saying the invite has been accepted.

UI testing for response to an advertisement

  • Login as student. Go to assignment page.
  • Go to your team and create an advertisement for this assignment.
  • Login as some other student who is the participant of the same assignment. Go to assignment page and open sign up sheet.
  • For the topic assigned to the student who created advertisement, an icon will appear in advertisement tab.
  • Clicking on this icon will redirect the student to page where student can request to join the team of students who created advertisement.
  • On click of request button, an e-mail of this response to the advertisement will be sent to the students who created advertisement.

Scope for Future Improvement

  • An e-mail is being triggered only when a file is submitted for revision. But on the submission of a link, no such e-mail is sent. So, this is one of the areas which can be improved in the future.

References