Commit Graph

3375 Commits

Author SHA1 Message Date
James Williams 7cb416f839 inherit default group quotas from parent accounts
test plan:
* on the quotas tab of the account settings,
 set a group quota for an account
* create a subaccount
* should have the same default quota as the parent
 account

closes #CNVS-14971

Change-Id: Icdb8e4a9666e4b7f03d9819ae7eab42627fff5ef
Reviewed-on: https://gerrit.instructure.com/44678
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Matt Fairbourn <mfairbourn@instructure.com>
QA-Review: Sean Lewis <slewis@instructure.com>
2014-11-25 01:29:18 +00:00
James Williams 29e307d73a hide admin-only account_navigation tools from teachers
test plan
* add an external tool to an account with an
 'account_navigation' placement configured with
 visibility set to 'admins'
 (see the ticket for example xml)

* as a teacher, navigate to the course settings page,
 then click on the account name under "Department" to
 go to the account settings page

* the external tool should not be shown in the account
 navigation tabs

closes #CNVS-17050

Change-Id: I1b51c3c5cb3a56d794eb5b558e1261cc94aab0d5
Reviewed-on: https://gerrit.instructure.com/44758
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
QA-Review: August Thornton <august@instructure.com>
2014-11-24 23:54:57 +00:00
Nathan Mills d0fb188b10 construct uniq resource_link_id for lti_links
fixes PLAT-736

test plan:
install the lti2 test tool with all placements enabled
launch the tool from the different placements
every module item and assignment should have a uniq resource_link_id
course_nav and account_nav should have a uniq resource_link_id

Change-Id: Ifb65a27fa5b7758a27f20684a5af3f5c9bb03100
Reviewed-on: https://gerrit.instructure.com/44051
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brad Humphrey <brad@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Nathan Mills <nathanm@instructure.com>
2014-11-24 23:34:49 +00:00
Nathan Mills 6ffeddcc46 setup default lti2 placements
fixes PLAT-691

test-plan

install a test provider using this url template:
/accounts/{account_id}/lti/tool_proxy_registration?tool_consumer_url=https://lti-tool-provider-example.herokuapp.com/register

during install select no placements
it should show up in the assignment and module item selection

regression test module and assignment lti launches

Change-Id: Ie8a3bee8ddb9a8e9cb8671545448a4bb73caae73
Reviewed-on: https://gerrit.instructure.com/42623
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Reviewed-by: Brad Humphrey <brad@instructure.com>
Product-Review: Brad Humphrey <brad@instructure.com>
Product-Review: Nathan Mills <nathanm@instructure.com>
2014-11-24 23:34:28 +00:00
Ahmad Amireh 7b74b9887d Quiz stats cleanup
Removed a couple of fields we're not using from the API and adjusted the
docs. Also added reminders for things to drop once new stats replaces
the legacy version.

Closes CNVS-16519, CNVS-13387

TEST PLAN
---- ----

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

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

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

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

Closes CNVS-16802

Other things:

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

TEST PLAN
---- ----

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

Preparation:

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

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

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

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

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

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

Change-Id: I3330bd987396aa84937af295390ec169b06c58e9
Reviewed-on: https://gerrit.instructure.com/44335
Reviewed-by: Derek DeVries <ddevries@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Trevor deHaan <tdehaan@instructure.com>
Product-Review: Ahmad Amireh <ahmad@instructure.com>
2014-11-21 02:57:46 +00:00
Nick Cloward 5818ed9458 add external integration keys
refs: CNVS-16627

First part is to add the framework for tracking external keys.  This
commit handles the ability to add multiple types easily to the
external_integration_keys with custom rights per type of key.

Test Plan:
 - Make sure the section for External Integration Keys does not display
   when no types are set.
 - Add a few custom types to the external integration keys with all
   combinations of write and read rights.
 - Make sure you can edit the appropriate keys inside the account
   settings page and that they are persistent.
 - Remove a value from a key and it should delete the appropriate
   record.
 - If the user does not have access to any keys the section should not
   display.

Change-Id: I37d56c3ee1bf44876c220e9d5a1ae80a22ac1289
Reviewed-on: https://gerrit.instructure.com/44161
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Colleen Palmer <colleen@instructure.com>
2014-11-21 01:19:24 +00:00
Cameron Sutter 613e298271 DA - update gb cells on the fly
fixes CNVS-16565

