Class: CoursesService::Commands::DistributeDueDates
- Inherits:
-
Object
- Object
- CoursesService::Commands::DistributeDueDates
- Defined in:
- app/services/courses_service/commands/distribute_due_dates.rb,
app/services/courses_service/commands/distribute_due_dates/scheduler.rb
Defined Under Namespace
Classes: Scheduler
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(args) ⇒ DistributeDueDates
constructor
A new instance of DistributeDueDates.
Constructor Details
#initialize(args) ⇒ DistributeDueDates
Returns a new instance of DistributeDueDates.
4 5 6 7 8 9 10 11 12 |
# File 'app/services/courses_service/commands/distribute_due_dates.rb', line 4 def initialize(args) @args = args @course = args[:course] @modules = ContextModule .where( 'context_modules.context_id = ? AND context_modules.context_type = \'Course\' AND context_modules.name IS NOT NULL', @course.id) .order(:position) end |
Instance Method Details
#call ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'app/services/courses_service/commands/distribute_due_dates.rb', line 14 def call return unless SettingsService.get_settings(object: :school, id: 1)['auto_due_dates'] == 'on' return unless course.start_at && course.end_at course_assignments = assignments scheduler.course_dates.each do |date, count| update_assignments(course_assignments.slice!(0..count - 1), date) end end |