some quiz questions weren't being processed for import
correctly because they were pointing to an AQ and
expected to get the AQ question data
Test Plan:
* Create some quizzes with images in the questions
* Copy the course
* The new course should have the images in the quiz questions
closes#8476
Change-Id: Ieaaef88f9551afa79aa8daab8b784ce388857f48
Reviewed-on: https://gerrit.instructure.com/10591
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
If there were existing query string parameters when
translating link on an Assessment Question the resultant
string would have two '?' instead of separating them with '&'
Test Plan:
* Create an assessment question and have the description point to an image in the course by selecting one in the wiki sidebar
* Before you save the question, add something like "?wrap=1" to the end of the img src
* Save the question
* Looking at the source of the question text after save should show that the wrap has a '&' before instead of a '?'
refs #8365
Change-Id: I5e5bb6499013b43a4fd3b2144dc9d8f9536ad174
Reviewed-on: https://gerrit.instructure.com/10411
Tested-by: Brian Palmer <brianp@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
All the code that works with question data is dependant on
the data being a HashWithIndifferentAccess. This commit
makes sure to use that in AQs and QQs, and made the
accessor to question_data set it to the expected hash
type so that old incorrectly serialized data doesn't have
to be updated.
Test Plan:
* Create some assessment questions that will run through translate_links
* When accesssing that data id should be an indifferent access hash
* When viewing those questions in the UI they should display correctly for students and teachers
* Manually set question data as a hash on a AQ or QQ, when you access it through the AQ/QQ it should be a HWIA
closes#6897
Change-Id: I526ab886aad2f96a3741330059439b100b6a1011
Reviewed-on: https://gerrit.instructure.com/8623
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Zach Wily <zach@instructure.com>
sometimes urls to files/images have relative urls instead of
the id of a file. Those should also be attempted to be
translated.
Test Plan:
* Make an assessment question with both types of urls
* run translate links on that question
* The urls should be happy when done
refs #6951
Change-Id: I9d4a526357871ac8ea7e1018df6c39f0dda95060
Reviewed-on: https://gerrit.instructure.com/8196
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
The translating of attachment links caused non string/array/hash
types to become nil in the question_data hash
Test Plan:
* Create a question in a question bank
* Edit the points possible
* reload the page, the points possible should be what you set them to
closes#6718
Change-Id: Ib4eaecff3a8540ffe1349603ce9236960f762461
Reviewed-on: https://gerrit.instructure.com/7761
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
Previously, assessment questions created via imports did not get their links
translated, since they are created with straight SQL. For now we will detect
when a question possibly has a link inside, and if it does, load the AQ model
and run translate_links on it.
This also includes a fix to translate_links to find them inside arrays too
(like in the answers array).
testplan:
* import a QTI package with images in the questions and answer feedback
* verify that the new questions in your question banks have links pointing to
/assessment_questions/ and not /courses/ for the images
* the existing translate_links specs cover the translate_links refactor
Change-Id: Idf36e65ef6a9887369feb1b2cdcbb2db1f2f70f3
Reviewed-on: https://gerrit.instructure.com/7136
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
imported matching answers were missing the required 'left' field
import the package attached to the ticket to test
closes#6146
Change-Id: I97e4af7070cb2068e677af91d3f23cde8e077987
Reviewed-on: https://gerrit.instructure.com/6615
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
Moved the translate_links call back to an after_save, and fixed some of the
logic.
Change-Id: I46f7f4618f3e8bf5019bb2cac2501ec82dc04af1
Reviewed-on: https://gerrit.instructure.com/6372
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
Assessment questions can be shared among multiple contexts, so we need to make
the Canvas links used inside authorized to anyone with the link.
Change-Id: I0df4907405fd518ee0efebccf1b9fb8717dca141
Reviewed-on: https://gerrit.instructure.com/6341
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
phased out AssessmentQuestion#context, did some ground work for #5026
and #5027
Change-Id: Ice4567a0f069dd49da8ce57bf0c8325b0b062115
Reviewed-on: https://gerrit.instructure.com/5303
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Reviewed-by: Brian Whitmer <brian@instructure.com>
This was already a small issue if the job queue was on a different
database driver than the main database, and it'll become more important
as more AR connections are introduced.
Change-Id: I204becadd32bb935df096e8c937a04bb6962f0b2
Reviewed-on: https://gerrit.instructure.com/4601
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
Basically, don't call a bazillion procs everytime you check_policy;
just the "given" statement. Everything else is evaluated just once,
and cached on the class. This does lose functionality (the ability
to access the instance inside of set_policy, and set methods), but
none of it was currently in use.
Change-Id: I736879d98beb4115a2e8c492931c755076291d08
Reviewed-on: https://gerrit.instructure.com/4665
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: JT Olds <jt@instructure.com>
Before if any single item had an error the whole import
errored out. This lets items fail and the rest continue to
import. The single item failures are logged as warnings in
the ContentMigration and this allows the user to know what
failed.
All the warnings/failures are also shown on the migration
list page to help admins diagnose problems.
refs #4903
Change-Id: I66b81ce1c243258dfc8c1d7d1381b2ea8daa3e72
Reviewed-on: https://gerrit.instructure.com/4268
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
Quiz statistics weren't supported for all question
types. Also added a csv export of the raw quiz
results data, with an attempt to make the data
meaningful even for complex question types.
fixes#4134
Change-Id: I55d1a21eed1cd6813fe0500190a1c0cc5fc038ab
Reviewed-on: https://gerrit.instructure.com/2850
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
proactively found and fixed varchar(255)'s where we relied on mysql's
silent truncation. added validations for places where we want to
enforce these limits
made it so you can reuse titles/urls of deleted wiki pages, and added
validations to ensure sane urls and prevent orphaned pages
Change-Id: I15bcc0c7a751efba1a0f7548e9989ad2ea1792bf
Reviewed-on: https://gerrit.instructure.com/2935
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
sometimes the formulas were getting jumbled
when they were saved to the server, because the
values are taken from an unordered hash
Change-Id: I6089fe0fa82e5e96b480c22e2329e5d2f28c3313
Reviewed-on: https://gerrit.instructure.com/2700
Reviewed-by: Zach Wily <zach@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
Since plaintext fields are stored raw in the database, a lot of the previous
escaping/unescaping behavior in quizzes has changed.
Change-Id: I299fa7979a30b1efa8944c6df7150b82980c47c5
Reviewed-on: https://gerrit.instructure.com/2403
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>