Commit Graph

303 Commits

Author SHA1 Message Date
Cody Cutrer 56ccea56d4 use preload/eager_load instead of includes
refs CNVS-21901

Change-Id: Ie9e1b2778b72f649392d8a1c47c0c86dae0ef19c
Reviewed-on: https://gerrit.instructure.com/58660
Reviewed-by: Rob Orton <rob@instructure.com>
Tested-by: Jenkins
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2015-09-08 20:32:05 +00:00
John Corrigan 2aaf91a4e1 use Quizzes::ScopedToUser in CC::QTI::QTIGenerator#generate
fixes CNVS-21395

The content export tool is being updated so that it consders the
provided user's rights, so that the CC export can be used for the new
epub generation tool.

This PS employs Quizzes::ScopedToUser to make sure that the user
only gets the quizzes that they have the right to view.

test plan:
- Regression test for content export tool quizzes functionality.

Change-Id: I68d952c794afac35e6fa2fa472538159f275c16b
Reviewed-on: https://gerrit.instructure.com/59498
Reviewed-by: Brian Finney <bfinney@instructure.com>
Tested-by: Jenkins
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: John Corrigan <jcorrigan@instructure.com>
2015-09-04 19:27:47 +00:00
Ryan Taylor 7ac94ed01f Prevents time_limits from being overwritten by section end_at
Closes CNVS-22928

Test Plan:
  - Confirm that time limits are more important than section end_at
    dates on quizzes when the 'section dates apply' box is checked.

Change-Id: I0c5664df8eacea3fecec01e7a5b839506c83d573
Reviewed-on: https://gerrit.instructure.com/62438
Tested-by: Jenkins
Reviewed-by: Cameron Sutter <csutter@instructure.com>
Product-Review: Derek Hansen <dhansen@instructure.com>
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
2015-09-03 16:54:27 +00:00
Strand McCutchen e369ac25e1 create QuizSubmissions#late?
fixes CNVS-9378

Test Plan:

1. Create a quiz with a due date and allow multiple
    attempts.
2. As a student take the quiz before the due date.
3. Check speedgrader and notice its not marked late.
4. After the due date as the student, take the quiz again.
5. Confirm in speedgrader that the last submission is late.
5. Confirm in speedgrader that the first submission is not
    late.

Change-Id: I0baf933103fad33dce5650842540486bf1e3112e
Reviewed-on: https://gerrit.instructure.com/61897
Reviewed-by: Keith T. Garner <kgarner@instructure.com>
Tested-by: Jenkins
QA-Review: Amber Taniuchi <amber@instructure.com>
Product-Review: Josh Simpson <jsimpson@instructure.com>
2015-09-01 17:00:58 +00:00
Simon Williams a1c796d4fa only render quiz restriction checks when trying to take the quiz
fixes CNVS-22655
fixes CNVS-22833

the can_take_quiz? method renders an access_code restriction template or
an ip restriction template if those things are required for the quiz.
previously, those were presented when trying to take the quiz, but
a recent change made it so that they were presented when simply trying
to view the quiz.  this reverts to the previous behavior.

test plan:
- as a teacher, create an access code or ip restricted quiz, publish it
- as a student, you should be able to view the quiz without being
  prompted for an access code (or from an invalid ip)
- as a student, when trying to take the quiz, the restrictions should
  apply correctly
- as a student who meets the restrictions, you should be able to take
  the quiz

Change-Id: Iedc78c3728501da56710e00857527a7323633eeb
Reviewed-on: https://gerrit.instructure.com/62089
Reviewed-by: Rob Orton <rob@instructure.com>
QA-Review: Adam Stone <astone@instructure.com>
QA-Review: Pedro Fajardo <pfajardo@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
Tested-by: Rob Orton <rob@instructure.com>
2015-08-30 00:02:35 +00:00
Ryan Taylor 768059aa0a Handles section end_at extensions in Quizzes
Closes CNVS-21521

Test Plan:
  - Regression test that due_dates, closing "end_at" dates and all
    things quiz time limits/moderation are all good.
    - Good luck!

Change-Id: Id5ad6c0028e06e67caea28fce514190730a02e44
Reviewed-on: https://gerrit.instructure.com/59020
Tested-by: Jenkins
Reviewed-by: Cameron Sutter <csutter@instructure.com>
Product-Review: Pedro Fajardo <pfajardo@instructure.com>
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
2015-08-26 14:50:14 +00:00
Coraline Ehmke 3509cf9c7f Fixes placeholder in essay question quiz grading
Fixes CNVS-8632

Test plan:
- Publish a quiz with an essay question
- Take the quiz
- Grade the quiz
- When no value is entered ('--' still present) the question should
  still be considered needing review
- The '--' in the points field for the essay question should disappear
  if a value is entered.

Change-Id: I6a6b0c15738c067f83722576cd3690e993c57e5d
Reviewed-on: https://gerrit.instructure.com/55917
Tested-by: Jenkins
Reviewed-by: John Corrigan <jcorrigan@instructure.com>
QA-Review: Jason Carter <jcarter@instructure.com>
Product-Review: Ryan Taylor <rtaylor@instructure.com>
2015-08-24 22:30:32 +00:00
Coraline Ehmke e1b612bd20 Consider section end date in quiz eligibility.
Refs CNVS-18768
Fixes CNVS-21514
Fixes CNVS-22172

test plan:
- Set course dates to the past and check the "Users can only
  participate during section dates"
- Set section dates to the present and check the "Users can only
  participate during section dates"
- Assign a quiz to that section
- Take Quiz button should not appear

- Confirm that no quiz taking timing regressions have introduced
  themselves.

  Hierarchy of dates:
  - term dates > course dates
  - course > term if course dates are restricted ("Users can only
    participate...")
  - section > term > course if only section dates are restricted
  - section > course > term if both section and course dates are
    restricted
  - Quiz time limits are always applied unless end_at times (section ||
    term || course) are shorter.
  - Moderation events are properly applied always..

- Create quiz, do not publish it
- View quiz list
- Attempt to view quiz as a teacher
- Attempt to preview quiz as a teacher

Change-Id: I33280c0b188ba9308858837dbea8a7e11f71e0b4
Reviewed-on: https://gerrit.instructure.com/57604
Tested-by: Jenkins
Reviewed-by: Matt Berns <mberns@instructure.com>
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: Jason Sparks <jsparks@instructure.com>
2015-08-10 21:20:20 +00:00
Ryan Taylor cd36ed7bc6 Fixing outcome scoring for quizzes
Only quiz questions were being scored.  This commit adds
LearningOutcomeResults for a quiz which determines mastery by
performance on the entire selection of questions.

This also records LearningOutcomeQuestionResults for each quiz
question outcome result.

Closes CNVS-13282

Test-Plan:
- Build out several question banks tied to learning outcomes
- Confirm nothing is broken.
- Confirm that outcomes are scored correctly

Change-Id: If2dd2c5f387071cec3c5634bcb74fc3f78283c64
Reviewed-on: https://gerrit.instructure.com/45381
Tested-by: Jenkins
Reviewed-by: John Corrigan <jcorrigan@instructure.com>
QA-Review: Michael Hargiss <mhargiss@instructure.com>
Product-Review: Ryan Taylor <rtaylor@instructure.com>
2015-07-27 16:24:18 +00:00
James Williams 600165e7b2 rails4: deprecate Relation#all in favor of Relation#to_a
refs #CNVS-21596

Change-Id: I5dedaab90a2abe6bf288ff30401c9b31629b45b2
Reviewed-on: https://gerrit.instructure.com/59220
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2015-07-24 21:28:14 +00:00
John Corrigan 0ca544448a move permision-based scope concat'ing from quizzes api endpoint
fixes CNVS-21388

test plan:
- Regression testing for quizzes index API endpoint.

Change-Id: I2805ce6c7d4f180495e9697a140624bf8b3d1dab
Reviewed-on: https://gerrit.instructure.com/57580
Tested-by: Jenkins
Reviewed-by: Matt Berns <mberns@instructure.com>
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Reviewed-by: Ryan Taylor <rtaylor@instructure.com>
Product-Review: Nick Nelson <nick@instructure.com>
2015-07-23 14:03:33 +00:00
Brian Finney 4ef9b487f8 Let users determine if alpha statistic is valid
Show alpha statistic as long as we can compute it, it's up to the
teacher if the statistic is valid or useful. As such the new requirment
for alpha data is 2 or more questions and variance > 0, variance > 0
implies 2 or more submissions with different scores.

Fixes CNVS-20337

Test plan
 - test with 1 question
     alpha = N/A
 - test with 2 questions and 1 submission
     alpha = N/A
 - test with 2 questions and 2 submissions with same score
     alpha = N/A
 - test with 2 or more questions and 2 or more submissions with
 different scores
     alpha = a number

Change-Id: I8b1e91b24f75c9f0311863b8573a03b2b8b3d9dc
Reviewed-on: https://gerrit.instructure.com/56580
Reviewed-by: Ryan Taylor <rtaylor@instructure.com>
QA-Review: Michael Hargiss <mhargiss@instructure.com>
Product-Review: Jason Sparks <jsparks@instructure.com>
Tested-by: Jenkins
2015-07-18 00:47:09 +00:00
Ryan Taylor c17eb2b268 Fixes Quiz icon regression on updates
This makes the workflow_state changes immediately accessible to the
gradebook.

Closes CNVS-21930

Test Plan:
  - Take quiz with essay question
  - Alter quiz icon score in gradebook
  - Confirm grade change is immediate.

Change-Id: I5ac68ac6c82128b3eedfac0138d7562ab49fa58f
Reviewed-on: https://gerrit.instructure.com/58659
Reviewed-by: John Corrigan <jcorrigan@instructure.com>
Tested-by: Jenkins
Product-Review: Ryan Taylor <rtaylor@instructure.com>
QA-Review: Michael Hargiss <mhargiss@instructure.com>
QA-Review: Adam Stone <astone@instructure.com>
2015-07-17 00:42:29 +00:00
James Williams 85dac3b3fb preload "can_unpublish" values for modules
should improve performance when viewing as a course admin

test plan:
* modules index should work as before

refs #CNVS-21476 #CNVS-21317

Change-Id: I00ee7602a48bc78538e8034d562781059f6fabb8
Reviewed-on: https://gerrit.instructure.com/57276
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2015-07-15 22:08:06 +00:00
James Williams d99183bee1 rails4: fix quizzes model specs
refs #CNVS-21596

Change-Id: I4d19b4f142b443109f15e4c658495a459867159d
Reviewed-on: https://gerrit.instructure.com/58382
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2015-07-15 21:55:59 +00:00
James Williams 384c26013c rails4: fix invalid utf8 removal on old serialized attributes
refs #CNVS-21596

Change-Id: I7888abfd6b36a7b685b6d89859d64bc1af72725e
Reviewed-on: https://gerrit.instructure.com/58387
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2015-07-15 19:52:36 +00:00
Cameron Matheson 9b62995270 prevent students from taking excused quizzes
closes CNVS-21458
refs CNVS-21080

Test plan:
  * make a quiz
  * excuse it for a student
  * that student should not be able to take the quiz

Change-Id: I9b000fcbd2b59fbcd74a35642f66fe3f24234628
Reviewed-on: https://gerrit.instructure.com/57089
Tested-by: Jenkins
Reviewed-by: Ryan Taylor <rtaylor@instructure.com>
Reviewed-by: Josh Simpson <jsimpson@instructure.com>
QA-Review: Jason Carter <jcarter@instructure.com>
Product-Review: Cameron Matheson <cameron@instructure.com>
2015-07-14 19:56:49 +00:00
James Williams 611c6d78cf don't fulfill must_submit requirements on manual grade
test plan:
* create a course with a student
* create an assignment
* create a module and add the assignment
 as an item
* add a completion requirement to submit the
 assignment
* in the gradebook, mark a grade for the student
 in the assignment
* as the student, it should not show the requirement
 as completed

* it should still complete on assignment submission

* should still work with quiz assignments as well

closes #CNVS-21460

Change-Id: I8bbc306c067a3bed7da7a9fc0cd00d3e046b1293
Reviewed-on: https://gerrit.instructure.com/57183
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
Product-Review: Cosme Salazar <cosme@instructure.com>
2015-06-26 16:03:24 +00:00
Ryan Taylor c6e91b57e5 Revert quiz eligibility changes
This reverts commit 882a1891e0.
This reverts commit a29454866d.

Test Plan:
  - Make sure you can take quizzes with question types other than MC.

Change-Id: I37481728e387b08d5e6adb5bd03d4dec6082559b
Reviewed-on: https://gerrit.instructure.com/57234
Reviewed-by: Cameron Sutter <csutter@instructure.com>
Product-Review: Cameron Sutter <csutter@instructure.com>
QA-Review: Adam Stone <astone@instructure.com>
QA-Review: Derek Hansen <dhansen@instructure.com>
QA-Review: Michael Hargiss <mhargiss@instructure.com>
Tested-by: Ryan Taylor <rtaylor@instructure.com>
2015-06-26 15:08:33 +00:00
Ethan Vizitei e85ae442d2 pick sis pseudonym reliably
closes CNVS-15282

Previously for users that have multiple pseudonyms,
the "sis_pseudonym" might be selected differently depending
on whether the pseudonyms collection was already loaded or not
because no specific order clause was given.  This patchset
makes it so that all sis pseudonym selection strategies
order the data set the same way (by "unique id") so that
you can count on getting a deterministic result.

Also, user.rb is huge, so I took the opportunity to split out a
SisPsuedonym class.  There may be room to move more
functionality into it later liked deciding what pseudonym to
fall back to in cases where the current strategy finds
nothing, but this is a good first step.  I switched all the use
cases I could find of the old interface on user.rb, but left the
method in place for now in case other plugins or extensions make use of
it.  We can wait a while and let the deprecation warnings take effect
before removing it.

TEST PLAN:
 1) download a gradebook csv export for a course
 2) make sure the SIS Login ID is the same as the secondary
   ID for each user that you see in the gradebook view itself.

Change-Id: Ib18b40acbaf3a8f4352fd6ee8e0826897e3edf49
Reviewed-on: https://gerrit.instructure.com/57001
Tested-by: Jenkins
Reviewed-by: Rob Orton <rob@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
QA-Review: August Thornton <august@instructure.com>
2015-06-25 22:18:14 +00:00
Christina Wuest a29454866d Short-circuit eligibility checks for teachers
Fixes CNVS-21486

Test plan:
- Create quiz, do not publish it
- View quiz list
- Attempt to view quiz

Change-Id: I0912b5035debc2b484ece04692a8002217255cbf
Reviewed-on: https://gerrit.instructure.com/57163
Tested-by: Jenkins
Product-Review: Matt Fairbourn <mfairbourn@instructure.com>
QA-Review: Adam Stone <astone@instructure.com>
Reviewed-by: Cameron Sutter <csutter@instructure.com>
2015-06-25 18:32:36 +00:00
Coraline Ehmke 882a1891e0 Consider section end date in quiz eligibility.
Fixes CNVS-18768.

test plan:
- Set course dates to the past
- Set section dates to the present
- Assign a quiz to that section
- Take Quiz button should not appear

Change-Id: I64d966cde8ffe2e2a69434cad4cf154c730845ce
Reviewed-on: https://gerrit.instructure.com/54603
Tested-by: Jenkins
Reviewed-by: Ryan Taylor <rtaylor@instructure.com>
QA-Review: Adam Stone <astone@instructure.com>
Reviewed-by: Brian Finney <bfinney@instructure.com>
Product-Review: Matt Fairbourn <mfairbourn@instructure.com>
2015-06-24 18:55:36 +00:00
Michael Nomitch f9d7c51e0e quiz icon shows in GB and grading changes workflow_state
fixes CNVS-18086

test plan:
  - make a quiz with auto-graded and non-auto-graded
    questions
  - take it as a student
  - notice that in the GB there is an icon for
    this quiz
  - notice that on the student grades page there
    is an icon for this quiz with a tooltip explaining
    that there is grading to be done
    - this is the case as both the teacher and student
  - grade the quiz in the gradebook
    - the icon goes away in both places and fudge
      points are added to the quiz (check in speed
      grader)
  - repeat the setup above but grade it in speed grader
    instead
    - the icons also go away in this case

