Commit Graph

2298 Commits

Author SHA1 Message Date
Cameron Sutter 669ba4ffe9 ensure id is valid in grade summary page
fixes CNVS-1869

test plan:
 - as a teacher, go to a student's grade summary page
 - in the url, replace the student's id with 'banana' or 'lqw'
   (e.g. /courses/1/grades/banana)
 - you should get a Page Not Found error page
 - navigate to /courses/:id/grades and the page should
   redirect you to gradebook

Change-Id: Ic7d2b3de463615957a8d4178544ab19b7e651f60
Reviewed-on: https://gerrit.instructure.com/29215
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2014-01-30 21:05:23 +00:00
Joel Hough 68ea9ce600 all outcome result api sideloads are optional
fixes CNVS-10527

the include[] parameter on the outcome result endpoint can now
include 'outcomes', 'users', and 'courses'

test plan
- fetch outcome results using the api
- verify that the 'linked' section is not present
- ensure that outcomes are included when requested
- with the aggregate parameter not set...
 - ensure that users are included when requested
 - ensure that requesting course inclusion results in an error
- with the aggregate parameter is set to 'course'...
 - ensure that courses are included when requested
 - ensure that requesting user inclusion results in an error

Change-Id: I80714c0c8c9534d5853bc1c0e9258919913afa60
Reviewed-on: https://gerrit.instructure.com/28826
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Matt Fairbourn <mfairbourn@instructure.com>
Reviewed-by: Braden Anderson <banderson@instructure.com>
Product-Review: Joel Hough <joel@instructure.com>
2014-01-28 21:53:54 +00:00
Nathan Mills b9ddd5d5d1 enhance tabs get api, and add put api
fixes PS-969

test plan:
*the posistion should reflect the posistion displayed in the UI
*the visibility should reflect the visibility in the UI
*hidden should be set if the nav tab is hidden
*unused should be set if the nav item has no content
*you should be able to update a tabs position
*you should be able to set a tab to hidden
*you shouldn't be able to modify home, or settings tabs

Change-Id: I96beba411551ea0709ecf0e876c61d90b35b8482
Reviewed-on: https://gerrit.instructure.com/28093
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Adam Phillipps <adam@instructure.com>
QA-Review: Adam Phillipps <adam@instructure.com>
Reviewed-by: Brandon Broschinsky <brandonbr@instructure.com>
2014-01-28 21:18:28 +00:00
Jon Jensen be8f32a91c escape translations when manually building html, fixes CNVS-10769
fix places where we manually build up an html snippet w/ a translation
embedded in it. note that this commit does not fix any such issues in
js_blocks, since those are all being removed in other commits.

test plan:
1. regression test of canvas, in particular the areas indicated by the
   files that were updated

Change-Id: I6f966ab5ca9908a21d7a1baef24ce243e7b1e675
Reviewed-on: https://gerrit.instructure.com/29246
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
Product-Review: Marc LeGendre <marc@instructure.com>
QA-Review: Marc LeGendre <marc@instructure.com>
2014-01-27 23:25:52 +00:00
Paul Hinze e5cec4240c instrument SAML login with stats
using these stats we should be able to follow SAML logins through their
lifecycle.

 - `canvas.saml.{an_account_host}.login_attempt` is the start of the
   process, where canvas redirects to the configured identity provider
 - `.login_response_received` will track all return requests from
   identity providers, regardless of outcome.
 - from there, every login response should resolve into either a
   `normal` or an `errors` subkey, with further details on the category
   of outcome in the next level of nesting.

the logout path is less important (and has less outcomes). we simply
instrument attempts and responses received for this path.

Change-Id: I7eb90776adb06303ee349394266e716ca7e639a2
Reviewed-on: https://gerrit.instructure.com/29315
Reviewed-by: Paul Hinze <paulh@instructure.com>
Product-Review: Paul Hinze <paulh@instructure.com>
QA-Review: Paul Hinze <paulh@instructure.com>
Tested-by: Paul Hinze <paulh@instructure.com>
2014-01-26 23:12:38 +00:00
Braden Anderson be4f66b08b Conversations: allow messages to groups in unpublished courses
fixes CNVS-10684

test plan:
  * create an unpublished course
  * invite a student
  * create a group in the course
  * add the student to the group
  * log in as the student
  * open old conversations
  * compose a new message
  * click on the address book icon
  * verify that the recipients list loads

Change-Id: Ic25500a31ef604331d7380e76af226b0c10fd4a1
Reviewed-on: https://gerrit.instructure.com/29244
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Steven Shepherd <sshepherd@instructure.com>
Reviewed-by: Joel Hough <joel@instructure.com>
Product-Review: Bryan Madsen <bryan@instructure.com>
2014-01-24 18:08:42 +00:00
Ahmad Amireh f4b49f8580 Quiz Submissions API - Self-Access
Passing a string id of "self" now returns the user's quiz submission.

Closes CNVS-10074

TEST PLAN
---- ----

Create a quiz and take it, and then using the API do the requests below:

[GET] /api/v1/courses/:course_id/quizzes/:quiz_id/submissions/self

  - verify that you can access your own quiz submission

[GET] /api/v1/courses/:course_id/quizzes/:quiz_id/submissions

  - verify that you get a list of submissions containing 1: your own

Change-Id: I8e98fd2ae081b7ff38f0bc7eaa6f3910241491a3
Reviewed-on: https://gerrit.instructure.com/28966
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Myller de Araujo <myller@instructure.com>
Reviewed-by: Stanley Stuart <stanley@instructure.com>
Product-Review: Stanley Stuart <stanley@instructure.com>
2014-01-24 16:40:25 +00:00
James Williams 0cedba19f8 replace association with association_object in models
having an "association" attribute causes problems in rails 3

Change-Id: I3249a25cd2a6162ff33f548a2e9f4f51a2940ece
Reviewed-on: https://gerrit.instructure.com/29058
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2014-01-24 16:35:40 +00:00
Ahmad Amireh db99de4616 Quiz Submission Questions - Index/Show
This patch makes it possible to list the "question records" for a QS
which clients can use to tell what questions are answered, flagged,
etc.

closes CNVS-10025

TEST PLAN
---- ----

Fire up some computer, launch a Canvas instance, create a quiz with a
question or two, take it as a student, answer it, then get ready for
API business:

> Index action - Listing all question records

[GET] api/v1/quiz_submissions/:quiz_submission_id/questions

  - Perform the request
  - Verify you get N entries, one for each question you answered or
    marked
  - Set an "include" parameter with "quiz_question" (ie,
    "?include=user")
    - Verify that the returned set now contains 3 entries:
      1. "quiz_submission_questions" what you saw earlier
      2. "quiz_questions" with Quiz Questions that you answered
      3. "meta" that you can safely ignore

> Show action - Fetching a single question record

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

  - Perform the request
  - Verify you get 1 entry
  - Try the "include" parameter as you did in the Index case

As a sidenote, the output of these endpoints should be the same as the
stuff you get when you answer a question (see CNVS-9844), they
basically should tell you what answer you provided if you did, and if
you marked the question or not.

Change-Id: If39b84d8fda77870c3990822ade06bd28b276c3d
Reviewed-on: https://gerrit.instructure.com/27598
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-24 11:03:30 +00:00
Joshua Simpson 1e81ea7caa move quiz into quizzes namespace as a precursor to enginifying
fixes CNVS-10679
this commit refactors quiz into a quizzes namespace. it contains various
shims to facilitate the data migration of polymorphic relationships
('Quiz' -> 'Quizzes::Quiz').  JIRA contains several tickets linked to
the above tickets in regards to removing these shims after the data
migration, as well as the strategies on reverting the shims once the
data migration is complete.
Change-Id: I30c566d60a87af6ee83e9d0041fdcb909ead6a89
Reviewed-on: https://gerrit.instructure.com/28573
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Derek DeVries <ddevries@instructure.com>
QA-Review: Myller de Araujo <myller@instructure.com>
Product-Review: Josh Simpson <jsimpson@instructure.com>
2014-01-24 00:08:46 +00:00
Nick Cloward d6592241a3 use base controller query_params method
refs: CNVS-392

Since all the auditor controllers use this same method it was
moved to the audit api base class.  See CNVS-392(g/27807).
This also adds the grade_change record method to activate the
submissions shard when creating a record which should will
prevent some shard issues with it.

Test Case:
  - Test the API calls for grade changes
  - Test the API calls for authentication events

Change-Id: If89d6b14cb7d328128b3a2275134301014d87ed3
Reviewed-on: https://gerrit.instructure.com/28551
Reviewed-by: Rob Orton <rob@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Nick Cloward <ncloward@instructure.com>
2014-01-23 20:37:33 +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
Ahmad Amireh 40259207c5 Renamed Api::V1::QuizStatistics to QuizReport
Closes CNVS-10704

TEST PLAN
---- ----

Create a quiz, take it, and then generate a statistics report by going
to the Statistics page in the browser:

http://localhost/courses/:course_id/quizzes/:quiz_id/statistics

  - verify that the page loads and the report is generated
  - use the API to retrieve the report and make sure it works

API endpoint:

[GET] /api/v1/courses/:course_id/quizzes/:quiz_id/reports/:report_id

If you can't get the report ID, doing this in the browser console might
give it:

console.log(ENV.quiz_reports[0].id);

Change-Id: I448543e577b92132c49e37a24651bf60b97d7aff
Reviewed-on: https://gerrit.instructure.com/29036
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 07:21:01 +00:00
Stanley Stuart e340d1a762 Revert "create PermissionsSerializer for serializing permissions"
This reverts commit cf8716bfb0.

Change-Id: I7c58b7533d2d34c4ddb3fd4d3f491b1656f71d84
Reviewed-on: https://gerrit.instructure.com/29135
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Bryan Madsen <bryan@instructure.com>
QA-Review: Bryan Madsen <bryan@instructure.com>
Product-Review: Bryan Madsen <bryan@instructure.com>
2014-01-23 05:17:23 +00:00
Brian Palmer 0849ccb1a1 extract canvas_cassandra gem
The gem still lives in the canvas-lms repo, but has separate tests, and
knows nothing about Canvas proper. Canvas' usage of the gem is through
Canvas::Cassandra::DatabaseBuilder (and Canvas::Cassandra::Migration).

Change-Id: I51878055647225755d54edc5595b8189b7bea3cc
Signed-off-by: Stephan Hagemann <stephan.hagemann@instructure.com>
Reviewed-on: https://gerrit.instructure.com/28632
Reviewed-by: Brian Palmer <brianp@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Brian Palmer <brianp@instructure.com>
2014-01-22 22:49:35 +00:00
Jeremy Stanley b0a789e25a feature flag state-change callbacks
to enable for your feature, in your feature definition, use
  after_state_change_proc: ->(context, old_state, new_state) { ... }

test plan:
 - specs pass
 - a future commit will make use of this feature
   and can be tested directly

fixes CNVS-10357

Change-Id: I5510545802fd181707bc217e179ba7102eec9d37
Reviewed-on: https://gerrit.instructure.com/28570
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
QA-Review: Bracken Mosbacker <bracken@instructure.com>
2014-01-22 22:05:25 +00:00
Jeremy Stanley 4e1641b833 customize feature flag state transitions for draft state
test plan:
0. render and consult the API documentation on feature flags,
   specifically looking at the 'transitions' member that
   was added to FeatureFlag
1. enable draft state in a course
2. use the API to show the draft state feature flag for the
   course (GET /courses/X/features/flags/draft_state)
   - verify that transitions['off'] contains a warning
     message about what happens to unpublished data
3. allow draft state in an account
4. as a non-site-admin user, use the API to show the
   draft state feature flag for the account
   (GET /accounts/X/features/flags/draft_state)
   - verify that transitions['on']['locked'] is false
   - verify that transitions['off']['locked'] is true
     and is accompanied by an explanatory message
5. attempt to turn the feature off via the API
   (still as a non-site-admin user)
   - you should get a 403 Forbidden error
6. repeat step 4 as a site-admin user
   - neither transition should be 'locked', but the
     message should still accompany 'off'
7. repeat step 5 as a site-admin user
   - it should succeed

fixes CNVS-10355
fixes CNVS-10356

Change-Id: I36b0d387ad09f98cdf3d4de9e4e351bfd6aa8c58
Reviewed-on: https://gerrit.instructure.com/28541
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
QA-Review: Nathan Rogowski <nathan@instructure.com>
2014-01-22 22:01:58 +00:00
Zach Pendleton 89352ff2f3 add cors headers to s3_success action
fixes CNVS-10678

test plan:
  * enable S3 uploads;
  * as any user, upload a profile picture while watching
    the network panel of your favorite browser;
  * verify that the s3_success action passes
    access-control-allow-* headers, including origin,
    methods, and headers.

Change-Id: I35ea81fc82fbf92a1410a6b896f96db79f1fc5c6
Reviewed-on: https://gerrit.instructure.com/28973
Reviewed-by: Braden Anderson <banderson@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Zach Pendleton <zachp@instructure.com>
QA-Review: Zach Pendleton <zachp@instructure.com>
2014-01-22 19:33:20 +00:00
Stanley Stuart cf8716bfb0 create PermissionsSerializer for serializing permissions
test plan:
  - specs pass
  - You should see a "permissions" object in the quizzes API,
    both when using the JSONAPI version and normal version.
  - In the JSONAPI version, in the "meta" object, there should be
    a "permissions" object with a "create" key. It should be
    "create": true for teachers/admins and "create": false for
    students.

Change-Id: I74f89b41605b369ddb4c2b09e5d5752ce22d5edb
Reviewed-on: https://gerrit.instructure.com/28831
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Derek DeVries <ddevries@instructure.com>
QA-Review: Myller de Araujo <myller@instructure.com>
Product-Review: Stanley Stuart <stanley@instructure.com>
2014-01-22 17:48:39 +00:00
Nick Cloward 0859606756 add option for course content changes (log auditing)
fixes: CNVS-392

