Commit Graph

2370 Commits

Author SHA1 Message Date
Keith Garner ff6a1039c4 stop locking new gradebook in an off state
Given certain circumstances the new gradebook would be in a locked off
state. The original intention was to leave it locked on once backwards
incompatible features were used.

fixes GRADE-1419

test plan:
 - Have a course with new gradebook turned on
 - Use one of the backwards incompatible features such as manually
   marking late status
 - In the rails console force the new gradebook feature flag off with
   a command line such as:
   FeatureFlag.where(context_id: <course id>, context_type: "Course",
     feature: "new_gradebook").update(state: 'off')
 - Visit the course settings feature flag editors and ensure that New
   Gradebook has a toggle in the office position not the locked "Off"
 - Turn on the new gradebook. Reload the feature flag page, note that
   its now in a locked on position.

Change-Id: Iba2dc617ddeaf33888d0d97cf5e1f91c1cb0ec19
Reviewed-on: https://gerrit.instructure.com/158548
Tested-by: Jenkins
Reviewed-by: Spencer Olson <solson@instructure.com>
Reviewed-by: Jeremy Neander <jneander@instructure.com>
Reviewed-by: Derek Bender <djbender@instructure.com>
QA-Review: Jeremy Neander <jneander@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2018-07-30 16:41:32 +00:00
August Thornton e4353b94cd use calling context app center token if set
fixes PLAT-3598

test plan:
 - create two organizations and generate an api token for each
   within eduappcenter
 - for the first organization generate a visible whitelist of
   apps
 - for the second organization generate a visible whitelist of
   apps that includes an app that is not included within the
   first organization's whitelist
 - configure your canvas instance to talk with app center
   via plugin settings and use the first organization's
   api token
 - within your canvas root account settings --> apps
   check to make sure the external apps get populated that were
   included within the first organization's whitelist
 - create a sub-account and within settings --> apps
   click on |Manage App List| button and input the second
   organization's api token
 - verify the external apps that were whitelisted for the second
   organization appear
 - attempt to install an app that appears in the sub-account app
   listing, but does not appear in the root account's app listing
 - it should install without error
 - verify both account and course context app centers are populated
   with whitelisted apps pertaining to the token's organization in
   eduappcenter and allow for specific apps to be installed

for detailed summary and reproduction steps see:
https://instructure.atlassian.net/browse/PLAT-3598
   apps to be installed from selecting the app

Change-Id: I89dcc9dbccebff47803af4090af3a0ccbd30221b
Reviewed-on: https://gerrit.instructure.com/157848
Tested-by: Jenkins
Reviewed-by: Nathan Mills <nathanm@instructure.com>
Reviewed-by: Marc Alan Phillips <mphillips@instructure.com>
QA-Review: Nathan Mills <nathanm@instructure.com>
Product-Review: Jesse Poulos <jpoulos@instructure.com>
2018-07-23 16:33:04 +00:00
Derek Bender e15aa37067 extract submission serializer shared code
closes: GRADE-1312

test plan: specs pass

Change-Id: I274ae211ab55d7c0a135c609f9917df5ccc2c716
Reviewed-on: https://gerrit.instructure.com/157760
Tested-by: Jenkins
Reviewed-by: Adrian Packel <apackel@instructure.com>
Reviewed-by: Gary Mei <gmei@instructure.com>
QA-Review: Derek Bender <djbender@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2018-07-23 16:22:46 +00:00
Gary Mei e1a58a0239 fix gradebook import of moderated assignments
Uploading a csv with moderated assignments would fail because
the attributes that would be checked weren't previously loaded in.

fixes GRADE-1374

Test Plan
- Create a moderated assignment.
- Export the gradebook.
- Modify the grade for the moderated assignment.
- If you are the final grader, uploading should work.
- If you are not the final grader, uploading should have no effect.

Change-Id: If0cef730e3b22cd9b049a9c44133cb7a389a6e85
Reviewed-on: https://gerrit.instructure.com/157526
Tested-by: Jenkins
Reviewed-by: Jeremy Neander <jneander@instructure.com>
Reviewed-by: Adrian Packel <apackel@instructure.com>
QA-Review: James Butters <jbutters@instructure.com>
Product-Review: Sidharth Oberoi <soberoi@instructure.com>
2018-07-17 15:54:06 +00:00
Gary Mei 24dbd0ac46 make select_final_grade work for existing accounts
Existing accounts default :moderate_grades permissions to false for
TAs, but the new :select_final_grade replacement permission defaults
to true. In the case that no role overrides exist for accounts, we
add a role override to make :select_final_grade false as well. If a
role override exists (for any role), we mirror the existing one.

closes GRADE-1228

Test Plan
 - Don't run migrations yet.
 - Open the Permissions page as an admin.
 - Create a role that descends from Ta role.

 - In a rails console, run RoleOverride.destroy_all
 - Run migrations.
 - Verify that 'Select final grade for moderation' is turned off for
   TAs and any custom roles descended from TAs.
 - Verify that roles that had 'Moderate grades' enabled (such as
   Teacher) continue to have 'Select final grade...' enabled as well.

 - Roll back migrations with `rails db:rollback STEP=1` *STEP might
   be greater than 1. In my case, there were CSS related migrations
   that needed to be rolled back first.
 - In a rails console, run RoleOverride.destroy_all

 - Refresh the Permissions page.
 - Turn on 'Moderate grades' for one of the Ta roles.
 - Run migrations.
 - Verify that 'Select final grade...' is turned on for the role that
   just had 'Moderate grades' turned on, but the other Ta role that
   didn't have 'Moderate grades' turned on has 'Select final grade..'
   turned off.

 - tl;dr 'Select final grade...' should mirror 'Moderate grades'.

Change-Id: Ie575da205bdbe3f5d9110b3b4e99c7f88644c86a
Reviewed-on: https://gerrit.instructure.com/156131
Reviewed-by: Adrian Packel <apackel@instructure.com>
Tested-by: Jenkins
Reviewed-by: Spencer Olson <solson@instructure.com>
QA-Review: Spencer Olson <solson@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2018-07-13 16:37:04 +00:00
Han Ngo 27d24538d6 Run Key Rotation Script as a Periodic Job in Canvas
Closes PLAT-3508 & PLAT-3509

Test Plan:
- Verify the key rotate correctly (set current to past, future
to current, and the new key to future) in both cases: when there
is no existing key AND when there is key already in Consul
- Verify the script will be running every month
- Verify the keys got rotated using Imperium gem version '0.4.0'

Change-Id: I630f230b3cd1c515ebb266b532901b4260622173
Reviewed-on: https://gerrit.instructure.com/154529
Reviewed-by: Stewie aka Nicholas Stewart <nstewart@instructure.com>
QA-Review: Nathan Mills <nathanm@instructure.com>
Product-Review: Nathan Mills <nathanm@instructure.com>
Tested-by: Jenkins
2018-07-12 19:57:40 +00:00
Ed Schiebel a8a5490534 Have planner deal with media comments.
When we detect a media comment, replace the default "This is a media
comment." with "You have media feedback."

closes: ADMIN-1090

test plan:
  - course with assignment, student submits answer, teacher grades and
    leaves a comment
  > expect student's planner item to show the first line of the comment
  - teacher adds a media comment
  > expect student's planner item to say "You have media feedback."
    you may have to setup nororious. See
    https://instructure.atlassian.net/wiki/spaces/ENG/pages/45645850/Setting+Up+Notorious
    for instructions.  You may also have to fiddle with browser settings
    to get permission to use the mic and/or camera.

Change-Id: Idb688be7e50e66cec0ac52ef6338a3f4cdfe01f9
Reviewed-on: https://gerrit.instructure.com/155791
Tested-by: Jenkins
Reviewed-by: Jon Willesen <jonw+gerrit@instructure.com>
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: Christi Wruck
2018-07-12 18:37:07 +00:00
Xander Moffatt 7a4b731cdb reference instfs_uuid from instfs direct upload
refs RECNVS-521

* previously instfs file upload returned only the
instfs uuid as `uuid`
* instfs file upload now returns canvas capture
data, which includes the canvas uuid
* instfs uuid has been renamed to `instfs_uuid`

test plan:
* specs

Change-Id: I1f77f3dd1952fbd275ae67c399ff04ef6533785b
Reviewed-on: https://gerrit.instructure.com/157118
Reviewed-by: Michael Jasper <mjasper@instructure.com>
Tested-by: Jenkins
Product-Review: Xander Moffatt <xmoffatt@instructure.com>
QA-Review: Xander Moffatt <xmoffatt@instructure.com>
2018-07-12 16:13:06 +00:00
Michael Guymon c7a0ba68d6 Add Delayed Job homework submission for url uploads.
Add a Delayed Job Worker that reuses the
Services::SubmitHomeworkService to submit the url uploads after
copying the url from the source. Sends an email for success or failure
of the job. This will be used when InstFS is not enabled.

Based on work from GOOF-435 for the InstFS to support reliable
url uploads.

fixes: GOOF-461, GOOF-462

Test Plan:

* Disable InstFS
* Submit an assignment from Google/Office
* Get an alert with info about submission
* Job enqueued to process the upload.
* When job finishes, the assignment will be submitted.

Change-Id: I63d0f5f9b5dd01cc53bcfffe6f8d952cd6e2c078
Reviewed-on: https://gerrit.instructure.com/155104
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Josh Orr <jgorr@instructure.com>
Tested-by: Jenkins
QA-Review: Tyler Belnap <tyler@instructure.com>
Product-Review: Jesse Poulos <jpoulos@instructure.com>
2018-07-11 20:59:40 +00:00
Augusto Callejas dd867b5c6d Allow excluding users with no results
closes OUT-1859

test plan:
  - in a course, create about 10 outcomes and 10 student users
  - create an assignment, aligned to an outcome
  - submit to the assignment with two student users
  - assess the rubrics for each submission in speed grader
  - load LMGB, confirm that all students and outcomes appear,
    with the results of the two students
  - using a tool like Postman, perform an API call with an
    access to the following endpoint:

    http://canvas.docker/api/v1/courses/<course id>/outcome_rollups

  - confirm that a rollup appears for each student, and only scores
    appear for students whose assignments were assessed
  - append "?exclude[]=missing_user_rollups" to the request above
    and resubmit
  - confirm that only rollups with scores appears (should be two)
  - append "&include[]=outcomes" to the request above and resubmit
  - confirm that under the "linked" section, that "outcomes" contains
    all outcomes in the course

Change-Id: I399715093943455659ed5a05c39befca8dc2e801
Reviewed-on: https://gerrit.instructure.com/156247
QA-Review: Dariusz Dzien <ddzien@instructure.com>
Tested-by: Jenkins
Reviewed-by: Neil Gupta <ngupta@instructure.com>
Reviewed-by: Frank Murphy <fmurphy@instructure.com>
Product-Review: Michael Brewer-Davis <mbd@instructure.com>
2018-07-11 19:20:58 +00:00
Gary Mei 5a3437c251 fix semicolons as delimiters in gradebook importer
fixes GRADE-1324

Test Plan
 - Have DelayedJobs running.
 - Create a course with one teacher and at least one student.
 - Create an assignment for that course.
 - Go to the User settings of the teacher and turn on the option to
   use semicolons in Gradebook Export.
 - Go to the Gradebook as the teacher and export the Gradebook.
 - Open the csv file and change the grade a bit.
 - Verify that the csv did indeed use semicolons rather than commas.
 - Import that csv file back into the Gradebook.
 - Verify that the import worked successfully.
 - Turn off the option for using semicolons and instead use commas.
 - Verify that export/import works with commas using the same above
   steps.

Change-Id: I42870aeb3ff4064f3db39ed1b67681e2acc4ed8e
Reviewed-on: https://gerrit.instructure.com/156648
Tested-by: Jenkins
Reviewed-by: Keith T. Garner <kgarner@instructure.com>
Reviewed-by: Spencer Olson <solson@instructure.com>
QA-Review: Adrian Packel <apackel@instructure.com>
Product-Review: Sidharth Oberoi <soberoi@instructure.com>
2018-07-10 21:13:27 +00:00
Augusto Callejas c47fb7a26f Exclude outcome results from muted asgmts/quizzes
closes OUT-2304

performance:
Indices are used throughout the scoped query.

Shard.current.id => 1773

base query:
LearningOutcomeResult.active.where(context_code:'course_1079845',user_id:3306819,learning_outcome_id:1397026)

without scope:
----------------------------------------------------------------------------------------------------------------------------------
 Nested Loop  (cost=4.86..8.20 rows=1 width=268)
   ->  Bitmap Heap Scan on learning_outcome_results  (cost=4.42..5.54 rows=1 width=268)
         Recheck Cond: ((user_id = 3306819) AND (learning_outcome_id = 1397026))
         Filter: ((context_code)::text = 'course_1079845'::text)
         ->  BitmapAnd  (cost=4.42..4.42 rows=1 width=0)
               ->  Bitmap Index Scan on index_learning_outcome_results_association  (cost=0.00..1.73 rows=27 width=0)
                     Index Cond: (user_id = 3306819)
               ->  Bitmap Index Scan on index_learning_outcome_results_on_learning_outcome_id  (cost=0.00..2.44 rows=123 width=0)
                     Index Cond: (learning_outcome_id = 1397026)
   ->  Index Scan using content_tags_pkey on content_tags  (cost=0.43..2.66 rows=1 width=8)
         Index Cond: (id = learning_outcome_results.content_tag_id)
         Filter: ((workflow_state)::text <> 'deleted'::text)

with scope (`exclude_muted_associations`):
----------------------------------------------------------------------------------------------------------------------------------------------------------
 Nested Loop Left Join  (cost=6.99..20.54 rows=1 width=268)
   Join Filter: ((learning_outcome_results.association_type)::text = 'Assignment'::text)
   Filter: (((ra.muted IS NULL) AND (qa.muted IS NULL) AND (sa.muted IS NULL)) OR (ra.muted IS FALSE) OR (qa.muted IS FALSE) OR (sa.muted IS FALSE))
   ->  Nested Loop Left Join  (cost=6.56..17.88 rows=1 width=270)
         ->  Nested Loop Left Join  (cost=6.13..15.72 rows=1 width=277)
               Join Filter: ((learning_outcome_results.association_type)::text = 'Quizzes::Quiz'::text)
               ->  Nested Loop Left Join  (cost=5.71..13.06 rows=1 width=269)
                     Join Filter: (((rassoc.association_type)::text = 'Assignment'::text) AND ((rassoc.purpose)::text = 'grading'::text))
                     ->  Nested Loop Left Join  (cost=5.28..10.85 rows=1 width=293)
                           Join Filter: ((learning_outcome_results.association_type)::text = 'RubricAssociation'::text)
                           ->  Nested Loop  (cost=4.86..8.20 rows=1 width=268)
                                 ->  Bitmap Heap Scan on learning_outcome_results  (cost=4.42..5.54 rows=1 width=268)
                                       Recheck Cond: ((user_id = 3306819) AND (learning_outcome_id = 1397026))
                                       Filter: ((context_code)::text = 'course_1079845'::text)
                                       ->  BitmapAnd  (cost=4.42..4.42 rows=1 width=0)
                                             ->  Bitmap Index Scan on index_learning_outcome_results_association  (cost=0.00..1.73 rows=27 width=0)
                                                   Index Cond: (user_id = 3306819)
                                             ->  Bitmap Index Scan on index_learning_outcome_results_on_learning_outcome_id  (cost=0.00..2.44 rows=123 width=0)
                                                   Index Cond: (learning_outcome_id = 1397026)
                                 ->  Index Scan using content_tags_pkey on content_tags  (cost=0.43..2.66 rows=1 width=8)
                                       Index Cond: (id = learning_outcome_results.content_tag_id)
                                       Filter: ((workflow_state)::text <> 'deleted'::text)
                           ->  Index Scan using rubric_associations_pkey on rubric_associations rassoc  (cost=0.42..2.64 rows=1 width=33)
                                 Index Cond: (id = learning_outcome_results.association_id)
                     ->  Index Scan using assignments_pkey on assignments ra  (cost=0.43..2.19 rows=1 width=9)
                           Index Cond: (id = rassoc.association_id)
               ->  Index Scan using quizzes_pkey on quizzes  (cost=0.43..2.65 rows=1 width=16)
                     Index Cond: (id = learning_outcome_results.association_id)
         ->  Index Scan using assignments_pkey on assignments qa  (cost=0.43..2.15 rows=1 width=9)
               Index Cond: (id = quizzes.assignment_id)
   ->  Index Scan using assignments_pkey on assignments sa  (cost=0.43..2.65 rows=1 width=9)
         Index Cond: (id = learning_outcome_results.association_id)

test plan:
  - create two course-level outcomes
  - create an assignment with a single question, and align the 1st outcome via a rubric
  - create a quiz bank with a single auto-gradeable question (e.g. true/false), and
    align the 2nd outcome to it
  - create a quiz that pulls the single question from the quiz bank above
  - as a student, submit to the assignment and the quiz
  - as a teacher, assess the assignment, providing a score to the rubric
  - as a teacher, confirm:
    * both outcomes have results in the LMGB
    * both outcomes have results in the sLMGB
  - as a student, confirm:
    * both outcomes have results in the sLMGB
  - as a teacher, mute the assignment in the gradebook:
    https://community.canvaslms.com/docs/DOC-12961-4152724339
  - as a teacher, confirm:
    * both outcomes have results in the LMGB
    * both outcomes have results in the sLMGB
  - as a student, confirm:
    * only the outcome associated with the quiz bank has results in the sLMGB
  - as a teacher, mute the quiz in the gradebook
  - as a teacher, confirm:
    * both outcomes have results in the LMGB
    * both outcomes have results in the sLMGB
  - as a student, confirm:
    * no outcomes should have results in the sLMGB
  - as a teacher, unmute the assignment in the gradebook
  - as a teacher, confirm:
    * both outcomes have results in the LMGB
    * both outcomes have results in the sLMGB
  - as a student, confirm:
    * only the outcome associated with the assignment has results in the sLMGB

Change-Id: I0ea05eedd29383501cc9306bcedcfa67aee4cd67
Reviewed-on: https://gerrit.instructure.com/155210
Tested-by: Jenkins
Reviewed-by: Neil Gupta <ngupta@instructure.com>
Product-Review: Neil Gupta <ngupta@instructure.com>
QA-Review: Neil Gupta <ngupta@instructure.com>
2018-07-10 20:18:30 +00:00
Nick Houle 8cdf400ba7 Implement Inst-fs capture callback for url uploads.
Adds an alert when the student submits stating that the upload is
processing and an email will be sent.

THe FilesController#api_capture called by InstFS, when the upload
processing is finished, uses Services::SubmitHomeworkService#submit
to submit the assignment.

Update the JS to prevent the browser from submitting the url upload
assignment twice. Passes the submit_assignment parameter to provide
backwards compatibilty, so the old JS can still double submit.

fixes: GOOF-449, GOOF-450, GOOF-435

Test Plan:
* Submit a file from the Google Drive, will see a pop up.
* Check the xhr for the request, the submit_assignment param will be true
* InstFS callback will cause the assignment to be submitted.

Change-Id: I5f49b8ef642fe5913bf0c2f282de8d697dcf1ce1
Reviewed-on: https://gerrit.instructure.com/154757
Reviewed-by: Nick Houle <nhoule@instructure.com>
QA-Review: Tyler Belnap <tyler@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Jesse Poulos <jpoulos@instructure.com>
Tested-by: Jenkins
Reviewed-by: Josh Orr <jgorr@instructure.com>
2018-07-10 19:56:27 +00:00
Ryan Kuang 6e2d127d8d Add custom columns to gradebook imports/exports
When exporting a gradebook,
the csv should include custom columns listed at the final columns.

fixes GRADE-1275

Test Plan (Exporting)
 -Create a course
 -Use the public api to add custom columns, 1 read only and 2 writable
  (POST /api/v1/courses/:course_id/custom_gradebook_columns)
 -Use the public api to add data into those custom columns
  (PUT /api/v1/courses/:course_id/custom_gradebook_columns/:id/data/:user_id)
 -Navigate to the gradebook for the course and inspect the columns
 -Export to csv
 -Check if the csv has the proper columns as the gradebook, the read only column
  should not have changed, while the writable columns should display the changes

Test Plan (Importing)
 -Follow the steps above to export to csv
 -Change any data in an assignment column
 -Make sure the column changed is not (read only)
 -Save the csv and upload into gradebook
 -Check if the assignment changes appear in the gradebook

Change-Id: I36a7d53af7b86ffcb6cdfbc4f78effcb0df9a3fe
Reviewed-on: https://gerrit.instructure.com/155027
Tested-by: Jenkins
Reviewed-by: Keith T. Garner <kgarner@instructure.com>
Reviewed-by: Derek Bender <djbender@instructure.com>
QA-Review: Keith T. Garner <kgarner@instructure.com>
Product-Review: Matt Goodwin <mattg@instructure.com>
2018-07-10 17:36:50 +00:00
Spencer Olson c5ee434ff5 make anonymous grading checks consider muted status
Unmuting an anonymous assignment will now cause that assignment to show
in the UI as though it is not anonymous. In addition, posting grades for
a moderated anonymous assignment will now cause that assignment to show
in the UI as though it is not anonymous.

closes GRADE-1310
closes GRADE-1313

Test Plan:
1. Verify unmuting an anonymous assignment causes that assignment to no
   longer be anonymized in the UI. You can do this by spot checking
   gradebook (old/new/individual) and SpeedGrader. In addition,
   re-muting an unmuted anonymous assignment should cause the assignment
   to become anonymized in the UI.
2. Verify posting grades for a moderated, anonymous assignment causes
   that assignment to no longer be anonymized in the UI (even if the
   assignment is muted).

Change-Id: I113c61b4e7fa0eb8909448d8ba7cffb22600e17c
Reviewed-on: https://gerrit.instructure.com/156151
Reviewed-by: Gary Mei <gmei@instructure.com>
Reviewed-by: Keith T. Garner <kgarner@instructure.com>
QA-Review: James Butters <jbutters@instructure.com>
Tested-by: Jenkins
Product-Review: Sidharth Oberoi <soberoi@instructure.com>
2018-07-10 16:24:26 +00:00
Augusto Callejas 9c73b7e21b Add median aggregate rollups
closes OUT-2144

