clean up question import SQL parameter binding

test plan:
 - import the evil_angel.zip Angel package into Canvas
 - you should not have a migration issue referring to
   a SQL syntax error encountered when importing a
   quiz question
 - test quiz and question bank imports and re-imports

fixes CNVS-12899
fixes CNVS-12901

Change-Id: I26dcf5ffd4c6b6320232a7603ae2688f7c860fac
Reviewed-on: https://gerrit.instructure.com/34434
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Nathan Rogowski <nathan@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
allow configuring DJ's last ditch log file

fixes CNVS-12704

test plan:
 * script/delayed_job run should output to stdout as expected
 * script/delayed_job start should log rails startup to
   log/delayed_job.log
 * change config/delayed_jobs.yml to add
   last_ditch_logfile: log/dj.log under the 'development'
   or 'default' key (whichever you have)
 * restart jobs. rails startup should log to log/dj.log
 * change last_ditch_logfile to '| cat - > log/djcat.log'
   (with the quotes)
 * restart jobs. rails startup should log to log/djcat.log

Change-Id: I3b2e24605bc0e01aa6e5392be2b9a1ea6d88a331
Reviewed-on: https://gerrit.instructure.com/34260
Reviewed-by: Brian Palmer <brianp@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
csv downloads working with new gb urls

refs CNVS-11966

test plan:
  -with srgb ff on
    - download a csv from srgb
    - download a csv from gb2
    - upload a gradebook csv
  -with srgb ff off
    - download a csv from gb2
    - download a csv from gb1
    - upload a gradebook csv

Change-Id: Ib63c65adbdb650852f3541e8045b103dd5fb7a21
Reviewed-on: https://gerrit.instructure.com/34100
Reviewed-by: Cameron Sutter <csutter@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Tyler Pickett <tpickett+gerrit@instructure.com>
QA-Review: Anna Koalenz <akoalenz@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
avoid conflicts in otp used redis key

refs CNVS-1505

Change-Id: Iee6e1b0101616fe4e9daeba8f3c72b031ba04244
Reviewed-on: https://gerrit.instructure.com/34483
Reviewed-by: Rob Orton <rob@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
fix multiple due dates from overlaping in modules

fixes CNVS-12637

When you go to the modulese page if you had multiple due dates it would
overflow into the pts column. This no longer does this.

Test Plan
---------
As a teacher
Given I have multiple sections set up in a course
And I've added an assignment to the modules page
And that assignment has multiple due dates on it
And that assignment has points on it
When I go to the modules page
I should the module item with multiple due dates text
And it should not be overlaping the points column

Change-Id: I77557f10eb83a1acca4aa21ad4b9d7ab1de2004d
Reviewed-on: https://gerrit.instructure.com/34387
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Clare Strong <clare@instructure.com>
Product-Review: Hilary Scharton <hilary@instructure.com>
ignore bogus last_logged_out timestamps

fixes CNVS-7297

test plan:
 * set your clock in the future
 * log in then log out
 * fix your clock
 * log in - it should not kick you out

Change-Id: Ie6b9749b921dd8c20f6b1e6be6b5abee977d52b4
Reviewed-on: https://gerrit.instructure.com/34489
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
protect against race conditions creating course account associations

fixes CNVS-7108

Change-Id: I68a4cdc105300f274f84ee61b2e195ba94f92284
Reviewed-on: https://gerrit.instructure.com/34507
Reviewed-by: Rob Orton <rob@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
fix bad account_authorization_configs query

fixes CNVS-9788

test plan
 - pass params[:account_authorization_config_id]=
   invalid id
 - you should get record not found error instead of 
   database error

Change-Id: Id885c5f783ddd4138a78148bc64d2fcd1cd35ffa
Reviewed-on: https://gerrit.instructure.com/34495
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
QA-Review: Rob Orton <rob@instructure.com>
validate length of user_notes.title

fixes CNVS-7111

test plan
 - UserNote title should not
   throw database error when over 255 characters

Change-Id: I18366c1ec5a9e2434d2c6cc6638ea74803e05970
Reviewed-on: https://gerrit.instructure.com/34494
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
QA-Review: Rob Orton <rob@instructure.com>
better section length checking

fixes CNVS-12786

test plan:
 - regression on assignment edit page due dates

Change-Id: Ib8391e776e69794c4c828a073df1c137cea082cd
Reviewed-on: https://gerrit.instructure.com/34119
Reviewed-by: Liz Abinante <labinante@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
QA-Review: Anna Koalenz <akoalenz@instructure.com>
validate length of eportfolio_entries.name and slug

fixes CNVS-1006

test plan
 - eportfolio_entries name and slug should not
   throw database error when over 255 characters

Change-Id: I393cb04f6f4bf7516262cc5996c27fdf330e5d32
Reviewed-on: https://gerrit.instructure.com/34496
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
QA-Review: Rob Orton <rob@instructure.com>
treat "//url" as an absolute url in imported html converter

test plan:
* import that package reference in the ticket
* should not have 1000+ missing link warnings

fixes #CNVS-12911

Change-Id: Icea97472635a93b22bac0c3f571496ffe2bcf458
Reviewed-on: https://gerrit.instructure.com/34465
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Clare Strong <clare@instructure.com>
make ic-publish-icon component work for publish buttons as well

