Commit Graph

1183 Commits

Author SHA1 Message Date
James Williams 45147e0911 bypass the wiki model as much as possible for wiki_pages
Change-Id: I60ec3b519219fcb5256a132c05f63538600df73f
Reviewed-on: https://gerrit.instructure.com/121760
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2017-08-09 16:09:06 +00:00
wdransfield 3ee5623ce6 Add DeveloperKey/vendor code association for LTI2
refs PLAT-2708

Test Plan:
- Create a developer key through the Canvas UI and
  verify that a new vendor code text input is
  available and optional.
- Verify each of the following:
  * If a vendor is associated with a devloper key they
    must use one of the associated developer keys
    when registering.
  * If a vendor is associated with a developer key
    they may not register without using a
    developer key.
  * If a vendor is associated with a developer key
    they may not use a developer key other than
    one they are associated with to register.
  * If a vendor is not associated with a developer key
    they must register without a developer key.

Change-Id: I9c9974706f542c1442988634790656da1c407cb8
Reviewed-on: https://gerrit.instructure.com/118592
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Nathan Mills <nathanm@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Tested-by: Jenkins
Product-Review: Jesse Poulos <jpoulos@instructure.com>
2017-08-07 16:32:48 +00:00
Rob Orton e63627c74c add workflow_state to account_users
fixes CNVS-38231

test plan
 - delete an admin
 - admin should be gone from every where
 - admin should not have permissions to do stuff

Change-Id: I56c90a12b2be879c5d646c1ab6980693ff161673
Reviewed-on: https://gerrit.instructure.com/119220
Reviewed-by: Tyler Pickett <tpickett@instructure.com>
Tested-by: Rob Orton <rob@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2017-08-01 18:31:37 +00:00
Rob Orton db4c5724d8 write all errors and warnings to file
fixes CNVS-38309

when the batch is saved it will write the messages to file, but
if it has more work to do, it will skip future messages for the
error file.

test plan
 - run an import that has errors and warnings
 - it should report all of them to the file

Change-Id: I2891651febdf2b16270ea62d623e143c30e59cbc
Reviewed-on: https://gerrit.instructure.com/120651
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
QA-Review: Rob Orton <rob@instructure.com>
2017-07-28 22:09:16 +00:00
Cody Cutrer 2e6ffb7218 use native rails methods for gist indexes
Change-Id: Ia082ab3e55ff91d9488ec165735c69f490ee3560
Reviewed-on: https://gerrit.instructure.com/106114
Tested-by: Jenkins
Reviewed-by: Simon Williams <simon@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2017-07-27 22:22:30 +00:00
Simon Williams c5ba9dd6bd drop messages.asset_context_code, unused
closes CNVS-38367

test plan: send a message, it should work

Change-Id: Ic1b99120ee0c93155a4a4475f4d1dfb3d373be37
Reviewed-on: https://gerrit.instructure.com/120424
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Matt Smith <msmith@instructure.com>
Tested-by: Jenkins
Product-Review: Simon Williams <simon@instructure.com>
QA-Review: Simon Williams <simon@instructure.com>
2017-07-27 15:05:53 +00:00
James Williams a354602ea8 rails 5.1: bunch of other specs
Change-Id: Ic6e4f64874021639f5e8950e2fe42f714ae31250
Reviewed-on: https://gerrit.instructure.com/120225
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2017-07-27 12:35:30 +00:00
Simon Williams 4f1f2131e2 clean up invalid communication channels more nuanced
we had some communication channels that were valid except for leading or
trailing whitespace, making them invalid.  we try to keep these around
and make them valid email addresses.

closes CNVS-38303

test plan:
- create valid and invalid communication channels, including one that is
valid except for leading whitespace
- run migrations
- invalid channels should be cleaned up

Change-Id: I848ef57deb3549b2ec56cd16b7471c35b3e4eb70
Reviewed-on: https://gerrit.instructure.com/119802
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins
Product-Review: Simon Williams <simon@instructure.com>
QA-Review: Simon Williams <simon@instructure.com>
2017-07-25 17:39:33 +00:00
James Williams 711f54fc97 add context_id and context_type to wiki pages
and populate it; shouldn't do anything yet but
next release we can switch over to direct associations

refs #CNVS-38247

Change-Id: I23e0983d5be61d45db8087738f658b63dc0aeb48
Reviewed-on: https://gerrit.instructure.com/119253
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2017-07-20 19:03:45 +00:00
James Williams 237c6143d9 improve delete_extra_placeholder_submissions job load
Change-Id: I8661dac6ef472e564f18483c79973c911720f8f9
Reviewed-on: https://gerrit.instructure.com/119439
Tested-by: Jenkins
Reviewed-by: Keith T. Garner <kgarner@instructure.com>
Reviewed-by: Neil Gupta <ngupta@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2017-07-18 16:33:19 +00:00
Shahbaz Javeed f3ccde01a1 fix migration issues when running db:initial_setup
closes CNVS-38243

test plan:
* In your environment, run the following rake commands:

  bundle exec rake db:drop db:create
  bundle exec rake db:initial_setup

* Verify that the db:initial_setup command successfully completes
  all migrations and begins to ask your site administrator
  account details

Change-Id: I8e814cc5e7e10ac0e6686aed2e3f8eba065c1f5e
Reviewed-on: https://gerrit.instructure.com/119244
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Keith T. Garner <kgarner@instructure.com>
QA-Review: Matt Taylor <mtaylor@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2017-07-17 16:23:55 +00:00
Shahbaz Javeed c2cacc5b23 recreate the pg_collkey based indexes to use collation level 3
closes CNVS-38143

this commit aligns the collation schemes for postgres, ruby and
javascript to the same level.  this means that when sorting an
array of strings in any of the three environments, the result
will be identical.

this also stops relying on default collation strengths in ruby
and postgres and explicitly specifies the default collation
strengths to avoid surprises later.

test plan:
* Verify migrations pass with multiple shards
* Verify migrations rollback properly individually

Change-Id: I6023b364c260c35b85a8d6364ccc346e2ef7d159
Reviewed-on: https://gerrit.instructure.com/118675
Tested-by: Jenkins
Reviewed-by: Derek Bender <djbender@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
QA-Review: Keith T. Garner <kgarner@instructure.com>
2017-07-14 21:30:46 +00:00
Simon Williams 84473984f1 Revert "run delete invalid ccs datafix"
This reverts commit 0a1711b618.

When investigating this further, I discovered that this will delete
email addresses like " blah@example.com", with a space at the beginning
or end of an otherwise valid email address.  I think it's possible that
the system treats these as valid otherwise, and I'd like to investigate
a little more

test plan: n/a (migration should not run)

Change-Id: Ia95e14c9066dab7544eecc54569ad08468cfcd81
Reviewed-on: https://gerrit.instructure.com/118991
Reviewed-by: Matthew Wheeler <mwheeler@instructure.com>
Tested-by: Jenkins
Reviewed-by: Tyler Pickett <tpickett@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
QA-Review: Rob Orton <rob@instructure.com>
2017-07-13 23:26:22 +00:00
Keith Garner 6acd178169 skip grade history audit log datafix if there is no cassandra
test plan:
 - Successfully run migrations on a system without cassandra

Change-Id: I8ae203596d75ab4de9027cbf366bf855bbc0b8d4
Reviewed-on: https://gerrit.instructure.com/118711
Reviewed-by: Gary Mei <gmei@instructure.com>
Reviewed-by: Jeremy Neander <jneander@instructure.com>
QA-Review: David Tan <dtan@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
Tested-by: Jenkins
2017-07-12 18:36:38 +00:00
Keith Garner d441418d7e add more search capabilities to audit endpoint
This adds more search capabilities to the audit endpoint to give
maximum flexibility to support the new gradebook history page. This
adds the ability to search for course AND any combination of the
following: assignment, grader, student. Permissions were not touched
in this patchset, so only admins can access currently.

closes CNVS-37299

test plan:
 - Create a course with two teachers, two assignments, and two
   student.
 - Grade the students for the assignments and change the grades a few
   times as each teacher
 - Visit the following API endpoints with appropriate ids confirming
   that appropriate data is returned:
    o /api/v1/audit/grade_change/courses/:course_id/assignments/:assignment_id
    o /api/v1/audit/grade_change/courses/:course_id/assignments/:assignment_id/graders/:grader_id
    o /api/v1/audit/grade_change/courses/:course_id/assignments/:assignment_id/graders/:grader_id/students/:student_id
    o /api/v1/audit/grade_change/courses/:course_id/assignments/:assignment_id/students/:student_id
    o /api/v1/audit/grade_change/courses/:course_id/graders/:grader_id
    o /api/v1/audit/grade_change/courses/:course_id/graders/:grader_id/students/:student_id
    o /api/v1/audit/grade_change/courses/:course_id/students/:student_id

Change-Id: I86648896d49d7228ddce04864e80221da9b5f96d
Reviewed-on: https://gerrit.instructure.com/114146
Reviewed-by: Shahbaz Javeed <sjaveed@instructure.com>
Tested-by: Jenkins
Reviewed-by: Derek Bender <djbender@instructure.com>
QA-Review: Anju Reddy <areddy@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2017-07-12 17:16:03 +00:00
wdransfield fa6f460722 Allow tool proxies with equal profiles access to services
Closes PLAT-2710

Test Plan:
- Install a plagiarism detection tool, associate it with an
  assignment, and create a submission.
- Delete the tool
- Install the tool again in the same context.
- Using the tool proxy guid and secret from the second tool,
  request an access token
- Verify you can request the submission for the assignment in
  step one and create an originality report for it.
- Verify this is also true for other lti2 services (
  subscription api, originality report api, etc).

Change-Id: I006b4a88b105e808dcf0fbbbc8087a83aabe5731
Reviewed-on: https://gerrit.instructure.com/117700
Tested-by: Jenkins
QA-Review: August Thornton <august@instructure.com>
Reviewed-by: Nathan Mills <nathanm@instructure.com>
Product-Review: Weston Dransfield <wdransfield@instructure.com>
2017-07-10 21:49:48 +00:00
Mysti Sadler 770605d852 Add dismissed attribute to planner override API
refs FALCOR-453

Test plan
- Ensure that planner overrides can have dismissed
- attributes added both during update and create
- Ensure the dismissed attribute shows up in the
- planner items api
- Ensure the dismissed attribute shows up in the
- missing submissions api, if you include overrides

Change-Id: I28faa856b65ecf6b931761c89eb6ac337848e25c
Reviewed-on: https://gerrit.instructure.com/117965
Reviewed-by: Dan Minkevitch <dan@instructure.com>
Tested-by: Jenkins
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: Mysti Sadler <mysti@instructure.com>
2017-07-10 20:00:15 +00:00
Spencer Olson 0f3f341e72 add seconds_late_override to submissions table
Remove accepted_at and add seconds_late_override to the submissions
table.

closes CNVS-37893

Test Plan:
1. Verify running the migrations in this commit removes accepted_at
   and adds seconds_late_override to the submissions table.
2. Verify rolling back the migrations in this commit adds accepted_at
   and removes seconds_late_override from the submissions table.
3. Run the migration before following the next steps.
4. In a rails console, find a submission and set its late_policy_status
   to nil.

     s = Submission.find(<submission id>)
     s.update!(late_policy_status: nil)

5. Verify you cannot set seconds_late_override.

     s.update!(seconds_late_override: 60)
     s.seconds_late_override # => nil

6. Set the late_policy_status to "late" and verify you can set the
   seconds_late_override. Also verify the seconds_late method now
   returns the overridden value.

     s.update!(late_policy_status: "late", seconds_late_override: 60)
     s.seconds_late_override # => 60
     s.seconds_late # => 60
     s.update!(seconds_late_override: 20)
     s.seconds_late_override # => 20
     s.seconds_late # => 20

7. Set the late_policy_status to something other than "late" and verify
   the seconds_late_override is set to nil.

     s.update!(late_policy_status: "missing")
     s.seconds_late_override # nil

8. As a teacher, hit the submissions update API endpoint
   (PUT "/api/v1/courses/#{course.id}/assignments/#{assignment.id}/
         submissions/#{student.id}.json")

   and pass:

   submission: {
     late_policy_status: 'late',
     seconds_late_override: 60
   }

   a. Make sure the json response includes a late_policy_status of
      "late" and a seconds_late of 60.
   b. Load the submission in rails console and make sure its
      late_policy_status is set to "late" and its seconds_late_override
      is set to 60.

9. As a teacher, hit the submissions update API endpoint
   (PUT "/api/v1/courses/#{course.id}/assignments/#{assignment.id}/
         submissions/#{student.id}.json")

   and pass:

   submission: {
     late_policy_status: 'missing',
     seconds_late_override: 60
   }

   a. Make sure the json response includes a late_policy_status of
      "missing" and a seconds_late of 0.
   b. Load the submission in rails console and make sure its
      late_policy_status is set to "missing" and its
      seconds_late_override is set to nil.

Change-Id: I9a8070445482b7029454cdfbbcc266aaab5a3e4b
Reviewed-on: https://gerrit.instructure.com/117476
Tested-by: Jenkins
Reviewed-by: Matt Taylor <mtaylor@instructure.com>
Reviewed-by: Jeremy Neander <jneander@instructure.com>
Reviewed-by: Shahbaz Javeed <sjaveed@instructure.com>
QA-Review: Anju Reddy <areddy@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2017-07-07 20:57:18 +00:00
Rob Orton f5292eb60d allow a change threshold to be set for sis imports
fixes CNVS-37751

test plan
 - set change_threshold to 10
 - upload an empty file or one that is more than
   10% different from the diffing master
 - it should not delete all items, or not use
   diffing
 - run rake doc:api and verify documentation

Change-Id: Ifced7e4b76b747b37a7c0b0d5dd065da4a8d68dc
Reviewed-on: https://gerrit.instructure.com/116886
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2017-06-29 17:16:57 +00:00
Neil Gupta 33a0f62210 don't create placeholder submissions for unassigned students
Fixes CNVS-37395

Test plan:
* Create a course with 2 students
* Create an assignment with a due date for everyone
* Create a differentiated assignment with a due date for only 1 student
* In rails console:
  * Run `DueDateCacher.for_course(course_id)
  * Make sure `Submission.count` is 3
  * Make sure the first assignment has 2 placeholder submissions
  * Make sure the second assignment only has one placeholder submission

Change-Id: I5c8084d4fb0138f65e4c117dcc97638cf8d4f49d
Reviewed-on: https://gerrit.instructure.com/114573
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Shahbaz Javeed <sjaveed@instructure.com>
Product-Review: Neil Gupta <ngupta@instructure.com>
QA-Review: Neil Gupta <ngupta@instructure.com>
2017-06-27 20:33:35 +00:00
Cody Cutrer 75c7538888 drop rails 4.2
also, allow rails 5.1

Change-Id: If480c2a2c01a7578552dc70f4bdcf3a46df40e7b
Reviewed-on: https://gerrit.instructure.com/115654
Tested-by: Jenkins
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Reviewed-by: Tyler Pickett <tpickett@instructure.com>
2017-06-27 15:29:51 +00:00
Rob Orton ff1589f408 log all sis errors and warnings to a file
refs CNVS-37717

test plan
 - run sis import that would generate errors
 - in console it should have an errors_attachment
 - the attachment should contain all the errors

Change-Id: I8e76d29395047b1ee743e42394432baea27d7c3a
Reviewed-on: https://gerrit.instructure.com/116522
Tested-by: Jenkins
Reviewed-by: Tyler Pickett <tpickett@instructure.com>
QA-Review: Tucker McKnight <tmcknight@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2017-06-23 18:59:17 +00:00
Andrew Butterfield e318f907a8 Tool Profile export
fixes PLAT-2595

Test plan:
* Install an LTI 2 tool in a course
* Export the course
* Ensure that a json representation of the tool profile is in the
  resulting export file
* Repeat this process but this time add a url to the registration_url
  field that was added to the Lti::ToolProxy model in this commit
* Ensure that the resulting export includes the registration url

Change-Id: I6d0a4a1d5dce42a48e895601343070d26e9de078
Reviewed-on: https://gerrit.instructure.com/114987
QA-Review: August Thornton <august@instructure.com>
Tested-by: Jenkins
Reviewed-by: Nathan Mills <nathanm@instructure.com>
Product-Review: Andrew Butterfield <abutterfield@instructure.com>
2017-06-20 16:47:33 +00:00
Mysti Sadler e3bde5f77f Change planner overrides controller to match planner items
refs FALCOR-333

Test plan
- Create a planner override with the plannable_type as
- 'assignment' or 'discussion_topic' etc and ensure it creates
- Ensure visible has been replaced everwhere with marked_complete

Change-Id: Id56ceeb36e45a732f3afa5968da1fadc7724f86f
Reviewed-on: https://gerrit.instructure.com/115007
Reviewed-by: Dan Minkevitch <dan@instructure.com>
Tested-by: Jenkins
QA-Review: Dan Sasaki <dsasaki@instructure.com>
Product-Review: Dan Minkevitch <dan@instructure.com>
2017-06-17 00:11:22 +00:00
Rob Orton 3b570a4efc add blue print course permissions
fixes MC-260

test plan
 - run migrations
 - if you could manage courses you should have the new permission

Change-Id: If1f200f443696592eecc27f99c52ffedf82a8b5e
Reviewed-on: https://gerrit.instructure.com/115416
Tested-by: Jenkins
Reviewed-by: James Williams  <jamesw@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
2017-06-14 17:27:54 +00:00
Simon Williams 0a1711b618 run delete invalid ccs datafix
whoops, forgot to actually queue it in a migration in
2370468fb0

refs CNVS-36145

test plan:
- same as previous commit, but should be run by migrations

Change-Id: I8d2f2ac69f485d74dca14961b10af6ccc9d371b8
Reviewed-on: https://gerrit.instructure.com/113593
Tested-by: Jenkins
Reviewed-by: Rob Orton <rob@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
QA-Review: Simon Williams <simon@instructure.com>
2017-06-13 18:13:06 +00:00
Cody Cutrer da142e77e4 add missing FK index
Change-Id: I8f3a87d732d3c49dda5c72cb6054885107e55562
Reviewed-on: https://gerrit.instructure.com/115281
Reviewed-by: Rob Orton <rob@instructure.com>
Tested-by: Jenkins
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2017-06-13 17:56:07 +00:00
wdransfield f7af9cb397 Support lti launches in originality report
closes PLAT-2020

Test Plan:
0. Install an LTI 2 tool and associate it with an
   assignment. As a student create a submission
   for the assignment.
1. Create an originality report via the api. Specify
   the `tool_setting[resource_type_code]` param
   with a value set to the `resoure_type` code of
   a valid resource handler for your tool proxy.
   The resource handler should have at least one
   message handler. The message handler type
   should be 'basic-lti-launch-request'
2. Verify the OriginalityReport created has
   a `link_id` set to the resource link id
   of a new Lti::ToolSetting.
3. From each of the following locations click the
   originality report colored bubble and
   verify your tool launches to the message
   in the resource handler specified in step 1:
   - submission details modal from gradebook page
   - submission details page
   - student grades page
   - speed grader
4. Update the originality report via api and
   repeat steps 2 and 3.

Change-Id: Ie40ea9e3423b8f8198dd3fdc3f5f4da76800998f
Reviewed-on: https://gerrit.instructure.com/113516
Reviewed-by: Brad Humphrey <brad@instructure.com>
Tested-by: Jenkins
QA-Review: August Thornton <august@instructure.com>
Product-Review: Weston Dransfield <wdransfield@instructure.com>
2017-06-07 21:03:44 +00:00
Rob Orton c8a9022624 create attachment purgatory
closes CNVS-36308

test plan
  a = Attachment.find(id)
  a.destroy_content_and_replace
  # a should have new content
  p = Purgatory.take
  a.resurrect_from_purgatory
  # the content should be restored
  p.reload #workflow_state should be ‘restored’

Change-Id: I560e8ca31c22d894322d7951562371730a8abdfc
Reviewed-on: https://gerrit.instructure.com/108530
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Tucker McKnight <tmcknight@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2017-06-01 21:01:49 +00:00
wdransfield 5e7b6707f7 Lookup message handler by resource link id
Closes PLAT-2609

Test Plan:
- Create an Lti::ToolSetting object with vendor_code,
  product_code, and resource_type_code set to
  valid values of an installed LTI2 tool. The
  resource_link_id of the object should also be set.
- Navigate to context/:id/lti/resource_link_id
  /:resource_link_id
- Verify the message handler specified by the tool setting
  launches.
- Test using both course and accounts as contexts. The
  tool should not be launched if it is not installed in the context
  or the context's account.

Change-Id: I676b11d28c5ba2db9ae68cd4e7bbf2de82f4eb81
Reviewed-on: https://gerrit.instructure.com/113143
Reviewed-by: Tyler Pickett <tpickett@instructure.com>
Reviewed-by: Brad Humphrey <brad@instructure.com>
Tested-by: Jenkins
QA-Review: August Thornton <august@instructure.com>
Product-Review: Weston Dransfield <wdransfield@instructure.com>
2017-05-31 22:45:04 +00:00
Christian Prescott 978b27106b fix floating point error in Quiz points_possible arithmetc
closes CNVS-33804

Test Plan
before checking out the change, create a quiz with enough fractional
point questions to create rounding error. Here's one: 29 questions at
3.3 points each. Or 20 at 4.02 points each.
The quiz show page should have a points value that isn't precisely right.
As a student, create a submission to the quiz.
Check out this change. Run migrations.
Ensure the quiz no longer has imprecise points_possible.
Ensure the submission does not need regrading.
Ensure editing or creating quizzes with fractional points no longer
creates rounding error. Ensure submissions no longer need regrading
after editing quiz fields unrelated to score.

Change-Id: I6d761a6ceb8dae47b72e9454912c14aa94b6e50b
Reviewed-on: https://gerrit.instructure.com/111956
Reviewed-by: Ryan Taylor <rtaylor@instructure.com>
Tested-by: Jenkins
QA-Review: Michael Hargiss <mhargiss@instructure.com>
Product-Review: Kevin Dougherty <jdougherty@instructure.com>
2017-05-31 22:09:44 +00:00
Jeremy Stanley 3d47677764 teacher-side index, show, and details APIs
test plan:
 - render API documentation
 - ensure links between blueprint and associated endpoints
   work properly in API documentation
 - ensure the link from "Set or remove restrictions" to the
   "Course API Update" link works properly in API docs
 - ensure teachers in associated courses who are not
   enrolled in the blueprint and not account admins
   can use the three endpoints in "Associated Course History"
   and that these work as expected
 - the notification links for teachers should be as follows:
   #!/blueprint/blueprint_subscriptions/X/Y
   where X is the BlueprintSubscription ID
   and Y is the ContentMigration ID
 - the notification links for admins should be as follows:
   #!/blueprint/blueprint_templates/X/Y
   where X is the MasterTemplate ID
   and Y is the MasterMigration ID
 (note that making these links work is MC-217)

closes MC-215

Change-Id: I3b0462faf888f8df91cfbd0acb1566da3d60bebc
Reviewed-on: https://gerrit.instructure.com/112840
Tested-by: Jenkins
Reviewed-by: James Williams  <jamesw@instructure.com>
QA-Review: Heath Hales <hhales@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2017-05-31 15:08:01 +00:00
Brent Burgoyne eaccb83fd7 ensure google hosted_domain is nil for empty str
this includes a data fixup for existing google account auth configs

fixes CNVS-37146

test plan:
- create or edit a google authentication config for an account
- try to log in as a google user
- you should be able to login successfully

Change-Id: I5b8fd1c6df22c64dad6d10329d3cd5e3a34a40dd
Reviewed-on: https://gerrit.instructure.com/113347
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins
QA-Review: Tucker McKnight <tmcknight@instructure.com>
Product-Review: Brent Burgoyne <bburgoyne@instructure.com>
2017-05-26 19:52:38 +00:00
James Williams 4809161eb9 master courses: bring over settings sometimes
test plan:
* create a master course
* in the course settings, 'navigation' tab, create
 a custom navigation configuration
* add an associated course
* the initial sync should bring over the tab navigation
* subsequent syncs should not
* use the api to queue a migration (sync), setting the
 optional parameter "copy_settings"
* it should copy over the navigation

closes #MC-205

Change-Id: Ia6501af6bb0fdeea58803a08bcf17a13a480658a
Reviewed-on: https://gerrit.instructure.com/111616
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: David Tan <dtan@instructure.com>
Product-Review: Matt Goodwin <mattg@instructure.com>
2017-05-26 19:27:21 +00:00
wdransfield e0ff8a8cf9 Remove datafixup that broke all the things
Test Plan:
Migrations run

Change-Id: I291e0c9ee6e91877f108b3f31f166dad2e3788ea
Reviewed-on: https://gerrit.instructure.com/112912
Reviewed-by: Rob Orton <rob@instructure.com>
Tested-by: Jenkins
QA-Review: August Thornton <august@instructure.com>
Product-Review: Weston Dransfield <wdransfield@instructure.com>
2017-05-23 23:45:14 +00:00
wdransfield 9acbad2a5c lti2 launch by link_id
Closes PLAT-2565

Test Plan:
- Create an unsigned JWT with the following values
  in the body:
   - vendor_code
   - product_code
   - resource_type_code
  The values for each of these should be a valid
  code of an Lti::ProductFamily and
  Lti::ResourceHandler existing in Canvas
- Navigate to `http://canvas.docker/<tool context>/:id/
  lti/message_handler_link/<jwt>`
- Verify that doing a launch in this way finds
  tools up the context's account chain. (i.e.
  doing this with the context in the URL set
  to a course should find a tool in the course,
  or any account up the chain).
- Verify that the closest context to the
  current context is used.

Change-Id: I397dbcadc5ed8bcdfd7cd7993c0ed997a0814bc9
Reviewed-on: https://gerrit.instructure.com/112171
Tested-by: Jenkins
Reviewed-by: Brad Humphrey <brad@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Brad Humphrey <brad@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
2017-05-23 14:41:49 +00:00
Steven Burnett 74a09dfb23 add note to self model
fixes FALCOR-246

Test Plan:
- Go to Rails Console
- Create some NoteToSelf
- Tests pass

Change-Id: Ieb5808017f5d498eda5a3fed1581f713f89d503d
Reviewed-on: https://gerrit.instructure.com/112056
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: Steven Burnett <sburnett@instructure.com>
2017-05-22 16:33:13 +00:00
Gary Mei 5d4e8ada04 fix/ensure that latepolicy has unique course_id
Closes CNVS-36864

Runs a fixup to clean up any LatePolicies that have the same course
id, keeping only the newest one. Adds a unique constraint on the db
and activerecord.

Test Plan
 - Before pulling code, create some LatePolicies in the console all
 with the same course.
 - Verify that you have multiple LatePolicies with the same course_id
 - Pull this code and run migrations
 - Check in the console to see if you still have LatePolicies that
 share a course_id with another LatePolicy
 - Attempt to create a LatePolicy that shares a course_id with
 another LatePolicy

Change-Id: I78fd49789dc7f235a399d261a6b6a1a30c42bb8e
Reviewed-on: https://gerrit.instructure.com/112152
Tested-by: Jenkins
Reviewed-by: Neil Gupta <ngupta@instructure.com>
Reviewed-by: Shahbaz Javeed <sjaveed@instructure.com>
QA-Review: Spencer Olson <solson@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2017-05-22 16:03:13 +00:00
Jeremy Stanley 3d66ec5d74 notify when a blueprint sync completes
test plan: enable Blueprint Sync in notification preferences,
 perform syncs, and ensure admins and teachers get appropriate
 notifications in /users/id/messages.

 also test twitter, sms, and summary notifications.

 to test summary notifications:
 1. configure an email address to receive daily or weekly
    summaries (doesn't matter which; we will override the time)
 2. perform a sync
 3. in a console, force the messages to come due for delivery,
    and then queue them up (make sure jobs are running):

DelayedMessage.where(workflow_state: 'pending').update_all(send_at: 1.day.ago)
SummaryMessageConsolidator.process

 4. the summary message should then be visible in
    /users/X/messages

closes MC-102

Change-Id: I5e259e55f0684a05de27ec0a80ec59679d6cd5a6
Reviewed-on: https://gerrit.instructure.com/110927
Reviewed-by: James Williams  <jamesw@instructure.com>
Tested-by: Jenkins
QA-Review: Heath Hales <hhales@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2017-05-19 22:08:46 +00:00
Rob Orton 90d3293f3a add current_line and total_lines to account_reports
refs CNVS-35978

test plan
 - run report
 - it should have current_line

Change-Id: Ic60b1421e38a2b2d66604fbb14c1063925965dc6
Reviewed-on: https://gerrit.instructure.com/106951
Tested-by: Jenkins
Reviewed-by: Tyler Pickett <tpickett@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2017-05-17 19:34:01 +00:00
Mysti Sadler 5c2b0571aa Add to do date to discussion topics
closes FALCOR-223

Test plan
- As a teacher, edit a course discussion or
- a group discussion (account or course) and
- verify the checkbox shows up
- Verify that you can select the checkbox to
- make the date input field show up
- Verify that if you do not input a date, it
- gives you an error message on save
- Verify that if you do input a date and save
- that you can still see that date on reload
- Verify that you can remove the date by unchecking
- the box
- Verify that you can't set the assignment to graded
- and set a todo date (set the date and then check
- the graded checkbox and see if it saves)
- Verify that you can't see the checkbox as a student
- Verify that you can't use the API to set the date
- on either a new or updated discussion as a student
- Verify that you can use the API to set the date
- Verify that you can't use the API to have a graded
- discussion with a todo date

Change-Id: I5ee7a41244444ac4cc7ca54f8de37cdfbf39f722
Reviewed-on: https://gerrit.instructure.com/111172
Tested-by: Jenkins
Reviewed-by: Steven Burnett <sburnett@instructure.com>
QA-Review: Dan Sasaki <dsasaki@instructure.com>
Product-Review: Christi Wruck
2017-05-17 19:24:42 +00:00
Dan Minkevitch 1f4132e1ba Planner API
Closes FALCOR-183
Closes FALCOR-184
Closes FALCOR-255
Closes FALCOR-186
Closes FALCOR-187
Closes FALCOR-188
Closes FALCOR-189
Closes FALCOR-147
Closes FALCOR-148

Test Plan:
* As a student in an account with the Student Planner
  feature flag enabled
* In a course with multiple upcoming due assignments
  in the current and following weeks
* Test that the following API endpoints provide you
  with the data described:

  get '/api/v1/planner/items'
    * Should return a list matching that of the todo
      list endpoint, while adding an additional key
      named `visible_in_planner`
  get '/api/v1/planner/overrides'
    * Should return a list of previously created
      PlannerOverrides
  get '/api/v1/planner/overrides/:override_id'
    * Should return the specific override for the
      passed in id
  put '/api/v1/planner/overrides/:override_id'
    * Should update an existing override's `visible`
      value to match what was passed in the request. No
      other values should be updated
  post '/api/v1/planner/overrides'
    * Should create a new PlannerOverride with the specified
      `plannable_type`, `plannable_id`, and `visible` values.
      `user_id` should match that of the user making the request
  delete '/api/v1/planner/overrides/:override_id'
    * Should set the PlannerOverride's `deleted_at` to when
      the request was made, as well as updating the `workflow_state`
      to `deleted`

Change-Id: I03890a525f8201a8df1d2f1290cdcd549ba548d7
Reviewed-on: https://gerrit.instructure.com/107495
Tested-by: Jenkins
Reviewed-by: Steven Burnett <sburnett@instructure.com>
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: Dan Minkevitch <dan@instructure.com>
2017-05-15 19:18:47 +00:00
Steven Burnett 4105782667 add student planner todo to pages
fixes FALCOR-157

Test Plan:
- Go to Pages with the student planner FF on
- Notice the add to student todo checkbox
- add the todo date and save
- remove the todo date and save
- check validations with checkbox and not saving
- update the todo date and save

Change-Id: I30d3996549f3e6c780603f7668e707e3b3ba8ca0
Reviewed-on: https://gerrit.instructure.com/111303
Tested-by: Jenkins
Reviewed-by: Dan Minkevitch <dan@instructure.com>
QA-Review: David Mirabile <dmirabile-c@instructure.com>
Product-Review: Steven Burnett <sburnett@instructure.com>
2017-05-15 18:37:01 +00:00
Rob Orton 48adba8387 fix a typo
just a small cahnge

Change-Id: Ie90a3e548916dd0effbab184ed024904c5bc237f
Reviewed-on: https://gerrit.instructure.com/111596
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
QA-Review: Rob Orton <rob@instructure.com>
Tested-by: Jenkins
2017-05-12 01:49:59 +00:00
Neil Gupta 1e052eae19 Update DueDateCacher to use EffectiveDueDates
fixes CNVS-33651

Test plan:
* Create a course
* Enroll 3 students
* Create 2 assignments with different due dates
* In rails console:
	* Submission.pluck(:assignment_id, :cached_due_date) should return
	  an array of 6 tuples of (assignment id, its due date)
* Create an override for one student on one assignment
* In rails console:
  * Submission.where(
  		assignment_id: <assignment picked above>,
  		user_id: <user picked above>
  	).cached_due_date should equal the override date
* Smoke test grading and viewing students in different places to make
  sure the new dummy submissions aren't breaking anything

Change-Id: Idc2721fd3f05214555db780b452ddf53e67ff404
Reviewed-on: https://gerrit.instructure.com/109027
Tested-by: Jenkins
Reviewed-by: Keith T. Garner <kgarner@instructure.com>
QA-Review: Anju Reddy <areddy@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2017-05-11 20:54:44 +00:00
wdransfield 86d81a2d91 Add lookup id to lti resource handler
Closes PLAT-2572

Test Plan:
- Run migrations and verify any resouce_handlers
  in your DB now have a `lookup_id` that takes
  the following form:
  <product_code>-<vendor_code>-
  <resource_type_code>-<signature>
- Verify Lti::ResourceHandler now validates the
  presence of a 'lookup_id'
- Verify creating an Lti::ResourceHandler without
  specifying a 'lookup_id' generates a lookup_id
  for the resource handler.

Change-Id: Ie2271a7356be4101b011bb22d4a7c04d5b3dbe44
Reviewed-on: https://gerrit.instructure.com/111133
Tested-by: Jenkins
Reviewed-by: Andrew Butterfield <abutterfield@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Weston Dransfield <wdransfield@instructure.com>
2017-05-11 19:43:06 +00:00
James Williams f2b4dea8a5 master courses: allow default restrictions to be set by type
closes #MC-186

Change-Id: I71ef6c255319f63ce20b47b98dee1b08e33acbb8
Reviewed-on: https://gerrit.instructure.com/110988
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Heath Hales <hhales@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2017-05-11 12:33:20 +00:00
Clay Diffrient 9970a1ec3a Merge branch 'grahamb-developer_key_notes_field'
closes CNVS-36654

Reviewed-by: Ryan Shaw <ryan@instructure.com>
Reviewed-by: Tyler Pickett <tpickett+gerrit@instructure.com>
Reviewed-on: https://gerrit.instructure.com/106068
Tested-by: Jenkins
QA-Review: Tucker McKnight <tmcknight@instructure.com>
Product-Review: Clay Diffrient <cdiffrient@instructure.com>

Change-Id: I6eee43e696ca2d98d935ebd0e51ef54fd7554ed9
2017-05-10 08:21:39 -06:00
Derek Bender 8f3fcfe51d add late_policy_status, accepted_at, points_deducted to submission
closes: CNVS-32365

Test Plan:
1. As a student, submit to an assignment late.
2. In rails console, observe that the submission created in step 1
   returns `minutes_late` that accurately represents the number of
   minutes late the submission was. This value should be 0 for
   not-late submissions.
3. As the student, resubmit to the assignment. In a rails console,
   verify the minutes_late has been updated.
4. Repeat steps 1-3 with a quiz instead of an assignment. To get the
   submission for a quiz, it will look like:

   quiz = Quizzes::Quiz.find_by(title: "My Quiz")
   s = quiz.quiz_submissions.find_by(user_id: 173).submission

   For quiz submissions, the student should be given one minute of
   leeway, meaning if you submit a minute or less after the quiz is
   due, minutes_late should be 0. A way you can test it via rails
   console:

   # make the student's submitted at exactly 1 minute after it was due
   irb(main):103:0> s.submitted_at = 1.minute.from_now(s.cached_due_date)
   => Thu, 04 May 2017 06:00:59 UTC +00:00
   # verify minutes_late is 0, since quiz submissions get 1 minute of leeway
   irb(main):105:0> s.minutes_late
   => 0.0

   # make the student's submitted at exactly 2 minutes after it was due
   irb(main):106:0> s.submitted_at = 2.minutes.from_now(s.cached_due_date)
   => Thu, 04 May 2017 06:01:59 UTC +00:00
  # verify minutes late is 1, since quiz submissions get 1 minute of leeway
   irb(main):108:0> s.minutes_late
   => 1.0

Change-Id: I170f798a38d827a0699682cb557c1aa81c73201e
Reviewed-on: https://gerrit.instructure.com/107955
Tested-by: Jenkins
Reviewed-by: Jeremy Neander <jneander@instructure.com>
Reviewed-by: Shahbaz Javeed <sjaveed@instructure.com>
QA-Review: Matt Taylor <mtaylor@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2017-05-05 16:03:01 +00:00
Cody Cutrer 0571277626 MFA backup code support
fixes CNVS-35623

test plan:
 * disable redis
 * configure MFA; do not remember this computer
 * on your profile, there should be a link to MFA backup codes
 * follow it; it should show 10 codes
 * log out and log back in, using one of those codes
 * go back to your backup code list; the one you used should be
   crossed out
 * log out and log back in, attempting to use the same code;
   it should not allow you to
 * log in with another code
 * make note of one of the unused backup codes
 * regenerate your backup codes; it should give you 10 new codes,
   all unused
 * log out, and attempt to log in with one of the old unused codes;
   it should not allow you to
 * log in with one of the new backup codes; it should work
 * make note of backup codes
 * reconfigure MFA
 * look at your backup codes again; they should be different
 * make note of them again
 * disable MFA, and then configure it again
 * your backup codes should be different again

Change-Id: I20b1da102ef4cb757c80e1f46e276f88fdfb21b4
Reviewed-on: https://gerrit.instructure.com/21614
QA-Review: Tucker McKnight <tmcknight@instructure.com>
Tested-by: Jenkins
Reviewed-by: Simon Williams <simon@instructure.com>
Product-Review: McCall Smith <mcsmith@instructure.com>
2017-05-02 16:08:53 +00:00