Ember Quiz Stats - Essay Questions

Essay stats include a donut chart of the ratio of students who received
full-credit, as well as an area graph showing the score distribution.

Also, the serializer now prepares the data in a way for ED to properly
populate the questionStatistics association with quizStatistics, so we
got rid of the hack in the route's #afterModel hook, and exterminated
the bug that caused the question stats not to be updated when the quiz
changes (e.g, via the URL).

Closes CNVS-12466, CNVS-13009, CNVS-13021

TEST PLAN
---- ----

  - create a quiz with essay questions
  - take the quiz by a number of students
  - before grading, take a look at the stats page, make sure nothing
    funny happens
  - grade the responses with different scores
  - revisit the page, make sure the graphs are rendered appropriately
  - clicking the View in SpeedGrader link should open a new tab with the
    SpeedGrader for the quiz
  - hover over the circles and verify that you get tooltips similar to
    those for MChoice and T/F questions
  - verify that sorting by DI/Position is again functioning correctly

Change-Id: I3ab6818d86632720c6da2c37b2126b4abe63cefa
Reviewed-on: https://gerrit.instructure.com/33991
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Reviewed-by: Jason Madsen <jmadsen@instructure.com>
Product-Review: Derek DeVries <ddevries@instructure.com>
include hostname and pid in error reports

to make it easier to go from error reports to logs

Change-Id: I38015db9dd616460f84d9792db6c2bbbfbbde330
Reviewed-on: https://gerrit.instructure.com/34965
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
remove params[:id] from ProfileController#communication

because it is an information leak and I can't imagine any
legitimate purpose for it

fixes CNVS-13057

test plan:
- you should not be able to retrieve other users' notification
  preferences by appending ?id=X to /profile/communication

Change-Id: I744792020d88ce15071a6332571ca1e3289885ed
Reviewed-on: https://gerrit.instructure.com/34939
Reviewed-by: Ethan Vizitei <evizitei@instructure.com>
Product-Review: Ethan Vizitei <evizitei@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Clare Strong <clare@instructure.com>
discussion rubrics show points when used for grading

fixes CNVS-5378

test plan:
  - make a graded discussion
  - go to its show page
  - click add rubric in settings
  - use the rubric for grading
  - with the same # of points as the assignment
    - no warning should pop up
  - with a different number of point
    - a warning should pop up
    - the point value should be accurate
    - this should work multiple times without reloading
      the page
  - assignments rubrics work as usual

Change-Id: Iee12859b73a118b5339573ae26de9c589d41feb4
Reviewed-on: https://gerrit.instructure.com/33932
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Product-Review: Matt Fairbourn <mfairbourn@instructure.com>
assigments page keyboard menu working

fixes CNVS-12426

test plan:
  - with draft state on go to assignments page
  - hit ","
  - the shortcuts menu should pop open

Change-Id: I69b0e477fb638e1127cdef188c0bbcfcb6648ecb
Reviewed-on: https://gerrit.instructure.com/34824
Reviewed-by: Tyler Pickett <tpickett+gerrit@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Steven Shepherd <sshepherd@instructure.com>
Product-Review: Matt Fairbourn <mfairbourn@instructure.com>
correctly show completion icons on peer review listings

Because of concerns with a potential race condition on using just the 
incomplete peer review count we've also added the total count of
assigned reviews to the cache key. These two additions still allow us
to take advantage of caching yielding a 90% performance improvement 
against a hot cache locally. These numbers may not translate perfectly
to production given that this page may have frequent cache misses. This
is something we should probably take a look at in the logs once this is
in beta/production.

fixes CNVS-7523

Test Plan:
- As an instructor build a class with at least 2 students
- Add an assignment to the class with peer review enabled
- Assign peer reviewers manually
  - These should start marked as incomplete with a yellow icon
- As the first student navigate to the assignment and submit it
- As the second student navigate to the assignment
  - In the sidebar this student should see that they have an incomplete
    review, indicated by the yellow icon
- Complete the review and view the assignment again
  - The review should indicate that it is complete with a green
    checkmark
- As the teacher view the peer assessments page
  - The review you previously completed should show as completed using
    the same green checkmark.

Change-Id: I8b71fd8f25c71b8031ab74b57d280c98add2c14e
Reviewed-on: https://gerrit.instructure.com/34420
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Mike Nomitch <mnomitch@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Steven Shepherd <sshepherd@instructure.com>
Product-Review: Matt Fairbourn <mfairbourn@instructure.com>
send delayed jobs stats to statsd

closes CNVS-12739

log timing for pops, time spent in queue, time to perform job,
sliced by tag (where applicable), shard, and job shard.

test plan:
 * configure statsd.yml to go to 127.0.0.1 port 7856
 * nc -lu 127.0.0.1 7856
 * run jobs
 * you should see lots of job timings sent to netcat

Change-Id: I60a4b6b10d30edd96011e8e8bc8aa6104dfc6daa
Reviewed-on: https://gerrit.instructure.com/34724
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
improve sis user importer spec

 * use timecop instead of sleeps
 * use stubs instead of manually adding and deleting callbacks to the class

Change-Id: I72f859f9a387cec88a77edfdf2b4b926852945dc
Reviewed-on: https://gerrit.instructure.com/34963
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
fix issue with flash message close button not working