test plan:
 * setup DA
 * setup an assignment that is only visible to two sections
 * grade all of a student's submissions so that he has a 100% in the class.
 - remove that student's section from the list of overrides on the assignment
 - navigate to gb
 - remove the student's grade for that assignment
 > the cell should be grayed out
 > the student's grade should still be a 100%
 - repeat the above with 'treat ungraded as 0' turned on

 * using all the api endpoints that return assignment submissions
   - including by not limited to:
     submit an assignment, index, show, grade a submission
 * include 'include[]=visibility' in the request
 > each submission object returned should have an 'assignment_visible' attribute
   which should match whether the submitter has visibility

Change-Id: I6eb5324ea5b96738cc40fb2446fc4bc96db094c5
Reviewed-on: https://gerrit.instructure.com/43618
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Mike Nomitch <mnomitch@instructure.com>
QA-Review: Sean Lewis <slewis@instructure.com>
Product-Review: Hilary Scharton <hilary@instructure.com>
2014-11-20 22:01:19 +00:00
Andrew Butterfield 5a2eaa57d8 Correct sorting for numerically named groups
fixes CNVS-14327

Followed the tutorial at: https://gollum.instructure.com/sorting. Used
the database level solution

Groups sort first by group category name and then by group name both on
the server side and the client side.

Updated app/coffeescripts/util/natcompare.coffee because when the tests in
public/javascripts/compiled/ember/student_groups/tests/controllers/student_groups_controller.spec.js
one fails because window.I18n.locale is not defined or is null. Hence I
added a default of 'en-US'.

Added spec for server side sorting check.

Test Plan:
* Create a group set and add groups named 1-9, 10, 110, 28 and whatever
  other numbers you want
* Notice as a teacher that the groups are naturally ordered meaning that
  10 and 110 don't come directly after 1 for example

* Next, login as a student and verify that groups are naturally ordered

* Then on the account level, enable the new student groups option
* As a student go back to the groups page and verify that the ordering
  is natural on the new students group page

* Groups get pulled down from the server in groups of 50. I would
  suggest creating two group sets with the names 1 and 2. Add a couple
  groups to group set 1, then add 50+ groups to group set 2, and then
  add a couple more groups to group set 1 but that would come after the
  groups in group set 1. Then check to make sure that when the page
  loads all of group set 1's groups appear at the top of the page in the
  correct order.

Change-Id: Ie066abd3cef237fd8c8c0f73231cea0177756e21
Reviewed-on: https://gerrit.instructure.com/43565
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Braden Anderson <braden@instructure.com>
QA-Review: Steven Shepherd <sshepherd@instructure.com>
Product-Review: Janelle Seegmiller <jseegmiller@instructure.com>
2014-11-20 18:23:05 +00:00
Mysti Sadler 0154dc6d22 Update Diigo API URL
test plan
 - verify you can set up the diigo plugin with the information in gollum https://gollum.instructure.com/OtherServiceTestAccounts
 - on the user settings page, verify you can use your diigo username and password to register the service

Change-Id: I78fb9614f03a51a8e0d11ac806a49a7a85e8e2f7
Reviewed-on: https://gerrit.instructure.com/44379
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Clare Strong <clare@instructure.com>
Product-Review: Mysti Sadler <mysti@instructure.com>
2014-11-20 03:12:58 +00:00
Rob Orton 2a4f455f5f allow excluding students from global surveys
also bump switchman to allow for .uniq across shards

fixes CNVS-14873

test plan
 - site admin survey should go to students by
   default
 - accounts/self/settings should have checkbox to
   include students in global surveys checked by
   default
 - accounts that have unchecked setting should
   exclude students from global surveys
 - regular announcements should still get to
   students
 - checkbox should only be visible to site admin

Change-Id: I5b268f3e19f8710cdaf0e40f37e9af87ff437649
Reviewed-on: https://gerrit.instructure.com/44457
QA-Review: August Thornton <august@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2014-11-19 20:45:23 +00:00
Jeremy Stanley 96362fd69a data model and API for file usage rights
test plan:
 1. consult the files API documentation and note the additions:
   A. usage_rights include parameter on 'List files'
   B. usage_rights include parameter on 'Get file'
   C. 'List licenses' endpoint
   D. 'Set usage rights' endpoint (PUT)
   E. 'Remove usage rights' endpoint (DELETE)
 2. exercise these new API features