Change-Id: I51f497fe8b59b9785ef126eaac963a8f0a285891
Reviewed-on: https://gerrit.instructure.com/55803
Tested-by: Jenkins
Reviewed-by: Brian Finney <bfinney@instructure.com>
QA-Review: Michael Hargiss <mhargiss@instructure.com>
Product-Review: Jason Sparks <jsparks@instructure.com>
2015-06-22 15:05:53 +00:00
Ryan Taylor 8f59fa1dce Prevents funky errors when accessing quiz_data#compact
Closes CNVS-21228, GH-291, GH-512

Test Plan:
- Quizzes still work

Change-Id: I1b2131a8e0c8bd3e015597f0f756394217ee16b3
Reviewed-on: https://gerrit.instructure.com/56469
Tested-by: Jenkins
Reviewed-by: Brian Finney <bfinney@instructure.com>
QA-Review: Michael Hargiss <mhargiss@instructure.com>
Product-Review: Ryan Taylor <rtaylor@instructure.com>
2015-06-19 20:55:28 +00:00
Abhishek Singh aeed561106 Quiz submission creation event
Fixes CNVS-20996

Test Plan
 - Should create quiz submission creation event with
  quiz data and quiz version as event data
 - Should not create this event for quiz preview

Change-Id: Ie5d5b77338981ede4f0955fe0af2b80943167063
Reviewed-on: https://gerrit.instructure.com/56339
Reviewed-by: Ryan Taylor <rtaylor@instructure.com>
Tested-by: Jenkins
QA-Review: Michael Hargiss <mhargiss@instructure.com>
Product-Review: Ryan Taylor <rtaylor@instructure.com>
2015-06-16 19:53:17 +00:00
Cody Cutrer 936ef6e889 avoid unnecessary drop to raw SQL
Change-Id: I4cc28cdcb5be1c8abf420f3ca3d8e02b05ce0499
Reviewed-on: https://gerrit.instructure.com/56357
Tested-by: Jenkins
Reviewed-by: Ethan Vizitei <evizitei@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2015-06-15 16:11:41 +00:00
Cody Cutrer 8a19951591 remove deprecated method
Change-Id: I38a28e20b8f2cc3d4cc58837cc80a8d4e50e338a
Reviewed-on: https://gerrit.instructure.com/56173
Tested-by: Jenkins
Reviewed-by: Ethan Vizitei <evizitei@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2015-06-12 16:15:14 +00:00
Michael Nomitch cc4a9fb949 quiz question types works with groups
fixes CNVS-20948

test plan:
  - make a quiz with multiple questions
    and a quiz group with questions of
    different types in it
  - ping the API endpoint for this quiz
    "api/v1/courses/:id/quizzes/:id"
  - the question_types array contains
    the types from the quiz group
    and the types of the non-nested
    questions

Change-Id: I647499707fa024a19fac564688653db3c9f9e4c7
Reviewed-on: https://gerrit.instructure.com/55993
Reviewed-by: Ryan Taylor <rtaylor@instructure.com>
Tested-by: Jenkins
QA-Review: Michael Hargiss <mhargiss@instructure.com>
Product-Review: Ryan Taylor <rtaylor@instructure.com>
2015-06-12 05:36:06 +00:00
Cody Cutrer 004617a433 resolve ties in quiz statistics by moving them up a bucket
instead of undeterministically splitting the ties apart in different
buckets. this also fixes a fragile spec

Change-Id: Ia07c0bc7f1f1e56cc9d04d2d003d7012b499cb57
Reviewed-on: https://gerrit.instructure.com/56278
Reviewed-by: Jon Jensen <jon@instructure.com>
Tested-by: Jenkins
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2015-06-11 23:18:39 +00:00
Abhishek Singh e6d25a1b68 Removed delete dependency between quiz_submissions and quiz_submission events.
Fixes CNVS-20994

Test Plan
 - Deleting any quiz submission should not delete its events.

Change-Id: I1b8d80db8d62da753de3d7568495e7dac17b1ca9
Reviewed-on: https://gerrit.instructure.com/56018
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Brian Finney <bfinney@instructure.com>
QA-Review: Ryan Taylor <rtaylor@instructure.com>
Product-Review: Ryan Taylor <rtaylor@instructure.com>
2015-06-11 19:37:25 +00:00
Brian Finney 232e2dcb8d refactor overdue_and_needs_submission and needs_grading?
Change-Id: I2e8c424545b71be8136d04008433ff42eb96bc4d
Reviewed-on: https://gerrit.instructure.com/55831
Reviewed-by: Cameron Sutter <csutter@instructure.com>
Reviewed-by: Ryan Taylor <rtaylor@instructure.com>
Tested-by: Jenkins
QA-Review: Michael Hargiss <mhargiss@instructure.com>
Product-Review: Brian Finney <bfinney@instructure.com>
2015-06-09 00:22:27 +00:00
Michael Nomitch ea246c32d5 allow students to see answers after final attempt
fixes CNVS-19091

test plan:
  - make a quiz where correct answers are visible
    after a final attempt and give them two attempts
    - include some questions that require manual
      grading and some that do not
  - as a student submit two attempts
  - note that you do NOT get an error saying
    'Answers will be shown after your last attempt'
    once you have submitted your second attempt

Change-Id: I4ed1c7c775ef730afb963ed1d15f844e2244602f
Reviewed-on: https://gerrit.instructure.com/55480
Tested-by: Jenkins
Reviewed-by: Brian Finney <bfinney@instructure.com>
QA-Review: Michael Hargiss <mhargiss@instructure.com>
Product-Review: Hilary Scharton <hilary@instructure.com>
2015-06-08 19:49:51 +00:00
Abhishek Singh c032ada325 Needs Grading on quiz submission list API
Fixes CNVS-19664
Modified list quiz submissions API to check for all submissions which
needs grading and trigger a delayed grading job. Also added a new
field 'overdue_and_needs_submission' to the returned JSON.

Test Plan
- Check the overdue_and_needs_submission field for ongoing test. It should be false.
- Check the overdue_and_needs_submission field for test which is overdue but workflow state is still untaken.
  It should be true and a delayed job to grade that quiz should be triggered.
- Check if the overdue quiz is graded and workflow state is changed to complete and
  overdue_and_needs_submission is changed to false.
- Check the above scenarios with teacher role and student role.

Change-Id: I420ade5b6b2d522aa79d1f13f865ce0e1169aae0
Reviewed-on: https://gerrit.instructure.com/55269
Tested-by: Jenkins
QA-Review: Michael Hargiss <mhargiss@instructure.com>
Reviewed-by: Cameron Sutter <csutter@instructure.com>
Product-Review: Abhishek Kumar Singh <asingh@instructure.com>
2015-06-05 19:54:55 +00:00
Michael Nomitch 38be25df93 dont set quiz submission finish times to future
fixes CNVS-18374

test plan:
  - make a quiz and take it as a student
  - view it in speed grader and check that
    the Submitted time is accurate

Change-Id: Ic6d727134542664308e9a2378ea196d825660120
Reviewed-on: https://gerrit.instructure.com/55279
Tested-by: Jenkins
Reviewed-by: Brian Finney <bfinney@instructure.com>
QA-Review: Ben Bolton <bbolton@instructure.com>
Product-Review: Hilary Scharton <hilary@instructure.com>
2015-06-04 19:03:47 +00:00
Michael Nomitch ae045803d1 shuffle quiz answers in API
fixes CNVS-20526

test plan:
  - create a quiz that shuffles ansers
  - as a student get the questions for said quiz via
    the API
    'api/v1/quiz_submissions/:submission_id/questions'
    - the answers are shuffled
  - as a teacher do the same
    - the answers are not shuffled
  - make sure non shuffleable questions show up properly

Change-Id: I8a197e8a6005488fc5adccfec937bde9d259df28
Reviewed-on: https://gerrit.instructure.com/54604
Tested-by: Jenkins
Reviewed-by: Brian Finney <bfinney@instructure.com>
QA-Review: Michael Hargiss <mhargiss@instructure.com>
Product-Review: Hilary Scharton <hilary@instructure.com>
2015-06-04 15:25:11 +00:00
Ryan Taylor 6ebff05c4a Fixes event rebuild tools, optimization for event_aggregator
This should make event rebuilding equivalent with versions rebuilding
in the most substantial ways (doesn't cause bug in quiz showing with
unsupported question types).

Refs CNVS-20069

Test Plan:
  - contact Ryan for DB migration script
  - Run custom migration
  - Delete a single quiz submission with raw SQL query
  - Rebuild that quiz_submission from the events log
  - Confirm that the quiz is viewable, contains the same questions, and
    is properly graded.

Change-Id: Ia66a3f15e86e5dffd8ba2eff1ce5ff1ce663ad9b
Reviewed-on: https://gerrit.instructure.com/55164
Tested-by: Cameron Sutter <csutter@instructure.com>
Reviewed-by: Brian Finney <bfinney@instructure.com>
QA-Review: Robert Lamb <rlamb@instructure.com>
Product-Review: Ryan Taylor <rtaylor@instructure.com>
2015-05-29 17:14:48 +00:00
Ryan Taylor 46f31b42fb Fixes Question nil in event aggregator
Enables tooling to run for data fix.

Change-Id: Ie0dfe7c91c20040d9ddf5447b03cbd0b791c6987
Reviewed-on: https://gerrit.instructure.com/54414
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins
Product-Review: Ryan Taylor <rtaylor@instructure.com>
QA-Review: Ryan Taylor <rtaylor@instructure.com>
2015-05-29 16:03:26 +00:00
Michael Nomitch abd7f73c95 quiz submission questions bug fix
fixes CNVS-20168

test plan:
  - make a quiz that only tests students on a
    subset of its questions (i.e. make a group that
    shows 2/4 questions in it) - and can be taken
    multiple times
  - start taking the quiz as a student
  - note the questions that have been chosen and
    do not finish the quiz
  - hit api/v1/quiz_submissions/:sub_id/questions
  - make sure the questions and number of questions
    are the same as you see when taking the quiz
  - submit the quiz and try again
  - note that the questions are probably different
  - hit that endpoint again and make sure that the
    questions align with the new ones

Change-Id: I8476ee8d27956573980cf2c1603132848b851972
Reviewed-on: https://gerrit.instructure.com/54854
Tested-by: Jenkins
Reviewed-by: Ryan Taylor <rtaylor@instructure.com>
QA-Review: Michael Hargiss <mhargiss@instructure.com>
Product-Review: Hilary Scharton <hilary@instructure.com>
2015-05-28 14:04:07 +00:00
Alex Boyd 90461b3502 Don't superfluously publish assignments during quiz updates
Fixes CNVS-20619

Test plan:
 - Create and publish a course
 - Add a student to the course
 - Set all of their notification settings to ASAP
 - As a teacher:
   - Create, but do not publish, a quiz
   - Go to the "assignments" page
   - Delete the assignment corresponding to the quiz
   - Ensure that the student did not receive a message telling
     them that the assignment was created
 - Regression test quizzes

Change-Id: Iabb968708e79a3151617f01987fed477eaaff877
Reviewed-on: https://gerrit.instructure.com/54658
Tested-by: Jenkins
Reviewed-by: Ryan Taylor <rtaylor@instructure.com>
QA-Review: Michael Hargiss <mhargiss@instructure.com>
Product-Review: Alex Boyd <aboyd@instructure.com>
2015-05-27 23:25:41 +00:00
James Williams 9a282ae150 Revert "don't fulfill must_submit requirements on manual 0 grade"
This reverts commit 499aa1ca88.

closes #CNVS-20564

Change-Id: If916cb992d520abf71b9a4c804dafa8d272fce3f
Reviewed-on: https://gerrit.instructure.com/54756
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Clare Strong <clare@instructure.com>
Product-Review: Matt Fairbourn <mfairbourn@instructure.com>
2015-05-21 17:59:00 +00:00
Ryan Taylor 221b15d7fa Creates quiz attribute "has_access_code" for mobile API
Now quizzes report if they have an access code in the API.

Closes CNVS-20233

Test Plan:
  - Visit api/v1/courses/1/quizzes
  - Confirm each quiz shows "has_access_code" accurately
  - ["with", "without"].map do |word|
    - Create a quiz #{word} an access code
    - Check the api/v1/courses/1/quizzes/:id endpoint to see if
      has_access_code is correct

Change-Id: I825af0a42ef722a03f5d4ee7a7065c6bb187dd1c
Reviewed-on: https://gerrit.instructure.com/54372
Tested-by: Jenkins
Reviewed-by: Cameron Sutter <csutter@instructure.com>
QA-Review: Michael Hargiss <mhargiss@instructure.com>
Product-Review: Ryan Taylor <rtaylor@instructure.com>
2015-05-19 15:44:12 +00:00
Ryan Taylor b02be2eae6 Prevent arbitrary timestamps in QLA event data from client
Overwrites timestamps from the client if they differ from server time by
greater than 30 seconds.

Closes CNVS-20405

Test Plan:
  - Start a quiz attempt.
  - Take a question or two
  - Change system clock to +2 minutes
  - Take a question or two
  - Change your system clock to -2 minutes (from real time)
  - Take a question or two.
  - Submit quiz.
  - View quiz submission event log (QLA) and confirm that
    the page events have correct timestamp information. Remember that answer
    events are not subject to the system clock problems, so look at page
    focused/page blurred events and others which are JS based.

Change-Id: I9e1fa20a9bb9e9373ad7422cc2e917480e7ac628
Reviewed-on: https://gerrit.instructure.com/53974
Tested-by: Jenkins
Reviewed-by: Cameron Sutter <csutter@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
Product-Review: Ryan Taylor <rtaylor@instructure.com>
2015-05-15 21:09:21 +00:00
Cody Cutrer 6636445f69 optimize rebuilding of quiz submissions
don't load questions one at a time, instead load all of the questions for
the quiz at once. also set inverse relations so accesses back to the quiz
don't cause another query

Change-Id: I4a90a012c7b2bb832c55adfb3dd4a23ecd798a9d
Reviewed-on: https://gerrit.instructure.com/54404
Tested-by: Jenkins
Reviewed-by: Rob Orton <rob@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2015-05-15 18:48:36 +00:00
Cody Cutrer be8b9e0772 refactor and improve partition management
* move most of the logic into PartitionManager
 * use a setting for how many partitions to precreate/prune
 * enumerate existing tables for pruning, instead of assuming
   we can just roll off the last one
 * actually run the tests for partman from CI
 * simplify configuring partitioned migrations (just rely
   on the model to get the table name, instead of trying to
   guess the model from the table name, and sometimes having
   to provide both)

Change-Id: Ic8ac2b603a02f092b2f278d2b366b1cd9f942954
Reviewed-on: https://gerrit.instructure.com/53286
Tested-by: Jenkins
Reviewed-by: Ethan Vizitei <evizitei@instructure.com>
Reviewed-by: Brian Finney <bfinney@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2015-05-15 02:15:09 +00:00
Ryan Taylor 6cf8fd9caa Updates for data fix script for missing QS
This updates the functionality of our QS data fix script to allow for
finding/fixing in a single delayed_job operation

Also, corrects a bug in the existing event_aggregator which
unnecessarily looped over the answers repeatedly.  This should speed up
the data fix by orders of magnitude.

Refs CNVS-20069

Test Plan:
  - Confirm script works well on beta

Change-Id: Icd4a1b1fa866650162a2b1b4ac97201efe6d5e76
Reviewed-on: https://gerrit.instructure.com/54249
Reviewed-by: Ben Chobot <bench@instructure.com>
Reviewed-by: Brian Finney <bfinney@instructure.com>
Product-Review: Brian Finney <bfinney@instructure.com>
Tested-by: Jenkins
QA-Review: Robert Lamb <rlamb@instructure.com>
2015-05-14 16:35:37 +00:00
Cody Cutrer 39bf52a671 keep 6 months of QLA data
Change-Id: I8046174f551a95b4f25ac1886d9013ddc86ba3fe
Reviewed-on: https://gerrit.instructure.com/53279
Tested-by: Jenkins
Reviewed-by: Cameron Sutter <csutter@instructure.com>
Reviewed-by: Ethan Vizitei <evizitei@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2015-05-01 19:38:02 +00:00
Ryan Taylor e347721e62 Fixes QLA data fix tools on text-only questions
Closes CNVS-19990

