CSC/ECE 517 Fall 2018/E1834 Improve email notifications: Difference between revisions
No edit summary |
No edit summary |
||
Line 36: | Line 36: | ||
end | end | ||
prepared_mail = MailerHelper.send_mail_to_user(user, "Your Expertiza account and password have been created.", "user_welcome", "password") | prepared_mail = MailerHelper.send_mail_to_user(user, "Your Expertiza account and password have been created.", "user_welcome", "password") | ||
prepared_mail.deliver | |||
end | |||
We have in a similar fashion added a method in the course_participant model. | |||
# provide import functionality for Course Participants | |||
# if user does not exist, it will be created and added to this assignment | |||
def self.import(row_hash, _row_header = nil, session, id) | |||
raise ArgumentError, "No user id has been specified." if row_hash.empty? | |||
user = User.find_by(name: row_hash[:name]) | |||
if user.nil? | |||
raise ArgumentError, "The record containing #{row_hash[:name]} does not have enough items." if row_hash.length < 4 | |||
attributes = ImportFileHelper.define_attributes(row_hash) | |||
user = ImportFileHelper.create_new_user(attributes, session) | |||
end | |||
course = Course.find_by(id) | |||
raise ImportError, "The course with the id \"" + id.to_s + "\" was not found." if course.nil? | |||
unless CourseParticipant.exists?(user_id: user.id, parent_id: id) | |||
CourseParticipant.create(user_id: user.id, parent_id: id) | |||
end | |||
password = "password"#user.password | |||
prepared_mail = MailerHelper.send_mail_to_user(user, "Your Expertiza account and password have been created.", "user_welcome", password) | |||
prepared_mail.deliver | prepared_mail.deliver | ||
end | end |
Revision as of 05:12, 2 November 2018
This page provides a description of the Expertiza based OSS project.
About Expertiza
Expertiza is an open source project developed using Ruby on Rails framework.Expertiza allows the instructor to create new assignments and customize new or existing assignments.The application allows students to submit and peer-review learning objects (articles, code, web sites, etc)[1].Expertiza supports submission across various document types, including the URLs and wiki pages.
Problem Statement
Approach Taken To Implement Changes
NOTE: All the mails except the ones for the reviewer which are sent to mailinator are sent to expertiza.development@gmail.com ,as this is already set in the development environment.
1) Mail sent when participant added to assignment :
When students' accounts are created by importing a CSV file on the Users page,they receive e-mails but not when user was added as a participant to the assignment.We added a method in the assignment_participant.rb model to send mails when a participant is added to an assignment on the assignment page through a CSV file.This functionality is implemented with using the MailerHelper class.
# provide import functionality for Assignment Participants # if user does not exist, it will be created and added to this assignment def self.import(row_hash, _row_header = nil, session, id) raise ArgumentError, "No user id has been specified." if row_hash.empty? user = User.find_by(name: row_hash[:name]) if user.nil? raise ArgumentError, "The record containing #{row_hash[:name]} does not have enough items." if row_hash.length < 4 attributes = ImportFileHelper.define_attributes(row_hash) user = ImportFileHelper.create_new_user(attributes, session) end raise ImportError, "The assignment with id \"#{id.to_s}\" was not found." if Assignment.find(id).nil? unless AssignmentParticipant.exists?(user_id: user.id, parent_id: id) new_part = AssignmentParticipant.create(user_id: user.id, parent_id: id) new_part.set_handle end prepared_mail = MailerHelper.send_mail_to_user(user, "Your Expertiza account and password have been created.", "user_welcome", "password") prepared_mail.deliver end
We have in a similar fashion added a method in the course_participant model.
# provide import functionality for Course Participants # if user does not exist, it will be created and added to this assignment def self.import(row_hash, _row_header = nil, session, id) raise ArgumentError, "No user id has been specified." if row_hash.empty? user = User.find_by(name: row_hash[:name]) if user.nil? raise ArgumentError, "The record containing #{row_hash[:name]} does not have enough items." if row_hash.length < 4 attributes = ImportFileHelper.define_attributes(row_hash) user = ImportFileHelper.create_new_user(attributes, session) end course = Course.find_by(id) raise ImportError, "The course with the id \"" + id.to_s + "\" was not found." if course.nil? unless CourseParticipant.exists?(user_id: user.id, parent_id: id) CourseParticipant.create(user_id: user.id, parent_id: id) end password = "password"#user.password prepared_mail = MailerHelper.send_mail_to_user(user, "Your Expertiza account and password have been created.", "user_welcome", password) prepared_mail.deliver end