closes CNVS-16826
closes CNVS-16841

Change-Id: I6c01128423adc24a5b70f71bb109d5a005379c37
Reviewed-on: https://gerrit.instructure.com/44403
Reviewed-by: James Williams  <jamesw@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Anna Koalenz <akoalenz@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2014-11-19 16:14:00 +00:00
Michael Nomitch 3347ca8df2 DA - avoid seq scans in scopes
test plan:
  - with DA on and OFF
  - assignments & discussions & quizzes & modules indices load
    and filter properly for students/teachers
  - assignments needing submitting/grading load and
    filter properly
  - grade summary page for students & teachers loads
    and filters assignments properly

Change-Id: Ibff8ff0357360a7e09d500c2475885f3dfb7f495
Reviewed-on: https://gerrit.instructure.com/44215
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2014-11-19 15:41:47 +00:00
James Williams ac12c555d2 invalidate cached stream item instances after item deletion
test plan:
* with caching enabled, create an announcement or other
 object that creates items in the "Recent Activity"
* delete the item
* should refresh the activity right away and not
 show the now deleted item

closes #CNVS-962

Change-Id: I28b2165c238ad074c345db23b64384439d8b8efb
Reviewed-on: https://gerrit.instructure.com/44477
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Dan Minkevitch <dan@instructure.com>
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2014-11-18 17:50:40 +00:00
James Williams 1de91edaa2 show custom role names in courses drop-down
test plan:
* create a custom course-level role for an account
* enroll a user into an active course with the custom role
* as that user, the "Courses" dropdown menu on the navigation header
 should read "Enrolled as: [Custom Role]" instead of
 the base type for the role

refs #CNVS-5349

Change-Id: Ife07a10852de3d5376a945c9f35d3ef56cb4ca58
Reviewed-on: https://gerrit.instructure.com/44507
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
Product-Review: Cosme Salazar <cosme@instructure.com>
2014-11-18 16:21:51 +00:00
Cody Cutrer dd1b16828c don't delete from params in AssignmentsController
refs CNVS-16685

Change-Id: I9f778191f7a552a5294ba74f138b0758d7b821eb
Reviewed-on: https://gerrit.instructure.com/44287
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Nick Cloward <ncloward@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2014-11-17 18:58:42 +00:00
Spencer Olson 9cde815d68 add grading period group model
add GradingPeriodGroup, and change associations between GradingPeriods,
GradingPeriodGroups, Courses, and Accounts. also adjust the grading
periods controller to account for addition of grading period groups

closes CNVS-16538

test plan:
-run bundle exec rake db:migrate, and bundle exec rake db:migrate RAILS_ENV=test
-verify the migrations successfully run
-open the rails console in sandbox: bundle exec rails c -s
-create a course, a few grading periods, and a grading period group. Add the grading periods to the group. Assign
  the grading period group to the course.
  $ course = Course.create
  $ grading_period1 = GradingPeriod.create(weight: 25.0, start_date: Time.zone.now, end_date: 2.days.from_now)
  $ grading_period2 = GradingPeriod.create(weight: 30.0, start_date: Time.zone.now, end_date: 2.days.from_now)
  $ grading_period_group = GradingPeriodGroup.create()
  $ grading_period_group.grading_periods << grading_period1
  $ grading_period_group.grading_periods << grading_period2
  $ grading_period_group.course = course
-verify the associations are working as expected, i.e. a GradingPeriodGroup has GradingPeriods, a GradingPeriod
  belongs to a GradingPeriodGroup, and a GradingPeriodGroup belongs to a course or account.
  $ grading_period_group.grading_periods #should return an array containing grading_period1 and grading_period2
  $ grading_period1.grading_period_group #should return grading_period_group
  $ grading_period2.grading_period_group #should return grading_period_group
  $ grading_period_group.course #should return course
  $ grading_period_group.account #should return nil (should not throw error)

