Commit Graph

31 Commits

Author SHA1 Message Date
Bracken Mosbacker 38ab6c39ce correctly prepare quiz questions when copying course
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>
2012-05-08 09:10:41 -06:00
Bracken Mosbacker 649e9a2495 properley handle query string params on translate links
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>
2012-04-30 14:29:04 -06:00
Bracken Mosbacker f803aa65dc make question data always a HashWithIndifferentAccess
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>
2012-02-09 16:29:54 -07:00
Bracken Mosbacker 355dbf97d9 find relative pathed files when translating links on assessment questions
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>
2012-01-31 12:13:07 -07:00
Bracken Mosbacker 2478f305a8 don't strip numeric (and other) types when saving questions
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>
2011-12-29 21:32:50 -07:00
Zach Wily a74962833c translate links on imported assessment questions
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>
2011-11-29 13:07:23 -07:00
Zach Wily 5f3a79011d log the id of the assessment question when link translation fails
Change-Id: I2b0e41de7e2c9da14cbef7aa7b01e015efc69d43
Reviewed-on: https://gerrit.instructure.com/6850
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2011-11-10 11:57:36 -07:00
Bracken Mosbacker f15c5cc9c1 make sure matching questions are formatted correctly when imported
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>
2011-11-03 09:17:36 -06:00
Zach Wily 052283dbfa fix assessment question link translation; refs #6012
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>
2011-10-21 15:12:57 -06:00
Zach Wily a4e55af920 make sure links in assessment questions are correctly translated, fixes #6012
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>
2011-10-21 08:36:34 -06:00
Jon Jensen b2b21a794b account-level question banks, closes #5025
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>
2011-08-29 16:24:49 -06:00
Brian Palmer dbe0d239e9 add html/image support to quiz question/answer feedback
closes #5284

Change-Id: I51aad86e8b389ab1f3d6b700ebcef968803f0b10
Reviewed-on: https://gerrit.instructure.com/5097
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
2011-08-24 10:09:22 -06:00
Brian Palmer 92feb2bcdb replace ActiveRecord::Base calls with subclass calls where it makes sense
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>
2011-07-18 13:56:08 -06:00
Cody Cutrer 7f5cc0693b optimize AdheresToPolicy
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>
2011-07-14 13:25:28 -06:00
Bracken Mosbacker a03dd41895 don't allow single item failures to stop a whole import
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>
2011-06-17 12:21:59 -06:00
Cody Cutrer 6ea73305f7 i18n AssessmentQuestionBank
Change-Id: Ib9daa923e91dcf44b3717bfd9e837f8917d61695
Reviewed-on: https://gerrit.instructure.com/4133
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: JT Olds <jt@instructure.com>
2011-06-10 10:07:01 -06:00
Cody Cutrer 625f475ff6 i18n AssessmentQuestion
Change-Id: I6a0a162fcca190bc620b95b3eda1790035cf29e2
Reviewed-on: https://gerrit.instructure.com/4131
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: JT Olds <jt@instructure.com>
2011-06-10 10:06:53 -06:00
Cody Cutrer b81a49021a i18n ApplicationController
Change-Id: I99cd8d56be94cfff1dc42eaca008712536ea53ec
Reviewed-on: https://gerrit.instructure.com/4130
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
2011-06-09 16:33:04 -06:00
Cody Cutrer 3404788721 only create one version per create/update of AssessmentQuestion
refs #4189

Change-Id: Ic96b542dfb441e8f1da85a6c784ccc8fbc33023c
Reviewed-on: https://gerrit.instructure.com/3949
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: JT Olds <jt@instructure.com>
2011-05-31 15:54:43 -06:00
Jon Jensen cdc2f43d27 sanitize question/answer html on import too, added specs
Change-Id: I6d733640f9e4c6c6dd985d70bafd620a9332cb57
Reviewed-on: https://gerrit.instructure.com/3377
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2011-05-02 09:41:13 -06:00
Bracken Mosbacker 31374465fe export/import question banks
refs #3396

Change-Id: I4199264bf07e145be2b3949bc4a56a37cda715b7
Reviewed-on: https://gerrit.instructure.com/3223
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Zach Wily <zach@instructure.com>
2011-04-25 07:29:12 -06:00
Bracken Mosbacker 6b46bf6c6d import canvas cartridge qti
refs #3396

Change-Id: If9d1732f01c9243dda25741cbed20a919631f19e
Reviewed-on: https://gerrit.instructure.com/3218
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Zach Wily <zach@instructure.com>
2011-04-23 10:49:06 -06:00
Jon Jensen 8c2d97f436 allow html answers for multiple-choice/multiple-answers, closes #4206
Change-Id: I49626c4d2f24ac73336dba006f01fdc83792eda2
Reviewed-on: https://gerrit.instructure.com/3155
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Reviewed-by: Brian Whitmer <brian@instructure.com>
2011-04-21 13:23:23 -06:00
Brian Palmer 6ba1e76a2d support question banks in respondus api, closes #4239
Change-Id: I468e0e1e57b862d01dee993da47686228800d159
Reviewed-on: https://gerrit.instructure.com/3113
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2011-04-15 15:19:10 -06:00
Brian Whitmer 34419410e6 quiz statistics revamp
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>
2011-04-05 17:06:35 -06:00
Jon Jensen c6b7a45ad8 string validations/fixes, closes #4154. wiki fixes, closes #3973, #4168
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>
2011-04-05 11:22:50 -06:00
Brian Whitmer f6d1ff52a8 keep equation question formulas in the right order
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>
2011-03-18 21:59:25 -06:00
Brian Whitmer 2a5976b20b don't let question names be blank
fixes #4027

Change-Id: Ic1d590daf29ed5972c689de5554c68cf5c7b43cd
Reviewed-on: https://gerrit.instructure.com/2624
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Zach Wily <zach@instructure.com>
2011-03-12 21:26:51 -07:00
Zach Wily 0858d4e337 fix escaping issues with quizzes
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>
2011-02-23 14:08:29 -07:00
Bracken Mosbacker d7e99aa39b properly handle an assessment with no questions on import
Change-Id: I14b1f4075e564e7553e29486d6ad0820e49039f9
Reviewed-on: https://gerrit.instructure.com/2294
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: JT Olds <jt@instructure.com>
2011-02-15 11:06:57 -07:00
Brian Whitmer 8b8173dcc9 Initial commit.
closes #6988138
2011-01-31 18:57:29 -07:00