Added logging for course events.  This is on a more generic level allowing us
to add all sorts of event types to courses.  First adds a general event for
course details.  Later we can add other event types such as assignment date
changes.

Test Plan:
  Setup:
    - Create a course

  Security:
    - Query API and should return success.
    - Remove account level permissions for viewing course changes.
    - Query API and should return invalid.
    - Add credentials back.
    - Query API and should return success.

  Course Details:
    - Change some details on the course.
    - API should return an event containing the data for the changes made to the
      course details.

Change-Id: I5ab139868842c2ad9777245d5a81452caf0d0970
Reviewed-on: https://gerrit.instructure.com/27807
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Nick Cloward <ncloward@instructure.com>
2014-01-22 16:15:23 +00:00
Zach Pendleton f7b371152e load all result pages in outcome gradebook
fixes CNVS-10631

test plan:
  * create a course with > 100 users;
  * navigate to that page's outcome gradebook and
    verify that all users are displayed.

Change-Id: Id38c8ff1bcdfb26adabfd68d8884074b70f83193
Reviewed-on: https://gerrit.instructure.com/28930
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jon Willesen <jonw@instructure.com>
QA-Review: Steven Shepherd <sshepherd@instructure.com>
Product-Review: Zach Pendleton <zachp@instructure.com>
2014-01-21 23:48:24 +00:00
Derek DeVries a10507d590 disable item analysis for surveys
fixes CNVS-10333

test plan:
- as a teacher
  - create an ungraded survey
  - publish the survey

- as a student
  - take the survey

- as a teacher
  - go to the quiz and click "Survey Statistics"
  - the "Generate Item Analysis" button should be disabled
  - it should show a tooltip that item analysis isn't available for surveys

Change-Id: I45c69d18418cceacbea009f67905e448b71edb74
Reviewed-on: https://gerrit.instructure.com/28957
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Stanley Stuart <stanley@instructure.com>
QA-Review: Myller de Araujo <myller@instructure.com>
Product-Review: Derek DeVries <ddevries@instructure.com>
2014-01-21 19:24:25 +00:00
Jon Willesen b1ae5c89ae add index actions to outcome groups api, includes to rollups
added include parameter to outcome rollups api so we can
efficiently query the outcome groups and links so we can display
outcome paths in the interface. Added additional endpoints to
outcome groups controller so this information is also available
via separate api call.

fixes CNVS-10396

test plan:
 - check documentation for new outcomes groups endpoints:
   - outcome groups for course and account.
   - outcome links for course and account.
 - check the documentation for the new "include[]" parameter of
   the outcome results rollups endpoint.
 - make the api calls and make sure they behave as advertised.
 - mastery gradebook should still function as before.

Change-Id: I2c5611385af5c39dcef0929beff5261b9aadf391
Reviewed-on: https://gerrit.instructure.com/28576
Reviewed-by: Braden Anderson <banderson@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Matt Fairbourn <mfairbourn@instructure.com>
Product-Review: Jon Willesen <jonw@instructure.com>
2014-01-17 21:22:52 +00:00
Cody Cutrer f994831e05 associate with shard when masquerading (for db page views)
test plan:
 * enable db page views
 * as an admin in shard 1, masquerade as a user in shard 2
 * view the user in shard 2; the page views from the admin should
   show up

Change-Id: I3c71ab12d207159d2f2dd0985449f4576bb04b67
Reviewed-on: https://gerrit.instructure.com/28355
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Reviewed-by: Nick Cloward <ncloward@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2014-01-17 17:54:06 +00:00
Anthus Williams 40c5c1f5f7 fix for rails3 refactoring of TestUploadedFile
in rails 3, ActionController::TestUploadedFile has
been moved to Rack::Test::UploadedFile. This commit
simply updates uses of TestUploadedFile to work
with this new structure

Change-Id: Ib31159c635f033a13908608dffeea88c8f719086
Reviewed-on: https://gerrit.instructure.com/28234
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Product-Review: Anthus Williams <awilliams@instructure.com>
QA-Review: Anthus Williams <awilliams@instructure.com>
2014-01-17 17:53:18 +00:00
Nick Cloward 4b41632880 add search_term to account courses api
fixes: CNVS-10517

This adds the ability to search for a course in an account scope based on
course name, course code, and returning a specific course by relative id
or global id.

Test Plan:
  - Create a few courses
    * Make sure the names and codes are different but similar for a wildcard search
  - Call the api with the search_term parameter as a string
    - Search for a specific course name
    - Search for a specific course code
    - Search for a partial course name
    - Search for a partial course code
    - Search for a course based on the id either global or local to the shard
  - Each should return respective results
  - Test other parameters for this API to make sure this change did not affect them.

Change-Id: I13dbca10ef3a14a0771bdd32fc04ddccdfcb805c
Reviewed-on: https://gerrit.instructure.com/28539
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Nick Cloward <ncloward@instructure.com>
2014-01-16 23:55:35 +00:00
Cody Cutrer 501e760528 include id in sort
cause mysql doesn't do subsecond timestamps, it keeps ordering consistent

refs CNVS-7032

Change-Id: I5e56202ad06396f1f34b449091c94052c90d9eba
Reviewed-on: https://gerrit.instructure.com/28569
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2014-01-16 22:33:57 +00:00
Cody Cutrer 3e574da39e fix invalid utf-8 when editing an attachment
just let the browser deal with it. garbage in, garbage out

test plan:
 * upload an html file of < 1MB that has invalid UTF-8 in it (such
   as the byte sequence 0xff)
 * attempt to edit it in the browser
 * it should work

Change-Id: I948b9c9f8dcaa68a67703fc9e6bd04cc5c76cac5
Reviewed-on: https://gerrit.instructure.com/28230
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Reviewed-by: Nick Cloward <ncloward@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2014-01-16 22:07:04 +00:00
Cody Cutrer 81a63f2922 use an AR query to get a grouped count instead of custom SQL
refs CNVS-7032

primarily, Mysql's execute doesn't return rows, but this is much
much cleaner anyway

Change-Id: Ia8c13374e5625ae0568f9bc386101dd2a2048d88
Reviewed-on: https://gerrit.instructure.com/28620
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Nick Cloward <ncloward@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2014-01-16 21:39:50 +00:00
Jon Jensen 2e2c6599d8 document user registration API, tighten up pseudonym validation
refs CNVS-10001

document existing behavior around how this api can be used by non-admins
for user registration (if self-registration is turned on for the account).

only functional change is to really require email pseudonyms if you're a
non-admin doing an API request. it was already required for non-admins
doing non-API requests (since @context and @domain_root_account would be
the same ruby object)

test plan:
specs

Change-Id: I165872e9d7133521b799d410299e235f19408f59
Reviewed-on: https://gerrit.instructure.com/28581
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Marc LeGendre <marc@instructure.com>
QA-Review: Marc LeGendre <marc@instructure.com>
2014-01-16 21:23:17 +00:00
Braden Anderson 4b2c6771bb discussions: use strings for IDs in ENV and materialized view
fixes CNVS-10341

test plan:
  * before applying this commit, if possible:
    * create a discussion
    * add a reply as a student
  * after applying this commit:
    * open the discussion as the student
    * verify that you can edit the reply you added before, but not
        those from other users
    * add a new reply
    * without refreshing, verify that you can edit your new reply
    * refresh the page
    * verify that you can still edit your reply

  * test basic canvas functionality (sorry)

Change-Id: Ifa654f7d853fd167d5bfbaee6184657209d58272
Reviewed-on: https://gerrit.instructure.com/28413
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
Reviewed-by: Jon Willesen <jonw@instructure.com>
QA-Review: Steven Shepherd <sshepherd@instructure.com>
Product-Review: Braden Anderson <banderson@instructure.com>
2014-01-16 17:31:32 +00:00
Joel Hough e209ba649d add profile pics to mastery gradebook and outcome result api
fixes CNVS-10295

test plan
- regression on mastery gradebook
- ensure student profile pics appear next to the student name on
 the mastery gradebook when profile pics are enabled
- ensure that profile pics do not appear if profile pics are
 disabled

Change-Id: I24ccb21990402a76fe1c79ea39a752d1f73e8d5f
Reviewed-on: https://gerrit.instructure.com/28561
Reviewed-by: Braden Anderson <banderson@instructure.com>
QA-Review: Braden Anderson <banderson@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Joel Hough <joel@instructure.com>
2014-01-16 00:28:51 +00:00
Mark Severson 0152fa52fa deprecate hide_from_students on wiki pages
hide_from_students is being deprecated in lieu of the workflow states
'active' (published) and 'unpublished'

test plan: (draft state and legacy)
  special attention should be given to areas related to hiding wiki
  pages from students (legacy: hide from students checkbox;
  draft state: published/unpublished items)

  items that are hidden from students or unpublished should show for
  teachers, but should not show for students

 - areas to test:
   - pages api and ui (regression)
     - validate hide_from_students and published values in all api calls
   - course migrations (specifically course copy)
   - wiki sidebar in other parts of canvas

fixes CNVS-10354, CNVS-10366

Change-Id: I70f4d8c07c2be4150163279f0673377bad6e9c48
Reviewed-on: https://gerrit.instructure.com/28375
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Nathan Rogowski <nathan@instructure.com>
QA-Review: Matt Fairbourn <mfairbourn@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
2014-01-15 21:29:06 +00:00
Jon Jensen c87d12c573 self-enrollment API, fixes CNVS-10419
move existing self-enrollment endpoint (undocumented) into enrollment api

depends on g/28504

test plan:
1. specs should pass
2. existing self enrollment forms should work, specifically:
   1. enrollment dialog on public course page
   2. self enrollment url (from course settings)
   3. canvas.net enrollment dialog

Change-Id: I0c876720203654e0a589b9ef2d25b80c3e4dfb08
Reviewed-on: https://gerrit.instructure.com/28506
Reviewed-by: Dan Dorman <ddorman@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Marc LeGendre <marc@instructure.com>
Product-Review: Marc LeGendre <marc@instructure.com>
2014-01-15 21:17:04 +00:00
Cody Cutrer 0a0251e059 fix count call on mysql
mysql doesn't all count(distinct users.*), so use count(distinct user.id)
instead

refs CNVS-7032

Change-Id: I8cc068581ec78d1482ece3502a7253cf5c7dec88
Reviewed-on: https://gerrit.instructure.com/28610
Reviewed-by: Anthus Williams <awilliams@instructure.com>
Reviewed-by: Nick Cloward <ncloward@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2014-01-15 20:45:07 +00:00
Cody Cutrer 4abdda8983 ensure a consistent ordering in web conferences api
refs CNVS-7032

Change-Id: I934c87defd9fccc4ea35a73e4bc7c541b5769217
Reviewed-on: https://gerrit.instructure.com/28601
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Nick Cloward <ncloward@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2014-01-15 20:07:28 +00:00
Brandon Broschinsky d87ac513ae course[syllabus_body] added to api doc
fixes PS-853

Change-Id: I97e1e55f60cc803df90e94be5c1254a40447627f
Reviewed-on: https://gerrit.instructure.com/28494
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
Product-Review: Adam Phillipps <adam@instructure.com>
QA-Review: Adam Phillipps <adam@instructure.com>
2014-01-14 23:36:30 +00:00
Cameron Sutter 0de6a03c13 hide srgb behind a feature flag
fixes CNVS-10336

test plan
 - with Screenreader Gradebook not enabled
 - navigate to srgb and it should redirect you to gb2
 - enable Screenreader Gradebook on the course settings page
 - navigate to srgb and it should load

Change-Id: I106ec2093693215f3ed74db61f835fa8e996831a
Reviewed-on: https://gerrit.instructure.com/28400
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Cameron Sutter <csutter@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
2014-01-14 19:35:46 +00:00
Ahmad Amireh 37aed89c01 Quiz Questions API - Allow student access
Students can now get a censored version of quiz questions, with enough
data to build the quizzes they have to take, but not enough to read the
correct answers and make the entire thing moot.

closes CNVS-10222

Note to code reviewers: the spec file shows too many changes because of
a re-indentation/rescope .. the original specs are untouched, but it was
necessary to scope them under a context ("as a teacher") to escape the
wrath of the global before(:each) block that was installed for all
specs.

TEST PLAN
---- ----

Endpoints:

  1. /api/v1/courses/:course_id/quizzes/:quiz_id/questions
  2. /api/v1/courses/:course_id/quizzes/:quiz_id/questions/:question_id

- Create a quiz with a question or two
- As a student using the API, make a GET request to both endpoints
  above and verify that:
  - you can read the questions
  - you don't get to see the answer weights
- Add a "?include=assessment_question" to the URL and:
  - verify that the "answers" array entries in the "assessment_question"
    do not list the answer weight either

Change-Id: I5c32030d92a1c46993706c2aa6f0575f858b60c0
Reviewed-on: https://gerrit.instructure.com/28022
QA-Review: Myller de Araujo <myller@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Derek DeVries <ddevries@instructure.com>
Product-Review: Ahmad Amireh <ahmad@instructure.com>
2014-01-14 16:13:31 +00:00
Cody Cutrer ddf2f3d4e3 allow api-style ids in non-APIs
Change-Id: I4701af3ad4b1998559ea6cbb6e28617bc38cbcd5
Reviewed-on: https://gerrit.instructure.com/28289
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2014-01-14 16:10:53 +00:00
Ahmad Amireh 34e58a7354 Quiz Submissions API - Update
This patch ports the ability for teachers to manually grade questions
and add comments on student answers in a quiz submission.

fixes CNVS-8981

TEST PLAN
---- ----

Create a quiz with like two questions, take it as a student and turn it
in.