Change-Id: I9d7465431dabd2afa18e7a8a33706b9a78a94cd1
Reviewed-on: https://gerrit.instructure.com/43512
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Josh Simpson <jsimpson@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Product-Review: Spencer Olson <solson@instructure.com>
2014-11-14 22:07:00 +00:00
Ryan Shaw 8af0fe3391 fix link to user files when newfiles is turned on
fixes: CNVS-16393

/dashboard/files did the same thing as /files
in old files. we don't want to continue to support
the /dashboard prefixed url and prefer to just
use /files.

test plan:
* with newfiles turned off:
* click your name in very top (next to "inbox settings logout")
* click the "Files" tab on the left
* it should render the oldfiles browsing interface

* now, with: User.find(<your_user_id>).account.enable_feature!(:better_file_browsing)
* do the same thing, and it should render newfiles

* they both should go to /files. not /dashboard/files

Change-Id: Ic18e6d93031b9ebc6798849cadc441c2a664e1f0
Reviewed-on: https://gerrit.instructure.com/44337
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Dan Minkevitch <dan@instructure.com>
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
Product-Review: Matt Fairbourn <mfairbourn@instructure.com>
2014-11-14 16:28:46 +00:00
James Williams 9945043150 fix role overrides fetching for site admin on a separate shard
test plan:
* have site admin on one shard
* make a custom account role
* give it all the permissions
* login as a user with that custom role
* visit an account on another shard
* should have all the permissions

Change-Id: I2a128a672b7b6973e1d25c58d635f0147a486240
Reviewed-on: https://gerrit.instructure.com/44353
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2014-11-13 19:09:51 +00:00
Cody Cutrer 517fd5b754 be more defensive of special account creation
fixes CNVS-16632

don't auto-create unless the setting was previously nil, and we're
*not* in production mode. production mode *requires* using
rake db:initial_setup.

test plan:
 * existing canvas install should work
 * a fresh canvas install should also work

Change-Id: Iee4b0ead053aef220aac5f54c519174ce1b41843
Reviewed-on: https://gerrit.instructure.com/43845
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: August Thornton <august@instructure.com>
2014-11-13 17:04:06 +00:00
Cody Cutrer ad93871703 use scopes instead of associations with joins
associations with joins were never really supported by rails

test plan:
 * canvas works

Change-Id: I62dd9b38c7340fce96351f1e3ba91acd6440aa66
Reviewed-on: https://gerrit.instructure.com/42856
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>
2014-11-13 16:54:22 +00:00
Nick Houle 2ef228be06 UI for adding SIS token to canvas
fixes SIS-641

Test plan:
- generate a token in SIS App
- copy and paste the token in the 'SIS Token Authentication' field
-- you must enable the Post Grades to SIS feature to see this setting
- update the settings and confirm the sis token was saved

Change-Id: I13f2e0136809c42d7b7c7b30c330efb11f6dc29f
Reviewed-on: https://gerrit.instructure.com/44358
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Tyler Pickett <tpickett+gerrit@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Nick Houle <nhoule@instructure.com>
2014-11-13 02:06:47 +00:00
Ahmad Amireh 26d7cb06c3 Quiz Reports API - force regeneration
Extends the quiz reports API with the ability to re-trigger failed CSV
generation jobs, and to abort them completely. The UI is extended to
utilize those new APIs.

Closes CNVS-16525

TEST PLAN
---- ----

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

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

Launch a rails console and perform the following command:

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

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

Change-Id: I467a9030c3ef94d685ec20b31dd533e530e24758
Reviewed-on: https://gerrit.instructure.com/43862
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Trevor deHaan <tdehaan@instructure.com>
Reviewed-by: Derek DeVries <ddevries@instructure.com>
Product-Review: Derek DeVries <ddevries@instructure.com>
2014-11-12 22:49:38 +00:00
James Williams 193b95ed29 UI and API update for role overrides to allow editing name
also a bit of refactoring

test plan:
* test the role_overrides update API endpoint and confirm
 that a custom role's name is able to be updated
 (using the "label"  parameter)
* test the permissions UI, confirming that you can edit
 the name of a custom role and all things behave as before

closes #CNVS-14159