test plan:
  - create a course-level outcome with default rubric criterion
  - create an assignment that is aligned to that outcome
  - create two sections in a course (in Settings)
  - create 6 student users, split evenly between the two sections
  - masquerade as each student and submit to the assignment
  - in speedgrader, assess the rubrics with the following scores:
    1st section students: 5, 3, 0
    2nd section students: 4, 2, 1
  - perform an authenticated API call using a tool like Postman
    to fetch the average aggregate score:
    > /api/v1/courses/<course id>/outcome_rollups?aggregate=course
  - confirm the average score is 2.5
  - perform the same call again, but fetch the median aggregate score:
    > /api/v1/courses/<course id>/outcome_rollups?aggregate=course&aggregate_stat=median
  - confirm the median score is 2.5
  - determine the "section_id" values for each of the two sections above
    by running this in a Rails console:
    > CourseSection.last(2).map(&:id)
  - append "&section=<section id>" to the average aggregate score call
    above, and confirm the average scores:
    1st section: 2.67
    2nd section: 2.33
  - append ""&section=<section id>" to the median aggregate score call
    above, and confirm the median scores:
    1st section: 3
    2nd section: 2

Change-Id: I5701fd3edc1ff423caf4735406ee1bc3b5b1b011
Reviewed-on: https://gerrit.instructure.com/156486
Reviewed-by: Frank Murphy <fmurphy@instructure.com>
Tested-by: Jenkins
Reviewed-by: Matt Berns <mberns@instructure.com>
QA-Review: Dariusz Dzien <ddzien@instructure.com>
Product-Review: Augusto Callejas <acallejas@instructure.com>
2018-07-09 23:06:02 +00:00
Augusto Callejas 466088fc8a Use default ratings and points
closes OUT-2218

test plan:
  - in a new course, import the CSV file attached to the JIRA ticket
  - align the newly created outcome to an assignment
  - submit to the assignment
  - confirm that a score appears in the LMGB
  - confirm that a score appears in the sLMGB

Change-Id: I5d013b2e74369a23c9922059734c86d0328dea08
Reviewed-on: https://gerrit.instructure.com/155468
Reviewed-by: Frank Murphy <fmurphy@instructure.com>
Tested-by: Jenkins
QA-Review: Dariusz Dzien <ddzien@instructure.com>
Product-Review: Sidharth Oberoi <soberoi@instructure.com>
2018-07-05 21:04:54 +00:00
James Williams 50b4e51ac0 cache mathman results generating mathml
test plan:
* with mathman configured and
 "Use MathMan to convert LaTeX to MathML?"
 enabled, mathml conversion for equations
 in rich content should work as before

closes #CORE-1551

Change-Id: Ib632ee6ea4186cabc782748727e1c67e82f30e10
Reviewed-on: https://gerrit.instructure.com/155808
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2018-07-03 19:22:08 +00:00
Cody Cutrer 4014a971e0 allow 5 minutes of future clock skew when verifying JWTs
fixes CORE-1439

Change-Id: Ia3ed12dd79cee475bedd0879323eacf3a0325476
Reviewed-on: https://gerrit.instructure.com/155617
Tested-by: Jenkins
Reviewed-by: Brent Burgoyne <bburgoyne@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2018-06-29 18:33:10 +00:00
Simon Williams 87a5b6032f allow creating developer keys that only work against test clusters
Some production installations have a beta or test environment that is
refreshed with data from production, and is used as a place to test
integrations or new features. In that case, you may want to create
a developer key that only works against this test instance, which has
traditionally meant making the following tradeoff:
- Create the key in the test instance directly, which means it will be
  removed the next time the data is refreshed
- Create the key in production, which means the key works against the
  production instance as well

This new functionality allows the best of both worlds: create the key in
production for persistance, but only allow it to function against a test
cluster.

To enable test cluster functionality, you need a plugin that overrides
`ApplicationController.test_cluster?` to return appropriately for the
environment.

To see the functionality, you need to set:
  `Setting.set("dev_key_test_cluster_checks_enabled", true)`

closes PLAT-3392
[ci no-db-snapshot]

test plan:
- First ensure that all existing developer key functionality works and
no new functionality appears without any action taken
- Then set Setting.set("dev_key_test_cluster_checks_enabled", true), you
should see the new option available in the new dev key UI
- Create a key with and without the new option checked. Access tokens
from the key without it check should still work normally. Tokens from
the key with it checked should not work
- Now manually override `ApplicationController.test_cluster?` to be
true.
- Tokens from both keys should now work

Change-Id: I5bbb46782d19c26a7b703834aaa507b0cb10039a
Reviewed-on: https://gerrit.instructure.com/153035
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
Tested-by: Jenkins
QA-Review: August Thornton <august@instructure.com>
Product-Review: Karl Lloyd <karl@instructure.com>
2018-06-29 15:50:08 +00:00
Matt Sessions 11d6856cba Change alert titles to match correct wording
Refs MBL-10742

Test Plan:
 - Create a threshold for each type for an observer-student
   pairing
 - Generate an alert for each threshold type
 - The title should match the ticket
 - Threshold Types:
   - course_grade_low
   - course_grade_high
   - assignment_grade_low
   - assignment_grade_high
   - assignment_missing
   - course_announcement
   - institution_announcement
 - For assignment grade thresholds have multiple
   assignments that have different display grade as
   types and ensure it puts the correct grade in the
   alert title

Change-Id: Ia971e707c8da73b09066c5f23a742fe60a64be8f
Reviewed-on: https://gerrit.instructure.com/155341
Tested-by: Jenkins
Reviewed-by: Layne Moseley <lmoseley@instructure.com>
QA-Review: Layne Moseley <lmoseley@instructure.com>
Product-Review: Matthew Sessions <msessions@instructure.com>
2018-06-27 14:01:04 +00:00
Nate Armstrong dd0c3c8cda Add missing observer alert json fields
* Adds html_url for assignment_missing alerts
* Always includes action_date field

Refs MBL-10730

Test plan:
* Create an assignment_missing alert for an observer
* View alerts via api `/api/v1/users/self/observer_alerts/:userID`
* Verify that action_date field is present
* Verify that html_url field is present

Change-Id: I1276d6467b392ffaa9f919440ec7635ebd925895
Reviewed-on: https://gerrit.instructure.com/155092
Reviewed-by: Matthew Sessions <msessions@instructure.com>
Product-Review: Matthew Sessions <msessions@instructure.com>
QA-Review: Matthew Sessions <msessions@instructure.com>
Tested-by: Jenkins
2018-06-25 20:59:15 +00:00
Gary Mei d39a795518 fix empty rows in new gradebook for soft conclude
Soft concluded courses with hard concluded students were returning
ids for those hard concluded students while the frontend was only
expecting ids for non-hard concluded students. This was causing extra
rows to be present in the gradebook, which cascaded into grades not
showing up. This changes gradebook_user_ids to be in line with what
Gradebook.coffee is expecting.

fixes GRADE-1096

Test Plan
 - Create a course.
 - Turn on New Gradebook for the course.
 - Enroll at least two students.
 - Create an assignment.
 - Grade both students.
 - Conclude one student's enrollment.
 - Go to the course settings and change the course dates to start and
   end before the current day.
 - Under the course dates, check the box for
   "Users can only participate in the course between these dates"
 - Go back to the Gradebook.
 - Verify that there are no empty rows and only the students that are
   not concluded are present.
 - Set the grid to show concluded enrollments.
 - Verify that the concluded enrollments now appear.

Change-Id: I21ffa7ee52c07947710ff8ec68159fcfe96b0ec8
Reviewed-on: https://gerrit.instructure.com/154679
Reviewed-by: Spencer Olson <solson@instructure.com>
Reviewed-by: Keith T. Garner <kgarner@instructure.com>
Tested-by: Jenkins
QA-Review: Derek Bender <djbender@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2018-06-25 20:44:16 +00:00
Jeremy Stanley 39bdab8baa make planner items link to submission if present
test plan:
 - enable planner
 - have assignments and graded discussions
 - ensure these link to the assignment or discussion
   on a student's planner
 - ensure after the student submits and/or the teacher
   grades the item, the planner links to the submission
   page where the student can see feedback

fixes ADMIN-179

Change-Id: I4bbe2f11c8c95899b6fda6d0935dc9bc48a66d39
Reviewed-on: https://gerrit.instructure.com/154256
Tested-by: Jenkins
Reviewed-by: Dan Minkevitch <dan@instructure.com>
QA-Review: Ed Schiebel <eschiebel@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2018-06-25 20:41:35 +00:00
Jeremy Stanley 0ba33e8b38 fix user-context content migrations
test plan:
 - in user files (not course files),
   - upload a zip file and select "Expand it"
   - it should complete without having to reload the page

fixes ADMIN-1180

Change-Id: I9fbb52a1fa50f55ac294bc6df3057b7e4084fda6
Reviewed-on: https://gerrit.instructure.com/154982
Reviewed-by: Han Yan <hyan@instructure.com>
Reviewed-by: Steve Kacsmark <skacsmark@instructure.com>
Reviewed-by: Robert Lamb <rlamb@instructure.com>
Product-Review: Robert Lamb <rlamb@instructure.com>
QA-Review: Robert Lamb <rlamb@instructure.com>
Tested-by: Jenkins
2018-06-23 16:45:20 +00:00
Adrian Packel 4af8b55867 Switch old anonymous grading flag over, again
For any accounts/courses with the old Anonymous Grading flag still
enabled, enable anonymous grading for the assignments in those
accounts/courses and move them over to the new Anonymous Marking flag.
For any accounts with the old flag merely allowed, switch it to off.

refs GRADE-957

Test plan:

Setup:
- Have an account (A1) with the Anonymous Grading (course-level) flag
  set to ALLOW
  - Have a course within A1 (C1) with the same flag set to ON
- Have an account (A2) with the Anonymous Grading (course-level) flag
  set to ON (this can be a sub-account of A1)
  - Have a course within A2 (C2)
- Create at least one assignment in each course
- Ensure the courses and assignments have been published (i.e., the
  courses have a workflow_state of 'available' and the assignments
  have a workflow_state of 'published')

Testing:
- Run the migration
- A1, C1 and A2 should no longer have entries for the old feature flag
  if you call the feature_flag method in the console:

  > account_or_course.feature_flag(:anonymous_grading) # should be nil

- They should also have the new Anonymous Marking flag set to ON
- All assignments in C1 and C2 should now be anonymously-graded

Change-Id: Id1c7325775eda0cbfe89cd5342a1d594c7565b5a
Reviewed-on: https://gerrit.instructure.com/153683
Reviewed-by: Keith T. Garner <kgarner@instructure.com>
Reviewed-by: Spencer Olson <solson@instructure.com>
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Anju Reddy <areddy@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2018-06-21 17:33:38 +00:00
Michael Brewer-Davis 8fa3360f89 do not include hidden results in rollups
closes OUT-1846

Test plan:
- create an outcome
- create two assignments with rubrics including
  the outcome
- set one of the rubrics to "Don't post results to LMGB"
- assess a student using both rubrics with different scores
- visit the LMGB
- verify that only the non-hidden score is reflected
  in the LMGB
- visit the student LMGB
- verify that only the non-hidden alignment is shown
  in the student lmgb
- visit
    http://canvas.docker/api/v1/courses/COURSE_ID/outcome_results?user_ids[]=USER_ID&outcome_ids[]=OUTCOME_ID
  (replacing COURSE_ID, USER_ID and OUTCOME_ID)
- verify that hidden alignment is not shown
- add
    &include_hidden=true
  to the above URL
- verify that hidden alignment is now shown

Change-Id: Ie08c63f32686ffc42394e926c22eac773799d616
Reviewed-on: https://gerrit.instructure.com/154464
Tested-by: Jenkins
Reviewed-by: Frank Murphy <fmurphy@instructure.com>
Reviewed-by: Augusto Callejas <acallejas@instructure.com>
QA-Review: Augusto Callejas <acallejas@instructure.com>
Product-Review: Sidharth Oberoi <soberoi@instructure.com>
2018-06-21 16:39:27 +00:00
Cody Cutrer ce9fcf595f run counts reports in parallel
refs CORE-1505

also, don't build the overview report anymore (which requires summing up
all of the parts)

Change-Id: Icb4c317e65237cb4ea9a800d7742f36ebac79022
Reviewed-on: https://gerrit.instructure.com/154342
Tested-by: Jenkins
Reviewed-by: James Williams  <jamesw@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2018-06-21 14:44:22 +00:00
Mysti Sadler cd569cda41 Preload assignment objects
refs ADMIN-1031
closes ADMIN-1136

Test plan
- Ensure /api/v1/planner/items call runs
- It shouldn't have to load individual
  SQL queries for content tags for assignments
  or for assignment overrides or to get
  assignments from quiz/wiki/discussions

Change-Id: I7720944df118f158b444330842bdb2c2780f053b
Reviewed-on: https://gerrit.instructure.com/153422
Tested-by: Jenkins
Reviewed-by: Dan Minkevitch <dan@instructure.com>
QA-Review: Dan Minkevitch <dan@instructure.com>
Product-Review: Mysti Sadler <mysti@instructure.com>
2018-06-20 19:13:29 +00:00
Han Ngo 843ec80814 Canvas Creates Private-Public Key Pair & Copy into JWK Format
Closes PLAT-3503 & PLAT-3504

Test Plan
- Verify Lti::RSAKeyPair can generate a private and a public key
- Verify the key pair can be read but not modified
- Verify the keys got copied into JWK format correctly

Change-Id: If83edebfbf631815e3078031623d6dead52017ec
Reviewed-on: https://gerrit.instructure.com/154187
Reviewed-by: Marc Alan Phillips <mphillips@instructure.com>
Tested-by: Jenkins
QA-Review: Marc Alan Phillips <mphillips@instructure.com>
Product-Review: Han Ngo <hngo@instructure.com>
2018-06-20 13:29:30 +00:00
Jeremy Neander 4626c6cbc3 add existing custom grades to moderation page
refs GRADE-1002

test plan:
 A. Setup
    1. Set up a course with a moderated assignment
    2. Log in as various instructors and grade some students
    3. Log in as the final grader
    4. Visit SpeedGrader and grade some students

 B. Verify without Grader Anonymity
    1. Ensure the final grader can see grader names
    2. Visit the Moderation Page
    3. Verify the final grader's grades are visible
       * They appear in the Select menu only
       * e.g. "9.8 (Custom)"
    4. Verify the final grader's grades can be selected

 C. Verify with Grader Anonymity
    1. Ensure the final grader cannot see grader names
    2. Visit the Moderation Page
    3. Verify the final grader's grades are visible
    4. Verify the final grader's grades can be selected

 D. Verify as an Admin (w & w/o Grader Anonymity)
    1. Visit the Moderation Page
    2. Verify the final grader's grades are visible
    3. Verify the final grader's grades can be selected

Change-Id: I7ded82f9663be9bea74598c3fa4d71146ffb25cd
Reviewed-on: https://gerrit.instructure.com/153784
Reviewed-by: Spencer Olson <solson@instructure.com>
Reviewed-by: Keith T. Garner <kgarner@instructure.com>
QA-Review: Anju Reddy <areddy@instructure.com>
Tested-by: Jenkins
Product-Review: Sidharth Oberoi <soberoi@instructure.com>
2018-06-19 19:00:12 +00:00
Adrian Packel 8fc7cf8c3c Set grade_matches_current_submission in MPA
For any submissions considered missing, have the missing policy
applicator set grade_matches_current_submission to true. (This is
appropriate since the grade issued by the applicator matches the
submission's current lack-of-submission.)

fixes GRADE-1171

Test plan:
- Create a course with some students
- Open new Gradebook, click the settings cog, and enable "Automatically
  apply grade for missing submissions" and set a value
- Create an online-submitted assignment with a due date in the past
  - The entries in Gradebook should be appropriately marked as missing
- Open the assignment in SpeedGrader
  - In the menu at the top, the students should have a checkbox by their
    name indicating their submissions (or lack thereof) are graded
- Log in as one of the students and submit something for the assignment
- As the teacher, open the assignment in SpeedGrader again
  - That student should now have the "circle" icon by their name in the
    menu, indicating their new submission needs a grade

Change-Id: I35d5036341192eac6e8abe017f88067fb621ea29
Reviewed-on: https://gerrit.instructure.com/154075
Reviewed-by: Neil Gupta <ngupta@instructure.com>
Reviewed-by: Spencer Olson <solson@instructure.com>
Reviewed-by: Keith T. Garner <kgarner@instructure.com>
Tested-by: Jenkins
QA-Review: Anju Reddy <areddy@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2018-06-19 15:01:40 +00:00
Matthew Berns e924133cb8 add hide_points to json response on lmgb
closes OUT-2300

test plan (dev-qa):
- create a new outcome
- create a new rubric and align the outcome
- align the rubric to a new assignment, ensure you
  choose the box to remove points from rubric
- assess a student
- go to the LMGB
- the outcome_rollups response should include a
  hide_points field in the json
- hide_points should be 'true' on the rollup for the new outcome
  with the newly created outcome
- attach the newly create outcome to a different assignment, one
  that doesn't have its points hidden on the rubric association
- assess the student
- return to lmgb
- hide_points should be 'false' for the rollup on the new outcome

Change-Id: I0f9accb4ff0cc76f40c08ce08e21091e35df6af8
Reviewed-on: https://gerrit.instructure.com/153547
Tested-by: Jenkins
Reviewed-by: Michael Brewer-Davis <mbd@instructure.com>
Reviewed-by: Augusto Callejas <acallejas@instructure.com>
Product-Review: Michael Brewer-Davis <mbd@instructure.com>
QA-Review: Michael Brewer-Davis <mbd@instructure.com>
2018-06-13 21:58:49 +00:00
Jacob Fugal 0e9a74856e don't export partial attachments to inst-fs
Change-Id: I35e28352b4ac68ce86293130c7689431d628f1fe
test-plan: specs
Reviewed-on: https://gerrit.instructure.com/153652
Tested-by: Jenkins
Reviewed-by: Michael Jasper <mjasper@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
QA-Review: Jacob Fugal <jacob@instructure.com>
2018-06-13 17:04:40 +00:00
Neil Gupta 6a659fbaa8 stop using anonymous moderated marking feature flag
fixes GRADE-976

test plan:
* Make sure the AMM flag is off
* All AMM features should be visible and work
* The Anonymous Marking and Moderated feature flags should be visible
* Toggling the AMM feature flag should do nothing

Change-Id: Ie0c52c23748389c6f5df5b85e8580bdf474c0a52
Reviewed-on: https://gerrit.instructure.com/152067
Reviewed-by: Adrian Packel <apackel@instructure.com>
Tested-by: Jenkins
Reviewed-by: Derek Bender <djbender@instructure.com>
QA-Review: James Butters <jbutters@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2018-06-12 20:58:47 +00:00
Neil Gupta c9b6791e1f Migrate legacy moderated graders to new moderation_graders table
fixes GRADE-1020

test plan: migrations run and specs pass

Change-Id: I03ee7f87139b5d5373e7c62942670741f50d9ff1
Reviewed-on: https://gerrit.instructure.com/152299
Reviewed-by: Adrian Packel <apackel@instructure.com>
Reviewed-by: Spencer Olson <solson@instructure.com>
Tested-by: Jenkins
QA-Review: Neil Gupta <ngupta@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2018-06-07 16:05:36 +00:00
Jeremy Stanley e2c28d9010 don't replace part of an absolute path in HtmlRewriter
yes, this is terrible, but it's less bad than breaking URLs entirely
which is what we did before

test plan:
 - upload an image to a course
 - put the following in a quiz description using the HTML editor:
   <img src="http://localhost:3000/files/3603/download?download_frd=1">
   (substitute the hostname and id of the image)
 - ensure the image shows up when viewing the quiz
 - copy the course
 - ensure the image shows up when viewing the quiz in the copy

fixes ADMIN-1103

Change-Id: I4b1914a7dd8baa1d03cf739163cdbf0e164e56da
Reviewed-on: https://gerrit.instructure.com/152470
Reviewed-by: James Williams  <jamesw@instructure.com>
Tested-by: Jenkins
QA-Review: Luke Kingsley <lkingsley@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2018-06-06 21:30:28 +00:00
Nathan Mills a270d29b4a use class methods instead of consts for api scopes
fixes PLAT-3454

test plan:
* you can either test in production RAILS_ENV
or turn on eager_loading and disable class_cache in development

* The scopes list in the developer keys page should show all
expected scopes

Change-Id: I4018cdd8d4f08d32f549cfab5f4a135c2144c403
Reviewed-on: https://gerrit.instructure.com/152398
Tested-by: Jenkins
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
QA-Review: Weston Dransfield <wdransfield@instructure.com>
Product-Review: Karl Lloyd <karl@instructure.com>
2018-06-05 16:46:47 +00:00
Ed Schiebel 2729cabecd Include feedback in planner items
- skinnied down the feedback in the api to just the comment we want
- updated planner to show the feedback if it exists

closes ADMIN-1022

test plan
  - create an assignment, have the student submit an entry, have the
    teacher grade it and include a comment that's long enough that it
    gets truncated in the planner
  > expect the comment to show up with the item in the planner
  > expect the comment to be truncated with an ellipsis in desktop
    and tablet view

Change-Id: Ie540c6b11a95422fae3723f9a78e6bf68dbf10e9
Reviewed-on: https://gerrit.instructure.com/151377
Tested-by: Jenkins
Reviewed-by: Jon Willesen <jonw+gerrit@instructure.com>
QA-Review: Luke Kingsley <lkingsley@instructure.com>
Product-Review: Jon Willesen <jonw+gerrit@instructure.com>
2018-06-05 14:47:33 +00:00
Michael Brewer-Davis 834d967ee7 resolve outcome import/export errors
closes OUT-2219

Test plan:
- Verify that the CSV files included in the ticket
  import without error
- Verify that the account outcomes export correctly
  after the files included in the ticket have been
  imported
- Create a valid outcomes CSV file with only the following
  fields: vendor_guid, object_type, title
  and verify that it imports correctly
- Verify that account outcomes export correctly
  after the minimal file has been imported

Change-Id: I94d48be26bb12930c9355ebfc38f928860249ba9
Reviewed-on: https://gerrit.instructure.com/151822
Reviewed-by: Frank Murphy <fmurphy@instructure.com>
Reviewed-by: Matt Berns <mberns@instructure.com>
Tested-by: Jenkins
QA-Review: Augusto Callejas <acallejas@instructure.com>
Product-Review: Sidharth Oberoi <soberoi@instructure.com>
2018-06-05 13:30:48 +00:00
James Williams 287321a80c don't run giant transaction around user_importer
refs #CORE-1467

Change-Id: I57d2f3315e7c908bfb7f5944b650e4153a965908
Reviewed-on: https://gerrit.instructure.com/151863
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2018-06-04 19:47:08 +00:00
Jacob Fugal 7f301937ea legacy api claims in inst-fs jwts for API clients
fixes RECNVS-471
fixes RECNVS-479

allows API requests from access tokens issued by whitelisted developer
keys to receive additional claims in the JWTs of inst-fs links in the
response. these additional claims are a workaround to cause inst-fs to
accept the link as if authenticated despite the client not having an
inst-fs session or presenting inst-fs with the access token.

updated API clients will need to present their API token when accessing
inst-fs links. once the clients associated with a developer key are
updated, the developer key will be removed from the whitelist. this is
only a temporary workaround.

test-plan:
- have inst-fs configured and enabled with your canvas instance
- generate a new access token for your user
- in the rails console of your canvas instance, set:
  Setting.set('instfs.whitelist_all_developer_keys', 'true')
- using something without a session, like postman, POST to
  /api/v1/courses/:course_id/files with a valid preflight and
  authenticated via the access token (e.g. using the `Authorization`
  header)
  - the `upload_url` in the response should be an inst-fs link
  - the `upload_url` should include a `token` query parameter with a JWT
    as the value
  - decoding the JWT from the `upload_url`, it should include
    `legacy_api_developer_key_id` and a `legacy_api_root_account_id`
    claims
- in the rails console of your canvas instance:
  Setting.remove('instfs.whitelist_all_developer_keys')
- repeat the upload preflight attempt from above
- this time, the JWT should not include the `legacy_api_*` claims

Change-Id: I911d18c031d9ba90de808e260e4644beaef69ff9
Reviewed-on: https://gerrit.instructure.com/151690
Tested-by: Jenkins
Reviewed-by: Jonathan Featherstone <jfeatherstone@instructure.com>
QA-Review: Collin Parrish <cparrish@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
2018-06-04 17:04:06 +00:00
Derek Bender d5c8a08920 spec: fix flakey grade calc spec
add order query to scores query to ensure consistency

Change-Id: Ia29a249e35d2aaecd431b8d1ce4032bd340dd37e
Reviewed-on: https://gerrit.instructure.com/152344
Tested-by: Jenkins
Reviewed-by: Steven Burnett <sburnett@instructure.com>
Product-Review: Steven Burnett <sburnett@instructure.com>
QA-Review: Steven Burnett <sburnett@instructure.com>
2018-06-03 20:00:09 +00:00
Cameron Sutter 080beef78d allow all observers
closes MBL-10561

test plan:
- go through all the observer_alerts & observer_alert_thresholds
  endpoints and use them with a course observer

Change-Id: I64b14746969727b69b047139fdceecb89f4c123a
Reviewed-on: https://gerrit.instructure.com/151107
Reviewed-by: Matthew Sessions <msessions@instructure.com>
Tested-by: Jenkins
QA-Review: Taylor Wilson <twilson@instructure.com>
Product-Review: Taylor Wilson <twilson@instructure.com>
2018-06-02 01:57:34 +00:00
Neil Gupta 9b7ec59ee6 anonymize gradeable students endpoint
fixes GRADE-898 GRADE-1023

test plan:
1. create a course with 3 teachers and 1 student
2. create an anonymously graded and moderated assignment with 2 graders
3. as a teacher, give the student a provisional grade
4. as another teacher, give the student another provisional grade
5. as the final grader, visit the grade moderation page
6. inspect the API responses, there should be no identifiable ids or
  names in the responses
7. select a final grade
8. make sure the API request and response when selecting the final grade
  is also anonymous

Change-Id: I083673e29d4b49c1d97cedad46571bccc622a8a2
Reviewed-on: https://gerrit.instructure.com/151134
Tested-by: Jenkins
Reviewed-by: Jeremy Neander <jneander@instructure.com>
Reviewed-by: Spencer Olson <solson@instructure.com>
QA-Review: Anju Reddy <areddy@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2018-05-31 22:30:25 +00:00
Han Yan f9676125bb Qti import from Canvas to Quizzes.Next
refs QUIZ-4415

test plan:
- cr
- Quiz.Next CC import is not ready for test with only this patch
- regression on `Import Content`, to make sure:
  1) `Qti .zip file` import works
  2) `Common Catridge 1.x Package` import works