Endpoint: [PUT]
/api/v1/courses/:course_id/quizzes/:quiz_id/submissions/:id

  1. Modify fudge points (Appendix A) with values like -2.5, 2.5 and:
    a. verify that the score gets adjusted by the fudge amount
    b. verify that the returned "fudge_points" in the output is adjusted
  2. Modify a question score (Appendix B) and:
    a. verify that the total score is adjusted by the correct amount
    b. verify that no other question scores were affected
    c. verify that no comments were affected
  3. Modify a question comment (Appendix C) and:
    a. verify that the total score is not affected
    b. verify that no comments were affected

Tip: to verify stuff like single question scores and comments, just go
to the quiz history page in the web UI and keep refreshing after
sending API requests.

Tip: to get a list of all the question ids, perform a GET request to:
  /api/v1/courses/:course_id/quizzes/:quiz_id/questions

Validations that should hold:

  1. [403] if you're not a teacher
  2. [400] if you specify an invalid attempt
  3. [400] if you specify an attempt that is in progress (not turned in)
  4. [400] if you pass in a funny score, like an array ([ 'hehe' ]) or a
     Hash ({ hello: 'World' })

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

Appendix A: Modifying fudge points

{
  "quiz_submissions": [{
    "attempt": 1,
    "fudge_points": VALUE
  }]
}

Appendix B: Modifying a question score

{
  "quiz_submissions": [{
    "attempt": 1,
    "questions": {
      "QUESTION_ID": {
        "score": VALUE
      }
    }
  }]
}

Appendix C: Modifying a question comment

{
  "quiz_submissions": [{
    "attempt": 1,
    "questions": {
      "QUESTION_ID": {
        "comment": "HEHEHEHH"
      }
    }
  }]
}

Change-Id: Id290d4e9f9cb9abcaa00eae857f4b0b7bd06e2ff
Reviewed-on: https://gerrit.instructure.com/28268
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Myller de Araujo <myller@instructure.com>
Reviewed-by: Jason Madsen <jmadsen@instructure.com>
Product-Review: Ahmad Amireh <ahmad@instructure.com>
2014-01-14 08:30:39 +00:00
Braden Anderson 9083377dc5 outcome results api: filter by outcome
fixes CNVS-10041

test plan:
  * make an API call to the outcomes service
  * add an outcome_ids parameter to your URL
  * verify that only the outcomes you specified are returned
  * add an outcome_group_id parameter to your original URL
  * verify that only outcomes in the group you specified are returned
  * add both parameters
  * verify that an error message is returned

Change-Id: Id31361a5937b36eb66765d29cbce3f1ce24e0d0f
Reviewed-on: https://gerrit.instructure.com/28364
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Steven Shepherd <sshepherd@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
Product-Review: Braden Anderson <banderson@instructure.com>
2014-01-13 20:33:33 +00:00
Cody Cutrer 5e241255d7 refactor loading/creating of submissions for assignments
optimizes and hopefully avoid deadlocks

 * use a single query to get all the submissions
 * use the association to load them for shard safety
 * preload self on the submission so it doesn't need to be loaded later
 * go through students in id order to avoid deadlocks with other
   transactions that also go in user id order

test plan:
 * simple regression test on submitting normal and group assignments

Change-Id: Ic96fc91c402e3968a3e63ca5f08ed204bfa389f8
Reviewed-on: https://gerrit.instructure.com/28257
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-01-13 18:54:24 +00:00
Rob Orton 183203438f add created_at to enrollment api object
also updated enrollment api documentation

closes CNVS-10391

test plan
 - hit an enrollment endpoint 
   /api/v1/courses/:course_id/enrollments
 - api json should contain created_at
 - run ram doc:api
 - /doc/api/enrollments.html should render

Change-Id: If1b252a82d2e14bed7222b44a6e5e5e5785b738a
Reviewed-on: https://gerrit.instructure.com/28420
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2014-01-13 16:46:18 +00:00
Jeremy Stanley 97120caea6 Content Exports API
API to export a course in .imscc format, or a course's quizzes
in QTI .zip format

test plan:
 - consult the API documentation for Content Exports
 - begin a course export with the API
  - confirm the returned progress_url shows progress
  - when the progress API says it's done, use the
    show export endpoint (and the id returned when
    you created the export) to get the URL of the
    download
  - download and re-import the .imscc to make sure it
    was exported correctly
 - repeat the above, but for a QTI quiz export instead
 - use the index action to list exports performed
 - also do a quick regression test on the content export
   functionality in the Course Settings UI

fixes CNVS-10259

Change-Id: I187671cb060ccaca075c94f5c7c20ef0591abb6f
Reviewed-on: https://gerrit.instructure.com/28207
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
QA-Review: Nathan Rogowski <nathan@instructure.com>
2014-01-10 23:24:23 +00:00
Cameron Matheson 16d7b04c9d support for reordering custom gradebook columns
refs CNVS-5856

Test plan:
  * create some custom gradebook columns
  * drag them into a different order in gradebook2
  * after reloading, the order of custom columns should be preserved

Change-Id: Ib3ef172b01baabe8480b12846775fde965880215
Reviewed-on: https://gerrit.instructure.com/28155
Reviewed-by: Mike Nomitch <mnomitch@instructure.com>
Product-Review: Cameron Matheson <cameron@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
2014-01-10 23:21:18 +00:00
Cameron Matheson fbf3da7073 custom gradebook columns ui
closes CNVS-5856

Test plan:
  * in a course that has n custom gradebook columns, load the gradebook
    * the custom columns should be displayed in the frozen section
    * you should be able to edit the content for those cells and it
      should be remembered
  * enable the teacher notes column (in the gradebook dropdown)
  * use the teacher notes column
  * hide the teacher notes column

Change-Id: Ie7ab048d29047e895f4dac4018bce0d9b3897591
Reviewed-on: https://gerrit.instructure.com/27898
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Cameron Matheson <cameron@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
2014-01-10 23:21:08 +00:00
Jason Madsen 3e39d19ceb show - hide ember quiz index admin buttons
closes CNVS-10185

test plan:
  - turn on fabulous quizzes
  - visit quiz index as teacher
    - publish and admin settings should be shown for each quiz
    - add quiz and admin (question banks) should be shown
  - visit quiz index as student
    - publish and admin settings should not be shown for each quiz
    - add quiz and admin (question banks) should not be shown

Change-Id: I76f578cf490d3742b4e95b2a113c22746dc53eb4
Reviewed-on: https://gerrit.instructure.com/28082
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Josh Simpson <jsimpson@instructure.com>
QA-Review: Myller de Araujo <myller@instructure.com>
Product-Review: Jason Madsen <jmadsen@instructure.com>
2014-01-10 17:12:21 +00:00
Jacob Fugal b9e04e300a return 404 in auditor apis if not configured
test-plan:
 - de-configure the auditors cassandra db (or don't have it configured
   in the first place)
 - attempt to access the authentication audit log API
 - should get a 404 Not Found response, not a 500 Internal Server Error
 - repeat for the grade change audit log API

Change-Id: I176d9bbf1265f372c2efe9933a8b97c4cbe9b363
Reviewed-on: https://gerrit.instructure.com/28288
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Nick Cloward <ncloward@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
2014-01-10 16:38:15 +00:00
Mark Severson f5c6aa8154 fix default front page behavior
test plan:
 - on a new course (with draft state disabled)
 * click on 'Pages' in the left nav
   - shows edit form for a new 'Front Page'
 * enable draft state for the course
 * click on 'Pages' in the left nav
   - should indicate no pages have been created
   - should allow the creation of a new page

 - on a course (with draft state enabled)
 * navigate to an existing wiki page
	 * click 'Edit'
	 * click 'Cancel'
   - should be redirected to a view of the same page
 * navigate to a non-existent page (manually changing url)
   - shows the edit form for the page
   * click 'Cancel'
   - should be redirected to the pages index

additional test considerations:
 - this affects behaviors around the default page named 'Front Page' on
   new courses (specifically when draft state is disabled). testing of
   related behaviors should be tested (especially the api).

fixes CNVS-10269

Change-Id: I11c7b65b004922e76f680afdece1ddcb65d542e3
Reviewed-on: https://gerrit.instructure.com/28081
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Nathan Rogowski <nathan@instructure.com>
Product-Review: Matt Goodwin <mattg@instructure.com>
2014-01-10 16:04:28 +00:00
Cody Cutrer a66e5f914b order modules by id when possibly creating progressions
mitigates a deadlock that can occur on pg < 9.3

basically, it inserts into context_module_progressions for module 1
in one process, and module 2 in another. then it attempts to touch the
user in both, but they both have the user row locked from the insert
due to FK validation. if we do it in order, the insert will block
because it's the same entry in a unique index, preventing the later
deadlock

Change-Id: I5a97c184364defe445060fa3c6ce93a83f2b0840
Reviewed-on: https://gerrit.instructure.com/28254
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Anthus Williams <awilliams@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2014-01-10 02:04:18 +00:00
Cody Cutrer 56eeceb7e7 avoid double render on deleted assessment question attachments
Change-Id: I7ee57d7fad459b36d93591676f34e902899dff08
Reviewed-on: https://gerrit.instructure.com/28229
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Anthus Williams <awilliams@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2014-01-10 02:03:41 +00:00
Cody Cutrer 8354afbfc0 fix double render uploading a file and getting a permission error
test plan:
 * go to a course files page
 * in another tab, log out
 * in the first tab, attempt to upload a file
 * it should fail
 * inspect the rails log or watch network requests. the preflight
   request should have failed with a 401 unauthorized, not a 500
   internal server error

Change-Id: I0eccc9574e658cc67216de8645d263ea1e9fdcd4
Reviewed-on: https://gerrit.instructure.com/28225
QA-Review: August Thornton <august@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Anthus Williams <awilliams@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2014-01-10 02:03:26 +00:00
Nick Cloward 1b1ce45f3c add option for course grade change (log auditing)
fixes: CNVS-8996

Added a grade change audit UI for searching grade change events.  This allows the
user to search based off of the grader, student, course id, and assignment id.
In addition to each parameter a date range can be selected.

Currently assignment and course can only be searched if the ID is known.  This
is because there is no way to query for courses based on a name with the api.

Note: The submission after_save :grade_change_audit needed to be after the
simply_versioned call because the grade change audit uses that to grab the
previous grade.  This was a bug in the grade change audit log api.  This
fixes that issue also.

Test Case:
  - Create a course with an assignment and student.
  - Grade the assignment for the student.
  - Change the grade for the student a few times.
  - Open the admin tools. Select the Logging tab and then pick the grade change
    activity option in the drop down.
  - Search for the grader.  The results from the grade changes should show
    accordingly.
  - Search for the student.  The results from the grade changes should show
    accordingly.
  - Search for the course id.  The results from the grade changes should show
    accordingly.
  - Search for the assignment id.  The results from the grade changes should
    show accordingly.
  - Perform each search type again, testing the date range capabilities.
  - Make sure you cannot search with an invalid date range, grader, and student.
  - Enter an invalid course id,  no results should be returned.
  - Enter an invalid assignment id,  no results should be returned.

Change-Id: Ie5a4d34dbb60627374035071c68ec4d404e80135
Reviewed-on: https://gerrit.instructure.com/26868
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Nick Cloward <ncloward@instructure.com>
Product-Review: Nick Cloward <ncloward@instructure.com>
QA-Review: Nick Cloward <ncloward@instructure.com>
Tested-by: Nick Cloward <ncloward@instructure.com>
2014-01-09 23:50:57 +00:00
Mark Severson 828d5c19a0 fix hide_from_students being ignored on new pages
test plan:
 - on a course with draft state disabled
 * create a new page through the api (using both POST and PUT)
   - with wiki_page[hide_from_students] set to 'false'
 - the page should be created with hide_from_students set to 'false'

fixes CNVS-10096

Change-Id: Idaa96c6dc358d929eed69566df363ed614b6f1e8
Reviewed-on: https://gerrit.instructure.com/28240
QA-Review: Matt Fairbourn <mfairbourn@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
2014-01-09 20:30:30 +00:00
Anthus Williams a8c8e8c46a option to restrict global announcements by role
Gives account admins the options to display
announcements to users that have a given role in
at least one course. This will enable us to, e.g.
write surveys intended for teachers and ensure
they will not be seen by K-12 students, etc.

Currently the granularity of this feature extends
only to the base enrollment types, (defined in
RoleOverride::ENROLLMENT_TYPES) not to the custom
roles that may have been defined in a given
account.

Fixes CNVS-8319

Test plan
- While logged in as an account admin or site
admin, browse to /accounts/N/settings#tab-announcements
and add a new announcement
- You should see the enrollment types delineated as
checkboxes
- Create an announcement defined for one role but
not another
- Log in as a user who has one of the defined roles
in at least one course to verify you are seeing the
announcement
- Log in as a user who has does not have any of
the defined roles in any of his enrolled courses
and verify that you do not see the announcement
- Verify it works for "Unenrolled users" (which is
not, in fact, a type of role in the same vein as
the rest) by logging in as a user who is not
enrolled in any courses
- Check "Account admin" option with a user who
does not have any role for which the announcement
is defined, but is an account admin (added under
the Admins section of /accounts/N/settings)

Change-Id: I7d141c7c38dc05ae72991de3a710043327d615f6
Reviewed-on: https://gerrit.instructure.com/27008
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Munda Frazier <munda@instructure.com>
2014-01-09 19:54:21 +00:00
Joel Hough 827fae9005 section_id parameter for outcome result rollup endpoint
fixes CNVS-10035

test plan
- create a course with more than one section and users in each
 section
- fetch outcome results using api, specifying a section_id
- ensure that only users from the specified section are returned
- fetch course aggregate results, specifying a section_id
- ensure that only the users' scores from the specified section
 are used in the resulting average
- try to fetch outcome results using the api, specifying a
 section_id for a section not in the course
- ensure that an error is returned
- fetch some outcomes using the api without the section_id param
- ensure that results for all users in the course are returned

