-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
E2104. Email notification to reviewers and instructors. #1913
Conversation
Generated by expertiza-bot |
Hey @harshkachhadia, TravisCI finished with status |
test/models/due_date_test.rb
Outdated
@@ -0,0 +1,28 @@ | |||
require 'test_helper' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please write RSpec tests under the spec
folder.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done writing and refactoring the same. Thank you for guiding the team. We appreciate it.
Hi team, please fix all the code climate issues. |
1 similar comment
reminder | ||
end | ||
|
||
def reminder |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Method reminder
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
app/models/due_date.rb
Outdated
# content_type: "text/html", | ||
to: defn[:to]) | ||
end | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar blocks of code found in 2 locations. Consider refactoring.
app/models/due_date.rb
Outdated
return (self.due_at - days_before_deadline).to_datetime | ||
end | ||
|
||
handle_asynchronously :start_reminder, run_at: proc { |i| i.when_to_run_start_reminder } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Space between { and | detected.
app/models/due_date.rb
Outdated
end | ||
|
||
handle_asynchronously :start_reminder, run_at: proc { |i| i.when_to_run_start_reminder } | ||
handle_asynchronously :reminder, run_at: proc { |i| i.when_to_run_reminder } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Space between { and | detected.
app/models/due_date.rb
Outdated
|
||
handle_asynchronously :start_reminder, run_at: proc { |i| i.when_to_run_start_reminder } | ||
handle_asynchronously :reminder, run_at: proc { |i| i.when_to_run_reminder } | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Final newline missing.
spec/models/due_date_spec.rb
Outdated
}.to change(Delayed::Job.count).by(1) | ||
end | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing whitespace detected.
spec/models/due_date_spec.rb
Outdated
end | ||
|
||
it 'enqueues remainder email in delayed job queue' do | ||
expect { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid using {...}
for multi-line blocks.
spec/models/due_date_spec.rb
Outdated
end | ||
|
||
it 'enqueues remainder job in delayed job queue' do | ||
expect { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid using {...}
for multi-line blocks.
spec/models/due_date_spec.rb
Outdated
|
||
it 'enqueues remainder email in delayed job queue' do | ||
expect { | ||
delay.reminder() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not use parentheses for method calls with no arguments.
spec/models/due_date_spec.rb
Outdated
|
||
it 'enqueues remainder job in delayed job queue' do | ||
expect { | ||
delay.start_reminder() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not use parentheses for method calls with no arguments.
Code Climate has analyzed commit 0eb1e78 and detected 0 issues on this pull request. The test coverage on the diff in this pull request is 37.5% (50% is the threshold). This pull request will bring the total coverage in the repository to 29.1% (-21.7% change). View more on Code Climate. |
spec/models/due_date_spec.rb
Outdated
class DueDateTest < ActiveSupport::TestCase | ||
describe "due_date_reminder_functions" do | ||
before(:all) do | ||
@due_at = DateTime.current - 4.days |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer Date or Time over DateTime.
spec/models/due_date_spec.rb
Outdated
class DueDateTest < ActiveSupport::TestCase | ||
describe "due_date_reminder_functions" do | ||
before(:all) do | ||
@due_at = Date.today - 4.days |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not use Date.today
without zone. Use Time.zone.today
instead.
A description of the changes proposed in the pull request.
This amendment to the project involves adding an asynchronous deadline reminder mailer to the application.
In the due_date.rb file, whenever a new due date is created or an existing due date is updated, the 'start_reminder' method will be fired which will eventually be added to the delayed_job queue.
This job will be executed at a preconfigured time before deadline, where it will fire the method 'reminder' which will be added to the delayed job queue by the handle_asynchronously method of gem 'delayed_job_active_record'.
Inside the reminder method, we will fetch three attributes - assignment_id, deadline_type, due_at. These three attributes will be used to decide the deadline type ( submission or review or teammate review ), fetch the participant email for that assignment, fetch the deadline threshold and at the end send the email reminder at a specified threshold time before the deadline which will contain all the details such as assignment names link to assignment and assignment type ( submission or review or teammate review).
Person or team responsible for reviewing proposed changes.
@efg , @Saurabh110