Change-Id: Ib6d5b08b96293d7b660a047bce4e2342f6d52e65
Reviewed-on: https://gerrit.instructure.com/43936
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
Product-Review: Cosme Salazar <cosme@instructure.com>
2014-11-12 15:29:36 +00:00
James Williams 7372523690 refactor role type definitions to fix circular dependencies
Change-Id: I7cca4a22ef7dc310ba1b94fd81d67854a6fe1daf
Reviewed-on: https://gerrit.instructure.com/43833
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2014-11-12 15:29:33 +00:00
Ahmad Amireh da11cb0cbd QuizLogAuditing - JS core
- workflow for modular event tracking
- two basic event trackers: PageFocused and PageBlurred
- events are buffered, and are stored in localStorage when possible
  - they will also be (re)loaded when the page is reloaded
- events can be submitted in bulks to the API

backend changes:

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

Closes CNVS-16177

TEST PLAN
---- ----

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

Sample of PageFocused and PageBlurred events serialized in localStorage:

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

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

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

Closes CNVS-16795

TEST PLAN
---- ----

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

Change-Id: I7d6b77c62db8510e09a54fbae00048a14b5366bb
Reviewed-on: https://gerrit.instructure.com/44145
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Trevor deHaan <tdehaan@instructure.com>
Reviewed-by: Derek DeVries <ddevries@instructure.com>
Product-Review: Ahmad Amireh <ahmad@instructure.com>
2014-11-11 19:06:00 +00:00
Cody Cutrer 0c5e957e12 validate group_category_id in discussion topics
refs CNVS-16708

test plan:
 * post a new discussion topic for a group
 * it should work

Change-Id: I0e98b1000383297f21273fe66f2175af9a69d009
Reviewed-on: https://gerrit.instructure.com/43874
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Braden Anderson <braden@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2014-11-10 22:59:52 +00:00
Brad Humphrey 732551f72d refactor lti setting/selection_type to placements
- specs should pass

Change-Id: Iefdeb4b4dbc4a878fd11c7b4dec8caa81c741084
Reviewed-on: https://gerrit.instructure.com/42922
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Nathan Mills <nathanm@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
QA-Review: Brad Humphrey <brad@instructure.com>
2014-11-10 21:28:20 +00:00
Derek DeVries 14591b07ad remove non-draft-state features from quizzes
fixes CNVS-16048

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

Change-Id: I1112e3b28ed6388077bfc165056bb1ab0d84b3fd
Reviewed-on: https://gerrit.instructure.com/42258
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Trevor deHaan <tdehaan@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2014-11-10 19:15:24 +00:00
Jacob Fugal 34288b6986 single shard transaction on stream item generation
fixes CNVS-15415

we suspect the accidental use of user_ids when it meant user_ids_subset
(the subset of user_ids local to Shard.current) could contribute to long
run times of this method when user_ids is moderately large and contains
ids from multiple shards. users is a busy table and trying to grab locks
on it unnecessarily is both slow and adverse to other users.

additionally, the only reason for the updates on the users is to
invalidate cache entries; give a little personal space on users that may
have already been updated very recently; it's highly unlikely that the
relevant caches have already been repopulated in those few seconds, and
if they were, a little cache staleness on stream items isn't the end of
the world.

Change-Id: Ibbda9af75aa0e727bd2e7d0a128ee2e3470433eb
Reviewed-on: https://gerrit.instructure.com/44045
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
QA-Review: Jacob Fugal <jacob@instructure.com>
2014-11-08 17:03:33 +00:00
Jeremy Stanley 10eeaa4a5d return overridden start/end dates for terms in courses API
fixes CNVS-5791

test plan:
 0. have a course in an account-defined enrollment term
 1. customize the term access dates for different roles (students,
    teachers, etc.)
 2. use the courses API with ?include=term to view the course
    using both the index (/api/v1/courses) and show
    (/api/v1/courses/X) endpoints
 3. the returned start_at and end_at dates under "term" should
    reflect the term access date overrides

Change-Id: I91e5f37de2af0fd283152ac14067b7d39c32274f
Reviewed-on: https://gerrit.instructure.com/43378
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: James Williams  <jamesw@instructure.com>
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
Product-Review: Hilary Scharton <hilary@instructure.com>
2014-11-07 22:52:41 +00:00
Nick Cloward b80713758a refresh CAS ticket in find_user
fixes: CNVS-16438