Change-Id: Iba2818a2b864020b6c59ef55e02f122b996e4c40
Reviewed-on: https://gerrit.instructure.com/149978
Reviewed-by: Andrew Butterfield <abutterfield@instructure.com>
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: David Tan <dtan@instructure.com>
Product-Review: Han Yan <hyan@instructure.com>
2018-05-31 16:57:32 +00:00
Nick Pitrak d058cfec8e automatically add students to moderation (back end)
closes GRADE-1177

test plan:
- turn on anonymous moderated marking
- create a course with a student
- create a moderated assignment in the course
- add another student to the course
- go to the moderation page for the assignment
- ensure both students have a speedgrader link in the first column
- go back to the assignment page
- edit the assignment to only be assigned to the first student
- open the rails console
- find the assignment
- ensure assignment.moderated_grading_selections.count returns 1

Change-Id: I8ef9fb7715b103469ea35c303c4301520b7bf7cb
Reviewed-on: https://gerrit.instructure.com/150969
Tested-by: Jenkins
Reviewed-by: Adrian Packel <apackel@instructure.com>
Reviewed-by: Keith T. Garner <kgarner@instructure.com>
QA-Review: James Butters <jbutters@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2018-05-30 22:46:21 +00:00
Jeremy Neander eed2cca7f5 create simple version of new moderation page
refs GRADE-964
refs GRADE-877
refs GRADE-1024

test plan:
 A. Setup
    1. Enable Anonymous Moderated Marking
    2. Select or create a course
       a. with Anonymous Marking enabled
       b. with three instructors (A, B, and C)
       c. with at least one student
    3. Select or create an assignment
       a. with Moderated Grading
       b. with instructor A as the final grader
    4. Select or create an assignment
       a. with Moderated Grading
       b. with Anonymous Grading
       c. with instructor A as the final grader
    5. As each instructor (B and C)
       a. give at least one student a provisional grade
          on each assignment (using SpeedGrader)
       * This SHOULD create a new moderation_grader for each user
         and for each assignment

 B. Verify the Non-Anonymous Assignment
    1. Log in or act as instructor A
    2. Visit the moderation page for the assignment
    3. Verify the assignment title is visible on the page
    4. Open the browser console
    5. View the contents of ENV.GRADERS
    6. Verify for both instructors B and C:
       a. user_id is present
       b. anonymous_id is NOT present
       c. grader_name is present

 B. Verify the Anonymous Assignment
    1. Log in or act as instructor A
    2. Visit the moderation page for the assignment
    3. Verify the assignment title is visible on the page
    4. Open the browser console
    5. View the contents of ENV.GRADERS
    6. Verify for both instructors B and C:
       a. anonymous_id is present
       b. user_id is present
       c. grader_name is NOT present

Change-Id: Id69f926972c1daaf8d7db5257f66b92e30a914fa
Reviewed-on: https://gerrit.instructure.com/151149
Reviewed-by: Derek Bender <djbender@instructure.com>
Reviewed-by: Keith T. Garner <kgarner@instructure.com>
Tested-by: Jenkins
QA-Review: Indira Pai <ipai@instructure.com>
Product-Review: Sidharth Oberoi <soberoi@instructure.com>
2018-05-30 21:21:22 +00:00
Michael Jasper ceb0f5ec75 handle missing setting values properly
closes RECNVS-440

test plan
- enable the instfs plugin with canvas, but have missing setting
  values (app-host, secret)
- actions with respect to instfs should not cause errors
  - login, logout, file upload
- canvas should treat instfs as it is not enabled if setting values
  are not set

Change-Id: I2a33a553c6d66e99fd85e8333b8d8a3b60124d10
Reviewed-on: https://gerrit.instructure.com/150575
Reviewed-by: Andrew Huff <ahuff@instructure.com>
QA-Review: Collin Parrish <cparrish@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Tested-by: Jenkins
Product-Review: Michael Jasper <mjasper@instructure.com>
2018-05-30 19:03:30 +00:00
Derek Bender b57cb8cbae add anonymous provisional grades controller
When loading or selecting a student in SpeedGrader, an ajax call is made
to obtain the provisional grade status for that student. This provides a
way to perform this request anonymously.

closes GRADE-1128

test plan
- given an anonymously graded and moderated assignment
- given some students assigned to said assignment
- when visiting speed grader
- then the page loads provisional grades endpoint which can be viewed in
  the dev tools on the network tab. The URL looks like:

  /api/v1/courses/1/assignments/1/anonymous_provisional_grades/status

Change-Id: Ib3d3a7b58fc8fa044d240dee0c1bef08b80384d0
Reviewed-on: https://gerrit.instructure.com/151607
Tested-by: Jenkins
Reviewed-by: Jeremy Neander <jneander@instructure.com>
Reviewed-by: Spencer Olson <solson@instructure.com>
QA-Review: Indira Pai <ipai@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2018-05-30 17:40:14 +00:00
Keith Garner a89d8b7b8b change assignment due date caching from a singleton to a strand
When invoking the DueDateCacher with update_grades on, switch to using
a strand based on the course instead of a singleton based on the
assignment. This should avoid score table contention when lots of
assignments in a single course are edited close in time to each other.

closes GRADE-1194

test plan:
 - Have a course with some students and a bunch of assignments
 - Edit the assignments quickly back to back
 - Ensure the jobs queued as a strand
 - (Testing this may be easier if delayed jobs isn't running and you
   edit inst-jobs to always background even if not in production.)

Change-Id: I4b5600f52f2f09b6faf994e29e6056e1c6eaeb60
Reviewed-on: https://gerrit.instructure.com/151661
Tested-by: Jenkins
Reviewed-by: Adrian Packel <apackel@instructure.com>
Reviewed-by: Jeremy Neander <jneander@instructure.com>
QA-Review: Jeremy Neander <jneander@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2018-05-30 16:01:30 +00:00
Rob Orton 7c9f41312c restore states for sis_imports
fixes CORE-1397
fixes CORE-1398

test plan
 - run sis import that changes workflow_states of objects
 - restore the sis import
 - the states should be restored
 - rake doc:api should work

Change-Id: I4fb401699d53d4d8309c986ae27eefea99e93d53
Reviewed-on: https://gerrit.instructure.com/150113
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Rohan Cheeniyil <rcheeniyil@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2018-05-29 21:38:09 +00:00
Rob Orton 91a4234bd3 create roll back data for users
closes CORE-1395

test plan
 - import users
 - workflow_state changes should be logged

Change-Id: I1466d6ec9f0ac3d38f74fd1b7a68dd0fa1c77a2f
Reviewed-on: https://gerrit.instructure.com/150103
Tested-by: Jenkins
Reviewed-by: James Williams  <jamesw@instructure.com>
QA-Review: Rohan Cheeniyil <rcheeniyil@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2018-05-29 21:28:29 +00:00
Rob Orton 9cfe51d449 create roll back data for groups
closes CORE-1394

test plan
 - import groups and group_memberships and
   group_categories
 - workflow_state changes should be logged

Change-Id: I91d50dcb7a34051b3c6b70bfb5acc2021cdbbc30
Reviewed-on: https://gerrit.instructure.com/150102
Reviewed-by: James Williams  <jamesw@instructure.com>
Tested-by: Jenkins
QA-Review: Rohan Cheeniyil <rcheeniyil@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2018-05-29 21:28:23 +00:00
Rob Orton 57d0771887 create roll back data for admin importer
closes CORE-1393

test plan
 - import admin
 - workflow_state changes should be logged

Change-Id: I5067cf85f68cb2cc65d1f77c89572bb728b21988
Reviewed-on: https://gerrit.instructure.com/150101
Reviewed-by: James Williams  <jamesw@instructure.com>
Tested-by: Jenkins
QA-Review: Rohan Cheeniyil <rcheeniyil@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2018-05-29 21:28:17 +00:00
Rob Orton 063e36faa4 create roll back data for section importer
closes CORE-1391

test plan
 - import sections
 - workflow_state changes should be logged

Change-Id: I18d24bd0dbffb26c9132a63e5b9da937e0742455
Reviewed-on: https://gerrit.instructure.com/150100
Reviewed-by: James Williams  <jamesw@instructure.com>
Tested-by: Jenkins
QA-Review: Rohan Cheeniyil <rcheeniyil@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2018-05-29 21:28:10 +00:00
Rob Orton 3aa5acc6ca create roll back data for enrollment importer
closes CORE-1392

test plan
 - import enrollments
 - workflow_state changes should be logged

Change-Id: I26e2711713307f98da4a5cf0230bdac3e1cf0b90
Reviewed-on: https://gerrit.instructure.com/150099
Reviewed-by: James Williams  <jamesw@instructure.com>
Tested-by: Jenkins
QA-Review: Rohan Cheeniyil <rcheeniyil@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2018-05-29 21:28:03 +00:00
Rob Orton 7e30160782 create roll back data for course importer
closes CORE-1390

test plan
 - import courses
 - workflow_state changes should be logged

Change-Id: Ieb3d87e6b5fb826e88f6dce3430571d735e5422a
Reviewed-on: https://gerrit.instructure.com/149578
Tested-by: Jenkins
Reviewed-by: James Williams  <jamesw@instructure.com>
QA-Review: Rohan Cheeniyil <rcheeniyil@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2018-05-29 21:27:57 +00:00
Rob Orton 2e8af939b4 create roll back data for term importer
closes CORE-1416

test plan
 - import terms
 - workflow_state changes should be logged

Change-Id: Ie846f2bfd12fb88da54d66c7eac942d1b6c6ccb5
Reviewed-on: https://gerrit.instructure.com/150545
Reviewed-by: James Williams  <jamesw@instructure.com>
Tested-by: Jenkins
QA-Review: Rohan Cheeniyil <rcheeniyil@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2018-05-29 21:27:52 +00:00
Rob Orton 5b48c4f2ca create roll back data for account importer
closes CORE-1389

test plan
 - import accounts
 - workflow_state changes should be logged

Change-Id: Ib6aff91b05ef99ec618d09364ed04492c9eee698
Reviewed-on: https://gerrit.instructure.com/149567
Reviewed-by: James Williams  <jamesw@instructure.com>
Tested-by: Jenkins
QA-Review: Rohan Cheeniyil <rcheeniyil@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2018-05-29 21:27:47 +00:00
Spencer Olson 8bbfbac5d2 grade calc: use bigdecimal instead of float for calculations
Convert values to bigdecimal before computing to avoid rounding issues
in certain edge cases.

closes GRADE-1187

Test Plan:
- specs pass

Change-Id: If5140e24c28647350170f559ffe6f231ed1a6a30
Reviewed-on: https://gerrit.instructure.com/151674
Tested-by: Jenkins
Reviewed-by: Keith T. Garner <kgarner@instructure.com>
Reviewed-by: Jeremy Neander <jneander@instructure.com>
Product-Review: Spencer Olson <solson@instructure.com>
QA-Review: Spencer Olson <solson@instructure.com>
2018-05-29 21:01:23 +00:00
Stewie (Nicholas Stewart) 80cdef03b4 Update existing account bindings' workflow_state
Test Plan: specs still pass.

Refs: PLAT-3409

Change-Id: Ibf31f2611fb8193962073ade4a8097f6056f24ed
Reviewed-on: https://gerrit.instructure.com/151124
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Tested-by: Jenkins
Product-Review: Stewie aka Nicholas Stewart <nstewart@instructure.com>
2018-05-24 16:53:02 +00:00
Stewie (Nicholas Stewart) 28c9125c37 Backfill bindings for deleted keys
Test Plan: For a dev key dk, call dk.detroy,
delete its bindings, run the migration,
and verify dk has a binding with an "off" state.

Refs: PLAT-3400

Change-Id: I0031911d9d6102eed96de672910dce0104db50be
Reviewed-on: https://gerrit.instructure.com/151064
Tested-by: Jenkins
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Stewie aka Nicholas Stewart <nstewart@instructure.com>
2018-05-24 16:52:52 +00:00
Cameron Sutter ae3e89536c mark alerts read/dismissed
closes MBL-10124

test plan:
 - create an observer alert (probably in the rails console)
 - use the new endpoint to mark it read
 - create another observer alert
 - use the new endpoint to dismiss it

endpoint:
 /users/:user_id/observer_alerts/:observer_alert_id/:workflow_state

  :workflow_state should be either 'read' or 'dismissed'

Change-Id: I44e06a703e059d8188a841259846b088bb9b1c68
Reviewed-on: https://gerrit.instructure.com/150730
Reviewed-by: Matthew Sessions <msessions@instructure.com>
Product-Review: Matthew Sessions <msessions@instructure.com>
QA-Review: Matthew Sessions <msessions@instructure.com>
Tested-by: Jenkins
2018-05-24 16:47:16 +00:00
Andrew Butterfield c8602c0da6 Add student sis id to grade changed live event
refs PLAT-3331

Test plan:
* specs pass

Change-Id: I5737430d2a56a04ce89088c9b6c2f4273b5a37a4
Reviewed-on: https://gerrit.instructure.com/151222
Tested-by: Jenkins
QA-Review: August Thornton <august@instructure.com>
Reviewed-by: Nathan Mills <nathanm@instructure.com>
Product-Review: Andrew Butterfield <abutterfield@instructure.com>
2018-05-23 19:21:35 +00:00
Xander Moffatt 1b02588f9c allow JWT creation with algorithms other than `HS256`
refs RECNVS-387

* eventually, default to HS512 or ES512
* for now, allow specifying a different algorithm

test plan:
* specs

Change-Id: I914da208ae9f85b28a35ac6705c1cee02c8d6739
Reviewed-on: https://gerrit.instructure.com/150613
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Tested-by: Jenkins
Product-Review: Xander Moffatt <xmoffatt@instructure.com>
QA-Review: Xander Moffatt <xmoffatt@instructure.com>
2018-05-23 16:54:01 +00:00
Nathan Mills ec4f61746f add lookup class for scope resource names
fixes PLAT-3311

test plan:

* run the rake task "doc:api"
* request the scopes from api/v1/accounts/:account_id/scopes
  - you should get back a json object that includes the localized name
* request the scopes from api/v1/accounts/:account_id/scopes passing
  the query param "group_by=resources_name"
  - you should get back a json object with the scopes grouped by
    localized resource_name

Change-Id: I2cab1822baef7cdda6471096153d60d4f7fe1e2b
Reviewed-on: https://gerrit.instructure.com/150233
Tested-by: Jenkins
Reviewed-by: Marc Alan Phillips <mphillips@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Jesse Poulos <jpoulos@instructure.com>
2018-05-23 16:09:12 +00:00
Stewie (Nicholas Stewart) b86b534193 Backfill dev key account bindings
Refs: PLAT-3021

Test Plan: For a dev key dk, delete its bindings, run the migration, and
verify dk has a binding with an "on" state.

Change-Id: Iae3628355817e69976ad255eebf7dfae673b9c14
Reviewed-on: https://gerrit.instructure.com/150221
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
Tested-by: Jenkins
QA-Review: August Thornton <august@instructure.com>
Product-Review: Stewie aka Nicholas Stewart <nstewart@instructure.com>
2018-05-23 14:38:56 +00:00
Cameron Sutter eb880955bd dont allow duplicate thresholds
closes MBL-10504

test plan:
- using the api endpoint below, try to create a threshold
  with an alert_type that already exists for a user/observer
- it shouldn't create a new threshold, just update the
  value for "threshold"

endpoint: POST /users/:user_id/observer_alert_thresholds

Change-Id: I64870ea5414b83d984cb4a71ff106bfb1d532d1b
Reviewed-on: https://gerrit.instructure.com/150515
Tested-by: Jenkins
Reviewed-by: Matthew Sessions <msessions@instructure.com>
QA-Review: Kausty Saxena <ksaxena@instructure.com>
Product-Review: Cameron Sutter <csutter@instructure.com>
2018-05-21 21:02:24 +00:00
Cameron Sutter a124defc21 get alerts by student
closes MBL-10123

test plan:
- with a user_observation_link and an observer_alert_threshold
  make observer_alerts in the rails console
- hit the endpoint
  /users/:user_id/observer_alerts/:student_id
- it should return all alerts for that observer/student

Change-Id: I01fe71e3414d63cedc0e02eaed4e0d8822f80fcf
Reviewed-on: https://gerrit.instructure.com/150143
Reviewed-by: Matthew Sessions <msessions@instructure.com>
Tested-by: Jenkins
QA-Review: Taylor Wilson <twilson@instructure.com>
Product-Review: Cameron Sutter <csutter@instructure.com>
2018-05-17 21:56:34 +00:00
Jacob Fugal eab9c0ed2a script to reclaim attachments from instfs
fixes RECNVS-419

intended for manual execution only if necessary, not scheduled by a job.
would be good to optimize to allow parallel downloads of files from
inst-fs instead of serial.

test-plan:
  setup:
    - configure your canvas with at least two root accounts, A and B
    - enable inst-fs on root account B but initially disable it on root
      account A
    - upload a handful of files into root account A ("set A") and verify
      they're being served by non-inst-fs (local storage or s3,
      whichever you have configured)
    - upload a handful of files into root account B ("set B") and verify
      they're being served by inst-fs
    - now enable inst-fs on root account A and upload or generate more
      files into various locations in that account (courses, groups,
      content exports, etc.). include any portion of canvas you want to
      verify ("set C")
    - verify "set A" is still served by local storage or s3 and "set C"
      is served by inst-fs

  trigger:
    - disable inst-fs on root account A
    - in the rails console, run:
      DataFixup::ReclaimInstfsAttachments.run([root_account_A])

  verify:
    - verify "set A" still works, and is still served by non-inst-fs;
      non-inst-fs files should be untouched by the fixup
    - verify "set B" still works, and is still served by inst-fs;
      inst-fs files in other accounts should be untouched by the fixup
    - verify "set C" still works, but is now served by non-inst-fs
      instead of inst-fs; inst-fs files in the target account should be
      "repatriated" to non-inst-fs storage

Change-Id: Ia6d7b43f295af79d7db4658dfad4e1965aab57d4
Reviewed-on: https://gerrit.instructure.com/149736
Reviewed-by: Jonathan Featherstone <jfeatherstone@instructure.com>
QA-Review: Collin Parrish <cparrish@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
Tested-by: Jenkins
2018-05-16 16:40:02 +00:00
Adrian Packel 25870e5117 Move anonymous ID routines to own module
refs GRADE-1057

Test plan:
  - Specs pass
  - In a course with at least one student, create a new assignment
    and make sure there are no errors