this component will now work for both 'icon' and 'button' style publish buttons.
pass tagName='span' to create an icon, and tagName='button' to create the
button.

fixes CNVS-12434

test plan:
  - enable fabulous quizzes

  - on the quizzes#index page
    - check that the publish icon has no regressions
    - check that you can publish and unpublish quizzes
    - check that quizzes with submissions cannot be unpublished

  - on the quizzes#show page
    - the publish button here should behave just like the non-fabulous publish
      button.
    - check that you can publish and unpublish quizzes
    - check that quizzes with submissions cannot be unpublished

Change-Id: I9c4e1341c487f70d8730b95ffa179368e9e3af4b
Reviewed-on: https://gerrit.instructure.com/34355
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jason Madsen <jmadsen@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Product-Review: Derek DeVries <ddevries@instructure.com>
switch to using the karma binary in node_modules/.bin

fixes CNVS-12918

Change-Id: If1abbcdb84d26a1a30d60030bcf490bb35f2a9ec
Reviewed-on: https://gerrit.instructure.com/34493
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Ryan Florence <ryanf@instructure.com>
Product-Review: Ryan Florence <ryanf@instructure.com>
QA-Review: Ryan Florence <ryanf@instructure.com>
fix invalid context_tags.context_module_id queries

fixes CNVS-5186

Change-Id: I6e67f413a3b511b5f64aa293e1ab03459dc1cd37
Reviewed-on: https://gerrit.instructure.com/34517
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
QA-Review: Rob Orton <rob@instructure.com>
Align TurnItIn pledge text with checkbox

Also, remove the inline styles.

fixes CNVS-6754

Test Plan:
- As an account admin, enable turnitin and add pledge text
- Create an assignment with turnitin enabled
- As an enrolled student, navigate to the assignment submission form

The pledge checkbox and text should be well aligned

Change-Id: Ia8b9652b93008686981db85ab6db842343092dcf
Reviewed-on: https://gerrit.instructure.com/34274
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
add indexes supporting a foreign key

closes CNVS-12783

Change-Id: Ibbd9709aef83ae69c55bb0c2221530c55808612c
Reviewed-on: https://gerrit.instructure.com/34500
Reviewed-by: Rob Orton <rob@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
move access tokens on user merge

fixes CNVS-12919

test plan
 - have an access token on user1
 - merge user1 into user2
 - access token should now belong to user2

Change-Id: Ied578d6c921585f15eb3575704f9bb6c5a801266
Reviewed-on: https://gerrit.instructure.com/34514
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
QA-Review: Nathan Rogowski <nathan@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
Make optional fields optional in Discussion Topic

fixes SIS-233

Change-Id: I0df8341113825df5acefdc68eedea8a4543d38aa
Reviewed-on: https://gerrit.instructure.com/33627
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Reviewed-by: Duane Johnson <duane@instructure.com>
Product-Review: Duane Johnson <duane@instructure.com>
Ember Quiz Stats - Multiple-Choice and T/F

Question statistics for multiple-choice and true/false questions.

Closes CNVS-12173

TEST PLAN
---- ----

  - create a quiz with a bunch of multiple-choice and true/false
    questions
  - take the quiz by at least 5 students, make different combinations of
    answer selections, and make sure you skip some questions by at least
    one student
  - go to the statistics page and:
    - "Attempts: X out of Y" should display the number of responses that
      question received

Block by block:

  A. the correct answer distribution block:
    - should display a donut chart that visualizes the number of
      responses that were correct for this question
    - should show the percentage in both the donut chart and the little
      explanation beside it, like 33% or 67%, etc.

  B. the answer distribution column chart:
    - each answer defined in the question should be represented by a
      single column
    - the column should be as high as the number of responses the answer
      received
    - the column should be colored green if it represents the correct
      answer, blue otherwise
    - answers with 0 responses should still be visible / hoverable (1
      pixel high)
    - when you hover over a column, it should show a tooltip containing
      the response ratio as well as the answer text
    - the special "No Answer" should have its own bar if any student has
      not specified an answer
      - that bar should be striped

  C. the discrimination index block:
    - should show the point biserial value:
      - red if it is less than or equal to 0.25
      - green otherwise
    - should show a chart that meets the criteria specified in the
      relevant tickets

  D. the answer-drilldown/question-details section:
    - should list every answer
    - the single answer block should be prefixed by a little bubble that
      shows the ratio of responses for that answer
    - that same bubble should be green for the correct answer, blue
      otherwise
    - the answer block should contain the answer text

  E. toggling of question details:
    - clicking the detail-toggle button should expand and collapse the
      answer drilldown section
    - clicking the toggle button in the "Question Statistics" header
      should expand/collapse ALL questions

  F. sorting questions:
    - choosing to sort by discrimination index should sort them
      descendingly
    - choosing to sort by position should mimic the order of creation of
      questions

Change-Id: I784ce21e4f446144f64137295c1fb0923dc321de
Reviewed-on: https://gerrit.instructure.com/32734
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Reviewed-by: Jason Madsen <jmadsen@instructure.com>
Product-Review: Ahmad Amireh <ahmad@instructure.com>