Found an issue where the refresh_cas_ticket method was being called
before find_user which will fail since @pseudonym_session would not have
been populated yet.  This removes that method from application_controller
and adds the refresh to the CAS expired check.

Test Plan:

  - Setup CAS with Canvas
  - Log in with CAS and take note of the ticket that was used.
  - Open up redis and find a record with a key of cas_ticket:#{ticket}
    from the previous step.
  - The note the ttl of the record in redis.
  - Refresh the page and the ttl should have been extended.
  - Do the same for an ajax call.  The ttl should have been extended.

Change-Id: Ieb25f05765fed2cfb3de00ed6a49966fd3d04698
Reviewed-on: https://gerrit.instructure.com/44062
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Nick Cloward <ncloward@instructure.com>
2014-11-07 20:17:05 +00:00
Braden Anderson 2f9171080d course catalog
test plan:
  * open a course's settings page
  * enable listing the course in the public index but not
      making the course content public
  * open the course home page as an unregistered user
  * verify that only the course's title and description are accessible

  * open root account feature flags page
  * enable Course Catalog

  * open your "My Courses" page
  * verify that the right pane includes a "Browse more courses" link
  * click the link
  * verify that you can browse courses allowed in the public index

  * log out
  * verify that the homepage includes a "Browse courses" link

Change-Id: I44f96396859283d76bfe527672612ff71ca4ae67
Reviewed-on: https://gerrit.instructure.com/24682
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Braden Anderson <braden@instructure.com>
QA-Review: Trevor deHaan <tdehaan@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
2014-11-07 17:15:10 +00:00
Cameron Matheson 2c76c27ad5 sort speedgrader dropdown menu for group assignments
fixes CNVS-16714

Test plan:
  * make some groups with non-latin names (二, and 一, for example)
  * make a group assignment using that group category
  * open the assignment in speedgrader
  * the groups should be listed in proper order (一 before 二)

Change-Id: Ide53cc6a5607fb29907c158325f4698c6d59ff1b
Reviewed-on: https://gerrit.instructure.com/43954
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
Product-Review: Matt Fairbourn <mfairbourn@instructure.com>
Reviewed-by: Josh Simpson <jsimpson@instructure.com>
2014-11-07 16:00:54 +00:00
Jacob Fugal 305b340b0d extract tardiness predicates into a module
refs CNVS-16621

so that they can be used in other Submission-like objects (needed for an
analytics optimization)

Change-Id: I28c55ba8dfdaf911e58206abf0ed9a994bd75c1e
Reviewed-on: https://gerrit.instructure.com/43962
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
QA-Review: Jacob Fugal <jacob@instructure.com>
2014-11-06 23:24:35 +00:00
Cody Cutrer a0ba7f7606 remove shims of migration to DiscussionTopic#group_category
Change-Id: I15e3224275c6aab911cae6c2a9e3aac167b61f71
Reviewed-on: https://gerrit.instructure.com/43875
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Braden Anderson <braden@instructure.com>
Product-Review: Braden Anderson <braden@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2014-11-06 22:35:59 +00:00
Cody Tanner fcaedde451 adds checkbox to quiz/show_answers to show correct answers on last attempt
closes PFS-201, PFS-202, PFS-203

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

Change-Id: I6c108174c817959be23770b3dfa9065831907460
Reviewed-on: https://gerrit.instructure.com/43179
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Derek DeVries <ddevries@instructure.com>
QA-Review: Trevor deHaan <tdehaan@instructure.com>
Reviewed-by: Cody Tanner <ctanner@instructure.com>
Product-Review: Cody Tanner <ctanner@instructure.com>
QA-Review: Cody Tanner <ctanner@instructure.com>
Tested-by: Cody Tanner <ctanner@instructure.com>
2014-11-06 21:29:29 +00:00
Cameron Matheson a038f68301 avoid extra submissions query in assignment_json
refs CNVS-16051

Test plan:
  * make two assignments (and publish them).
  * make submissions to one of the assignments.
  * on the assignments index page, you should be able to unpublish the
    submisssion-less assignment with the cloud icon.
  * you should not be able to unpublish the other assignment.
  * a tooltip will explain why