Change-Id: If429480ea516177bfed91509d149275190b44931
Reviewed-on: https://gerrit.instructure.com/150069
Reviewed-by: Derek Bender <djbender@instructure.com>
Reviewed-by: Spencer Olson <solson@instructure.com>
Tested-by: Jenkins
QA-Review: Spencer Olson <solson@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2018-05-15 15:03:06 +00:00
Cameron Sutter a3f3ec6e81 add observer alert threshold CRUD
closes MBL-10122

test plan:
- do CRUD operations on the observer_alert_threshold endpoints
  /users/<id>/observer_alert_threshold[?student_id=<id>]
  and
  /users/<id>/observer_alert_threshold/<id>

Change-Id: I2c5c7700adaedd4a2068a61568217219b763339e
Reviewed-on: https://gerrit.instructure.com/149147
Reviewed-by: Matthew Sessions <msessions@instructure.com>
Product-Review: Matthew Sessions <msessions@instructure.com>
QA-Review: Matthew Sessions <msessions@instructure.com>
Tested-by: Jenkins
2018-05-10 20:25:01 +00:00
Dan Minkevitch 2391cd2d58 Add comment data to planner/items API
Closes ADMIN-1020

Test Plan:
* With student planner enabled
* As a student
* With a recent submission that has comments/feedback
* GET `api/v1/planner/items`, passing the parameters
  necessary to include the assignment for the aforementioned
  submission
* The response should include the assignment with a
  `submissions.feedback` key whose value is an array
  of hashes of submission comments containing
  the comment, author name, and author avatar url

Change-Id: Ib288330bd276e3c32f994e1cb2a178ecb3eb2ca3
Reviewed-on: https://gerrit.instructure.com/149562
Reviewed-by: Ed Schiebel <eschiebel@instructure.com>
Reviewed-by: Mysti Sadler <mysti@instructure.com>
Reviewed-by: Carl Kibler <ckibler@instructure.com>
Tested-by: Jenkins
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: Dan Minkevitch <dan@instructure.com>
2018-05-10 20:03:21 +00:00
Jacob Fugal 59e375fc47 include real user in oauth token
closes RECNVS-417

We want to give InstFS accurate information about who is actually
accessing files in canvas, even if they're masquerading as someone else.
This commit adds that additional information without breaking the normal
oauth flow for other apps that use oauth.

test plan:
* Check out g/148868 in your instfs repo
* Have canvas configured with inst-fs
* Log in to canvas as an admin
* While masqueraded as another user
  - delete your inst-fs session cookie
  (Go to api.instfs.docker and clear your cookies for that site)
  - visit a canvas page displaying inst-fs files; this will
  regenerate your inst-fs session
* base64 decode the new inst-fs session cookie; verify that it holds
  the admin's user id and not the masqueraded-as user's id

Change-Id: I0790be317bf41290bcbeec672145dc64625573a0
Reviewed-on: https://gerrit.instructure.com/148142
Tested-by: Jenkins
Reviewed-by: Jacob Fugal <jacob@instructure.com>
QA-Review: Collin Parrish <cparrish@instructure.com>
Product-Review: Andrew Huff <ahuff@instructure.com>
Reviewed-by: Andrew Huff <ahuff@instructure.com>
2018-05-07 21:52:53 +00:00
Augusto Callejas 41ad4a0d33 Distinguish between outcome import errors/failures
closes OUT-2012

test plan
  - add `docker-compose/mailcatcher.override.yml` to your
    COMPOSE_FILE env variable
  - start up canvas
  - create or confirm you have at least two account-level outcome
  - under account settings, export outcomes for the given account
  - on the export file, remove one outcome's title by blanking out
    the value, and change the title of another outcome to a valid
    value
  - import the modified exported file
  - confirm that a warning alert appears, saying "a problem importing some
    of the outcomes"
  - confirm that the 2nd outcome's title did change, but not the 1st, since
    the title was blank
  - in mail.canvas.docker, confirm that a successful message appears,
    but with the warning issues listed
  - create an empty csv file
  - import the emtpy csv file
  - confirm that an error alert appears
  - in mail.canvas.docker, confirm that a failed message appears

Change-Id: If9296338a5667e2a4795888d5627a37a1ddcb82a
Reviewed-on: https://gerrit.instructure.com/147994
Reviewed-by: Rob Orton <rob@instructure.com>
Tested-by: Jenkins
Reviewed-by: Michael Brewer-Davis <mbd@instructure.com>
QA-Review: Andrew Porter <hporter-c@instructure.com>
Product-Review: Sidharth Oberoi <soberoi@instructure.com>
2018-05-07 20:55:45 +00:00
Brent Burgoyne d78e11064a make rcs enabled setting enable all risk levels
refs CORE-50

test plan:
- in rails console run:
    Setting.set('rich_content_service_enabled', 'true')
- start canvas (or restart if already running)
- turn of the rcs feature flag if on
- all editors should be using RCS

Change-Id: I9912b14bc92182716921acf6a5c2ffa51e1d1e23
Reviewed-on: https://gerrit.instructure.com/148757
Tested-by: Jenkins
Reviewed-by: Clay Diffrient <cdiffrient@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Brent Burgoyne <bburgoyne@instructure.com>
2018-05-07 16:03:24 +00:00
Shahbaz Javeed 1f96f2da9e allow users to change CSV field separator as personal preference
closes GRADE-1113

test plan:
* Create a course with at least one assignment and one student
* There are three settings you will be testing all combinations of:
  - The feature labelled "Use semicolons to separate fields..."
  - The feature labelled "Autodetect field separators..."
  - The language of your user

* Verify that the semicolons feature and the autodetection feature are
  mutually exclusive.  Specifically:
  - when you enable semicolons and attempt to enable autodetection
    without reloading the page, verify that it generates an error
    message
  - after reloading the page, verify that autodetection can no longer
    be enabled
  - when you disable semicolons and reload the page, verify that
    autodetection can now be enabled
  - verify the above steps also work in the reverse direction when you
    enable autodetection

* Verify the following results:

  semicolons | Autodetection | Language | CSV separators | number format
  -----------+---------------+----------+----------------+--------------
       no    |      no       |    en    |       ','      |      8.5
       no    |      no       |    is    |       ','      |      8,5
       no    |     yes       |    en    |       ','      |      8.5
       no    |     yes       |    is    |       ';'      |      8,5
      yes    |      no       |    en    |       ';'      |      8.5
      yes    |      no       |    is    |       ';'      |      8,5

* Specifically, verify that when you set the features and language as
  in each row, the CSV file generated as a Gradebook export has the
  field separator as described in the fourth column and the number
  format as in the fifth column
* Note that since semicolons and autodetection cannot both be enabled at
  the same time, that case isn't part of the truth table above.

Change-Id: I688cc44bd78e08c8ab3b1d49601f72990361505d
Reviewed-on: https://gerrit.instructure.com/148715
Reviewed-by: Jeremy Neander <jneander@instructure.com>
Reviewed-by: Adrian Packel <apackel@instructure.com>
Reviewed-by: Spencer Olson <solson@instructure.com>
Tested-by: Jenkins
QA-Review: Anju Reddy <areddy@instructure.com>
Product-Review: Sidharth Oberoi <soberoi@instructure.com>
2018-05-04 21:56:57 +00:00
James Williams c45d0c2e96 re-queue sis blueprint association sync if one is in progress
test plan:
* specs, mostly because setting up a parallel sis
environment isn't worth it

closes #ADMIN-1012

Change-Id: I6e87a869a0b211b5cf8fe21e64bd43c151c3e735
Reviewed-on: https://gerrit.instructure.com/149075
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2018-05-04 16:38:42 +00:00
Mysti Sadler 2fe733666f Add calendar events to planner ui
closes ADMIN-971

Test plan
- Ensure calendar items from courses,
  groups, user and appointments show up
  on the planner with correct info
- Ensure all day events show up properly
- Ensure events group up with to do items
- Ensure item links to calendar and goes to
  the event (and opens it) when you click
  the link

Change-Id: I1a2ae654df785b0e2e8c010456ab6c666e0deabc
Reviewed-on: https://gerrit.instructure.com/148505
Tested-by: Jenkins
Reviewed-by: Ed Schiebel <eschiebel@instructure.com>
Reviewed-by: Carl Kibler <ckibler@instructure.com>
QA-Review: Ed Schiebel <eschiebel@instructure.com>
Product-Review: Christi Wruck
2018-05-03 00:27:25 +00:00
Keith Garner 10dbd7f01e add support helper to run due date cacher for a course
To help support close out issues, add a support helper that runs the
DueDateCacher and then recalculates grades for a course.

closes GRADE-1120

test plan:
 - access /api/v1/support_helpers/due_date_cache/course?course_id=6
   to make sure it kicks off a new DueDateCacher run. It should send
   you a success email.
 - make sure that endpoint is only accessible when you are logged in as
   a site admin user

Change-Id: Ida5f7db0484cfd4e33e1094244a3b8c00b523c6a
Reviewed-on: https://gerrit.instructure.com/148694
Tested-by: Jenkins
Reviewed-by: Spencer Olson <solson@instructure.com>
Reviewed-by: Jeremy Neander <jneander@instructure.com>
QA-Review: Shahbaz Javeed <sjaveed@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2018-05-01 20:25:05 +00:00
Simon Williams c8ab71f3a8 bump rails to 5.1.6
Change-Id: Id5331a6c8b54d5e0cb553ba657a9f78892c0c2ec
Reviewed-on: https://gerrit.instructure.com/145599
Reviewed-by: Rob Orton <rob@instructure.com>
Tested-by: Jenkins
Product-Review: Simon Williams <simon@instructure.com>
QA-Review: Simon Williams <simon@instructure.com>
2018-05-01 19:50:22 +00:00
Jared Crystal 9bc71a7891 return correct versions of questions for quiz submissions
fixes QO-340

test plan:
 - to be tested in mobile app (or in browser + postman)
 - Create a quiz with an essay question
 - As a student, start taking the quiz
 - As a teacher, update the question to be a file upload question
   (can also change point value, question stem, title, etc)
 - As the student, resume the quiz on the app
   (or hit /api/v1/quiz_submissions/YOUR_QUIZ_SUBMISSION_ID/questions)
 - the question type should still be essay
 - other question details should reflect the original question from
   when you started the quiz as the student

Change-Id: Ie6be814d4b8c3b154cdb79f79766c5ac0a04bf45
Reviewed-on: https://gerrit.instructure.com/147893
Reviewed-by: Mark Grant <mgrant@instructure.com>
Tested-by: Jenkins
QA-Review: Sven Thirion <sthirion@instructure.com>
Product-Review: Kevin Dougherty <jdougherty@instructure.com>
2018-05-01 17:58:02 +00:00
Jeremy Neander 36d2ee1705 prevent unmuting some anonymous moderated assignments
closes GRADE-959

test plan:
 A. Setup
    1. Set Anonymous Moderated Marking to "ON"
       * Root Account Level Feature Flag
    2. Set Anonymous Marking to "ON"
       * Root Account > Course Level Feature Flag
    3. Create an anonymous Assignment

 B. Verify in New Gradebook
    1. Visit New Gradebook
    2. Mute the assignment from above
    3. Verify the option to Unmute is disabled
    4. Verify other assignments can be muted and unmuted

 C. Verify in Old Gradebook
    1. Visit Old Gradebook
    2. Mute the assignment from above
    3. Verify the option to Unmute is disabled
    4. Verify other assignments can be muted and unmuted

Change-Id: Iafcf18db396b4150efeb415aba5e3cb55dcfffa3
Reviewed-on: https://gerrit.instructure.com/148100
Tested-by: Jenkins
Reviewed-by: Adrian Packel <apackel@instructure.com>
Reviewed-by: Keith T. Garner <kgarner@instructure.com>
QA-Review: Indira Pai <ipai@instructure.com>
Product-Review: Sidharth Oberoi <soberoi@instructure.com>
2018-05-01 17:10:43 +00:00
Michael Jasper 7cbf9917eb course exports use instfs if enabled
closes RECNVS-414

test plan
- with instfs enabled
  - have a course
  - export it
  - verify that the download comes from instfs, not canvas

Change-Id: I18dec04f7c98e85163cd29afeba6b1878a0f62c6
Reviewed-on: https://gerrit.instructure.com/148704
Tested-by: Jenkins
Reviewed-by: Jonathan Featherstone <jfeatherstone@instructure.com>
QA-Review: Collin Parrish <cparrish@instructure.com>
Product-Review: Michael Jasper <mjasper@instructure.com>
2018-05-01 16:43:51 +00:00
Nate Collings b7757849e1 send course id in module events and only send for modules with changes
The course id is needed to be able to access
that resource through the API.

Also only send the module updated live event
when the order changes. Previously they were
getting sent for all modules in the course,
even if the position hadn't changed.

Test plan:

- Create and make a change to context modules
  and validate that the live event has the course_id
- Create and make a change to module items
  and validate that the live event has the course_id
  and module_id
- Reorder modules in a course and validate that the
  only live events sent are for modules whose position
  changed.

refs SKUNK-17

Change-Id: I8443eae28b6d8cddfc8560a22a79b99504e6664c
Reviewed-on: https://gerrit.instructure.com/148580
Reviewed-by: Andrew Butterfield <abutterfield@instructure.com>
Tested-by: Jenkins
Product-Review: Nate Collings <ncollings@instructure.com>
QA-Review: Nate Collings <ncollings@instructure.com>
2018-05-01 16:29:28 +00:00
Simon Williams e7b8ec1d81 don't require mathman config to check enabled status
test plan:
- remove mathman configuration from consul and/or dynamic_settings.yml
- use the equation editor
- it should work, and use codecogs

Change-Id: Ifd12eca76752dfd520eca6b8aae167daadbe0582
Reviewed-on: https://gerrit.instructure.com/147739
Tested-by: Jenkins
Reviewed-by: Ryan Shaw <ryan@instructure.com>
QA-Review: Tucker McKnight <tmcknight@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2018-04-30 22:46:21 +00:00
Nathan Mills d7a7aa0ae3 refactor scopes api endpoint to allow grouping
refs PLAT-3024

test plan:
* request the scopes from api/v1/accounts/:account_id/scopes
  - you should get back a json object that matches the documentation
* request the scopes from api/v1/accounts/:account_id/scopes passing
  the query param "group_by=resources"
  - you should get back a json object with the scopes grouped by
    resource

Change-Id: I4562121a44e3baccc7de8e56e19629377f1931df
Reviewed-on: https://gerrit.instructure.com/148623
Reviewed-by: Marc Alan Phillips <mphillips@instructure.com>
Tested-by: Jenkins
Reviewed-by: Andrew Butterfield <abutterfield@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Nathan Mills <nathanm@instructure.com>
2018-04-30 21:28:46 +00:00
Keith Garner bfa77a7d5b run the assignment score statistics generator in a singleton
The grade calculator can have multiple runs per course if the course
has more than 100 students in it or if single students were being
graded closely together. This patchset invokes the
AssignmentScoreStatisticsGenerator as a singleton from the grade
calculator to avoid running the same calculation multiple times
concurrently.

fixes GRADE-1105

test plan:
 * Create a course with a few students and one 100 point assignment
 * Grade all students with an assortment of points
 * Visit the grade summary page for any student
 * Verify that the assignment stats are correct:
   - minimum score
   - maximum score
   - mean score
   - number of scores

Change-Id: I29b907117a2a2384d871f7dc33050a50344bcc3c
Reviewed-on: https://gerrit.instructure.com/148176
Tested-by: Jenkins
Reviewed-by: Shahbaz Javeed <sjaveed@instructure.com>
Reviewed-by: Jeremy Neander <jneander@instructure.com>
QA-Review: Adrian Packel <apackel@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2018-04-30 19:29:38 +00:00
Mysti Sadler 382e7bc756 API changes to add calendar events to planner
closes ADMIN-970

Test plan
- Add some calendar events, including a course
  event, a user event, a group event and an
  appointment group appointment
- Go to /api/v1/planner/items and ensure all
  of the items show up with the appropriate
  info

Change-Id: I5b0dc6402a98c5018d3597a3474d6a4a68ad3ae7
Reviewed-on: https://gerrit.instructure.com/148244
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: Mysti Sadler <mysti@instructure.com>
2018-04-30 17:16:56 +00:00
Frank Murphy 0063a5d065 Allow linking of outcomes with nil values.
Fixes OUT-2170

Test Plan:
- Create an account-level outcome and an API $TOKEN for your account.
- Find the $ID of the outcome via the UI or rails console.
- Fetch the outcome data:
  curl "https://web.canvas.docker/api/v1/outcomes/$ID.json" \
     -H "Authorization: Bearer $TOKEN" | jq . > outcome.json
- Edit outcome.json so that "description": null
- PUT the edited outcome back:
  curl "https://web.canvas.docker/api/v1/outcomes/$ID.json" \
     -H "Authorization: Bearer $TOKEN" \
     -X PUT \
     --data-binary @outcome.json \
     -H "Content-Type: application/json"
- Export outcomes from the account.
- Create a course under the prior account.
- Import the exported CSV into the course
- Verify that there are no errors and the outcome is properly imported.

Change-Id: If21a7d1068d5bf1ea7aa1de520df229a1688e691
Reviewed-on: https://gerrit.instructure.com/147995
Tested-by: Jenkins
Reviewed-by: Michael Brewer-Davis <mbd@instructure.com>
Reviewed-by: Augusto Callejas <acallejas@instructure.com>
QA-Review: Dariusz Dzien <ddzien@instructure.com>
Product-Review: Michael Brewer-Davis <mbd@instructure.com>
2018-04-30 15:20:22 +00:00
Jeremy Stanley 19893a75fa preserve query params in links in migrations
test plan:
 - have a course with a wiki page and assignment
 - create another page that embeds the two former items
   in an iframe with "?embedded=true" in the link
   as described in the ticket
 - copy the course
 - in the copy, the "?embedded=true" links should be
   preserved

fixes ADMIN-868

Change-Id: I20c775cbd8a76eabecf49252b61a45d0a7817278
Reviewed-on: https://gerrit.instructure.com/147898
Tested-by: Jenkins
Reviewed-by: James Williams  <jamesw@instructure.com>
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2018-04-26 16:35:52 +00:00
Cody Cutrer 41794a9383 rename AccountAuthorizationConfig* to AuthenticationProvider*
I couldn't take it anymore. it was driving me crazy

Change-Id: Ib40addff56e98a6e0a6d80f246c208e0ce0cb762
Reviewed-on: https://gerrit.instructure.com/148026
Tested-by: Jenkins
Reviewed-by: James Williams  <jamesw@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2018-04-26 16:03:47 +00:00
Keith Garner af039d8bb8 ensure teacher_due_date_for_display returns nil not an error
If a DateOverridable is only visible to users and has no due dates at
any level, an undefined method exception was being generated by calls
to teacher_due_date_for_display. This adds guards around the call to
all_due_dates to ensure nil is returned.

fixes GRADE-1099

test plan:
 - spec pass

Change-Id: I27a07760d78bf487d42105a61be424ac479337be
Reviewed-on: https://gerrit.instructure.com/147864
Tested-by: Jenkins
Reviewed-by: Adrian Packel <apackel@instructure.com>
Reviewed-by: Derek Bender <djbender@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
QA-Review: Keith T. Garner <kgarner@instructure.com>
2018-04-26 15:52:54 +00:00
James Williams 7423e4fb94 rails 5.2
closes #CORE-1301 #CORE-1302

Change-Id: I687132b066d12cf35e3c7a593dff9b2a91337f33
Reviewed-on: https://gerrit.instructure.com/147220
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2018-04-25 19:15:20 +00:00
Marc Phillips 4b3fb3aff9 Add submittedAt details to Basic Outcomes
A tool may now submit the submitted at timestamp for a submission
in the tool and Canvas will honor the timestamp submitted as
the submission time.

closes PLAT-2933

Test Plan
 - Submit a submission using the new submissionDetails node
   and the submittedAt subnode to submit an assignment
 - The submission timestamp should be the same as the
   timestamp submitted in the node
 - This timestamp should be honored whether a resultData
   is in the xml or not

Change-Id: I0dec6b326b0c3380f6a8ee19f78f34f5c943758a
Reviewed-on: https://gerrit.instructure.com/147421
Tested-by: Jenkins
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Karl Lloyd <karl@instructure.com>
2018-04-23 17:06:49 +00:00
Nate Collings 83a24b8a08 add Module and ModuleItem live events
Test plan:

- Merge and warmfix onto beta
- Configure our EventManager Kinesis stream
  to listen to the Module and ModuleItem
  live events
- Create a Module and a ModuleItem and
  validate that the events were sent
- Update a Module and a ModuleItem and
  validate that the events were sent

refs SKUNK-17, SKUNK-18

Change-Id: Ia047024b0f5d38e5c14a19194f75b131f9fc68cc
Reviewed-on: https://gerrit.instructure.com/146858
Reviewed-by: Andrew Butterfield <abutterfield@instructure.com>
Reviewed-by: Brent Burgoyne <bburgoyne@instructure.com>
Tested-by: Jenkins
Product-Review: Nate Collings <ncollings@instructure.com>
QA-Review: Nate Collings <ncollings@instructure.com>
2018-04-23 15:12:55 +00:00
Keith Garner d46aa37f5d restore scores by calculating grades when restoring enrollments
When enrollments are restored to active or inactive by updating the
workflow_state and skipping over the restore method have the
DueDateCacher update the grades when its done updating the users
submissions.

fixes GRADE-1085

test plan:
 - Enroll a student into a course with at least one assignment
 - Give the student a grade on one or more assignments
 - Delete the student from the course
 - Re-enroll the student into the course through the API
   setting the state to 'active'
 - Check the enrollments API for the course/student and see that
   students grades are reporting as not 'null'
 - Delete the student from the course
 - Re-enroll the student into the course through the API
   setting the state to 'inactive'
 - Check the enrollments API for the course/student and see that
   students grades are reporting as not 'null'

Change-Id: Ib15fe1381c0f58310cd666b90bcaa9e2bed27f6c
Reviewed-on: https://gerrit.instructure.com/147373
Tested-by: Jenkins
Reviewed-by: Adrian Packel <apackel@instructure.com>
Reviewed-by: Derek Bender <djbender@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
QA-Review: Anju Reddy <areddy@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2018-04-20 18:50:15 +00:00
Frank Murphy 72b791a739 Use vendor_guid_2 when locating outcomes using ABv3
Fixes OUT-2099

Test Plan
- Install this plugin:
  https://gerrit.instructure.com/#/admin/projects/instructure_misc_plugin
  under gems/plugins
- Run `bundle update`, `bundle install`
- Run `bundle exec rake db:migrate`
- Open a rails console, and run:

  DataFixup::AbGuidUpdater.enable_new_cols

- Create a new account
- Create a new outcome from that account.
- Using the outcomes API:

  https://canvas.instructure.com/doc/api/outcomes.html

  Update the outcomes so that its vendor_guid is a known value.
- Verify that the vendor_guid_2 field in the database is set
  to that value on the rails console:

  LearningOutcome.find(id).vendor_guid_2

- Export outcomes from the account
- Modify one of the outcomes in the CSV file
- Re-import the CSV, verify that the outcome changes in Canvas.

Change-Id: I33b8eb9375d94616c677d45194953a81ccd36a15
Reviewed-on: https://gerrit.instructure.com/145694
Reviewed-by: Michael Brewer-Davis <mbd@instructure.com>
Reviewed-by: Augusto Callejas <acallejas@instructure.com>
Tested-by: Jenkins
QA-Review: Dariusz Dzien <ddzien@instructure.com>
Product-Review: Sidharth Oberoi <soberoi@instructure.com>
2018-04-20 18:01:52 +00:00
Shahbaz Javeed 151130cf3b optionally include byte-order mark in gradebook exports
closes GRADE-821

test plan:
 1. Visit your User profile
 2. Verify a feature flag exists with the name:

    Include Byte-Order Mark in Gradebook Exports

 3. Select or create a course with:
    a. at least one Assignment
    b. at least one Student
 4. Export the Gradebook
 5. Verify the exported gradebook does not include a byte-order mark
 6. Enable the aforementioned feature flag
 7. Export the Gradebook
 8. Verify the exported gradebook includes the byte-order mark

Change-Id: Ie41eb800498d74b3a244e7d14bb8b7088fb9bff8
Reviewed-on: https://gerrit.instructure.com/145904
Tested-by: Jenkins
Reviewed-by: Keith T. Garner <kgarner@instructure.com>
Reviewed-by: Derek Bender <djbender@instructure.com>
Reviewed-by: Spencer Olson <solson@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
QA-Review: Keith T. Garner <kgarner@instructure.com>
2018-04-17 15:53:26 +00:00
Rob Orton 5c92e9333c recache_grade_distribution once per course
refs CORE-1284

test plan
 - enrollment importer should work

Change-Id: Ia05aafc37c7da3fef0c0f1f662e24f8787ea8b24
Reviewed-on: https://gerrit.instructure.com/146717
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
QA-Review: Rob Orton <rob@instructure.com>
2018-04-12 17:19:42 +00:00
Augusto Callejas 8e17fcd6c6 Allow references to outcomes in a visible context
closes OUT-2124

test plan:
  - create an account-level outcome
  - export account outcomes
  - import the exported outcomes into a course under the account
  - confirm no error occurs and the account-level outcome appears
    at the course-level

Change-Id: I1e20604c06ce2f6353378aea0d20df195cd8305b
Reviewed-on: https://gerrit.instructure.com/146190
Reviewed-by: Michael Brewer-Davis <mbd@instructure.com>
Reviewed-by: Matt Berns <mberns@instructure.com>
Tested-by: Jenkins
QA-Review: Andrew Porter <hporter-c@instructure.com>
Product-Review: Sidharth Oberoi <soberoi@instructure.com>
2018-04-11 16:48:50 +00:00
Frank Murphy 9ece42fbae spec: Ensure we can import '0' ratings.
See https://community.canvaslms.com/ideas/11312-allow-importing-0-zero-for-outcomes

Test Plan:
:qa-cr:

Change-Id: I7ac68287fa23fd449ea99967181f33c13f4403ef
Reviewed-on: https://gerrit.instructure.com/146520
Reviewed-by: Neil Gupta <ngupta@instructure.com>
QA-Review: Dariusz Dzien <ddzien@instructure.com>
Tested-by: Jenkins
Product-Review: Frank Murphy <fmurphy@instructure.com>
2018-04-10 18:17:34 +00:00
Michael Hargiss 7293ebc942 add quiz lti contract tests for live events
refs QUIZ-4175

Test Plan:
  - qa-cr for now. A subsequent commit will include a comprehensive
    test plan once the Quiz LTI contract test is published.

Change-Id: I2ffe962d8a626994614f3cc904d131e41e3a00b1
Reviewed-on: https://gerrit.instructure.com/145857
Tested-by: Jenkins
Reviewed-by: Mark Grant <mgrant@instructure.com>
Product-Review: Michael Hargiss <mhargiss@instructure.com>
QA-Review: Michael Hargiss <mhargiss@instructure.com>
2018-04-10 14:20:18 +00:00
Nathan Mills e740ca876f fix some brittle specs
fixes PLAT-3033

test plan:

* The specs should pass and be less brittle

Change-Id: Iefbe9f82259cb1aa2768ba150038d3974688ce3c
Reviewed-on: https://gerrit.instructure.com/144862
Tested-by: Jenkins
Reviewed-by: Andrew Butterfield <abutterfield@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Nathan Mills <nathanm@instructure.com>
2018-04-10 01:32:12 +00:00
Jeremy Stanley 7bfe0ac4b6 fix user_search permissions
test plan:
 - enable the "Account Course and User Search" feature
 - ensure "See other users' primary email address"
   permission is required to find by email address
 - ensure "Read SIS data" or "Manage SIS data" is
   required to find by SIS ID
 - ensure "View login ids for users" is required
   to find by login ID
 - ensure you can find users by canvas ID and name
   in the same search (where one user's name matches
   another user's ID)

also:
 - ensure students cannot use the include[]=email
   option in the "List users in course" API to
   retrieve email addresses of other students
   (unless granted "See other users' primary
   email address" permission)

fixes ADMIN-836

Change-Id: I9c0a1ba9a643632047f42dc010822b6e5035d0d4
Reviewed-on: https://gerrit.instructure.com/143915
Reviewed-by: Mysti Sadler <mysti@instructure.com>
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: Matt Goodwin <mattg@instructure.com>
Tested-by: Jenkins
2018-04-09 17:19:56 +00:00
Rob Orton 63479873a5 spec: assign account instead of creating one
Change-Id: I16828643912f8f8c4287c46e47751f477b1f1515
Reviewed-on: https://gerrit.instructure.com/146265
Tested-by: Jenkins
Reviewed-by: James Williams  <jamesw@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
QA-Review: Rob Orton <rob@instructure.com>
2018-04-09 15:20:01 +00:00
Rob Orton d9e576504a set sis feature flag to allowed
fixes CORE-1251

test plan
 - feature should show

Change-Id: I6f85ef608916281b6fb658c84ea66a050b39c5a4
Reviewed-on: https://gerrit.instructure.com/145928
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins
Product-Review: Rob Orton <rob@instructure.com>
QA-Review: Rob Orton <rob@instructure.com>
2018-04-05 20:12:30 +00:00
James Williams df8de0f03c handle many user ids in due date cacher strand name
closes #CORE-1252

Change-Id: Ia381bd2cba10a40622818d4e01365c19cd52c3bd
Reviewed-on: https://gerrit.instructure.com/146008
Reviewed-by: Shahbaz Javeed <sjaveed@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
Tested-by: Jenkins
Reviewed-by: Spencer Olson <solson@instructure.com>
QA-Review: Spencer Olson <solson@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2018-04-05 17:00:10 +00:00
Brent Burgoyne ce3379a3ac add success include param for upload preflight
refs CORE-20

test plan:
- test file upload api with success_include[]=avatar on the preflight
  request
- the final response on success should include the avatar property
- test with local storage, s3, and InstFS

Change-Id: I974197944d0f84ad0b89a628ab8604f50cdec45e
Reviewed-on: https://gerrit.instructure.com/144456
Reviewed-by: Ryan Shaw <ryan@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Tested-by: Jenkins
QA-Review: Tucker McKnight <tmcknight@instructure.com>
Product-Review: Brent Burgoyne <bburgoyne@instructure.com>
2018-04-04 19:45:50 +00:00
Jeremy Neander 63bc5bc5f9 mark missing submission as graded when deducting points
fixes GRADE-980

test plan:
 1. Select or create a Course with at least one Student
 2. Enable a missing policy
 3. Create an assignment due 12 hours ago
 4. Load the Rails console
 5. Load a submission for this Assignment
 6. Ensure the cached due date matches the assignment due date
 7. Manually update the submission

    submission.score = nil
    submission.grade = nil
    submission.workflow_state = "unsubmitted"
    submission.save!

 8. Manually run the missing policy applicator

    MissingPolicyApplicator.apply_missing_deductions

 9. Reload the submission
10. Verify the submission workflow state is "graded"

Change-Id: I1ba5b69e7f6e42c69baca61fe10d30a2db2bb0ff
Reviewed-on: https://gerrit.instructure.com/145437
Reviewed-by: Derek Bender <djbender@instructure.com>
Reviewed-by: Shahbaz Javeed <sjaveed@instructure.com>
Tested-by: Jenkins
QA-Review: Indira Pai <ipai@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2018-04-04 18:34:09 +00:00
Jeremy Stanley af5432d11c web zip export: exclude unpublished module prerequisites
test plan:
 - have a module in a course that has an unpublished module
   as a prerequisite
 - from the modules page, select "Export Course Content"
 - download and unzip the package
 - ensure the browser renders it

fixes ADMIN-913

Change-Id: Ib329bfac9f476280ed6b47ccc342b284ef0029f6
Reviewed-on: https://gerrit.instructure.com/145740
Reviewed-by: Dan Minkevitch <dan@instructure.com>
Tested-by: Jenkins
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2018-04-04 17:13:50 +00:00
Frank Murphy 5ae9ab5600 Allow outcomes CSVs with no workflow_state column.
Fixes OUT-2104

Test Plan:
- Create a CSV file (possibly from spec/lib/outcomes/fixtures)
  with no workflow_state header / column.
- Import, verify that the outcomes and groups are properly imported.

Change-Id: I2175c974085045c9b6263588ab903ab4729b4072
Reviewed-on: https://gerrit.instructure.com/145553
Tested-by: Jenkins
Reviewed-by: Michael Brewer-Davis <mbd@instructure.com>
QA-Review: Leo Abner <rabner@instructure.com>
Product-Review: Sidharth Oberoi <soberoi@instructure.com>
2018-04-04 15:42:01 +00:00
Spencer Olson 2c998a4904 fix new gradebook assignment visibility bug
closes GRADE-986

Test Plan 1: Concluded Students
1. Create a Grading Period for 2018 (Jan 1 - Dec 31).
2. Create a Grading Period for 2019 (Jan 1 - Dec 31). This should be
   the ‘last’ grading period, meaning there are no other grading
   periods after this one.
3. Create an assignment and assign it to everyone without a due date.
4. Go to New Gradebook, make sure you are NOT showing concluded
   students, and verify the assignment shows up when you select the
   2019 Grading Period.
5. Conclude one of the students that the assignment is assigned to.
6. Edit the assignment and change its due date to be in 2018 and save
   it.
7. Go to New Gradebook, make sure you are NOT showing concluded
   students, and verify the assignment does not show up when you select
   the 2019 Grading Period.
8. With the 2019 Grading Period still selected, in the Student Header
   Menu select to show concluded enrollments. Verify the assignment
   appears. Then deselect the option to show concluded enrollments and
   verfify the assignment disappears.

Test Plan 2: Inactive Students
1. Create a Grading Period for 2018 (Jan 1 - Dec 31).
2. Create a Grading Period for 2019 (Jan 1 - Dec 31). This should be
   the ‘last’ grading period, meaning there are no other grading
   periods after this one.
3. Create an assignment and assign it to a single student in 2018.
4. Deactivate the student that the assignment is assigned to.
5. Go to New Gradebook, make sure you are NOT showing inactive
   students, and verify the assignment does not show up when you select
   the 2018 Grading Period.
6. With the 2018 Grading Period still selected, in the Student Header
   Menu select to show inactive enrollments. Verify the assignment
   appears. Then deselect the option to show inactive enrollments and
   verfify the assignment disappears.

Change-Id: If463dcd5037125ea4345fcbef964460b23fa8820
Reviewed-on: https://gerrit.instructure.com/144119
Reviewed-by: Keith T. Garner <kgarner@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
QA-Review: Keith T. Garner <kgarner@instructure.com>
Tested-by: Jenkins
2018-04-03 20:42:35 +00:00
Shahbaz Javeed 17eeec079a calculate assignment-level score statistics in grade calculator
closes GRADE-990

test plan:
* Create a course with a few students and one 100 point assignment
* Grade all students with an assortment of points
* Visit the grade summary page for any student
* Verify that the assignment stats are correct:
  - minimum score
  - maximum score
  - mean score
  - number of scores

Change-Id: I1f666b607d8b4570eba8868a8de84c4aa41823c9
Reviewed-on: https://gerrit.instructure.com/144900
Reviewed-by: Keith T. Garner <kgarner@instructure.com>
Tested-by: Jenkins
Reviewed-by: Adrian Packel <apackel@instructure.com>
QA-Review: Indira Pai <ipai@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2018-04-03 17:03:28 +00:00
Frank Murphy 2233d6f347 Remove canvas_id from export, use vendor_guid on import
Fixes OUT-2052

Test Plan:
- Create an outcomes tree under an account, with nested outcomes.
- Export the account outcomes.
- Create a new course under the prior account.
- Import outcomes into that account.
- The outcome tree should be fully imported.

Change-Id: Ifbf886a65a307b4c45f9c28ca92c19f0bcb16c06
Reviewed-on: https://gerrit.instructure.com/145408
Tested-by: Jenkins
Reviewed-by: Matt Berns <mberns@instructure.com>
Reviewed-by: Augusto Callejas <acallejas@instructure.com>
Reviewed-by: Michael Brewer-Davis <mbd@instructure.com>
QA-Review: Leo Abner <rabner@instructure.com>
Product-Review: Sidharth Oberoi <soberoi@instructure.com>
2018-04-02 15:33:34 +00:00
Rob Orton a3b55cdb11 add ability to skip deletes in sis imports
closes CORE-1185

test plan
 - pass skip_deletes as true to sis imports
 - it should not delete any records
 - rake doc:api should work

Change-Id: I91bfa260bfd48d349aeb16703143cf4345fae0bb
Reviewed-on: https://gerrit.instructure.com/144438
Tested-by: Jenkins
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Reviewed-by: James Williams  <jamesw@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2018-03-29 15:07:35 +00:00
Adrian Packel e7c2cdaa15 Fix CSV export cols for weighted assignment groups
Export the proper number of "(read only)" filler values for Gradebook
CSV export when weighted assignment groups are enabled for the course.
The previous change to display unposted grades/scores did not use the
right number of filler values.

fixes GRADE-991

Test plan:
* Set up a course with some students and at least one assignment.
* Enable weighted assignment groups for the course.
* From Gradebook (old or new), export the grades as a CSV.
* Attempt to import the resulting file. Rather than receiving an error,
  you should get the usual "no changes were detected" method.
  (Alternatively, you can open the CSV in a spreadsheet or similar and
  make sure the two header rows are of the same length.)
* Mute the assignment, run the export again, and make sure the resulting
  file is valid.
* Disable weighted assignment groups, run the export again, and make sure
  the resulting file is valid.

Change-Id: Ief84340cc326c586ae155746fa0c67ee31530f42
Reviewed-on: https://gerrit.instructure.com/144649
Tested-by: Jenkins
Reviewed-by: Shahbaz Javeed <sjaveed@instructure.com>
Reviewed-by: Jeremy Neander <jneander@instructure.com>
QA-Review: Jeremy Neander <jneander@instructure.com>
Product-Review: Sidharth Oberoi <soberoi@instructure.com>
2018-03-27 16:28:40 +00:00
Frank Murphy 3fb0633a29 Reactivate dead parent links
Fixes OUT-2062

Test Plan:
- Import or create some outcomes.
- Export those outcomes.
- Delete one of those outcomes.
- Re-import the outcomes from the prior export.
- The outcomes should be visible again under their prior parent.

Change-Id: I5ea9bb19f4bd1559e0dfabf4922b17c1c6a55346
Reviewed-on: https://gerrit.instructure.com/144709
Tested-by: Jenkins
Reviewed-by: Michael Brewer-Davis <mbd@instructure.com>
Reviewed-by: Augusto Callejas <acallejas@instructure.com>
QA-Review: Leo Abner <rabner@instructure.com>
Product-Review: Sidharth Oberoi <soberoi@instructure.com>
2018-03-27 16:19:58 +00:00
Rob Orton 0bb49b6985 fix group_category importer on refactored sis
refs CORE-929

test plan
 - an import with group_categories should not fail

Change-Id: If341872e3cdb4feb39275f75862d013a793fe95e
Reviewed-on: https://gerrit.instructure.com/144878
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Tested-by: Jenkins
Reviewed-by: James Williams  <jamesw@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2018-03-27 02:30:32 +00:00
James Williams 78a47e65ad don't use browser locale for notification locale
closes #COMMS-892

Change-Id: Ifa74e58e09fd05bbedcb75a63f15031ce61aa5f3
Reviewed-on: https://gerrit.instructure.com/144778
Reviewed-by: Steven Burnett <sburnett@instructure.com>
Tested-by: Jenkins
QA-Review: Landon Gilbert-Bland <lbland@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2018-03-26 22:34:58 +00:00
Michael Brewer-Davis 3522092362 raise errors on empty outcomes import files
closes OUT-2037

Test plan:
Submit empty file for outcomes import
Verify that error says 'There was an error uploading your file'
Submit file with only whitespace
Verify that error says 'Missing required fields'
Submit file with only valid headers for outcomes import
Verify that error says 'File has no outcomes data'
Submit file with data rows
Verify that import completes as expected

Change-Id: I3a98af3c8001c79c0cf3a1bf7d477c9de898754b
Reviewed-on: https://gerrit.instructure.com/143883
Reviewed-by: Augusto Callejas <acallejas@instructure.com>
Tested-by: Jenkins
Reviewed-by: Frank Murphy <fmurphy@instructure.com>
QA-Review: Leo Abner <rabner@instructure.com>
Product-Review: Sidharth Oberoi <soberoi@instructure.com>
2018-03-26 20:44:03 +00:00
Rob Orton 84e1280d39 retry failed parallel importers
fixes CORE-1205

test plan
 - cause failure on a parallel importer
 - it should retry once

Change-Id: I0a7cdcabdc759d48249d75b4bf8803a3ee94e7fa
Reviewed-on: https://gerrit.instructure.com/144728
Tested-by: Jenkins
Reviewed-by: James Williams  <jamesw@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
QA-Review: Rob Orton <rob@instructure.com>
2018-03-24 21:00:02 +00:00
Shahbaz Javeed 2e833107c4 ensure last bucket in a grading scheme starts with 0%
closes GRADE-192

test plan:
*** Setup
* On the master branch, create two grading schemes whose last bucket
  does not start with 0%
* Delete one of these bad grading schemes in the console using
  something like:

  GradingStandard.last.destroy

*** Tests
* Run migrations
* Verify both the grading schemes in the Setup phase now have a last
  bucket which starts with 0%.  You can use something like the
  following on the Rails console:

  GradingStandard.last(2).map(&:data)

* Delete the second grading scheme you created in the Setup phase as
  well using a Rails console command like:

  GradingStandard.last(2).map(&:destroy)

* Verify destroying the grading schemes works

* Create a grading scheme using the UI
* Ensure the last bucket in the grading scheme doesn't start with 0%
* Verify the grading scheme fails to save
* Now update the last bucket to start with 0%
* Verify the grading scheme now saves successfully

Change-Id: Icab1fa638718fa666c491cdcd60e53e363dbf145
Reviewed-on: https://gerrit.instructure.com/143681
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Jeremy Neander <jneander@instructure.com>
Tested-by: Jenkins
QA-Review: Anju Reddy <areddy@instructure.com>
Product-Review: Matt Goodwin <mattg@instructure.com>
2018-03-23 15:39:33 +00:00
Michael Brewer-Davis 21d2e5c3c2 raise error on duplicate outcomes in import
closes OUT-2038

Test plan:
Create an outcome import csv that includes
duplicate vendor guids.
Import file into a context
Verify that import is successful for the first
row using a vendor guid, and fails for any
subsequent rows.

Change-Id: Ia3925b16d32e31d522431bfe07154cddf88af862
Reviewed-on: https://gerrit.instructure.com/143879
Reviewed-by: Augusto Callejas <acallejas@instructure.com>
Reviewed-by: Frank Murphy <fmurphy@instructure.com>
Tested-by: Jenkins
QA-Review: Dariusz Dzien <ddzien@instructure.com>
Product-Review: Sidharth Oberoi <soberoi@instructure.com>
2018-03-22 17:30:59 +00:00
Derek Bender 18acda2837 populate submission anonymous_ids
closes: GRADE-923

test plan:
1. run migrations
2. all submissions have anonymous IDs:

    Submission.joins(assignment: :course).
      where(anonymous_id: nil).
      merge(Course.active).
      exists? # => false

Change-Id: Ic5588841698c3a6d9e18baf6bdf023f7903801eb
Reviewed-on: https://gerrit.instructure.com/144251
Reviewed-by: Shahbaz Javeed <sjaveed@instructure.com>
Tested-by: Jenkins
Reviewed-by: Keith T. Garner <kgarner@instructure.com>
QA-Review: Indira Pai <ipai@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2018-03-22 01:13:40 +00:00
Andrew Butterfield 66844d2366 Add route scope enforcement to application controller
fixes PLAT-3176
fixes PLAT-3179
fixes PLAT-3181
fixes PLAT-3177

Test plan:
* Create a DeveloperKey
* Create an AccessToken
* Ensure that everything can be accessed as normal
* Set require_scopes to true on the DeveloperKey
* Ensure that nothing can be accessed
* Add some scopes to the AccessToken from the list of available scopes
    TokenScopes::SCOPES
* Ensure that the endpoints associated with those requests work but that
  others don't
* Ensure that HEAD requests work for GET endpoints
* Ensure all api endpoints behave normally when scopes are not turned on
  for  developer key

Change-Id: I0e7c1758ae2d51743490f243cfa21714255c8109
Reviewed-on: https://gerrit.instructure.com/143026
Tested-by: Jenkins
Reviewed-by: Simon Williams <simon@instructure.com>
Reviewed-by: Nathan Mills <nathanm@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
Product-Review: Karl Lloyd <karl@instructure.com>
2018-03-21 23:18:36 +00:00
Michael Jasper 816c4bad2d Upload attachment to inst-fs, eportfolio export
closes RECNVS-362
closes RECNVS-363

Test plan:
- with instfs configured and enabled:
  - log into canvas and navigate to the users eportfolio
  - dowload the eportfolio
  - verify that the eportfolio was
    - created successfully
    - download from the <instfs domain>/files
  - verify that the instfs logs show
    - a post of the eportfolio to instfs
    - a get of the eportfolio from instfs

Change-Id: Ia27ca9811598cea180432e730ae8d5163a720036
Reviewed-on: https://gerrit.instructure.com/143050
Tested-by: Jenkins
Reviewed-by: Jacob Fugal <jacob@instructure.com>
QA-Review: Collin Parrish <cparrish@instructure.com>
Product-Review: Michael Jasper <mjasper@instructure.com>
2018-03-21 19:45:35 +00:00
Rob Orton d8cb87252f add row number to sis_batch_errors
fixes CORE-870

test plan
 - enable sis refactor feature
 - import a file with errors
 - the errors should have a row number

Change-Id: I8d890aa94a5621cbbfbf959f4f038bd189645e55
Reviewed-on: https://gerrit.instructure.com/143872
Tested-by: Jenkins
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Reviewed-by: James Williams  <jamesw@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2018-03-21 19:19:37 +00:00
Rob Orton 8f9ef1cfd3 set sis_id on new sis groups with group_category
fixes CORE-1164

test plan
 - import a new group with a group_category
 - it should have a sis_id

Change-Id: I6028147491f597229d4524b18b3dc52f3dfe5538
Reviewed-on: https://gerrit.instructure.com/144338
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
QA-Review: Rob Orton <rob@instructure.com>
Tested-by: Jenkins
2018-03-21 17:56:22 +00:00
Simon Williams c0b7b9ffc3 upgrade to rubyzip 1.2.1
Even though this is a patch level version bump, it made a subtle change
that broke some workflows we had (see https://xkcd.com/1172/).

The second argument to Zip::File.open is a `create` flag, which
determines whether the zip file is created if it does not exist. Prior
to 1.2.1, the expectation was that `Zip::File::CREATE` was passed as the
argument if creation was desired. However, internally the library was
inconsistent about checking the passed flag against `Zip::File::CREATE`
vs just checking truthiness.

In practice, what this meant is that if you passed a different truthy
value, like `Zip::File.open(filename, 'w')` (like we did in several
places), the file would still be created if it did not exist, BUT,
critically, it would not be saved if nothing was put into the archive.

1.2.1 changed this flag to always check "truthiness", meaning empty zip
archives started to be saved. Unfortuantely, our mime type evalutation
rules don't correctly identify an empty zip file as a zip file, but
instead as just a binary file. These two things combined to create
problems.

see https://github.com/rubyzip/rubyzip/compare/v1.2.0...v1.2.1
and particularly fc23f68f77

closes CNVS-41711

test plan:
- test course copy and export/import workflows (both canvas and standard
common cartridge formats), especially in "sparse" cases where, for
example, no associated files would be copied.

Change-Id: If0033f6c0ede7f7a6e8c26031371ae2bd24cd1fb
Reviewed-on: https://gerrit.instructure.com/143744
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2018-03-21 17:09:44 +00:00
Cody Cutrer 616b2dbb47 drop rails 5.0
Change-Id: Ic374d543a7ba00f660efccb287513c5f80232196
Reviewed-on: https://gerrit.instructure.com/144178
Reviewed-by: James Williams  <jamesw@instructure.com>
Tested-by: Jenkins
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2018-03-20 19:50:23 +00:00
Adrian Packel f22eb39a72 update anonymous grading assignment/course flag
For all courses with the old "anonymous grading" feature flag set,
enable our new "anonymous marking" flag and set the assignments in the
course to be anonymously graded.

closes GRADE-922

Test plan:

Setup:
* Enable the account-level Anonymous Moderated Marking feature.
  (This is required to work with the new Anonymous Marking feature
  flag below; otherwise, enabling the flag will not "stick.")
* Set the new Anonymous Marking feature flag to be ALLOWed at the
  account level.
* Set up at least one course that has:
  * The (old) Anonymous Grading feature flag set to ON
  * The (new) Anonymous Marking feature flag set to OFF
  * At least one assignment (it should NOT have the "anonymous grading"
    checkbox set)

Running the migration:
* Run the attached migration.
* Check using the console that any course with the (old)
  anonymous_grading flag enabled now also has the (new)
  anonymous_marking flag enabled. A console query like:

  > Course.all.select { |c| c.feature_enabled?(:anonymous_grading) &&
      !c.feature_enabled?(:anonymous_marking) }

  should return an empty array. (If it *does* return any courses,
  those courses probably do not have the Anonymous Marking feature
  flag toggleable at the account level--see above.)

* Check that any course with the new feature flag enabled has the
  anonymous_grading field set to true for all its assignments.
  A console query like:

  > Course.all.select { |c| c.feature_enabled?(:anonymous_marking) &&
      c.assignments.exists?(anonymous_grading: false) }

  should return an empty array. (Recall that a previous migration
  backfilled all the nulls in the column, so all values should be true
  or false.)
* Finally, check that the migration is idempotent: undo the migration
  using db:migrate:down (undoing it will do nothing), re-run it, and
  make sure that the checks you performed above still hold.

Change-Id: I3ea988e40e1350b4edf14ee5c99a3a96352d0245
Reviewed-on: https://gerrit.instructure.com/143644
Tested-by: Jenkins
Reviewed-by: Spencer Olson <solson@instructure.com>
Reviewed-by: Derek Bender <djbender@instructure.com>
Reviewed-by: Keith T. Garner <kgarner@instructure.com>
QA-Review: Indira Pai <ipai@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2018-03-20 19:45:04 +00:00
Derek Bender faf4445bad add anonymous_id to due date cacher to upsert
Relies on base58, which is rad because you can't mistake 0 (zero) for
uppercase O (oh) and uppercase I (eye) for lowercase l (el). The other
added benefit is some systems will interpret a prefixed 0 has indicating
a different literal (e.g. hex is `0x` prefixed). This avoids the problem
by never using zero.

    log2(58)*5 = ~29.28 bits (round up to 30 bits of entropy)
    58**5 = 656,356,768 combinations

For two generations there's a 1 in 656,356,768 chance of collision.

In the case of a collision, we'll loop until an unused one is generated.
Performance for this probably gets kinda bad once the assignment is half
full. However if we have >300,000,000 submissions the app has probably
already fallen over.

closes: GRADE-893

Test Plan:
1. Given a course
2. Given a student enrolled in the course
3. When creating the first assignment (e.g. 'Alpha')
4. Then all submissions have anonymous_ids:

    anonymous_ids = Assignment.find_by!(title: 'Alpha').
      all_submissions.pluck(:anonymous_id)

5. When Alpha has it's due date changed via the assignment edit page
6. Then none of the anonymous_ids have changed:

    anonymous_ids.sort! == Assignment.find_by!(title: 'Alpha').
      all_submissions.pluck(:anonymous_id).sort!

7. Given a second assignment (e.g. 'Omega')
8. Given the manual deletion of anonymous_ids for the Omega assignment:

    omega = Assignment.find_by!(title: 'Omega')
    omega.all_submissions.update_all(anonymous_id: nil)

9. When DueDateCacher is triggered by changing the due date
10.Then all submissions in Omega now have anonymous_ids:

    omega.all_submissions.reload.pluck(:anonymous_id)

11.When validating a new submission in the console:

    submission = omega.submissions.build
    submission.validate # => false

12.Then anonymous_id is present:

    submission.anonymous_id # e.g. "aB123"

Change-Id: I874ba5b0d6025c95af2f832c3cc5d83c3cbd20e7
Reviewed-on: https://gerrit.instructure.com/143314
Tested-by: Jenkins
Reviewed-by: Keith T. Garner <kgarner@instructure.com>
QA-Review: Indira Pai <ipai@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2018-03-20 18:40:57 +00:00
Mysti Sadler e3bdcbf3b5 Fix mastery path links for submittable objects
fixes ADMIN-753

Test plan
- Set up a course with Mastery Paths and BluePrint
- Set up a child course for the BluePrint sync
- Set up a graded quiz and discussion with an item
  unlocked with Mastery Paths
- Also set up any kind of item with a wiki page
  unlocked by Mastery Paths
- Run the master course sync
- Verify the child course has the correct Mastery
  Path links
- Remove the links from the parent course
- Ensure they are removed

Change-Id: Iad8672f295b041756821fe9f4e02b33f752c0ccb
Reviewed-on: https://gerrit.instructure.com/143566
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Jenkins
QA-Review: Leo Abner <rabner@instructure.com>
Product-Review: Mysti Sadler <mysti@instructure.com>
2018-03-20 17:11:50 +00:00
Michael Brewer-Davis b2fcca7de8 add context information to outcome import error
closes OUT-1976

Test plan:
Import outcomes into an account
Import the same outcomes into a subaccount or course
  Verify that import was successful
Make changes to the outcomes in the CSV
Re-import the outcomes into the subaccount or course
  Verify that modified outcomes were not imported

Change-Id: Ib7d16cbb5b79b894dff571b6afeacc7af2c6a7b6
Reviewed-on: https://gerrit.instructure.com/143876
Tested-by: Jenkins
Reviewed-by: Augusto Callejas <acallejas@instructure.com>
Reviewed-by: Frank Murphy <fmurphy@instructure.com>
QA-Review: Andrew Porter <hporter-c@instructure.com>
Product-Review: Sidharth Oberoi <soberoi@instructure.com>
2018-03-20 15:43:47 +00:00
Jayce Higgins cfd5af230c Add import support and live event for Q.N. course copy
Closes: QUIZ-4112

Test-Plan:
  - We could set up local live events and run a course copy
    and assert that there is a live event being pushed to the kinesis
    queue
  - Then assert that the kinesis queue has the event looking correct

Change-Id: Ic98d026b2c087c2be4e0b2aefae85a374a827d2a
Reviewed-on: https://gerrit.instructure.com/143322
Tested-by: Jenkins
Reviewed-by: Hannah Bottalla <hannah@instructure.com>
QA-Review: Robin Kuss <rkuss@instructure.com>
Product-Review: Jayce Higgins <jhiggins@instructure.com>
2018-03-20 15:26:58 +00:00
Jacob Fugal 2bdca4957e consider request host when choosing oauth host
fixes RECNVS-361

instead of just using Attachment.current_root_account.domain

to facilitate the change, all generation of non-public links to external
file storage go through a FileAuthenticator instance that holds the
necessary information about the current user and oauth host

test-plan:
[locally]
- smoke test file uploads and downloads, there should be no impact on
  behavior, just a refactor
[once on beta]
- enable inst-fs in your sandbox
- logout of canvas
- open network logging in your browser dev tools and log back in to
  canvas
- identify the requests related to the inst-fs login pixel and
  corresponding oauth redirects
- the oauth should have occurred against your beta sandbox, not your
  production sandbox
- attempt to upload a file; should be successful

Change-Id: Ic859b707908baef84f5ee4dba29f18bdd841abcc
Reviewed-on: https://gerrit.instructure.com/143930
Tested-by: Jenkins
Reviewed-by: Michael Jasper <mjasper@instructure.com>
QA-Review: Collin Parrish <cparrish@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
2018-03-20 04:25:18 +00:00
Stewie (Nicholas Stewart) 5fa6bb57b9 Add copyright message to remaining .rb files
Update: Copyright years now reflect the year that the file was first
committed.

Refs: PLAT-3200

Test Plan: jenkins is still happy and specs pass!!

Change-Id: Ic26463defe41fc52cf4da8020976394c641f51d5
Reviewed-on: https://gerrit.instructure.com/143545
Tested-by: Jenkins
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Stewie aka Nicholas Stewart <nstewart@instructure.com>
2018-03-19 13:38:50 +00:00
Frank Murphy aaff60425d Use separator / delimiter from rails locale
Fixes OUT-2049

Test Plan:
- Create an outcome.
- Change the rubric on the outcome to have a large number with
  fractional points, i.e. 1,234.567
- Go to account settings.
- Change the language to French.
- Go to "Reports" ("Rapports")
- Generate the outcomes report ("Export de résultats")
- Download the resulting file.
- Change to another large number using the same format
  in the file, i.e. 2 000,42
- Re-import the downloaded file ("Acquis" > "Importer")
- Verify the outcome tier threshold has changed to the
  value you specified before.
- (optional) change your language back under "Paramètres"

Change-Id: I11b45d210b1a09cc16c6b5d6589e869fce08242e
Reviewed-on: https://gerrit.instructure.com/143505
Tested-by: Jenkins
Reviewed-by: Augusto Callejas <acallejas@instructure.com>
Reviewed-by: Michael Brewer-Davis <mbd@instructure.com>
QA-Review: Leo Abner <rabner@instructure.com>
Product-Review: Sidharth Oberoi <soberoi@instructure.com>
2018-03-16 14:20:49 +00:00
Tucker McKnight 48e0221073 Allow group category sis ids to be changed
fixes CORE-913

test plan:
- Generate documentation, make sure that the
  change_sis_id.csv parts about group_categories
  make sense.
- Upload a change_sis_id.csv and make sure you
  can change the SIS ID on a group category.

Change-Id: Id3e5813dd1cee371784d43cd9ba9dce90ef9fcd4
Reviewed-on: https://gerrit.instructure.com/139534
Reviewed-by: Rob Orton <rob@instructure.com>
Tested-by: Jenkins
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2018-03-15 16:45:29 +00:00
Cody Cutrer 5e3038b721 codify our sorting cases in a spec
refs gh-1229

also make clear how the collator is configured, vs. the defaults
also also document each of our three uses of ICU to point to each
other if you change anything in the future

Change-Id: Ib911302a96a9d9a667923793ebb2be095b62d8ab
Reviewed-on: https://gerrit.instructure.com/142772
Tested-by: Jenkins
Reviewed-by: Rob Orton <rob@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
QA-Review: Rob Orton <rob@instructure.com>
2018-03-14 21:05:57 +00:00
James Williams 5b612586cc batch add_to_favorites in sis enrollment importer
Change-Id: I632a9819150856b09115d3a3dde0c42069357689
Reviewed-on: https://gerrit.instructure.com/143454
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2018-03-14 20:07:14 +00:00
James Williams 2b0f57c560 rename user_observer/observee classes/associations
for my sanity because it's too confusing to actually refactor

closes #CORE-1140

Change-Id: I445e0edeb3fde76ffd02a467180ee7a83d916067
Reviewed-on: https://gerrit.instructure.com/143538
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2018-03-14 19:51:49 +00:00
Derek Bender e895ef4fa7 spec: reorganize spec to improve diffing
this is prework to help the code reivew diffing for GRADE-893

ref: GRADE-893

Change-Id: I1fe2622bc88b32332fac36b2ec839fda3518841f
Reviewed-on: https://gerrit.instructure.com/143574
Tested-by: Jenkins
Reviewed-by: Jeremy Neander <jneander@instructure.com>
Product-Review: Derek Bender <djbender@instructure.com>
QA-Review: Derek Bender <djbender@instructure.com>
2018-03-14 17:38:30 +00:00
Rob Orton 52ced9231d don’t delete submissions on user merge
fixes CORE-1069
refs CORE-1026

test plan
 - have 2 users with conflicting submissions
   one with grade one with submission
 - merge them
 - split them and it should be restored

Change-Id: Id645ddcc0c5182a825e513de7e7d05e6fa50f254
Reviewed-on: https://gerrit.instructure.com/142004
Reviewed-by: Keith T. Garner <kgarner@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins
QA-Review: Tucker McKnight <tmcknight@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2018-03-14 16:49:52 +00:00
wdransfield 068bdbce26 Fix flakey group spec
Test Plan:
Modified specs pass regardless of id array order

Change-Id: I2f702a4878c6d64f9966d0cbf07ddbaca32a5705
Reviewed-on: https://gerrit.instructure.com/143476
Reviewed-by: Stewie aka Nicholas Stewart <nstewart@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Tested-by: Jenkins
Product-Review: Weston Dransfield <wdransfield@instructure.com>
2018-03-14 02:13:07 +00:00
Mysti Sadler a242a38e50 Order planner queries by overridden due dates
fixes ADMIN-131

Test plan
- Set up user with several assignments with
  as many types of overrides as possible
- (User in multiple sections with different
  due dates, user with an ad-hoc override,
  overrides that don't override the due date, etc)
- Ensure the API returns the items in the correct
  order (assuming the user has a due date for the
  item)
- Check the same with ungraded quizzes
- Ensure the plannable_date is the correct date
  for the user
- Turn off Canvas Planner and check to make sure
  the to do list works correctly

Change-Id: Ie38900ac645804867823ed24b59f228cefef7f51
Reviewed-on: https://gerrit.instructure.com/142412
Tested-by: Jenkins
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Mysti Sadler <mysti@instructure.com>
2018-03-13 19:09:19 +00:00
Adrian Packel 1ede802a20 Add course-level anonymous grading flag
Add a course-level development flag to enable AMM-specific anonymous
grading (separate from the existing "anonymous grading" flag), and
ensure it is only visible if AMM has been enabled on the relevant
account.

closes GRADE-920

Test plan:
* Have an account with a course attached to it.
* Account-level testing:
  * Open the feature options page for the account.
  * Set Anonymous Moderated Marking on the account to "OFF", if it is
    not already disabled.
  * Reload the page.
  * On the same page, in the course-level settings, you should NOT see
    the "Anonymous Grading (Anonymous Moderated Marking)" flag (the one
    added here).
  * Set Anonymous Moderated Marking on the account to "ON" and reload.
  * On the same page, in the course-level settings, you SHOULD see the
    "Anonymous Grading (Anonymous Moderated Marking)" flag and be able
    to set it to ALLOW or ON.
* Course-level testing:
  * Check that the feature option on the course level behaves
    according to the value on the account level as usual (e.g.,
    ON should force-enable it for the course while ALLOW should
    make it optional).

(Note that at present, if you disable the base Anonymous Moderated
Marking feature at the account level, the new course-level setting will
not be adjusted accordingly and so could remain enabled even if AMM as a
whole is disabled. Since this is all still development-only and these
flags are not intended to go live in their current form, this isn't a
big deal.)

Change-Id: I84189ec6064403c7f109a85ca47f501c1e66b90c
Reviewed-on: https://gerrit.instructure.com/143103
Tested-by: Jenkins
Reviewed-by: Derek Bender <djbender@instructure.com>
Reviewed-by: Spencer Olson <solson@instructure.com>
QA-Review: Shahbaz Javeed <sjaveed@instructure.com>
Product-Review: Sidharth Oberoi <soberoi@instructure.com>
2018-03-13 18:20:24 +00:00
Rob Orton 3e611c87de don’t allow deleting dirty sub_accounts
fixes CORE-1128

test plan
 - it should raise an error if sub_account has
   active accounts or courses

Change-Id: I77d4a0d45adb3b7f230c9ea0f320fba2bc11f48e
Reviewed-on: https://gerrit.instructure.com/143230
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
QA-Review: Rob Orton <rob@instructure.com>
2018-03-12 21:07:05 +00:00
Rob Orton af0ae43107 don’t send every sis import error to sentry
fixes CORE-1121

test plan
 - import a user with a really long login_id
 - the error should be on the sis import
 - sentry should not get an error

Change-Id: Ie38b8f3e1faa80308f63904c34e67690aac5f66e
Reviewed-on: https://gerrit.instructure.com/143205
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
QA-Review: Rob Orton <rob@instructure.com>
2018-03-12 21:06:42 +00:00
Rob Orton c9126cfa9b allow importing mac zip files
fixes CORE-1133

test plan
 - import a mac zip file
 - it should not fail

Change-Id: I84f5c4e0634f35084f9a8eb36a8be9102f71a94d
Reviewed-on: https://gerrit.instructure.com/143263
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Tucker McKnight <tmcknight@instructure.com>
Tested-by: Rob Orton <rob@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2018-03-12 17:03:59 +00:00
Frank Murphy e99ef6e856 i18n tweaks for outcome import
Fixes OUT-2010

Test Plan
- Save an .xlsx version of demo.csv:

  $ open spec/lib/outcomes/fixtures

  A finder window will open. Right click "demo.csv", and select
  "Open With..." > "Excel"

  Then "Save As" and specify the format as ".xslx". Remember
  where you saved this file. I recommend you save it to
  "Downloads"

- Change your system language to Norwegian:
  - on OSX, go to "Language & Region" in System Preferences
  - click the '+' below "Preferred Languages"
  - Choose "Norsk bokmål"
  - Click "Add"
  - When it asks if you want to use it as a primary language,
    click "Use Norwegian Bokmål"
  - Keep the preferences window open so you can switch back.
  - Click the back button on the top left.
  - Don't restart your system when prompted.
  - Don't close the settings window, it should still remain in
    English so you can switch back at the end.

- **Google Translate is now your best friend.**

- Make sure that Excel is not running.
- Open your previously saved file.
- The excel window should have all menu options in Norwegian.
- Choose Fil > Lagre Sum... to save as
- Click the arrow next to "Arkiver som" to select a file path.
- Choose the "Nedlastinger" (Downloads) directory, and set the
  name under "Arkiver som" to "norwegian"
- Under "Filformat", select "Kommadelte verdier (.csv)"
- Save by clicking "Arkiver"
- Quit excel. You will see a dialog that says:
  "Vil du lagre endringene i dokumentet norwegian.csv?"
  Click:
  "Ikke lagre"
- Change your system language back to English (optional, don't
  switch back for hard-mode test plan):
  - Go back to "Language & Region" in System Preferences
  - Click "Norsk bokmål"
  - Click the minus button.
- Check that the file in "Downloads" is semicolon-separated.
- Attempt to import "norwegian.csv" in "Downloads" via the
  canvas UI.
- It should work!

Change-Id: I0ed4b6d7547b605712278a08dadbd6f41b86376b
Reviewed-on: https://gerrit.instructure.com/143007
Tested-by: Jenkins
Reviewed-by: Augusto Callejas <acallejas@instructure.com>
Reviewed-by: Neil Gupta <ngupta@instructure.com>
QA-Review: Leo Abner <rabner@instructure.com>
Product-Review: Sidharth Oberoi <soberoi@instructure.com>
2018-03-12 15:43:13 +00:00
Andrew Huff c15f938cb7 canvas upload via url
closes RECNVS-329

test plan: (joint with g/142642)

Change-Id: I32df18bdc91451e67bb83fbcc68b3f0629444ad6
Reviewed-on: https://gerrit.instructure.com/142732
Reviewed-by: Jacob Fugal <jacob@instructure.com>
QA-Review: Collin Parrish <cparrish@instructure.com>
Tested-by: Jenkins
Product-Review: Jacob Fugal <jacob@instructure.com>
2018-03-11 19:37:47 +00:00
James Williams fabc0839fb add optional common cartridge html file to page converter
test plan:
* as a site admin, enable the hidden root account
 feature flag "Common Cartridge HTML File
 to Page Conversion"
* import the "Home-Term" package referenced in the ticket
* it should try to bring over the html files
 in the package as pages (e.g. "Overview")

closes #CNVS-41424

Change-Id: If808cd126a8eab1211f8b3f2a4a288d2785ec3ec
Reviewed-on: https://gerrit.instructure.com/142021
Tested-by: Jenkins
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Reviewed-by: Mysti Sadler <mysti@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2018-03-09 21:29:33 +00:00
Michael Brewer-Davis 54e84ea19e allow updating outcomes via csv
closes OUT-1555

Test plan:
Basic behavior:
- follow instructions in g/140107 to
  do basic import of outcomes into a context
- make changes to the csv file:
  - change titles/descriptions/ratings/etc.
  - change parents of groups and of outcomes
- re-run the import command with the updated
  csv file
- verify that changes can be seen in the
  console or in the canvas UI

Subcontext behavior:
- check LearningOutcome.count and LearningOutcomeGroup.count
  in the rails console
- import the csv into a subaccount or course
  under the account used above
- verify that the outcomes and groups are
  imported
- verify that outcomes are re-used and groups
  are re-created by viewing LearningOutcome.count and
  LearningOutcomeGroup.count again; the former should be
  unchanged and the latter increased by the # of groups
  in the csv file

Export/Import behavior:
- generate a csv file using Account Settings/Reports/Outcome Export
- make changes to the csv file, including updating
  vendor_guids for outcomes/groups in the file
- import the csv and verify that changes are
  made using the UI and console (you can check vendor_guid
  changes by looking at LearningOutcome.find($canvas_id)

Error behavior
- Attempt to import the exported csv into the
  subcontext account or course from the second set
  of steps, verifying
  - groups cannot be imported or updated, with error that
    group was found in a different context
  - properties of outcomes cannot be updated, with error
    that fields for outcome from another context cannot
    be updated
  - non-existent canvas ids lead to errors

Change-Id: Iceca02ec5157a4d187a2b9fd11b3415c84613ffa
Reviewed-on: https://gerrit.instructure.com/141836
Tested-by: Jenkins
Reviewed-by: Neil Gupta <ngupta@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
Reviewed-by: Augusto Callejas <acallejas@instructure.com>
QA-Review: Leo Abner <rabner@instructure.com>
Product-Review: Sidharth Oberoi <soberoi@instructure.com>
2018-03-09 20:17:43 +00:00
James Williams c186393f10 don't include quizzes locked by date in epub export
test plan:
* have a quiz set to be locked until a future date
* a student should not be able to see the quiz
 content in a epub export

closes #ADMIN-842

Change-Id: I323bc3df36b8078e88331a08a85abb7914c92efb
Reviewed-on: https://gerrit.instructure.com/142958
Tested-by: Jenkins
Reviewed-by: Mysti Sadler <mysti@instructure.com>
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2018-03-09 17:11:48 +00:00
Jacob Fugal 14d54e7eb3 export attachments to instfs
closes RECNVS-43

This datafixup finds attachments which do not have an instfs_uuid,
creates `references` for them, posts them to instfs /references
endpoint. The endpoint imports them into instfs and returns an array
of the references with their new uuids. The attachments are updated
to include the uuids from instfs

Test plan
- turn on s3 storage for files in canvas
- with inst-fs off in canvas (deactivate the plugin), upload a file
- Enable the inst-fs plugin
- in the rails console, run
  `DataFixup::ExportAttachmentsToInstfs.run(Account.find(1))`
  (or whatever your account id is)
- verify using instfs /debug/attachments/ls route that the attachment
  was posted
  to instfs
- verify using the rails console that the attachment has an instfs_uuid

Change-Id: I26720c2324b7302a3a843f04932785518ac699e7
Reviewed-on: https://gerrit.instructure.com/142572
Tested-by: Jenkins
Reviewed-by: Jacob Fugal <jacob@instructure.com>
QA-Review: Collin Parrish <cparrish@instructure.com>
Product-Review: Michael Jasper <mjasper@instructure.com>
Reviewed-by: Michael Jasper <mjasper@instructure.com>
2018-03-07 19:38:50 +00:00
Shahbaz Javeed 9f7ee5f6b3 prevent disabling new gradebook if any sub-account/course uses it
closes GRADE-767

test plan:
* Create a sub-account 2 levels deep
* Create a course for this sub-account

* Go to the root account and look for the "New Gradebook" feature flag
* Verify visually that you're allowed to turn the flag off

* Enable the "New Gradebook" feature flag on the course
* Go to the root account and look for the "New Gradebook" feature flag
* Verify visually that you're no longer allowed to turn the flag off

* Disable the "New Gradebook" feature flag on the course
* Enable the "New Gradebook" feature flag on the sub-account
* Go to the root account and look for the "New Gradebook" feature flag
* Verify visually that you're no longer allowed to turn the flag off

* Disable the "New Gradebook" feature flag on the sub-account
* Go to the root account and look for the "New Gradebook" feature flag
* Verify visually that you're allowed to turn the flag off

Change-Id: Ifc7444ff114d8fb3b297ea20f5e2891a450497c5
Reviewed-on: https://gerrit.instructure.com/142011
Tested-by: Jenkins
Reviewed-by: Keith T. Garner <kgarner@instructure.com>
Reviewed-by: Jeremy Neander <jneander@instructure.com>
QA-Review: Adrian Packel <apackel@instructure.com>
Product-Review: Pert Eilers <peilers@instructure.com>
2018-03-07 17:30:49 +00:00
Jacob Fugal 171ef86f81 set Attachment.current_root_account during jobs
and rename that suite of methods to make more sense

test-plan: N/A

Change-Id: Iffc520ea55141ac47da669663838a4d3c3d8712c
Reviewed-on: https://gerrit.instructure.com/142486
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
QA-Review: Jacob Fugal <jacob@instructure.com>
2018-03-07 17:18:24 +00:00
Keith Garner 92cb5afafc fix assignment override calcs to ignore deleted student overrides
This patchset fixes the assignment override applicator and effective
due dates to only consider active AssignmentOverrideStudent
definitions. Without this fix, if a deleted AssignmentOverrideStudent
appeared first in the database based on id order, its potentially out
of date information would be used.

fixes GRADE-916

test plan:
 - Have a class with a student
 - Create and save an assignment.
 - Edit the assignment to add an override for the student and remove
   the everyone else due date.  Save the assignment.
 - Note the due date shows up on the student grades page
 - Edit the assignment to remove the student due date and add an
 everyone else due date.  Save the assignment.
 - Note the due date shows up on the student grades page
 - Edit the assignment to add an override for the student and remove
   the everyone else due date.  Save the assignment.
 - Note the due date shows up on the student grades page

Change-Id: I4ff90a7843fe1de0f391642b0a8b4ae09be72432
Reviewed-on: https://gerrit.instructure.com/142342
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Reviewed-by: Adrian Packel <apackel@instructure.com>
Reviewed-by: Shahbaz Javeed <sjaveed@instructure.com>
Tested-by: Jenkins
QA-Review: Indira Pai <ipai@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2018-03-06 22:22:30 +00:00
Jacob Fugal e60143748d user real user when available in instfs JWTs
refs RECNVS-264

but still pass the @current_user for access and upload JWTs, so that it
can go in a separate claim if its different

test-plan:
- smoke test an inst-fs upload. should still work

Change-Id: I4be9cd4049c83848e69aae37500ae9f4b96392b4
Reviewed-on: https://gerrit.instructure.com/142334
Tested-by: Jenkins
Reviewed-by: Michael Jasper <mjasper@instructure.com>
QA-Review: Jonathan Featherstone <jfeatherstone@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
2018-03-06 20:44:27 +00:00
Michael Jasper f92b17b174 Directly upload to inst-fs from canvas
closes RECNVS-324

test plan
- use the `InstFS.direct_upload` method to upload files to canvas through the
  the rails console
  - an example of a rails console command is documented in the method
  - verify that uploads from canvas are available in inst-fs

Change-Id: I20e5d2544a0853fd913ebcba5229e9977825f482
Reviewed-on: https://gerrit.instructure.com/142411
Tested-by: Jenkins
QA-Review: Collin Parrish <cparrish@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
2018-03-06 18:02:10 +00:00
Frank Murphy 052c7480e6 Outcomes import job runner with status and errors
Fixes OUT-1997

Test Plan:
- On an account with no outcomes,
- In the rails console, run the following:
  Attachment.skip_3rd_party_submits(true)
  a = Attachment.new
  a.context = Account.first
  path = 'spec/lib/outcomes/fixtures/demo.csv'
  a.uploaded_data = File.open(path,'rb')
  a.display_name = 'qa-test-outcomes-import'
  a.save!
  i = OutcomeImport.create!(
    context: Account.first,
    workflow_state: :created,
    attachment: a
  )
  i.run
- You should see a bunch of sql commands. Now run:
  i.reload
  i.progress # should be 100
  i.workflow_state # should be "succeeded"

Change-Id: I90a2e7808fcf1baf662832e5955a41c3b36e3add
Reviewed-on: https://gerrit.instructure.com/142220
Reviewed-by: Neil Gupta <ngupta@instructure.com>
Tested-by: Jenkins
Product-Review: Neil Gupta <ngupta@instructure.com>
QA-Review: Neil Gupta <ngupta@instructure.com>
2018-03-06 16:30:48 +00:00
James Williams 2142fa4fff master courses: copy assignment group rules selectively
should still copy rules correctly even if the referenced
 assignments are not included in the copy

test plan:
* create a blueprint course
* have an assignment group with assignments and
 a dropping rule that excludes one of the
 assignments
* sync to an associated course
* change the rule on the group
* re-sync
* it should still exclude the correct assignments
 in the associated course group

closes #ADMIN-801

Change-Id: I60e2a691426364ca0b93a1f67b29d1ab05d18e8a
Reviewed-on: https://gerrit.instructure.com/141655
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Jenkins
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2018-03-05 16:23:41 +00:00
Rob Orton 093b2c94b8 allow empty strings to be ignored for sis import
fixes CORE-1073

test plan
 - should ignore empty strings for optional fields

Change-Id: I0e2dc3b6f4ef90eed963eb3a9fac94475e55c708
Reviewed-on: https://gerrit.instructure.com/142352
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins
Product-Review: Rob Orton <rob@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
2018-03-02 18:04:05 +00:00
Rob Orton 3ab3f1b5b3 only recompute grades for users on sis import
refs GRADE-927

test plan
 - enrollment imports should work

Change-Id: Ib70c137d8bf53bea48cbd5fbf3732f5ab07253a9
Reviewed-on: https://gerrit.instructure.com/142309
Tested-by: Jenkins
Reviewed-by: Shahbaz Javeed <sjaveed@instructure.com>
Reviewed-by: Spencer Olson <solson@instructure.com>
QA-Review: Tucker McKnight <tmcknight@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2018-03-01 20:15:30 +00:00
James Williams c496ed62e9 use parallel importers to do stuff in smaller jobs
and overall maybe suck a little less

test plan:
* enable the feature "SIS Import Refactor"
* lower the threshold to use multiple parallel jobs
 via "/plugins/sis_import" to a number like 2
* regression tests for sis batch imports

closes #CORE-927 #CORE-928

Change-Id: I91b0bb0cc0e0957cae7897af453ed2d19555303d
Reviewed-on: https://gerrit.instructure.com/140535
Tested-by: Jenkins
Reviewed-by: Rob Orton <rob@instructure.com>
QA-Review: Tucker McKnight <tmcknight@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2018-03-01 20:05:33 +00:00
wdransfield edb63589e9 Add com.instructure.Course.groupIds varaible expansion
Closes PLAT-3106

Test Plan:
- Create several groups in a course.
- Install a tool that uses the new $com.instructure.Course.groupIds
  variable expansion.
- Launch the tool from the coures nave and verify the
  param value is a list of Canvas ids for each group in the course.
- Launch the tool from an assignment and verify the same thing.
- Verify groups that are soft deleted are not included.

Change-Id: I36cc73525361c54505c5f0d4c4df57a549c97718
Reviewed-on: https://gerrit.instructure.com/140804
Tested-by: Jenkins
Reviewed-by: Andrew Butterfield <abutterfield@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Jesse Poulos <jpoulos@instructure.com>
2018-03-01 17:45:35 +00:00
Andrew Butterfield 857c7b137f Don't include deleted roles in lti launch data
fixes PLAT-3156

Test plan:
* Follow the steps to reproduce the issue
* Ensure that the issue cannot be reproduced

Change-Id: I351a785c519c7f8fc396fdc58347ad94b59be997
Reviewed-on: https://gerrit.instructure.com/142211
Tested-by: Jenkins
Reviewed-by: Marc Alan Phillips <mphillips@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Andrew Butterfield <abutterfield@instructure.com>
2018-03-01 16:46:23 +00:00
James Williams 35995509bb soft-delete access_tokens and notification_endpoints
refs #COMMS-867

Change-Id: Ib28258633a539bf44c8d2575877ac182dfe24598
Reviewed-on: https://gerrit.instructure.com/141493
Tested-by: Jenkins
Reviewed-by: Steven Burnett <sburnett@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2018-03-01 14:13:25 +00:00
Michael Jasper a891136f20 Add host claim to inst-fs JWT
refs RECNVS-313

test-plan:
- with inst-fs enabled, do the following:
  - login, upload a file, access a file
- in each case the JWT serialized in the url should contain a
  `host` claim which is the oauth host (domain of the root account)

Change-Id: I05e833407bfd6a3d6cb0dcb95d42d446e314d224
Reviewed-on: https://gerrit.instructure.com/141584
Tested-by: Jenkins
Reviewed-by: Jacob Fugal <jacob@instructure.com>
QA-Review: Collin Parrish <cparrish@instructure.com>
Product-Review: Michael Jasper <mjasper@instructure.com>
2018-02-28 17:32:59 +00:00
Frank Murphy 8ee874ef3a Friendly error messages on outcomes CSV import
Fixes OUT-1885

Test Plan:
- Find your canvas account id.
- Create an invalid CSV import file by copying:

  spec/lib/outcomes/fixtures/demo.csv

  to, for example, error.csv. Delete one of the outcome groups in this
  file, which will invalidate the `parent_guid` references to it.

- Run (if you have sharding enabled, add `switch_to_shard ... ; ` before
  the Outcomes::CsvImporter command):
  dc run --rm web bundle exec rails r \
    "puts Outcomes::CsvImporter.new('error.csv', Account.find_by(id: $ID)).run"
- Verify that an error for the missing parent reference has been
  generated.

Change-Id: I252c97281121aee597464a4417a6e0657fba03a8
Reviewed-on: https://gerrit.instructure.com/141670
Tested-by: Jenkins
Reviewed-by: Augusto Callejas <acallejas@instructure.com>
QA-Review: Andrew Porter <hporter-c@instructure.com>
Product-Review: Sidharth Oberoi <soberoi@instructure.com>
2018-02-27 21:55:37 +00:00
Cody Cutrer 8b47dfcd8f transpose cross-shard links in api_user_content
fixes CORE-763

test plan:
 * set up two accounts, on different shards, and a user associated with both
 * create a course on shard 2 and create a wiki page for the front page.
 * create a module in that course
 * as the content of the front page, embed an image from the course, and
   link to the module
 * using the domain of shard 1, go to /api/v1/courses/<id of shard 2>~<id the course>/front_page
 * inspect the links in the returned body element. they should be using the
   first account's domain, but should contain (short) global ids. there should
   4 - the 'regular' URL for the image and the link, and a data-api-endpoint for each.
 * exercise all 4 URLs. the HTML ones should redirect to account 2's domain,
   and the API URLs should return a result directly

Change-Id: I10aa0fc1dc003a781d04ec5b230ede6aeba64fb9
Reviewed-on: https://gerrit.instructure.com/141664
Reviewed-by: Rob Orton <rob@instructure.com>
Tested-by: Jenkins
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2018-02-27 16:57:45 +00:00
Nate Collings cbd207736b add read_only to custom_gradebook_columns
Test Plan:

1 - Run the migrations and validate that the
    `read_only` column exists on the
    `custom_gradebook_columns` table, with a default
    of false
2 - Create a new CustomGradebookColumn through the API
    and validate that it accepts and persists the
    `read_only` parameter. Example curls:

   Create the column:

   curl -H "Authorization: Bearer <token>" \
     http://localhost:3000/api/v1/courses/:id/custom_gradebook_columns \
     -X POST \
     -F "title=ReadOnly" \
     -F "read_only=true"

   Validate the columns:

   curl -H "Authorization: Bearer <token>" \
     http://localhost:3000/api/v1/courses/:id/custom_gradebook_columns/

3 - Open the gradebook for a course and validate that you cannot
    edit the `read_only` columns in both the old and new
    gradebooks. (Tabbing should still work as normal.)

4 - Go to the Individual View. Under Global Settings, check Show Notes
    in Student Info. Under Content Selection, select a student.
    Confirm that you can only edit the custom columns that were
    not created as read_only.

refs PFS-9913, PFS-9914, PFS-10003

Change-Id: I18005cc0eaf19202c00a5d79c2a04421b5d12a5c
Reviewed-on: https://gerrit.instructure.com/139625
Reviewed-by: Keith T. Garner <kgarner@instructure.com>
Reviewed-by: Jeremy Neander <jneander@instructure.com>
Tested-by: Jenkins
Product-Review: Ian Morris <ianm@instructure.com>
QA-Review: Aiona Hernandez <ahernandez@instructure.com>
2018-02-26 19:59:46 +00:00
Rob Orton 1bd47da265 limit communication_channels to root_account
refs CORE-778

test plan
 - search for a user
 - it should work faster

Change-Id: I4f7010ff40ac2329215cc24c1a0af347ec359f74
Reviewed-on: https://gerrit.instructure.com/141602
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins
QA-Review: Tucker McKnight <tmcknight@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2018-02-22 22:02:34 +00:00
Rob Orton bb468b268c return sis_users when matching canvas_id in search
fixes CORE-778

test plan
 - search for a user with sis_id that matches a
   canvas_id
 - it should return both users

Change-Id: I3495decec057e57357d6104b0f935086a22f380b
Reviewed-on: https://gerrit.instructure.com/141599
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Tucker McKnight <tmcknight@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2018-02-22 21:50:46 +00:00
Shahbaz Javeed 11f764f833 fix stale grades when re-assigning students to assignment
closes GRADE-819

The specific case was to unassign a graded student from an assignment by
removing "Everyone" and adding all students except one to the
assignment.  Then remove all students and assign "Everyone" to the
assignment.  This should make the previously unassigned student's grades
stale.

test plan:
* Configure delayed jobs to use 6 simultaneously running workers
  by editing config/delayed_jobs.yml to look like this:

  default:
    workers:
    - queue: canvas_queue
      workers: 6

  Notice the line that says "workers: 6"
* Restart the jobs container so all six new workers are started
* Create a published course with one assignment worth 150 points
  and two students enrolled
* For the remainder of these steps, let's assume unique identifer
  for the course is "course_id" and the unique identifier for
  the student is "student_id"
* Go to the Gradebook and grade the first student at 125 points
  and wait for their score to be updated in the gradebook.
* Verify the score in the Gradebook is 83.33%
* In a separate tab, visit the following URL, making sure to
  replace course_id with the actual course id and student_id
  with the actual student id:

  /api/v1/courses/course_id/enrollments?user_id=student_id

* Verify that you see the student's current_score as 83.33
* Repeat the following steps multiple times to ensure the
  problem does not manifest itself:

  - Modify the assignment: unassign it from the first student
    and only assign it to the second student only
  - Go to the gradebook and verify the cells for the first student
    are not editable any more
  - Go back to the API URL above and verify the student's
    current_score now says null

  - Modify the assignment: re-assign it to "Everyone"
  - Go to the gradebook and verify the cells for the first student
    are now editable again
  - Go back to the API URL above and verify the student's
    current_score now says 83.33 again.  If it ever says null
    at this point, there is a problem.

Change-Id: Ifaaf0609dfe5081697c1939db1b4a4e0a3e05bad
Reviewed-on: https://gerrit.instructure.com/141049
Reviewed-by: Keith T. Garner <kgarner@instructure.com>
Reviewed-by: Derek Bender <djbender@instructure.com>
Tested-by: Jenkins
Product-Review: Keith T. Garner <kgarner@instructure.com>
QA-Review: Keith T. Garner <kgarner@instructure.com>
2018-02-22 16:04:24 +00:00
Rob Orton d5bb5cb12e update bounce count when email changes
fixes CORE-1031

test plan
 - have invalid email with bounce count
 - update email through sis and it should have a
   bounce count of 0

Change-Id: If756f77cca6120bb140d393f6b5da4a9c9a5257b
Reviewed-on: https://gerrit.instructure.com/141579
Tested-by: Jenkins
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Tucker McKnight <tmcknight@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2018-02-21 23:47:46 +00:00
Augusto Callejas 4b5654711d Propagate outcome edits to unassessed rubrics
closes OUT-1566

When outcomes are imported into rubrics, then any updates
to an outcome's name, description and ratings will be
reflected in unassessed, updateable (referenced by no more
than one assignment) rubrics, specifically in the rubric
criteria containing the outcome.

test plan (unassessed/updateable):
  - create an account outcome
  - create an account rubric, using the outcome as
    a single criterion
  - edit the outcome, including name, description
    ratings and total points possible (confirm that
    a warning dialog appears before editing)
  - confirm that the changes are reflected in the
    account rubric's criterion (check criteria name,
    ratings, and total points)
  - create an assignment, and use the account rubric
    as its rubric
  - edit the outcome, including name, description
    ratings and total points possible (confirm that
    a warning dialog appears before editing)
  - confirm that the changes are reflected in the
    account rubric's criterion and the assignment's rubric
    (check criteria name, ratings, and total points)
  - create another assignment, and use the account rubric
    as its rubric
  - edit the outcome, including name, description
    ratings and total points possible (confirm that
    a warning dialog DOES NOT appear before editing)
  - confirm that the changes are NOT reflected in the
    account rubric's criterion and both the assignment
    rubrics

test plan (assessed):
  - create a new account rubric using the default criterion
  - create a new assignment and use the account rubric
    as its rubric
  - as a student, submit to the assignment
  - as a teacher, score the assignment, including the rubric
  - add the account outcome to this new account rubric
  - edit the outcome, including name, description
    ratings and total points possible (confirm that
    a warning dialog DOES NOT appear before editing)
  - confirm that the changes are NOT reflected in the
    account rubric's criterion and the assignment's rubric

Change-Id: Ie5064269689071a450fa503fb68c73f5beb16710
Reviewed-on: https://gerrit.instructure.com/127991
Reviewed-by: Michael Brewer-Davis <mbd@instructure.com>
Tested-by: Jenkins
Reviewed-by: Frank Murphy <fmurphy@instructure.com>
QA-Review: Andrew Porter <hporter-c@instructure.com>
QA-Review: Leo Abner <rabner@instructure.com>
Product-Review: Sidharth Oberoi <soberoi@instructure.com>
2018-02-21 21:59:05 +00:00
Jacob Fugal edcef8d4a8 logout of instfs during explicit canvas logout
fixes RECNVS-248

test-plan:
  [happy path]
  - have instfs configured and enabled
  - login to canvas
  - logout of canvas (do not expect instfs cookie to be removed)
  - attempt to access <instfs>/session/ensure; should get oauth
    redirected to canvas login despite existing cookie
  - login to canvas anew
  - attempt to access <instfs>/session/ensure; should get 204 response

  [no instfs path]
  - have instfs disabled
  - logout of canvas; should not get a page error or other unexpected
    behavior

  [broken instfs path]
  - have instfs configured and enabled in canvas, but service down
  - logout of canvas; should not get a page error or other unexpected
    behavior, but should still see an error report for the failure to
    logout of instfs

Change-Id: Ibb4c846cfe48151df3dab04bf8fde39c2738ee4a
Reviewed-on: https://gerrit.instructure.com/141372
Tested-by: Jenkins
Reviewed-by: Andrew Huff <ahuff@instructure.com>
QA-Review: Collin Parrish <cparrish@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
2018-02-21 21:11:57 +00:00
Jeremy Stanley 118c552002 allow unicode characters submission zip files
test plan:
 - have an assignment that accepts file uploads
 - have a student with non-ASCII characters in the name
   (e.g., accented or Japanese, etc.)
 - submit as the student
 - as the teacher, on the assignment page right sidebar,
   download submissions (ensure jobs are running)
 - the non-ASCII characters should not be filtered out
   of the student's name in the filename

notes:
 - spaces and commas and hyphens, etc., will still
   be filtered out of names; this was done for
   other reasons and has not changed. the difference
   is we use [[:word:]] instead of \w, which includes
   word-like Unicode general categories and not just
   alphanumerics
 - windows explorer prior to windows 8 does not
   properly support unicode filenames in zip files.
   there's not much we can do about this, other than to
   suggest using a third-party zip program that does.
   (ASCII filenames are still handled correctly)
 - the student's name is not included if anonymous grading
   is turned on

fixes ADMIN-770

Change-Id: I1cb06a4277ee330e02dabab1d7d7cae01d80822a
Reviewed-on: https://gerrit.instructure.com/140996
Reviewed-by: Ed Schiebel <eschiebel@instructure.com>
Reviewed-by: Jon Willesen <jonw+gerrit@instructure.com>
Tested-by: Jenkins
QA-Review: Jon Willesen <jonw+gerrit@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2018-02-21 16:08:36 +00:00
Omar Khan 353b6e90d4 Add Assignment#duplicate_of relation
This commit updates Assignment#duplicate to store a reference to the
original assignment on the duplicated assignment. Both the original
assignment and the new assignment's lti_resource_link_id are included
in the `assignment_created` live event emitted when the new assignment
is saved.

This allows LTI tools listening for Canvas live events to identify when
an assignment has been duplicated, and duplicate their own data
accordingly.

Closes QUIZ-3749

Test plan:

- Set up live events and tail the kinesis stream as per the instructions
  in doc/live_events.md
- Create an LTI assignment
- An `assignment_created` live event containing this assignment's
  lti_resource_link_id should appear in the kinesis log. Make a note of
  this lti_resource_link_id
- Duplicate this assignment by clicking the "kebab" menu and clicking
  "Duplicate"
- Check that another `assignment_created` live event appears in the
  kinesis log, containing both the original assignment's
  lti_resource_link_id and the new assignment's lti_resource_link_id

Change-Id: I64bdb9a2132e58c4e7be0ab7687c2c819a3587fd
Reviewed-on: https://gerrit.instructure.com/140877
Tested-by: Jenkins
QA-Review: Michael Hargiss <mhargiss@instructure.com>
Reviewed-by: Jeff Belser <jbelser@instructure.com>
Product-Review: Michael Hargiss <mhargiss@instructure.com>
2018-02-20 22:55:00 +00:00
Keith Garner 5dcaebaea9 Revert "Return variable name when Expansion is empty"
This reverts commit d7643ad2dd.

Change-Id: I828dd9ede27537eb523ccedda0e4c9ace8ca7c87
Reviewed-on: https://gerrit.instructure.com/141315
Tested-by: Jenkins
Reviewed-by: Nathan Mills <nathanm@instructure.com>
Product-Review: Nathan Mills <nathanm@instructure.com>
QA-Review: Nathan Mills <nathanm@instructure.com>
2018-02-17 03:44:45 +00:00
Ryan Shaw d23922a367 Handle named colors like ‘red’ in theme editor
Closes: CORE-947

Test plan:
be logged in as an admin
Click 'admin' on the left nav and select the account
Click 'Themes'
Click '+ Theme'
Select 'Default Template'
Change the 'Main Text Color' to a color name (red, blue, green, hotpink) 
  and not a hex value
Click 'Preview Your Changes'
Click 'Save Theme'
Name the theme
Click 'Save Theme'
Click 'Apply Theme'
Click 'OK'
Click 'Courses'
unpublished course titles should not be white

Change-Id: I50e8fce0c9cc3e7a3ac7edd07f061b09df1f4dc1
Reviewed-on: https://gerrit.instructure.com/141092
Tested-by: Jenkins
Reviewed-by: Clay Diffrient <cdiffrient@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Ryan Shaw <ryan@instructure.com>
2018-02-16 23:26:02 +00:00
Frank Murphy 113a6b4a11 Basic bulk outcome import
Fixes OUT-1887

Test Plan:
- Find your canvas account id.
- Run (if you have sharding enabled, add `switch_to_shard ... ; ` before
  the Outcomes::CsvImporter command):
  dc run --rm web bundle exec rails r \
    "Outcomes::CsvImporter.new('spec/lib/outcomes/fixtures/demo.csv', Account.find_by(id: $ID)).run"
- Open account outcomes in canvas, verify they look ok.

Change-Id: I3631866d5b0a89df2b494f67edb6c63585699c75
Reviewed-on: https://gerrit.instructure.com/140107
Tested-by: Jenkins
Reviewed-by: Neil Gupta <ngupta@instructure.com>
Reviewed-by: Michael Brewer-Davis <mbd@instructure.com>
QA-Review: Andrew Porter <hporter-c@instructure.com>
Product-Review: Sidharth Oberoi <soberoi@instructure.com>
2018-02-14 23:07:18 +00:00
Cody Cutrer cf6b0ae363 wrap data redis from cache in RedisWrapper
fixes CORE-1008

test plan:
 * configure redis.yml to point to cache_store
 * log in via CAS
 * it shouldn't go into a redirect loop

Change-Id: I8dd278d3d1ba75f0a4c9336bc5b9603f09f4ca53
Reviewed-on: https://gerrit.instructure.com/140913
Reviewed-by: Rob Orton <rob@instructure.com>
Tested-by: Jenkins
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2018-02-14 17:17:06 +00:00
wdransfield bc20165672 Update membership expansion documentation
Refs CNVS-41279

Test Plan:
Verify the new documentation is clear that
Canvas.xuser.allRoles does not scope roles
to the launch context.

Verify that the Canvas.membership.roles
expansion now has a default name
(not required to address this issue,
just more convenient for the TP).

Change-Id: I182b2dbd51e47063b959c4568f9d1880d044d7ae
Reviewed-on: https://gerrit.instructure.com/140784
Reviewed-by: Andrew Butterfield <abutterfield@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Tested-by: Jenkins
Product-Review: Jesse Poulos <jpoulos@instructure.com>
2018-02-13 21:45:55 +00:00
Rob Orton fd880aa693 re-run populate_root_account_on_group_category job
fixes CORE-1004

test plan
 - run data fixup/migrations
 - it should run even when context is invalid

Change-Id: I7ef38554d145a5f4e462f48d55f4284485e0c50d
Reviewed-on: https://gerrit.instructure.com/140758
Tested-by: Jenkins
Reviewed-by: James Williams  <jamesw@instructure.com>
QA-Review: Tucker McKnight <tmcknight@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2018-02-13 20:49:30 +00:00
James Williams 6313d034de don't overwrite sortable_name with full_name in sis import
test plan:
* import a user csv with full_name and sortable_name specified
* the user's sortable_name should be brought in from
 the sortable_name column

closes #CORE-1006

Change-Id: Iad06a8a269c69bbf8c6df8ea91a2a1faafa5c0f6
Reviewed-on: https://gerrit.instructure.com/140776
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Tucker McKnight <tmcknight@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2018-02-13 19:58:50 +00:00
Spencer Olson 6b0910ae6b change delayed job behavior when grading period is updated
If a grading period or grading period group is updated, we were
previously creating a delayed-job-per-course for grade recalculation
and a delayed-job-per-course for DueDateCacher recalculation, with no
limit on how many of those jobs could be run in parallel.

Now, we create a delayed-job-per-1000-courses for grade recalculation,
and a delayed-job-per-1000-courses for DueDateCacher recalculation, and
the number of jobs that can be run in parallel are limited with an
n_strand.

closes GRADE-805

Test Plan:
1. Verify cached due dates and scores (grading period and overall) are
   recalulated when:

   a) Creating, updating, and deleting a Grading Period Set.
   b) Creating, updating, and deleting a Grading Period.

2. When creating/updating a Grading Period or a Grading Period Group
   such that a score + due date recalculation occurs, verify:

   a) Enrollment term delayed jobs
      (EnrollmentTerm#recompute_scores_for_batch) are being stranded by
      GradingPeriodGroup, and a job is being created for each 1000
      courses that need to be operated on in that term.
   b) Score recalculation delayed jobs are not being triggered (because
      the score recalculation is happening in the delayed job triggered
      in step a above).
   c) Due date recalculation delayed jobs are not being triggered
      (because the due date recalculation is happening in the delayed
      job triggered in step a above).

Change-Id: I99610d0559a449ad08b9209646490f7fa1cdf33b
Reviewed-on: https://gerrit.instructure.com/138508
Reviewed-by: Shahbaz Javeed <sjaveed@instructure.com>
Tested-by: Jenkins
Reviewed-by: Derek Bender <djbender@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
QA-Review: Keith T. Garner <kgarner@instructure.com>
2018-02-12 23:25:59 +00:00
Keith Garner 05cd8ee0cf add ability for due_date_cacher to work on a single user
This patchset adds the ability to run the DueDateCacher on a single
user in a course. This also updates the callback in Enrollment to call due

closes GRADE-832

test plan:
 - Have a course with a student and an assignment
 - In the rails console, add a new student to the course.
 - Confirm via the logs that only a single user id was worked on for
   the DueDateCacher
 - Soft delete one of the students in the course
 - Confirm via the logs that only that students Submissions were
   deleted
 - Confirm via the rails console that the still active students
   Submissions are not deleted

Change-Id: If4a9a7d7cfa78a455013fe23152e1479f38840e2
Reviewed-on: https://gerrit.instructure.com/139943
Reviewed-by: Derek Bender <djbender@instructure.com>
Reviewed-by: Jeremy Neander <jneander@instructure.com>
Tested-by: Jenkins
QA-Review: Anju Reddy <areddy@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2018-02-09 21:32:26 +00:00
wdransfield 9dfbb56af1 Add group id variable substitution
Closes PLAT-3036

Test Plan:
- Create an assignment that uses a plagiarism tool and is a group
  assignment. The tool should use both new variable expansions.
- Verify all originality report launches show the correct
  group id and name for the current user.

Change-Id: Id2908ff649e4e931f6a76992871ebebe7558d88b
Reviewed-on: https://gerrit.instructure.com/139504
Tested-by: Jenkins
Reviewed-by: Marc Alan Phillips <mphillips@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Weston Dransfield <wdransfield@instructure.com>
2018-02-09 20:20:24 +00:00
Shahbaz Javeed a18991b819 Store points and points_possible for all Scores
closes GRADE-8

test plan:
Store points and points_possible for all Scores

closes GRADE-8

test plan:
** Setup
* Create a course in a term with two grading periods GP1 and GP2
* Weight the grading periods as: GP1: 30%, GP2: 70%
* Create four assignment groups AG1, AG2, AG3 and AG4
  - Ensure the assignment groups have a rule to drop the 1 lowest
    score
* Weight the assignment groups as: AG1: 15%, AG2: 20%, AG3: 25%, AG4: 40%
* Create three assignments in AG1, AG1-1, AG1-2, AG1-3
  - Ensure they're all due in GP1
  - Ensure they have the following points possible:
    AG1-1: 5, AG1-2: 10, AG1-3: 15
  - Mute AG1-1
* Create three assignments in AG2, AG2-1, AG2-2, AG2-3
  - Ensure they're all due in GP1
  - Ensure they have the following points possible:
    AG2-1: 5, AG2-2: 10, AG2-3: 15
  - Mute AG2-2
* Create three assignments in AG3, AG3-1, AG3-2, AG3-3
  - Ensure they're all due in GP2
  - Ensure they have the following points possible:
    AG3-1: 5, AG3-2: 10, AG3-3: 15
  - Mute AG3-3
* Create three assignments in AG4, AG4-1, AG4-2, AG4-3
  - Ensure they're all due in GP2
  - Ensure they have the following points possible:
    AG4-1: 5, AG4-2: 10, AG4-3: 15
  - Mute AG4-1

* Enroll one student in this course
* Go to the Gradebook and ensure you're viewing all grading periods
* Assign the following grades to the student:
  AG1-1: 3
  AG1-2: 8
  AG1-3: 5

  AG2-1: 4
  AG2-2: 6
  AG2-3: 10

  AG3-1: 2
  AG3-2: 9
  AG3-3: 14

  AG4-1: 1
  AG4-2: 7
  AG4-3: 12

** Validating Assignment Group Scores
* Assuming your newly created course's id is course_id, run the
  following command from the Rails console:

  Score.where(enrollment: Course.find(course_id).enrollments).
    where.not(assignment_group_id: nil).order(assignment_group_id: :asc).
    pluck(:current_points)

* Verify that this returns [8.0, 4.0, 9.0, 12.0]
* Run the following command from the Rails console:

  Score.where(enrollment: Course.find(course_id).enrollments).
    where.not(assignment_group_id: nil).order(assignment_group_id: :asc).
    pluck(:final_points)

* Verify that this returns [8.0, 10.0, 9.0, 12.0]
* Run the following command from the Rails console:

  Score.where(enrollment: Course.find(course_id).enrollments).
    where.not(assignment_group_id: nil).order(assignment_group_id: :asc).
    pluck(:unposted_current_points)

* Verify that this returns [11.0, 14.0, 23.0, 19.0]
* Run the following command from the Rails console:

  Score.where(enrollment: Course.find(course_id).enrollments).
    where.not(assignment_group_id: nil).order(assignment_group_id: :asc).
    pluck(:unposted_final_points)

* Verify that this returns [11.0, 14.0, 23.0, 19.0]

** Validating Grading Period Scores
* Run the following command from the Rails console:

  Score.where(enrollment: Course.find(course_id).enrollments).
    where.not(grading_period_id: nil).order(grading_period_id: :asc).
    pluck(:current_points)

* Verify that this returns [80.0, 83.85]
* Run the following command from the Rails console:

  Score.where(enrollment: Course.find(course_id).enrollments).
    where.not(grading_period_id: nil).order(grading_period_id: :asc).
    pluck(:final_points)

* Verify that this returns [45.71, 50.77]
* Run the following command from the Rails console:

  Score.where(enrollment: Course.find(course_id).enrollments).
    where.not(grading_period_id: nil).order(grading_period_id: :asc).
    pluck(:unposted_current_points)

* Verify that this returns [71.43, 82.15]
* Run the following command from the Rails console:

  Score.where(enrollment: Course.find(course_id).enrollments).
    where.not(grading_period_id: nil).order(grading_period_id: :asc).
    pluck(:unposted_final_points)

* Verify that this returns [71.43, 82.15]

** Validating Total Scores
* Run the following command from the Rails console:

  Score.where(enrollment: Course.find(course_id).enrollments).
    where(course_score: true).pluck(:current_points)

* Verify that this returns [82.7]
* Run the following command from the Rails console:

  Score.where(enrollment: Course.find(course_id).enrollments).
    where(course_score: true).pluck(:final_points)

* Verify that this returns [49.25]
* Run the following command from the Rails console:

  Score.where(enrollment: Course.find(course_id).enrollments).
    where(course_score: true).pluck(:unposted_current_points)

* Verify that this returns [82.7]
* Run the following command from the Rails console:

  Score.where(enrollment: Course.find(course_id).enrollments).
    where(course_score: true).pluck(:unposted_final_points)

* Verify that this returns [49.25]

Change-Id: I6a107f09bc43d6e82eab4e3476313380f3e5d819
Reviewed-on: https://gerrit.instructure.com/137257
Reviewed-by: Derek Bender <djbender@instructure.com>
Reviewed-by: Jeremy Neander <jneander@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Keith T. Garner <kgarner@instructure.com>
Tested-by: Jenkins
QA-Review: Indira Pai <ipai@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2018-02-07 18:32:11 +00:00
Spencer Olson c892a8f19b fix gradebook exporter csv offset issues
Fixes two offset issues with the Gradebook Export CSV. One was caused
when a course had muted assignments, and one was caused when a course
had a Grading Scheme enabled.

closes GRADE-752

Test Plan 1: Muted Assignments
* Prequisites: Have a course in a trust account, with at least one
  assignment. Sign in as a user that has permission to manage SIS.

1. Mute the assignment.
2. Export the gradebook.
3. Notice that the "Muted" value shows below the muted assignment's
   name, and not below the "Section" column.

Test Plan 2: Course Grading Scheme
1. Go to the course settings page (courses/:course_id/settings). Check
   the checkbox next to 'Enable course grading scheme' and select a
   grading scheme. Click 'Update Course Details' at the bottom of the
   page.
2. Export the gradebook.
3. Notice that all total fields have the text '(read only)' under them.

Change-Id: I7178cf0202d8fb2279006ebdea63436436a47c88
Reviewed-on: https://gerrit.instructure.com/138262
Tested-by: Jenkins
Reviewed-by: Derek Bender <djbender@instructure.com>
Reviewed-by: Jeremy Neander <jneander@instructure.com>
Reviewed-by: Shahbaz Javeed <sjaveed@instructure.com>
QA-Review: Adrian Packel <apackel@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2018-02-06 22:31:37 +00:00
Rob Orton 377d4f0ceb validate dates on assignment model
fixes CNVS-41165

test plan
 - should allow updating due date to invalid lock
   range if lock range is also updated

Change-Id: I928918be6079e431ac38d471a68ed86a6991201d
Reviewed-on: https://gerrit.instructure.com/139788
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Landon Gilbert-Bland <lbland@instructure.com>
QA-Review: Venk Natarajan <vnatarajan@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2018-02-06 16:57:48 +00:00
Cody Cutrer 09fd728969 allow aliases for locale names coming from browsers
fixes gh-1167

and set them up for the chinese variants

test plan:
 * change your browser language to Chinese (Traditional)
 * ensure your account and user don't override the language
   (both set to System Default)
 * inspect your web request, make sure the accept-language includes
   zh-TW
 * you should see Canvas in traditional chinese, not simplified
   chinese

Change-Id: Id09e9b348c18195809b96138d081c246c080fa29
Reviewed-on: https://gerrit.instructure.com/133838
Reviewed-by: Brent Burgoyne <bburgoyne@instructure.com>
Tested-by: Jenkins
QA-Review: Tucker McKnight <tmcknight@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2018-02-05 19:52:03 +00:00
Nathan Mills 62a1931e8f allow dev_keys to be created at a sub account
fixes PLAT-3018

test plan:

- create a developer key at a sub account
- use it to get an access token for a user
- use the access token to access resources in the sub account, i.e
a course via the api
+ it should allow you to get access resources in the sub account
- use it to access a user via the api
+ it shouldn't allow you to access a user
- use it to access a resource in a different sub account
+ it shouldn't allow you to access resources in other sub accounts

Change-Id: Ie6e18399770e2dd3590be2c8407cdd5c3a230e69
Reviewed-on: https://gerrit.instructure.com/139268
Tested-by: Jenkins
Reviewed-by: Andrew Butterfield <abutterfield@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Nathan Mills <nathanm@instructure.com>
2018-01-30 16:46:18 +00:00
Derek Bender 47e5d7803c spec: fixup specs for gradebook exporter
closes: GRADE-817

Change-Id: Ieda85a61e6cc852f05365cfbda63bd9578f1fbdb
Reviewed-on: https://gerrit.instructure.com/139386
Reviewed-by: Jeremy Neander <jneander@instructure.com>
Reviewed-by: Spencer Olson <solson@instructure.com>
Tested-by: Jenkins
Product-Review: Derek Bender <djbender@instructure.com>
QA-Review: Derek Bender <djbender@instructure.com>
2018-01-29 21:25:42 +00:00
Adrian Packel 7d2a89fbbb add unposted scores to gradebook import/export
Include unposted scores and grades for assignment groups as well as
current/final scores in the Gradebook CSV export.

closes GRADE-762

Test plan:
- Set up a course with some students and one or more assignment groups.
- Add some assignments and record some grades. Mute at least one of the
  assignments.
- Export the grades from the course. Check that the resulting CSV file
  includes columns for unposted scores for each assignment group you
  exported and that they correctly reflect the values for unposted
  scores.
- Also check that the CSV includes corresponding unposted columns for
  each summary column (current score, final score, and so on) and that
  each new column's value takes into account the scores of unposted
  assignments.
- Finally, import the CSV file you just exported and make sure there
  are no errors due to the addition of the new columns (as with the
  rest of the summary columns, they should be ignored by the importer).

Change-Id: I3bbbe6b5ad93816d929fa72b48a6006271825ed4
Reviewed-on: https://gerrit.instructure.com/138047
Reviewed-by: Spencer Olson <solson@instructure.com>
Tested-by: Jenkins
Reviewed-by: Jeremy Neander <jneander@instructure.com>
Reviewed-by: Derek Bender <djbender@instructure.com>
QA-Review: Indira Pai <ipai@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2018-01-29 18:20:24 +00:00