Class: CleanupRemovedTimetableSlots

Inherits:
CleanupRemovedRecords show all
Includes:
Interpipe::Interactor
Defined in:
app/interactors/cleanup_removed_timetable_slots.rb

Instance Method Summary collapse

Methods included from Interpipe::Interactor

included, #initialize, #setup

Methods inherited from CleanupRemovedRecords

#cleanup_records

Instance Method Details

#perform(timetable_slots:, faculty_semester:, **options) ⇒ Object


7
8
9
10
11
12
13
14
15
# File 'app/interactors/cleanup_removed_timetable_slots.rb', line 7

def perform(timetable_slots: , faculty_semester: , **options)
  @slots = timetable_slots
  @options = options
  stored_slot_ids = TimetableSlot.join(Parallel.table_name, id: :parallel_id)
    .where(semester: faculty_semester.code, faculty: faculty_semester.faculty, timetable_slots__deleted_at: nil)
    .select(Sequel.lit('timetable_slots.*'))
    .select_map(:timetable_slots__id)
  cleanup_records(@slots, stored_slot_ids, TimetableSlot)
end

#resultsObject


17
18
19
# File 'app/interactors/cleanup_removed_timetable_slots.rb', line 17

def results
  { timetable_slots: @slots }.merge(@options)
end