Change-Id: I707f6939af43b4d9a2ac1550c26c81f137e2ae7c
Reviewed-on: https://gerrit.instructure.com/42458
Reviewed-by: Josh Simpson <jsimpson@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
Product-Review: Cameron Matheson <cameron@instructure.com>
2014-11-06 01:13:27 +00:00
Cody Cutrer dbc8710802 more no more dynamic finders
Change-Id: Ie8045a76fa9f77e1e9e9d38e421a98fac8ac79b7
Reviewed-on: https://gerrit.instructure.com/43876
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2014-11-05 21:03:40 +00:00
Jacob Fugal 9d49603aa1 add :read and :read_sis permissions on pseudonym
fixes CNVS-16482

test-plan:
 * given
   - Sally who's an admin with the :manage_user_logins permission on one
     account (Account1) and a student on another account (Account2)
   - Bob who's a student on both accounts
   - Bob's pseudonym in Account1 has a SIS ID set

 * as Sally:
   - GET /api/v1/users/x/logins
   - returned json should include sis_user_id field

 * as Bob:
   - GET /api/v1/users/x/logins
   - returned json should not include sis_user_id field

 * also, Sally should:
   - see Bob's Account1 pseudonym at /users/:bob
   - not see Bob's Account2 pseudonym at /users/:bob

Change-Id: Ie9fb65bd58a1fcd8aebc5e8f6c86c614e97ee9ca
Reviewed-on: https://gerrit.instructure.com/42908
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Nick Cloward <ncloward@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
2014-11-05 21:01:09 +00:00
Jacob Fugal 54649a4d62 clean up user "deletion"
fixes CNVS-1552

any time the UI/API tries to "delete" a user, it should only be trying
to remove it from some root account (the @domain_root_account if not
otherwise specified). if that root account was the last root account the
user was associated with, then the remnants of the user are fully
deleted, but only then. leave User#destroy as a short-cut to delete the
user from all their accounts at once, but should not be invoked directly
from any UI/API actions.

test-plan:

 PERMISSIONS

   being able to remove a user from an account entails being able to:

   - DELETE http://accounts-domain/users/:user
   - DELETE /accounts/:account/users/:user

   both should fail or succeed together

   * given
     - Sally who's an admin with the :manage_user_logins
       permission on one account (Account1) and a student on another
       account (Account2)
     - Bob who's a student on both accounts
     - Alice who's an admin on Account1 with greater permissions than
       Sally

   * Sally should:
     - see "Delete My Account" on her Account1 profile
     - not see "Delete My Account" on her Account2 profile
     - not see "Delete My Account" on Bob's Account1 profile
     - not see "Delete My Account" on Alice's Account1 profile
     - see "Delete from Account1" at /users/:sally
     - see "Delete from Account1" at /users/:bob
     - not see "Delete from Account2" at /users/:sally
     - not see "Delete from Account2" at /users/:bob
     - not see "Delete from Account1" at /users/:alice
     - be able to remove herself from Account1
     - be able to remove Bob from Account1
     - not be able to remove herself from Account2
     - not be able to remove Bob from Account2
     - not be able to remove Alice from Account1

   * given Sally's Account1 pseudonym has a SIS ID but her Account2
     pseudonym doesn't, Sally should:
     - no longer see "Delete My Account" on her Account1 profile
     - no longer see "Delete from Account1" at /users/:sally
     - still see "Delete from Account1" at /users/:bob
     - no longer be able to remove herself from Account1
     - still be able to remove Bob from Account1

 EFFECTS

 * as Sally, remove Bob from Account1 via
   DELETE http://account1-domain/users/:bob
   - Bob's pseudonyms, enrollments, etc. in Account1 should be removed
   - Bob's pseudonyms, enrollments, etc. in Account2 should be untouched

 * repeat using DELETE /accounts/:account1/users/:bob, with the same
   expectations

Change-Id: Ib7612f95d1c7e4cca36d8486950565ec096b4ab1
Reviewed-on: https://gerrit.instructure.com/41591
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
2014-11-05 21:00:35 +00:00
Ryan Taylor 7989bfb1f4 API for Quiz Submission Events
Provides basic features for Quiz Submission Events API.  Will be adding
additional features in time.