Test Plan:
  - Confirm that QLA tools can be run for a quiz containing text-only
    questions without error.

Change-Id: Idbc0b51cd7b22bdf395d5b4195a2836b161ee56e
Reviewed-on: https://gerrit.instructure.com/52736
Tested-by: Jenkins
Reviewed-by: Cameron Sutter <csutter@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
Product-Review: Ryan Taylor <rtaylor@instructure.com>
2015-04-28 15:05:54 +00:00
Strand McCutchen 04cb5187e0 fix Performance/ReverseEach issue
Change-Id: I939e883124ebcd67d57febc7dde6336db6277f62
fixes: CNVS-20009
Reviewed-on: https://gerrit.instructure.com/52893
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Strand McCutchen <smccutchen@instructure.com>
QA-Review: Strand McCutchen <smccutchen@instructure.com>
2015-04-27 20:53:43 +00:00
Strand McCutchen 1a24af8e53 fix Lint/StringConversionInInterpolation issue
Change-Id: Ibea00b023aa91e4f4a627161fbe87dbb54d22daf
fixes: CNVS-20009
Reviewed-on: https://gerrit.instructure.com/52884
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins
Product-Review: Strand McCutchen <smccutchen@instructure.com>
QA-Review: Strand McCutchen <smccutchen@instructure.com>
2015-04-27 20:53:25 +00:00
Simon Williams e806ae508b don't let broadcast_policy swallow errors
closes CNVS-18909

test plan:
- trigger as many different permutations of notifications as possible
  * for example, discussion announcements for a course and a group,
    graded and ungraded
- none of them should raise an error

Change-Id: I35ea692bd8510a07be73c571f1e862b5bc0faa38
Reviewed-on: https://gerrit.instructure.com/49640
Tested-by: Jenkins
Reviewed-by: Joel Hough <joel@instructure.com>
QA-Review: Adam Stone <astone@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2015-04-24 22:35:35 +00:00
James Williams 4fce85e497 don't allow negative quiz question point values
test plan:
* should not be able to create a quiz question
with a negative point value

* import the package referenced in the ticket
* should not have questions with negative point values

closes #CNVS-19877

Change-Id: I184bf4705af59bfddfe6bce09c7930e0957dccd6
Reviewed-on: https://gerrit.instructure.com/52611
Tested-by: Jenkins
Reviewed-by: Dan Minkevitch <dan@instructure.com>
QA-Review: Clare Strong <clare@instructure.com>
Product-Review: Hilary Scharton <hilary@instructure.com>
2015-04-23 16:19:40 +00:00
James Williams 499aa1ca88 don't fulfill must_submit requirements on manual 0 grade
test plan:
* create a course with a student
* create an assignment
* create a module and add the assignment
 as an item
* add a completion requirement to submit the
 assignment
* in the gradebook, mark a 0 for the student
 in the assignment
* as the student, it should not show the requirement
 as completed

closes #CNVS-12693

Change-Id: Ic2721ead70b570e66b12d8936cc5bd4fcff62575
Reviewed-on: https://gerrit.instructure.com/52663
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Clare Strong <clare@instructure.com>
2015-04-23 15:00:37 +00:00
Ryan Taylor 0bfe1c1cea Adds question_types to quiz API responses
Necessary for mobile quiz selection

Closes CNVS-19613

Test Plan:
  - Confirm that quiz API endpoints return question_types array,
    containing unique quiz question types.

Change-Id: If1a51bb101fc6a346872c7d5952cb68d32e85397
Reviewed-on: https://gerrit.instructure.com/52217
Reviewed-by: Brian Finney <bfinney@instructure.com>
Tested-by: Jenkins
QA-Review: Amber Taniuchi <amber@instructure.com>
Product-Review: Ryan Taylor <rtaylor@instructure.com>
2015-04-20 16:04:42 +00:00
Ryan Taylor 6cb549ebcf Adds basic AnswerSerializer behavior for file upload questions
Fixes QLA fixup tooling.

Closes CNVS-19807

Test Plan:
 - Ensure all file upload question behaviors in editors/grading/speedgrader are
   not broken.

Change-Id: I85e5fd6739434d3f36ea14ef30c737a66ca76e50
Reviewed-on: https://gerrit.instructure.com/52142
Reviewed-by: Brian Finney <bfinney@instructure.com>
Tested-by: Jenkins
QA-Review: Amber Taniuchi <amber@instructure.com>
Product-Review: Ryan Taylor <rtaylor@instructure.com>
2015-04-16 17:09:24 +00:00
James Williams 5e5cd7b79c add tinymce editor for quiz question comments
test plan:
* should be able to create and edit question and
 answer comments using the html rce editor
* should be able to edit previously uneditable
 comments imported by certain packages

closes #CNVS-15633 #CNVS-10161

Change-Id: I3879fa3a2bb71e3e0f4ceefd66da3dbba41b0549
Reviewed-on: https://gerrit.instructure.com/52075
Reviewed-by: Brian Finney <bfinney@instructure.com>
Tested-by: Jenkins
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
Product-Review: Hilary Scharton <hilary@instructure.com>
2015-04-14 20:29:42 +00:00
James Williams 2b8cd4c6ad restore re-copied items to published state if not unpublishable
test plan:
* create a regular assignment, and a quiz
* keep them unpublished
* copy them to another course
* publish the quiz and assignment
* enroll a student and submit to the
 assignment and the quiz
* delete the assignment and quiz
* re-copy the assignment and quiz over
 from the original course
* should restore them to a published state

closes #CNVS-14510

Change-Id: I4a97602882fdc2f88427892d92526bc21c57e0b2
Reviewed-on: https://gerrit.instructure.com/51862
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Clare Strong <clare@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2015-04-10 19:43:46 +00:00
Cody Cutrer 9834937c8c don't autorequire a bunch of gems that are rarely used
Change-Id: I09ed3686629b62849d392684d587f30cb2047013
Reviewed-on: https://gerrit.instructure.com/51853
Tested-by: Jenkins
Reviewed-by: Ethan Vizitei <evizitei@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2015-04-09 18:47:50 +00:00
Jeremy Stanley 3ea15e9b98 "after course end date" includes hard-concluded courses
test plan:
 - check "Restrict students from viewing quiz questions after
   course end date" in account settings
 - as a student, take a quiz
 - as a teacher, conclude the course containing the quiz via the
   "conclude this course" button in course settings
 - as the student, confirm that the quiz answers are no longer
   shown to you on the quiz page

fixes CNVS-19394

Change-Id: I1bd95de08b91e391873935278ed95576e6783d6e
Reviewed-on: https://gerrit.instructure.com/50821
Tested-by: Jenkins
Reviewed-by: James Williams  <jamesw@instructure.com>
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2015-03-24 17:58:29 +00:00
Ryan Taylor 9a46b2f19c Fixes QLA back end tooling bugs required for data fixes
Closes CNVS-19336

Test Plan:
 - Open console
 - Select a recent quiz submission (id, attempt)
 - Run:
   - `a = Quizzes::LogAuditing::EventAggregator.new`
   - `sub_data = a.run(id, attempt, Time.now)` to aggregate all data from event
     stream into data
   - Confirm that sub_data looks mostly like
     `Quizzes::QuizSubmission.find(id).submission_data`

Change-Id: I91e1df17a34b09d1a73af2e75b98324e1fa27b2d
Reviewed-on: https://gerrit.instructure.com/50471
Tested-by: Jenkins
Reviewed-by: Brian Finney <bfinney@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
Product-Review: Ryan Taylor <rtaylor@instructure.com>
2015-03-18 18:12:06 +00:00
Brian Finney db41817044 Don't QuizQuestion#question_data= for aq update
Looks like QuizQuestion#question_data= is expecting form data and
create_quiz_question uses write_attribtue so update_assessment_question!
probably should also.

Fixes CNVS-19292

Test plan:
 - Full regression test all quiz question types through question banks
 making sure to also edit the question bank for every question type.

Change-Id: I9350e6e3a313920f63a424761c10937d376cb111
Reviewed-on: https://gerrit.instructure.com/50440
Tested-by: Jenkins
Reviewed-by: Ryan Taylor <rtaylor@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
Product-Review: Matt Fairbourn <mfairbourn@instructure.com>
2015-03-17 21:34:52 +00:00
Ryan Taylor 96a604111a Prevents pick count erroring on nil
Adds a default value of 0 when pick count isn't being set properly.

Closes CNVS-18856

Test Plan:
  - Create quiz with question groups and pick count of nil
  - Confirm that the preview page still works without error or silent
    redirection to quiz show page.

Change-Id: I2523e93aa3af31520e87ca0107e5f82db1b7a92c
Reviewed-on: https://gerrit.instructure.com/49469
Reviewed-by: Cameron Sutter <csutter@instructure.com>
Tested-by: Jenkins
QA-Review: Robert Lamb <rlamb@instructure.com>
Product-Review: Ryan Taylor <rtaylor@instructure.com>
2015-03-05 02:48:27 +00:00
Brian Finney a9b68e3abc Ensure submission is complete before showing answers
Fixes CNVS-18802

Test plan
 - Create a quiz with multiple attempts and 'Let Students See The
 Correct Answers' 'Only After Their Last Attempt'
 - Take quiz untill you are on your final attempt
 - Answers should not be visible during final attempt
 - When final attempt is completed answers should now be visible

Change-Id: Ibf729afbe491b958d58b6b813379c9b40e678088
Reviewed-on: https://gerrit.instructure.com/49507
Tested-by: Jenkins
Reviewed-by: Ryan Taylor <rtaylor@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
Product-Review: Brian Finney <bfinney@instructure.com>
2015-02-27 18:29:50 +00:00
Brian Finney aef17194b1 Check version when finding questions from a pool
Fixes CNVS-18016

Test plan:
 - create a question bank
 - create a quiz with a question group and associate it with the
 question bank
 - take the quiz, see your questions
 - change the questions in the question bank
 - take the quiz, see your changes

Change-Id: I2fd65eb1a5daaba3bda1a96ee6dcb2f2b54b2533
Reviewed-on: https://gerrit.instructure.com/48596
Tested-by: Jenkins
Reviewed-by: Ryan Taylor <rtaylor@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
Product-Review: Hilary Scharton <hilary@instructure.com>
2015-02-23 16:56:03 +00:00
Cody Cutrer d6312b7e0d use url helpers in messages
fixes CNVS-11838

and then choose the host more intelligently to use one the user
can actually log in to

test plan
- have accounts on two shards, referred to as "account 1" and
 "account 2" from now on
- have account domains that are resolvable for the accounts,
 referred to as account1.canvas.dev and account2.canvas.dev from
 now on
- have account 2 trust account 1 by POSTing to
 account2.canvas.dev/api/v1/accounts/<account 2 id>/trust_links
 with a site admin's auth token and setting
 trust_link[managing_account_id] to account 1's global id.
 you can now use users from account 1 on account 2

- regression test notifications, especially considering
 notifications generated by account 2 that are sent to account 1
 users.
- account 1 users should have links that use account1.canvas.dev
 and have global ids for referenced objects that live on
 account 2's shard,
 e.g. account1.canvas.dev/courses/2~1/discussion_topics/2~30
- avatars should use the avatar owner's account domain
- account 2 users should have links that use account2.canvas.dev
 and have local ids,
 e.g. account2.canvas.dev/courses/1/discussion_topics/30
- following the links when the user receiving the notification is
 logged in should take the user to the linked object
- following the links when not logged in should take the user to
 a login page that they are able to log in to
- be sure to at least check:
 context file downloads links (e.g. discussion topic attachments)
 file downloads links (e.g. conversation message attachments)
 avatars links
 conversation notifications
 discussion notifications
 peer review notifications

Change-Id: Idebd247fee99a2b973d3fa6f4f2fca0e723d99a5
Reviewed-on: https://gerrit.instructure.com/31867
Tested-by: Jenkins
Reviewed-by: Matthew Wheeler <mwheeler@instructure.com>
QA-Review: Steven Shepherd <sshepherd@instructure.com>
Product-Review: Joel Hough <joel@instructure.com>
2015-02-18 23:07:57 +00:00
Ryan Taylor 6c197f9862 Blocks student access to QLA
Turns off student accessibly QLA records

Test plan:
  - Confirm no student access
  - Confirm teacher access

Change-Id: Idca90b00b966acea3c63ea0dd105e6c0bfbd3ceb
Reviewed-on: https://gerrit.instructure.com/48600
Reviewed-by: Brian Finney <bfinney@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
Tested-by: Jenkins
Product-Review: Ryan Taylor <rtaylor@instructure.com>
2015-02-11 05:03:33 +00:00
Josh Simpson 6ab29afcf8 add average scoring policy to quizzes
fixes CNVS-18389
This commit adds an 'average' scoring policy to quizzes. You can
now choose to keep the average score of all attempts of a quiz.

Test plan
- Create a quiz with multiple attempts, and an 'average' scoring policy
- Take the quiz multiple times, choosing different answers for different
scores per attempt.
- The kept score should be the average of all attempts scores.

Change-Id: I1d3c6a9072188af338611f340a0963108cba148e
Reviewed-on: https://gerrit.instructure.com/48353
Tested-by: Jenkins
Reviewed-by: Ryan Taylor <rtaylor@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
Product-Review: Hilary Scharton <hilary@instructure.com>
2015-02-06 19:14:26 +00:00
Ryan Taylor f36acb65b3 Fixes quiz_statistics largeness error
Checks for size of active quiz questions before turning off quiz stats
for being too big.

Closes CNVS-18341

Test-Plan:
  - Make a quiz with 101 questions, but make only 50 of them active
  - Confirm that quiz stats show up

Change-Id: Ia45c1b444d774dcd6c6a434a0552ff1a22f09b31
Reviewed-on: https://gerrit.instructure.com/48192
Tested-by: Jenkins
Reviewed-by: Josh Simpson <jsimpson@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
Product-Review: Ryan Taylor <rtaylor@instructure.com>
2015-02-05 23:03:33 +00:00
Brian Finney 1d69dcf8fc Graded survey should always recieve full points
Fixes CNVS-16056

Test plan
 - create a graded survey with a custom possible points
 - take the survey as a student
 - leave a comment on a question in the survey as the teacher
 - the survey should still have recieved full points

Change-Id: Id5a0513584c2991a3ece15506268936f7b1c33c3
Reviewed-on: https://gerrit.instructure.com/47977
Reviewed-by: Ryan Taylor <rtaylor@instructure.com>
Tested-by: Jenkins
QA-Review: Amber Taniuchi <amber@instructure.com>
Product-Review: Brian Finney <bfinney@instructure.com>
2015-02-04 00:37:12 +00:00
Ryan Taylor 6abb24a4f0 Prevent JSON parse errors in Quiz Statistics
Some quizzes ended up with a set of answers which caused the statistical
calculations to implode.  This catches these and sanitizes them.  JSON
parsers are happier now.

Closes CNVS-17466

Test Plan:
  - Create a quiz which replicates the original problem.  Apparently
    this can be done by answering the quiz with different answers and
    only two students, however I suspect it has more to do with answers
    having a standard deviation of zero (i.e. identical answers).
  - Visit the quiz statistics page for that quiz and confirm that stats
    finish loading and show some data.

Change-Id: I2847a2aa99c34579c926b05b371a7c48242ab618
Reviewed-on: https://gerrit.instructure.com/47766
Tested-by: Jenkins
Reviewed-by: Cameron Sutter <csutter@instructure.com>
Product-Review: Matt Fairbourn <mfairbourn@instructure.com>
QA-Review: Sean Lewis <slewis@instructure.com>
2015-01-27 22:34:47 +00:00
Ryan Taylor d836c6f08a A landing page for when Quiz Stats are just too big
Quiz Stats were silently failing. This catches the failed server request
and renders a clean error page which directs the user to download the
reports instead of using the statistics UI.

Closes CNVS-17285

Test Plan:
  - Access a quiz with more than 1000 submissions or more than 50
    questions.  See that the stats page is no longer rendered empty, but
    that an error page is shown.
  - Confirm that report buttons are operational
  - Confirm that report popup info boxes are looking good

Change-Id: I850406ed164a61e59d137dda3221746ee25a77cc
Reviewed-on: https://gerrit.instructure.com/46377
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Josh Simpson <jsimpson@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
Product-Review: Ryan Taylor <rtaylor@instructure.com>
2015-01-13 19:17:14 +00:00
Derek DeVries 65cd872f8e fix issue with event created at time not being set to utc time
fixes CNVS-17723

test plan:
  - as a teacher
    - create a OQAAT quiz with a few questions
    - publish the quiz

  - as a student
    - take the quiz
    - you should not get errors when answering questions

Change-Id: I5811e775112bd030d1ea3703985c7f3b194d4901
Reviewed-on: https://gerrit.instructure.com/46458
Reviewed-by: Derek DeVries <ddevries@instructure.com>
QA-Review: Matt Fairbourn <mfairbourn@instructure.com>
Product-Review: Matt Fairbourn <mfairbourn@instructure.com>
Tested-by: Matt Fairbourn <mfairbourn@instructure.com>
Reviewed-by: Ahmad Amireh <ahmad@instructure.com>
Product-Review: Ahmad Amireh <ahmad@instructure.com>
QA-Review: Ahmad Amireh <ahmad@instructure.com>
Tested-by: Ahmad Amireh <ahmad@instructure.com>
2015-01-01 04:34:55 +00:00
Ahmad Amireh 45260fa4b9 QLA - Table view / answer matrix
A table view that lists all the answers to all questions with lots of
options. The view is restricted to Support SiteAdmins only.

Closes CNVS-17165

Backend/API Changes:

  - QuizSubmissionEvents#index is now paginated

  - Added a new account-level permission :view_quiz_answer_audits to
    control the visiblity of the answer matrix. You can test this on the
    quiz using "quiz.grants_right?(user, :view_answer_audits)"

Client app changes:

  - Fixed a race issue when loading environment-specific config;
    sometimes would cause the tests to fail because the test suite would
    run before the test config was loaded

  - Moved the decoration of QUESTION_ANSWERED events to a separate
    module and now it is done only once at fetch-time, instead of once
    per render

  - Simplified a lot of book-keeping that was done in the Events store
    by using query & URL parameters

  - A global loading indicator prop "isLoading" which is managed by the
    root route in routes/app.jsx - if you want to create a nicer loading
    indicator, this would be the place to edit

  - Moved all "devDependencies" into "dependencies" in package.json so
    now we can just do "npm shrinkwrap" without any flags to generate
    the shrinkwrap.

  - grunt watch task is now smart enough to pick up the current app
    we're working on. Doing `grunt server:events` will watch all the
    files in /apps/events and run the test suite only for that app. :)

Doc changes:

  - Defined a new JSDuck tag @seed that allows us to inspect React
    components in real-time in the docs! Every @seed tag you define will
    accept a JSON construct (or a file that contains JSON) and will
    inject that into the rendered component, so you can show off
    different states and usages in the documentation itself.

TEST PLAN
---- ----

  - create a large quiz with a lot of questions and multiple attempts
  - take it a few times, do many things like answering questions,
    tabbing out and back in, flagging/unflagging questions, etc.
  - go to the log view
    + make sure you enable the new permission for your user from the
      "Manage Permissions" page in the SiteAdmin settings
    + verify you see the "View Table" button
    + click it, and verify the table works as expected
  - go back to the Stream View
  - click on a question link
    + in the question page, verify that the answers are rendered in a
      friendly version (e.g, MultipleChoice answers are shown as radio
      buttons, with the student's answer selected)
    + hop to other questions/types and verify the same thing

Change-Id: I0529b08becbf7dead86c959254faab55761db8df
Reviewed-on: https://gerrit.instructure.com/45883
Reviewed-by: Derek DeVries <ddevries@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Trevor deHaan <tdehaan@instructure.com>
Product-Review: Derek DeVries <ddevries@instructure.com>
2014-12-19 22:11:56 +00:00
Ahmad Amireh 84a87f8513 QLA - use the submission's question set
Closes CNVS-17235

API/Backend Changes:

  - New helper in Filters::QuizSubmissions for retrieving a specific
    attempt model of a quiz submission, given the attempt number

  - QuizSubmission now provides an interface for looking up its model
    reflection in a certain attempt: QuizSubmission#model_for_attempt()

  - QuizQuestion API index endpoint now allows us to specify a
    submission and an attempt number for retrieving questions presented
    during that unique session

  - QuizSubmission API show endpoint now allows us to specify an attempt
    for retrieving the submission info at that attempt

  - QuizQuestion JSON renderer can now utilize quiz_data (if specified)
    to infer the position of the question in the output. This is
    necessary for submission questions since their position varies from
    a sub to another.

  - QuizSubmissionEvents #create endpoint has been moved to:
    [POST] /courses/:id/quizzes/:id/submissions/:id/events

  - New endpoint for retrieving a sub's attempt events at:
    [GET]  /courses/:id/quizzes/:id/submissions/:id/events

Client changes:

  - Client can now parse pagination using either the Link header when
    receiving regular JSON responses, or the JSON-API "pagination" set,
    whichever is available.

TEST PLAN
---- ----

  - create a quiz with 2 questions, make sure u allow multiple attempts
  - take the quiz as a student, no need to submit it
  - go to the submission log for that student:
    + verify the page loads and renders just fine
  - now edit the quiz, delete one of those questions, save the quiz
    + reload the submission log page:
      - it should still work
  - submit the quiz, take it again
    + go back the submission log page, and switch between attempts:
      - verify the switching works and data gets (re)loaded

Test with banks:

  - create a new quiz with questions pulled out of a bank, and let it
    allow multiple attempts
  - take the quiz a number of times so you get different questions from
    the bank across the attempts
  - in the QLA app, verify that you see the correct questions when you
    switch between attempts

Extra:

Generate the API docs (`bundle exec rake doc:api`) and visit the Quiz
Questions page; the "List questions in a quiz or submission" endpoint
docs should now list the 2 new parameters, "quiz_submission_attempt" and
"quiz_submission_id".

Change-Id: I4b1761b924fb6011b1df696b89fbf6a91bab43a6
Reviewed-on: https://gerrit.instructure.com/45262
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Derek DeVries <ddevries@instructure.com>
QA-Review: Trevor deHaan <tdehaan@instructure.com>
Product-Review: Derek DeVries <ddevries@instructure.com>
2014-12-18 23:39:54 +00:00
Matthew Berns d5ad3f6e5b updated learning outcome to retain eval method and info for weighted methods
fixes CNVS-16915

(all mentions of 'gradebook' refer to learning mastery gradebook)
test plan:
- go to gradebook
- all existing mastery scores should still default to highest score to retain
  accuracy of existing calculations
- in rails console, set 'calculation_method' to 'latest' for an outcome
- all results for that outcome should now show student's latest score on gradebook
- in rails console, set method to 'highest'
- all results for that outcome should now show student's highest score on gradebook
- in rails console, set method to 'n_mastery' and set 'calculation_int' to a number
  between two and 5
- all results for that outcome should now show avg of student's higest n# of scores
  (#n being the number set for the outcome's 'calculation_int')
- in rails console, set method to 'decaying_average' and set 'calculation_int' to 75
- scores should now appear as they did first time gradebook was viewed on step #2
- in rails console, set 'calculation_int' to 65
- scores for that outcome should now reflect decaying average with 65% weight given to
  most recent score, and 35% weight for avg of all prior scores
- have a student make a new submission to an old assignment and give it a score
- the re-submission should now be most recent score for 'latest' and
  'decaying_average' methods
- amend a score for an old submission without a new submission from the student
- the amended score should not become the most recent, but still be accurately
  reflected in the 25%/35% part of the 'decaying_average' method

Change-Id: I330c47cb2288d99e589deca00ddb5a8ee8103a91
Reviewed-on: https://gerrit.instructure.com/44935
Reviewed-by: Simon Williams <simon@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Sean Lewis <slewis@instructure.com>
Product-Review: Benjamin Porter <bporter@instructure.com>
2014-12-16 01:04:28 +00:00
Ahmad Amireh bfb266cedc Fix quiz questions from banks
This patch makes it so that whenever we generate a submission that pulls
questions from a QuestionBank, we are assured that we're dealing with
QuizQuestion objects. Retroactively, a data fixer is installed that will
process every submission on hot points like the API readers if they
happen to have bad data.

There are a lot of comments in the additions which should give you more
context.

Huge refactors:

- Quiz is no longer responsible for "preparing" its question data, nor
  generating questions for submissions. That's now delegated to the
  QuizQuestionBuilder

Closes CNVS-17412

TEST PLAN
---- ----

  - create a crazy quiz with all sorts of things:
    a) single questions,
    b) question groups with manual questions
    c) question groups tied to question banks
    d) question groups that have questions from banks and others
       manually created
    e) multiple attempts so we can verify versioning is not affected
  - MAKE SURE that you can get some questions duplicated (even if it
    takes you a couple of attempts), you can achieve this by creating 1
    group that is linked to a bank, and another group that has 1 or more
    questions from that same bank (and possibly other banks) - keep
    trying the quiz until you get a duplicate
  - take the quiz both as a student and a teacher, and do it multiple
    times
    + verify all the answers to the questions are as you entered
    + ON DUPLICATES: provide different answers, and make sure that all
      answers were recorded
    + go over all the submission-related pages and verify everything is
      still rendering
    + use the API to read the quiz, its questions, and the submissions
      and verify that all endpoints are functional

Change-Id: I322e2786d33eda03fb18dde0fbb5cd11a16f2449
Reviewed-on: https://gerrit.instructure.com/45456
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Ryan Taylor <rtaylor@instructure.com>
QA-Review: Trevor deHaan <tdehaan@instructure.com>
Product-Review: Matt Fairbourn <mfairbourn@instructure.com>
Reviewed-by: Ahmad Amireh <ahmad@instructure.com>
Product-Review: Derek DeVries <ddevries@instructure.com>
Reviewed-by: Derek DeVries <ddevries@instructure.com>
2014-12-15 17:38:13 +00:00
Derek DeVries a5a5d5e780 place generating a submission in a transaction
this also does a little bit of refactoring around generating quiz submissions
and how we determine the end_at date

fixes CNVS-17232

test plan:
  - as a teacher
    - create a quiz
    - make sure you can successfully take the quiz

    - create a quiz
    - take a quiz
    - leave the quiz before finishing
    - return and 'resume quiz'
    - make sure that you can successfully resume the quiz

    - create a quiz
    - add extension for a user to give extra time or attempt

    - as a student with an extension
    - make sure you can successfully take the quiz

  - important! Logic has been updated here and needs
    a good check for regressions on the test plan in:
    https://gerrit.instructure.com/#/c/40609

Change-Id: I3ead6adf866ac8aa155b7104b2819e03b124bb53
Reviewed-on: https://gerrit.instructure.com/45261
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Ryan Taylor <rtaylor@instructure.com>
QA-Review: Trevor deHaan <tdehaan@instructure.com>
Product-Review: Derek DeVries <ddevries@instructure.com>
2014-12-05 17:04:34 +00:00
Derek DeVries 99a431f546 don't pull assessment question from the same bank twice for the same quiz
fixes CNVS-16139, CNVS-17164

test plan:

  - as a teacher
    - create a quiz with two groups that both pull from the same bank
    - save and publish the quiz
    - take the quiz
    - you should never get the same question pulling from that bank twice

    - create a quiz with groups that contain questions (not from a bank)
    - save and publish the quiz
    - take the quiz
    - the questions should be pulled randomly from the group

  - test for regressions around building and taking quizzes with groups
    both with and w/o question banks in any permutation you can think of

Change-Id: Ia1d305cbc1e6051d38adcaff8e192d97802c6bd5
Reviewed-on: https://gerrit.instructure.com/45237
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Ryan Taylor <rtaylor@instructure.com>
QA-Review: Trevor deHaan <tdehaan@instructure.com>
Product-Review: Derek DeVries <ddevries@instructure.com>
2014-12-04 21:44:22 +00:00
Ahmad Amireh 6d1e53f608 canvas-partman - rolling partition migrations
Closes CNVS-16878

TEST PLAN
---- ----

Similar to g/44145 but no rake tasks needed.

  - check out the patch
  - run `bundle exec rake db:migrate`
  - run the rails server and visit any page:
    + if you got this far, and jenkins has passed, things are good

Change-Id: Icfed777974269c344b5e1e1c2617ab2f3836f38f
Reviewed-on: https://gerrit.instructure.com/44405
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Ahmad Amireh <ahmad@instructure.com>
QA-Review: Ahmad Amireh <ahmad@instructure.com>
2014-12-03 19:53:53 +00:00
Ryan Taylor 4e0b0c066d Quiz Event Aggregator for QS events
This commit introduces methods for aggregation of quiz submission events
with the ability to target specific attributes like answering or
flagging questions as is specific for generating a Quiz Submission, or
all events as for generating a replay of the quiz taking events as they happen.

Closes CNVS-15659

Test Plan:
- Confirm that quiz submission events aren't adversely affected.
- Specs should cover most of this

Change-Id: Ie6364ea12db15858f3d6cb6d54ce22b4eaf55456
Reviewed-on: https://gerrit.instructure.com/44372
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Ahmad Amireh <ahmad@instructure.com>
QA-Review: Trevor deHaan <tdehaan@instructure.com>
Product-Review: Ryan Taylor <rtaylor@instructure.com>
2014-12-01 17:13:57 +00:00
Derek DeVries 1457e26e93 show grader in gradebook history when quiz scores are manually updated
fixes CNVS-16907

test plan:
  - as a teacher
    - create a quiz with a multiple choice question
  - as a student
    - take the quiz
  - as the teacher
    - visit the quiz moderate page
    - choose the student's submission
    - change the grade
    - visit the gradebook history page for the course
    - it should show the correct name for the teacher that changed the grade
      (previously it would always say 'Graded on Submission')

Change-Id: Ie382a3cb06cd695482e3ef1494d8fc91b1ca9bd5
Reviewed-on: https://gerrit.instructure.com/44960
Reviewed-by: Ryan Taylor <rtaylor@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Trevor deHaan <tdehaan@instructure.com>
Product-Review: Matt Fairbourn <mfairbourn@instructure.com>
2014-11-26 20:15:11 +00:00
Ahmad Amireh fd6da9e2f8 Quiz API - "only after last attempt" in show correct answers
Closes CNVS-16905

TEST PLAN
---- ----

  - create a quiz with multiple attempts allowed (>1) and check the
    option to Show Correct Answers
  - use the API to update the new parameter
    "show_correct_answers_last_attempt" with a value of `true`
    + verify the setting is accepted
  - disable multiple attempts
    + if you make the API request again, the setting should be ignored
  - re-enable multiple attempts, but disable "show correct answers"
    + if you make the API request again, the setting should be ignored

...

  - check the Quizzes API docs, the new parameter should be documented
    in both the Quiz Object synopsis and the "Create a quiz" endpoint
    docs

Change-Id: I1a059c07c44cd7905e491996f20ec4fab4f083fc
Reviewed-on: https://gerrit.instructure.com/44676
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Finney <bfinney@instructure.com>
QA-Review: Trevor deHaan <tdehaan@instructure.com>
Product-Review: Ahmad Amireh <ahmad@instructure.com>
2014-11-26 18:17:32 +00:00
Ryan Taylor 0bdfd21310 Prevents blank answers on Fill in Blank question types
Blank answers for a fill in the blank question type aren't very helpful,
and silently slid into a quiz.  If a student enters a blank, they
weren't necessarily penalized for being incorrect.  This prevents blank
answers from entering the DB for these question types.
Note:  This modifies the instructure rails notifications as they
interact with screenreaders.

Closes CNVS-15383

Test Plan:
  - Two question types:
      - Fill in the blank
      - Multiple fill in the blank
  - Confirm JS alert when attempting to save questions with no valid answers
  - Confirm extra blank answers aren't saved into the database
  - Test highlighted text messages rendered as notifications from this
    link:
    https://docs.google.com/a/instructure.com/spreadsheets/d/1KiNh9D30IzNGw6Q_H-DrL2CqYmNWE0qEq_NgVj3ists/edit?usp=sharing

Change-Id: Iba18ad3db8321538fa6c959df22b461399474174
Reviewed-on: https://gerrit.instructure.com/43554
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Derek DeVries <ddevries@instructure.com>
QA-Review: Trevor deHaan <tdehaan@instructure.com>
Product-Review: Ryan Taylor <rtaylor@instructure.com>
2014-11-26 16:07:05 +00:00
Ahmad Amireh 7b74b9887d Quiz stats cleanup
Removed a couple of fields we're not using from the API and adjusted the
docs. Also added reminders for things to drop once new stats replaces
the legacy version.

Closes CNVS-16519, CNVS-13387

TEST PLAN
---- ----

  - generate the API docs, `bundle exec rake doc:api`
  - check out the quiz stats docs, it should no longer be marked in beta
  - two fields were dropped from the API: "user_ids" and
    "logged_out_users" in the "submission_statistics" set
  - turn on the new stats feature flag and visit the stats page, verify
    it loads fine

Change-Id: I16603d4f67fc334ebb994ec6e9363bdb94002e64
Reviewed-on: https://gerrit.instructure.com/44674
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Finney <bfinney@instructure.com>
QA-Review: Trevor deHaan <tdehaan@instructure.com>
Product-Review: Ahmad Amireh <ahmad@instructure.com>
2014-11-24 18:08:19 +00:00
Derek DeVries b9aad3fd0b raise exception if a quiz submission doesn't save successfully during generation
fixes CNVS-16463

test plan:
  - as a teacher
    - create a quiz
  - as a student
    - you should be able to successfully take the quiz

Change-Id: I233d093b9c45217de488a933ebe65b75b44e9d16
Reviewed-on: https://gerrit.instructure.com/44482
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Ryan Taylor <rtaylor@instructure.com>
QA-Review: Trevor deHaan <tdehaan@instructure.com>
Product-Review: Derek DeVries <ddevries@instructure.com>
2014-11-21 05:04:45 +00:00
Ahmad Amireh 1bb148ae61 QLA - QuestionAnswered
Support for extracting and recording "question_answered" events from
submission_data. Unlike the other event patches, this takes place
completely on the back-end.

Closes CNVS-16802

Other things:

  - refactored stuff to use QuizSubmission#graded?
  - QuizQuestion::AnswerSerializers now output string IDs

TEST PLAN
---- ----

You need a database browser for this, like pgadmin3 [1].

Preparation:

  - create a quiz with ALL question types
  - using pgadmin3, view the data in the quiz_submission_events_2014_XX
    table (XX would be the current month), keep this window open
    + this window should be empty so far, unless you're repeating this
      plan

  - go to take quiz page
  - do anything useful to trigger the initial backup call:
    + verify that there's a new record with "event_type" is
      "question_answered"
    + grab the "event_data" in that column and paste it in some JSON
      editor like http://jsoneditoronline.org/ [2]
    + verify that this data-set includes the initial answers for ALL
      questions

Ok, now we need to test whether each answer we update gets recorded:

  - in any question, change your answer
  - open the pgadmin3 table window
    + refresh, press F5
    + verify there's a new event record
    + copy/paste the "event_data" in the JSON editor and:
      - verify that not ALL the answers were recorded again, ONLY the
        one that you have just added/changed/updated

Rinse and repeat with the rest of the questions. Make sure that answers
to *all* question types are being recorded (this includes File Upload,
in which case the value would be the attachment ID.)

[1] pgadmin3 works on all platforms, download it for OS X from
    http://www.pgadmin.org/download/macosx.php
[2] when copying from pgadmin3, it may wrap the JSON with '' and that
    will cause an error in the editor, just remove those quotes

Change-Id: I3330bd987396aa84937af295390ec169b06c58e9
Reviewed-on: https://gerrit.instructure.com/44335
Reviewed-by: Derek DeVries <ddevries@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Trevor deHaan <tdehaan@instructure.com>
Product-Review: Ahmad Amireh <ahmad@instructure.com>
2014-11-21 02:57:46 +00:00
Michael Nomitch 3347ca8df2 DA - avoid seq scans in scopes
test plan:
  - with DA on and OFF
  - assignments & discussions & quizzes & modules indices load
    and filter properly for students/teachers
  - assignments needing submitting/grading load and
    filter properly
  - grade summary page for students & teachers loads
    and filters assignments properly

Change-Id: Ibff8ff0357360a7e09d500c2475885f3dfb7f495
Reviewed-on: https://gerrit.instructure.com/44215
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2014-11-19 15:41:47 +00:00
Ahmad Amireh 26d7cb06c3 Quiz Reports API - force regeneration
Extends the quiz reports API with the ability to re-trigger failed CSV
generation jobs, and to abort them completely. The UI is extended to
utilize those new APIs.

Closes CNVS-16525

TEST PLAN
---- ----

  - create a quiz with a file upload question
  - take the quiz by a student and upload a file, then submit
  - turn on new stats and go to new stats page
  - click the "Student Analysis" report generator button and verify that
    the CSV file is generated and you get prompted to save it

Now... we break the student's submission by removing the attachment and
then the student analysis will start failing to generate.

Launch a rails console and perform the following command:

[ 'Quizzes::QuizSubmission', 'Quizzes::QuizStatistics' ].each do |type|
  Attachment.where({ context_type: type }).last.destroy!
end

  - reload the stats page
    + the "Student Analysis" button should now read that it had never
      been generated, that's right because we just removed the CSV file
      attachment using the console
    + try generating the report again
      - verify that it blows up
    + you should now see a notification as in the screencast
      - clicking the "retry" link should retry generating the report
        (which will fail again)
      - clicking the "cancel" link should remove the notification
      - clicking "Dismiss" should dismiss the notification, but if you
        reload the page, it's still there

Change-Id: I467a9030c3ef94d685ec20b31dd533e530e24758
Reviewed-on: https://gerrit.instructure.com/43862
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Trevor deHaan <tdehaan@instructure.com>
Reviewed-by: Derek DeVries <ddevries@instructure.com>
Product-Review: Derek DeVries <ddevries@instructure.com>
2014-11-12 22:49:38 +00:00
Ahmad Amireh da11cb0cbd QuizLogAuditing - JS core
- workflow for modular event tracking
- two basic event trackers: PageFocused and PageBlurred
- events are buffered, and are stored in localStorage when possible
  - they will also be (re)loaded when the page is reloaded
- events can be submitted in bulks to the API

backend changes:

  - renamed "answers" column to "event_data"; answers is now an alias
    for nicer API when dealing with EVT_QUESTION_ANSWERED events
  - renamed EVT_ANSWERED to EVT_QUESTION_ANSWERED for consistency with
    how we're naming events
  - API now accepts and stores the "event_data" attribute
  - The optimizer in the Snapshot parser is now more aggressive; it will
    do as many passes as needed to achieve 0 data redundancy

Closes CNVS-16177

TEST PLAN
---- ----

  - create a quiz
  - take it
  - open the developer's console, go to the Resources tab and also leave
    the console open (i left some messaging in to make this easier)
    - move the cursor out of the window then back in
    - look at the console, you should see messages like
      "Enqueuing event ... for delivery"
    - click the little reload/refresh icon in the dev tab
      + verify you see an entry called "qla_events"
      + the value of this entry should be a JSON that looks something
        like what's shown below
    - in a few seconds, if you look at the Network tab, you will notice
      a request to a URL like
      "/api/v1/courses/1/quizzes/1/submissions/1/events"
    - (optional) look up the records in the database and verify they
      make sense (don't really need to do this if the request was
      successful :)

Sample of PageFocused and PageBlurred events serialized in localStorage:

    [
      {
        "type": "page_focused",
        "created_at": "2014-10-09T14:55:50.887Z"
      },
      {
        "type": "page_blurred",
        "created_at": "2014-10-09T14:55:51.131Z"
      }
    ]

Change-Id: I7efbbef281faece5df90f09c299bfa3260abcff6
Reviewed-on: https://gerrit.instructure.com/42466
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Trevor deHaan <tdehaan@instructure.com>
Reviewed-by: Derek DeVries <ddevries@instructure.com>
Product-Review: Derek DeVries <ddevries@instructure.com>
2014-11-11 22:25:02 +00:00
Ahmad Amireh cb498b345f canvas-partman & quiz log auditing partitioning
A small gem for abstracting partitioning at the model layer, as well as
helpers for dynamically creating the partitions needed for quiz
submission events.

You can read more about the gem's API in its README file.

Closes CNVS-16795

TEST PLAN
---- ----

  - check out the patch
  - run `bundle exec rake db:migrate`
  - run `bundle exec rake canvas:quizzes:create_event_partitions`
  - run the rails server and visit any page:
    + if you got this far, and jenkins has passed, things are good

Change-Id: I7d6b77c62db8510e09a54fbae00048a14b5366bb
Reviewed-on: https://gerrit.instructure.com/44145
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Trevor deHaan <tdehaan@instructure.com>
Reviewed-by: Derek DeVries <ddevries@instructure.com>
Product-Review: Ahmad Amireh <ahmad@instructure.com>
2014-11-11 19:06:00 +00:00
Derek DeVries 14591b07ad remove non-draft-state features from quizzes
fixes CNVS-16048

test plan:
  - do regression testing around publishing / unpublishing quizzes
    - all publishing / unpublishing scenarios should work correctly
    - make sure to check publishing on:
      - quizzes#index
      - quizzes#show
      - from modules
      - from module items
    - make sure that warnings about unpublished quizzes work
    - make sure that warnings about not being able to unpublish quizzes with
      submissions work
    - make sure that the module sequence footer still works on the quizzes page
    - make sure we can still review published quizzes in speedgrader

Change-Id: I1112e3b28ed6388077bfc165056bb1ab0d84b3fd
Reviewed-on: https://gerrit.instructure.com/42258
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Trevor deHaan <tdehaan@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2014-11-10 19:15:24 +00:00
Cody Tanner fcaedde451 adds checkbox to quiz/show_answers to show correct answers on last attempt
closes PFS-201, PFS-202, PFS-203

Test Plan Happy Path: 
	1) Setup Canvas and run migrations
	2) Create a quiz and set the number of attempts to 2
	3) Check "Let students see their responses"
	4) Check "Let Students see their correct answers"
	5) Check "Only after last attempt"
	6) As a student, take the quiz. On the first attempt verify that you do not see the correct answers.
	7) As a student, take the quiz for the final attempt and verify that you see the answers to the questions.

Change-Id: I6c108174c817959be23770b3dfa9065831907460
Reviewed-on: https://gerrit.instructure.com/43179
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Derek DeVries <ddevries@instructure.com>
QA-Review: Trevor deHaan <tdehaan@instructure.com>
Reviewed-by: Cody Tanner <ctanner@instructure.com>
Product-Review: Cody Tanner <ctanner@instructure.com>
QA-Review: Cody Tanner <ctanner@instructure.com>
Tested-by: Cody Tanner <ctanner@instructure.com>
2014-11-06 21:29:29 +00:00
Cody Cutrer dbc8710802 more no more dynamic finders
Change-Id: Ie8045a76fa9f77e1e9e9d38e421a98fac8ac79b7
Reviewed-on: https://gerrit.instructure.com/43876
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2014-11-05 21:03:40 +00:00
Ryan Taylor 7989bfb1f4 API for Quiz Submission Events
Provides basic features for Quiz Submission Events API.  Will be adding
additional features in time.

Closes CNVS-15663

Test Plan:
  - Post Array of quiz submission events to
    /courses/1/quizzes/18/submission/87/events
  - As owner of quiz_submission
    - Confirm successful (204) responses to quiz answer events posts
  - As anyone else
    - Confirm unauthorized response on attempt

Change-Id: I3a392663fc6508f16600262c2d1fcd346fde64e7
Reviewed-on: https://gerrit.instructure.com/42461
QA-Review: Trevor deHaan <tdehaan@instructure.com>
Reviewed-by: Derek DeVries <ddevries@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Ryan Taylor <rtaylor@instructure.com>
2014-11-05 20:24:03 +00:00
Michael Nomitch 78571b40a5 DA - module evaluation efficiency
fixes CNVS-16367

test plan:
  - go to modules page and change stuff and save
    - things dont break
  - DA'd discussions/assignments/quizzes filter out
    of the modules page for students
  - the page for all student progressions works
    as it should

Change-Id: I8403e4c508169e7f3750f3ddc7494f4a4ed3f371
Reviewed-on: https://gerrit.instructure.com/43113
Reviewed-by: Cameron Sutter <csutter@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Sean Lewis <slewis@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2014-10-28 19:11:47 +00:00
Jon Jensen 9b19b077bb fix submission deadlocks, fixes CNVS-15988
this removes our db triggers and instead uses AR callbacks in conjunction
with after_transaction_commit. this way we won't get processes fighting
over the same assigments tuple.

note that we can't actually remove the hairtrigger gem until we clean up/
remove all those old migrations :-/

test plan:
1. tests should pass (and cover 2. and 3.), but just to be sure...
2. ensure that "assignments needing grading" counts work as expected
3. ensure that quizzes w/ essays don't show as graded in the speedgrader
   until the essays have been graded

Change-Id: I6af67605b18378bd3c181c710ba5027ec944394b
Reviewed-on: https://gerrit.instructure.com/43202
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Hannah Bottalla <hannah@instructure.com>
Product-Review: Jon Jensen <jon@instructure.com>
2014-10-23 23:09:52 +00:00
Derek DeVries 2e69728e2a don't set finish date to end date unless student finished past the end date
fixes CNVS-16328

test plan:
  - as a teacher
    - create a quiz with a single question
    - give the quiz a time limit of 20 minutes
    - visit the moderate page
    - give a student a time extension of 10 minutes

  - as a student (with the extension above)
    - take the quiz and complete immediately
    - the quiz should show the correct finish time

  - make sure there are no regressions in the test plan in:
    https://gerrit.instructure.com/#/c/41236

Change-Id: Icbc65ab1710c84f1b7981710778b3e0af5e54a93
Reviewed-on: https://gerrit.instructure.com/42949
QA-Review: Amber Taniuchi <amber@instructure.com>
Reviewed-by: Josh Simpson <jsimpson@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Derek DeVries <ddevries@instructure.com>
2014-10-18 23:54:21 +00:00
Michael Nomitch 4e791b941b DA - more refactoring
- cleans up assignment model
- eliminates unnecessary feature flag checks
- eliminates unnecessary teacher permission checks
- moves duplicated methods from assignment and quiz
  to new module

Change-Id: I8d1e8f99bf5c8f6a63bd670b432aeef7e8f0e86b
Reviewed-on: https://gerrit.instructure.com/41654
Reviewed-by: Cameron Sutter <csutter@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Sean Lewis <slewis@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2014-10-08 16:32:18 +00:00
Cameron Sutter 4a80953544 DA - permissions
fixes CNVS-15852

test plan:
 * setup DA
 * for assignments
   - as a student, submit an assignment
   - as a teacher, remove visibility from that student
   - as a student, type in the url (/courses/:id/assignments/:id/submissions/:id)
     for your submission for that assignment
   > there should not be a link to resbumit the assignment
 * for discussions
   - as a student, using the API
   > you should not be able to reply to a discussion for which you do not have
     visibility

Change-Id: Ia4669626c745aac02ac9830865c5a5b2fd75cc37
Reviewed-on: https://gerrit.instructure.com/41947
Product-Review: Hilary Scharton <hilary@instructure.com>
Reviewed-by: Mike Nomitch <mnomitch@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Sean Lewis <slewis@instructure.com>
2014-10-07 20:36:51 +00:00
Ahmad Amireh 4997e5446a Quiz question integrity after regrade
The problem was that quiz questions were going through some
transformations when generated for a submission, but those
transformations were not applied when we re-generated the questions from
a regrade. This patch makes those xforms happen in both phases.

Closes CNVS-15727

TEST PLAN
---- ----

  - create a quiz with two questions, the second being like MChoice
  - modify the title of the second question
  - take the quiz by a student
  - edit the quiz, and the question, and choose a different answer (and
    make sure it's not what you picked, so you get affected)
    - choose the option to only give full credit to ones who chose the
      *new* answer (again, so the student sub gets affected)
  - reload the student view of the submission and verify:
    - you see the "This question has been regraded." banner
    - you see Question 1 and Question 2 as titles
    - you see the same thing (for titles) from the teacher's perspective

Change-Id: I43a9edc03a381efa0d1c2ccfc7705d0ba912184b
Reviewed-on: https://gerrit.instructure.com/41906
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Derek DeVries <ddevries@instructure.com>
QA-Review: Trevor deHaan <tdehaan@instructure.com>
Product-Review: Derek DeVries <ddevries@instructure.com>
2014-10-06 22:46:29 +00:00
Cody Cutrer dacf060160 no more dynamic finders
fixes CNVS-15126

Change-Id: I48b99ff69942463df6d6c355fe6f8a2fc679e69a
Reviewed-on: https://gerrit.instructure.com/41969
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2014-10-03 16:22:49 +00:00
Ahmad Amireh 63a5a8ac4c Extract events from quiz submission snapshots
Closes CNVS-15880

- a new model, QuizSubmissionEvent, for tracking events done during a
  quiz-taking session
- utilizes the quiz question answer serializers to maintain JSON
  representations of the students' answers, which are stored in the
  :answers DB column (also in JSON)
- events can be optimized to track only what has really changed between
  snapshots of a quiz submission
- all exported records are tagged with the "answered" event type (this
  is currently all we have without josh's patch)
- a few fixes were needed for the serializers to function, primarily
  adding (no)support for FileUpload and TextOnly questions so they don't
  blow up

Extras:

- a new convenience rake task, canvas:quizzes:dump_events that can be
  used by support to produce a JSON dump of all the events in a single
  quiz submission (for tracking student behavior)
- another rake task, canvas:quizzes:generate_events_from_snapshots, for
  use by developers for migrating data in QuizSubmissionSnapshots to
  QuizSubmissionEvents for a single quiz (or many). This will hit the DB

TEST PLAN
---- ----

There's no UI in this commit, only touches the DB. You can still test if
you like:

  - make sure you got some data logged before you check out this patch:
    + create a quiz and take it by a student, choose different answers
      so you log some actions, and then:
  - check out the patch
  - run `bundle exec rake db:migrate`
  - run the command below[1] to generate a JSON dump of the events and
    view it for integrity

[1] bundle exec rake canvas:quizzes:dump_events[quiz_submission_id,out]
    - replace "quiz_submission_id" with the ID of the student submission
    - replace "out" with some path to store the JSON in, like
      "./events.json"

Change-Id: Ifd8a43a66aba99780428623b956d868d87e53215
Reviewed-on: https://gerrit.instructure.com/41999
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Derek DeVries <ddevries@instructure.com>
QA-Review: Trevor deHaan <tdehaan@instructure.com>
Reviewed-by: Ryan Taylor <rtaylor@instructure.com>
Product-Review: Ahmad Amireh <ahmad@instructure.com>
2014-10-01 21:23:47 +00:00
Michael Nomitch 8893003b1e DA - quiz messaging
fixes CNVS-15716

test plan:
  - with DA on
    - make a sel_rel'd quiz
    - on the quiz show page, click message_students_who
      - students without visibility should not show up
    - send a message
      - make sure only students with visibility get it
    - on the show page, click "Show Student Quiz Results"
      in the gear menu
      - students without visibility should not show up
  - with DA off
    - repeat the above steps but ensure all students
      show up/get the message

Change-Id: I202599a9a0c26430075c2056b553c03a908b0dfd
Reviewed-on: https://gerrit.instructure.com/41545
Reviewed-by: Cameron Sutter <csutter@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
QA-Review: Sean Lewis <slewis@instructure.com>
Product-Review: Mike Nomitch <mnomitch@instructure.com>
2014-10-01 21:01:28 +00:00
Michael Nomitch 0a5e71d28e DA - quizzes
fixes CNVS-14094

test plan:
  - course with DA as students and teacher
    - api show & index
    - quizzes index page shows only assigned quizzes
    - quizzes show page url redirects to index if
      quiz isnt visible to user
    - grade calculation
    - gradebook/grades page
    - calendar events events
    - modules filter out quizzes correctly
    - observers see same things as their students
    - if a student takes a quiz and it is not graded and then
      loses visibility, make sure that the GB greys out the cell
      rather than showing a submission icon
  - same course with DA off works normally

Change-Id: I10b936f1516d6d24f11d74c0bb572051f0b1d1c4
Reviewed-on: https://gerrit.instructure.com/39897
Reviewed-by: Simon Williams <simon@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Mike Nomitch <mnomitch@instructure.com>
Reviewed-by: Derek DeVries <ddevries@instructure.com>
Product-Review: Mike Nomitch <mnomitch@instructure.com>
2014-10-01 20:58:54 +00:00
Ryan Taylor 1c6eaa8d5d Controller/model features for Outstanding Quiz Submissions
Outstanding quiz submission management is now contained in a dedictated
model, and this controller action provides access to the quiz scoped
actions of #search and #grade.  The API endpoint provides JSON access to
these actions.
Closes CNVS-15501
Test Plan:
  - Create quizzes with outstanding (unclosed, but overdue) quiz submissions
  - Hit the endpoint
  /api/v1/courses/:course_id/quizzes/:quiz_id/outstanding_quiz_submissions
  - GET JSON to retrieve quiz_submissions which are outstanding
  - POST JSON with something like {"quiz_submission_ids": [1,2,3,4]} to grade the QS
Change-Id: I7fe0341379d4dbd70ed25c667bd1c4dc7969b077
Reviewed-on: https://gerrit.instructure.com/41229
Reviewed-by: Derek DeVries <ddevries@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Trevor deHaan <tdehaan@instructure.com>
Product-Review: Ryan Taylor <rtaylor@instructure.com>
2014-09-30 19:46:01 +00:00
Cody Cutrer 102fdfc849 no more dynamic finders (models)
refs CNVS-15126

Change-Id: I2996e0e262c41274c34d0ea3bfde757074416b8c
Reviewed-on: https://gerrit.instructure.com/40973
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2014-09-24 20:51:48 +00:00
Ahmad Amireh 5e78d3d223 Quiz: LDB requirements fix
LDB can not be required to view the results if it's not required to
actually take the quiz, as is consistent with what the setting page
shows.

Closes CNVS-4832

TEST PLAN
---- ----

  - enable LDB plugin if you need to
  - create a quiz with the LDB options checked (both to take and view
    results), and make sure it allows multiple attempts
  - save and go to the quiz page (as a teacher)
    + verify you see the LDB columns reading "Yes"
  - edit the quiz, turn off the LDB requirement to view the results
    + verify you see only the first LDB column reading "Yes"
  - turn them off completely
    + verify you see both columns reading "No"

> Student experience test

  - turn back both LDB options on
  - visit the quiz as a student in a regular browser
    + verify you can not take the quiz
  - turn both options off
    + verify you can take the quiz now
    + take it
      - verify you can see the results
  - turn back on the option to require LDB for taking the quiz
    + verify you can no longer re-take it, but can still view the
      results
  - turn back on the option to require LDB for viewing the results
    + verify you can no longer view the results either

Change-Id: Ie82a75b4d028c05d2feddaea14f638e2a82cc697
Reviewed-on: https://gerrit.instructure.com/41235
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Ryan Taylor <rtaylor@instructure.com>
Reviewed-by: Derek DeVries <ddevries@instructure.com>
Product-Review: Matt Fairbourn <mfairbourn@instructure.com>
QA-Review: Matt Fairbourn <mfairbourn@instructure.com>
Product-Review: Ahmad Amireh <ahmad@instructure.com>
2014-09-22 15:18:36 +00:00
Ahmad Amireh cb7bdbbea9 Quiz taking: reliable auto-submission
The big change: on browsers that support it (everything except IE8 and
9), we now use a Web Worker for time-limit checks. This is much more
reliable cross-browser than plain setInterval() when tabs are
inactivated as the workers are spawned in an actual background thread
and run until the parent page is killed.

This not only has the benefit of updating every X seconds consistently,
but it will also make sure the quiz is submitted when time is out, even
if the student isn't looking at the Canvas page.

The second change is a secondary defense line: when we submit, we use
either the current time, or the time at which the quiz session should've
timed out, to not confuse support that the student seems to have had
extra time when it was really just JS code being stalled.

Closes CNVS-8463

NEW STUFF
--- -----

  - r.js plugin for loading web-workers, if browser support exists,
    otherwise returns null so you can define fallback code

TEST PLAN
---- ----

  - create a quiz with 1 minute time limit
  - in Chrome, open the console tab, right click and enable the "Log
    XMLHttpRequests" option so you can see the requests we're making to
    the Canvas API
  - start taking the quiz by a student, and keep watching the console
  - tab away to some other page
    + after like 10 seconds, go back to the quiz page and verify you see
      the timer has reached 50 seconds or so
  - sleep for a while until the countdown has reached like -7 seconds
    + tab back and verify you see the "Auto-submitting in ..." dialog
    + tab away!!!
      - in 7-10 seconds, if you watch the console, you will see that the
        quiz is auto-submitting
      - if you go back to the tab, you will also see that you are no
        longer on the quiz-taking page, but are instead redirected back
        to the quiz page just as if you were on that tab

Change-Id: I640b1124de1c397dc7d7b8a2317f66917aa9328c
Reviewed-on: https://gerrit.instructure.com/41236
Reviewed-by: Derek DeVries <ddevries@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Trevor deHaan <tdehaan@instructure.com>
Product-Review: Derek DeVries <ddevries@instructure.com>
2014-09-18 21:41:27 +00:00
Ahmad Amireh c00c732f54 Quiz stats: escape HTML in answers in SA CSV
Closes CNVS-9167

TEST PLAN
---- ----

  - create a quiz with the question types listed in the ticket
  - take the quiz as a student and fill in answers like these:
    + <em>fill in the blank</em>
    + <em>fill in multiple blanks</em>
    + ...
  - visit statistics page and generate student analysis report CSV
  - open the sheet and verify the answers do not include the <em />
    tags, only the text within

Change-Id: I1523578801e27beeb4b29394fdcba93fdbda9bd4
Reviewed-on: https://gerrit.instructure.com/41234
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Ryan Taylor <rtaylor@instructure.com>
QA-Review: Trevor deHaan <tdehaan@instructure.com>
Product-Review: Ahmad Amireh <ahmad@instructure.com>
2014-09-18 16:21:28 +00:00
Ahmad Amireh aed232828e Always shuffle quiz matching question matches
Closes CNVS-4342

TEST PLAN
---- ----

  - create a quiz with:
    + a matching question and 3 pairs of answers/matches and a bunch of
      distractors
    + infinite multiple attempts
    + shuffle answers option turned OFF
  - take the quiz by a student:
    + look at the order of the matches
    + submit and re-take
      + verify that the order of the matches has changed (if not, you
        may just been hit by the RNG wand, try again)
  - turn on the option to shuffle answers and verify the matches still
    shuffle like they did without the option

Change-Id: I492fa15f168ff26c50b1300d79ff0c589e626fe2
Reviewed-on: https://gerrit.instructure.com/41237
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Ryan Taylor <rtaylor@instructure.com>
QA-Review: Trevor deHaan <tdehaan@instructure.com>
Product-Review: Ahmad Amireh <ahmad@instructure.com>
2014-09-18 14:53:37 +00:00
Ryan Taylor 1c76ff61a9 Quizzes only autosubmit when they hit the lock date
When a quiz is in progress, it should be marked late if the student is
still taking the quiz when the due date is reached.  If the lock date
comes up, the quiz should autosubmit at that point.  If there is a quiz
timer and a lock date, the lock date overrules the quiz timer.

Closes CNVS-13689

Test Plan:
  - Create 4 types of quiz scenarios:
    - Lock date only
      - submits at lock date
      - never marked late
    - Lock date and due date
      - autosubmits at lock date
      - late if submitted after due date
    - No due date
      - Never late
      - Autosubmits at course completion
    - Lock date and timer which runs beyond lock date
      - Gives the student time until lock, not normal timer
      - autosubmits at lock date
  - Monitor all these for sane prompts and alerts
    - deadline approaching flash messages for LATENESS (occur at T-30
      minutes, T-5 minutes, and T-1 minute)
    - autosubmission flash prompts (and popup @ T-10 seconds)

Change-Id: I5af9eb360a5f13527b32e7f84c205149bea1935b
Reviewed-on: https://gerrit.instructure.com/40609
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Derek DeVries <ddevries@instructure.com>
QA-Review: Trevor deHaan <tdehaan@instructure.com>
Product-Review: Ryan Taylor <rtaylor@instructure.com>
2014-09-16 19:50:40 +00:00
Ryan Taylor a50d334754 Model features for outstanding quiz detection
When quiz submissions are overdue and unsubmitted, we need to provide a
teacher with the means to find and fix those problems. Here we've built
the model access features to enable finding and grading of these
submissions, by quiz_id.
Closes CNVS-15274
Test Plan:
  - Confirm passing specs
    - No real QA testable features here
      - Confirm normal quiz submission behavior
Change-Id: I72c6bd2fc740c31c901e29d26eba9fe87a6baba2
Reviewed-on: https://gerrit.instructure.com/40821
Reviewed-by: Ahmad Amireh <ahmad@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Trevor deHaan <tdehaan@instructure.com>
Product-Review: Ryan Taylor <rtaylor@instructure.com>
2014-09-16 15:45:21 +00:00
Ahmad Amireh fe0e9ea24a Quiz index: auto-grade all outstanding course subs
Closes CNVS-15402

TEST PLAN
---- ----

  - create 2+ quizzes in a course
  - make some submissions, don't turn them in
  - go to quizzes index
  - verify your submissions are now graded (you may have to wait a bit
    since it's done in a background job)

Change-Id: I80af5523f7549120ca81a5029d9681ddd511bb2b
Reviewed-on: https://gerrit.instructure.com/40862
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Ryan Taylor <rtaylor@instructure.com>
Reviewed-by: Derek DeVries <ddevries@instructure.com>
QA-Review: Trevor deHaan <tdehaan@instructure.com>
Product-Review: Derek DeVries <ddevries@instructure.com>
2014-09-10 20:14:17 +00:00
Ryan Taylor 3b267b559b Course Quiz Extension: A course level quiz extension API
ProServe wants an API endpoint for their LTI which allows for editing of all quizzes
contained in a course similar to that provided by the Quiz Extensions
API endpoint.  This provides the ability to edit all quizzes at the
course level with the same type of parameters.

Closes: CNVS-14950

Test Plan:
  - Access /api/v1/courses/:course_id/quiz_extensions with POST
  - Pass quiz extensions parameters
  - Confirm that all quizzes are edited with the appropriate parameters

Change-Id: Ifca1a4937ab356665627ef3f0aa829aeeaddedc7
Reviewed-on: https://gerrit.instructure.com/40331
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Derek DeVries <ddevries@instructure.com>
QA-Review: Trevor deHaan <tdehaan@instructure.com>
Product-Review: Ryan Taylor <rtaylor@instructure.com>
2014-09-05 16:26:07 +00:00
Ahmad Amireh 1c03e40aae quiz index optimizations
Closes CNVS-15109, CNVS-15173

CHANGES
-------

  - "auto-grading" of due submissions that was previously done
    synchronously in the index action is now done in a DJ
  - when viewing the index page, you don't get to see due/available
    dates on load, instead the dates are fetched on the client-side and
    load progressively
  - new API endpoint for retrieving assignment overrides for a bunch of
    quizzes at [GET] /courses/:course_id/quizzes/assignment_overrides
  - we now cache the user's quiz permissions
  - Canvas AMS API serializer now accepts a new option, see docs
  - QuizSerializer behavior changed radically:
    - "takeable", "submitted_students", "unsubmitted_students"  disabled
    - all associations disabled including the submission, assignment
      group, and any student participants
    - it can now utilize preloaded permissions

Rationale behind disabling things in the serializer is that these were
exclusive for the "show" action, so the next step forwards is to
allow the serializer to recognize different "modes" for output (e.g, for
index and one for show) and tailor the associations/fields accordingly.
Using "#filter" right now isn't cutting it, because assocs get loaded
anyway.

REFACTORING
-----------

  - broke down index into three actions for visibility:
    1. default, Draft-State version
    2. legacy non-DS version that's not reachable in the UI, kept around
       until we upgrade the tests
    3. ember version
  - legacy non-DS ERB code goes into its own file
  - moved code that used to grade due submissions inside index to
    SubmissionGrader in preparation to remove it from there entirely
  - cleaned up internal docs for the Canvas AMS api serializer

TEST PLAN
---- ----

  - create ~30 quizzes
    + make one of them have many questions
    + make a good number of submissions (i tested with 420 and 20
students)
  - create multiple sections
    + specify date overrides for certain sections, and have at least one
      student enrolled in that section
  - as a teacher and/or an observer, go to quizzes index
    + verify the page renders fine
    + verify that you see "loading indicators" in the due/available
      field which get replaced with actual dates when they're loaded
    + verify it's faster than the version in master (should be at least
      60% faster)
  - as a student in the general section, go to quizzes index
    + verify the page renders
    + verify you see the same loading behavior for dates as in teacher
      view
  - as a student in one of the section with overrides, go to index:
    + verify you see the overridden date

Change-Id: I741d89625da1b858148baa95e881fcc75c1802e5
Reviewed-on: https://gerrit.instructure.com/40350
Reviewed-by: Derek DeVries <ddevries@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Trevor deHaan <tdehaan@instructure.com>
Product-Review: Ahmad Amireh <ahmad@instructure.com>
2014-09-05 14:20:38 +00:00
Ryan Taylor df4c41a48d Regrade events do not show up in the Gradebook History
Regrade events are not shown in the gradebook history.  Adding this
feature will provide a simple and convenient way to see ALL grading
events in one place.

Fixes CNVS-8590

Test Plan:
  - Create a quiz event
  - Take the quiz with a student
  - Regrade the quiz as an instructor
  - Confirm that regrades are shown in the gradebook history

Change-Id: I3925f0fefaf80f0426427c774b0fc63835d1f317
Reviewed-on: https://gerrit.instructure.com/39977
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Derek DeVries <ddevries@instructure.com>
QA-Review: Trevor deHaan <tdehaan@instructure.com>
Product-Review: Ryan Taylor <rtaylor@instructure.com>
2014-08-28 22:36:34 +00:00
Derek DeVries 622d811c64 fix issue when restoring a deleted quiz with student submissions
fixes CNVS-15098, CNVS-15079

test plan:
  - as a teacher
    - create a quiz
    - publish the quiz

  - as a student
    - take the quiz

  - as a teacher
    - delete the quiz
    - attempt to restore the quiz
    - the quiz should restore successfully

Change-Id: I5111e5beeb6debbb43a587689251e2fb62a8d3bc
Reviewed-on: https://gerrit.instructure.com/40159
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Ahmad Amireh <ahmad@instructure.com>
QA-Review: Trevor deHaan <tdehaan@instructure.com>
Product-Review: Derek DeVries <ddevries@instructure.com>
2014-08-28 18:51:26 +00:00
Ryan Taylor ebc19f7409 Quizzes and Assignments pass #destroy calls back and forth
While we can't reproduce locally, this code change will cause an
exception in the future which should provide additional information
about what is happening.

Closes CNVS-14864

Change-Id: I80fb1297a1d76c7fdc51715b09dde345e4ab47fc
Reviewed-on: https://gerrit.instructure.com/40117
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Derek DeVries <ddevries@instructure.com>
QA-Review: Trevor deHaan <tdehaan@instructure.com>
Product-Review: Ryan Taylor <rtaylor@instructure.com>
2014-08-28 16:32:59 +00:00
Ethan Vizitei f8b4c9d780 give good messaging when a quiz question is big
fixes CNVS-6983

When submitting a quiz question that's too long,
the response that is "unknown error" which isn't
helpful.  This provides a useful error message.

test plan:
 - Login as a teacher
 - EDIT AN EXISTING quiz question
 - make the question text more than 16384 characters
 - save the question
 - you should get an error that tells you why it can't save
 - CREATE A NEW quiz question
 - make the question text more than 16384 characters
 - save the question
 - you should get an error that tells you why it can't save

Change-Id: Ida3438a9648c6b8c61f9e4a19c9414f3595a67e8
Reviewed-on: https://gerrit.instructure.com/39748
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Derek DeVries <ddevries@instructure.com>
QA-Review: Trevor deHaan <tdehaan@instructure.com>
Product-Review: Ethan Vizitei <evizitei@instructure.com>
2014-08-28 16:19:16 +00:00
Brian Finney 0d62f0f3a4 Hide quiz answers when term is concluded
Hide quiz answers for courses with concluded term and restrict_quiz_questions is true

Fixes CNVS-13075

Test Plan
 - At the account level, check the option to restrict students from
 viewing quiz questions after course end date.
 - Set a term to end in the near future.
 - Set a course to this term. (NOTE: Do not set course end date within
 the course)
 - Log into this course as the student and take at least one quiz.
 - As the student, go to the completed quiz after the course has
 concluded naturally by term end date passing.
 - You should not see the quiz questions or answers

Change-Id: Ib06c0e2ab94b297ec0d50f0af5af9697bf2ee132
Reviewed-on: https://gerrit.instructure.com/39351
Reviewed-by: Derek DeVries <ddevries@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Product-Review: Brian Finney <bfinney@instructure.com>
2014-08-18 16:06:56 +00:00
Ahmad Amireh a7e979afb3 Preview quiz: show the correct points possible
Closes CNVS-3856

TEST PLAN
---- ----

  - create a quiz with 3 questions with points possible: 0.42, 0.23, 1
  - preview the quiz and get all the questions correctly
    - verify you see "1.65 out of 1.65"
  - retry with failing some questions
    - verify you get the correct score shown

Change-Id: Ib7e830adce26b2c2346eb3a4149e4bc0406a9d35
Reviewed-on: https://gerrit.instructure.com/39295
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Reviewed-by: Ryan Taylor <rtaylor@instructure.com>
Reviewed-by: Josh Simpson <jsimpson@instructure.com>
Product-Review: Ahmad Amireh <ahmad@instructure.com>
2014-08-16 07:47:37 +00:00
Ahmad Amireh 00f6adb248 Quizzes edit form: "Only Once" checkbox fix
A few changes to how the "Let Students See Their Quiz Responses" form
section works:

  - if the "Let Students See Their CAs" checkbox is on:
    + we show the date-pickers like usual
    + if the "Only Once" checkbox is turned on:
      - we still show them, but they're disabled (teacher can't use,
        dates don't go through to the backend)
  - if it's off:
    + we totally hide the date-pickers

The primary fix was that the "Only Once" checkbox is no longer tied to
the correct-answer visibility fields, but instead to the
result-visibility fields (which is consistent with how the form looks
like). The back-end will also ignore the showAt/hideAt dates if that
option is turned on.

Closes CNVS-14641

TEST PLAN
---- ----

  - go to edit quiz
  - verify the UI behavior is as described in the top of this message
  - uncheck the "Let Students See Their Correct Answers" option
  - check the "Only Once After Each Attempt" option
  - save
    + verify your options were saved properly

Change-Id: I4587bcb748e238bf351e90e6707e6244aa3289b7
Reviewed-on: https://gerrit.instructure.com/39190
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Josh Simpson <jsimpson@instructure.com>
QA-Review: Trevor deHaan <tdehaan@instructure.com>
Product-Review: Ahmad Amireh <ahmad@instructure.com>
2014-08-13 16:15:35 +00:00
James Williams 81558f728c remove rails 2 support
closes #CNVS-14261

Change-Id: I1b0e8a4438ab659ecd1ac8462bc3559d810989b3
Reviewed-on: https://gerrit.instructure.com/38744
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2014-08-06 18:16:19 +00:00
James Williams 29fba6ecb9 don't create an extra assignment on import in draft state
test plan:
* import the package referenced in the ticket into a
 draft-state enabled course
* should not have extra assignments created in the
 default "Assignments" group

closes #CNVS-13345

Change-Id: I7debc455014b5a44fe2026d85de8b58ad4ae89fb
Reviewed-on: https://gerrit.instructure.com/38673
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Clare Strong <clare@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2014-08-06 16:04:12 +00:00
Ahmad Amireh d016f08193 Quiz Stats - Account for fudge points
Fudge points were not considered because we were manually summing up the
points for each individual question. The patch makes it so that we use
the pre-calculated #score field for the submission.

Closes CNVS-13645

TEST PLAN
---- ----

  - create a quiz with 1 question with 2 points possible
  - take it by a student and answer it correctly
    - visit quiz stats, verify the numbers are now 2
  - add a -1 fudge point
    - visit quiz stats, verify that the low/high/avg scores are 1
  - manually grade the question up to 2.5 from 2
    - visit quiz stats, verify the numbers are now 1.5

Change-Id: I4341a6241b2c94b654b2ddce4439e4cbb71344e8
Reviewed-on: https://gerrit.instructure.com/38668
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Reviewed-by: Derek DeVries <ddevries@instructure.com>
Product-Review: Derek DeVries <ddevries@instructure.com>
2014-08-05 15:15:28 +00:00
Ahmad Amireh 7df6a55a34 Quiz Stats - don't count Student View submissions
QuizSubmission now supports a new scope "for_students" that will grab
all submissions that are:

  - not a teacher preview
  - not a teacher-initiated "Student View" one
  - submitted by students who really are rolled in a course

Closes CNVS-13694

TEST PLAN
---- ----

  - create a quiz with one question
  - enter Student View via the course settings
    + take the quiz
    + get out of Student View
  - visit the statistics page (or hit the API)
    + verify the attempt is not factored
  - generate the CSV of Item-Analysis to verify that IA does not factor
    these attempts either
  - test the change with Survey quizzes - need to make sure "logged out"
    users are still OK where applicable

Change-Id: Ic58569be31576734eb6e309d548a7415c07e08a7
Reviewed-on: https://gerrit.instructure.com/38174
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jason Madsen <jmadsen@instructure.com>
Product-Review: Ahmad Amireh <ahmad@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
2014-07-29 16:13:44 +00:00
Simon Williams d7ed7a5911 don't set graded_at in the future for quiz submissions
fixes CNVS-14403

test plan:
- create a quiz with a due date far in the future (and no time limit)
- take the quiz as a student
- look at the grade_history api for that user
- the graded_at for the quiz assignment should be when it was submitted, not
  when it was due (in other words, it should be in the recent past, not the far
  future)

Change-Id: I37754b4be5238e240bbc6a9826ea9d7599c9a61f
Reviewed-on: https://gerrit.instructure.com/38154
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Mike Nomitch <mnomitch@instructure.com>
Reviewed-by: Jason Madsen <jmadsen@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2014-07-25 20:12:09 +00:00
Cameron Sutter 79f45f569d DA - quiz edit page
fixes CNVS-9766

test plan:
 * turn on the Differentiated Assignments feature flag
 * from the quiz edit page
  - add a due date for some of the sections, but not all
  - save (update quiz)
  > the only_visible_to_overrides flag on the quiz should be true
  > edit the quiz again and there should not be an
    empty due date row for 'Everyone else'
  - add a due date for all the sections
  - update the quiz
  > the only_visible_to_overrides flag should not be there
  - edit the quiz so that there are only due dates
    for some sections but not all
 * on the normal quiz show page and
 * on the new Quiz Statistics show page
  > there should not be a row in the due date area
    for 'Everyone else'
 - turn off the DA flag and make sure the quiz show page works
   with the 'New Quiz Stats page' flag and without it
 - make sure the edit page works with the DA flag off as well

Change-Id: Ifb090a195ff3283d963df12ae7a9eb503f32ee86
Reviewed-on: https://gerrit.instructure.com/34085
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
Reviewed-by: Mike Nomitch <mnomitch@instructure.com>
Product-Review: Cameron Sutter <csutter@instructure.com>
2014-07-23 14:41:24 +00:00
Ahmad Amireh 8cf0000fa0 Stop counting teacher previews in results
The scope QuizSubmission#logged_out now excludes teacher previews. This
should solve all occurrences of logged-out users mixing up with teacher
preview submissions.

Closes CNVS-7851

TEST PLAN
---- ----

  - create a quiz
  - preview it, submit your attempt
    - click on the "Show Student Quiz Results" and verify that your
      preview attempt does not show up
  - create a survey quiz and verify that we still get to see the
    "Logged Out User" submissions correctly
  - verify we don't have any regressions on quiz stats with teacher
    previews (a simple API should suffice, they're now configured to
    share the same code, so it should work in both places)

Change-Id: I9803a127dd0be6975504e4fe55ccb2acea13d9af
Reviewed-on: https://gerrit.instructure.com/37622
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Derek DeVries <ddevries@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Product-Review: Ahmad Amireh <ahmad@instructure.com>
2014-07-15 14:54:18 +00:00
Ahmad Amireh ab0c410b49 Quizzes - Lock down results after first view
Adds an option to Quiz that prevents the students from seeing their
results more than once after their submission.

Closes CNVS-13877

CHANGES
-------

  - New option in quiz settings:
    "Let Student See Their Responses" => "Only Once After Each Attempt"
  - Teacher can always see the student's results
  - Moderate dialog allows teacher to manually reset the result-locking
    flag, allowing the student one more glimpse
  - The flag is reset whenever a new attempt is taken

TEST PLAN
---- ----

  - create a quiz
  - toggle the new option: "Let Student See Their Responses" then "Only
    Once After Each Attempt"

Turn off Ember/quiz stats:

  - take the quiz by a student, turn it in:
    - verify that you see your results
    - reload the page
      - verify that you no longer see the results
  - take the quiz again:
    - verify you see the results once, then not
  - go to the moderate page as the teacher
    - open the moderate dialog for that student
      - check the new option "Let the student see the results one more
        time"
      - click Save
        - reload the page as the student, verify that you see the
          results

Turn on Ember/quiz stats:

  - repeat the process

Other things to test:

  - verify the new field "has_seen_results" is visible in the
    submissions API and is documented
  - verify the new field "one_time_results" is visible in the quizzes
    API and is documented properly
  - verify that the new option has no effect if the Quiz option is not
    set
  - verify that you can always see the student's results as a teacher
    (the setting should not affect teachers)

Change-Id: I6eb4909f777e038acf6afc9ef2823352f5ea78be
Reviewed-on: https://gerrit.instructure.com/37544
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Derek DeVries <ddevries@instructure.com>
Product-Review: Ahmad Amireh <ahmad@instructure.com>
2014-07-15 09:47:56 +00:00
Ahmad Amireh 0200972541 Quiz Submission Questions - fix serializer lookup
Closes CNVS-14021

TEST PLAN
---- ----

  - create a quiz with a question
  - try answering the quiz using the QSQ API (see docs)
  - verify that your answer is recorded

Change-Id: I667671f639ac0b5c6bc469477b638e70f90f37ff
Reviewed-on: https://gerrit.instructure.com/37372
Reviewed-by: Derek DeVries <ddevries@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Product-Review: Derek DeVries <ddevries@instructure.com>
2014-07-08 19:55:22 +00:00
Cody Cutrer c25317cb86 fix quiz question parsing for non-eager loading
fixes CNVS-13791

with non-eagerloading, the constants might not be present, so we just
have to try to get it, instead of checking if we have it

test plan:
 * in development mode, make sure cache_classes is false
 * create a quiz with a fill in multiple answers question
 * save it
 * preview the quiz
 * it should not page error

Change-Id: Iacdebd972e4b0d6f404e8f0a6a91a8adecb77ca8
Reviewed-on: https://gerrit.instructure.com/37172
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Ahmad Amireh <ahmad@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2014-07-07 16:55:23 +00:00
Ahmad Amireh 29bd44354a Draft-State Quizzes - "Save It Now" should work
Closes CNVS-13730

This patch enables the (re)publishing functionality in DS mode. The
issue was that the internals were relying on "workflow_state_changed?"
to be truthy in order to re-publish the quiz, which is not the usual
case in DS where the quiz's WState is always "available" and doesn't
really change between authoring updates.

A side change: Canvas::DraftStateValidations is now covered and
responsible for adding the required validations to classes that mix it
in.

TEST PLAN
---- ----

  - create a quiz with draft-state on
  - add a question
  - save the quiz, publish it
  - open a tab on the quiz show page and keep it
  - in another tab, edit the quiz, modify the question, hit "Update
    Question" and switch back to the show quiz tab
  - refresh the page, verify you get the "Save it Now" button
    - push the button
    - refresh again
    - verify that the button no longer re-appears, and that your changes
      were actually published (you can do this by taking the quiz as a
      student)

Change-Id: Idf3b4302b23d6abc483b80796fee753b0e6fba85
Reviewed-on: https://gerrit.instructure.com/37303
Reviewed-by: Derek DeVries <ddevries@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Product-Review: Ahmad Amireh <ahmad@instructure.com>
2014-07-07 16:08:38 +00:00
Cody Cutrer 1277aaae90 stabby lambda scopes for rails4
Change-Id: I34f2527471cdb4d8cab5cde426ba959baa26189e
Reviewed-on: https://gerrit.instructure.com/37151
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>
2014-07-04 02:11:56 +00:00
Cody Cutrer 20737f3d74 fix quiz answer serializer loading for cache_classes=false
refs CNVS-13790

the serializers aren't all loaded in development mode, so you can't
rely on them auto-registering themselves. just constantize what the
class name should be.

also fix a module method not being in the correct file, also for
autoloading goodness

Change-Id: Id7da60757c1b7d816fe94e39d57b521e9efb730d
Reviewed-on: https://gerrit.instructure.com/37173
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Ahmad Amireh <ahmad@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Product-Review: Brian Palmer <brianp@instructure.com>
2014-07-03 14:45:49 +00:00
Jon Jensen 256bb3ab0b spec: once-ler spec/models/[i-q]*
in rails3, reduce runtime by 60% (9:45 -> 3:50 locally)

Change-Id: Ibc584966b61d78894f48768cad511cd141c99d1b
Reviewed-on: https://gerrit.instructure.com/37175
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Dave Donahue <ddonahue@instructure.com>
Product-Review: Dave Donahue <ddonahue@instructure.com>
QA-Review: Dave Donahue <ddonahue@instructure.com>
2014-07-02 15:57:40 +00:00
Nick Cloward eea4718d6b clean up calls to cached_context_grants_right?
refs: CNVS-11425

Change-Id: I0487d98b839d33a339592d312ed8ed2134c4b62e
Reviewed-on: https://gerrit.instructure.com/35528
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2014-06-19 18:10:51 +00:00
Nick Cloward e9595976c1 clean up permission calls for grants_rights?
refs: CNVS-11425

Change-Id: Ia0145e4b4d1da9e0f83a1845647ce203b3586057
Reviewed-on: https://gerrit.instructure.com/34280
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2014-06-19 18:10:30 +00:00
Ahmad Amireh 5dfc8a1d93 Quiz Stats - Set sanity limits
This patch makes the API reject generating stats for large quizzes. A
quiz is large based on two configurable settings:

  - quiz_statistics_max_questions (defaults to 100)
  - quiz_statistics_max_submissions (defaults to 1000)

They can be tuned using the console. Something similar to this:

    Setting.set('quiz_statistics_max_questions', 500)

The defaults can be changed by modifying constants in
Quizzes::QuizStatistics.

Closes CNVS-13330

TEST PLAN
---- ----

  - create a quiz with like 10 questions
  - change the setting for the max questions to something like 5
    - verify that you can't get the stats from the API
    - visit ember quiz stats:
      - verify you get a different page, similar to the blank state one
        but with a different message
  - tune it back up to something like 15
    - verify you can now get the stats from the API and can see them in
      ember

Change-Id: I1b0626c1b460974976eec5b184e1b5989f50d210
Reviewed-on: https://gerrit.instructure.com/35561
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Derek DeVries <ddevries@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Product-Review: Derek DeVries <ddevries@instructure.com>
2014-06-13 22:57:44 +00:00
Derek DeVries ffe38fc635 make quiz stats use kept score instead of always using latest score
fixes CNVS-13561

test plan:
  - enable draft state and quiz stats
  - as a teacher
    - create a quiz that allows multiple attempts, and keep highest score
    - publish the quiz

  - as a student
    - take the quiz a first time, and get a perfect score
    - take the quiz a second time and get a worse score

  - as a teacher
    - view the quiz stats
    - it should show results from the kept score, not the latest

  - try this with keeping the highest score as well. Stats should use the
    correct kept score.

Change-Id: I8fb9998e800bfd91f9297a3bc30178f5f31aa59c
Reviewed-on: https://gerrit.instructure.com/36300
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>
2014-06-13 17:46:53 +00:00
Ahmad Amireh 8b9e82ade8 Quiz Stats - don't count teacher previews
Exclude preview quiz submission from student analysis (item analysis was
already accounting for this) based on the "was_preview" field.

Closes CNVS-8203

TEST PLAN
---- ----

  - create a quiz
  - take it as a preview by the teacher
    - request the stats from the API (or visit ember quiz stats)
    - verify that your attempt does not show up
  - take it by a student
    - verify everything is ok
  - now preview it again as a teacher
    - verify your attempt still doesn't add to the stats

Change-Id: I62bf1dd6c0bedb26ee55d029ac0f015b2ad48e91
Reviewed-on: https://gerrit.instructure.com/35954
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Derek DeVries <ddevries@instructure.com>
QA-Review: Clare Strong <clare@instructure.com>
Product-Review: Derek DeVries <ddevries@instructure.com>
2014-06-11 00:24:28 +00:00
Ahmad Amireh 4964865302 Quiz Stats - Whitelist exposed question data
Changes:

  - drops unused attributes from the api output, the only things we
    expose now are question id, type, text, and position (for sorting)
  - drops logic in ember that is no longer necessary
  - stringifies IDs in the serializer output

Closes CNVS-13388

TEST PLAN
---- ----

  - BEFORE YOU CHECK THIS OUT:
    - create a quiz with all question types
    - hit the stats API and save the JSON output in some text file
  - now check this patch out:
    - use the same quiz, hit the stats api
    - verify that each question document in "question_statistics" has
      the following fields beside the metrics:
      "id", "question_type", "question_name", and "position"
    - verify that MChoice/TF questions still contain the "item analysis"
      report data (like point_biserials, etc.)
    - check out the ember quiz stats and make sure everything is OK

Note: i found a small tool that can help you see the differences in the
API output if you push the old JSON and the new one into it: try it out
maybe it will make things easier: http://tlrobinson.net/

Note 2: the docs are really out-of-date now and need to be adjusted.
There is CNVS-13387 for that.

Change-Id: I2d2e8c4dcb0e406378b50cd63f5aba14efe8c2ef
Reviewed-on: https://gerrit.instructure.com/35739
Reviewed-by: Jason Madsen <jmadsen@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Ahmad Amireh <ahmad@instructure.com>
2014-06-05 09:12:33 +00:00
Derek DeVries df6be76cc3 fix issue with republish quiz not working correctly pre-draft state
fixes CNVS-13391

test plan:
  - turn off draft state
  - as a teacher
    - create a new quiz
    - publish the quiz
    - make changes to the quiz questions
    - make sure the notification shows that you have unpublished changes
    - republish the quiz
    - the quiz changes should be published

  - make sure there are no regressions with CNVS-13003

  - make sure that publish/unpublish of a quiz with DS continues to work
    as expected
  - mess around with any way you can think to publish the quiz via modules
    etc.

Change-Id: I1365609f8c4fc10056de42a806a3629155e6643e
Reviewed-on: https://gerrit.instructure.com/35754
Reviewed-by: Jason Madsen <jmadsen@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Product-Review: Derek DeVries <ddevries@instructure.com>
2014-06-02 21:34:36 +00:00
Derek DeVries a8dfe3a4e8 add extend time modal link and dialog for ember quizzes moderate
fixes CNVS-12448

test plan:
- as a teacher
  - enable fabulous quizzes
  - enroll a few students in the course

  - create a quiz with a time limit
  - publish the quiz
  - visit the quiz moderate page

- in a different browser / session as a student
  - start the quiz as a student
  - don't submit the quiz yet!

- as a teacher
  - refresh the moderate page
  - you should be shown a clock icon for the students with currently running
    quizzes.
  - you can now click on this icon!
  - this will bring up a modal dialog to extend time for the current attempt
  - try out extending the quiz by a few minutes from now
  - try out extending the quiz by a few minutes from the end date

- also try these out with multiple students taking the quiz at once.
- changing the options in the modal should persist until you choose a different
  student, at which point it will reset the form in the dialog

Change-Id: I0adf1ed2133b6adaf8501b5131bd70365b06c249
Reviewed-on: https://gerrit.instructure.com/35343
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Ahmad Amireh <ahmad@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Product-Review: Derek DeVries <ddevries@instructure.com>
2014-06-02 15:23:10 +00:00
Derek DeVries c1b4b889fa fix issue with publishing a module not publishing quiz item correctly
this was fixed by changing two things.

1. all objects except quizzes are published by setting workflow_state to
   'published'. Quizzes differ in that it also needs to generate the question
   data and set the published at time. We have the Quiz#publish! method to do
   exactly this, but nobody uses it. So the code now just checks the workflow
   state and always triggers the correct code if someone changes it directly

2. Quizzes use 'available' instead of 'published' for the published workflow
   state. Content tags was checking for 'active' first and since quizzes
   responded to that method it was setting the state to active, which was
   messing things up. I switched the logic to check for responds_to :available
   first, so that quizzes get set correctly.

fixes CNVS-13003

test plan:
  - turn off draft state
  - as a teacher
    - create a new quiz with questions (leave unpublished)
    - create a new module (leave unpublished)
    - add the quiz to the module
    - publish the module
  - as a student
    - take the quiz
    - the questions should show up fine when taking the quiz

  - make sure that publish/unpublish of a quiz with DS continues to work
    as expected
  - mess around with any way you can think to publish the quiz via modules
    etc.

Change-Id: I734e2499d58891fda952b608a13e856d469ebca2
Reviewed-on: https://gerrit.instructure.com/35479
Reviewed-by: Ahmad Amireh <ahmad@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Product-Review: Derek DeVries <ddevries@instructure.com>
2014-05-28 21:50:07 +00:00
Braden Anderson 45d19f3003 validate types on polymorphic associations
fixes ALYT-26

test plan:
	* regression test

Change-Id: Ie93e89b842e354f1f76d75f3492145b86c79a035
Reviewed-on: https://gerrit.instructure.com/34560
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
Reviewed-by: Derek DeVries <ddevries@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Braden Anderson <banderson@instructure.com>
2014-05-28 17:05:34 +00:00
Anthus Williams c247a3758d remove some of the less useful associations from export
delayed_messages, exports, imports, migrations,
stream_items, etc.

Change-Id: I6eb63457ad496d7aaf56fc9ec8a9602a5679fdd7
Reviewed-on: https://gerrit.instructure.com/35215
Reviewed-by: Braden Anderson <banderson@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Anthus Williams <awilliams@instructure.com>
QA-Review: Anthus Williams <awilliams@instructure.com>
2014-05-27 15:44:00 +00:00
Derek DeVries efa361db59 add student extension dialogs on new ember quiz moderate page
fixes CNVS-12449

test plan:
  - as a teacher
  - enable fabulous quizzes
  - enroll a few students in the course

  - there is a new quizzes api attribute called 'quiz_extensions_url'
  - check out the jsonapi quizzes api to make sure this attribute only shows
    up for teachers (and not students)

  - create a quiz with no time limit and unlimited attempts
    - visit the quiz moderate page
    - click the "edit" icon for a student
    - the modal dialog should only allow you to "manually unlock"

  - create a quiz with a time limit
    - visit the quiz moderate page
    - click the "edit" icon for a student
    - the modal dialog should only allow you to "manually unlock"
    - the modal dialog should only allow you to add "extra time"

  - create a quiz with a limited number of attempts (1 or more)
    - visit the quiz moderate page
    - click the "edit" icon for a student
    - the modal dialog should only allow you to "manually unlock"
    - the modal dialog should only allow you to add "extra attempts"

  - create a quiz with both a time limit and a limited number of attempts
    - visit the quiz moderate page
    - click the "edit" icon for a student
    - the modal dialog should only allow you to "manually unlock"
    - the modal dialog should only allow you to add "extra attempts"
    - the modal dialog should only allow you to add "extra time"
    - change the settings for extra attempts, extra time, and manually unlock
    - hit submit
    - it should save these new settings if you reopen the dialog
    - it should show the extra minutes allowed on the attempt under the username
    - it should add the extra attempts to the 'attempts left' column value

Change-Id: I0e10942ff7a3a80cec200468216ba0641decee2c
Reviewed-on: https://gerrit.instructure.com/35089
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Reviewed-by: Ahmad Amireh <ahmad@instructure.com>
Product-Review: Derek DeVries <ddevries@instructure.com>
2014-05-22 19:45:34 +00:00
Ahmad Amireh ddcffe00ef Quiz Stats - File Upload & Formula
Add support for generating stats for File Upload and Formula questions.
Similar to Essay metrics but adjusted to calculate properly.

Closes CNVS-13169

TEST PLAN
---- ----

  - create a quiz with those question types
  - take the quiz:
    - answer both question types by at least one student, but leave it
      unanswered by another so we can test the "responses" metric
  - test the stats:
    GET /api/v1/courses/:course_id/quizzes/:quiz_id/statistics
    - the "responses" metric should count the number of students who
      provided an answer
    - the "graded" metric should read the number of students whose
      answers you've graded so far
    - the "full_credit" one should read 0 until you grade it and give
      them a score higher than, or equal to, the maximum points possible
    - "point_distribution" is similar to that of Essays; it is an array
      of objects that track every score you gave the students and the
      number of students who received those scores
  - grade the scores and re-test to verify the metrics update correctly
  - verify that the API documentation is updated to include those
    question types

PS: the "responses" field will read "the number of students who uploaded
a file" for File Upload, and "the number of students who wrote any
answer" for Formula.

Change-Id: I890eafe018e000eef88de782bd7e86b5259df5d5
Reviewed-on: https://gerrit.instructure.com/35112
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jason Madsen <jmadsen@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Product-Review: Ahmad Amireh <ahmad@instructure.com>
2014-05-22 15:56:29 +00:00
Derek DeVries 093b6c76f4 fix documentation issues for quiz extensions api
fixes CNVS-13237

test plan:
  - generate the documentation for the api
    - the description for the endpoint to set extensions has been corrected
    - the copyright block is no longer in the docs
    - user_id is now correctly described as 'Required' instead of 'Optional'
    - The attributes of the QuizExtension object description have been changed
      to not show the extend_from_now and extend_from_end_at, and instead
      reflect the actual object returned when you make updates - which instead
      includes the end_at date
    - fixed description of extra_attempts to be more clear
    - The example response should now correctly show quiz_extensions and not
      quiz_submissions
    - updated the description of extra_time in quiz submissions api to correctly
      describe it in 'minutes' instead of 'seconds'

  - I have updated the behavior of the manually_locked attribute.
    - Sending 1, '1', true, or 'true' will result in the attribute being
      set to true. Every other value will set the value to false.

Change-Id: Id6071632a8eb9d01d61cf21287955fb5e44c2f3f
Reviewed-on: https://gerrit.instructure.com/35305
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Reviewed-by: Josh Simpson <jsimpson@instructure.com>
Product-Review: Derek DeVries <ddevries@instructure.com>
2014-05-22 00:53:43 +00:00
Derek DeVries 1343e2379c add api for quiz submission extensions
quiz submissions can have their time limit or number of attempts extended.
we can extend both existing quiz submissions, and also those that don't exist
yet. adding this functionality to the existing quiz submissions api would
muddle up responsibilities. So instead we post all extensions to a the
quiz extensions api which is specifically meant for adding extensions to a
submission whether it has been started yet or not.

Also add 'manually_unlocked' to the quiz submissions api. this field lets us
know if a student can take a quiz after it has been locked for everyone else.

fixes CNVS-13165

test plan
  - There is a new attribute added to quiz_submissions objects in the api
    called 'manually_unlocked'. This attribute will now show up when returning
    results back from
    - GET /api/v1/courses/:course_id/quizzes/:quiz_id/submissions (index)
    - GET /api/v1/courses/:course_id/quizzes/:quiz_id/submissions/:id (show)

  - There is a new endpoint to create quiz extensions. This should work to
    create quiz extensions for users that both have existing quiz submissions
    started, and users who have not yet started a quiz:
    - POST /api/v1/courses/:course_id/quizzes/:quiz_id/extensions (create)
  - Check Permissions on the new quiz extension endpoint. Only teachers should
    be able to extend the quizzes.
  - Check that all the documentation looks okay for quiz extensions.

Change-Id: Ie23113c1f30e139a1e376475fb35a2cf3ce0212c
Reviewed-on: https://gerrit.instructure.com/35111
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Ahmad Amireh <ahmad@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Product-Review: Derek DeVries <ddevries@instructure.com>
2014-05-21 21:30:15 +00:00