Class: GradesService::Commands::ZeroOutAssignmentGrades
- Inherits:
-
Object
- Object
- GradesService::Commands::ZeroOutAssignmentGrades
- Defined in:
- app/services/grades_service/commands/zero_out_assignment_grades.rb
Instance Method Summary collapse
- #call!(options = {}) ⇒ Object
-
#initialize(submission) ⇒ ZeroOutAssignmentGrades
constructor
A new instance of ZeroOutAssignmentGrades.
Constructor Details
#initialize(submission) ⇒ ZeroOutAssignmentGrades
Returns a new instance of ZeroOutAssignmentGrades.
4 5 6 7 8 9 10 11 |
# File 'app/services/grades_service/commands/zero_out_assignment_grades.rb', line 4 def initialize(submission) @previous_score = submission.score @submission = submission @assignment = @submission.assignment @student = @submission.user @course = @assignment.context @grader = GradesService::Account.account_admin end |
Instance Method Details
#call!(options = {}) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/services/grades_service/commands/zero_out_assignment_grades.rb', line 13 def call!(={}) return unless [:log_file] return unless SettingsService.get_settings(object: :school, id: 1)['zero_out_past_due'] == 'on' @options = return unless should_grade? if [:dry_run] log_execution_plan return end log_operation @assignment.grade_student(@student, score: 0, grader: @grader) end |