Closes CNVS-15663

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

Change-Id: I3a392663fc6508f16600262c2d1fcd346fde64e7
Reviewed-on: https://gerrit.instructure.com/42461
QA-Review: Trevor deHaan <tdehaan@instructure.com>
Reviewed-by: Derek DeVries <ddevries@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Ryan Taylor <rtaylor@instructure.com>
2014-11-05 20:24:03 +00:00
Jeremy Stanley 95537d2a59 fix importing assignments with no name
test plan:
 * import a course package containing a nameless assignment,
   and choose to remove dates from the imported course.
   You can find such a package here:
   https://hilary.instructure.com/courses/332573/content_migrations
   (download the .imscc linked to on that page)
   Note that you can't easily create a new nameless assignment,
   because CNVS-12938 adds a validator to prevent this
   (the linked course package predates that fix)
 * the nameless assignment should have a generic name
   ("untitled assignment")
 * go to the syllabus page in the new course
 * there should be no due dates there

fixes CNVS-16624

Change-Id: Ib51773024ccaac2241619cd8b1a5a8b54b99f3ce
Reviewed-on: https://gerrit.instructure.com/43791
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: James Williams  <jamesw@instructure.com>
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2014-11-05 18:23:19 +00:00
Cody Cutrer 1a720a153c improve distinct_on
refs CNVS-16563

distinct_on returns a relation, and takes select from the relation
(and order becomes automatic)

test plan:
 * specs should pass
 * dashboard should load, and course menu should have data

Change-Id: I26c6068aaa4aa89c2626cdb8058f3aa9e50ff0fb
Reviewed-on: https://gerrit.instructure.com/43622
QA-Review: August Thornton <august@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2014-11-05 05:43:58 +00:00
Nick Cloward faaec09c91 add idp initiated saml logout
fixes: CNVS-16363

Adds a method to saml_logout which allows Canvas to accept an IDP
initiated SAML logout redirect.

Test Plan:

Setup:
  - SAML server with IDP initiated logouts.
  - SAML account in Canvas using the SAML server.

  * It would be good to test with multiple SAML providers including:
    https://www.feide.no/sites/feide.no/files/documents/Feide_integration_guide.pdf

Tests:
  - Log in as a user within the SAML account.
  - Logout the user from the SAML Server.
  - The user should be logged out of Canvas and redirected back with
    a SAMLResponse in the query string.

Change-Id: I381189cee6759b178fccec4bef9be31b4a81448d
Reviewed-on: https://gerrit.instructure.com/43227
Reviewed-by: Paul Hinze <paulh@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Nick Cloward <ncloward@instructure.com>
2014-11-04 22:58:56 +00:00
Cody Cutrer ba8e4c0c17 don't assign attachments attribute taht doesn't exist
refs CNVS-15830

Change-Id: I840ce48ca4293182fa21550586d6b0d08898c105
Reviewed-on: https://gerrit.instructure.com/43853
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2014-11-04 21:09:31 +00:00
Cameron Matheson 1f8c0c4aa5 show warning when crocodoc is still processing
closes CNVS-15940

Test plan:
  * make a file upload assignment
  * submit a crocodocable submission
  * turn off delayed jobs
  * submit another crocodocable submission
  * in speedgrader, the second submission should not display in
    crocodoc.  you will be notified that the submission is still being
    processed

Change-Id: Ifcdda634dd97a81f17d0d753cade0b80f3e0ebce
Reviewed-on: https://gerrit.instructure.com/42387
Reviewed-by: Josh Simpson <jsimpson@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Cameron Matheson <cameron@instructure.com>
2014-11-04 20:30:55 +00:00
Cody Cutrer 3b1b82f85c restrict roles visible to javascript to @domain_root_account
fixes CNVS-16196

test plan:
 * add a user to a course in account A, and as an admin in account B
 * view source when visiting account A, and look for current_user_roles
   in the ENV for js.
 * it should include student, but not admin
 * when visiting B, it should include admin, but not student

Change-Id: Ic69da40dcdd3858840a34c260d75b537b4779c07
Reviewed-on: https://gerrit.instructure.com/42542
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2014-11-04 19:42:12 +00:00