Change-Id: I8581f50ec239824daaa0782c4ebca575e3b8e65a
Reviewed-on: https://gerrit.instructure.com/28205
Reviewed-by: Zach Pendleton <zachp@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Matt Fairbourn <mfairbourn@instructure.com>
Product-Review: Joel Hough <joel@instructure.com>
2014-01-09 18:58:18 +00:00
Zach Pendleton c312a04279 add publish state text to discussion edit page
fixes CNVS-9952

test plan:
  * enable draft state in a course;
  * create a published discussion topic and an unpublished
    discussion topic;
  * attempt to edit each of these topics and verify that
    "Published" and "Not Published" text is visible above
    the title field;
  * attempt to create a new topic and verify that no
    published text is visible;
  * attempt to edit a topic in a course without draft state
    enabled and verify that published/unpublished text is
    not visible.

Change-Id: I137e14698a991276c8aa6419ab3e79a0cf99f460
Reviewed-on: https://gerrit.instructure.com/28145
Reviewed-by: Zach Pendleton <zachp@instructure.com>
Product-Review: Zach Pendleton <zachp@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Matt Fairbourn <mfairbourn@instructure.com>
2014-01-09 17:20:36 +00:00
Joel Hough 8ab50e00a9 user_ids param on outcome result rollup endpoint
fixes CNVS-10040

test plan
- fetch outcome results using api, specifying some users from the
 context in the user_ids parameter
- ensure that only the specified users are returned, even if they
 don't have an outcome result
- fetch course aggregate results, specifying some users
- ensure that only the specified users' scores are used in the
 resulting average
- try to fetch outcome results using the api, specifying some users
 who are not in the context
- ensure that an error is returned
- fetch some outcomes using the api without the user_ids param
- ensure that results for all users are returned

Change-Id: I9e0e3fa37a7087a9808f3ab7c1859410620eab3d
Reviewed-on: https://gerrit.instructure.com/28149
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Matt Fairbourn <mfairbourn@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
Product-Review: Joel Hough <joel@instructure.com>
2014-01-08 21:49:23 +00:00
Simon Williams 5490b92542 hide unpublished assignments from students in old assignments interface
fixes CNVS-10252

test plan:
- create a course with draft state enabled
- create a mix of published and unpublished assignments
- as a student or teacher, go to the assignments tab in the top menu bar
- it should only show published assignments (even for teachers)
- now change your course homepage to be the assignment list
- it should show only published assignments for students
- it should show both published and unpublished for teachers
- finally, check that the course RSS feed contains only published assignments

Change-Id: Ib9494e76d178cba4b6c32722b0c33b1f8e11824c
Reviewed-on: https://gerrit.instructure.com/28055
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cameron Sutter <csutter@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2014-01-08 20:46:02 +00:00
Duane Johnson 946bee524b in API docs, remove space from "Custom Column" model
Test Plan:
- Custom Gradebook API docs should use "CustomColumn" to describe
  its model instead of "Custom Column".

Fixes SIS-123

Change-Id: I266733878803bda58ccc44fe26255f8518289469
Reviewed-on: https://gerrit.instructure.com/28121
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Reviewed-by: Duane Johnson <duane@instructure.com>
Product-Review: Duane Johnson <duane@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2014-01-08 20:10:22 +00:00
Simon Williams c99bb855f0 ignore scores for unpublished assignments
fixes CNVS-10244

test plan:
- create a new course with a teacher and student
- create two assignments, and publish them
- grade them both
- unpublish one of them
- look at all the places you can see grades, and make sure they all
  consistently show only the grades for the published assignment (the
  unpublished assignment should be completely ignored)
  * GB2 with and without 'treat ungraded as 0'
  * GB1 with and without 'incluce ungraded'
  * GB csv download
  * student grades summary page with and without what-if scores
  * /grades page as a student and as a teacher

Change-Id: I32aca28fe377e59cb2e0c6278b59eb74c87c73b4
Reviewed-on: https://gerrit.instructure.com/28047
Reviewed-by: Cameron Matheson <cameron@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2014-01-08 18:05:04 +00:00
Zach Pendleton 1ff6a776e7 add outcome gradebook feature
fixes CNVS-10196

test plan:
  * verify that no outcome gradebook tab or option appears
    on the gradebook2 page;
  * using feature flags, enable outcome gradebook;
  * verify that the gradebook2 page now displays a learning
    mastery tab;
  * verify that clicking the learning mastery tab displays
    the learning mastery gradebook;
  * verify that course outcomes with scores are displayed as
    columns and that students with results are displayed as
    rows;
  * in a course with sections, verify that filtering either
    the gradebook or outcome gradebook by section updates
    the filter of the other view (note: only the section
    dropdown will change in the outcome gradebook; no
    filtering will actually take place);
  * verify that toggling the mastery checkbox filters in
    the outcome gradebook will show/hide relevant cells in
    the table.

Change-Id: I9979f37ac42d9bc45f0dd9846dd7a92e45c25c09
Reviewed-on: https://gerrit.instructure.com/28014
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Braden Anderson <banderson@instructure.com>
QA-Review: Steven Shepherd <sshepherd@instructure.com>
Product-Review: Zach Pendleton <zachp@instructure.com>
2014-01-07 22:50:12 +00:00
Jon Willesen f9e3d2ae98 add aggregate parameter to outcome results rollup api
also replaces raw hashes in outcome result analytics with
structs to improve error detection and possibly support active
model serialization in the future.

fixes CNVS-10037

test plan:
 - check the outcome results api documentation for the new
   aggregate parameter.
 - call the outcome rollup api with the aggregate=course
   parameter.
 - verify the result in this case is one rollup that contains
   an accurate average of the user rollups for each outcome.

Change-Id: I635cf5e28f5de73e44b63ac6234971657728d035
Reviewed-on: https://gerrit.instructure.com/28103
Reviewed-by: Joel Hough <joel@instructure.com>
Product-Review: Joel Hough <joel@instructure.com>
QA-Review: Joel Hough <joel@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2014-01-07 22:09:45 +00:00
Paul Hinze 75dba33a5d use https for all kaltura communication
kaltura is always available over https, and requesting a secure resource
from within a plain http page is not harmful.

so we can simplify the code and pave the way for a media service that
only runs over https by converting everything to request kaltura
resources via https.

to accomplish this we pull together all of the myriad ways that HTTP
requests were being made from canvas's kaltura client. then in the
unified code path we ensure SSL is being used to make requests.

we're also pulling in webmock to make for better tests of the kaltura
client code with stubs closer to the HTTP layer.

unfortunately this change ends up touching most of kaltura
functionality, so the test plan is basically a full kaltura regression
test.

test plan:
 - upload a video to kaltura; once it's done transcoding, the thumbnail
   should work, and the video should play
 - upload a video via canvas files, then embed it in some content; do
   the same verification
 - record a video using your webcam; verify it works

Change-Id: If5f67469fee07db80188911a0c7edd256c94c0a3
Reviewed-on: https://gerrit.instructure.com/28100
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Paul Hinze <paulh@instructure.com>
2014-01-07 17:46:49 +00:00
Joel Hough 0d1c04cbf1 jsonapi-ify outcome results api
fixes CNVS-10198, CNVS-10201

test plan
- test outcome result api as in c/27631
- ensure that jsonapi paging metadata is returned

