namespace :institution_confidential_infos do
  desc 'Declassify institution confidential info status'
  task :change_status => :environment do
    InstitutionConfidentialInfo.all.each do |info|
      if (info.status == "created" or info.status == "extension") and info.declassification_date.end_of_day == Date.today.end_of_day
        info.status = 'declassified'
        info.save
      end
    end
  end
end