-
Notifications
You must be signed in to change notification settings - Fork 13
Script: Add idea to old feedback 2.0 test
Josh Schwartzman edited this page Dec 6, 2019
·
1 revision
Find a test collection and make the first media item the first idea
c = Collection.find(collection_id)
ideas_collection_card = c.primary_collection_cards.create(
order: 0,
section_type: :ideas,
record: Collection.new(name: 'Ideas'),
)
first_media_item = c.items.where(
type: ['Item::FileItem', 'Item::LinkItem', 'Item::VideoItem'],
).first
first_description_item = c.items.question_description.first
first_media_item.update(
question_type: :question_idea,
content: first_description_item&.content
)
first_media_item.parent_collection_card.update(
parent_id: ideas_collection_card.collection.id,
)