- fetch outcome results for a course that includes students
 without outcome results (i.e. haven't submitted anything)
- ensure that the student is listed in the returned results
 with an empty scores array

Change-Id: I00d8e9de241a243fb6ac1aa9f55150b8955a2452
Reviewed-on: https://gerrit.instructure.com/28015
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Joel Hough <joel@instructure.com>
QA-Review: Steven Shepherd <sshepherd@instructure.com>
Product-Review: Zach Pendleton <zachp@instructure.com>
Product-Review: Joel Hough <joel@instructure.com>
2014-01-06 20:08:01 +00:00
Cameron Matheson 9af963c357 custom gradebook columns: teacher_notes support
refs CNVS-5856, CNVS-6906, CNVS-6475

Test plan:
  This commit lets you mark columns as teacher_notes columns.  The UI
  only supports one teacher_notes column, but this isn't enforced by
  the API.  Create a teacher_notes column using the API.

Change-Id: I1c15082e95ac08b092148f32f3c6906ec2dcef11
Reviewed-on: https://gerrit.instructure.com/28097
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Product-Review: Cameron Matheson <cameron@instructure.com>
2014-01-06 19:48:40 +00:00
Cameron Matheson d4e99d505b custom gradebook columns api: support hidden state
refs CNVS-5856, CNVS-6906, CNVS-6475

Test plan:
  * use the api to make some custom columns hidden (you should be able
    to create hidden columns too)
  * hidden columns should not be returned in the list of custom columns
    by default (you can request them with the include_hidden param)

Change-Id: Ic8c6eed567e6b2890d6e62b9da64ab767888f03e
Reviewed-on: https://gerrit.instructure.com/28033
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Product-Review: Cameron Matheson <cameron@instructure.com>
2014-01-06 19:48:22 +00:00
Landon Wilkins 7f8ccedd47 add validation for group split count for group set creation
fixes CNVS-9973

test plan:
* click the create group set button
* check the Split students into equal groups and
  leave the associated number input empty
* attempt to create the group set
* verify that you get a validation error

Change-Id: I67cf71704e46ce5035fb86344442f5f06ea09041
Reviewed-on: https://gerrit.instructure.com/27536
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Marc LeGendre <marc@instructure.com>
QA-Review: Marc LeGendre <marc@instructure.com>
Reviewed-by: Dan Dorman <ddorman@instructure.com>
2014-01-06 17:43:34 +00:00
Joel Hough ff382f1737 unlink discussion from assignment before deletion
fixes CNVS-10262

test plan
- create a graded discussion
- edit it to be ungraded
- ensure that the topic is not deleted

Change-Id: I53595a3210d75391c3edba3a01b298dcc03b40c7
Reviewed-on: https://gerrit.instructure.com/28076
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Steven Shepherd <sshepherd@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
Product-Review: Joel Hough <joel@instructure.com>
2014-01-04 00:23:55 +00:00
Jason Madsen 8266f23f5b limit student requests to available quizzes
closes CNVS-10207

test plan:
  - enable fabulous quizzes
  - as a teacher
    - create a few quizzes
    - make some quizzes available now and publish
    - leave some quizzes un-published - unavailable
  - visit quiz index
    - verify that all quizzes are showing
  - log in as a student
    - visit the quiz index
      - verify that only available quizzes are showing

Change-Id: I3c0b4847fc16479f1427135383afd58f7abeb804
Reviewed-on: https://gerrit.instructure.com/28061
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Josh Simpson <jsimpson@instructure.com>
Reviewed-by: Stanley Stuart <stanley@instructure.com>
QA-Review: Myller de Araujo <myller@instructure.com>
Product-Review: Jason Madsen <jmadsen@instructure.com>
2014-01-03 23:28:20 +00:00
Cody Cutrer f3dd6f37de order error reports by created_at, not id
Change-Id: I91d0af99ce9d140c6f2a6abc8e443d26bb1e51af
Reviewed-on: https://gerrit.instructure.com/28087
Reviewed-by: Rob Orton <rob@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2014-01-03 23:11:47 +00:00
Ahmad Amireh 6641684b0c QS API - Respect the quiz's LDB requirement
Attempts to create or complete a quiz submission via the API will now be
rejected if the quiz requires LDB and the client is not identified to be
using one.

closes CNVS-10220

A note to reviewers: the filter is at the controller layer instead of
the service one because the LDB plugin requires a controller to validate
the authorization, and it seemed silly to pass the controller to either
the service or the QuizParticipant.

TEST PLAN
---- ----

  - create a quiz that requires the LDB (you may have to install/enable
    the LDB plugin for this to work)
  - try to create and complete the quiz submission via the API from a
    regular browser (like Chrome with Postman) or via cURL (see below)
    * your request should be rejected with a 403 telling you the quiz
      requires LDB

cURL command:

curl -X POST \
  -d '{}' \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer YOUR_API_TOKEN_HERE' \
  http://localhost/api/v1/courses/:course_id/quizzes/:quiz_id/submissions

Change-Id: Ic9d3561cd21288ff51d1946854f416c92b4a9f57
Reviewed-on: https://gerrit.instructure.com/28021
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Myller de Araujo <myller@instructure.com>
Reviewed-by: Stanley Stuart <stanley@instructure.com>
Product-Review: Ahmad Amireh <ahmad@instructure.com>
2014-01-03 19:01:30 +00:00
Jon Willesen f8042f63cc start of new outcome results api
fixes CNVS-10034

test plan:
 - check the new outcome results api documentation.
 - generate some outcome results:
   - create assignments with rubrics that have linked outcomes.
   - grade those assignments with the rubric.
 - call the /api/v1/outcome_results api endpoint.
 - make sure the returned student scores contain the maxiumum
   score achieved for each outcome.
 - students should not be able to access the api.

Change-Id: Icddec2aa9000c01f3b05c1c3c21260f7c15f7f7e
Reviewed-on: https://gerrit.instructure.com/27631
Reviewed-by: Zach Pendleton <zachp@instructure.com>
Product-Review: Zach Pendleton <zachp@instructure.com>
QA-Review: Zach Pendleton <zachp@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2014-01-02 22:35:02 +00:00
Simon Williams c93b03cb30 api: restore docs for creating a submission
fixes CNVS-10241

test plan:
- generate the api docs and go to /doc/api/submissions.html
- there should be docs for creatint a submission

Change-Id: I734127c194a10c2e33af3923e541c994f328216c
Reviewed-on: https://gerrit.instructure.com/28017
Reviewed-by: Cameron Matheson <cameron@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2014-01-02 21:51:53 +00:00
Michael Nomitch af4315488c graded discussion edit: right assignment_group selected by default
fixes CNVS-6571

assignment group ids are strings (not ints) for both assignments and discussions

test plan:
  - as teacher, create two assignment groups
  - add a discussion to each group
  - ensure: when editing the discussion, the right assignment group is selected by default
  - ensure: other types of assignments default to correct assignment group

Change-Id: I13ec98f28025394cf4a1e6ea1b1d51c87fcc987b
Reviewed-on: https://gerrit.instructure.com/27604
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Matthew Irish <mirish@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2013-12-31 20:58:32 +00:00
Jeremy Stanley 73c7685597 make unhiding feature flags require only membership on site admin
creating feature flags _on_ site admin still requires a
full-fledged site administrator, but creating feature flags
for hidden features on root accounts only requires a site
membership (and permissions on the root account, of course).

test plan:
 - a user with a non-admin account membership on site admin:
   * should be able to see hidden features on site admin and
     root accounts
   * should not be able to set feature flags on site admin
   * should be able to enable hidden features on root accounts
     (provided their site membership or root account membership
     gives them this ability)

fixes CNVS-10205

Change-Id: I4463dd6e60b06b7428143412e902b9e0fa895f04
Reviewed-on: https://gerrit.instructure.com/27959
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
QA-Review: Matt Fairbourn <mfairbourn@instructure.com>
2013-12-31 20:50:22 +00:00
James Williams 8066372219 use rescue_action methods in rails 3
Change-Id: I876716101f0c6f2f2d078fbbd2989f8d21f8eb18
Reviewed-on: https://gerrit.instructure.com/27578
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2013-12-31 19:00:32 +00:00
Duane Johnson cb426d2757 Make "ColumnDatum" a proper API doc class
Removes the space in "Column Datum" so that swagger
can generate the type as a ruby class.

Test Plan:
- API docs should reflect this change

Fixes SIS-120

Change-Id: I581942b6671d73d42b63e0d0ace92bdc45622e12
Reviewed-on: https://gerrit.instructure.com/27983
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Eric Adams <eadams@instructure.com>
Product-Review: Eric Adams <eadams@instructure.com>
Reviewed-by: Cameron Matheson <cameron@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
2013-12-31 17:14:34 +00:00
Rob Orton 13bb4b8851 create user merge api
closes CNVS-9084

test plan
 - merge users via api
 - should not be able to merge if you cannot manage
   both users

Change-Id: Id84995925b20ac109977a4f281c9de45a5db5a09
Reviewed-on: https://gerrit.instructure.com/27712
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2013-12-31 16:54:23 +00:00
Simon Williams 9e0b481117 remove dead grade_summary code
test plan:
- basic regression test on the grade summary page

Change-Id: If8a658ee752946af650dd1c8d59c78fce2844c60
Reviewed-on: https://gerrit.instructure.com/27869
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cameron Matheson <cameron@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2013-12-31 16:01:41 +00:00
Kunmi Ayanbule 00d06bfae9 Remove double quotes in generated sql query in assignment_context_scope, which fails in mysql db 2013-12-30 17:01:09 -07:00
Jon Jensen e05dde3827 show uncategorized account groups, fixes CNVS-10188, refs CNVS-1482
when you import groups into an account vis SIS, they are not linked to any
group set. this commit puts them in a new "Uncategorized" tab so you can
still see them and navigate to their home pages. previously you could see
them in the now-retired right sidebar.

note that there is no "Uncategorized" set in the db; we simply display a
synthetic group set that is essentially read-only.

also note that this doesn't apply to course groups, because 1. you can't
SIS import them and 2. canvas won't let you create a course group without
a group set.

test plan:
1.  do a SIS of import of some groups. for bonus points, import some users
    into those groups
2.  go to the manage groups page for the account
3.  you should see an "Uncategorized" tab at the end (always comes last)
4.  click it
5.  you should see a note explaining what these are
6.  you should not be able to delete or edit the group set
7.  you should not be able to add/edit/delete groups in the set
8.  you should be able to see the users in the groups (if any)
9.  you should not be able to reassign users (via menu or drag-and-drop)
    in the group set
10. you should be able to navigate to a given group's home page (via cog)
11. you should be able to filter groups via the search box
12. accounts without Uncategorized group sets should not have an
    Uncategorized tab
13. all other group sets (and their contents) should behave normally in
    this account and in any other course/account (general regression test)

Change-Id: Id0fa8e547bc9274a685c89d70b0cbb54ef3a01d0
Reviewed-on: https://gerrit.instructure.com/27933
Reviewed-by: Landon Wilkins <lwilkins@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Clare Strong <clare@instructure.com>
Product-Review: Jon Jensen <jon@instructure.com>
2013-12-30 20:30:35 +00:00
Stanley Stuart 5f2089c889 import ActiveModel::Serializers port and convert quizzes api to it
test plan:
  - The quiz api should work like it normally does when you don't pass
    an 'Accept: application/vnd.api+json' header.
  - The quizzes index page and quiz edit page should work like they
    always do.
  - Testing the Quizzes API for "jsonapi" style:
    - For all requests, you MUST have the "Accept" header set to
      "application/vnd.api+json"
    - Test all the endpoints (PUT, POST, GET, INDEX, DELETE) like you
      normally would, except you'll need to format the data according to
      the next few steps:
      - For "POST" and "PUT" (create and update) requests, you should send
        the data like: { "quizzes": [ { id: 1, title: "blah" } ]
      - For all requests (except DELETE), you should get back a response
        that looks like: { "quizzes": [ { quiz you requested } ]
    - For the "delete" action, you should get a "no content" response
      and the request should be successful

Change-Id: Ie91deaeb6772cbe52a0fc46a28ab93a4e3036061
Reviewed-on: https://gerrit.instructure.com/25997
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Product-Review: Stanley Stuart <stanley@instructure.com>
2013-12-26 20:32:39 +00:00
Cameron Matheson b088c6beda custom gradebook columns api
closes CNVS-6906, CNVS-6475

Test plan:
  Use the new custom gradebook column apis to create/edit/delete custom
  gradebook columns, and set data for users in a course on those
  columns.

  only teachers/TAs should have permission to use these apis.

Change-Id: I658b8dc02d6104559c98a6b7e1be5c72e775d664
Reviewed-on: https://gerrit.instructure.com/27615
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Simon Williams <simon@instructure.com>
Product-Review: Cameron Matheson <cameron@instructure.com>
2013-12-26 17:45:40 +00:00
Nathan Mills da0d95520d add api endpoint to list web conferences
fixes: PS-918

test plan:
you should be able to get a list of the web conferences through the API

Change-Id: I4bdfe35acbf4e6407a1fe5bcac67f4cca30aa6a0
Reviewed-on: https://gerrit.instructure.com/27592
Reviewed-by: Rob Orton <rob@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Adam Phillipps <adam@instructure.com>
QA-Review: Adam Phillipps <adam@instructure.com>
2013-12-23 22:59:28 +00:00
Simon Williams 0be2477685 remove code for max_score/min_score/mastery_score
these are legacy fields on the assignment table.  we'll keep the columns
around for a bit, but remove any and all effects.

fixes CNVS-10059

test plan:
- create an assignment, noting it's id
- in the console, run the following commands:
  > assign = Assignment.find(<id>)
  > assign.max_score = assign.points_possible
  > assign.min_score = 1
  > assign.save!
- make sure you can grade someone with a number greater than points possible
  and also that you can give a 0.
- make sure the grade shows up correctly in the gradebook and on the student's
  grade page
- make sure you can still copy assignments between courses
- try exporting an assignment that has a max_score set before this change is
  applied, and importing after.

Change-Id: I8ea228988c6514129db2fca1bea9be92d01c4efd
Reviewed-on: https://gerrit.instructure.com/27740
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Reviewed-by: Cameron Matheson <cameron@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2013-12-23 20:31:57 +00:00
Cody Cutrer 6ff358abca notification preferences API
closes CNVS-5797

test plan:
 * GET /api/v1/users/self/communication_channels/:id/notification_preferences
   should return your preferences
 * GET .../notification_preferences/<one of the named notifications returned above>
   should return a single preference
 * PUT .../notification_preferences/<notification>?notification_preferences[frequency]=never
   should update it (will return it, and confirm by getting it again
 * PUT .../notification_preferences?notification_preferences[<notification>][frequency]=never&
   notification_preferences[<another notification>][frequency]=never
   should update two preferences at once
 * other allowed frequencies are immediately, daily, and weekly
 * repeat replacing the communication channel's id by email/<email address>
 * repeat by using an actual user id instead of self. users should
   not be able to view or update each other's preferences. admins
   should only be able to view, not update (the update routes only exist for "self",
   so you'll get a 404 instead of a 401 for them)
 * regression test notification preferences UI

Change-Id: I107f68a44cb68ee1675ad50ff7123e26d7765450
Reviewed-on: https://gerrit.instructure.com/26311
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>
2013-12-20 22:44:02 +00:00
Zach Pendleton 908dfb1e57 reduce duplication in DiscussionEntriesController
fixes CNVS-10132

test plan:
  * run specs

Change-Id: Ie7ee61b6ab88a5b79bfc7333c586a8b13c39e380
Reviewed-on: https://gerrit.instructure.com/27787
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jon Willesen <jonw@instructure.com>
QA-Review: Zach Pendleton <zachp@instructure.com>
Product-Review: Zach Pendleton <zachp@instructure.com>
2013-12-20 22:00:57 +00:00
James Williams 40ce797f55 session and request fixes for rails 3
primarily switching fullpath in place of request_uri
in preparation for rails 3

Change-Id: If14f2cc2da5120a60f04d4cfdfb05a55482a3695
Reviewed-on: https://gerrit.instructure.com/27162
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2013-12-20 20:56:39 +00:00
James Williams 0be7b663f3 fix UsersController#all_menu_courses for rails 3
@template is not defined in rails 3

Change-Id: Ic2f4fbcb36c19715077c0ed0819e8b3dff175e00
Reviewed-on: https://gerrit.instructure.com/27611
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2013-12-20 17:42:18 +00:00
Cody Cutrer 85515a7e79 rearrange enrollments API query
avoid inline includes, cause they kill performance in very large courses and it's
trying to sort huge amounts of data

test plan:
 * regression test enrollments list API (from a course, a section, and a user)

Change-Id: Ie5bd4085e3520f918c1c86b611f236c751b5474f
Reviewed-on: https://gerrit.instructure.com/27553
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2013-12-19 20:06:48 +00:00
Ahmad Amireh e3778b529c Quiz Submissions API - Create & Complete
Allows users to start a "quiz-taking session" via the API by creating
a QuizSubmission and later on completing it.

Note that this patch isn't concerned with actually using the QS to
answer questions. That task will be the concern of a new API controller,
QuizSubmissionQuestions.

closes CNVS-8980

TEST PLAN
---- ----

- Create a quiz
- Keep a tab open on the Moderate Quiz (MQ from now) page

Create the quiz submission (ie, start a quiz-taking session):

- Via the API, as a student:
  - POST to /courses/:course_id/quizzes/:quiz_id/submissions
    - Verify that you receive a 200 response with the newly created
      QuizSubmission in the JSON response.
    - Copy the "validation_token" field down, you will need this later
    - Go to the MQ tab and verify that it says the student has started a
      quiz attempt

Complete the quiz submission (ie, finish a quiz-taking session):

- Via the API, as a student, prepare a request with:
  - Method: POST
  - URI: /courses/:course_id/quizzes/:quiz_id/submissions/:id/complete
  - Parameter "validation_token" to what you copied earlier
  - Parameter "attempt" to the current attempt number (starts at 1)
  - Now perform the request, and:
    - Verify that you receive a 200 response
    - Go to the MQ tab and verify that it says the submission has been
      completed (ie, Time column reads "finished in X seconds/minutes")

Other stuff to test (failure scenarios):

The first endpoint (one for starting a quiz attempt) should reject your
request in any of the following cases:

  - The quiz has been locked
  - You are not enrolled in the quiz course
  - The Quiz has an Access Code that you either didn't pass, or passed
    incorrectly
  - The Quiz has an IP filter and you're not in the address range
  - You are already taking the quiz (you've created the submission and
    did not call /complete yet)
  - You are not currently taking the quiz, but you already took it
    earlier and the Quiz does not allow for multiple attempts

The second endpoint (one for completing the quiz attempt) should reject
your request in any of the following cases:

  - You pass in an invalid "validation_token"
  - You already completed that quiz submission (e.g, you called that
    endpoint earlier)

Change-Id: Iff8a47859d7477c210de46ea034544d5e2527fb2
Reviewed-on: https://gerrit.instructure.com/27015
Reviewed-by: Derek DeVries <ddevries@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Myller de Araujo <myller@instructure.com>
Product-Review: Ahmad Amireh <ahmad@instructure.com>
2013-12-19 06:44:28 +00:00
Zach Pendleton f5ee7dbfc3 remove tinychat code
fixes CNVS-10058

canvas no longer integrates with tinychat; this commit
removes legacy references to it.

test plan:
  * run specs

Change-Id: I4887e901d57ff39f8554af3e4eacd52ec4edd6e5
Reviewed-on: https://gerrit.instructure.com/27621
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Matt Fairbourn <mfairbourn@instructure.com>
Reviewed-by: Braden Anderson <banderson@instructure.com>
Product-Review: Zach Pendleton <zachp@instructure.com>
2013-12-18 22:51:45 +00:00
Cameron Sutter 43f03e79f2 unauthorize Google Docs
fixes CNVS-1504

test plan:
 - as a student who has not registered gDocs
 - go to submission for an assignment that allows
   file upload
 - go to Google Docs tab
 - Authorize Google Docs access
 - after the process takes you back,
   you should see your Google Docs
 - go to user's profile and remove Google Docs
   from registered services
 - got to the submission of that assignment
 - go to Google Docs tab
 - it should ask you to authorize Google Docs again

Change-Id: I8e3b64eccfd01e57e1657c71b89c631e5925cd58
Reviewed-on: https://gerrit.instructure.com/27171
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Product-Review: Cameron Sutter <csutter@instructure.com>
2013-12-18 20:07:50 +00:00
Simon Williams 94ad7974db catch invalid user ids in rubric assessments controller
also fixes an issue where the submission detail page broke after assessing
a rubric for the first time (never been assessed before)

fixes CNVS-9953

test plan:
- create a new assignment with a rubric for grading
- go to the submission detail page for a student who has never been graded
  with this rubric before (in other words, this will create a rubric
  assessment for the first time)
- grade them with the rubric
- you should be able to re-open the rubric and grade them again without having
  to refresh the page

Change-Id: I7245650b9527e11ec20b66e852a744ce67fb381d
Reviewed-on: https://gerrit.instructure.com/27541
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Liz Abinante <labinante@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
Reviewed-by: Cameron Matheson <cameron@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2013-12-18 16:19:03 +00:00
Nick Cloward e983251c9d add 'links' container to jsonapi-style API objects
fixes: CNVS-9757

Change the authentication log api to return relationships (foreign keys) based
on jsonapi with a links element.  This also changes the page_view object to
also move the relationship (foreign keys) to the links element in the json.

Requires underscore.js 1.5.2.  See g/27313

Test Case:
  Authentication Logs:
    - Create some authentication logs if you don't have any by logging in and out.
    - Test the authentication logs api to make sure its returning in the correct
      format and data.
    - Open the admin tools
    - Search for authentication logs in the logging tab.
    - Search by date.
    - Ensure the page is not broken.

  Page Views:
    - Create page view data.
    - Test the page view api to make sure its returning in the correct
      format and data.
    - Test the analytics page views.
    - Test the user profile page views.
    - Account stats for page views.
    - Generating the CSV's/page views for page views.

  Make sure the API documentation reflects the changes.

Change-Id: Ic8aa9e5da4df58e2816fb348accac62b17ec20d5
Reviewed-on: https://gerrit.instructure.com/26907
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
Product-Review: Nick Cloward <ncloward@instructure.com>
2013-12-17 23:50:27 +00:00
Nathan Mills b17025abfe add scheduling support to conferences
refs PS-894

test-plan:
requires g/27337 to test functionality
* conferences should behave the same without g/27337

Change-Id: I546e806897fa35bc93b983da2d149e312f502d2d
Reviewed-on: https://gerrit.instructure.com/27338
Reviewed-by: Braden Anderson <banderson@instructure.com>
Product-Review: Adam Phillipps <adam@instructure.com>
QA-Review: Adam Phillipps <adam@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2013-12-17 23:46:41 +00:00
Joel Hough 2245a8224b check context for discussion draft state enable
fixes CNVS-9927

test plan
- allow but don't enable draft state at the account level
- enable draft state at the course level
- ensure that publish icons show on the discussion index page

Change-Id: Id1660f542874875bc7c827b9e95cd7a652a145cc
Reviewed-on: https://gerrit.instructure.com/27549
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Braden Anderson <banderson@instructure.com>
QA-Review: Matt Fairbourn <mfairbourn@instructure.com>
QA-Review: Steven Shepherd <sshepherd@instructure.com>
Product-Review: Joel Hough <joel@instructure.com>
2013-12-17 22:38:03 +00:00
Joel Hough 717e922674 fixed feature flag update condition
Change-Id: I1b033218005807bbb44905ce8a6b33a7e809f742
Reviewed-on: https://gerrit.instructure.com/27543
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Steven Shepherd <sshepherd@instructure.com>
2013-12-17 22:37:50 +00:00
Braden Anderson 1d25cfb67e conversations: improve recipient search
fixes CNVS-4806, CNVS-4482

test plan:
  * open conversations
  * compose a new message
  * select a course
  * verify that you can search for a section in the course by name
  * verify that you can search for a group in the course by name
  * verify that you can send a message to an entire group if you have
      permissions to send it to the entire course

  * create a course with two sections
  * add students to the sections and add a TA who can only see
      students in one section
  * masquerade as the TA
  * verify that the other section does not appear in the recipient
      search section list
  * verify that users in the other section do not appear in the
      recipient search student list

  * create a course in a concluded term
  * open new conversations
  * verify that the course is listed in the concluded section of the
      filter list
  * masquerade as a teacher for the course
  * open old conversations
  * verify that the concluded course is present in the filter search
  * verify that the course is not present in the recipient search

Change-Id: I5a4e62de4e182cf0859dc47a3f8ad694f616a3bc
Reviewed-on: https://gerrit.instructure.com/27433
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Matt Fairbourn <mfairbourn@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
Product-Review: Braden Anderson <banderson@instructure.com>
2013-12-17 21:11:20 +00:00
Cody Cutrer 65da18174e improve acts_as_list
fixes CNVS-9622

basically, stop with the assumption that lists must be contiguous,
so that we don't have to keep compacting them all the time. allows
for far simpler queries adding things to lists.

test plan:
 * regression test on lists - files, context modules, assignments,
   etc.
 * basically make sure that adding new items puts them in the same
   spot as it did before (bottom of list?), and that reordering
   still works

Change-Id: I31c9ad4ed9b7db2b23e032617d4a01611c8e3c03
Reviewed-on: https://gerrit.instructure.com/26709
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2013-12-17 19:55:43 +00:00
Rob Orton e8ed4b6531 add index to sis imports api
closes CNVS-9946
closes CNVS-10008
refs CNVS-3680

test plan
 - get https://<canvas>/api/v1/accounts/<account_id>/sis_imports
 - should show a paginated list of past imports for the account
 - run rake doc:api
 - https://<canvas>/doc/api/sis_imports.html should render 
 - it should have the SIS import object

Change-Id: I5d81e0049a2a16455e9acbea5be2effc2c2dd633
Reviewed-on: https://gerrit.instructure.com/27539
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2013-12-17 19:46:03 +00:00
Duane Johnson f43994073f Fix Quiz Questions API doc data type
"answers" array must have a type. Should probably be "string".

Test Plan:
- QuizQuestion model in API docs should have an "answers" array of
  type "string".

Change-Id: I431bcb54c1344acac259495658fe0a564d0bfac7
Reviewed-on: https://gerrit.instructure.com/27213
Reviewed-by: Josh Simpson <jsimpson@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Josh Simpson <jsimpson@instructure.com>
Product-Review: Duane Johnson <duane@instructure.com>
2013-12-16 18:38:20 +00:00
Rob Orton 1f58fd112f don't clear sis_id when deleting a course
fixes CNVS-9903

test plan
 * delete a course that has an sis_id
 * the sis_id should still be there

Change-Id: Icf884f798e8be1c4b528ee9fcd6911cd107aaa9a
Reviewed-on: https://gerrit.instructure.com/27165
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
QA-Review: Nathan Rogowski <nathan@instructure.com>
2013-12-16 17:56:22 +00:00
Simon Williams 6597a2c9f1 show total columsn in GB1 when draft state is enabled
fixes CNVS-9951

test plan:
- enable draft state
- go to gradebook 1
- total columns should be visible

Change-Id: I99b50a04583e84c8762d3b83889e551cae486cd2
Reviewed-on: https://gerrit.instructure.com/27325
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cameron Matheson <cameron@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2013-12-16 17:01:35 +00:00
Jeremy Stanley a07965032c normalize hide_from_students value via value_to_boolean
fixes CNVS-9954

test plan:
 - with draft state OFF,
  - using the API, perform a PUT on a page, ending the query
    with wiki_page[hide_from_students]=
    (nothing after the =)
  - in the result, hide_from_students should be false
    (not null)

Change-Id: Ic48143ee84411f7b099354e82bfd19d053bf4435
Reviewed-on: https://gerrit.instructure.com/27516
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Nathan Rogowski <nathan@instructure.com>
2013-12-14 00:49:34 +00:00
Michael Nomitch 9a7c075060 added option to always hide turnitin score from students
fixes CNVS-9770
fixes CNVS-9728

added "never" option to 'students can see originality report' dropdown
when never is selected, turnitin api gets different s_view_report value
link on gradebook to originality report is never shown

test plan:
- make assignment as teacher and enable turnitin
- select 'never' from on the 'students can see originality report'
- login as student and turn in assignment
- wait for turnitin to finish
- ensure that you can see the turnitin report as a teacher
- ensure that you cannot see it as the student
- ensure that other turnitin options work as intended

Change-Id: I3119b2a3375d7076b40d083f192adb209ca48e87
Reviewed-on: https://gerrit.instructure.com/27049
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
Product-Review: Mike Nomitch <mnomitch@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
2013-12-13 18:16:53 +00:00
Simon Williams 16d804df48 capture js stack trace when possible
in chrome, the 5th argument to window.onerror is the error object which
exposes a sanitized stack trace.

closes CNVS-9916

test plan:
- in chrome, cause a javascript error
- check error reports, it should have a stack trace
- in other browsers, cause a javascript error
- check error reports, it should not have a stack trace, but still correctly
  generate an error report

Change-Id: Ibdeaa612f2ac63b0cc9551a27f47126db974b947
Reviewed-on: https://gerrit.instructure.com/27135
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
Product-Review: Jon Jensen <jon@instructure.com>
2013-12-13 00:32:03 +00:00
Simon Williams abb28daddc remove quiz_submission loading from gradebook1
it's expensive and the only reason we need it is for the quiz id, so we can
link to the quiz submission page.  instead, include the quiz_id in the
assignment object and look it up from there.

fixes CNVS-9943

test plan:
- full regression test of gradebook1, specifically:
- make sure it works for regular assignments and quiz assignments
- make sure it works for students with quiz_submissions and without
- make sure grading students with and without quiz_submissions works
- make sure it works for courses where num students + assignments
  + submissions is < 100 and > 100

Change-Id: I84f4f543d8a021d005f8247c6863c23d794fb621
Reviewed-on: https://gerrit.instructure.com/27300
Reviewed-by: Cameron Matheson <cameron@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2013-12-12 21:21:59 +00:00
Rob Orton 5fea3d7bcd use exception class for category in ErrorReport
rather than using 'default' in rescue_action send
the class of the exception

test plan
 - break a query in an account report
 - run report
 - the ErrorReport should have a category of
   ActiveRecord::StatementInvalid

Change-Id: I14a816aceac4267f36f576226347ddc494110163
Reviewed-on: https://gerrit.instructure.com/27205
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2013-12-12 19:39:21 +00:00
Matthew Irish a4ec80a26e foundation for ember-based screenreader gradebook
this is the initial work on the screenreader interface for gradebook and
is very much a work in progress

at this point all that's expected to work is the initial fetching of
data and the template binding that updates when choosing a student or
assignment from their respective dropdowns

merging to allow work to continue in parallel

closes CNVS-9478

Change-Id: I38db029a86f52b89e0889c7e9189911e5519348b
Reviewed-on: https://gerrit.instructure.com/26938
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Aaron Shafovaloff <ashafovaloff@instructure.com>
Product-Review: Matthew Irish <mirish@instructure.com>
QA-Review: Matthew Irish <mirish@instructure.com>
2013-12-12 19:17:09 +00:00
Jeremy Stanley d01026cf37 decouple grading rights from create/update rights
test plan:
 - create a custom role based on TA
 - deny "Manage (add/edit/delete) assignments and quizzes" to it
 - deny "Manage all other course content" to it
 - keep "Edit grades" and "View all grades" allowed
 - enroll a user with this custom role
 - make sure the user can grade assignments and quizzes
 - make sure the UI elements to create, edit, and delete modules,
   assignments, and quizzes are not shown to this user
   - with draft state disabled
   - with draft state enabled;
   - from the Assignments/Quizzes/Modules page, and also
   - the ability to create an assignment or quiz via module item.
 - make sure that attempts to create, edit, and delete
   quizzes via the API are denied

fixes CNVS-1481

Change-Id: Ic4056f709d48c40b2804aef52a4a1aafc44b5122
Reviewed-on: https://gerrit.instructure.com/27187
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Matt Fairbourn <mfairbourn@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
2013-12-12 17:56:23 +00:00
Jacob Fugal 26047a499d update folio gem for will_paginate view helper
refs CNVS-8795
fixes CNVS-8796

the will_paginate view helper will handle non-ordinal and open-ended
collections now, without hacks around the total_entries value.

test-plan:
 - load the error reports page
 - should load
 - should be paginated
 - first page should have the most recent reports
 - first page should not have a "previous" link
 - first page should have a "next" link (assuming >1 pages worth of
   reports)
 - second page should have a "previous" link
 - second page should have a "next" link (assuming >2 pages worth of
   reports)
 - last page should not have a "next" link

Change-Id: I776b3a1b78267722a47932aa7849593f10938e52
Reviewed-on: https://gerrit.instructure.com/27125
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Anthus Williams <awilliams@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
2013-12-12 00:07:51 +00:00
James Williams d3dcb38ced update flash_notices for rails 3 compatibility
Change-Id: I5584e8c005949e37750a638da60f0f7dbe880893
Reviewed-on: https://gerrit.instructure.com/27174
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2013-12-11 19:59:16 +00:00
Rob Orton 166fc75c50 remove duplicate submitted_at from documentation
test plan
 - docs should generate 

Change-Id: I515e56367b4e5faf8b0b9196651fe0179236d4df
Reviewed-on: https://gerrit.instructure.com/27239
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Rob Orton <rob@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2013-12-11 00:46:39 +00:00
James Williams 5b20c6077c replace original_id attr_accessor with previous_id
in preparation for rails 3

Change-Id: I048e4f8db97dacf64616ad52ec075516b55f3c0f
Reviewed-on: https://gerrit.instructure.com/26966
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2013-12-10 21:33:24 +00:00
Michael Ziwisky 130a150625 Add optional parent coenrolment banner on /login page
fixes CNVS-9350

test plan:
1. Enable the parent coenrolment banner through script/console with:
    a = Account.default;
    a.settings[:self_registration] = true;
    a.settings[:self_registration_type] = 'observer'
    a.save;
2. Verify that /login shows "click here for a parent account" banner.
3. Click that banner.
4. Verify that clicking "Start Participating" without filling out the
   form pops up all of the "Required field" error messages.
5. Verify that submitting bad info (e.g. an email address without an @
   sign) pops up appropriate error messages as well.
6. Enter good info (using a student account you previously registered)
   and verify that you get the the /?registration_success=1 page.

Change-Id: I9920f8599beafee584d574f4f6748d8a298a8bd2
Reviewed-on: https://gerrit.instructure.com/26680
Reviewed-by: Jon Jensen <jon@instructure.com>
Tested-by: Jon Jensen <jon@instructure.com>
Product-Review: Marc LeGendre <marc@instructure.com>
QA-Review: Marc LeGendre <marc@instructure.com>
2013-12-10 18:22:33 +00:00
Joel Hough e201063960 discussion draft state backend
fixes CNVS-9263

test plan
be sure to test ungraded discussions, graded discussions, graded
group discussions (root level and group topics), and announcements

with draft state disabled
- ensure publish icons do not appear on discussion index page
- ensure publish button does not appear on discussion show page
- ensure that discussions for delayed posting are not visible to
 students

with draft state enabled
- ensure that publish icons appear on the discussion index page and
 that clicking them toggles the discussion's publish state
- ensure that publish button appears on the discussion show page
 and that clicking it toggles the discusssion's publish state
- ensure that unpublished topics are not visible to students
- ensure that published topics are visible to students, even if
 the topic is for delayed posting
- ensure that topics for delayed posting show a 'This topic will
 open on' message on the topic show page
- ensure that [un]publishing the root topic of a graded group
 discussion changes the group level discussion and vice versa
- ensure that announcements are published when posted and cannot
 be unpublished

test plan for misc frontend fixes
- as a teacher, create a new discussion
- ensure it is unpublished
- as a student, create a new discussion
- ensure that it is published and that no publish button appears
 on the topic show page or the topic index page

- as a teacher, create a new graded group discussion
- navigate to the group level topic
- publish the topic using the button on the show page
- ensure that the button switches to the 'Published' state

- as a teacher, create an announcement
- ensure that it is published

Change-Id: If0c46d232bc25776770012654af23e5cf10bbb45
Reviewed-on: https://gerrit.instructure.com/26654
QA-Review: Joel Hough <joel@instructure.com>
Reviewed-by: Jon Willesen <jonw@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Clare Strong <clare@instructure.com>
2013-12-10 18:10:57 +00:00
Josh Simpson cb345b65ad QuizQuestion::AnswerParser refactor and clean up
fixes
CNVS-8975,CNVS-8976,CNVS-8974,CNVS-8973,CNVS-8971,CNVS-8972,CNVS-8970,CNVS-8965,CNVS-8966,CNVS-8967,CNVS-8968,CNVS-8969

this commit addresses each of the answer format tickets, with minor
refactoring and cleanup.

Test Plan
Make sure all questions can be created and edited normally.

Change-Id: I65fc184b2ea9bb5cc76e4167bd57031be1f4e3ce
Reviewed-on: https://gerrit.instructure.com/27122
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Derek DeVries <ddevries@instructure.com>
QA-Review: Myller de Araujo <myller@instructure.com>
Product-Review: Josh Simpson <jsimpson@instructure.com>
2013-12-10 16:39:55 +00:00
Jacob Fugal 7f6e8729d2 fix errors in error reports pagination stopgap
comedy of errors:

 * was adding 1 to the wrong paramter (page vs. per_page)
 * adding 1 to per_page was wrong anyways (offset is calculated from
   per_page, not just selection size)
 * was comparing @reports.size to page, instead of per_page
 * but can't use that approach anymore anyways, since we can't change
   the selection size independent of offset

instead, just use offset+pagesize as the total_entries, and then bump it
by one if we're not on the last page, where we check if we're on the
last page with a limit(1) query.

test-plan:
 - load first page of /error_reports
 - should have the most recent report first
 - should have the expected 20 reports
 - should have a next page link (assuming you have more than 20 reports
   in the DB)
 - load last page of /error_reports (e.g. page 3 if you have 50 reports
   in the DB)
 - should have the expected reports (e.g. oldest 10 reports if you have
   50 reports in the DB)
 - should not have a next page link

Change-Id: I141a3513427fe154e81d436460498dc28a2ecff9
Reviewed-on: https://gerrit.instructure.com/27134
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
QA-Review: Brian Palmer <brianp@instructure.com>
Product-Review: Brian Palmer <brianp@instructure.com>
2013-12-07 14:03:28 +00:00
Cameron Matheson c7f26b342d warn when converting assignment to group assignment
closes CNVS-9187

Test plan:
  * make two assignments (not group assignments)
  * on assignment number one, submit some homework
  * edit the assignment and try to convert it to a group assignment,
    you should see a warning
  * try to convert assignment 2 to a group assignment.  there should be
    no warning

Change-Id: I196cbad54fbcfe6df4bcbc3b71d3175e92a104fb
Reviewed-on: https://gerrit.instructure.com/26955
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Cameron Matheson <cameron@instructure.com>
2013-12-07 02:18:38 +00:00
Jacob Fugal ac39cfcf22 clean up paginate calls
fixes CNVS-8791
fixes CNVS-8795

 * "without_count: true" -> "total_entries: nil"
 * move order clauses to the pagination target, rather than being in the
   pagination call
 * clean up implementation of first/last page links in Api.paginate

test-plan:
  - have an account report with at least two instances
  - fetch /api/v1/accounts/:account_id/reports/:report
  - response should have most recent report instance first

  - have two subaccounts under an account
  - fetch /api/v1/accounts/:id/sub_accounts?recursive=true&per_page=1
  - Links response header should not have a link with rel=last
  - fetch /api/v1/accounts/:id/sub_accounts?recursive=false&per_page=1
  - Links response header should have a link with rel=last embedding
    page=2

  - load /error_reports
  - should have most recent reports first

  - fetch /api/v1/conversations/batches
  - should have oldest batch first

Change-Id: Ifef79b193720a09ad7fe059ed23e930c97d10f59
Reviewed-on: https://gerrit.instructure.com/26535
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
2013-12-07 00:04:06 +00:00
Anthus Williams 16011eaa32 don't display filename to unauthorized users
Fixes CNVS-5551

Test plan
- As user 1, upload a file and then delete it
- User 1 should see the name of the newly deleted
  file in the notice returned when browsing to
  /users/1/files/[Deleted-File-ID]
- Log in as user 2 and try
  to access /users/2/files/[Deleted-File-ID]
- you should not see the file name but
  rather a simple unauthorized message

Change-Id: Iab277b60c80e599790d76bcc86f3a73181e3b483
Reviewed-on: https://gerrit.instructure.com/26702
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
Product-Review: Anthus Williams <awilliams@instructure.com>
2013-12-06 19:21:59 +00:00
Jason Madsen 7506b21672 implement quizzes index in ember
closes cnvs-9403, cnvs-9400, cnvs-9399

test plan:
  -- enable fabulous quizzes for Account.default
  -- navigate to quizzes index
  -- layout should match non-fabulous, draft state quizzes index
  -- links (new, question bank, view quiz, edit, delete) should all work
  -- search / filter quizzes should work

Not addressed in this commit (ember quizzes is wip behind a private flag):
  - publish button
  - user permissions
  - multi-available data tooltips
  - recent verbiage updates for available dates

Change-Id: Ib3646c7e0addce11e96d848bcf9e53335965fce9
Reviewed-on: https://gerrit.instructure.com/26531
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Myller de Araujo <myller@instructure.com>
Reviewed-by: Stanley Stuart <stanley@instructure.com>
Product-Review: Jason Madsen <jmadsen@instructure.com>
2013-12-05 19:18:58 +00:00
Jeremy Stanley 83d938af12 fix asset tag for undeleting wiki pages
it's wiki_page_XXX, not wiki_pages_XXX

fixes CNVS-7795

test plan:
 - delete a wiki page in a course
 - go to /courses/X/undelete and restore the page

Change-Id: Ia7607e1c2113d1f00a73a4a1cafb142cc6c3c6fd
Reviewed-on: https://gerrit.instructure.com/26979
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Matt Fairbourn <mfairbourn@instructure.com>
Product-Review: Mark Severson <markse@instructure.com>
Reviewed-by: Mark Severson <markse@instructure.com>
2013-12-05 17:38:39 +00:00
Cameron Matheson 463c9462b2 allow adding submission comments with attachments via the api
closes CNVS-5781

Test plan:
  repeat the following for a student and teacher, for a regular
  assignment and a group assignment (try two students from the group
  when testing the group assignment)
    * Use the new submission comments api to upload a file for an attachment
    * attach the file to a comment using the submissions API

Change-Id: I710cec8171dc028582267caae91cc448f1e8ae4c
Reviewed-on: https://gerrit.instructure.com/26544
Reviewed-by: Cameron Sutter <csutter@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
Product-Review: Cameron Matheson <cameron@instructure.com>
2013-12-04 20:38:38 +00:00
Rob Orton 75d33c951e add last_activity_at to api enrollment object
closes CNVS-9752

test plan:
 - enrollments api should include the last_activity_at

Change-Id: Id854d163280a6f77c88601b212809fd36f5842d3
Reviewed-on: https://gerrit.instructure.com/26860
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2013-12-02 22:30:23 +00:00
Rob Orton a00534c678 return 404 for non existing account reports
closes CNVS-9775

test plan
 * hit api with post to /api/v1/accounts/self/reports/bad_report_csv
 * should return 404

Change-Id: If425aea95a89b9e988d229b0d471150b51b7bded
Reviewed-on: https://gerrit.instructure.com/26866
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2013-12-02 22:30:10 +00:00
Nick Cloward 53a0f077d8 modify logging tab UI
fixes: CNVS-9511

The initial logging tab in admin tools needs to have the ability to support more
then one type of log.  This adds a backbone view layer to the tab and also
provides a drop down for selecting a log type.

Test Case:
  1.  Open the Admin tools and the logging tab.
  2.  A drop down should be displayed. (Follows wireframe in ticket CNVS-9511)
  3.  Default option should be 'Select a log type.'
  4.  Pick the only log type available of 'Login / Logout Activity'
  5.  The usual Login / Logout Activity functionality should be shown.
  6.  Ensure this is not broken by going through its functionality.
  7.  The drop downs default value should be removed since one has been chosen.

Note:
More log types are coming.  This is just extracting the UI to support more types.

Change-Id: I5c22f7f8e60dd1f5370270bdde22fadecb3b958e
Reference: CNVS-8996
Reviewed-on: https://gerrit.instructure.com/26687
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Nick Cloward <ncloward@instructure.com>
2013-12-02 20:38:00 +00:00
Rob Orton 4638782cb9 make user search use api_find
fixes CNVS-9744

test plan
 - in GET /api/v1/search/recipients
 - pass user_id=sis_user_id:SIS_ID
 - it should work

Change-Id: I15b3b2a10f3478c40d8141e2350809d49af0263e
Reviewed-on: https://gerrit.instructure.com/26832
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2013-12-02 19:22:13 +00:00
Derek DeVries 008a784bd1 update due dates and availability info for quizzes on index page
fixes CNVS-9679

test plan:
  As a teacher:
  - The availability date should display in six different formats
    - Blank (when there is no availability dates)
    - "Available" (when the assignment is unlocked, and there is no lock date)
    - "Not available until <date>" (when the assignment is not unlocked yet)
    - "Available until <date>" (when the assignment is unlocked and has a lock date)
    - "Closed" (when the locked date has passed)
    - "Multiple Availability" (when there are multiple availability dates)
  - Add different variations on availability dates for quizzes
  - Check that the format appears correct
  - Generally availability and due dates should work the same between quizzes
    and assignments

  As a student:
    - The format of availability / due dates should generally work similarly
      to that of a teacher except:
    - It should never show "Multiple Availability" for due dates
    - It should never show "Multiple Availability" for availability dates

Change-Id: If68c15049f854ff42def76239e2dcfd4901fcc20
Reviewed-on: https://gerrit.instructure.com/26792
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Josh Simpson <jsimpson@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Product-Review: Derek DeVries <ddevries@instructure.com>
2013-12-02 16:39:18 +00:00
Mark Severson 980004aa49 don't return unpublished assignments to students
unpublished assignments are only returned if the querying user is a
teacher; students only have published assignments returned

test plan:
 - in a course with draft state enabled
 * navigate to the syllabus page as a teacher
   - unpublished assignments should be visible
 * navigate to the syllabus page as a student/observer
   - unpublished assignments should not be visible

fixes CNVS-9169

Change-Id: Ie23bc0fe1d2180b145a80cbc742ea8c438c77dc1
Reviewed-on: https://gerrit.instructure.com/26691
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Nathan Rogowski <nathan@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2013-12-02 16:27:34 +00:00
Jeremy Stanley 4324cee825 make create-assignment (non-API) endpoint respect draft state
test plan:
 - enable draft state in a course
 - create a module
 - create an assignment via add-module-item
 - the assignment should not be initially published

fixes CNVS-9318

Change-Id: I8bbf14b2ca499b91ff69b83508da21185def88dd
Reviewed-on: https://gerrit.instructure.com/26720
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Nathan Rogowski <nathan@instructure.com>
2013-12-02 15:54:39 +00:00
Jon Willesen b5acad5123 fix loading course calendar event edit page with section dates
there was a javascript error on this page because it was
comparing a string id to a numeric id. the splitAssetString
function was still returning the id it parses out as a number
instead of a string. most places that call this function won't
care about the change. the one place that did only cared because
it was comparing it to data coming from ENV that should have
been using string ids anyway.

this also exposed a race condition in our javascript loading,
where one bundle can start an ajax call before the common bundle
loads the ajaxPrefilter in the instructure.js file. an explicit
dependency fixes this specific issue; the more general problem
should be solved in a separate commit.

fixes CNVS-9182

test plan:
 - create a course calendar event with section specific dates.
 - navigate to one of the events in the calendar, click on it,
   click the "edit" button, then the "more options" button.
 - should take you to the event's edit page, which should load
   normally. Note that it can take a minute to load the event
   edit page the first time and it doesn't have a loading
   indicator (which is a separate issue).

Change-Id: I7c2525081973ad5327b5508bba3d544e83a34b9c
Reviewed-on: https://gerrit.instructure.com/26567
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
QA-Review: Steven Shepherd <sshepherd@instructure.com>
Product-Review: Jon Willesen <jonw@instructure.com>
2013-11-27 20:20:49 +00:00
Cameron Matheson 187181fc9b Don't query for non-numeric rubric ids
fixes CNVS-5603

Test plan:
  * Go to /courses/NN/rubrics/what_this_isnt_a_rubric_id
  * you should get a 404 response, not a 500

Change-Id: I4eb68818270c7c31a631723501b41413a1430f3a
Reviewed-on: https://gerrit.instructure.com/26735
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cameron Sutter <csutter@instructure.com>
Reviewed-by: Liz Abinante <labinante@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
Product-Review: Cameron Matheson <cameron@instructure.com>
2013-11-27 18:46:52 +00:00
Zach Pendleton 32b4ef475a move google docs domain restriction to feature flag
fixes CNVS-9686

test plan:
  * as a site admin, navigate to a root account's settings
    page, select the feature flags tab, and verify that the
    google docs domain restriction is there;
  * enable the feature;
  * reload the settings page and verify that there is a
    domain text input in the settings form;
  * verify that if set, the google docs restriction
    prevents users with invalid google docs domains from
    submitting assignments;
  * verify that when turned off, users can submit
    assignments on any domain.

Change-Id: I1078c4d0d6d56e04ee882e1d58e6e1c302cf4caa
Reviewed-on: https://gerrit.instructure.com/26657
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Steven Shepherd <sshepherd@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
Product-Review: Zach Pendleton <zachp@instructure.com>
2013-11-27 15:37:01 +00:00
Brad Humphrey 4b0345c629 removing unneccessary borderless launch template
the tool_show template already had a mechanism for launching
a tool full screen.

Test Plan:

 * Borderless launches should still work

fixes PLAT-244

Change-Id: Idab2e7f9b61e06c0bfb9e99f0cd70f027b77d147
Reviewed-on: https://gerrit.instructure.com/26728
QA-Review: Nathan Rogowski <nathan@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
2013-11-26 23:19:57 +00:00
Ahmad Amireh 6fafe23b61 More accurate Access Report scores for Quizzes
This patch makes it that when viewing the Access Report for a course
student, their "Times Viewed" column will reflect the number of times
the student has browsed the quiz or any of its related resources
(like History, or attempt views), but not taken it.

While the "Times Participated" column will reflect the number of times
the student really took the quiz (1:1 mapping with the number of
submissions.)

TEST PLAN
---- ----

In both test cases, you'll need:
  - a course with a student enrolled
  - one browser session with a teacher logged in viewing the Access
    Report of the student
  - one browser session with the student logged

CASE: Normal quizzes

  - Create a quiz with a few questions and unlimited attempts.
  - Refresh the teacher tab, keep an eye on Times "Viewed" and
    "Participated" columns
  - As the student:
    - Go to the quizzes page
    - Go to the quiz page
  - Refresh the teacher tab, and:
    - ONLY the "Times Viewed" score should be incremented by 1
  - As the student:
    - Push the Take the Quiz
  - Refresh the teacher tab, and:
    - ONLY the "Times Participated" score should be incremented by 1
  - As the student:
    - Refresh the quiz page (while taking it)
  - Refresh the teacher tab, and:
    - NEITHER score should be incremented

CASE: OQAAT quizzes

The expected behaviour for OQAAT quizzes is that the entire attempt
counts as 1 participation, just like the normal quizzes.

Follow the same steps as above, but:

  - While taking the quiz, and for every question page:
    - Refresh the teacher tab and make sure that neither score is
      incremented

OBLIGATORY REFERENCES
---------- ----------

  - Acceptance criteria @ http://docs.kodoware.com/canvas/cnvs-5294

refs CNVS-5294

Change-Id: I55883b8edbf417edb42b9fd103e08369e0e9e63c
Reviewed-on: https://gerrit.instructure.com/26543
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Derek DeVries <ddevries@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Derek DeVries <ddevries@instructure.com>
2013-11-26 23:05:01 +00:00
Derek DeVries 31db7d5bb9 refactor and add api documentation for quizzes#reorder
fixes CNVS-8963

test plan:
- reordering questions in a quiz should continue to work
- reordering of questions within a quiz group should continue to work
- try dragging questions out of a quiz group
- try dragging questions into a quiz group
- Try out the API for reordering questions within a quiz
- Try out the API for reordering questions within a quiz group

Change-Id: Ic2b4a839979f54a4a5d98eaaafd09950f57f17b5
Reviewed-on: https://gerrit.instructure.com/26703
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Josh Simpson <jsimpson@instructure.com>
QA-Review: Myller de Araujo <myller@instructure.com>
Product-Review: Derek DeVries <ddevries@instructure.com>
2013-11-26 21:12:22 +00:00
Jeremy Stanley dcf3df456b move draft state under feature flag umbrella
fixes CNVS-9496

test plan:
 - draft state feature should show up in site admin feature
   flags, or root account feature flags when called as site
   admin
 - when site admin hits "allow" for the feature, it should
   appear in the root account administrator's settings
   in "Off" state
 - the root account admin should be able to "Allow" the setting
   which allows a sub-account or course to turn it on
 - when the feature is turned on via the Feature Settings tab
   or features API, draft state functionality should appear
   in the course wiki pages and elsewhere

Change-Id: Id7403f2a8371b0a7bfebffbb8f29330fff5c94c5
Reviewed-on: https://gerrit.instructure.com/26308
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Nathan Rogowski <nathan@instructure.com>
2013-11-26 20:43:49 +00:00
Josh Simpson 30b640ba96 add input validation for quiz groups
fixes CNVS-9282
this commit adds input validation to quiz groups for pick_count and
question_points, requiring the data given by the user to be numerical.

Test Plan
1. Create a Question Group with non-numerical values for pick count and
question points.
- Validation should fail and alert the user.

Change-Id: I13b1c95763504afd13f2f16e1a2de190e836c085
Reviewed-on: https://gerrit.instructure.com/26656
Reviewed-by: Derek DeVries <ddevries@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Myller de Araujo <myller@instructure.com>
Product-Review: Josh Simpson <jsimpson@instructure.com>
2013-11-26 18:45:45 +00:00
Brad Humphrey 64394c32e4 shows a user warning for insecure tool launches
Test Plan:
  * Install an http tool
  * Launch the tool using each major browser
    - A warning should be displayed at the top of the page content
   * If the tool launch is blocked by the browser:
     - A button should appear
     - The button should launch the tool in a new tab
   * If the tool launch is not blocked by the browser:
     - The warning message should be removed

fixes PLAT-236

Change-Id: Ib3ae167a3ad542ece4e7c8a8f61bde92a12945d6
Reviewed-on: https://gerrit.instructure.com/26475
QA-Review: Nathan Rogowski <nathan@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Eric Berry <ericb@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
2013-11-26 16:56:28 +00:00
Ahmad Amireh 5cf830b081 Quiz Submissions API - Show
SIDE CHANGES
---- -------

  - Some specs that were originally in the #index context are now in the
    #show context as they make more sense there
  - quiz_submission_files route resource group endpoint(s) changed to
    become consistent with the rest of the Quiz nested API endpoints

TEST PLAN
---- ----

  - Create a quiz
  - Take the quiz as a student and make a submission
  - Perform a GET request to the following endpoint:
    /api/v1/courses/:course_id/quizzes/:quiz_id/submissions/:id
    - Verify that the returned "quiz_submissions" collection contains
      the submission you've just made
  - Perform the request as:
    - the student who made the submission:
      - you should see it
    - the course teacher:
      - you should see it
    - anyone else:
      - you should not see it

fixes CNVS-8979

Change-Id: I018c63e4a27af0fe88d3cccbe955440a03965ba9
Reviewed-on: https://gerrit.instructure.com/26653
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>
2013-11-26 16:33:40 +00:00
Ahmad Amireh 0dff562ba8 Quiz IP Filters API controller - #index
This patch moves rendering of IP filters from the QuizzesController into
a separate, specialized API controller - QuizzesIpFilters.

The rendered IP filter object is backwards-compatible, as in it provides
the same three attributes: name, account, and filter. However, the endpoint
output has been modified to scope the array of filters under "quiz_ip_filters".
The front-end/JS part has been adjusted to accommodate this change.

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

In an effort to reduce complexity, I've also taken to refactor all the
:before_filters that were looking up Quiz in the current context across
all Quiz controllers (where it was applicable), and that was done by
introducing a new component set: API Helpers.

API Helpers are modules that can be mixed-in, just like the API Modules,
that are really just a place to hold routines common between the API
and the regular controllers. I've put the first one in
lib/api/v1/helpers, namespaced under Api::V1::Helpers...

TEST PLAN
---- ----

  - Create a Quiz. No questions.
  - Set an IP filter of 192.168.1.1 on the Quiz
    - the restriction should still hold like it usually does
  - Perform a GET request to this endpoint:
    /courses/:course_id/quizzes/:quiz_id/ip_filters
    - A list of filters should be returned in JSON-API format containing
      the filter you set for the Quiz
  - Add one or more IP Filters on the account-level, and:
    - Re-perform the GET query:
      - The list should contain both the Quiz and the Account filters
    - Using the IP Filter search box from the Quiz settings page:
      - It should still properly list the available filters

refs CNVS-8988, CNVS-9586

Change-Id: I75c1b85024a58e6accd1627b7bee3da1185d2658
Reviewed-on: https://gerrit.instructure.com/26440
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>
2013-11-26 10:26:21 +00:00
Cameron Matheson ba1b63ec92 don't leak muted assignment scores on grade summary page
fixes CNVS-9633

regression from I2f989c0b0dba9a17c904ba516154adb18ceaaad5

Test plan:
  * mute an assignment in a course
  * load the students grade page as a student
  * grade the assignment for that student
  * refresh the student grades page
  * the assignment group totals should not have changed

Change-Id: I21651cf5be341224910dcca56f02154ef3ab77f4
Reviewed-on: https://gerrit.instructure.com/26666
Reviewed-by: Simon Williams <simon@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
Product-Review: Cameron Matheson <cameron@instructure.com>
2013-11-25 23:00:12 +00:00
Brian Palmer c5114c418a rails3: errors_add_to_base was removed
The errors.add_to_base(...) method was removed in rails3, so this replaces
all instances of that with errors.add(:base, ...) which also works in
rails2 and is forward compatible with rails3, semantically as well as
syntactically.

test plan: specs cover some of these error responses, generally you'll
want to make sure that validation errors still get displayed correctly.
for instance when accessing /plugins/etherpad and saving the settings
without filling in all the fields, should display an appropriate error

Change-Id: Icab1592470bf5bd86912655d5b847cfe413bd003
Reviewed-on: https://gerrit.instructure.com/26180
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Product-Review: Brian Palmer <brianp@instructure.com>
2013-11-25 16:57:42 +00:00
Jacob Fugal cd892fe723 clean up context.users_not_in_group
for rails3 and folio

fixes CNVS-8790

test-plan:
 - validate pagination of unassigned group members both for course
   groups and account groups

Change-Id: Ic9e842abdbfba714829a123ca0dee4f93e5a1fdc
Reviewed-on: https://gerrit.instructure.com/26534
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
2013-11-25 16:37:50 +00:00
Zach Pendleton 1a089f7224 add google docs restriction ui settings
fixes CNVS-8948

test plan:
  * as a site admin, visit the account settings page of a
    root account and verify that a new section, "Allowed
    Google Docs Domain" appears, can be set, and persists
    over page refreshes;
  * visit the site admin settings page and verify that the
    section does not appear;
  * visit the settings page of a sub-account and verify that
    the section does not appear;
  * visit a root account settings page as an account admin
    of that root account and verify that the section does
    not appear.

Change-Id: Iace893269ff1cbe12f2670be242f1ad56673dd03
Reviewed-on: https://gerrit.instructure.com/26437
Reviewed-by: Jon Willesen <jonw@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Steven Shepherd <sshepherd@instructure.com>
Product-Review: Zach Pendleton <zachp@instructure.com>
2013-11-23 17:10:43 +00:00
Zach Pendleton 557a3dae9e restrict google doc submissions by domain
fixes CNVS-8949

test plan:
  * from a rails console, run the following:

    account = Account.default
    account.settings[:google_docs_domain] = 'example.com'
    account.save!

  * as a student, configure your google docs integration
    from your profile page;
  * attempt to submit an assignment that allows file
    uploads using the "google docs" tab of the submissions
    box;
  * verify that a message is displayed informing you that
    cannot use a google doc because your domain is
    incorrect;
  * as another user who shares a course with the first
    student, create a google doc collaboration and add
    the first student to it;
  * verify that the first student cannot join the
    collaboration;
  * change the account :gmail_domain setting to 'gmail.com'
    and verify that both assignment submissions and
    collaborations work as expected;
  * verify that if you delete the gmail domain account
    setting, both google doc submissions and collaborations
    work as expected for users with google docs integration
    configured.

note: users added to a collaboration without a valid google
docs address will receive a notification about the
collaboration, but will not be able to join it. this is
pre-existing behavior.

Change-Id: I26f164f253710819214ccf5f2250b74b91a6774b
Reviewed-on: https://gerrit.instructure.com/26436
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
Product-Review: Zach Pendleton <zachp@instructure.com>
QA-Review: Zach Pendleton <zachp@instructure.com>
2013-11-23 17:10:31 +00:00