the preventDefault function expects a function to be passed in to work correctly

fixes CNVS-12893

test plan:
  - as a teacher
    - create a quiz
    - turn on fabulous quizzes
    - view a quiz
    - click the menu and 'show student quiz results'
    - the flash message should appear
    - click on the x icon on the message
    - the message should close, and you should remain on the same page

  - try other variations that bring up this type of message at the top
  - clicking the close on them should work as well

Change-Id: Ia7e13e01c031d09b08ef6f6bdff9c0cf6f375396
Reviewed-on: https://gerrit.instructure.com/34999
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Josh Simpson <jsimpson@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Product-Review: Derek DeVries <ddevries@instructure.com>
Upgrade MediaElementJS to 2.14.12

This commit just updates the vendor mediaElementJS code
so that we can see clearly what changed from upgrading
and what our changes are (yes, sadly we have to make
modifications to mediaelement-and-player.js's source)

so don't focus on QAing this in isolation. the actual changes
come in the commit after this.

refs: #CNVS-12293

Change-Id: I71f18f8dc8f30acd5cbb0730b1a97065e2aed2e3
Reviewed-on: https://gerrit.instructure.com/34015
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Clare Strong <clare@instructure.com>
Product-Review: Clare Strong <clare@instructure.com>
Reviewed-by: Paul Hinze <paulh@instructure.com>
Don't try to link to mp3 flavors from kaltura

refs: CNVS-12293
refs: CNVS-12998

This commit needs to go out with changeid:
I5b77f58133fb9081909771d50bb8f0a91db23d63
because it fixes audio playback in firefox.

it is it's own commit so that if we fix our mp3s
being served from kaltura (this ticket: CNVS-12998)
, we can just revert this one commit.

long story:
all our browsers except firefox will allow
<audio><source type="video/mp4" src="blah.mp4"></audio>
...and play back the audio inside the mp4 container

but firefox won't, so it was falling back to the
last of the options returned by /media_objects/<id>/info;
an 'audio/mp3' url. but the thing that url points to
right now in production
(e.g.: http://www.instructuremedia.com/p/100/sp/10000/download/entry_id/0_4b4pgy5p/flavor/0_092j8kek/ks/NWRiYzk5Njk2MTRjZTlhYWEwODBkYjVlOWQ2MTc2MzZmMGNhMDc0MHwxMDA7MTAwOzEzOTk2NzM4NjI7MDsxMzk5NTg3NDYyLjkwNzg7O2Rvd25sb2FkOjBfNGI0cGd5NXA7)
just returns text/html that says:
"This URL is expired"

Change-Id: Ie9bc2551b839247042fc7f3261f82845331e04fc
Reviewed-on: https://gerrit.instructure.com/34748
Reviewed-by: Sterling Cobb <sterling@instructure.com>
QA-Review: Clare Strong <clare@instructure.com>
Product-Review: Ryan Shaw <ryan@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Paul Hinze <paulh@instructure.com>
user merge supports versions

closes CNVS-12967

test plan (backend):
- create some submissions, quiz submissions, rubric assessments, and wiki pages
  as a user
- merge that user into another user
- the version objects associated with those objects should have an updated user
  id

test plan (user facing):
- upload multiple submissions to a file assignment
- merge the student with another student
- as a teacher, go to the students submission in SpeedGrader
- attempt to download the submission, it should work

Change-Id: I96caf214e5bb43eeb8251470c71f708125cfdf41
Reviewed-on: https://gerrit.instructure.com/34887
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Clare Strong <clare@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
support adding custom meta tags

refs CNVS-12627

test plan:
- load any page, it should render

Change-Id: I66bca1e87296edfd841992d2262b9d73dd263747
Reviewed-on: https://gerrit.instructure.com/34466
Reviewed-by: Tyler Pickett <tpickett+gerrit@instructure.com>
Reviewed-by: Cameron Sutter <csutter@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
Updated pl translation
Updated pt translation
retain user avatar information on user merge (if none exists)

test plan:
* enable avatars
* set an avatar for a user
* merge the user into another one without an avatar
* the new user should have the old avatar

* merge a user with an avatar into another
 one with an avatar
* confirm that it does not overwrite the original

fixes #CNVS-13079

Change-Id: Ic45a42c19f82c57a3524a19bc3ca43a253689f50
Reviewed-on: https://gerrit.instructure.com/34993
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Clare Strong <clare@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
upgrade debugger gem to work with 1.9.3p545

Change-Id: I0d49d7af9a6a688e6ef04c1ee6ed1e9a86102ff3
Reviewed-on: https://gerrit.instructure.com/34808
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
user merge supports versions

closes CNVS-12967

test plan (backend):
- create some submissions, quiz submissions, rubric assessments, and wiki pages
  as a user
- merge that user into another user
- the version objects associated with those objects should have an updated user
  id

test plan (user facing):
- upload multiple submissions to a file assignment
- merge the student with another student
- as a teacher, go to the students submission in SpeedGrader
- attempt to download the submission, it should work

Change-Id: I96caf214e5bb43eeb8251470c71f708125cfdf41
Reviewed-on: https://gerrit.instructure.com/34887
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Clare Strong <clare@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
Updated pl translation
Updated pt translation