class MavisCLI::Schools::RemoveProgrammeYearGroup
Public Instance Methods
Source
# File app/lib/mavis_cli/schools/remove_programme_year_group.rb, line 17 def call(urn:, programme_type:, year_groups:, **) MavisCLI.load_rails location = Location.gias_school.find_by_urn_and_site(urn) if location.nil? warn "Could not find school." return end begin programme = Programme.find(programme_type) rescue Programme::InvalidType warn "Could not find programme." return end location .location_programme_year_groups .for_programme(programme) .where(location_year_group: { value: year_groups }) .destroy_all end