Class: GradesService::Commands::ZeroOutAssignmentGrades

Inherits:
Object
  • Object
show all
Defined in:
app/services/grades_service/commands/zero_out_assignment_grades.rb

Instance Method Summary collapse

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.
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!(options={})
  return unless options[:log_file]
  return unless SettingsService.get_settings(object: :school, id: 1)['zero_out_past_due'] == 'on'
  @options = options
  return unless should_grade?

  if options[:dry_run]
    log_execution_plan
    return
  end

  log_operation
  @assignment.grade_student(@student, score: 0, grader: @grader)
end