Jump to content

User:Cbaruah/sandbox

From Wikipedia, the free encyclopedia

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

[edit]

Peer Review Information

[edit]

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
  • Student Login: Username: testing11, password: password
  • Student Login: Username: testing12, password: password

Expertiza Background

[edit]

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.

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.

Motivation

[edit]

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.

Currently, the mailer notifies the students and instructors of various events by e-mail, e.g., creation of a new account, submission of a review on their work, or updating of work that they have reviewed.  There are some holes, though, and this project deals with plugging several of them.

Current Implementation

[edit]
  • 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. helpers/participants_helper.rb
    2. helpers/import_file_helper
  • 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.
    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
  • 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.
  • 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.
    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
  • 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
    1. app/views/mailer/partials/_team_accept_invite_html.html.erb
    2. app/views/mailer/partials/_team_accept_invite_plain.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.
    1. app/views/mailer/partials/_response_to_advertisement.html.erb
    2. app/views/mailer/partials/_response_to_advertisement.html.erb

Files modified in current project

[edit]

Classes

[edit]
  • 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

[edit]

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

[edit]

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_mail_to_reviewer(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

[edit]

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_mail_for_invitation(user, "Invitation to join team", "team_join_invite", "invitation to join", student.name)
prepared_mail.deliver

About import_file_helper

[edit]

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

[edit]

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

[edit]

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_mail_to_reviewer(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
 def self.send_mail_for_invitation(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

def self.send_mail_for_advertisement_response(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

[edit]
  • 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/_response_to_advertisement.html.erb
  • app/views/mailer/partials/_response_to_advertisement.html.erb
  • app/views/mailer/partials/_team_accept_invite_html.html.erb
  • app/views/mailer/partials/_team_accept_invite_plain.html.erb

Testing Details

[edit]

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

[edit]
  • Login as instructor. Create a new course and assignment.
  • Add new participant to an assignment using a import file option.
  • A mail is triggered for participant who do not have an expertiza account.

UI testing of file submission

[edit]
  • Login as student. Go to assignment and open your work page.
  • Upload a new file submission. If the submission is made in review stage, a mail is triggered to a reviewer saying a new submission is available for a particular review round.

UI testing for sending/accepting invitation to join team

[edit]
  • 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. A mail is triggered to that student saying a new invite has been sent.
  • When the student accepts it, another mail is triggered back to the invitee saying the invite has been accepted.
  • When a team member responds to an advertisement, the student who hosted it gets a mail about that response.

Scope for Future Improvement

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

References

[edit]

https://github.com/cbaruah/expertiza.git

https://expertiza.ncsu.edu

http://research.csc.ncsu.edu/efg/expertiza

YouTube channel

How to install and run image file in docker