Skip to content
Snippets Groups Projects
Commit b770d2c3 authored by Anusha Ranganathan's avatar Anusha Ranganathan
Browse files

Merge branch 'feature/356_rake_task_to_deleted_CRC1280' into 'develop'

Rake task to delete CRC 1280 collections and works

Closes FDM/rdm-system/antleaf-projectmanagement#356

See merge request !298
parents 7ad8b2cf b339a1fd
No related branches found
Tags v1.0-beta3
1 merge request!298Rake task to delete CRC 1280 collections and works
Pipeline #13963 failed
# frozen_string_literal: true
namespace :rdms do
desc 'Delete CRC1280 works and collections. usage: rdms:delete_crc_1280_works_and_collections["dry_run"]'
task :"delete_crc_1280_works_and_collections", [:dry_run] => :environment do |task, args|
crc_1280_datasets_to_delete = []
CrcDataset.all.each do |c|
if args.dry_run.present?
crc_1280_datasets_to_delete << c.id
else
puts "Deleting Crc 1280 dataset #{c.id}"
c.delete
end
end
if args.dry_run.present?
puts "IDs of all Crc 1280 Datasets to be deleted"
puts crc_1280_datasets_to_delete
end
crc_1280_collections_to_delete = []
Collection.all.each do |c|
if c.collection_type.title == "CRC 1280" and c.title.first != "CRC 1280"
if args.dry_run.present?
crc_1280_collections_to_delete << c.id
else
puts "Deleting Crc 1280 collection #{c.id}"
c.delete
end
end
end
if args.dry_run.present?
puts "IDs of all Crc 1280 collections to be deleted"
puts crc_1280_collections_to_delete
end
end
end
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment