Commit Graph

24 Commits

Author SHA1 Message Date
Augusto Callejas aaeda39f3b Exclude unpublished items for students in sLMGB
closes OUT-2898

test plan:
  - in a course, create a student user
  - create a course outcome
  - create an unpublished assignment, and align to the outcome
  - create a quiz bank with a single question, aligned to the outcome
  - create an unpublished quiz, pulling from the quiz bank
  - as a teacher, confirm that the student LMGB shows the assignment
    and quiz alignments for the outcome
  - as a student, confirm that the student LMGB does not show
    the alignments
  - as a teacher, publish the assignment and quiz
  - confirm that the alignments appear for the student now

Change-Id: If110f52179ea5acbbe513dcb019fa21a1e369bf0
Reviewed-on: https://gerrit.instructure.com/184092
Tested-by: Jenkins
Reviewed-by: Neil Gupta <ngupta@instructure.com>
QA-Review: Frank Murphy III <fmurphy@instructure.com>
Product-Review: Augusto Callejas <acallejas@instructure.com>
2019-03-07 00:22:48 +00:00
Shahbaz Javeed a4e109ea0c re-apply late policies to any late submissions as needed
the "as needed" refers to two cases:
* when late policy changes
* when an assignment's points_possible changes

closes CNVS-36656

test plan:
* Create a course with two assignments, two grading periods and
  two students enrolled
* Ensure one assignment is due in a closed grading period and the
  other in an open grading period
* Submit homework from both students so for each assignment one
  student submits the homework on time and the other submits it
  late
* Go to gradebook and grade the students
* Add a late policy to the course using the Rails console:

  course = Course.find(my_course_id)
  late_policy = LatePolicy.create(
    course: course,
    late_submission_deduction_enabled: true,
    late_submission_deduction: 50.0
  )
* Reload the gradebook and you should see the score of the late
  submission for the assignment in the open grading period to
  have changed (lowered)
* Verify that none of the other submissions had their scores
  changed

* Now edit the assignment in the open grading period and change
  its points possible to a higher number and save this change
* Reload the gradebook and you should see the score of the late
  submission for the assignment in the open grading period to
  have changed again
* Verify that none of the other submissions had their scores
  changed

* Now try this using three quiz submissions (early and late and
  just 45 seconds past the deadline).
* Verify in the gradebook that late policy deductions are applied
  only to quiz submissions that are later than 60 seconds after
  the quiz due date

Change-Id: I58ed3e3d0665870cf46d1b1e3ddf00f5f2f7008c
Reviewed-on: https://gerrit.instructure.com/110598
Tested-by: Jenkins
Reviewed-by: Jeremy Neander <jneander@instructure.com>
Reviewed-by: Derek Bender <djbender@instructure.com>
QA-Review: KC Naegle <knaegle@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2017-05-26 18:53:26 +00:00
Landon Wilkins 0ce4a23f58 da licença part 46
add consistent license headers to all source files

Change-Id: If9d3b01addc4fd9c2977bf2402dda57ec622e72f
Reviewed-on: https://gerrit.instructure.com/110151
Tested-by: Jenkins
Reviewed-by: Jon Jensen <jon@instructure.com>
Product-Review: Jon Jensen <jon@instructure.com>
QA-Review: Jon Jensen <jon@instructure.com>
2017-04-28 17:56:22 +00:00
Jon Jensen ed7518840f spec: speed up student quiz specs
also move observer ones into their own thing

group: 1:46 -> 0:53
slowest example: 0:20 -> 0:08

Change-Id: I51f63b37eee59587d8f844167ad127180a8a2359
Reviewed-on: https://gerrit.instructure.com/101021
Tested-by: Jenkins
Reviewed-by: Landon Wilkins <lwilkins@instructure.com>
Product-Review: Landon Wilkins <lwilkins@instructure.com>
QA-Review: Landon Wilkins <lwilkins@instructure.com>
2017-02-03 16:18:03 +00:00
James Williams 031242d031 strong params part Q
refs #CNVS-32574

Change-Id: Ifd139bf1e8296370d1d793ceed7c8e2e50440059
Reviewed-on: https://gerrit.instructure.com/94684
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2017-01-10 18:20:03 +00:00
Simon Williams 57497719a7 spec: rename the `course` helper to `course_factory`
closes CNVS-34046

test plan: specs should pass

Change-Id: I8684d30e5af7be04566b2d3903db2b7f4b14b24b
Reviewed-on: https://gerrit.instructure.com/98439
Tested-by: Jenkins
Reviewed-by: Landon Wilkins <lwilkins@instructure.com>
Product-Review: Landon Wilkins <lwilkins@instructure.com>
QA-Review: Landon Wilkins <lwilkins@instructure.com>
2016-12-27 20:25:29 +00:00
Simon Williams ece65b5a89 spec: rename the `user` helper to `user_factory`
closes CNVS-34042

test plan: specs should pass

Change-Id: I20709a69f0cb28fb55eba18ca81f89f4d7673b56
Reviewed-on: https://gerrit.instructure.com/98426
Tested-by: Jenkins
Reviewed-by: Landon Wilkins <lwilkins@instructure.com>
Product-Review: Landon Wilkins <lwilkins@instructure.com>
QA-Review: Landon Wilkins <lwilkins@instructure.com>
2016-12-27 20:25:25 +00:00
Jon Jensen a27d19c76f spec: speed up some of the slowest specs
reduce these 5 specs (now 6) from 2:10 -> 0:22 collectively

Change-Id: I4430673aaa47c797c3191714a8659460c7d0f8cf
Reviewed-on: https://gerrit.instructure.com/97789
Tested-by: Jenkins
Reviewed-by: Landon Wilkins <lwilkins@instructure.com>
Product-Review: Landon Wilkins <lwilkins@instructure.com>
QA-Review: Landon Wilkins <lwilkins@instructure.com>
2016-12-16 19:38:55 +00:00
Jon Jensen da62f561ea spec: move factories off of Object
it's kind of crazy that you could do stuff like:

  "lol".user

i don't know why we didn't do this years ago ¯\_(ツ)_/¯

Change-Id: I0d3f8644729382d6bee889352557792bc353927c
Reviewed-on: https://gerrit.instructure.com/92583
Tested-by: Jenkins
Reviewed-by: Landon Wilkins <lwilkins@instructure.com>
Product-Review: Landon Wilkins <lwilkins@instructure.com>
QA-Review: Landon Wilkins <lwilkins@instructure.com>
2016-10-12 02:02:44 +00:00
Michael Brewer-Davis 154d34fa26 Allow outcome result details for Quiz alignments
Fixes CNVS-25911

Test plan:

Align an outcome to a question bank
Create a quiz
Import question bank into quiz
Have student take quiz
Go to outcome show page
Click on the quiz result within "Artifacts"
Should redirect to quiz submission, not show error

Change-Id: Ibb25d4fae21ccce29d49325bd593de3eafd866e3
Reviewed-on: https://gerrit.instructure.com/70093
Reviewed-by: John Corrigan <jcorrigan@instructure.com>
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Tested-by: Jenkins
Product-Review: McCall Smith <mcsmith@instructure.com>
2016-01-27 23:48:03 +00:00
Michael Hargiss ca8d6a62d8 spec: modify SpecComponents module and classes, prep for DA specs
Test Plan:
- pass Jenkins
- check for errors
- make sure DA (selective release) spec setup
  matches those specified in the DA Preconditions
  in TestRail (http://bit.ly/1mVXHOt)

Change-Id: I6b3d4a432c37b3bfb652a75d71bd78af1792afb8
Reviewed-on: https://gerrit.instructure.com/69920
Tested-by: Jenkins
Reviewed-by: Caleb Guanzon <cguanzon@instructure.com>
Product-Review: Caleb Guanzon <cguanzon@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
2016-01-16 02:31:18 +00:00
Michael Hargiss ae496391dd spec: add selective release module and context
Test Plan:
- pass Jenkins
- check for syntax errors

Change-Id: I7b2edb3201796efb8f5c4e5c7961c2ee506dc839
Reviewed-on: https://gerrit.instructure.com/66051
Tested-by: Jenkins
Reviewed-by: Robert Lamb <rlamb@instructure.com>
Product-Review: Robert Lamb <rlamb@instructure.com>
QA-Review: Robert Lamb <rlamb@instructure.com>
2015-10-30 21:44:18 +00:00
Brian Finney 28c202db85 Add precision fields to numerical question ui
Adds edit ui for "Answer with Precision" as a "Numerical Answer" subtype.

Precision answers are rounded to a precision of 16 to handle floating
point errors and then truncated to the specified precision for grading
and comparison.

If any of the potential answers to a numerical question is a precision
answer then the student form will accept precision answers. If none of
the possible answers are precision answers then the student form will
continue to round to 4 decimal places.

Refs CNVS-10866

Test plan:
 - Create a new question
 - Select a question type of "Numerical Answer"
 - Select answer type of "Answer with Precision"
 - You should see an answer input field and a precision input field
 - The precision field should default to 10 and accept input between
 1 and 16, these are the limits of javascript floats
 - The answer input should accept numerical inputs with or without an `e`
 exponent and be formatted according to the configured precision
 - The quiz submission form should accept answers with a precision of up
 to 16 in normal or exponential format (#.##e##)

Change-Id: Idc117a61040a43b038272afec9319bada43e5f54
Reviewed-on: https://gerrit.instructure.com/64068
Reviewed-by: Matt Berns <mberns@instructure.com>
QA-Review: Michael Hargiss <mhargiss@instructure.com>
Tested-by: Jenkins
Product-Review: Jason Sparks <jsparks@instructure.com>
2015-10-08 22:48:10 +00:00
John Corrigan fcb87dc336 move factories out of spec_helper
This is the first step to get us moved over to factory girl for test
factories. Gergich (rightly) has a lot to say on this, because I've
moved around a lot of scary looking code, but I am hesitant to spend
much time on fixing it here, since the end goal would be to rewrite most
all of the factory logic in factory girl anyway. Any feedback is good
feedback!

Change-Id: Id0da1099e98d4ac79c6bf1e1e8808d6e7ea43596
Reviewed-on: https://gerrit.instructure.com/57853
Tested-by: Jenkins
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: John Corrigan <jcorrigan@instructure.com>
Tested-by: John Corrigan <jcorrigan@instructure.com>
Product-Review: John Corrigan <jcorrigan@instructure.com>
2015-07-16 15:29:29 +00:00
Joseph Rodriguez e0a5065086 replace usages of Quiz#find_or_create_submission with SubmissionManager#find_or_create_submission
fixes: CNVS-12598

  test plan:
    - create a quiz as an instructor
    - as a student
    - take quiz
    - exercise all paths by which a quiz submission is generated
    - verify that quiz submissions continue to work as before

Change-Id: I9fd71679e6c9a45686861609ff481f5f4250cca1
Reviewed-on: https://gerrit.instructure.com/33735
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Derek DeVries <ddevries@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Product-Review: Jason Madsen <jmadsen@instructure.com>
2014-04-24 19:33:08 +00:00
Ahmad Amireh 20a3562779 Quiz Submission Questions API - Update
This patch provides support for answering Quiz Questions via the API.

closes CNVS-9844, CNVS-10225

TEST PLAN
---- ----

Testing this will be a bit rough because there are many variations and
validations to cover. I'll spare the validations that are covered by
specs from the test plan.

Create a quiz with a question of *each* type except "Text" and "File
Upload". There's a script that creates a quiz with its questions
automatically for you if you don't want to keep doing this manually. See
references.

> Answering Questions

Now you need to answer each question via the API. Most of them vary in
formats, but they are fully specified in the API documentation page
(along with examples). See DOCUMENTATION for more info.

> Flagging Questions

Flagging, and unflagging, a question is the same regardless of its type,
see the "EXAMPLE REQUESTS" section.

> Access Validations

Here are some generic, non-question based validations to verify. You
should NOT be able to answer a question if:

  - the quiz submission has been turned in
  - the quiz submission is overdue
  - the Access Code for the quiz is invalid
  - the IP filter of the Quiz prohibits you from taking the quiz
  - the quiz submission :validation_token is incorrectly specified (ie,
    other students shouldn't be able to answer your questions)
  - you don't specify the latest :attempt, so if the Quiz has multiple
    attempts, and this is your 2nd take, you specify an :attempt of 1,
    3, or anything but 2 should fail
  - NEW: turn quiz into an OQAAT quiz with the "Can't go back" flag on;
    the API should not reject all requests to modify any of the
    questions with a 501 error saying that type of quizzes is not
    supported yet (support will come in CNVS-10224)

> Grading

Also, when you're done answering the questions, take a look at the
grades and make sure everything gets graded just like it does when using
the UI directly.

> Verifying results in the browser

While taking a quiz in the canvas UI, the scripts perform backups in the
background that would overwrite any changes you do via the API. If you
want to verify the changes you make via the API from the UI, you must
append "?backup=false" to the take quiz page URL, something like this:

http://localhost:3000/courses/1/quizzes/1/take?backup=false

Setting that flag will (for now) disable the backup behaviour and should
make things tick.

EXAMPLE REQUESTS
------- --------

Don't forget to set the 'Content-Type' header to 'application/json'!

> Answering a Multiple-Choice question

[PUT] /api/v1/quiz_submissions/:quiz_submission_id/questions/:id

{
  "attempt": 1,
  "validation_token": "1babd0...",
  "answer": 10
}

> Flagging a question

[PUT] /api/v1/quiz_submissions/:quiz_submission_id/questions/:id/flag

{
  "attempt": 1,
  "validation_token": "1babd0..."
}

> Unflagging a question

[PUT] /api/v1/quiz_submissions/:quiz_submission_id/questions/:id/unflag

{
  "attempt": 1,
  "validation_token": "1babd0..."
}

DOCUMENTATION
-------------

Run `bundle exec rake doc:api` and check out the Quiz Submission
Questions page. There's an Appendix that contains example requests for
each question type, as well as the errors produced by each handler.

LINKS
-----

  - bootstrap script:
    https://gist.github.com/amireh/e7e8f835ffbf1d053e4c
  - direct link to the API documentation page:
    http://canvas.docs.kodoware.com/quiz_submission_questions.html

Change-Id: I9a958323ece8854bc21a24c2affd8dc3972e46d5
Reviewed-on: https://gerrit.instructure.com/27206
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Derek DeVries <ddevries@instructure.com>
QA-Review: Myller de Araujo <myller@instructure.com>
Product-Review: Ahmad Amireh <ahmad@instructure.com>
2014-01-23 17:49:36 +00:00
Mark Ericksen 0e9ac378e9 Some quiz result display fixes and a scoring fix. Fixes #7894
This fixes a couple bugs with quizzes but more issues remain that require a
more in-depth refactor. This makes the following changes:
* QuizQuestion::ShortAnswerQuestion - don't let a blank answer match and
  receive full points. (the actual ticket being fixed)
* Fixed display of matching question results. If user left it blank it just said,
  "You put:". Now shows the "You left this blank" and uses the color for wrong.
* Fixed display of short_answer_question (fill-in-the-blank single option) as it
  never showed the "you left this blank" even though the code was setup
  with that intention.
* Added spec and factory change to validate the short_answer_question
  scoring change.

Test Plan:
* Create a quiz with a single "Fill in the blank". Give it 1 or 2 answers and don't remove the
  the blank answers.
* Preview the quiz (or take as a student... it's the same)
* Taking the quiz, leave the question blank and submit.
* The quiz review page should now show "Your Answer: You left this blank" and
  not award any points.

Change-Id: I485463849367c2a9e54882235a9961c2cf2e3cf9
Reviewed-on: https://gerrit.instructure.com/10704
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2012-05-22 09:32:21 -06:00
Joe Tanner cd1329d263 saved quiz attempts not auto-submitted at due time, fixes #7933
Steps to Reproduce:
- create a quiz with a due date/time and NO time limit or lock time
- have student start quiz before due time
- exit the quiz without hitting submit
- allow due time to pass
- refresh quizzes page as student and verify that the quiz has a score

Change-Id: Ic9038eec076d1b89961511872f1c1ddf441982ae
Reviewed-on: https://gerrit.instructure.com/10621
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Mark Ericksen <marke@instructure.com>
2012-05-14 09:20:05 -06:00
Zach Wily 5433f63b29 fixes for ruby 1.9.3
* gemfile tweaks
 * removed ruby-debug (since it's broken in 1.9.3)
 * removed colons from case statements
 * turned off whiny nils for tests (they cause a 2X perf hit)
 * added utf-8 encoding markers to files with multibyte chars
 * removed an instance of calling String#map, which no longer works
 * fixed an issue in the assets file where the yaml emitter doesn't output the
   same whitespace as it did in 1.8.7
 * fix call to .map without block
 * fix yaml engine initialization for delayed jobs (was happening too late)
 * fix rspec instafail
 * fix UserProfile#id calls
 * fix ModelCache for instance_methods now returning symbols
 * fix user_spec collection not seeing the new objects
 * fix course specs where POST lines are slightly different in 1.9
 * fix utc_datetime in the time initializer

Change-Id: Ic95dda23cb910579e2828fb448323d4fc18902a2
Reviewed-on: https://gerrit.instructure.com/10705
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Zach Wily <zach@instructure.com>
2012-05-12 14:34:23 -06:00
Brian Palmer a4b3f14708 spec: quiz question scoring specs
these are (hopefully) pretty comprehensive specs for the scoring code
for the various quiz question types. parts of these specs are marked as
pending due to various bugs uncovered while writing them, an upcoming
patch set will do some refactoring of this code and fix those uncovered
bugs.

refs #8267

test plan: n/a

Change-Id: Ia2235a4c6341c9fe292c21345e291cf72108548f
Reviewed-on: https://gerrit.instructure.com/10217
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
2012-04-24 10:44:06 -06:00
Jake Sorce c8843901df don't show resume quiz button when quiz is locked fixes #6692
test plan(main quiz page):

  1. create and publish a quiz
  2. as a student begin taking the quiz
     don't finish the quiz, click a link
     to go somewhere else
  3. go back to the quizzes main page and you
     should see the resume quiz link
  4. login as the teacher and lock the quiz
  5. as the student go to the quiz main page
     notice the resume quiz link is gone

test plan(individual quiz page):

  1. create and publish a quiz
  2. as a student begin taking the quiz
     don't finish the quiz, click a link
     to go somewhere else
  3. go back to the quiz main page and click
     the quiz name to go into the quiz
  4. notice the resume quiz button on the right
  5. as a teacher lock the quiz
  6. as a student either refresh the page you are
     already on or go back to the quiz page and click
     the link to to back into the quiz. notice the resume
     quiz button is gone

Change-Id: I700f107c3c6cbfcd7e0811dddf7adfd910691f45
Reviewed-on: https://gerrit.instructure.com/10044
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
2012-04-18 09:55:54 -06:00
Brian Palmer 62b9ed42a9 require a logged-in user when backing up a quiz
fixes #7494

test plan: start taking a quiz, then delete your session from the
database. the subsequent backups should result in an error. (there is a
separate ticket filed to put the user back on the initial quiz page or
something when this happens)

Change-Id: I598012af1ee8f0595e95b81dd6caeb9bcfbc5428
Reviewed-on: https://gerrit.instructure.com/9703
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
2012-03-30 13:39:27 -06:00
Bryan Madsen 743c5b2d7d Quiz statistics selenium test. Fix selenium tests.
Change-Id: Ifad889049a06f084cfaa3f079dd9b3c571c2ec12
Reviewed-on: https://gerrit.instructure.com/5963
Tested-by: Hudson <hudson@instructure.com>
Tested-by: Selenium <selenium@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2011-10-07 12:20:35 -06:00
Bryan Madsen 4f86bc3bb6 finish selenium tests for sales demonstrations
Change-Id: Ieaa32fbb6dfa448d6051643336d4696e367d0c9a
Reviewed-on: https://gerrit.instructure.com/5435
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Bryan Madsen <bryan@instructure.com>
Tested-by: Bryan Madsen <bryan@instructure.com>
2011-09-28 12:34:28 -06:00