Commit Graph

1404 Commits

Author SHA1 Message Date
James Williams 3a01c04c83 check for invalid rubric_assessment on submissions api
try to make sure that they're actually saving some data
but also don't explode on old invalid assessments

test plan:
* create an assignment with a rubric
* submit to the assignment

* use the assignment api show endpoint
(/api/v1/courses/X/assignments/Y)
and note the "rubric" object showing the criteria ids

* use the submissions api endpoint for
 "Grade or comment on a submission"
 and the "rubric_assessment" parameter
 to save a rubric assessment, using the criteria ids
 retrieved earlier
(e.g. "rubric_assessment[criteria_id][points]=5")

* try to use the same endpoint using
 invalid criteria ids
* should receive a useful error instead of creating
 a rubric assessment that can then break the
 submissions api

closes #OUT-1416

Change-Id: Iedfdca8e8d871dcf49e3de1773fc7d74abc225d3
Reviewed-on: https://gerrit.instructure.com/125511
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Andrew Porter <hporter-c@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2017-09-13 19:22:00 +00:00
James Williams 5059ced17e master courses: fix outcome copying on selective export
test plan:
* have a blueprint course with an associated course
* add an outcome to the blueprint course
* it should copy over to the associated course

closes #MC-290

Change-Id: I7baf402be34541db55bc7291b6ad8d1d5c85aae6
Reviewed-on: https://gerrit.instructure.com/125039
Tested-by: Jenkins
Reviewed-by: Jon Willesen <jonw+gerrit@instructure.com>
QA-Review: Heath Hales <hhales@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2017-09-12 12:13:15 +00:00
Shahbaz Javeed 140f5ec425 add the anonymous_instructor_annotations attribute to assignment
closes GRADE-157

this is currently hidden behind an environment variable until DocViewer
starts consuming this attribute and decides to expose it via a feature
flag

test plan:
* Setup the environment variable ANONYMOUS_INSTRUCTOR_ANNOTATIONS to
  'true'
* Start Canvas
* Go to create an assignment and verify that it contains a checkbox to
  anonymize instructor annotations for the new assignment
* Verify this checkbox works
* Edit the newly created assignment and verify the checkbox labelled
  anonymize instructor annotations always accurately reflects the choice
  made when saving the assignment

* Remove the ANONYMOUS_INSTRUCTOR_ANNOTATIONS environment variable
* Restart Canvas
* Go to create an assignment and verify it no longer contains a checkbox
  to anonymize instructor annotations
* Edit the assignment you created earlier and verify it also no longer
  contains a checkbox to anonymize instructor annotations

Change-Id: Ia43dee5c45ccd151319380e673d70dc509512ca8
Reviewed-on: https://gerrit.instructure.com/123646
Tested-by: Jenkins
Reviewed-by: Derek Bender <djbender@instructure.com>
Reviewed-by: Keith T. Garner <kgarner@instructure.com>
QA-Review: Indira Pai <ipai@instructure.com>
Product-Review: Matt Goodwin <mattg@instructure.com>
2017-09-06 19:47:21 +00:00
wdransfield 0e4b88cebd Check account chain for plag tool install
Closes PLAT-2816

Test Plan
- Create a sub account
- In the sub account create a course and
  install a plagiarism detection tool
- Create an assignment in that course and
  verify the tool can be associated with
  the assignment.

Change-Id: Ie4b6661c60f4832ba865658f28f8088fde00fa30
Reviewed-on: https://gerrit.instructure.com/125052
Tested-by: Jenkins
QA-Review: August Thornton <august@instructure.com>
Reviewed-by: Andrew Butterfield <abutterfield@instructure.com>
Product-Review: Weston Dransfield <wdransfield@instructure.com>
2017-09-06 19:37:47 +00:00
Spencer Olson 87e9bad41e add current grade to new gradebook history
closes GRADE-172

Test Plan:
1. Verify the New Gradebook History page results includes a "Current"
   grade column. The current grade should behave in the following ways:
   a) The points possible should be shown if the assignment is currently
      displaying grades as points and the current grade can be parsed as
      a number.
   b) If a current grade is not available (like if the submission has
      been destroyed), the current grade should be displayed as "N/A".

Change-Id: Ie1b753962eec10933be8a3be3829c1e2419a643f
Reviewed-on: https://gerrit.instructure.com/124834
Tested-by: Jenkins
Reviewed-by: Derek Bender <djbender@instructure.com>
Reviewed-by: Jeremy Neander <jneander@instructure.com>
QA-Review: Indira Pai <ipai@instructure.com>
Product-Review: Matt Goodwin <mattg@instructure.com>
2017-09-06 15:43:17 +00:00
Derek Bender 38ad7d4392 add mobile_student_label mobile_teacher_state API
This currently does not expose a dropped mobile_teacher_state because
that concept isn't currently exposed in any meaningful way.
See also: GRADE-16

This API is undocumented by design.

closes: GRADE-168

Test Plan
=========

Base Case
---------
- Given an assignment with at least one submission
- When fetching the submissions API:
  `/api/v1/courses/1/assignment/1/submissions`
- Then the fields `mobile_student_label` and `mobile_teacher_state`
  are not present

Mobile Student Label Use Cases
---------------
Resubmitted:
- Given a submission that is resubmitted
- When fetching the submissions API with the string
  'mobile_student_label' in the `include` query parameter:
  /api/v1/courses/1/assignment/1/submissions?include[]=mobile_student_label
- Then the submission JSON includes a field 'mobile_student_label'
  with the value 'resubmitted'

Missing:
- Given an assignment that is past due with no student submission
- When fetching the submissions API with the string
  'mobile_student_label' in the `include` query parameter
- Then the submission JSON includes a field 'mobile_student_label'
  with the value 'missing'

Late:
- Given an assignment that was submitted but was after the due date
- When fetching the submissions API with the string
  'mobile_student_label' in the `include` query parameter
- Then the submission JSON includes a field 'mobile_student_label'
  with the value 'late'

Submitted:
- Given an assignment that has as submission
- When fetching the submissions API with the string
  'mobile_student_label' in the `include` query parameter
- Then the submission JSON includes a field 'mobile_student_label'
  with the value 'submitted'

Unsubmitted:
- Given an assignment without a submission
- When fetching the submissions API with the string
  'mobile_student_label' in the `include` query parameter
- Then the submission JSON includes a field 'mobile_student_label'
  with the value 'unsubmitted'

Mobile Teacher State Use Cases
---------------
Excused:
- Given an assignment with an excused submission
- When fetching the submissions API with the string
  'mobile_teacher_state' in the `include` query parameter:
  /api/v1/courses/1/assignment/1/submissions?include[]=mobile_teacher_state
- Then the submission JSON includes a field 'mobile_teacher_state'
  with the value 'excused'

Needs Review:
- Given a quiz with an essay question that needs review and student
  submission for said quiz
- When fetching the submissions API with the string
  'mobile_teacher_state' in the `include` query parameter
- Then the submission JSON includes a field 'mobile_teacher_state'
  with the value 'needs_review'

Needs Grading:
- Given an assignment submission that hasn't yet been graded
- When fetching the submissions API with the string
  'mobile_teacher_state' in the `include` query parameter
- Then the submission JSON includes a field 'mobile_teacher_state'
  with the value 'needs_grading'

Graded:
- Given an assignment submission that has been graded
- When fetching the submissions API with the string
  'mobile_teacher_state' in the `include` query parameter
- Then the submission JSON includes a field 'mobile_teacher_state'
  with the value 'graded'

nil:
- Given an assignment submission that has been graded
- When fetching the submissions API with the string
  'mobile_teacher_state' in the `include` query parameter
- Then the submission JSON includes a field 'mobile_teacher_state'
  with the value null

Also test with quiz submission

Change-Id: Icbc784b47ecc3baecb770703a9515b52b326e347
Reviewed-on: https://gerrit.instructure.com/123007
Reviewed-by: Spencer Olson <solson@instructure.com>
Tested-by: Jenkins
Reviewed-by: Shahbaz Javeed <sjaveed@instructure.com>
QA-Review: Taylor Wilson <twilson@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2017-08-31 23:18:14 +00:00
brian kirkby 9894e81ee2 user input titles for media are now exposed as <p> title text
fixes CNVS-36185

test plan:
- record/upload video file through tinymce "Record/Upload Media" button
- before recording/uploading the the media, enter text into the Title field
- finish recording/uplading the media and the dialog will dismiss adding
  your recording to tinymce
- switch view to HTML edit mode and verify that the alt tag has your title
- save the comment/page/whatevs
- refresh the page and inspect the thumbnail button
- verify the alt text is included on the anchor tag
- edit the page/comment/whatevs and verify the alt text carries into the edit
- rejoice!

Change-Id: I5ab76688315c668b3c0fe1d06f7ff642650fc4e0
Reviewed-on: https://gerrit.instructure.com/122074
Tested-by: Jenkins
Reviewed-by: Brent Burgoyne <bburgoyne@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: brian kirkby <bkirkby@instructure.com>
2017-08-30 22:09:02 +00:00
wdransfield cfd1295bee Add originality report visibility settings
Closes PLAT-2779

Test Plan:
- Create an assignment with a plagiarism detection tool
  associated. Set the 'Show originality report to students'
  to 'Never'.
- Create an originality report for a submission and
  verify it is not visible to the student on the submission
  details page or grades summary page. It should still be
  visible to the teacher.
- Edit the assignment and change the visibility option to
  'After the due date'. Also set the due date to a date/time
  in the past.
- Verify the originality report is now visible to the student in
  the submission details page and grade summary page (note that
  you may need to flush redis).
- Create a new assignment associated with a plagiarism detection
  tool and set the visibility option to 'After the assignment
  is graded'.
- Create a submission and an originality report.
- Verify that the student cannot view the originality report
  until the assignment has been graded by the teacher.
- Edit the assignment and change report visibility
  to Immediately. Verify that the student can still
  view the originality report.

Change-Id: I35a4e87275577b5b5d9cc0c1ce3501a5ae048a79
Reviewed-on: https://gerrit.instructure.com/123766
Reviewed-by: Andrew Butterfield <abutterfield@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Tested-by: Jenkins
Product-Review: Jesse Poulos <jpoulos@instructure.com>
2017-08-30 20:18:23 +00:00
James Williams a0fbb1ab3d cache progression and item visibility data on courses
so we don't constantly refetch the same data when running
progressions

test plan:
* module progressions with assignment overrides
 should work as before

closes #CNVS-38735

Change-Id: If85cb5f6d736eaebdcd84a5e16fcf1b243ec42aa
Reviewed-on: https://gerrit.instructure.com/123268
Tested-by: Jenkins
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Heath Hales <hhales@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2017-08-24 16:46:26 +00:00
Gary Mei 242dd3e7c9 show points possible in gradebook history
closes GRADE-171

There are some edge cases where if the assignment went from points
based to non-points based and vice versa, grades will not show up
with points possible or they show up as the non-points based type
with a points possible. Examples are "100" alone and "A/100".

Test Plan
1. Grade some points based assignments.
2. Grade some non-points based assignments.
3. Check the history page; the points based assignments show a points
    possible that the assignment was out of. The non-points based
    assignments do not show points possible.
4. Change the points possible on a points based assignment.
5. Re-grade that assignment.
6. Check the history page; the new entries from Step 5 show up with
    the new points possible. The old entries from before Step 4 show
    with the old points possible.

Change-Id: Id7a4e20622daf021047e378815dea2f8ed6ace9c
Reviewed-on: https://gerrit.instructure.com/122817
Reviewed-by: Brian Park <bpark@instructure.com>
Reviewed-by: Spencer Olson <solson@instructure.com>
Tested-by: Jenkins
QA-Review: Anju Reddy <areddy@instructure.com>
Product-Review: Matt Goodwin <mattg@instructure.com>
2017-08-23 16:12:07 +00:00
Nick Houle a757d32301 Allow assignment to save w/ post_to_sis unchecked
Fixes: SIS-2912 and SIS-2915

Test plan:
- Enable SIS feature options
- Navigate to a course
- Confirm you can create an assignment with post_to_sis checked
- Confirm you can create an assignment without post_to_sis
  checked
- Edit the assignment
- Check post_to_sis and add a due date for Everyone Else
- Confirm the assignment saves

Change-Id: I921343525713747e3a1fb7a0242ae62826c163f8
Reviewed-on: https://gerrit.instructure.com/122693
Reviewed-by: Michael Brewer-Davis <mbd@instructure.com>
Product-Review: Brad Humphrey <brad@instructure.com>
Tested-by: Jenkins
QA-Review: Mark McDermott <mmcdermott@instructure.com>
2017-08-23 16:06:46 +00:00
Brent Burgoyne 1fa616ad0f include user full name in recipient search api
closes CNVS-38670

test plan:
- perform a search with the recipient search api
  (/api/v1/search/recipients)
- result should include full_name for users

Change-Id: I1ac89ac35448bf3ca68b754ca5fefb794e97d4e3
Reviewed-on: https://gerrit.instructure.com/122709
Tested-by: Jenkins
QA-Review: Tucker McKnight <tmcknight@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Brent Burgoyne <bburgoyne@instructure.com>
2017-08-15 22:10:58 +00:00
Rob Orton 17cf65636c add 'restrict_enrollments_to_section_dates' to section api
fixes gh-1095

test plan
 - api should have restrict_enrollments_to_section_dates

Change-Id: I4b3eb38bafefe09c1fbaccc95cd4450c425a821a
Reviewed-on: https://gerrit.instructure.com/122770
Tested-by: Jenkins
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Tucker McKnight <tmcknight@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2017-08-15 18:28:44 +00:00
Simon Williams 3dadfdba88 add from_name to CommMessage api
closes CNVS-38354

test plan:
- hit the CommMessages api
- it should return `from` and `from_name`

Change-Id: Ie06a09e778a3f0098a1ae80cd5bfc237014715bb
Reviewed-on: https://gerrit.instructure.com/120316
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2017-08-15 15:47:22 +00:00
Simon Williams 48b208c743 mark content imports as expired after X days
closes CNVS-38163

test plan:
- run Setting.set('content_migrations_expire_after_days', '1')
- create some content imports if you don't already have any
- ContentMigration.where(id: ContentMigration.last.id).
    update_all(created_at: 2.days.ago)
- visit the course content import page
- it should show as unavailable

Change-Id: I0491a1f1e292c0d9ded2ca202bd2cd997839a4bf
Reviewed-on: https://gerrit.instructure.com/118714
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Ryan Shaw <ryan@instructure.com>
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2017-08-15 03:29:19 +00:00
Simon Williams 3f1c585a2f shorten list of tags to rewrite to api urls
there is a measurable cost associated to this step of api content
transformation, so only run it on types of url attributes that might
actually need to be rewritten (ignore mathml href's)

fixes CNVS-38442

test plan:
- create a submission with a lot of <p> tags
- request it from the API
- performance should be better
- now create a link/image to something root-relative in canvas
- request it from the api
- it should come back as absolute

Change-Id: I21fc42db25e84e70a0d19db7dc271cfd46801ecb
Reviewed-on: https://gerrit.instructure.com/122400
Tested-by: Jenkins
Reviewed-by: Keith T. Garner <kgarner@instructure.com>
QA-Review: Tucker McKnight <tmcknight@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2017-08-14 20:06:57 +00:00
Neil Gupta 6a7d79f063 add external tool url to submission json
fixes GRADE-75

test plan:
* Create a Quizzes.Next quiz
* Complete the quiz as 2 different students
* As the teacher, access the quiz in speed grader
* Adjust the fudge points for the first student
* Navigate to the second student and then back to the first student
* The quiz should still be visible

Change-Id: I4cd9d743f8a2c0c5b511f8f5615c8ed0edc81991
Reviewed-on: https://gerrit.instructure.com/122041
Reviewed-by: Brian Park <brian@siimpl.io>
Reviewed-by: Shahbaz Javeed <sjaveed@instructure.com>
Tested-by: Jenkins
QA-Review: Robin Kuss <rkuss@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2017-08-10 20:11:50 +00:00
Brian Park b4d8da3246 apply late policy in gradezilla frontend on change
closes: GRADE-133

Test Plan:
1. Navigate to gradezilla
2. Change some late policy values in settings cog menu
3. Observe that upon clicking 'Update' in the menu,
   all late and missing assignments are updated to show
   the new grades.
    - Late submission deductions are applied when enabled
    - Late submission deductions are updated when penalty
       value is changed
    - Late submission deductions persist when late
        deductions are turned off
    - Missing submission grades populated when policy set
       - Does not affect existing grades!
    - Missing submission grades unchanged when policy unset
    - Submissions in closed grading periods are unaffected
      by any late or missing policy changes

Change-Id: I6d0f759a1653ab58a749a9d7b0b95eff453a432c
Reviewed-on: https://gerrit.instructure.com/119148
Reviewed-by: Jeremy Neander <jneander@instructure.com>
Tested-by: Jenkins
Reviewed-by: Neil Gupta <ngupta@instructure.com>
QA-Review: Indira Pai <ipai@instructure.com>
Product-Review: Matt Goodwin <mattg@instructure.com>
2017-08-09 17:27:05 +00:00
Mysti Sadler fd6495fd87 Add new_activity tag to planner item json
refs FALCOR-544
refs FALCOR-539

Test plan
- Create some grading items and some discussions/announcements
- Ensure they are not showing up with the new_activity flag
- in the API yet
- Ensure they do not show new_activity for submissions
- Grade or add feedback to the grading items
- Reply to the discussion/announcements
- Ensure that the api now does show new_activity

Change-Id: I8cf448c3296c21057aba9a9006b8efd8044986bd
Reviewed-on: https://gerrit.instructure.com/120658
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: David Mirabile <dmirabile-c@instructure.com>
Product-Review: Christi Wruck
2017-08-08 20:18:12 +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
James Williams 0638da43ba rails 5.1: all the rest of the specs
Change-Id: I2f4ca4a671a0e5bdcfbeb90b4714465ec34acc9f
Reviewed-on: https://gerrit.instructure.com/120891
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2017-07-31 19:48:51 +00:00
Andrew Katsanevas 04c576cb41 adds sorting to columns in courses and people search
adds sorting to the 'Courses' and 'SIS ID' columns of the Courses tab
and the 'Name' and 'Last Login' columns of the People tab
closes CNVS-33425

test plan:
- turn on Account Course and User Search feature flag
- go to /accounts/1/search/courses
- make sure Courses and SIS ID columns are clickable and sortable
- make sure that keyboard interaction and a11y looks good
- go to /accounts/1/search/people
- do the same for the Name and Last Login columns of the People tab

add sorting by Teacher column in courses

add sorting by first alphabetical teacher to
the 'Teacher' column of the Courses tab

test plan:
- turn on Account Course and User Search feature flag
- go to /accounts/1/search/courses
- make sure the Teacher column is clickable and sortable
- make sure that keyboard interaction and a11y look good

add sorting by Enrollments column in courses

add sorting by number of students enrolled to
the 'Enrollments' column of the courses tab

test plan:
- turn on Account Course and User Search feature flag
- go to /accounts/1/search/courses
- make sure the Enrollment column is clickable and sortable
- make sure that keyboard interaction and a11y look good

add sorting by Email and SIS ID columns in People

add sorting by 'Email' and 'SIS ID' columns of
'People' search tab

test plan:
- turn on Account Course and User Search feature flag
- go to /accounts/1/search/people
- make sure the Email column is clickable and sortable
- make sure the SIS ID column is clickable and sortable
- make sure that keyboard interaction and a11y look good

change UserPane to extend React.Component

change UserPane.js to be a class that extends React.Component
instead of using the old React.createClass

test plan:
- go to /accounts/1/search/people
- make sure the user search feature works the same as before

fix queries and lint warnings

fix SQL queries based on Tyler's suggestions
and fix some lint warnings throughout

test plan:
- go to /accounts/1/search/courses
- make sure sorts still work
- make sure queries are as correct and efficient
- go to /accounts/1/search/people
- do the same
- make sure Gergich is relatively happy

sort teachers in course and lint fixes

change course search so that teachers are sorted alphabetically
within a course (if it has multiple teachers). also a few lint
fixes here and there.

test plan:
- go /accounts/1/search/courses
- make sure that teachers are sorted within a course

Change-Id: I710878bd8ce98ba2fa4eb0c357721864df338939

add a sortable column for subaccounts to course search

add a new column to course search for subaccount
make it sortable like the other columns

test plan:
- turn on Account Course and User Search feature flag
- go to /accounts/1/search/courses
- make sure the correct subaccounts are showing
- make sure the subaccount column is clickable and sortable
- make sure that keyboard interaction and a11y look good

Change-Id: Ic8b8f258c27c16982a450286f6b715c9e04d425e

fix focus for keyboard navigation in Course Search sorting

prevent the CoursesList from rerendering sometimes on sorts
so that it doesn't lose focus

test plan:
- turn on Account Course and User Search feature flag
- go to /accounts/1/search/courses
- make sure keyboard interaction doesn't lose focus

Change-Id: I6236c92f6e71596d3dc38ef756e6ac808e9e99c2

fix invalid email sorting in User Search

fix the sorting of invalid emails in User Search
so that invalid emails (that don't show up) come last

test plan:
- turn on Account Course and User Search feature flag
- go to /accounts/1/search/courses
- make sure that invalid blank emails are sorted last

Change-Id: I56e6b1e57a1d494e7667c3cfc7b14a10976ec52e

fix invalid emails showing in User Search

fix User Search so that invalid emails don't display when
the "Load More..." button is pressed

test plan:
- turn on Account Course and User Search feature flag
- go to /accounts/1/search/courses
- have more than 10 users so "Load More..." is there
- click "Load More..." and make sure invalid emails don't display
for the newly-loaded users

Change-Id: I5bc23c616ae88da73f8632699c3bde1bffee994d

fix IE11 User Search sorting issue

fix User sorting in IE11 so that it doesn't go back to the
Courses tab when trying to sort

test plan:
- use IE11
- turn on Account Course and User Search feature flag
- go to /accounts/1/search/people
- make sure sorting works (doesn't take you to Courses tab)

Change-Id: I63491ca0b08812e21ed0ed2eb2f8a4bd1b791b89

fix add user in User Search bug where email doesn't show up

fix User Search so that when a user is added, their email
shows up without refreshing the page

test plan:
- turn on Account Course and User Search feature flag
- go to /accounts/1/search/people
- add a new user with a valid email
- make sure it displays before refreshing

Change-Id: Ib339bab3ea858c7c1ab18a6065ef4936941cb24b

remove debugger

Change-Id: Ibf88893ea35d795d8966c7580100ac135c8cfe93
Reviewed-on: https://gerrit.instructure.com/120294
Tested-by: Jenkins
Reviewed-by: Ryan Shaw <ryan@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Andrew Katsanevas <akatsanevas@instructure.com>
2017-07-25 22:55:10 +00:00
Jeremy Neander 0aeee4bdaf replace effective due dates with cached due dates
closes CNVS-38022

test plan:
* regression test Gradezilla with grading periods, especially:
  * filtering by grading periods
  * sorting by grading periods
  * grade locking (closed grading period grade protection)

Change-Id: Ic03e00cbe428e57bd0df7f29f1193deb1945d4a4
Reviewed-on: https://gerrit.instructure.com/119438
Tested-by: Jenkins
Reviewed-by: Keith T. Garner <kgarner@instructure.com>
QA-Review: Anju Reddy <areddy@instructure.com>
Product-Review: Pert Eilers <peilers@instructure.com>
2017-07-24 15:27:05 +00:00
Nick Houle 7c7c827f8b Fix sis due date validations
Fixes: SIS-2869, SIS-2768

Notes: This commit is also for Mastery Paths.
       Repeat the first six steps for Mastery Paths.
       However, instead of a section override create
       a Mastery Path override. If you need help
       setting up Mastery Paths ping me.

Test plan:
- Enable the new SIS integration settings
- Check the `Require due date` setting
- Navigate to a course with more than one section
- Navigate to the assignments tab
- Create an assignment with one section override and
  add a due date
- Confirm the assignment saves
- Repeat the same steps with two section overrides
- Confirm the assignment saves

Change-Id: I4ce249f24e381fb14698a784b6cf80d4dc839c31
Reviewed-on: https://gerrit.instructure.com/115330
Reviewed-by: Brad Humphrey <brad@instructure.com>
Product-Review: Brad Humphrey <brad@instructure.com>
QA-Review: Mark McDermott <mmcdermott@instructure.com>
Tested-by: Jenkins
2017-07-20 19:14:24 +00:00
James Williams 4ba94cb171 rails 5.1: lib specs
Change-Id: Ieef3d3447cfa2b22c9c9f6662688a40ae48a726c
Reviewed-on: https://gerrit.instructure.com/119730
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-20 17:26:51 +00:00
Brad Horrocks 01faca033c fix for moderated grading in DocViewer
Replace crocodoc_ids with moderated_grading_ids
Both canvadocs and crocodoc can use the ids now

refs RD-4238
Test Plan:
With a course that has one teacher, 2 TAs, and a student
- Create an assignment, check the moderated grading check box
- as the student submit the assignment
- as a TA, pull up the submission in speed grader, annotate and grade it
- as the Other TA, open the submission in speed grader
- make sure you cant see the first TAs comments

Change-Id: I886af3e21f9276866ea4be8d5de6574b32e5f122
Reviewed-on: https://gerrit.instructure.com/117360
Tested-by: Jenkins
Reviewed-by: Shahbaz Javeed <sjaveed@instructure.com>
Product-Review: Caleb Guanzon <cguanzon@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Reviewed-by: Derek Bender <djbender@instructure.com>
2017-07-18 22:13:39 +00:00
James Williams 16ac8bc9ea throw some ::'s around because rails is terrible
Change-Id: I6beefb3ca636e1915e9cdd173c04d3aa4bac07bc
Reviewed-on: https://gerrit.instructure.com/118923
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-13 20:27:58 +00:00
James Williams 980b05fee8 do some preloading for context/account in planner api
Change-Id: I7ffe15c36ba0699d704f568590a6b6afe4916fd9
Reviewed-on: https://gerrit.instructure.com/118680
Tested-by: Jenkins
Reviewed-by: Dan Minkevitch <dan@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2017-07-13 15:09:24 +00:00
Brad Horrocks 83011b6322 Enable annotations for submission api preview_urls
Test plan:
Make sure submission api results containing preview urls, have
annotations enabled

Fixes RD-4298
Change-Id: Id5358fc82bca6f94cc50f167cc33e7fe6515066f
Reviewed-on: https://gerrit.instructure.com/118357
Tested-by: Jenkins
Reviewed-by: Josh Orr <jgorr@instructure.com>
QA-Review: Mark McDermott <mmcdermott@instructure.com>
Product-Review: Brad Horrocks <bhorrocks@instructure.com>
2017-07-11 03:36:04 +00:00
Brian Park efed5ac493 show late deduction in speedgrader
closes: CNVS-37839

Test Plan:
1. As a teacher, navigate to SpeedGrader for an
   assignment with at least one late submission
2. Switch student to one that has a late, penalized submission
3. Observe that:
  - Unpenalized grade is displayed in input field
  - Penalty is displayed below input field
  - Modified grade is displayed  below input field
4. Repeat 1-3 for assignments of all `grading_type`s
  - Known issue: 'pass_fail' assignments do not
    display the points correctly if they have an
    existing late deduction.  To be addressed in
    future ticket.
5. Repeat with provisional grading
  - Observe thate late penalty stuff doesn't apply
    to provisional grades

Change-Id: Ie0acc835d9565faa9226c6969c70b4e8c5d0220e
Reviewed-on: https://gerrit.instructure.com/117217
Tested-by: Jenkins
Reviewed-by: Jeremy Neander <jneander@instructure.com>
Reviewed-by: Sheldon Leibole <sheldon@siimpl.io>
QA-Review: Anju Reddy <areddy@instructure.com>
Product-Review: Matt Goodwin <mattg@instructure.com>
2017-07-10 20:46:05 +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
Jeremy Stanley 3749ef0659 fix permissions for group appointment edit options
test plan:
 - in a course, create appointment groups with both
   individual and group signup
 - as a student, sign up for both
 - ensure that, when you click the appointments as a student,
   you don't see the "Group Options" and "Delete" buttons
 - ensure that a teacher does see this in both places

fixes CNVS-37047

Change-Id: I5b31cfd4587db9365fd9a0ddafdb920035eade3f
Reviewed-on: https://gerrit.instructure.com/118180
Tested-by: Jenkins
Reviewed-by: James Williams  <jamesw@instructure.com>
QA-Review: David Tan <dtan@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2017-07-10 15:55:48 +00:00
Spencer Olson 796ac1495e remove documentation for accepted_at on submissions
Remove documentation for accepted_at on submissions, because it is
going to get replaced by seconds_late. Also, no longer return the
accepted_at attribute in the submissions API. Finally, rename
duration_late to seconds_late, because in the change to replace
accepted_at with seconds_late, that method will no longer return
a Duration; it will return an integer number of seconds.

closes CNVS-38000

Test Plan:
1. Verify responses from the submissions API no longer return the
   accepted_at field on submissions.
2. Verify responses from the submissions API now return a field named
   seconds_late instead of duration_late
3. Verify the submissions API documentation no longer includes
   information about the accepted_at field, and documentation for
   duration_late has been renamed to seconds_late.

Change-Id: I903dedd45bcb822109d78ff815d6cecd2feb2a8d
Reviewed-on: https://gerrit.instructure.com/117657
Reviewed-by: Shahbaz Javeed <sjaveed@instructure.com>
Tested-by: Jenkins
Reviewed-by: Derek Bender <djbender@instructure.com>
QA-Review: KC Naegle <knaegle@instructure.com>
Product-Review: Neil Gupta <ngupta@instructure.com>
2017-07-06 16:22:19 +00:00
Rob Orton 7946f57107 return all warnings in sis batch error file
fixes CNVS-37888

test plan
 - run a sis import with more than 50 errors
 - should have all the errors in the error file
   and not just the first 50

Change-Id: Ib927b0aef1367ca7a7d21040d8eecdb80d341301
Reviewed-on: https://gerrit.instructure.com/117762
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-07-05 21:22:30 +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
Dan Minkevitch 3ff0b8e8c3 Format PlannerNote API responses
Fixes FALCOR-422
Fixes FALCOR-426

Test Plan:
* As a student
* In a course with Student Planner enabled
* And existing Planner Notes
* GET, PUT, POST, and DELETE from the `api/v1/planner_notes`
  endpoint
* The responses should all be JSON formatted correctly and
  return string IDs when the `Accept:
  application/json+canvas-string-ids` header is passed
* The `GET` index/list endpoint should not return deleted notes

Change-Id: I2435d62e8794aacbd4bb2d9484f9e89170187f4e
Reviewed-on: https://gerrit.instructure.com/116980
Reviewed-by: Clay Diffrient <cdiffrient@instructure.com>
Tested-by: Jenkins
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: Dan Minkevitch <dan@instructure.com>
2017-06-27 17:21:40 +00:00
Rob Orton 0956afd9e6 show errors_attachment in sis import api and ui
fixes CNVS-37717

test plan
 - run sis import that would generate errors
 - the json for the import api should have an
   errors_attachment object
 - the ui should have a download file option

Change-Id: I2c6f94b601be5777b8a57f4b5b56f9f2215869ec
Reviewed-on: https://gerrit.instructure.com/116523
Tested-by: Jenkins
QA-Review: Tucker McKnight <tmcknight@instructure.com>
Reviewed-by: Brent Burgoyne <bburgoyne@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2017-06-23 19:51:25 +00:00
wdransfield 9ac4eea42d Fix n+1 query in gradebook history feed endpoint
Closes PLAT-2686

Test Plan:
- As a student create submissions for several assignments
- Retrieve gradebook history via the api for that student:
  /api/v1/courses/<id>/gradebook_history/feed?user_id=<id>
- Verify that an n+1 query does not occure for originality
  reports. (the repeating query we want to avoid look something like this:
  SQL OriginalityReport Load (4.1ms)  SELECT "originality_reports"
  .* FROM "originality_reports" WHERE "originality_reports"
  ."submission_id" = 55487625)

Change-Id: Id5ba23772bc3eaa3b7ac253b4e6c61a8744ed6b3
Reviewed-on: https://gerrit.instructure.com/116270
Tested-by: Jenkins
Reviewed-by: Andrew Butterfield <abutterfield@instructure.com>
Reviewed-by: Keith T. Garner <kgarner@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Weston Dransfield <wdransfield@instructure.com>
2017-06-22 19:27:11 +00:00
Mysti Sadler 7a9ac20858 Allow planner items API to return all types of overrides
refs FALCOR-333

Test plan
- Create a quiz planner override for a quiz/announcement in Canvas
- POST /api/v1/planner/overrides -d 'plannable_type=quiz'
- POST /api/v1/planner/overrides -d 'plannable_type=announcement'
- Call GET /api/v1/planner/items and ensure the override
- shows up for that quiz/announcement
- Create a overrides on discussion topics/wiki pages
- or other types of items that could be graded
- and ensure they show up in the planner items override

Change-Id: I1bc18b7d80199bdad0cb59f7f27ab44c08442e64
Reviewed-on: https://gerrit.instructure.com/116015
Tested-by: Jenkins
Reviewed-by: Steven Burnett <sburnett@instructure.com>
QA-Review: Dan Sasaki <dsasaki@instructure.com>
Product-Review: Mysti Sadler <mysti@instructure.com>
2017-06-21 20:09:28 +00:00
Dan Minkevitch acafdcffc9 Add `plannable_date` to PlannerItems API
Closes FALCOR-375

Test Plan:
* As a student
* In a course with Student Planner enabled
* With various learning objects with associated
  todo_dates, due dates, posted dates, etc
* GET /api/v1/planner/items
* The response should contain a `plannable_date` for each
  object, with the date reflecting (in order of presence)
  todo_date, due_at, posted_at, or created_at

Change-Id: I3058f265cd91ef4e4f41b1266958a6cc049f213b
Reviewed-on: https://gerrit.instructure.com/116233
Tested-by: Jenkins
Reviewed-by: Mysti Sadler <mysti@instructure.com>
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: Dan Minkevitch <dan@instructure.com>
2017-06-21 18:23:11 +00:00
Dan Minkevitch 8f40c14268 BookmarkedCollection for Planner API
Closes FALCOR-325
Fixes FALCOR-361

Test Plan
Date Range Testing:
* With "Student Planner" enabled
* As a student
* Make a GET request to /api/v1/planner/items
  with ?start_date=YYYY-MM-DD&end_date=YYYY-MM-DD&filter=new_activity
* The response should only contain results with new activity
  between those time ranges (test with dates and dates with times)

Pagination Testing:
* With "Student Planner" enabled
* As a student
* Make a GET request to /api/v1/planner/items
  with some combination of start_date, end_date, and filter
* Include a a `per_page` param
* The response should only contain only `per_page` number of
  results
* The response should contain a `Link` header with links to the
  current, next, and previous pages (you should see a URL with
  a `page=bookmark:[bunch of characters]`)
* Copy the `page` param from the `Link` header for the next
  page of results
* Make a request with the newly copied `page=bookmark:[stuff]`
  parameter added to the request
* You should get the next page of results in the response
* The previous and next URLs in the `Link` response header should
  return the previous and next page of results

Regression Testing:
* Full regression test of "New Student Planner"

Change-Id: Ie6352aec71f5de3c60981aaeee65119cc43ed6f7
Reviewed-on: https://gerrit.instructure.com/114848
Reviewed-by: Steven Burnett <sburnett@instructure.com>
Tested-by: Jenkins
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: Dan Minkevitch <dan@instructure.com>
2017-06-20 20:14:20 +00:00
Brad Humphrey c3978bbeac allow post_to_sis to be set via the POST
test plan:
 - set an account to default post_to_sis on
 - create an assignment via the api with post_to_sis = false
 - verify that the assignment was created with post_to_sis = false

fixes SIS-2871

Change-Id: I0eda67788445ad3899f80acf3e1a768dd3b63f3e
Reviewed-on: https://gerrit.instructure.com/115859
Reviewed-by: Nick Houle <nhoule@instructure.com>
QA-Review: Mark McDermott <mmcdermott@instructure.com>
Tested-by: Jenkins
Product-Review: Brad Humphrey <brad@instructure.com>
2017-06-20 19:42:01 +00:00
Dan Minkevitch fff991435f Fix date handling for Planner Items API
Closes FALCOR-361

Test Plan:
* With "Student Planner" enabled
* As a student
* Make a GET request to /api/v1/planner/items
  with ?start_date=YYYY-MM-DD&end_date=YYYY-MM-DD&filter=new_activity
* The response should only contain results with new activity
  between those time ranges (test with dates and dates with times)

Change-Id: I575d99fba4128b695f38bb552c82ad9414137fca
Reviewed-on: https://gerrit.instructure.com/116101
Reviewed-by: Steven Burnett <sburnett@instructure.com>
Tested-by: Jenkins
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: Dan Minkevitch <dan@instructure.com>
2017-06-19 20:21:11 +00:00
Rob Orton 00390bf226 show the correct url for pagination on groups
fixes gh-1055

test plan
 - Execute API call to get a list of external tools associated with a group:
GET /api/v1/groups/2921/external_tools?include_parents=true
 - Examine the headers on the response. The Link header for retrieving more pages should point at:
/api/v1/groups/2921/external_tools?include_parents=true&page=2&per_page=10

Change-Id: Ied9bdb3ea36384faa2148f199047bebe87837aed
Reviewed-on: https://gerrit.instructure.com/115211
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2017-06-16 13:57:24 +00:00
Brian Park add9f15213 allow arranging gradebook assignment columns by module
closes CNVS-31861

test plan:
* Create a course without any modules and ensure it has at least
  two assignments and two students enrolled in it
* Create a course with two modules and at least two assignments
  in each module and an additional two assignments outside of
  any modules

* Go to Gradezilla for Course 1
* Verify that the "View > Arrange By" menu does not show any way
  to sort by modules

* Go to Gradezilla for Course 2
* Verify that the "View > Arrange By" menu shows two new options
  labelled
  - "Modules - First to Last"
  - "Modules - Last to First"
* Choose "View > Arrange By > Modules - First to Last"
* Verify that the assignment columns are arranged in the same
  order as they are on the modules page
* Verify that all assignments not in any modules show up at the
  end of the assignment columns
* Verify that all assignments not in any modules show up in the
  same order as they are on the assignments page

* Choose "View > Arrange By > Modules - Last to First"
* Verify that the assignment columns are arranged in the reverse
  order of the one they are in on the modules page
* Verify that all assignments not in any modules show up at the
  front of the assignment columns
* Verify that all assignments not in any modules show up in the
  same order as they are on the assignments page

* Go to the Modules page and drag/drop the assignments and
  modules to different locations and verify those orders are
  preserved when you go to Gradezilla and arrange assignment
  columns by modules.
* Go to the Assignments page and drag/drop the assignments and
  verify those orders are preserved when you go to Gradezilla
  and arrange assignment columns by modules

Change-Id: I4a4b56f18c7a24272d6c11590bdc8a0d9d55c356
Reviewed-on: https://gerrit.instructure.com/114485
Tested-by: Jenkins
Reviewed-by: Spencer Olson <solson@instructure.com>
QA-Review: KC Naegle <knaegle@instructure.com>
Product-Review: Christi Wruck
2017-06-14 19:51:25 +00:00
Dan Minkevitch 743bdfee29 Add "new_activity" filter and "submitted" key
Closes FALCOR-332

Test Plan:
* As a student
* In a course with the new Student Planner enabled
* With assignments that have submissions
  with comments/feedback, as well as unread
  discussion topics
* GET /api/v1/planner/items?filter=new_activity
* It should respond with only those items that have
  unread/unviewed activity
* Additionally, the `submitted` key in the `submissions` object
  should be `true` for items with submissions

Change-Id: I776ef9113e6c29f9958c8a22ff86227daf88239c
Reviewed-on: https://gerrit.instructure.com/114730
Tested-by: Jenkins
Reviewed-by: Mysti Sadler <mysti@instructure.com>
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: Dan Minkevitch <dan@instructure.com>
2017-06-14 17:01:25 +00:00
Dan Minkevitch c1eb9c2e3f Add planner overrides to missing submissions API
Closes FALCOR-345

Test Plan:
* As a student
* In a course with "Student Planner" enabled
* With missing submissions for the current user
* And planner overrides created for at least one
  of the missing assignments
* GET /api/v1/user/:user_id/missing_submissions
* The endpoint should return missing submissions
* Repeat the request with `?include[]=planner_overrides` passed
  as a parameter/query string
* The response should be the same as above, but include a
  `planner_override` key that contains the JSON data for the
  associated planner override

Change-Id: Ibcd809a6344c5ceef7018fdf9027da1f4b1d784e
Reviewed-on: https://gerrit.instructure.com/115179
Reviewed-by: Steven Burnett <sburnett@instructure.com>
Tested-by: Jenkins
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: Dan Minkevitch <dan@instructure.com>
2017-06-14 17:00:11 +00:00
Michael Brewer-Davis 346fa6f0b9 add course uuid to api response
closes OUT-1317

Test plan:
1.  Create a course in Canvas
2.  Visit
      domain.canvas/api/v1/courses/<course_id>
3.  Verify that "uuid" field is present in JSON
    response

Change-Id: I4a504061a0af55ce635be13e71fa873abd88748c
Reviewed-on: https://gerrit.instructure.com/114839
Tested-by: Jenkins
Reviewed-by: Matt Berns <mberns@instructure.com>
QA-Review: Leo Abner <rabner@instructure.com>
Product-Review: Michael Brewer-Davis <mbd@instructure.com>
2017-06-13 03:19:39 +00:00
wdransfield bda9803bf2 Add launch to submission details modal
Closes PLAT-2544

Test Plan:
- Create a course with a student and a tool that allows
  the student to return an ltiLaunchUrl as an outcomes
  service message.
- Submit to the assignment as the student
- Go to the gradebook and click the comment bubble to open a modal
- Verify the submission URL does the LTI launch
  returned when the submission was created.

Change-Id: I61bf8d0cb9205d3bef864b64f0ebe392c118ded1
Reviewed-on: https://gerrit.instructure.com/114303
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-06-09 13:31:25 +00:00
Neil Gupta 5afdacd654 Return all submissions, even placeholders, in API
Fixes CNVS-37333

Test plan:
* Create a course
* Enroll 2 students
* Create an assignment
* Visit api/v1/courses/:course_id/assignments/:assignment_id/submissions
* Make sure 2 placeholder submissions are returned

Change-Id: I745a3bdce2b76be35aee3382b36e32e7698a86ae
Reviewed-on: https://gerrit.instructure.com/114276
Tested-by: Jenkins
Reviewed-by: Spencer Olson <solson@instructure.com>
Reviewed-by: Derek Bender <djbender@instructure.com>
Reviewed-by: Jeremy Neander <jneander@instructure.com>
Reviewed-by: Keith T. Garner <kgarner@instructure.com>
QA-Review: KC Naegle <knaegle@instructure.com>
Product-Review: Neil Gupta <ngupta@instructure.com>
2017-06-07 21:41:51 +00:00
Rob Orton 08e1e7b3f9 show enrollments in deleted courses as deleted in api
fixes CNVS-36193

test plan
 - have enrollments in a course
 - update the course or sections workflow_state to
   ‘deleted’ through a sis import
 - hit the enrollments api for a user
 - the enrollment_state should be ‘deleted’
   GET /api/v1/users/:user_id/enrollments

Change-Id: I93c4be2be6851e8cbd986d405f544338b840f715
Reviewed-on: https://gerrit.instructure.com/112472
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-07 19:18:54 +00:00
Dan Minkevitch 565f371fde Add submission status & activity to PlannerItem API
Closes FALCOR-297

Test Plan:
* As a student
* In a course with the new Student Planner enabled
* With assignments with various submission states
  such as missing, late, graded, excused, etc
* GET /api/v1/planner/items
* The response should contain a "submissions" key
  whose value is reflected by the current status of the
  assignment, if it can be submitted, or `false` otherwise

Change-Id: I5c6703f930d7c5c13c77fdea8e01c6e31946ce43
Reviewed-on: https://gerrit.instructure.com/114007
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-06-07 17:44:38 +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
Steven Burnett c6d6a9ceae add ungraded discussion topics to planner
fixes FALCOR-262

Test Plan:
- Hit the planner_items root route
- Notice it now gives you ungraded discussion
  topics

Change-Id: I8c543a154a16b9eaaf29dad03b59038e65065bad
Reviewed-on: https://gerrit.instructure.com/113000
Reviewed-by: Mysti Sadler <mysti@instructure.com>
Tested-by: Jenkins
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: Steven Burnett <sburnett@instructure.com>
2017-05-30 22:01:46 +00:00
Dan Minkevitch 4de6dffa3a Add PlannerNotes to API
Closes FALCOR-261

Test Plan:
* With the student planner feature enabled
* As a student
* Create a Planner Note via the API
  POST /api/v1/planner_notes
  todo_date: today
* List the Planner Items via the API
  GET /api/v1/planner/items
* Your newly created note should be included
  in the returned list of planner items

Change-Id: I609f4e0cbd205a66e08215948bde183d1dc62202
Reviewed-on: https://gerrit.instructure.com/113504
Reviewed-by: Steven Burnett <sburnett@instructure.com>
Tested-by: Jenkins
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: Dan Minkevitch <dan@instructure.com>
2017-05-30 18:13:35 +00:00
Keith Garner 1cd6529c44 add points_deducted and duration_late to submission serializers
Added the new field of points_deducted and duration_late as default
fields to the submission_json method.  Also removes the unused late?
method from QuizSubmission

closes CNVS-32371

test plan:
 - Have a course with a student and an assignment
 - Hit the API endpoint of /api/v1/courses/{course_id}/assignments/{assignment_id}/submissions
 - note the presense of the points_deducted and duration_late fields

Change-Id: I0047cf7d78973bd7602ca373ac5b7d11dd5f2ff4
Reviewed-on: https://gerrit.instructure.com/113039
Reviewed-by: Brian Park <brian@siimpl.io>
Tested-by: Jenkins
Reviewed-by: Derek Bender <djbender@instructure.com>
QA-Review: Indira Pai <ipai@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2017-05-26 22:51:24 +00:00
Mysti Sadler a0e29fd75d Wiki Pages for student planner
closes FALCOR-260

Test plan
- Set up some Wiki Pages with to do dates
- Call API /api/v1/planner/items as a student
- Ensure pages are shown if the student should
- see them
- Ensure the student doesn't see pages they shouldn't
- (ie, conditional release, or missing todo dates)

Change-Id: I6cf45e1c19f5a8314912814d9b0263857ce5edb5
Reviewed-on: https://gerrit.instructure.com/112482
Tested-by: Jenkins
Reviewed-by: Steven Burnett <sburnett@instructure.com>
QA-Review: Dan Sasaki <dsasaki@instructure.com>
Product-Review: Mysti Sadler <mysti@instructure.com>
2017-05-26 21:31:37 +00:00
Simon Williams 1ac113a742 return correct status (200) for successful assignment api update
closes gh-979

test plan:
- basic regression of creating/editing assignments
- create api call should return 201, update should return 200

Change-Id: I8af9170c1432ff5124b09ace61fcb7b8bb5ae16d
Reviewed-on: https://gerrit.instructure.com/112570
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Ryan Shaw <ryan@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2017-05-25 22:10:32 +00:00
Dan Minkevitch a04b0db6e9 Add date range, pagination, and submitted assignments
Closes FALCOR-183
Closes FALCOR-185
Closes FALCOR-257

Test Plan:
* With new planner enabled
* As a student
* With assignments that have submissions
* Hit the `api/v1/planner/items` endpoint
* See that the submitted assignments are included
  in the response
* Hit `api/v1/planner/items?due_after=YYYY-MM-DD`,
  `api/v1/planner/items?due_before=YYYY-MM-DD`, &
  `api/v1/planner/items?due_before=YYYY-MM-DD&due_after=YYYY-MM-DD`,
  replacing YYYY-MM-DD with some date in that format
* The response should only contain objects within that range
* Hit any of the above URLs, appending `&per_page=X&page=Y`,
  replacing `X` with a limit for number of items returned,
  and `Y` with the page of items to return
* The response should contain `X` amount of objects, starting
  from page `Y`

Change-Id: I63fc108107fda07f674ef7a5465125b185c0c510
Reviewed-on: https://gerrit.instructure.com/112386
Reviewed-by: Mysti Sadler <mysti@instructure.com>
Tested-by: Jenkins
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: Dan Minkevitch <dan@instructure.com>
2017-05-25 21:25:03 +00:00
Simon Williams f20a840f70 mark content exports older than 30 days as expired
closes CNVS-37071

test plan:
- export course content, user content, and a folder
- tweak their created_at dates
- try different values of Setting.get('content_exports_expire_after_days', '30')
- the UI should show expired and api should not return an attachment url

Change-Id: I91923666752bc1e5d11f1e5319a83e040a363d41
Reviewed-on: https://gerrit.instructure.com/112720
Reviewed-by: Rob Orton <rob@instructure.com>
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Tucker McKnight <tmcknight@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2017-05-23 19:51:12 +00:00
Derek Bender 6a4e784148 add cell styles to gradebook
closes CNVS-31858

test plan
 - Given a gradezilla enabled gradebook
 - Given submissions that are late, missing, resubmitted, dropped, and
   excused
 - When a submission is late
 - Then the cell color is blue
 - When a submission is missing
 - Then the cell color is purple
 - When a submission is resubmitted
 - Then the cell color is green
 - When a submission is dropped
 - Then the cell color orange
 - When a submission is excused
 - Then the cell color is yellow

 - Given multiple students in the course to verify zerbra striping of
   state colors
 - When on the gradebook page
 - Then even rows are lighter
 - Then odd rows are darker

Change-Id: I9231f454b6982e1c7dc9c95d5eaed11140d2d3bc
Reviewed-on: https://gerrit.instructure.com/110818
Reviewed-by: Jeremy Neander <jneander@instructure.com>
Tested-by: Jenkins
QA-Review: KC Naegle <knaegle@instructure.com>
Product-Review: Christi Wruck
2017-05-19 16:25:07 +00:00
Neil Gupta f0a3595015 Add late policy status support to submission controller
Fixes CNVS-32372

Test plan:
* Create a course
* Enroll a student
* Create an assignment
* 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'
}

* Make sure the json response includes the right late policy status.
* Load the submission in rails console and make sure its late policy
  status is set.

You can pass 'missing', 'late', 'none', or null for late policy status
If status is 'late', then you can also include an `accepted_at`
timestamp that should also persist. If status is anything else,
accepted_at will be automatically cleared and fall back to submitted_at

Change-Id: I7f4032af520c44e5095da95ead03f0c0c987ef3f
Reviewed-on: https://gerrit.instructure.com/111439
Tested-by: Jenkins
Reviewed-by: Keith T. Garner <kgarner@instructure.com>
Reviewed-by: Matt Taylor <mtaylor@instructure.com>
QA-Review: KC Naegle <knaegle@instructure.com>
Product-Review: Neil Gupta <ngupta@instructure.com>
2017-05-17 22:59:26 +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
Matthew Berns dfc78d9b2c correct group overrides on existing assignments
fixes OUT-1032

test plan:
- ensure you have at least 1 active group in course
- create and save an assignment
- return to the assignment edit page
- make the assignment a group assignment
- attach a set of override dates to the group
- you should be able to successfully save the assignment

Change-Id: I1b6747336d933a8144c1a4e50ef011345697066e
Reviewed-on: https://gerrit.instructure.com/111875
Tested-by: Jenkins
Reviewed-by: Michael Brewer-Davis <mbd@instructure.com>
QA-Review: Andrew Porter <hporter-c@instructure.com>
Product-Review: McCall Smith <mcsmith@instructure.com>
2017-05-17 19:05:18 +00:00
Marco Bergantin 9861e5faea Whitelist virtual attribute locked for quiz locking via UI
Since rails 4.2 and strong parameters the lock quiz feature via web UI
isn't working anymore

closes gh-1036

Test Plan:
  - Create a new Quiz
  - Click on menu item "Lock this Quiz Now" on show page
  - After redirect a notification shows "Quiz successfully updated"
  - The Quiz now should be locked and the previous menu item should be
    labeled "Let Students Take this Quiz Now"

Change-Id: I60a456f0860c9d233304e3febe5ffb0a08953fa4
Reviewed-on: https://gerrit.instructure.com/111770
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins
QA-Review: Michael Hargiss <mhargiss@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2017-05-15 19:38:05 +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
James Williams 25758ccbfc don't overwrite assignment override title when updating due date
test plan:
* have a course with a student
* create an assignment and assign it only to the one student
 with a given due date
* open the course calendar
* click on the assignment (the title should include
 "1 student")
* edit the due date (while still on the calendar)
* save it
* the title on the calendar should still say
 "1 student" and not "No students"

closes #CNVS-36813

Change-Id: I25a3179c4e9ab30452c2615d94115c6f3f61e987
Reviewed-on: https://gerrit.instructure.com/111335
Tested-by: Jenkins
Reviewed-by: Ed Schiebel <eschiebel@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2017-05-11 16:51:42 +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
James Williams 7366f77614 preserve links in announcement list
test plan:
* set up a course to show announcements on home page
* create an announcement with a link
* it should show the link in the announcements list

closes #CNVS-36278

Change-Id: I20296ab5f2d08d4cf30f296dab4b1957482b9e13
Reviewed-on: https://gerrit.instructure.com/110333
Tested-by: Jenkins
Reviewed-by: Dan Minkevitch <dan@instructure.com>
QA-Review: Robert Lamb <rlamb@instructure.com>
Product-Review: Chris Ward <cward@instructure.com>
2017-05-08 16:41:21 +00:00
Cody Cutrer 99f5b454ed refactor and unify User#find_pseudonym_for_account and SisPseudonym
fixes CNVS-35919

also, prefer SIS pseudonyms over non-SIS pseudonyms from any given
account

test plan:
 * have a non-SIS pseudonym and a SIS pseudonym on a user
 * do an LTI launch
 * the LTI tool should get the info from the SIS pseudonym

Change-Id: I60a3c48a32eae94db93b0e72f1f0f6c5b6a5f5c2
Reviewed-on: https://gerrit.instructure.com/107785
Reviewed-by: Nathan Mills <nathanm@instructure.com>
Reviewed-by: Tyler Pickett <tpickett@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Tested-by: Jenkins
Product-Review: Cody Cutrer <cody@instructure.com>
2017-05-02 18:50:31 +00:00
Jeremy Stanley 4e01ef33a4 add blueprint unsynced changes endpoint
test plan:
 - set up a blueprint course and do an initial sync
 - create, update, and delete objects in the blueprint
 - before performing another sync, call the unsynced_changes
   endpoint and see that your changes are returned

closes MC-172

Change-Id: I6ff383a34b66217199923ed49b0456ff2f5e5be4
Reviewed-on: https://gerrit.instructure.com/110086
Tested-by: Jenkins
Reviewed-by: James Williams  <jamesw@instructure.com>
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2017-05-02 16:31:08 +00:00
Jeremy Stanley 83e392a0af API for returning blueprint migration results
test plan:
 - render documentation
 - test the "Get migration details" endpoint:
   - starting both with a blueprint course and a minion course
   - ensure a teacher without rights on the blueprint cannot
     call the endpoint on the blueprint (but can still call
     on a minion)
 - ensure creates, deletes, updates, and exceptions (for
   changed minion content) are returned as expected
   (exceptions show what type of content changed in the minion
    course to prevent the update from being synced:
    'content', 'points', 'due_dates', or 'availability_dates')
 - ensure when calling on a minion course, only exceptions
   for that minion course are returned
 - ensure the html_url retrieved links to the copy of the asset
   in the course the API endpoint is called on (master or minion)

closes MC-119

Change-Id: I73cf52304b080bbe564779294b53b4991700f0f8
Reviewed-on: https://gerrit.instructure.com/104789
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-01 16:26:08 +00:00
Landon Wilkins 014cc7368c da licença part 25
add consistent license headers to all source files
(ruby, coffeescript, javascript)

except for vendor files

Change-Id: Ic87c252aa2a2e2739d61ee9164431698e8d7e547
Reviewed-on: https://gerrit.instructure.com/110048
Tested-by: Jenkins
Reviewed-by: Jon Jensen <jon@instructure.com>
Product-Review: Jon Jensen <jon@instructure.com>
QA-Review: Jon Jensen <jon@instructure.com>
2017-04-27 21:51:40 +00:00
Jeremy Stanley 1eafcea81b Add comment to blueprint migration
test plan:
 - when starting a blueprint migration via the API, you should be
   able to add a comment via the `comment` parameter
 - when listing blueprint migrations, the comment should be
   included

closes MC-167

Change-Id: Ib91dc8917f736c217b2cc02d253c344fb1c14c3e
Reviewed-on: https://gerrit.instructure.com/109666
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-04-26 13:17:42 +00:00
Jacob Fugal 547ca9f669 don't ignore address_book cache
don't need to preload users that are already in the cache. not
functionality change, just performance

test-plan: N/A

Change-Id: I34aecd97a35619718a7c66c902974d3b2cec09ae
Reviewed-on: https://gerrit.instructure.com/109287
Reviewed-by: Jonathan Featherstone <jfeatherstone@instructure.com>
Tested-by: Jenkins
Product-Review: Jacob Fugal <jacob@instructure.com>
QA-Review: Jacob Fugal <jacob@instructure.com>
2017-04-20 22:16:50 +00:00
wdransfield 25baa102e3 Include account uuid in api response
Closes PLAT-2484

Test Plan:
Exercise the account index and show endpoints. Verify that
a parameter named 'uuid' is included in the response and
is set to the correct account uuid.

Change-Id: I40a30c638fd424d6d9fecacaeeb93f684575fd30
Reviewed-on: https://gerrit.instructure.com/108815
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Weston Dransfield <wdransfield@instructure.com>
2017-04-19 17:16:20 +00:00
James Williams d8ab3ffa26 master courses: fix assignment override locking
don't forbid if there are no overrides

Change-Id: If64e4dc4fb717433f3f8f84a8ff49ad3515aac45
Reviewed-on: https://gerrit.instructure.com/107745
Tested-by: Jenkins
QA-Review: Heath Hales <hhales@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2017-04-10 15:48:11 +00:00
Graham Ballantyne e359c8d187 Add notes & additional stats to Developer Keys page
This commit enhances the Developer Keys page in two ways:

Notes field:
A notes field is added on the `developer_keys` table. When creating a
key, there is sometimes a need to record more information (for example,
a ticket number for the request, information on how the key is to be
used, etc). The notes field is exposed in the developer key listing, in
the API response, and in the dialog for creating/editing a key.

Usage stats:
While adding the notes field, I found a `TODO` marker for "add some
better stats here, like token count, last usage, etc.". Mark that `TODO`
as `DONE`! This PR adds two methods to the `DeveloperKey` model:
`access_token_count` and `last_used_at`. These fields are returned in
the API response, and are displayed in the Stats column on the Developer
Key page.

Test Plan:
- Add a new developer key. There should be a notes field present in the
  form and it should save the value of the field when creating the key.
- Edit the key; you should be able to update the notes field.
- Assign access tokens using the developer key. The usage information
  should be reflected in the stats for that key.
2017-04-05 14:06:45 -07:00
Jeremy Stanley c3b7a550f6 Display "Limit this slot to [ ] groups" for group signups
test plan:
 - have two appointment groups with upcoming time slots
 - make one of these appointment groups sign up groups instead of
   individual users
 - edit time slots for each appointment group
 - ensure the text at the bottom shows
   "Limit this slot to [ ] groups" for the appointment group that
   signs up students by group, and "users" for the other one

fixes CNVS-35745

Change-Id: I639d1f07d5e7e51dca37e15e89a0d76ea24f1602
Reviewed-on: https://gerrit.instructure.com/106599
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-03-31 22:45:42 +00:00
Dan Minkevitch deddbf8b27 Change permission check to :read for migration auditing
Refs CNVS-29501

Test Plan:
* In a course, create some content migrations by exporting/importing
  course content
* GET /api/v1/courses/:course_id/content_migrations/:id
  using site admin credentials
* The response should contain infomation within an `audit_info` key
* Hit the same endpoint with teacher, student, or other non-site-admin
  credentials
* The API should not contain the extra information and should behave
  as before

Change-Id: I3a5eb7c3ccd0165dc4e362909a42abb26bb96a02
Reviewed-on: https://gerrit.instructure.com/106182
Tested-by: Jenkins
Reviewed-by: James Williams  <jamesw@instructure.com>
Product-Review: Dan Minkevitch <dan@instructure.com>
QA-Review: Dan Minkevitch <dan@instructure.com>
2017-03-31 21:21:19 +00:00
James Williams f430cd18c3 master courses: handle assignment overrides when date-restricted
ignores assignment overrides when updating on the backend
if date-restricted and deletes existing ones on import
when restrictions are added later

also some other stuff that snuck in

closes #MC-135

Change-Id: Iade3a64740ce04388bd5d97fc860fbcf7a6ca99f
Reviewed-on: https://gerrit.instructure.com/106848
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Jenkins
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2017-03-30 17:21:46 +00:00
Neil Gupta 017c734ccb Add has_weighted_grading_periods flag to course api response
Fixes CNVS-35910

Test plan:
* Hit `@GET("/courses/{courseid}?include[]=term&include[]=permissions&include[]=license&include[]=is_public&include[]=needs_grading_count&include[]=total_scores&include[]=current_grading_period_scores")`
* Make sure it includes a `has_weighted_grading_periods` boolean attr
* Make sure the value reflects the weighted value of the course's
  grading period set
* Remove `&include[]=current_grading_period_scores` from the get request
* Make sure `has_weighted_grading_periods` is not included anymore

Change-Id: I96ea26b568e3ba3a6bf6eb3f1a03c7c0df7dcf5c
Reviewed-on: https://gerrit.instructure.com/106439
Tested-by: Jenkins
Reviewed-by: Spencer Olson <solson@instructure.com>
Reviewed-by: Jeremy Neander <jneander@instructure.com>
QA-Review: Anju Reddy <areddy@instructure.com>
Product-Review: Neil Gupta <ngupta@instructure.com>
2017-03-28 00:02:15 +00:00
James Williams 2651bd5c85 don't show email/login_id for users with pending enrollments
test plan:
* invite a student to a course
* the people page shouldn't show their login id or email
* accept the invitation
* now the login id should be shown

closes #CNVS-34920

Change-Id: I621ea2c6ceeae4de53b923bf51300aa9bba832de
Reviewed-on: https://gerrit.instructure.com/105942
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: Chris Ward <cward@instructure.com>
2017-03-27 12:27:59 +00:00
James Williams fe2e86c9a2 provide default from name in admin communication messages api
closes #CNVS-35558

Change-Id: I4601d55603563bfc3f9383079528f8270935d636
Reviewed-on: https://gerrit.instructure.com/105949
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-03-23 14:17:51 +00:00
James Williams 92d33c5cd2 master courses: add helper method to load data in js_env
also refactor some stuff to make the distinction clearer
between child-side restrictions and master-side restrictions

closes #MC-126

Change-Id: Ib630022ce7f1d4bfe2461221787b3b942c22da67
Reviewed-on: https://gerrit.instructure.com/105407
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Jenkins
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2017-03-22 13:51:16 +00:00
James Williams a631102d3f strip html out of body on recent announcements
test plan:
* enable the recent announcements list on the course home
 (when set to show the front page)
* an announcement with html content should only show text
 (and not the html tags)

closes #CNVS-35565

Change-Id: I5162a32caa7da6fa88c5168c0b8791ae0ae38ed5
Reviewed-on: https://gerrit.instructure.com/105680
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Heath Hales <hhales@instructure.com>
Product-Review: Chris Ward <cward@instructure.com>
2017-03-22 12:37:22 +00:00
Spencer Olson 3f174be127 use scores table instead of grade calculator
Stop using the grade calculator to get grading period scores and
instead fetch the values from the scores table.

closes CNVS-35213

test plan:

1. Verify the "Multiple Grading Periods" account report runs and
   returns accurate student scores.
2. Verify the courses API returns accurate scores when you
   request 'current_grading_period_scores' as a student. Create an API
   key for a student and then make the following request:
   api/v1/courses/:course_id/?include[]=enrollments&include[]=
   current_grading_period_scores&include[]=total_scores

Change-Id: Ifdb8cd602935d1d0d97f301233a185024e6882a2
Reviewed-on: https://gerrit.instructure.com/104776
Reviewed-by: Jeremy Neander <jneander@instructure.com>
Tested-by: Jenkins
Reviewed-by: Neil Gupta <ngupta@instructure.com>
QA-Review: Anju Reddy <areddy@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2017-03-17 17:15:39 +00:00
Andrew Butterfield 692ced4566 Fix double escape in sessionless launch url
fixes PLAT-2069

Test plan:
* go through the repo steps in the ticket
* ensure that the data-api-endpoint url query param is not double url
  encoded

Change-Id: I3d6144202f6ec613e3aa38908d7e2dfef87ba460
Reviewed-on: https://gerrit.instructure.com/105337
Tested-by: Jenkins
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Andrew Butterfield <abutterfield@instructure.com>
2017-03-16 22:14:33 +00:00
Cody Cutrer ce21af8ecf rails 5: find and fix lots of deprecation warnings [ci verbose]
refs CNVS-34843

Change-Id: Idd523c2a7c37325381d590f1ee70c406ace2a459
Reviewed-on: https://gerrit.instructure.com/105033
Tested-by: Jenkins
Reviewed-by: Rob Orton <rob@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2017-03-16 16:03:51 +00:00
Matthew Berns f2bd113e02 fix points possible not being saved for graded surveys
fixes CNVS-35100

test plan:
- create a graded survey quiz and assign a point value
- create at least one question for the survey that has
  points
- the point total after saving should match the total
  specified when creating the quiz, not the total point
  value of the question(s)

Change-Id: I4394d400f77971081a09c20ecb64880a68f3e389
Reviewed-on: https://gerrit.instructure.com/104969
Reviewed-by: Augusto Callejas <acallejas@instructure.com>
Reviewed-by: Davis Lynn McClellan <dmcclellan@instructure.com>
QA-Review: Indira Pai <ipai@instructure.com>
Product-Review: Jason Sparks <jsparks@instructure.com>
Tested-by: Jenkins
2017-03-15 21:31:59 +00:00
Spencer Olson fee3b6f992 remove feature flag and place on grading period set
The feature flag "Display Totals for All Grading Periods"
is removed and now lives as an option on grading period
sets. All courses using a given grading period set will
display or hide 'All Grading Periods' totals according to
the set's configuration.

closes CNVS-26713

test plan:

1. Verify the feature flag for 'Display Totals for All Grading Periods'
   is gone.
2. Verify the 'Display Totals for All Grading Periods' feature behaves
   the same way it always has, except for the fact that the feature is
   now a setting on grading period sets, meaning a course should show
   or hide 'All Grading Periods' totals based on the setting of its
   associated grading period set.

Change-Id: Ia445c4a66f98587b556fbdb8ce94b4b8b0d03187
Reviewed-on: https://gerrit.instructure.com/104191
Reviewed-by: Neil Gupta <ngupta@instructure.com>
Tested-by: Jenkins
QA-Review: KC Naegle <knaegle@instructure.com>
Product-Review: Neil Gupta <ngupta@instructure.com>
2017-03-15 19:54:16 +00:00
Blake Allan 9a04032a6d add 'LaTeX: ' prefix to the equation alt attributes from equation editor
Fixes: CNVS-29738

Test Plan:
With an RCE view open, click the insert math equation button
Create a math equation and click insert equation
Ensure that the equation image alt attribute is prefixed by 'LaTeX: '

Change-Id: I6df61e83de9820f54757bbfdd3065275889df88c
Reviewed-on: https://gerrit.instructure.com/102708
Tested-by: Jenkins
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2017-03-14 04:45:00 +00:00
Cody Cutrer 6751891617 rails 5: fix lots of deprecation warnings
mostly s/uniq/distinct/, and choosing a content type for render :text

Change-Id: I53a2e77d23ecc43162f70b4fd88303cc1539c20b
Reviewed-on: https://gerrit.instructure.com/104762
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-03-13 19:07:11 +00:00
Brad Humphrey e9231a6428 use mastery path override as default due date
test plan
 * create an assignment
 * assign it to Mastery Paths with a due date
 * the sis assignments api should show that the
   assignment is due_at the mastery path due date

fixes SIS-2758

Change-Id: Ia61762863c46bfc75aad4760a1fd567aa6e1a8f5
Reviewed-on: https://gerrit.instructure.com/104156
Reviewed-by: Stewie aka Nicholas Stewart <nstewart@instructure.com>
QA-Review: Mark McDermott <mmcdermott@instructure.com>
Tested-by: Jenkins
Product-Review: Brad Humphrey <brad@instructure.com>
2017-03-10 23:52:31 +00:00
wdransfield 0d32c11ceb Auto create subscription for tools associated with assignment
Test Plan:
- Verify the 'Canvas.placements.similarityDetection' capability
  no longer appears on the default TCP.
- Verify adding the 'restricted_capabilities' to a custom TCP
  allows you to see this placement.
- Install two LTI2 tools with the similarity detection
  placement and a service offered with an endpoint specified
  and an @id that ends with 'SubmissionEvent' (see
  github.com/westonkd/lti-test-tool/blob/master/config/toolProxy.js
  for an example.
- Create a new assignment using one of the two tools
  as the associated plagiarism detection tool.
- Verify a subscription is created for the tool with
  the following values set:
      ContextType: 'assignment'
      Format: 'live-event'
      ContextId: <id of assignment>
      EventTypes: ['submission_created']
      TransportType: 'https'
      TransportMetadata:{Url: <endpoint of the
                         submission event servce>}
- Edit the assignment just created and only change the name
- Verify another subscription is not created
- Edit the assignment and switch the plagiarism tool to the
  second tool.
- Verify a subscription is created
- Create an assignment with no plagiarism tool
- Verify a subscription is not created
- Install a tool with the same 'SubmissionEvent' service in
  the tool profile, but change the 'action' array to only
  inlcude a 'GET'.
- Attempt to associate an assignment with this newly installed
  tool and verify a error flash message is displayed

Closes PLAT-2287

Change-Id: Ic20afbdb52c6b70d341a7b987345b4768bd0ab45
Reviewed-on: https://gerrit.instructure.com/103851
Reviewed-by: Andrew Butterfield <abutterfield@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Weston Dransfield <wdransfield@instructure.com>
2017-03-10 13:45:51 +00:00
Cody Cutrer d812a74977 rails 5: apis/v1 c-q
Change-Id: Ia1343f2590b87638264de5a1bf6e41eb78db4bd7
Reviewed-on: https://gerrit.instructure.com/104375
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-03-08 19:07:41 +00:00
Cody Cutrer f105926105 rails 5: api specs a
Change-Id: If119eb194d1a386bb89c39c1a52ce3ba58d07416
Reviewed-on: https://gerrit.instructure.com/104300
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-03-08 17:56:31 +00:00
Cody Cutrer ae0c85da6e rails 5: api specs s-u
Change-Id: I440c4b0fdc7a6a850b9c264835ea1a85f65c4363
Reviewed-on: https://gerrit.instructure.com/104401
Tested-by: Jenkins
Reviewed-by: Rob Orton <rob@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2017-03-08 06:00:13 +00:00
Clay Diffrient c9fb9a4036 Update AssignmentConfigurationToolsSpec for React 15
closes CNVS-34830

Test Plan:
  - Using similarity detection tools with assignments should
    work as before

Change-Id: I0db913f9568c8983518921eb7a75f35aa0dab3ad
Reviewed-on: https://gerrit.instructure.com/101532
Tested-by: Jenkins
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Clay Diffrient <cdiffrient@instructure.com>
2017-03-07 21:00:14 +00:00
Cody Cutrer 4ec005d7fc rails 5: controllers q-r
refs CNVS-34864

Change-Id: I14f590aa5b5b7e97bd240aad7feaa74298567817
Reviewed-on: https://gerrit.instructure.com/104169
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-03-07 04:08:40 +00:00
Cody Cutrer a75f4394d2 rails 5: controller specs a-c
refs CNVS-34864

Change-Id: I1f2f422929049044f791113f4262c0b6971ececa
Reviewed-on: https://gerrit.instructure.com/103930
Reviewed-by: James Williams  <jamesw@instructure.com>
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-03-06 17:59:49 +00:00
Neil Gupta ec51d5843a Merge branch 'dev/weighted-grading' into master
Fixes CNVS-35214

Change-Id: I55a1d4a02ed2640ad3f147e2c5534ef8f747c2f4
2017-03-03 11:00:01 -06:00
Cody Cutrer cd6ffacee5 rails 5: fixes for spec/lib/a**_spec.rb
refs CNVS-34863

note that User#display_name doesn't exist; Rails 4.2 just ignored it, but
Rails 5 complains

Change-Id: I6fd84ea5304a402eb51e549af5e9a9600737e3fc
Reviewed-on: https://gerrit.instructure.com/103795
Reviewed-by: James Williams  <jamesw@instructure.com>
Tested-by: Jenkins
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2017-03-02 20:38:34 +00:00
Neil Gupta 91418b6e69 Merge branch 'master' into dev/weighted-grading
Change-Id: I6089b65927f24039e80369c5de7641922567b606
2017-02-28 22:06:16 -06:00
Neil Gupta e34d0de6a6 Merge branch 'master' into dev/weighted-grading
Fixes CNVS-35198
Fixes CNVS-34498

Change-Id: I7841fa62de2747654c3f4ad13c1124aeb10f6663
2017-02-28 16:36:42 -06:00
Omar Khan 65ee8163f9 New assignment page for Quizzes 2
closes QUIZ-1211

Test plan:
- Set up the Quizzes 2 external tool (https://goo.gl/7LpFYh)
- Go to /courses/:id/assignments/new?quiz_lti
- Description textarea should not be present
- 'Moderated grading' checkbox should not be present
- 'Lock assignment properties' checkbox should not be present
- Submission type should be set to 'External Tool'
- It should not be possible to change the submission type
- The external tool URL should be set to the Quizzes 2 URL
- The 'load in new tab' option should not be present
- Click 'Save'
- You should see the new LTI quiz creator tool

Change-Id: I6208dfd39c672d989ae116f9b5d026883b621f6a
Reviewed-on: https://gerrit.instructure.com/102366
Reviewed-by: John Corrigan <jcorrigan@instructure.com>
QA-Review: Michael Hargiss <mhargiss@instructure.com>
Product-Review: Jason Sparks <jsparks@instructure.com>
Tested-by: Jenkins
2017-02-23 23:31:13 +00:00
Spencer Olson fb9049324e set default values for booleans on various tables
This commit adds default values of false and not null constraints for
all boolean columns on the assignments, discussion_topics, and quizzes
tables. This commit also has a data fixup to backfill default values on
the boolean columns.

closes CNVS-34536

Test Plan:
* Do the following in a course with at least one closed grading period:
1. On the Assignments page, create an assignment with a due date in a
   closed grading period using the "+" button on an assignment group.
2. As a teacher, try to toggle the "Post to SIS" setting for the
   assignment from the Assignments page. Verify the setting changes.
3. Create a new assignment with a due date in a closed grading period
   using the "+Assignment" button.
4. As a teacher, try to toggle the post to SIS setting for the
   assignment from the Assignments page. Verify you can edit the
   setting as you toggle the button.

Change-Id: I7c799bb3b194363836d900287be90ca13805508e
Reviewed-on: https://gerrit.instructure.com/101315
Reviewed-by: Neil Gupta <ngupta@instructure.com>
Reviewed-by: Derek Bender <djbender@instructure.com>
QA-Review: Anju Reddy <areddy@instructure.com>
Tested-by: Jenkins
Product-Review: Keith T. Garner <kgarner@instructure.com>
2017-02-22 18:17:59 +00:00
Keith Garner 27434a1e94 allow current_grading_period_scores in courses_api#users
When returning enrollments, the courses#user and courses#users
endpoints will use the current grading period scores for the grades
section when current_grading_period_scores is added as an include.
Additionally, grading_period_id will be included in the scores. If
grading_period_id is nil, its an indication that there is no current
grading period and the score is a total score.

closes CNVS-34972

test plan:
 - Have a course with at least one student in a term that has a
   grading period group, with at least 2 grading periods
 - Create an assignment in each grading period with 10 points.
 - In the gradebook, score the assignment in the first grading period
   at 1 point, score the other at 6 points
 - As the teacher, visit the API end point
   /api/v1/courses/<:course_id>/users/?include[]=enrollments
 - In the json returned, note that grades in the enrollment for
   student match the expected final scores of 35.
 - As the teacher, visit the API end point
   /api/v1/courses/<:course_id>/users/?include[]=enrollments&include[]=current_grading_period_scores
 - In the json returned, note that grades in the enrollment for
   student match the expected grading period scores of 10.
 - As the teacher, visit the API end point
   /api/v1/courses/<:course_id>/users/<:student_id>?include[]=enrollments
 - In the json returned, note that grades in the enrollment for
   student match the expected final scores of 35.
 - As the teacher, visit the API end point
   /api/v1/courses/<:course_id>/users/<:student_id>?include[]=enrollments&include[]=current_grading_period_scores
 - In the json returned, note that grades in the enrollment for
   student match the expected grading period scores of 10.

Change-Id: Iaa74e7f5eec1b79af21c0b7fbb4f6e6f2b1e37c8
Reviewed-on: https://gerrit.instructure.com/102220
Reviewed-by: Neil Gupta <ngupta@instructure.com>
Reviewed-by: Derek Bender <djbender@instructure.com>
QA-Review: KC Naegle <knaegle@instructure.com>
Tested-by: Jenkins
Product-Review: Keith T. Garner <kgarner@instructure.com>
2017-02-22 18:17:30 +00:00
James Williams dfbef7aad3 master courses: add api for creating/monitoring migrations
test plan:
* use the API docs for the three new endpoints to
 queue migrations for a blueprint course
 and view migration information

closes #MC-95

Change-Id: Ie04baf7ac1623384413de19aa7d718c3419fdd1d
Reviewed-on: https://gerrit.instructure.com/102294
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-02-22 12:31:14 +00:00
James Williams 4490ab5897 fix quiz 'hide_results' parameter filtering
hide_results sometimes expects a hash instead of a scalar value

test plan:
* should be able to create/edit a quiz without
 "Let Students See Their Quiz Responses" checked and save
 the value correctly

closes #CNVS-35069

Change-Id: I29faaf0d3bec06fa8f05656cd83e0d617b5028b4
Reviewed-on: https://gerrit.instructure.com/102683
Reviewed-by: Marc Alan Phillips <mphillips@instructure.com>
QA-Review: Gentry Beckmann <gbeckmann@instructure.com>
Tested-by: Rob Orton <rob@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2017-02-18 20:05:01 +00:00
Dan Minkevitch 66f5ef2d4b Add additional fields to Content Migrations API
Closes CNVS-29501

Test Plan:
* In a course, create some content migrations by exporting/importing
  course content
* GET /api/v1/courses/:course_id/content_migrations/:id
  using site admin credentials
* The response should contain infomation within an `audit_info` key
* Hit the same endpoint with teacher, student, or other non-site-admin
  credentials
* The API should not contain the extra information and should behave
  as before

Change-Id: Ia121b2ff72e9be553c1de74be2fd259038526dc5
Reviewed-on: https://gerrit.instructure.com/102193
Tested-by: Jenkins
Reviewed-by: Mysti Sadler <mysti@instructure.com>
QA-Review: Heath Hales <hhales@instructure.com>
Product-Review: Dan Minkevitch <dan@instructure.com>
2017-02-16 21:44:24 +00:00
James Williams 62e410c4ba master courses: refactor api hooks to include master-side data
doesn't do anything yet but should make it easier when the
time comes to try to make our lock/unlock button component(s)

closes #MC-92

Change-Id: Iff72e2045f924afe64433a0e5686e077afdcb755
Reviewed-on: https://gerrit.instructure.com/102021
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Jenkins
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2017-02-16 17:43:22 +00:00
James Williams 090b7586a4 master courses: initial master templates API
test plan:
* generate API documentation
* use the "Blueprint Templates" API documentation to test
 the three new endpoints
 (#show, #associated_courses, #update_associations)

closes #MC-69

Change-Id: I1ac7e0c385721a67d815ed1b8f7ee065248b2650
Reviewed-on: https://gerrit.instructure.com/101590
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Jenkins
QA-Review: Heath Hales <hhales@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2017-02-16 16:31:52 +00:00
Brad Humphrey 8979e1010e Merge include student overrides in sis assignments api
Merge branch 'dev/sis/sis-assignments-api'

Test Plan:
 - Verify the api documentation has been updated
   to show student overrides
   (/doc/api/sis_integration.html#method.sis_api.sis_assignments)
 - Create users with SIS IDs
 - Create assignments with post_to_sis enabled
 - Request the endpoint specified in the api docs without include[]=
   * It should return assignments without student overrides
 - Request the endpoint with include[]=student_overrides
   * It should return assignments with student overrides and SIS IDs
 - The API behavior should match the documentation

fixes SIS-2700

Change-Id: Ife4a68f6bf376cf7b4cf6e6a2800994b15bb951d
2017-02-13 15:26:29 -07:00
Brad Humphrey c663e40d88 make inclusion of student_overrides more explicit
test plan:
  sis_assignments_api should still work as expected
  with and without the student_overrides include

refs SIS-2700
fixes SIS-2750

Change-Id: I1da6d75410578c78cf0ac4c8882317ae4a0b5ccd
Reviewed-on: https://gerrit.instructure.com/101928
Tested-by: Jenkins
Reviewed-by: Stewie aka Nicholas Stewart <nstewart@instructure.com>
Product-Review: Brad Humphrey <brad@instructure.com>
QA-Review: Brad Humphrey <brad@instructure.com>
2017-02-13 22:13:39 +00:00
Michael Nomitch e23555cece add anonymous_submissions to allowed quiz params
fixes CNVS-34706

also alphabetizes allowed params

test plan:
  - make a survey and go to edit page
  - toggle "Keep Submissions Anonymous"
    and hit save
  - on page refresh this change is
    persisted
  - change it back
  - this change persists as well
  - when toggled to be anonymous the
    survey is actually anonymous
    - in the quiz submissions page
      for this survey, you do not
      see the name of a student
      when they have taken the survey

Change-Id: If3595492eed91b46f6774b11706a206ad9207dda
Reviewed-on: https://gerrit.instructure.com/101759
Reviewed-by: Marc Alan Phillips <mphillips@instructure.com>
QA-Review: Robin Kuss <rkuss@instructure.com>
Product-Review: Jason Sparks <jsparks@instructure.com>
Tested-by: Jenkins
2017-02-13 20:34:11 +00:00
Brad Humphrey 75ca24f1d8 include sis_user_id with student overrides for sis_assignments
test plan:
  set up a user with a sis_id
  set up an assignment with user level overrides
  verify that the sis_assignments_api can return sis_user_id

refs SIS-2700
fixes SIS-2749

Change-Id: I78a33f556cc1326fc5378cd3d92e71a113641f58
Reviewed-on: https://gerrit.instructure.com/101854
Tested-by: Jenkins
Reviewed-by: Nick Houle <nhoule@instructure.com>
Product-Review: Brad Humphrey <brad@instructure.com>
QA-Review: Brad Humphrey <brad@instructure.com>
2017-02-13 19:17:02 +00:00
Brad Humphrey cbf14a8aea add user level assignment overrides to the sis assignment JSON
test plan:
 sis_assignments response should be the same

refs SIS-2700
fixes SIS-2744

Change-Id: I3cd38481f00ec8b52d959c25f947e6306e4046ff
Reviewed-on: https://gerrit.instructure.com/101515
Tested-by: Jenkins
Reviewed-by: Nick Houle <nhoule@instructure.com>
Product-Review: Brad Humphrey <brad@instructure.com>
QA-Review: Brad Humphrey <brad@instructure.com>
2017-02-09 18:12:33 +00:00
Connor Ford bee51363cd Fix rubric api pagination links
Check both account and course contexts in rubric spec

The link header returned with certain rubric API responses incorrectly
contains links to course assignment endpoints instead of additional
pages of rubrics. This commit corrects the pagination links and adds
logic for differentiating between course and account contexts.

Test Plan:
  - Make API requests to the following endpoints for listing rubrics:
  - /api/v1/accounts/:account_id/rubircs
  - /api/v1/courses/:course_id/rubrics
  - Ensure the results are fully paginated by choosing cases with at
    least 10 associated rubrics or by lowering the per_page parameter.
  - Ensure the URLs in the response "Link" header correctly point to
    additional pages of rubrics for the requested context.
2017-02-06 15:50:32 -07:00
Nick Houle 521895b36d Add max_name_length to Assignment API
Refs: SIS-2692

Test plan:
- Using your preferred REST Client make a GET request to the
  assignments api and verify that max_name_length is
  included as an integer.

Change-Id: I0119bab3e840164bcc76fdd01d23bb94d1cce8f8
Reviewed-on: https://gerrit.instructure.com/100062
Tested-by: Jenkins
Reviewed-by: Stewie aka Nicholas Stewart <nstewart@instructure.com>
Product-Review: Brad Humphrey <brad@instructure.com>
QA-Review: Steven Shepherd <sshepherd@instructure.com>
2017-02-03 23:42:43 +00:00
James Williams 435f4684e9 master courses: add restriction icons to files and folders
should not be able to delete a folder if it contains a
 locked file (even nested within subfolders)

also should not get a prompt to overwrite a locked
file when uploading one with the same name

closes #MC-67

Change-Id: I7cc731377e35d27bb4e97550db8c1deb0b527cac
Reviewed-on: https://gerrit.instructure.com/100494
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-01-27 16:27:52 +00:00
wdransfield d57aced80c Change assignment_configuration to similarity_detection
Fixes PLAT-2072

Test Plan:

- Install and LTI1 and LTI2 tool in a course.
  both should use the 'similarity_detection'
  placement.
- Create an assignment in the course with type
  online file uploads. Verify that both tools
  appear in the "plagiarism Review" select
  box.
- Select one of the tools and save the assignment.
- Edit the assignment and verify that the chosen tool
  is still selected.
- Select the other tool, save, and edit again.
- Verify the other tool is still selected.

Change-Id: I775f126f4138a636d5f2a01c57e41a1535df087d
Reviewed-on: https://gerrit.instructure.com/99759
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-01-26 14:33:43 +00:00
Neil Gupta 7298b8749f Get rid of multiple_grading_periods feature flag
Fixes CNVS-27109

Test plan:
Regression test everything related to multiple grading periods.

In particular, make sure:
* there is no mention of the multiple grading periods feature flag on
  the account or course features pages
* make sure grading periods UI always shows up on the account grading
  standards page
* make sure the grading periods UI only shows on the course grading
  standards page if legacy course grading periods exist for that course
  (see below)
* grading period dropdowns only show up everywhere else if there are
  grading periods to show. Otherwise, it should behave as if MGP is
  "disabled"
* Grade calculation should work as expected with and without grading
  periods

To create legacy course grading periods, you have to use rails console:
1. Find your course:
      course = Course.find(<id>)
2. Create a grading period group:
      group = course.grading_period_groups.create!(title: "2017")
2. Create a grading period:
      group.grading_periods.create!(
        weight: 1,
        title: 'Fall',
        start_date: 5.days.ago,
        end_date: 10.days.from_now
      )

Here's the list of known places grading periods can be seen in the UI:

Instructor Assignments page
  (https://community.canvaslms.com/docs/DOC-2615)
Student Assignments page
  (https://community.canvaslms.com/docs/DOC-3123)
Gradebook (https://community.canvaslms.com/docs/DOC-2785)
Gradebook Individual View
  (https://community.canvaslms.com/docs/DOC-2788)
Course Settings grading schemes page
  (https://community.canvaslms.com/docs/DOC-4042)
Student Grades page (https://community.canvaslms.com/docs/DOC-1291)
Dashboard global Grades page
  (https://community.canvaslms.com/docs/DOC-5464)

Change-Id: Iefac4b08120bd1699d4ed98bcb418089eec9b3b8
Reviewed-on: https://gerrit.instructure.com/99744
Reviewed-by: Spencer Olson <solson@instructure.com>
Tested-by: Jenkins
QA-Review: KC Naegle <knaegle@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2017-01-25 20:35:18 +00:00
Frank Murphy f98dfc79d5 Add course locale information to show / list courses endpoint
Fixes MBL-7155

Test Plan:
- Create a course, change locale to Spanish.
- GET http://web.canvaslms.docker/api/v1/courses. Verify that the
  course locale is included in the JSON body of the course.

Change-Id: Ifba9d409533ac4db6bb8d70ccc73c6f32e8414cb
Reviewed-on: https://gerrit.instructure.com/99991
Reviewed-by: Dan Minkevitch <dan@instructure.com>
Tested-by: Jenkins
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: Dan Minkevitch <dan@instructure.com>
2017-01-23 22:24:51 +00:00
Jeremy Stanley 8692b78c76 add date override support to enrollment terms API
the API could actually set date overrides previously, but the
means to do so was not documented, and it could not retrieve them.
this commit fixes both.

test plan:
 - render documentation
 - use the enrollment terms API to create a term with dates
   overridden for specific enrollment types
   - ensure the only accepted enrollment types are those
     in the UI and the documentation and that other strings
     result in a 400 Bad Request error
 - use the enrollment terms API to edit override dates for
   existing terms (with and without changing the term name)
 - use the list enrollment terms endpoint with include[]=overrides
   and ensure override dates are returned properly

fixes CNVS-34227
fixes CNVS-34358

Change-Id: I012224b0cf5c7bdcf4cd0ae1a1e8d9d7965d42c1
Reviewed-on: https://gerrit.instructure.com/99563
Tested-by: Jenkins
Reviewed-by: Dan Minkevitch <dan@instructure.com>
QA-Review: Heath Hales <hhales@instructure.com>
Product-Review: Chris Ward <cward@instructure.com>
2017-01-23 20:14:38 +00:00
Ben Rinaca aee7ce3067 include lti_user_id when self requests profile
closes TD-1738

arc, via oauth, wants to make requests to canvas to get info about a
user, including what their lti user id is. this is so we can look up a
user in our system by that lti user id to determine who it is when they
have logged in via canvas oauth.

test plan:
- make sure requesting a user’s profile via api is still working
- make sure that when you request your own user profile via api you get
the lti user id included

Change-Id: I4c42b833baa677b31f5cd79de95daa63b26fba40
Reviewed-on: https://gerrit.instructure.com/99880
Tested-by: Jenkins
Reviewed-by: Andrew Butterfield <abutterfield@instructure.com>
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
Product-Review: Ben Rinaca <brinaca@instructure.com>
2017-01-19 22:21:36 +00:00
James Williams 8e01d17e03 master courses: link graded discussions/quizzes with assignments
should use the same migration_id + master/child content tags
so they'll be restricted/unlinked together

closes #MC-63

Change-Id: I815c76d79b7407ecbcb2bff88dea9c90188800eb
Reviewed-on: https://gerrit.instructure.com/99887
Reviewed-by: Dan Minkevitch <dan@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
Tested-by: Jenkins
2017-01-19 17:25:46 +00:00
Stewie (Nicholas Stewart) c03e2345a4 Add due_date_required to Assignment API
Refs: SIS-2636

Test Plan: Make a GET request to the assignments api and verify that
  due_date_required is included as a boolean.
  Example url:
    http://canvas.docker/api/v1/courses/25/assignments/6

Change-Id: I517c9597be7f1f2833798556aadfd72cfb88b19e
Reviewed-on: https://gerrit.instructure.com/99609
Reviewed-by: Nick Houle <nhoule@instructure.com>
QA-Review: <mmcdermott@instructure.com>
Tested-by: Jenkins
Product-Review: Stewie aka Nicholas Stewart <nstewart@instructure.com>
2017-01-19 00:24:49 +00:00
Matthew Sessions 09f75dabbd Add course image to show/list courses endpoint
Fixes MBL-7126

Test Plan:
 - Enable the course image feature flags for a course
   (must first allow or enable on the account feature
   flags)
 - Add a course image to a course
 - Hit /api/v1/courses/<course_id>
   with include[]=course_image
 - It should return a field on the course called image_download_url
   which will be a url to either the flicker image or user uploaded
   image that they provided when adding their course image
 - Remove the include and it shouldn't return the
   image
 - Turn the feature flag off but provide the include
   parameter and it shouldn't return the image
 - This should all also work on the list courses endpoint
   the same include value

Change-Id: I6774201235dcd6806e870a4cddab6d63e06b8c42
Reviewed-on: https://gerrit.instructure.com/99664
Reviewed-by: Dan Minkevitch <dan@instructure.com>
Tested-by: Jenkins
QA-Review: David Tan <dtan@instructure.com>
Product-Review: Matthew Sessions <msessions@instructure.com>
2017-01-18 20:28:28 +00:00
James Williams 0517c58e71 master courses: do some locked restrictions+icons for quizzes
closes #MC-62

Change-Id: I39f72492d622749d44fc6c29e96768b25f5b1a7a
Reviewed-on: https://gerrit.instructure.com/99812
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-01-18 14:47:37 +00:00
Spencer Olson b16d399da9 allow post to sis when assignment in closed grading period
closes CNVS-34252

test plan:
1. Create an assignment with a due date in a closed grading period
2. As a teacher, verify you are able to enable or disable the
   "Post to SIS" setting and verify can save the assignment without
   any errors.

Change-Id: Id827fcd9bce7947a9bf15b3e8e64c6c4ed5d9b7a
Reviewed-on: https://gerrit.instructure.com/99703
Reviewed-by: Jeremy Neander <jneander@instructure.com>
Reviewed-by: Keith T. Garner <kgarner@instructure.com>
Tested-by: Jenkins
Reviewed-by: Shahbaz Javeed <sjaveed@instructure.com>
QA-Review: KC Naegle <knaegle@instructure.com>
Product-Review: Christi Wruck
2017-01-17 17:32:24 +00:00
James Williams 3207cbbf50 master courses: do some locked restrictions+icons for assignments
closes #MC-61

Change-Id: I14c237cfaa0304b6abf4b05377eac68047ee3f9a
Reviewed-on: https://gerrit.instructure.com/99702
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-01-17 14:46:28 +00:00
James Williams 4c40851416 master courses: do some locked restrictions+icons for discussions
closes #MC-60

Change-Id: I4bbe452b4688ecd7e56c31627d956a34235d1a68
Reviewed-on: https://gerrit.instructure.com/99665
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-01-17 14:36:22 +00:00
James Williams 0dae91f7b0 master courses: add lock/unlocked icons on wiki page index
closes #MC-59

Change-Id: Id9e244ad70baffc0073c5fcb569258e3d28b0081
Reviewed-on: https://gerrit.instructure.com/99644
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-01-17 14:36:13 +00:00
James Williams a9fab4f4af remove strong_params
refs #CNVS-32574

Change-Id: I4e255b989f8ad3fc6ec2f2699d4950dc0e5a419a
Reviewed-on: https://gerrit.instructure.com/99483
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2017-01-13 12:49:15 +00:00
Dan Minkevitch 78f5641ee3 Refactor comment locking algorithm to properly reflect course setting
Fixes CNVS-34215

Test Plan:
* Create an announcement
* As a student, see that the announcement is available to comments
* As an admin, enable the account setting to disable comments on announcements
* As a student, see that announcements have a locked icon and cannot have replies
* As an instructor, view the announcements page and click the settings icon for an announcement
* See that an "Open to Comments" option doesn't appear in the menu
* View (not edit) one specific announcement and click the settings icon
* See that an "Open for Comments" option doesn't appear in the menu
* As an admin, disable the account setting to disable comments on announcements
* As an instructor, view the announcements page and click the settings icon for an announcement
* See that an "Open to Comments" option appears in the menu and unlocks the announcement when clicked
* View (not edit) one specific announcement and click the settings icon
* See that an "Open for Comments" option appears in the menu

Change-Id: I99482c05a5d710095287108925cca969c76ec160
Reviewed-on: https://gerrit.instructure.com/99150
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Heath Hales <hhales@instructure.com>
Product-Review: Dan Minkevitch <dan@instructure.com>
Product-Review: Chris Ward <cward@instructure.com>
Tested-by: Jenkins
2017-01-10 20:14:39 +00:00
James Williams 031242d031 strong params part Q
refs #CNVS-32574

Change-Id: Ifd139bf1e8296370d1d793ceed7c8e2e50440059
Reviewed-on: https://gerrit.instructure.com/94684
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2017-01-10 18:20:03 +00:00
James Williams 26ee38350a strong params part E-F
refs #CNVS-32574

Change-Id: Ib1fc9c81dbfa4ece200a15a23105dbfa6f84d0c6
Reviewed-on: https://gerrit.instructure.com/94677
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2017-01-10 18:16:54 +00:00
Joel Hough 766f0c9811 hide group file usage right publishing options
fixes CNVS-33258

group files are unpublished if they need usage rights and don't have
them, otherwise they are published

users can now see unpublished group files if they have file manage
permissions

test plan
- enable the usage rights feature flag
- upload a file to a group without setting a usage right
- ensure that the file is visible after a reload
- ensure the file has the "can't be published until usage rights are
set" warning icon
- ensure that the usage right dialog does not have publishing options.
check the dialog opened by:
 - clicking the usage right warning icon
 - clicking the cog menu usage right option
 - clicking the usage right toolbar button
- ensure that course file publishing and usage rights works as it did
before this commit

Change-Id: I19df7aca01cc20996988be173e69097bd9774eba
Reviewed-on: https://gerrit.instructure.com/98454
Reviewed-by: Clay Diffrient <cdiffrient@instructure.com>
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: Chris Ward <cward@instructure.com>
Tested-by: Jenkins
2017-01-05 22:20:33 +00:00
James Williams 84494e877d master courses: hide edit/delete for restricted wiki pages
proof of concept for first-pass all-or-nothing restrictions

closes #MC-50

Change-Id: I937aeb24892e4fca0b31d5cd2d05058e7ea01679
Reviewed-on: https://gerrit.instructure.com/98553
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2016-12-30 13:55:10 +00:00
Dan Minkevitch 507ea63cab Hide "Open to Comments" button on locked announcements
Fixes CNVS-33938

Test Plan:
* Create an announcement
* As a student, see that the announcement is available to comments
* As an admin, enable the account setting to disable comments on announcements
* As a student, see that announcements have a locked icon and cannot have replies
* As an instructor, view the announcements page and click the settings icon for an announcement
* See that an "Open to Comments" option doesn't appear in the menu
* As an admin, disable the account setting to disable comments on announcements
* As an instructor, view the announcements page and click the settings icon for an announcement
* See that an "Open to Comments" option appears in the menu and unlocks the announcement when clicked

Change-Id: Ibc837d2f1d76ec85790a9f00e74b21e18971c738
Reviewed-on: https://gerrit.instructure.com/98418
Tested-by: Jenkins
Reviewed-by: Frederick Polgardy <fpolgardy@instructure.com>
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: Dan Minkevitch <dan@instructure.com>
2016-12-29 23:16:55 +00:00
Neil Gupta 775e2e5c62 MGP Closed Assignment Locking Bug Fixes
Fixes CNVS-33974

Test plan:
* As an admin, setup a grading period that is closed
* Create 2 assignments:
  1) a group assignment that is due in the closed period
  2) a moderated assignment that is due in the closed period
* Masquerade as a teacher
* Try to edit each assignment:
  1) For assignment (1), the "New Group Category" button should be
     disabled.
  2) For assignment (1), you should be able to enable peer reviews,
     automatically assign them, and set reviews per user to any number
     greater than 0. Save should work.
  3) For assignment (2), clicking the moderated grading checkbox should
     not enable the peer reviews checkbox in any browser.

Change-Id: I089e40be543531de711f816636f1fb8712b23ba8
Reviewed-on: https://gerrit.instructure.com/98348
Reviewed-by: Keith T. Garner <kgarner@instructure.com>
Tested-by: Jenkins
QA-Review: Nathan Rogowski <nathan@instructure.com>
Product-Review: Neil Gupta <ngupta@instructure.com>
2016-12-22 23:16:10 +00:00
Stewie (Nicholas Stewart) e0fe10d25f Fix assignment group update
Fixes: SIS-2665

Test Plan: Create an assignment group with integration data.
Then make an update call to it with different integration data.
Verify that the new integration data is merged into the old.

Change-Id: I7c3516dade23a2bdc3d38b793054872cb84d1b97
Reviewed-on: https://gerrit.instructure.com/98203
Reviewed-by: Nick Houle <nhoule@instructure.com>
Tested-by: Jenkins
QA-Review: Steven Shepherd <sshepherd@instructure.com>
Product-Review: Brad Humphrey <brad@instructure.com>
2016-12-21 18:43:42 +00:00
Mysti Sadler e19b207542 Set up controllers for web zip export API
closes OFFW-44

test plan:
- start a web export (button on the modules page in the ui)
- go to api/v1/courses/:course_id/web_zip_exports and
  ensure you can see the list of web zip exports
- go to api/v1/courses/:course_id/web_zip_exports/:id and
  ensure you can see the one web zip export

Change-Id: Iede777011926dc01ad7f76d2a0b3c7f4183089fb
Reviewed-on: https://gerrit.instructure.com/97533
Tested-by: Jenkins
Reviewed-by: Cameron Sutter <csutter@instructure.com>
QA-Review: Nathan Rogowski <nathan@instructure.com>
Product-Review: Mysti Sadler <mysti@instructure.com>
2016-12-20 20:36:38 +00:00
Nick Houle 4f0e8f08ba Add Ability to Create/Update Assignment Group integration_data
Fixes: SIS-2600

Test Plan:
- Run Migrations
- Use your favorite REST Client
- Create a new AssignmentGroup, confirm the integration_data
  is populated
- Update that AssignmentGroup, confirm the integration_data
  is populated

Change-Id: I2f91fd7153d0ab01e16af32b74b53cb2ef50553d
Reviewed-on: https://gerrit.instructure.com/94478
Reviewed-by: Nick Houle <nhoule@instructure.com>
Reviewed-by: Stewie aka Nicholas Stewart <nstewart@instructure.com>
Tested-by: Jenkins
QA-Review: Steven Shepherd <sshepherd@instructure.com>
Product-Review: Oxana
2016-12-20 19:51:54 +00:00
wdransfield e087da776f OriginalityReport: enable in gradebook
Fixes PLAT-1999

Test Plan
- Create an assignment with a valid submission,
  attachment, and originality report. The originality
  report should not have the 'origanality_report_url'
  field set.
- Navigate to gradebook and verify the 'tunitin' speech
  bubble icon appers next to the submission. Click on the
  submission to open the details modal and verify that
  an icon appears displaying the originality score.
  Verify that the icon does not link to any page when
  clicked.
- Set the 'originality_report_url' of the existing
  OriginalityReport to a valid URL and save it.
- Navigate back to speedgrader and verify the same
  'turnitin' speech bubble appears next to the submission.
  Open the submission details modal and verify the same
  icon appears displaying the originality score. Verify
  that clicking on the icon navigates to the url set on
  the OriginalityReport
- Create an assignment with speedgrader enabled. Create
  a submission and attachment with valid turnitin_data.
- Navigate to gradebook and verify that the turnitin
  submission behaves as it did before.

Change-Id: I9b3577ea55fe802753ffcd0b46bd4c5a4a2ea244
Reviewed-on: https://gerrit.instructure.com/97019
Tested-by: Jenkins
Reviewed-by: Nathan Mills <nathanm@instructure.com>
Reviewed-by: Keith T. Garner <kgarner@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Weston Dransfield <wdransfield@instructure.com>
2016-12-20 19:31:06 +00:00
Matthew Berns a1aeb610fb revert OUT-20
closes OUT-1012

test plan:
- full regression testing of outcomes, including:
creation
deletion
moving
migrating
importing
taking
results
report export

Change-Id: Id0708d9133bab8977e6fcf7f91a56fb25f15b735
Reviewed-on: https://gerrit.instructure.com/97729
Reviewed-by: Michael Brewer-Davis <mbd@instructure.com>
QA-Review: Alex Ortiz-Rosado <aortiz@instructure.com>
Product-Review: Michael Brewer-Davis <mbd@instructure.com>
Tested-by: Matt Berns <mberns@instructure.com>
2016-12-20 00:20:34 +00:00
James Williams 69c9e8a2b4 allow account service settings to be updated through api
basically copy-pasted from the regular update action

not sure how/whether to document this since some services
reside in plugins

test plan:
* as an account admin, make an update (PUT) call
  to /api/v1/accounts/X for a root account
  with form data "accounts[services][avatars]=1"
* check the root account settings page
* it should have enabled the "Avatars" service

closes #CNVS-33825

Change-Id: Ifcddea3490a0053616128c1f462b6578ce0dce40
Reviewed-on: https://gerrit.instructure.com/97703
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Heath Hales <hhales@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2016-12-16 20:04:10 +00:00
Derek Bender f30ef06a83 disable editing assignments in closed periods
if an assignment is locked by having any due date
in a closed grading period all fields are locked except
RCE, submission type fields, peer review fields.

closes: CNVS-30899

Test Plan
 - lock an assignment edit page by having at least one
   due date in a closed grading period
 - create an assignment with at least one due date in
   a closed grading period
 - go to the edit the assignment page
   (e.g. /courses/1/assignments/1/edit)
 - all fields are locked except for
   - description (RCE)
   - submission type
   - peer reviews
 - if an assignment is not locked, all fields should
   be editable as normal
 - if the user is an admin, they can edit anything they want

Change-Id: I5cbee4e552331915280c949f467565069aee8743
Reviewed-on: https://gerrit.instructure.com/93380
Reviewed-by: Jeremy Neander <jneander@instructure.com>
Reviewed-by: Shahbaz Javeed <sjaveed@instructure.com>
QA-Review: Anju Reddy <areddy@instructure.com>
Product-Review: Christi Wruck
Tested-by: Jenkins
2016-12-14 21:51:08 +00:00
Keith Garner 818825e462 add crocodoc_whitelist to submission api preview_url
This allows the submission API to consider the
crodcodoc_whitelist (needed for Moderated Grading selections) when
generating preview_urls.

fixes CNVS-33531

test plan:
 - Create a course with 3 teachers, and a student
 - Create an assignment that takes a crodococ supported format as a
   submission and is moderated
 - As the student, submit homework
 - As the student, leave crocodoc annotations on the homework
 - As teacher #1, select moderate, select the student, and add reviewer
 - As teacher #2, grade the assignment and add crocodoc comments
 - As teacher #3, grade the assignment and add crocodoc comments
 - As teacher #1, go into speedgrader, click Add Review and select
   "Add Moderator Review(Copy 1st)" and leave additional annotations
 - As teacher #1, post the grades
 - As either teacher or student hit the API endpoint:
   /api/v1/courses/<course_id>/assignments/<assignment_id>/submissions?include[]=submission_history
 - In the json blob, find the preview_url and open it in your
   browser. Note that the annotations for the student, and teacher #1
   and #2 appear

Change-Id: I09464a74ec2c2a4167b3225c46c0ac9131109e23
Reviewed-on: https://gerrit.instructure.com/96486
Tested-by: Jenkins
Reviewed-by: Neil Gupta <ngupta@instructure.com>
Reviewed-by: Spencer Olson <solson@instructure.com>
Reviewed-by: Derek Bender <djbender@instructure.com>
QA-Review: KC Naegle <knaegle@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2016-12-09 00:00:29 +00:00
Spencer Olson 9fc2c1b61f load assignment_groups_controller#index faster
in assignment_groups_controller#index, we should only
make one query to get all of the info we need to compute
has_due_date_in_closed_grading_period. right now, we make
one query per assignment.

closes CNVS-33685

test plan:
1. open the network tab in your browser
2. go to the /assignments page in a course with multiple grading
   periods enabled
3. find the network request for assignment_groups and look at the
   response.
  a) verify each assignment has a
     has_assignment_due_in_closed_grading_period attribute
  b) verify the has_assignment_due_in_closed_grading_period
     value is accurate for each assignment (it should be true
     if the assignment is due for any student in a closed
     grading period, and false otherwise)
4. verify the gradebook loads

Change-Id: I5b131594b9d1b3d1305532269ab9a1bff28feaf1
Reviewed-on: https://gerrit.instructure.com/96809
Reviewed-by: Neil Gupta <ngupta@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>
2016-12-07 19:26:45 +00:00
Spencer Olson d244ec3968 fix pseudonyms n+1 when gradebook loads
refs CNVS-33411

test plan:
- verify gradebook loads

Change-Id: Ic6920169fc1cd509f479a85ad32ee608bdb7e4b1
Reviewed-on: https://gerrit.instructure.com/96485
Tested-by: Jenkins
Reviewed-by: Neil Gupta <ngupta@instructure.com>
Reviewed-by: Jeremy Neander <jneander@instructure.com>
QA-Review: KC Naegle <knaegle@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2016-12-05 17:08:57 +00:00
Spencer Olson 5569ce0e28 don't load overrides in gradebook
in gradebook (grid view and individual view),
overrides are no longer loaded. this should
decrease page load times for courses that
have differentiated assignments.

closes CNVS-33411

test plan:
 1) create a course with
  * 300 students
  * 75 assignments
  * one override per student per assignment
 2) benchmark how long it takes to load the
    gradebook
 3) switch to master. benchmark how long it takes
    to load the gradebook
 4) gradebook should load significantly faster with
    this commit than it does on master
 5) verify you can sort by due date in gradebook
 6) verify gradebook individual view loads

Change-Id: Id89cea8acadf7617bc8035789fb787a2bf68660a
Reviewed-on: https://gerrit.instructure.com/95897
Reviewed-by: Neil Gupta <ngupta@instructure.com>
Tested-by: Jenkins
QA-Review: KC Naegle <knaegle@instructure.com>
Product-Review: Spencer Olson <solson@instructure.com>
2016-12-02 23:38:12 +00:00
wdransfield eecdbfecb3 Re-Persist enabled tool settings launches for LTI 2
Fixes PLAT-1965

Test Plan:
- Install two LTI 2 tools: one at the course
  level, one at the account level. During registration
  enable the assignment configuration placement (see
  PLAT-1964).
- Install two LTI 1 tools: one at the course level,
  one at the account level. Make sure they have the
  assignment configuration placement as well.
- Create a new assignment with submission type "Online"
  with "File Uploads".
- Foreach LTI 1 and 2 tool installed previously:
   a. Select the tool in the "plagiarism review"
      select box.
   b. Verify the tool renders in an iframe.
   c. Save the tool, then go back to edit
      the same assignment.
   d. Verify the tool that was selected in
      step 'a' was remembered and renders in
      an iframe.

Change-Id: I39c31de3d234d0e63d9aa11ab2f68fd8d8232dd4
Reviewed-on: https://gerrit.instructure.com/96499
Tested-by: Jenkins
Reviewed-by: Nathan Mills <nathanm@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Weston Dransfield <wdransfield@instructure.com>
2016-12-01 20:31:11 +00:00
Jon Jensen 10b368f3d3 Revert "Persist enabled tool settings launches for LTI 2"
This reverts commit 3e73dfb8a5.

It doesn't play nicely with e3de0ea462

Change-Id: I1d434d926a49e52a279d76006d715f221802eeb6
Reviewed-on: https://gerrit.instructure.com/96446
Reviewed-by: Benjamin Christian Nelson <bcnelson@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
Tested-by: Jenkins
Product-Review: Jon Jensen <jon@instructure.com>
QA-Review: Jon Jensen <jon@instructure.com>
2016-12-01 00:51:52 +00:00
Joel Hough 0d9f23e7a4 add option to include all context codes in appointment show api
fixes CNVS-32911

test plan
- create an appointment group that has two courses as contexts
- as a teacher in one course but not the other, get the
 appointment group using the api
- ensure that only the teacher's course is listed under context
 codes
- get the appointment group via api again but with the
 ?include[]=all_context_codes param specified
- ensure that there is an all_context_codes field in the result
 that lists both context codes

Change-Id: If7852d7ba8489706b2f87571b66aa34fb5163ea7
Reviewed-on: https://gerrit.instructure.com/93659
Reviewed-by: Frederick Polgardy <fpolgardy@instructure.com>
Reviewed-by: Dan Minkevitch <dan@instructure.com>
Tested-by: Jenkins
QA-Review: Heath Hales <hhales@instructure.com>
Product-Review: Joel Hough <joel@instructure.com>
2016-11-30 22:15:30 +00:00
wdransfield 3e73dfb8a5 Persist enabled tool settings launches for LTI 2
Fixes PLAT-1965

Test Plan:
- Install two LTI 2 tools: one at the course
  level, one at the account level. During registration
  enable the assignment configuration placement (see
  PLAT-1964).
- Install two LTI 1 tools: one at the course level,
  one at the account level. Make sure they have the
  assignment configuration placement as well.
- Create a new assignment with submission type "Online"
  with "File Uploads".
- Foreach LTI 1 and 2 tool installed previously:
   a. Select the tool in the "plagiarism review"
      select box.
   b. Verify the tool renders in an iframe.
   c. Save the tool, then go back to edit
      the same assignment.
   d. Verify the tool that was selected in
      step 'a' was remembered and renders in
      an iframe.

Change-Id: I74e5ce7d839c408659f75ee3819f797275b7b45e
Reviewed-on: https://gerrit.instructure.com/95443
Tested-by: Jenkins
Reviewed-by: Nathan Mills <nathanm@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Weston Dransfield <wdransfield@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
2016-11-30 20:37:39 +00:00
Spencer Olson f7814b9c53 Improve calculation of effective due dates for students
closes CNVS-33110
closes CNVS-32641

Test plan:
* regression test changing group weighting schemes
* regression test moving assignments with any due date in
  a closed grading period (this could be from an override or
  the "Everyone Else" due date) into another assignment group
    * An assignment that is "locked" (that is, one with a due date
      that falls in a closed grading period) should not be movable.

Change-Id: I9bb87dcd7c0b83535a31d079c669b86c5eee55b0
Reviewed-on: https://gerrit.instructure.com/94939
Reviewed-by: Jeremy Neander <jneander@instructure.com>
Reviewed-by: Keith T. Garner <kgarner@instructure.com>
Tested-by: Jenkins
QA-Review: KC Naegle <knaegle@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2016-11-29 22:29:38 +00:00
Matthew Berns b6f60b4a30 add OutcomeLink model for outcomes and outcome groups
closes OUT-20

test plan:
- full regression testing of outcomes, including:
creation
deletion
moving
migrating
importing
taking
results
report export

Change-Id: I63a5d07358e3b3f9a0537b1ec30c4b0bf44f79e9
Reviewed-on: https://gerrit.instructure.com/91126
Reviewed-by: Augusto Callejas <acallejas@instructure.com>
QA-Review: Alex Ortiz-Rosado <aortiz@instructure.com>
Product-Review: Josh Simpson <jsimpson@instructure.com>
Tested-by: Matt Berns <mberns@instructure.com>
2016-11-29 21:32:49 +00:00
Dan Minkevitch 762d083eea Add announcements to home page with setting
Fixes CNVS-32366

Adds the most recent announcements to the course home page, provided
the home page is a wiki page.

Test Plan:
* As a teacher, go to a course
* Create a wiki page
* Set the wiki page as the course home page
* Post some announcements
* Go to the course home page
* It should show the wiki page as expected without any changes
* Enable the "Show recent announcements on Course home page" under
  "More options" in the course's settings
* Go to the course home page
* It should show a "Recent Announcements" widget above the wiki page
  for the course

Change-Id: If342928461289dd199709188e170337e3965ef5c
Reviewed-on: https://gerrit.instructure.com/94492
Tested-by: Jenkins
Reviewed-by: Frederick Polgardy <fpolgardy@instructure.com>
QA-Review: David Tan <dtan@instructure.com>
Product-Review: Chris Ward <cward@instructure.com>
2016-11-23 17:29:51 +00:00
Brad Horrocks ce71bfa7db Add current users permission for collaboration API
Updated UI to check those perms in order to render the edit delete links

Fixes: RD-3306

Test plan

Make sure the edit/delete links do not show up for a collaborator

Change-Id: Ieaac2a19cd8b8fbae43c5e36e474c02ac4fd175f
Reviewed-on: https://gerrit.instructure.com/94790
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Jenkins
Product-Review: Caleb Guanzon <cguanzon@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
2016-11-22 21:01:05 +00:00
Jeremy Neander 8eb038007d protect due dates in closed grading periods
This ensures that due dates cannot be set or changed in a way
which puts them into, takes them out of, or adjusts them within a
closed grading period.

closes CNVS-32489
closes CNVS-33037

test plan:

* Test the following endpoints:
  * POST     /courses/:course_id/quizzes
    (quizzes/quizzes#create)
  * PUT      /courses/:course_id/quizzes/:id
    (quizzes/quizzes#update)
  * POST     /api/v1/courses/:course_id/quizzes
    (quizzes/quizzes_api#create)
  * PUT      /api/v1/courses/:course_id/quizzes/:id
    (quizzes/quizzes_api#update)
  * POST     /api/v1/courses/:course_id/assignments
    (assignments_api#create)
  * PUT      /api/v1/courses/:course_id/assignments/:id
    (assignments_api#update)

* A teacher cannot:
  * create a quiz/assignment
    * with a due date in a closed grading period
    * with an override due date in a closed grading period
    * with a nil due date when the last grading period is closed
    * with a nil override due date when the last grading period
      is closed
  * change the due date on a quiz or assignment
    * due in a closed grading period
    * with an override due in a closed grading period
    * to a date within a closed grading period
  * change the due date of an override
    * due in a closed grading period
    * to a date within a closed grading period
  * unset (nullify) the due date when the last grading period is
    closed
  * unset (nullify) the due date of an override when the last
    grading period is closed
  * delete (by omission from parameters) an override due in a
    closed grading period

* A teacher can:
  * create a quiz/assignment with a due date in an open grading
    period
  * change the quiz/assignment due date when the assignment is
    only visible to overrides
  * change the quiz/assignment due date when not within a closed
    grading period
  * change the quiz/assignment due date when set to the same
    value

* An ADMIN does not have these restrictions.

Change-Id: I0da260e831784e7b6d0f6e5a35c43d6ecff9e977
Reviewed-on: https://gerrit.instructure.com/93806
Tested-by: Jenkins
Reviewed-by: Spencer Olson <solson@instructure.com>
Reviewed-by: Shahbaz Javeed <sjaveed@instructure.com>
QA-Review: KC Naegle <knaegle@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2016-11-18 23:50:24 +00:00
Spencer Olson 39ca35f548 fix group memberships n plus one
when loading gradebook, there is an
n+1 with group memberships loading.
this fixes that.

test plan:
- verify the gradebook loads

Change-Id: I7b5f944069fda2b6a642db37314c23ead4c0300c
Reviewed-on: https://gerrit.instructure.com/95364
Tested-by: Jenkins
Reviewed-by: Shahbaz Javeed <sjaveed@instructure.com>
Reviewed-by: Keith T. Garner <kgarner@instructure.com>
QA-Review: KC Naegle <knaegle@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2016-11-18 18:07:23 +00:00
Cameron Sutter f725305de8 enable formula questions in quiz api
closes MBL-6692

test plan:
- create and publish a quiz that has a formula question
- start the test as as a student
- don't answer any of the questions or leave the page
- in a different tab, use the following api endpoints to view
  the quiz questions:
  - api/v1/courses/:course_id/quizzes/:quiz_id/submissions
    save the quiz submission's id
   - api/v1/courses/:course_id/quizzes/:quiz_id/questions?
     quiz_submission_id=:quiz_submission_id&quiz_submission_attempt=1
- the following attributes should be returned in the returned json
  - answers
  - formulas
  - variables
  - answer_tolerance
  - formula_decimal_places
- one of the attributes of `answers` should be `variables`
  (yes, variables should show up twice)

** Please do an audit of other question types to make sure there are
   no distinguishing details exposed because of exposing variables

Change-Id: I2c75de523fa8f58bae3ca560c39b7fcb92ea1b7d
Reviewed-on: https://gerrit.instructure.com/90587
Tested-by: Jenkins
Reviewed-by: Ryan Taylor <rtaylor@instructure.com>
QA-Review: Robin Kuss <rkuss@instructure.com>
Product-Review: Cameron Sutter <csutter@instructure.com>
2016-11-17 18:40:37 +00:00
James Williams 1e40cfc3c4 don't allow replies to conversations without permissions
also don't allow group context messaging without permission

test plan:
* send a message to a student in a course
* in the account permissions, disable "Send messages to
individual course members" for students
* as the student, they should not be able to reply to the
 initial conversation

* add the student to a group in the course
* the student should also not be able to intitiate
a conversation in the group context (and thereby bypass
the permission restrictions)

closes #CNVS-32357 #CNVS-33174

Change-Id: Icf88e6c42e32fc4de39d0cfe305ec1fdd6bfccfc
Reviewed-on: https://gerrit.instructure.com/94785
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Heath Hales <hhales@instructure.com>
Product-Review: Chris Ward <cward@instructure.com>
2016-11-16 18:11:25 +00:00
Ken Romney 0d0281844f Remove User Override additions from the SIS Assignment API
This commit reverts the following patchsets:
  https://gerrit.instructure.com/#/c/87623/ - SIS-2360
  https://gerrit.instructure.com/#/c/92810/ - SIS-2587

Test Plan:

1: Incomplete open registration user with User-Specific due date
  Go to People tab in course
  Invite a user that does not already exist into the course as a
    student with their email address
  Do NOT complete the process of singing up as the user.
  Create an assignment with a due date for everyone, then give the
    student a user-specific due date.
  Mark the assignment to post to SIS
  Give the student a grade on the assignment (optional)
  Make sure there is NO 500 error at:
    https://<canvas_url>/api/sis/courses/#/assignments
2: Give an SIS enrolled student a user-specific due date, then delete
with user
  Create a student user in Canvas with a user CSV file
  Enroll a student into a course using an enrollment CSV file
  Create an assignment with a due date for everyone, then give the
    student a user-specific due date.
  Mark the assignment to post to SIS
  Give the student a grade on the assignment (optional)
  Delete the student from canvas through a students.csv SIS Import
  Make sure there is NO 500 error at:
    https://<canvas_url>/api/sis/courses/#/assignments

Fixes: SIS-2609

Change-Id: Ic2301148b69324417cae54d0d4aefb4bfabda4b5
Reviewed-on: https://gerrit.instructure.com/95080
Tested-by: Jenkins
QA-Review: Adam Phillipps <adam@instructure.com>
Reviewed-by: Stewie aka Nicholas Stewart <nstewart@instructure.com>
Product-Review: Brad Humphrey <brad@instructure.com>
2016-11-15 17:50:57 +00:00
Spencer Olson 1fd2d94d51 fix assignment updating with turnitin enabled
when ruby 2.3.1 is in use and the account has
turnitin enabled, creating assignments fails.
this commit fixes that.

closes CNVS-33137

test plan:
1) verify you are running ruby 2.3.1
2) enable turnitin at the account settings
   page
2) create a new assignment in a course. click
   'save and publish' and verify it succeeds
   and no errors are shown on the page

Change-Id: Ib4c66b5c3ad7df6f499dcfb367489b916967504b
Reviewed-on: https://gerrit.instructure.com/94599
Reviewed-by: Keith T. Garner <kgarner@instructure.com>
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: KC Naegle <knaegle@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2016-11-08 17:09:55 +00:00
wdransfield b3c9fa8a0e Don't save tool_settings_tol if submission type is not 'online'
Fixes PLAT-1930

Test Plan:
- Install a tool at the course level with the assignment_configuration
  placement
- Create a new assignment and launch the tool from the assignment
  creation page.
- Without changing the 'Plagiarism Review' selection to 'none',
  change the 'Submission Type' to 'On Paper'.
- Save the assignment and verify the 'tool_settings_tool' attribute
  of the assignment's model is not populated.
- Edit the assignment and set submission type to online with
  file upload.
- Save the assignment and verify the 'tool_settings_tool' is set.

Change-Id: Ie2a51c80deee581a6f719d09277336f6c93acfda
Reviewed-on: https://gerrit.instructure.com/94225
Reviewed-by: Nathan Mills <nathanm@instructure.com>
Tested-by: Jenkins
QA-Review: August Thornton <august@instructure.com>
Product-Review: Weston Dransfield <wdransfield@instructure.com>
2016-11-07 20:27:49 +00:00
wdransfield 1256d3455d Send ext_lti_assignment_it in edit launches
Fixes PLAT-1928

Test Plan:
- Install a tool in a course with the 'assignment_configuration
  placement.
- Create a new assignment and launch the tool
- Verify that the tool received the ext_lti_assignment_id
  and note what the id was.
- Save the assignment and then edit it
- Verify that the tool received the same ext_lti_assignmenet_id
  as before.

Change-Id: Iafe78c4faff20c41152baf41ccfef6e2f1107b5d
Reviewed-on: https://gerrit.instructure.com/94215
Tested-by: Jenkins
Reviewed-by: Nathan Mills <nathanm@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Weston Dransfield <wdransfield@instructure.com>
2016-11-04 20:27:41 +00:00
Simon Williams 1419f25f82 always rewrite absolute urls in incoming html
fixes CNVS-33040

test plan:
- create a wiki page, and link to another wiki page with an absolute url
- save and inspect the value stored in the db
- it should be saved as a relative url

Change-Id: Iee325b84d6e7f93aec258ec2dce1c73d950df061
Reviewed-on: https://gerrit.instructure.com/94126
Reviewed-by: Brent Burgoyne <bburgoyne@instructure.com>
Tested-by: Jenkins
QA-Review: Benjamin Christian Nelson <bcnelson@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2016-11-03 17:38:18 +00:00
wdransfield c9a3e3ef94 Assignment configuration tool UI
Fixes PLAT-1899

Test Plan:
- Turn on the 'Plagiarism Detection Platform'
  feature flag
- Install an LTI 1.x tool with the
  assignment_configuration placement
- Install an LTI 2 tool with the
  assignment_configuration placement
- Navigate to a course assignments page and
  create a new course
- Select 'Online' as the submission type
  and check 'file uploads'
- Verify that the 'Plagiarism Review'
  select box appers.
- Verify that the 'Plagiarism Review'
  select box is hidden if the submission
  type is not 'online' with 'file uploads'
- Verify that both of the tools installed appear
  in the 'Plagiarism Review' select box
- Click each tool and verify that the tool
  launches within an iframe on the page
- Verify that the iframe src contains a param
  named 'secure_params' with a JWT as the value.
- Turn off the feature flag and verify the
  'Plagiarism Review' select box never
  appears.

Change-Id: I7a0c753eb8b6674ffe2630d83731bc666260533b
Reviewed-on: https://gerrit.instructure.com/93361
Tested-by: Jenkins
Reviewed-by: Nathan Mills <nathanm@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Weston Dransfield <wdransfield@instructure.com>
2016-11-02 14:10:40 +00:00
Christian Prescott bd3602d422 Show single override's due date instead of none when present
refs OUT-430

Test Plan
1. Prepare an (assignment|quiz|graded discussion) and set its due date
   within a week so it appears in the "Coming Up" section on course home.
   Ensure the assignment and its due date appear to teacher and student.
2. Add an Assign To override to the assignment, with a different due date.
   Ensure the teacher sees "Multiple Due Dates" but the student sees their
   applied due date.
3. Edit the course to set the override as the _only_ due date. (Remove the
   Everyone Else override, or any others) Ensure the teacher sees the
   override's due date. Ensure only students for whom the assignment is
   overridden see the override's due date.
4. Ensure the "Multiple"/applied date visibility behavior is the same as
   above on the index pages for assignment, quiz, discussion, and maybe
   modules.

Change-Id: I276f34a7b439fe0e0f6f6883534e9fea698ae586
Reviewed-on: https://gerrit.instructure.com/93538
Tested-by: Jenkins
Reviewed-by: Matt Berns <mberns@instructure.com>
QA-Review: Cemal Aktas <caktas@instructure.com>
Product-Review: McCall Smith <mcsmith@instructure.com>
2016-11-01 19:09:22 +00:00
Nathan Mills d323de4a36 send lti_context_id to the create assignment form
refs PLAT-1901

test plan:
open the create a new assignment page
look for the "secure_params" hidden input
extract the jwt and decode it
save the assignment
the new assignments lti_context_id should match the id in the jwt

Change-Id: I64c8dc9e17b20621894aed9016c87e4a958209bc
Reviewed-on: https://gerrit.instructure.com/93811
Tested-by: Jenkins
Reviewed-by: Andrew Butterfield <abutterfield@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Reviewed-by: Matthew Wheeler <mwheeler@instructure.com>
Product-Review: Nathan Mills <nathanm@instructure.com>
2016-10-28 18:01:03 +00:00
Stewie (Nicholas Stewart) 02bdcace98 Refactor User Assignments, Part 1
The SisAssignment module is in charge of too many things and needs to be
refactored.  It's hard for a new-comer to grok the code, it's hard to
make changes, and there's probably many untested edge-cases.

My first stab at refactoring focuses on user differentiated assignments.

This particular changeset adds a class specifically for handling user
assignments and moves the logic into that class with few modifications
to the logic.

I didn't make any changes to functionality; I'm just trying to better
organize code that supports existing functionality.

I didn't add any specs.  I feel that the existing specs for
SisAssignment are sufficient for this changeset.  In future changesets
there will be more small classes with complete testing

Test Plan: Smoke test GPB and specifically pay attention users
  assignments.

Fixes: SIS-2587

Change-Id: Ie9a38248cac7d95bd1906161d246fe8fc3129ef9
Reviewed-on: https://gerrit.instructure.com/92810
Reviewed-by: Jeremy Slade <jslade@instructure.com>
Tested-by: Jenkins
QA-Review: Steven Shepherd <sshepherd@instructure.com>
Product-Review: Stewie aka Nicholas Stewart <nstewart@instructure.com>
2016-10-28 15:09:08 +00:00
Cameron Sutter 3496ea1378 enable multiple_dropdowns questions in quiz api
closes MBL-6653

test plan:
- create and publish a quiz that has a multiple_dropdown question
- start the test as as a student
- don't answer any of the questions or leave the page
- in a different tab, use the following api endpoints to view
  the quiz questions:
  - api/v1/courses/:course_id/quizzes/:quiz_id/submissions
    save the quiz submission's id
   - api/v1/courses/:course_id/quizzes/:quiz_id/questions?
     quiz_submission_id=:quiz_submission_id&quiz_submission_attempt=1
- one of the attributes of the returned json should be `answers`
- one of the attributes of `answers` should be `blank_id`

** Please do an audit of other question types to make sure there are
   no distinguishing details exposed because of exposing blank_id

Change-Id: Ic0997c62fbc1c79b57a05e6d9ac1e895e2b1e2d1
Reviewed-on: https://gerrit.instructure.com/90585
Reviewed-by: Ryan Taylor <rtaylor@instructure.com>
QA-Review: Robin Kuss <rkuss@instructure.com>
Product-Review: Brady Larson <brady@instructure.com>
Tested-by: Jenkins
2016-10-27 20:42:52 +00:00
wdransfield 615b2c7c78 Correctly set resource_link_id for modules
Fixes: PLAT-1736

Test Plan:
Part One
- Add an external tool as a module item in a course and
  note the module item id (not the module id).
- Do GET to "<local_canvas>/api/v1/courses/<course_id>/
  external_tools/sessionless_launch?id=launch_type=module_item
  &module_id=<module_item_id>"
- Navigate to the value of 'url' in the response to do
  a sessionless launch
- Verify that the resource_link_id is the identifier
  for the module item, not the context.
Part Two
- Make sure an external tool has been added to a course
  as a module item.
- Do GET to "<local_canvas>/api/v1/courses/<course_id>/
  modules/<module_id>/items"
- Verify the value of 'url' for a module item
  has a query string which contains:
  * 'launch_type=module_item'
  * 'module_item_id=<module_item_id>'
- Do GET to "<local_canvas>/api/v1/courses/<course_id>/
  modules/<module_id>/items/<id of module item with tool>"
- Verify the value of 'url' has a similar query string

Change-Id: Iaae84e44715f885709fb0d0aca015b256b5985fa
Reviewed-on: https://gerrit.instructure.com/93031
Tested-by: Jenkins
Reviewed-by: Nathan Mills <nathanm@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Weston Dransfield <wdransfield@instructure.com>
2016-10-20 21:31:54 +00:00
Brent Burgoyne 6f9a50a3bc strip host from absolute urls to request host
back out of previous commit to make url scope rewrite work with
absolute urls, and instead strip the host from urls when the host
matches to requests host.

fixes CNVS-32091

test plan:
- create a link in the rich content editor in the following format
  - http://some-other-domain/files/1
- save the content
  - make sure the context was not added to the url
    - i.e. /courses/1/files/1
- create link to a file
- save it
  - make sure the url starts with "/" and does not include the domain

Change-Id: I5796db47b47c19a2d061a5e809a13c3b043e1f0e
Reviewed-on: https://gerrit.instructure.com/91748
Tested-by: Jenkins
Reviewed-by: Ryan Shaw <ryan@instructure.com>
QA-Review: Benjamin Christian Nelson <bcnelson@instructure.com>
Product-Review: Brent Burgoyne <bburgoyne@instructure.com>
2016-10-19 15:45:13 +00:00
James Williams 1788c8b9be make values from WeakParameters also weak
refs #CNVS-32574

Change-Id: I64654de0e09866e2cbb5546734081bf2cb6f4491
Reviewed-on: https://gerrit.instructure.com/92892
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2016-10-19 12:54:33 +00:00
Christian Prescott a978231f74 Add "Mastery Paths" AssignmentOverride
refs CYOE-310

Implement Noop AssignmentOverride set_type to persist a setless "tag"
Add MasteryPaths noop override to assignment, discussion, quiz edit
Add only_visible_to_overrides to Assignment copied attributes

Test Plan
1. Edit an assignment. From the "Assign to" dropdown select "Mastery
   Paths."
2. Ensure "Everyone Else" override is removed from Assign to.
3. After saving, ensure the assignment is no longer visible to students.
4. Ensure adding other overrides (section, student) alongside MP allow
   visibility as expected.
5. Ensure MP override is available and works as expected for other
   "assignment types" including quiz and discussion.
6. Ensure when an assignment with the MP override is copied or imported,
   its MP designation remains intact. (But any individual or section
   overrides do not)
6. With the Mastery Paths feature flag disabled, the option should not
   appear in the dropdown. If the flag is turned off, the MP override
   should disappear but the assignment should stay invisible to students
   until "Everyone" is added back again. If the flag is turned back on,
   MP should reappear.

Change-Id: I17ac8345f872c111d073886c23bd7a3dd9b5dbce
Reviewed-on: https://gerrit.instructure.com/91833
Tested-by: Jenkins
Reviewed-by: Michael Brewer-Davis <mbd@instructure.com>
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
Product-Review: Matt Goodwin <mattg@instructure.com>
2016-10-17 17:07:33 +00:00
James Williams 440daa4a87 use strong params, part A
refs #CNVS-32574

Change-Id: I2785c562c33980a7e230296c200538b8bb0ca6b5
Reviewed-on: https://gerrit.instructure.com/92728
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2016-10-14 16:17:26 +00:00
James Williams 58ce3d2c10 fix discussion materialized view rendering with track tags
test plan:
* discussions with entries with media objects with subtitle
tracks should still render

closes #CNVS-32536

Change-Id: I2bbb8e2d7e0a41f2e1f936861403bc96facf4ce9
Reviewed-on: https://gerrit.instructure.com/92476
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Heath Hales <hhales@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2016-10-12 15:58:47 +00:00
Clay Diffrient 07e5f72110 Merge branch 'baholladay-vericite-master'
Reviewed-on: https://gerrit.instructure.com/78091
Tested-by: Jenkins
Reviewed-by: Keith T. Garner <kgarner@instructure.com>
QA-Review: KC Naegle <knaegle@instructure.com>
Product-Review: Clay Diffrient <cdiffrient@instructure.com>

Change-Id: Idb5bf109612b53160dd3dca2831dc5d662244be7
2016-10-11 20:25:34 -06:00
James Williams 9c5199241c limit module progression recomputation for adhoc overrides
only relock progressions for students affected by the change
(i.e. students added or removed from the assignment override)

closes #CNVS-32542

Change-Id: I814117bef9346bdb375f0a52e3c0814637d49e85
Reviewed-on: https://gerrit.instructure.com/92330
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2016-10-10 15:11:17 +00:00
Felix Milea-Ciobanu bb44df4000 implement cyoe gear option for score-able objects
refs CYOE-304

test plan:
- there should be no changes in the student view
- part 1:
  - create a new course with cyoe disabled
  - create two new assignments (one graded, one ungraded), four new
 quizzes (one graded, one practice, one survey, one graded survey),
 and two discussions (one graded, one ungraded), one page
  - create a new module and add the items from above as module items
  - check the cog menu on the created items and ensure that there
is no "Mastery Paths" option in any of the following views:
    - assignments index page
    - quizzes index page
    - discussions index page
    - all items on the modules page

- part 2:
  - enable cyoe in the course from part 1
  - create a new page with "allow in mastery paths" checkbox checked
  - create a module item for the new page
  - check the same four index pages as before (assignments, quizzes,
 discussions, and modules) and make sure that:
    - the following items have a "Mastery Paths" cog menu option:
      - the graded assignment
      - the graded discussion
      - the graded quiz
    - clicking on the "Mastery Paths" menu option on any
 of the above menus navigates to the correct edit page with the
 mastery paths tab opened on page load
    - the following items do not have the "Mastery Paths" option:
      - the ungraded assignment
      - the ungraded discussion
      - the practice quiz
      - the survey
      - the graded survey
      - both pages

Change-Id: I20c905d764fd3533ae8e68dbd99b7b73fcff81ed
Reviewed-on: https://gerrit.instructure.com/91129
Tested-by: Jenkins
Reviewed-by: Christian Prescott <cprescott@instructure.com>
Reviewed-by: Michael Brewer-Davis <mbd@instructure.com>
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
Product-Review: Felix Milea-Ciobanu <fmileaciobanu@instructure.com>
2016-10-07 23:48:41 +00:00
Michael Brewer-Davis 54280153ec update api for mobile
- change assignment model to full assignment json
- change select_mastery_path to return context module items in
  addition to assignments

closes CYOE-329

Test plan:
1.  Create a CYOE rule that includes an OR condition.  Include
    the trigger assignment and some of the follow on assignments
    in a module
2.  Grade a student so that they fall in the OR range
3.  As the student, hit the modules API to determine
    which assignment sets are relevant:
      /api/v1/courses/:course_id/modules/:module_id/items?includes[]=mastery_paths
    Look for the conditional release rules of the trigger assignment
4.  Verify that the follow on assignments listed show their
    submission_types attribute as an array
5.  Select a mastery path as the student
      /api/v1/courses/:course_id/modules/:module_id/items/:trigger_item_id/select_mastery_path?assignment_set_id=:assignment_set_id
6.  Verify that the response includes:
    - a meta tag specifying that the primary content is the assignments
    - an assignments tag listing all assignments in the assignment set
      (including those w/o modules)
    - an items tag listing all context module items related to those
      assignments
7.  Verify that the UI version of the above (visiting context modules
    page with a "select assignment set" block showing, select the
    assignment set from the choice page) works as expected

Change-Id: Iab652af64fa02a76e896bfc0a21f882ad51319ab
Reviewed-on: https://gerrit.instructure.com/91457
Tested-by: Jenkins
Reviewed-by: Christian Prescott <cprescott@instructure.com>
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
Product-Review: Michael Brewer-Davis <mbd@instructure.com>
2016-10-07 16:16:05 +00:00
Bryan Holladay 4e9eb7c65d VeriCite plugin integration into Assignments, Gradebook, and Speedgrader 2016-10-07 08:10:56 -04:00
Jeremy Neander 3a2d565dd4 lock assignment group weights in closed grading periods
Assignments which have been assigned for at least one student in
a closed grading period must:

* prevent changes to course group weighting setting
* prevent changes to assignment group weights
* prevent changes to assignment drop rules

These restrictions must not apply to admins.

closes CNVS-30909
closes CNVS-30912

test plan:
  A. create or select:
    a. an account
    b. an enrollment term for the account
    c. a grading period set for that term with:
      * a closed grading period
      * an open grading period
    d. a course with that enrollment term
    e. a student for the course
    f. two assignment groups (1, 2)
    g. an assignment (A) in group 1
      * due for everyone in the closed grading period
    h. an assignment (B) in group 2
      * due for everyone in the open grading period
  B. as a Teacher in the course, visit the course assignments page
      a. access the Assignment Settings Modal
          1. verify the 'Weight final grade' option cannot be changed
          2. verify the individual weights cannot be changed
      b. access the Assignment Group Edit Modal for group 1
          1. verify the assignment group weight cannot be changed
          2. verify the drop highest/lowest options cannot be changed
          3. verify that 'never drop' assignments cannot be removed
          4. verify that 'never drop' assignments cannot be added
      c. access the Assignment Group Edit Modal for group 2
          1. verify the assignment group weight can be changed
          2. verify the drop highest/lowest options can be changed
          3. verify that 'never drop' assignments can be removed
          4. verify that 'never drop' assignments can be added
  C. as an Admin, visit the course assignments page
      a. access the Assignment Settings Modal
          1. verify the 'Weight final grade' option can be changed
          2. verify the individual weights can be changed
      b. access the Assignment Group Edit Modal for group 1
          1. verify the assignment group weight can be changed
          2. verify the drop highest/lowest options can be changed
          3. verify that 'never drop' assignments can be removed
          4. verify that 'never drop' assignments can be added
      c. access the Assignment Group Edit Modal for group 2
          1. verify the assignment group weight can be changed
          2. verify the drop highest/lowest options can be changed
          3. verify that 'never drop' assignments can be removed
          4. verify that 'never drop' assignments can be added
  D. delete Assignment A
  E. as a Teacher in the course, visit the course assignments page
      a. access the Assignment Settings Modal
          1. verify the 'Weight final grade' option can be changed
          2. verify the individual weights can be changed
      b. access the Assignment Group Edit Modal for group 1
          1. verify the assignment group weight can be changed
          2. verify the drop highest/lowest options can be changed
          3. verify that 'never drop' assignments can be removed
          4. verify that 'never drop' assignments can be added
      c. access the Assignment Group Edit Modal for group 2
          1. verify the assignment group weight can be changed
          2. verify the drop highest/lowest options can be changed
          3. verify that 'never drop' assignments can be removed
          4. verify that 'never drop' assignments can be added

Change-Id: I73648f6ae0a3ca2229d383af025bad74dddb5a49
Reviewed-on: https://gerrit.instructure.com/91877
Reviewed-by: Neil Gupta <ngupta@instructure.com>
Tested-by: Jenkins
Reviewed-by: Spencer Olson <solson@instructure.com>
QA-Review: KC Naegle <knaegle@instructure.com>
Product-Review: Danaan Clarke <dclarke@instructure.com>
2016-10-05 19:44:00 +00:00
Matthew Berns b9933af53f add setting for intra-group peer reviews
closes OUT-383

test plan:
- create a group set and at least 2 groups
- assign some students to the groups
- create a new assignment and assign it to the
  group set, and enable peer reviews
- as a student in one of the groups, submit to the
  assignment
- go to the peer reviews page and attempt to
  assign peer reviews
- no peer reviews should be assigned
- on the same page, enable intra-group peer reviews
- attempt to assign peer reviews, peer reviews should
  be assigned to other group members of the submission

UI testing:
- when creating/editing an assignment, the intra-group
  reviews toggle should only be present if the group
  assignment box is checked, and if the automatically
  assign peer reviews toggle is selected
- the setting for intra-group reviews should persist after
  saving

Change-Id: I770749555f70b0e6d204f2d8eca268ec08ddeb36
Reviewed-on: https://gerrit.instructure.com/89757
Reviewed-by: Christian Prescott <cprescott@instructure.com>
QA-Review: Alex Ortiz-Rosado <aortiz@instructure.com>
Tested-by: Jenkins
Product-Review: McCall Smith <mcsmith@instructure.com>
2016-10-05 16:08:37 +00:00
Cody Cutrer 132937bc27 eliminate join thru users table for sensitive assignment overrides query
fixes CNVS-32260

also do a join instead of a subquery. also revert the reverting of
doing it in SQL instead of loading a bunch of ids into memory

Change-Id: I2089b12378ad5301049a4bb427f92b1603c9c964
Reviewed-on: https://gerrit.instructure.com/91405
Reviewed-by: Rob Orton <rob@instructure.com>
Tested-by: Jenkins
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2016-09-29 20:58:26 +00:00
James Williams 8a1d2ebc18 don't include all_dates in assignment api with too many overrides
test plan:
* in the rails console, configure the override threshold with

 Setting.set('assignment_all_dates_too_many_threshold', '5')

* an assignment more than 5 overrides should not return the
 'all_dates' value in the api, but rather 'all_dates_count'

* on the assignment index page, an assignment with more than 5
 overrides should still list "Multiple Dates" but no longer
 shows a tooltip

closes #CNVS-32277

Change-Id: I99df5ae0f482c745f00a2d4c9dcedbc8042f007c
Reviewed-on: https://gerrit.instructure.com/91478
Tested-by: Jenkins
Reviewed-by: Keith T. Garner <kgarner@instructure.com>
Reviewed-by: Matt Berns <mberns@instructure.com>
QA-Review: Heath Hales <hhales@instructure.com>
Product-Review: McCall Smith <mcsmith@instructure.com>
2016-09-29 20:14:25 +00:00
Gerrit Code Review 4ed051a252 Merge "Merge branch 'dev/mgp-v2'" 2016-09-29 19:23:29 +00:00
Jeremy Stanley 60213b772e include ungraded quizzes in TODO items
test plan:
 - ensure ungraded quizzes (survey or practice quizzes)
   due in the near future appear alongside graded quizzes
   and assignments in the To Do list on the dashboard
   - ensure they appear in the correct chronological
     position
   - ensure they link to the quiz properly
   - ensure the X button to remove the notification
     works properly
 - ensure ungraded quizzes are returned by the API
   "TODO items" endpoints for users and courses
   when `include[]=ungraded_quizzes` is supplied
   and that they appear in the correct chronological
   position

closes CNVS-32164

Change-Id: I216140ff9a3cada662c9fc8357de2e0ab0a8fa45
Reviewed-on: https://gerrit.instructure.com/91346
Tested-by: Jenkins
Reviewed-by: James Williams  <jamesw@instructure.com>
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2016-09-29 19:04:55 +00:00
Keith Garner 7b9270cbe6 Merge branch 'master'
Change-Id: Ie2c1a53ce4f4fa4e70b69f97a5468dccdbc07292
2016-09-29 13:55:56 -05:00
Michael Brewer-Davis 49f59190c4 batch operations on assignment overrides
- supports cyoe ability to make multiple overrides for a single
  student

closes CYOE-279

Test plan:
Consult generated api documentation for parameters for the following requests:

1.  As teacher or TA or student, retrieve multiple assignment overrides via
      GET /api/v1/courses/<id>/assignments/overrides
    Should respect override visibility, student visibility
2.  As teacher or TA, update assignment overrides via
      PUT /api/v1/courses/<id>/assignments/overrides
    Should respect validity, permissions, visibility, etc.
3.  As teacher or TA, create assignment overrides via
      POST /api/v1/courses/<id>/assignments/overrides
    Should respect validity, permissions, visibility, etc.

Change-Id: I72f3bdae87f16bb6ff49727cb7880f7728ff60a7
Reviewed-on: https://gerrit.instructure.com/88817
Tested-by: Jenkins
Reviewed-by: Christian Prescott <cprescott@instructure.com>
QA-Review: Christian Prescott <cprescott@instructure.com>
Product-Review: Michael Brewer-Davis <mbd@instructure.com>
2016-09-29 05:33:07 +00:00
Sheldon Leibole 1e4b6147c9 Extend SIS Assignment API for user overrides
Fixes: SIS-2360

Test plan:
- Start canvas and expose it through ngrok
- Install the Pinnacle LTI app
- Create a course
- Create two users WITH an SIS ID
- Add the users to the course
- Create two user lever differentiated assignments for each user
- Use your favorite REST client and hit this endpoint appropriately:
/api/sis/accounts/:account_id/assignments
- Confirm you see a `user_overrides` attribute in the response with
each user override you created and their respective values in this
format:
"user_overrides": [
    {
    "id": [
      {
        "id": 5,
        "name": "some student",
        "sis_user_id": "some-sis-id"
        "override": {
	  "due_at": "2016-08-26T05:59:59Z"
	}
      },
      {
        "id": 10,
        "name": "some other student",
        "sis_user_id": "some-other-sis-id",
        "override": {
          "due_at": "2016-08-26T05:59:59Z"
        }
      }
    ]
  }
]

Change-Id: I88b69c3732d0c3f88b88b7f61b44665e76d094bd
Reviewed-on: https://gerrit.instructure.com/87623
Reviewed-by: Stewie aka Nicholas Stewart <nstewart@instructure.com>
Tested-by: Jenkins
QA-Review: Steven Shepherd <sshepherd@instructure.com>
Product-Review: Nick Houle <nhoule@instructure.com>
2016-09-27 00:09:34 +00:00
Jeremy Neander c2f7d49105 Merge branch 'master' into dev/mgp-v2
Change-Id: I4b542d08b49a491db3f061f4c804aa3d6c99cebe
2016-09-26 13:25:02 -05:00
James Williams 171c74b06d reduce n+1 queries when loading overrides in assignment api json
test plan:
* assignment + assignment_groups api calls with
 include[]=overrides should behave as before
 and have the correct "student_ids" for adhoc overrides

refs #CNVS-31961

Change-Id: I573e034dd844f16f3e51d7b82072410f01685151
Reviewed-on: https://gerrit.instructure.com/91160
Reviewed-by: Jonathan Featherstone <jfeatherstone@instructure.com>
Tested-by: Jenkins
QA-Review: Michael Hargiss <mhargiss@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2016-09-23 21:29:07 +00:00
Brent Burgoyne 0913a186e9 correctly scope rce urls with host to context
the logic that sanitizes urls in user content only converts verified
file urls to file urls in the correct scope when the uri does not
contain the host. this is breaking because the rcs is using full
absolute urls for links to files, and we probably don't want to stop
in case content is rendered on a different domain in the future (lti
app in an iframe?).

fixes CNVS-32091

test plan:
- insert a file link from the rcs sidebar
- inspect the html before saveing
  - should include the host and be a verified url without the context
- save the content
- inspect the html
  - link should include the host, context and context id
    (i.e. https://account.instructure.com/course/1/files...)

Change-Id: I22e872370a120aebc2c60b3a11d2b98be14c7771
Reviewed-on: https://gerrit.instructure.com/91099
Reviewed-by: John Corrigan <jcorrigan@instructure.com>
Reviewed-by: Ryan Shaw <ryan@instructure.com>
Tested-by: Jenkins
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Brent Burgoyne <bburgoyne@instructure.com>
2016-09-23 20:56:58 +00:00
Jeremy Neander d07cb23490 prevent assignment & group deletion in closed periods
Assignments which have been assigned for at least one student in
a closed grading period must not be deletable, except by admins.
The same applies to assignment groups and quizzes.

closes CNVS-30897

test plan:
  A. create or select:
    a. an account
    b. an enrollment term for the account
    c. a grading period set for that term with:
      * a closed grading period
      * an open grading period
    d. a course with that enrollment term
    e. two students (1 & 2) for the course
    f. three assignment groups (1, 2, 3)
    g. an assignment (A) in group 1
      * due for everyone in the closed grading period
    h. an assignment (B) in group 1
      * due for student 1 in the open grading period
      * due for student 2 after the open grading period
    i. an assignment (C) in group 2
      * due for student 1 in the closed grading period
      * due for student 2 in the open grading period
    j. an assignment (D) in group 2
      * due for student 1 after the open grading period
      * for student 2 without a due date
    k. an assignment (E) in group 3
      * due for everyone in the open grading period
  B. as a Teacher in the course
    1. visit the course assignments page
      a. verify assignment A cannot be deleted
      b. verify assignment B can be deleted
      c. verify assignment C cannot be deleted
      d. verify assignment D can be deleted
      e. verify assignment E can be deleted
      f. verify assignment group 1 cannot be deleted
      g. verify assignment group 2 cannot be deleted
      h. verify assignment group 3 can be deleted
    2. visit the edit assignment page for each assignment
      a. verify assignment A cannot be deleted
      b. verify assignment B can be deleted
      c. verify assignment C cannot be deleted
      d. verify assignment D can be deleted
      e. verify assignment E can be deleted
  C. as an Admin
    1. visit the course assignments page
      a. verify assignment A can be deleted
      b. verify assignment B can be deleted
      c. verify assignment C can be deleted
      d. verify assignment D can be deleted
      e. verify assignment E can be deleted
      f. verify assignment group 1 can be deleted
      g. verify assignment group 2 can be deleted
      h. verify assignment group 3 can be deleted
    2. visit the edit assignment page for each assignment
      a. verify assignment A can be deleted
      b. verify assignment B can be deleted
      c. verify assignment C can be deleted
      d. verify assignment D can be deleted
      e. verify assignment E can be deleted
  D. create or select:
    a. an account
    b. an enrollment term for the account
    c. a grading period set for that term with:
      * a closed grading period
      * an open grading period
    d. a course with that enrollment term
    e. two students (1 & 2) for the course
    f. three assignment groups (1, 2, 3)
    g. a quiz (A) in group 1
      * due for everyone in the closed grading period
    h. a quiz (B) in group 1
      * due for student 1 in the open grading period
      * due for student 2 after the open grading period
    i. a quiz (C) in group 2
      * due for student 1 in the closed grading period
      * due for student 2 in the open grading period
    j. a quiz (D) in group 2
      * due for student 1 after the open grading period
      * for student 2 without a due date
    k. a quiz (E) in group 3
      * due for everyone in the open grading period
  B. as a Teacher in the course
    1. visit the course quizzes page
      a. verify quiz A cannot be deleted
      b. verify quiz B can be deleted
      c. verify quiz C cannot be deleted
      d. verify quiz D can be deleted
      e. verify quiz E can be deleted
      f. verify assignment group 1 cannot be deleted
      g. verify assignment group 2 cannot be deleted
      h. verify assignment group 3 can be deleted
    2. visit the show quiz page for each quiz
      a. verify quiz A cannot be deleted
      b. verify quiz B can be deleted
      c. verify quiz C cannot be deleted
      d. verify quiz D can be deleted
      e. verify quiz E can be deleted
    3. visit the edit quiz page for each quiz
      a. verify quiz A cannot be deleted
      b. verify quiz B can be deleted
      c. verify quiz C cannot be deleted
      d. verify quiz D can be deleted
      e. verify quiz E can be deleted
  C. as an Admin
    1. visit the course quizzes page
      a. verify quiz A can be deleted
      b. verify quiz B can be deleted
      c. verify quiz C can be deleted
      d. verify quiz D can be deleted
      e. verify quiz E can be deleted
      f. verify assignment group 1 can be deleted
      g. verify assignment group 2 can be deleted
      h. verify assignment group 3 can be deleted
    2. visit the show quiz page for each quiz
      a. verify quiz A can be deleted
      b. verify quiz B can be deleted
      c. verify quiz C can be deleted
      d. verify quiz D can be deleted
      e. verify quiz E can be deleted
    3. visit the edit quiz page for each quiz
      a. verify quiz A can be deleted
      b. verify quiz B can be deleted
      c. verify quiz C can be deleted
      d. verify quiz D can be deleted
      e. verify quiz E can be deleted

Change-Id: I2176904e9de96b61f31c9972c4c35b2b72367c54
Reviewed-on: https://gerrit.instructure.com/88608
Tested-by: Jenkins
Reviewed-by: Spencer Olson <solson@instructure.com>
Reviewed-by: Derek Bender <djbender@instructure.com>
QA-Review: KC Naegle <knaegle@instructure.com>
Product-Review: Christi Wruck
2016-09-23 17:51:43 +00:00
James Williams d910fec804 show cross-shard submission comments in inbox
test plan:
* have an instructor on a different shard than a course
* on the course, submit to an assignment as a student
 and make a comment on the submission
* the comment should show up in the instructor's
 "Submission Comments" inbox

closes #CNVS-31502

Change-Id: I3313c64c6b3c0cfc60f130745aec5ce7cb2781bf
Reviewed-on: https://gerrit.instructure.com/89704
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Jenkins
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2016-09-22 16:47:44 +00:00
James Williams 186fbab507 retain post_to_sis on assignment when updating without parameter
test plan:
* enable the "Post Grades to SIS" feature flag
 to enable the option when creating assignments
* create an assignment with "Post Grades" on and a due date
* on the calendar, drag the assignment from one day
 to another
* it should not reset the "Post Grades" setting to
 the account default (i.e. off)

* new assignments created through api should still have
 their "Post Grades" (post_to_sis) setting set to the
 account default (can be changed in the account settings)
 as with g/84391

closes #CNVS-31951

Change-Id: I9fdf31f76f2d72a9a3da03ecc9230eaf202c45e5
Reviewed-on: https://gerrit.instructure.com/90569
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2016-09-21 19:59:46 +00:00
James Williams 3c0972418a only preload common contexts if contexts are requested
should improve performance on conversations index

Change-Id: I93517ab7d856950d4cf3fddc500b8f2cd3f9168b
Reviewed-on: https://gerrit.instructure.com/90931
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2016-09-21 14:55:11 +00:00
James Williams e506a58863 remove unused "interleave_submissions" code
Change-Id: I70540791ffb2f294139912fb78d020ed4a5e6d0a
Reviewed-on: https://gerrit.instructure.com/90679
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2016-09-19 19:30:06 +00:00
James Williams a080e9c2cf fix current_user_and_observed for unenrolled users
Change-Id: Id63f4f824374531fb8e176f08a60dc36cf3f60ec
Reviewed-on: https://gerrit.instructure.com/90335
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2016-09-15 18:52:50 +00:00
Felix Milea-Ciobanu c4b625e804 module item placeholders for cyoe locked and choice states
test plan:
- as a teacher create a conditional assignment
- create a module and a module item for that assignment
- as a student, view the modules page
- a new module item with a locked icon and a description should show
up below the conditional module item
- make a submission to the conditional assignment
- as a teacher, grade conditional assignment submission
- as a student, view the modules page
- a new module item with an unlocked icon and a description
indicating you can choose an assignment group should show up below
the conditional module item
- a blue badge should show up in that module item with the number of
options available to the student
- as a teacher, add module items of every type to the same module
- as a student, check the modules page and make sure nothing
 unexpected is happening due to the variety of the module items

refs CYOE-241 CYOE-266

Change-Id: I36d80c0ab8e7a0f3d33a9beddf537add76092d52
Reviewed-on: https://gerrit.instructure.com/84907
Reviewed-by: Christian Prescott <cprescott@instructure.com>
Tested-by: Jenkins
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
Product-Review: Matt Goodwin <mattg@instructure.com>
2016-09-12 16:55:02 +00:00
Dan Minkevitch e31f284924 Add correct check for assignment id for CYOE
fixes CYOE-302

Test Plan:
* make sure CYOE is enabled in the course
* create a new assignment, take note of its ID
* add a simple cyoe rule to that assignment
* create enough new pages in that course so that a page exists that
  has a corresponding ID to the assignment ID from the step above
  (if the assignment ID is 12, you might need to create 12 new pages
  so that the last one has an ID of 12)
* create a new module
* add the assignment created before as well as the page with the
  same page ID as module items
* make sure the module and its items are published
* view the page as a student enrolled in that course
  (will need g/84907 pulled down or just test against API directly)
* a module item placeholder should not show up under the wiki page
  with the matching ID

Change-Id: I8c89d21158e51793fe345906fd05db64286d5df7
Reviewed-on: https://gerrit.instructure.com/89162
Reviewed-by: Christian Prescott <cprescott@instructure.com>
Tested-by: Jenkins
QA-Review: Christian Prescott <cprescott@instructure.com>
Product-Review: Dan Minkevitch <dan@instructure.com>
2016-09-09 21:53:20 +00:00
Jeremy Stanley 8a812f1f77 show appointment slots on calendar in "Find Appointment" mode
and gray out everything else

test plan:
 - enable "better scheduler" feature
 - have two or more courses with appointment groups configured
   including an appointment group that covers multiple courses
 - go to the calendar
 - click the "Find Appointments" button and select a course
 - ensure available appointment slots for that course appear
   on the calendar, and other events are grayed out
 - click the "Close" button (that took the place of
   "Find Appointments") and the calendar should return
   to normal
 - ensure in the case of a multi-course appointment group,
   selecting either course from the "Find Appointment"
   button shows the appointment slots

closes CNVS-31160
closes CNVS-31161

Change-Id: I80722b5723537b0559f40e942c504d235b16cef3
Reviewed-on: https://gerrit.instructure.com/88812
Reviewed-by: Clay Diffrient <cdiffrient@instructure.com>
Tested-by: Jenkins
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2016-09-09 17:15:56 +00:00
John Corrigan 594a645814 add `<track>`s to html API output
fixes CNVS-30960

test plan:
- Have an assignment / page/ discussion topic with an inline video that
  has a subtitle track.
- View the content via the API.
- Observe that the `<video>` tag has a nested `<track>` tag, that
  includes the `srclang`, `kind`,`src` & `label` attributes.
- Grab the link present in the `src` attribute.
- Observe that the track subtitle information is displayed.

Change-Id: Ic95af245dc866541b495aa6f94aa49ed4e72f995
Reviewed-on: https://gerrit.instructure.com/89498
Tested-by: Jenkins
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: John Corrigan <jcorrigan@instructure.com>
2016-09-08 21:57:55 +00:00
Ryan Shaw dbb7d422c8 remove scrollSidebar since it only affected oldUI
closes: CNVS-31373

test plan:

* edit a wiki page, an assignment and the syllabus
* there should not be any js errors when the page loads

Change-Id: I84bff68e6b120d52703606415972de89d547fa5c
Reviewed-on: https://gerrit.instructure.com/89023
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Tested-by: Jenkins
Product-Review: Ryan Shaw <ryan@instructure.com>
2016-09-07 18:06:16 +00:00
Cody Cutrer 38a4420425 avoid loading all users in a course into memory for override calculations
Change-Id: I64af5a809df9cfb1702a4f44aa11b7c803bca978
Reviewed-on: https://gerrit.instructure.com/89785
Reviewed-by: Tyler Pickett <tpickett@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Tested-by: Cody Cutrer <cody@instructure.com>
2016-09-07 16:12:49 +00:00
Jordan Farnworth 26a5e60c34 allow only_visible_to_overrides on quiz to be updated via API
refs CNVS-31465

Test Plan:
1) verify that the attribute only_visible_to_overrides is able to be
updated through the API
2) once flag has been updated, verify that the quiz respects the changes
ie, students that do not have a differentiated override do not have a
due date
3) once flag has been update to true, the quiz should be able to be saved,
updated and deleted via the Canvas User interface.

Change-Id: I3310c191e6e6f9e6bbdf6864af0db2e56438ca32
Reviewed-on: https://gerrit.instructure.com/89302
Reviewed-by: Tyson Brown <tbrown@instructure.com>
Tested-by: Jenkins
Reviewed-by: Davis Lynn McClellan <dmcclellan@instructure.com>
QA-Review: Michael Hargiss <mhargiss@instructure.com>
Product-Review: Jason Sparks <jsparks@instructure.com>
2016-09-02 17:21:27 +00:00
James Williams b241b30a8a fix module sequence footer with old bad announcement module items
it's probably too disruptive to delete them for people

closes #CNVS-31439

Change-Id: Ie1e716b2e43bd0a5961555609fdfd7872845405d
Reviewed-on: https://gerrit.instructure.com/89342
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2016-09-02 12:36:01 +00:00
John Corrigan 05ed9f3945 include mime_class & media_entry_id in attachment_json response
Also adds a `audio/mp3` => `audio` mime_class mapping.

closes CNVS-31340
refs CNVS-30900

test plan:
- Hit a files-related API endpoint that uses `attachment_json` under the
  hood. I was using:
  `/api/v1/folders/:folder_id/files?per_page=50&include[]=preview_url`
- Observe that `mime_class` & `media_entry_id` values are included.

Change-Id: I3ea854b9bfff0eb3e629b0ffd3dc75fe0694b93a
Reviewed-on: https://gerrit.instructure.com/88686
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: John Corrigan <jcorrigan@instructure.com>
2016-08-30 22:24:25 +00:00
James Williams 5c6ab9b3c0 fix mobile overrides in materialized discussion view
test plan:
* add js/css to the mobile section of the theme editor
* create a discussion with replies
* it should not load the mobile js/css

* view the discussion topic through the API w/ token
* the "message" values should include stylesheet/javascript tags

closes #CNVS-30339

Change-Id: I4a41a8fa74f9ed3ec8200ac618e6f878e726b0e6
Reviewed-on: https://gerrit.instructure.com/85310
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Reviewed-by: Ryan Shaw <ryan@instructure.com>
Tested-by: Jenkins
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2016-08-30 17:23:53 +00:00
Jeremy Stanley 567345908a regenerate submissions zip if anonymous grading setting changes
test plan:
 - have a course with "anonymous grading" turned off
 - have an assignment with files submitted by students
 - download submissions as a zip file from the assignment page
 - turn on the "anonymous grading" feature setting for the course
 - download submissions again and ensure you get a new file
   that does not include student names

fixes CNVS-31349

Change-Id: I4fb17b29c4b25e3bdedf2fb0770b47b94267e00b
Reviewed-on: https://gerrit.instructure.com/88947
Tested-by: Jenkins
Reviewed-by: James Williams  <jamesw@instructure.com>
QA-Review: Heath Hales <hhales@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2016-08-29 20:28:33 +00:00
Nathan Mills 946e226211 move extensions to the placments class
refs PLAT-1730

test plan:
LTI 1 shouldn't be broken

Change-Id: Ie66adf8d16e963bfc218840c9a57294a4421d75c
Reviewed-on: https://gerrit.instructure.com/88866
Tested-by: Jenkins
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Nathan Mills <nathanm@instructure.com>
2016-08-29 15:32:35 +00:00
Matthew Berns 88805f4b1e add new Rubric API endpoint
closes OUT-358
refs PFS-4925

test plan:
- review new API documentation
- create some rubrics in the context of an account
- create some rubrics in the context of a course
- attach the rubrics to some assignments
- for at least one assignment, enable peer reviews
  and assign some students
- as a teacher, assess the assignment
- as a student, complete some peer reviews
- go to the following endpoints

  api/v1/accounts/{account_id}/rubrics
  - should list all rubrics in the given account

  api/v1/courses/{course_id}/rubrics
  - should list all rubrics in the given course

  api/v1/accounts/{account_id}/rubrics/{rubric_id}
  - should list the specific account rubric

  api/v1/courses/{course_id}/rubrics/{rubric_id}
  - should list the specific course rubric

  api/v1/courses/{course_id}/rubrics/{rubric_id}?include=assessments
  - should include all assessments for the rubric

  api/v1/courses/{course_id}/rubrics/{rubric_id}?include=graded_assessments
  - should include only the assessment(s) used for grading the rubric

  api/v1/courses/{course_id}/rubrics/{rubric_id}?include=peer_assessments
  - should include only the peer_assessment(s) for the rubric

- when getting assessments, add the following parameters

  &style=full
  should return the full data hash associated with returned assessments

  &style=comments_only
  should only return the comments from an assessment's data hash

- when entering in invalid values for include or style, an error
  should be returned that provides you with the valid values for
  the respective parameters

Change-Id: Ib46900d4c58e06d6fa2771614ba2efa11d3b5b6c
Reviewed-on: https://gerrit.instructure.com/87702
Tested-by: Jenkins
Reviewed-by: Michael Brewer-Davis <mbd@instructure.com>
QA-Review: Alex Ortiz-Rosado <aortiz@instructure.com>
Product-Review: Josh Simpson <jsimpson@instructure.com>
2016-08-26 18:53:43 +00:00
Cody Cutrer e2ed5cb62f preload attachments for gradebook history
refs CNVS-31321

also need to memoize Version#model, so that the preload works with
the same object that is used later

Change-Id: Iee74ceda58b69287e5fc7b70f9ecee0da0332c6b
Reviewed-on: https://gerrit.instructure.com/88819
Tested-by: Jenkins
Reviewed-by: Rob Orton <rob@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2016-08-26 16:27:46 +00:00
Cody Cutrer b0a686fa06 preload submission attempt assignment
refs CNVS-31321

it's used by Submission#user_can_read_grade?, which is called by
filter_attributes_for_user, which is triggered by json serialization

Change-Id: I0daba4eaeb874cc39767019ccc79e211c89ac674
Reviewed-on: https://gerrit.instructure.com/88821
Tested-by: Jenkins
Reviewed-by: Rob Orton <rob@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2016-08-26 16:27:20 +00:00
Dan Minkevitch bdfa3a3906 Include CYOE data in Modules API
closes CYOE-239
closes CYOE-270

Test Plan:
* Prerequisites: CYOE-240 deployed on CYOE testing
  environment (if not already merged).
* Create a module with various module items that have
  conditional content/mastery paths data associated
  with them (e.g. assignment sets in scoring ranges
  with associated assignments)
* Make a Canvas API request to the List Module Items
  endpoint, adding `mastery_paths` to the `includes`
  parameter as part of the call
* The response should include the mastery paths data
  for the requested module items

Change-Id: I7f5f37ea10b1b37d8dc81bd54b1a9413f8bbbc05
Reviewed-on: https://gerrit.instructure.com/86868
Reviewed-by: Michael Brewer-Davis <mbd@instructure.com>
Tested-by: Jenkins
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
Product-Review: Dan Minkevitch <dan@instructure.com>
2016-08-25 22:17:01 +00:00
Jeremy Stanley 801612b775 don't show past appointment slots to students for reservation
test plan:
 - as a student, you should not see already-ended scheduler slots
   available for reservation on the Scheduler page

closes CNVS-20980

Change-Id: Ic0e813ebede2afa697a57e923f81ba52ddd20845
Reviewed-on: https://gerrit.instructure.com/87717
Tested-by: Jenkins
Reviewed-by: Joel Hough <joel@instructure.com>
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2016-08-24 17:06:08 +00:00
Christian Prescott 4a7227c050 Fix modules ignoring page assignment override behavior
Filters pages from set of assignments rendered in modal
Filters pages from displayed content tags according to differentiated
assignments behavior

refs CYOE-263

Test Plan:
1. Create a wiki page, via pages index or modules + button
2. Ensure page can be added to module and is visible to students
3. Check edit page, "mastery paths content"
4. Ensure the page is no longer visible to students in modules, until
   they are assigned it via an override.
5. Open the "add item to module" modal. Ensure the page does not appear
   in the assignments section, only under pages.

Change-Id: I822d53dc562476ef422f4a3ee6004e0d1e132246
Reviewed-on: https://gerrit.instructure.com/87418
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Jenkins
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
Product-Review: Christian Prescott <cprescott@instructure.com>
2016-08-17 16:26:45 +00:00
Anti Revoluzzer e5b67824dd Add include_in_final_grade to sis api
Refs SIS-2397

WHY:  For Pinnacle grade passback, we need to derive
      include_in_final_grade from grading_type and
      omit_from_final_grade and expose it in the SIS
      assignment API so that teachers are able to set these
      attributes and have them reflected in Pinnacle.

Test Plan:
      See acceptance criteria

Change-Id: Ie15d736357cf86bac2d3f0d77c08ee77722f0cae
Reviewed-on: https://gerrit.instructure.com/87866
Reviewed-by: Stewie aka Nicholas Stewart <nstewart@instructure.com>
Tested-by: Jenkins
QA-Review: Kausty Saxena <kausty@instructure.com>
Product-Review: Oxana
2016-08-16 23:48:44 +00:00
Dave Donahue afbe35d78f add sis_account_id filter and field to enrollments API
fixes SIS-2345

Test plan:
1) Create a course with some enrollments in different subaccounts.
2) Set the sis_source_id field on the accounts to some different values.
3) Run an enrollment query as an account admin filtering on sis_account_id
   `curl http://canvas.docker/api/v1/courses/X/enrollments \
     -H 'Authorization: Bearer 1~ur_token' \
     -X GET -F 'sis_account_id=ur_sis_id'`
4) Ensure the response behaves as you would expect, returning only
   enrollments for matching accounts, based on the account in which
   the course lives.
5) Ensure the sis_account_id parameter is returned both when listing
   enrollments and when looking up an individual one.
6) Now try running a query on the sis_account_id as a less privileged user
   like a student. Verify that you receive an error message since students
  do not have permissions to view SIS data.
7) Rebuild API docs and verify the updates look sane.

Change-Id: Ib5fa80e5465bebd29976d5c91309db15498c8edb
Reviewed-on: https://gerrit.instructure.com/87808
Reviewed-by: Hannah Bottalla <hannah@instructure.com>
Product-Review: Hannah Bottalla <hannah@instructure.com>
Tested-by: Jenkins
QA-Review: Kausty Saxena <kausty@instructure.com>
2016-08-15 23:41:56 +00:00
Dave Donahue 6c80614e7f add sis_user_id filter and field to enrollments API
fixes SIS-2367

Test plan:
1) Create a course with some enrollments.
2) Set the sis_user_id value on your test users' pseudonyms.
3) Run an enrollment query as an account admin filtering on the sis_user_id
   `curl http://canvas.docker/api/v1/courses/X/enrollments \
     -H 'Authorization: Bearer 1~ur_token' \
     -X GET -F 'sis_user_id=ur_sis_id'`
4) Ensure the response behaves as you would expect, returning only
   enrollments for matching users.
5) Ensure the sis_user_id parameter is returned both when listing
   enrollments and when looking up an individual one.
6) Now try running a query on the sis_user_id as a less privileged user
   like a student. Verify that you receive an error message since students
  do not have permissions to view SIS data.
7) Rebuild API docs and verify the updates look sane.

Change-Id: I8f0cf0b47cdff5f12d6de88e8d6ae8567a7c4cfe
Reviewed-on: https://gerrit.instructure.com/87570
Reviewed-by: Hannah Bottalla <hannah@instructure.com>
Product-Review: Hannah Bottalla <hannah@instructure.com>
Tested-by: Jenkins
QA-Review: Kausty Saxena <kausty@instructure.com>
2016-08-15 17:19:38 +00:00
Jacob Fugal 9a077a7873 AddressBook facade
fixes CNVS-29824
refs CNVS-29862, CNVS-29867

test-plan:
  check for regressions around:

  * accessing profile#show endpoint, with profiles enabled, is
    authorized if and only if current user knows profile owner.

  * eportfolios#show, with profiles enabled, includes link to owner's
    profile if and only if current user knows owner.

  * conversations:
    - filtering of individual recipients when creating a conversation
    - expansion of context recipients when creating a conversation
    - restriction of individual recipients to those known via course
      when creating a conversation in a course
      - including as an admin over that course
    - filtering of individual recipients when adding a message to an
      existing conversation allows existing recipients

  * searching/browsing address book (conversation creation, link
    observer to students, due date overrides, etc.):
    - when loading info about single user (user_id parameter), including
      combinations of conversation_id and context parameters, returns
      user data if and only if the target is known to current user under
      those parameters
    - users matched:
      - excludes already listed users
      - restricts to users known via specified context, if any
        - including as an admin over that context
      - finds users with weak associations (e.g. invited student that
        hasn't logged in for first time yet) when linking observers
      - doesn't find users with weak associations otherwise
    - contexts matched:
      - limited to those known to current user
      - have count of known users
      - have counts of known users in synthetic contexts

  * data returned for known users in various API calls include common
    course and groups between current user and returned user

Change-Id: I66bca0921b298be8d529a713fa982a6dfdcbcc8e
Reviewed-on: https://gerrit.instructure.com/84045
Reviewed-by: Jonathan Featherstone <jfeatherstone@instructure.com>
Tested-by: Jenkins
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
2016-08-15 15:03:56 +00:00
Matthew Sessions f5e94e2ce1 Add deleted conversations api
Site admin users can query for deleted conversations
allowing support to handle cases involving disputes
regarding content of conversations that have been
deleted.

Fixes CNVS-30743

Test Plan:
 - Create a conversation
 - Ensure the conversation has a message
 - Delete the conversation which will
   delete all of the messages
 - As a site admin hit
   /api/v1/conversations/deleted?user_id=<user_id>
 - The list of conversation messages should show
 - Provide another query param of conversation_id=<conversation_id>
 - Only deleted messages from the provided conversation
   should show
 - Using the deleted_before and deleted_after query
   params you should be able to filter based on the
   deleted_at date

Change-Id: Ia39d2763627be82f8084877a307ee2737a7e97d2
Reviewed-on: https://gerrit.instructure.com/86946
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Jenkins
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: Matthew Sessions <msessions@instructure.com>
2016-08-10 15:11:59 +00:00
Kacey Roberts efb663e016 New Syllabus visibility option for authenticated non-course user.
Test Plan:
- Create a new course
  Course setting[public_syllabus_to_auth] will be false
    Authenticated users not enrolled in the couse can not see the syllabus
     contents.
- Change course setting[public_syllabus_to_auth] to true
  Authenticaed users not enrolled in the course will be have access to
    syllabus as if it was setting[public_syllabus] were true.
- Change setting[public_syllabus_to_auth] to false and set
  setting[public_syllabus] to true
  All access rules will remane the same.
- Setting both settings to false
  The couse will only allow enrolled students to view the syllabus.

Change-Id: I97f49035c8a4749afbffbb5dd08c7b1facea6b03
Fixes: PFS-4867
Reviewed-on: https://gerrit.instructure.com/85169
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2016-08-09 16:26:37 +00:00
Matthew Berns 8ef2bfa815 disable "Edit" button on assessed Account outcome
fixes CNVS-23842

test plan:
- create two account level outcomes (A and B)
- import them into two different courses
- assess outcome A in one of the courses
- editing/deleting outcome A should be disabled in
  that course and on the account level
- you should still be able to delete outcome A
  in the course it's not assessed in
- outcome B should be able to be deleted from either
  course or edited at the account level

Change-Id: I886d6c8dd6e4456772a531d02d0c4c27c95b92c4
Reviewed-on: https://gerrit.instructure.com/84203
Reviewed-by: Tyler Pickett <tpickett@instructure.com>
QA-Review: Alex Ortiz-Rosado <aortiz@instructure.com>
Tested-by: Jenkins
Product-Review: McCall Smith <mcsmith@instructure.com>
2016-08-08 18:57:12 +00:00
James Williams c2408f388a don't show groups to students for unpublished courses
try to future proof it as well by tying to :read permission

test plan:
* add a student a group in an unpublished course
* it should not be shown on the dashboard list of groups

closes #CNVS-30391

Change-Id: I84ddeb9a096ad80aec89805b044e03a2c2670ea3
Reviewed-on: https://gerrit.instructure.com/86823
Tested-by: Jenkins
Reviewed-by: Clay Diffrient <cdiffrient@instructure.com>
QA-Review: Heath Hales <hhales@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2016-08-06 01:54:33 +00:00
Spencer Olson dcf034b7a3 add 'multiple_grading_periods_enabled' to course json
when 'current_grading_period_scores' are requested from
the courses API, there will now be a
'multiple_grading_periods_enabled' key returned which
indicates whether or not the course has the multiple
grading periods feature enabled.

closes CNVS-30327

test plan:
- in a course with multiple grading periods enabled,
  hit the courses api index with the
  current_grading_period_scores flag. for example:

    GET api/v1/courses/2?include[]=current_grading_period_scores

- verify the response has a 'multiple_grading_periods_enabled'
  key, and verify the value is true
- disable the multiple grading periods feature for the course
- hit the courses api index with the current_grading_period_scores
  flag again
- verify the response has a 'multiple_grading_periods_enabled'
  key, and verify the value is false
- hit the courses api index without the current_grading_period_scores
  flag. for example:

    GET api/v1/courses/2

- verify the response does not have a
  'multiple_grading_periods_enabled' key

Change-Id: I244aadb6fa9ad86f9cd866a3790501f447bd5037
Reviewed-on: https://gerrit.instructure.com/85496
Reviewed-by: Keith T. Garner <kgarner@instructure.com>
Reviewed-by: Neil Gupta <ngupta@instructure.com>
Tested-by: Jenkins
QA-Review: KC Naegle <knaegle@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2016-07-28 17:44:52 +00:00
Cody Cutrer 49ee1a33aa allow multiple redirect URIs
fixes CNVS-30433

and match them exactly

test plan:
 * edit an existing developer key
 * it should list both a legacy redirect URI, and a place
   to put multiple redirect URIs
 * add some URIs to it and save
 * reload the page, and edit again
 * they should be there
 * add a new developer key
 * it should not have a place to put legacy redirect URI
 * save, refresh, edit, and it still shouldn't

Change-Id: Ie61c9b4026ca675df8f64d660480e52fafff0c57
Reviewed-on: https://gerrit.instructure.com/76990
Reviewed-by: Simon Williams <simon@instructure.com>
Tested-by: Jenkins
QA-Review: Benjamin Christian Nelson <bcnelson@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2016-07-28 01:07:58 +00:00
Clay Diffrient 8a27560a43 Add image as an option for course settings hash
This makes it so valid image strings can be set
inside the course settings hash and referred to later.

closes CNVS-28645

Test Plan:
  - Make a PUT request to /api/v1/courses/XX
  - Include course[image_id]=FILE_ID where FILE_ID
    is a course file id in the request body
  - Make a GET request to /api/v1/courses/settings
    the settings  should include an image_id key with
     that file id set as the value
  - Do another PUT request to /api/v1/courses/XX
    with course[image_url]="http://farm3.static.flickr.com"
  - Getting the course settings again should include
    that.

Change-Id: Idafe3728ebf764e161bf666e70a3a0f7c7515195
Reviewed-on: https://gerrit.instructure.com/76952
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Colleen Palmer <colleen@instructure.com>
Tested-by: Jenkins
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
2016-07-27 15:15:14 +00:00
Jeremy Stanley ed69d52093 fix context for multi-course appointment events
test plan:
 - have an appointment group covering courses A and B
   allowing 2 or more sign-ups per slot
 - sign up a student from course A from a slot
 - as a student in course B, ensure the slot is visible
   in Scheduler

fixes CNVS-30397

Change-Id: I8c9f192eb29f0e8c1af1aba669a81c0491451a11
Reviewed-on: https://gerrit.instructure.com/85494
Tested-by: Jenkins
Reviewed-by: Alex Boyd <aboyd@instructure.com>
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2016-07-25 19:07:58 +00:00
Jeremy Stanley 1c8c021c39 add time_zone to course APIs
test plan:
 - course index and show actions should return time zone names
 - course time zones should be set when `course[time_zone]`
   is given (render and check API documentation)

closes CNVS-30534

Change-Id: I076f10b7c2ec00eca1e96f50686fb609e6a0fe79
Reviewed-on: https://gerrit.instructure.com/85858
Tested-by: Jenkins
Reviewed-by: James Williams  <jamesw@instructure.com>
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2016-07-25 19:07:41 +00:00
Amber Taniuchi dc34731e20 add not counted towards final grade flag to assignments
Teachers have requested for the ability to choose
which assignments count towards the final grade. I have
added a checkbox in the Assignment edit page that
can be checked that says, "This assignment does not count
toward the final grade." A new column has also been added
to the Assignments table to track this state called
"omit_from_final_grade," logic to omit such assignments
in the grade calculators, as well as notification in
assignment show, details, student grades pages, gradebook
and SRGB that notify an assignment is not included in
final grade. New state also added in assignment json.

fixes CNVS-28528

Test Plan:
As a Teacher:
1. Create or edit an assignment.
Verify there is a checkbox to not include the assignment
towards the final grade right below the grading type dropdown.
(This checkbox will not show up for not_graded grading type)
2. Save the assignment.
Verify there is a warning that the assignment is not
counted towards final grade.

As a Student:
1. Go to the assignment created above as a teacher
Verify the assignment show page (courses/x/assignments/y)
warns about the assignment not counting towards final grade.
2. Submit to the assignment.
3. Go to the assignment details page
Verify there is a warning that the assignment is not
counted towards final grade.

As a Teacher:
1. Go to gradebook2
Verify there is a warning that the assignment is not
counted towards final grade.
2. Grade the assignment
Verify in the Total Grade column that grade for the
assignment is not included in the final grade.
3. Download CSV
Verify assignment is not included in final grade.
4. Verify all the above for SRGB

As a Student:
1. Go to the Student Grades Page
Verify a flag that assignment is not counted towards
final grade.
Verify the total grade shown does not include
grade given for the assignment.

Change-Id: I61e2d8ca02201c6e5ff4fc063432b190b6f3d60f
Reviewed-on: https://gerrit.instructure.com/77201
Tested-by: Jenkins
Reviewed-by: Neil Gupta <ngupta@instructure.com>
Reviewed-by: Derek Bender <djbender@instructure.com>
QA-Review: KC Naegle <knaegle@instructure.com>
Product-Review: Christi Wruck
2016-07-14 23:31:40 +00:00
Shahbaz Javeed f7aab2e3c0 autosave comments on navigating to different user in speedgrader
closes CNVS-28529

While in SpeedGrader, if you have something entered in the comments
field and, without submitting those comments, you navigate to a
different user or otherwise navigate away from SpeedGrader, your
comments will now automatically be saved as "draft" comments for
that user's submission.

Draft comments
* don't show up anywhere other than while grading
* are invisible to users whether or not the assignment is muted
* are only "submittable" by the author of the draft comment

test plan:
1. Create a course, with at least two students
2. Add a quiz with at least one essay type question
3. As each student, take the quiz
4. As the teacher, grade the quiz and start up SpeedGrader
5. Enter comments for the first student's submission but do *not*
   submit them
6. Navigate to the next student
7. You should see a message telling you your comment was
   auto-saved
8. Go back to the previous student
9. You should see your comment styled differently with a red
   asterisk before it, indicating a draft comment (also using
   aria-label for a11y goodness)
10.Enter another comment and this time submit it
11.You should see your comment styled normally without a red
   asterisk before it, indicating a normal (non-draft) comment
12.Try steps 5 through 11 with different ways of leaving that
   student in step #6 e.g. using the drop down, or quitting
   SpeedGrader altogether and you should see the same results for
   draft comments
13.Go back to a submission with a draft comment.
14.Click on the button labelled "Publish" next to your draft
   comment.
15.Watch your comment change in appearance from a draft comment
   to a regular comment
16.Delete any comment and watch it disappear from the comment
   list.
17.Go to the next student
18.Go back to the previous student for whose submission you
   deleted the comment
19.Notice the deleted comment remains missing from the comment
   list.
20.Verify that, if logged in as a student, you never see draft
   comments

Change-Id: If32294a7bed6f847709b54d4c8e4fc21fb2a6eca
Reviewed-on: https://gerrit.instructure.com/77133
Reviewed-by: Spencer Olson <solson@instructure.com>
Reviewed-by: Neil Gupta <ngupta@instructure.com>
Tested-by: Jenkins
QA-Review: Amber Taniuchi <amber@instructure.com>
Product-Review: Christi Wruck
2016-07-14 21:51:55 +00:00
Cody Cutrer f0c093ddc0 expose integration id on user details page
closes CNVS-30248

test plan:
 * as an admin with manage sis, you should be able to view and edit
   logins with integration ids
 * as someone with view SIS, but not manage, you should be able to
   see it
 * as someone without any sis permissions, you should not see it at
   all

Change-Id: I69545a04d9eeb0a7ceb77c51d65dd8d3b05a2d58
Reviewed-on: https://gerrit.instructure.com/84538
Reviewed-by: Simon Williams <simon@instructure.com>
Tested-by: Jenkins
QA-Review: Benjamin Christian Nelson <bcnelson@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2016-07-13 20:49:41 +00:00
Cody Cutrer 3a022627f1 federated attributes backend
refs CNVS-28864

test plan:
 * ensure the API docs for authentication providers render;
   familiarize yourself with the formats of the
   federated_attributes configuration
 * configure a SAML provider, via the API, passing
   federated_attributes
 * do a SAML login, passing some of the attributes you
   configured in the previous step; the user should update
   in Canvas with the passed attributes
 * enable JIT provisioning
 * ensure a new user being created via SAML gets the
   attributes set correctly
 * configure one of the federated_attributes as
   "provisioning_only": true
 * do a normal login; that attribute should not update
 * create a new user via JIT provisioning; that
   attribute should still be set

Change-Id: I0a5f3215bafd5c1980d2ea5deb62f2b22a79f8aa
Reviewed-on: https://gerrit.instructure.com/80677
Reviewed-by: Simon Williams <simon@instructure.com>
Tested-by: Jenkins
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2016-07-13 19:00:00 +00:00
Jeremy Stanley a4d05c7b3c add include[]=tabs option for courses and groups apis
test plan:
 - in the courses and groups APIs, use
   include[]=tabs and ensure tabs are returned
   as they are in the Tabs API
 - regression test the Tabs API (since its code was
   refactored for use by courses and groups APIs)

closes CNVS-23298

Change-Id: I6bc349c72d4a1cedee83794d46108c538a770102
Reviewed-on: https://gerrit.instructure.com/84240
Tested-by: Jenkins
Reviewed-by: James Williams  <jamesw@instructure.com>
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2016-07-13 18:29:35 +00:00
Stewie (Nicholas Stewart) b3a237f7a3 Add group_weight to assignments api endpoint
WHY:  For Pinnacle grade passback we need to expose group_weight as
part of the assignment_group object in the assignment api.

See updated docs locally:
http://canvas.docker/doc/api/sis_integration.html#method.sis_api.sis_assignments

Test Plan:
  See acceptance criteria

Change-Id: I52ae97f40d6b1a16f7aac96ba94faca32874918f
Fixes: SIS-2270
Reviewed-on: https://gerrit.instructure.com/84862
Reviewed-by: Nick Houle <nhoule@instructure.com>
Tested-by: Jenkins
QA-Review: Steven Shepherd <sshepherd@instructure.com>
Product-Review: Brad Humphrey <brad@instructure.com>
2016-07-12 20:05:15 +00:00
Rob Orton 4e13360e02 respect default for post_to_sis in api
fixes SIS-1955

test plan
 - create an assignment with no post_to_sis
 - it should respect the default
 - create one with post_to_sis
 - it should respect what is set

Change-Id: I48a7b1403201d33b6d27371f1271f13fbc51496b
Reviewed-on: https://gerrit.instructure.com/84391
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Steven Shepherd <sshepherd@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2016-07-11 16:48:36 +00:00
James Williams ca74a2b7a6 don't show groups for deleted courses in menu list
test plan:
* add a user to a course group
* delete the course
* the group should no longer be listed in the user's
 groups in the new UI menu

closes #CNVS-29983

Change-Id: If39e3a4f99a14b9c853a40008badf7ddb3286236
Reviewed-on: https://gerrit.instructure.com/84141
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Jenkins
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2016-07-01 17:03:04 +00:00
Matthew Sessions 8e5b12ae88 Add ability to launch to edit collaboration
Fixes PLAT-1582

Test Plan:
 - Create a collaboration
 - Click the edit button
 - If the modal opens and something loads it works

Change-Id: I62606fe5de559c15dfd7f915dbd89accf7ff7066
Reviewed-on: https://gerrit.instructure.com/81981
Reviewed-by: Steven Burnett <sburnett@instructure.com>
Tested-by: Jenkins
QA-Review: August Thornton <august@instructure.com>
Product-Review: Matthew Sessions <msessions@instructure.com>
2016-06-30 18:44:46 +00:00
Jeremy Stanley 9a7b8ade54 list-announcements-by-date API
test plan:
 - consult API documentation for announcements
 - test the list-announcements endpoint
   (/api/v1/announcements) and ensure:
   1. an array of context_codes is expected, and status
      400 is returned if it is missing or contains
      non-course codes;
   2. announcements are retrieved for multiple courses;
   3. the API returns status 401 if the caller doesn't
      have permission to read announcements in _any_ of
      the given courses;
   4. announcements set to post in the future are
      returned only to teachers (in fact, they must
      be admins in all given contexts);
   5. if start_date and end_date are provided, the
      results are filtered appropriately (with the
      delayed_post_at date overriding the posted_at
      date if present)
   6. if start_date and end_date are omitted, announcements
      from two-weeks-ago to two-weeks-from-now are
      returned.

closes CNVS-29831

Change-Id: Id43f02dc8dd9fb60f14cef10ff0ba2f100be2aaf
Reviewed-on: https://gerrit.instructure.com/82168
Tested-by: Jenkins
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Reviewed-by: Joel Hough <joel@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2016-06-28 21:54:37 +00:00
Ben Rinaca e18ed1d8d1 recall formula question details for large quizzes
fixes CNVS-29176

when a quiz has more than 25 questions we resort
to lazy-loading the question details. loading
question details for formula questions was
omitting some important information from the
configuration of the question. let's put that
back in to make sure the front-end gets the
whole question.

test plan:
- create a large quiz (greater than 25 questions)
- add a formula question with decimal places on
  the formula and an allowable margin of error on
  the possible solutions
- save the question and verify all of the
  properties you entered on the question are
  recalled on page reloads
- verify you can take the quiz and answers are
  graded correctly within the parameters you
  specified on the quiz

Change-Id: If81a9faf1f4a8d47f80b57ce74b7eba096d08334
Reviewed-on: https://gerrit.instructure.com/83563
Tested-by: Jenkins
Reviewed-by: Davis McClellan <dmcclellan@instructure.com>
QA-Review: Michael Hargiss <mhargiss@instructure.com>
Product-Review: Jason Sparks <jsparks@instructure.com>
2016-06-28 17:56:22 +00:00
Tyler Scott da19c5aa63 fix assignment submissions api endpoint dates
fixes CNVS-27127

The api endpoint api/v1/courses/{course_id}/assignments/
{assignment_id}/submissions/{user_id} should return a submission
with the correct 'submitted_at' dates when 'submission_history' is
included in the request parameters. Previously for quiz assignments
it would return the same 'submitted_at' date for every submission.
Now it properly returns the specific 'submitted_at' date for every
submission returned.

test plan:
1. Create a quiz that allows for multiple submissions and shows
   up under the assignments tab
2. Masquerade as a student and take the quiz multiple times.
3. Use an API request to get a single submission (i used postman)
   GET /api/v1/courses/:course_id/assignments/:assignment_id/
       submissions/:user_id?include[]=submission_history
4. Inspect the response and notice that each submission now has the
   correct submitted_at dates

Change-Id: Ic2cbb74bfb9e4fa0de5d2841c76d3166d3136338
Reviewed-on: https://gerrit.instructure.com/83324
Tested-by: Jenkins
Reviewed-by: Ryan Taylor <rtaylor@instructure.com>
QA-Review: Michael Hargiss <mhargiss@instructure.com>
Product-Review: Jason Sparks <jsparks@instructure.com>
2016-06-28 15:45:29 +00:00
Alex Boyd df46426ed9 Expose reply permission state in discussions API
Fixes CNVS-30106

Test plan:
 - Hit /api/v1/courses/<id>/discussion_topics/<id>
 - Verify the permissions key has a reply key that's true or
   false, depending on whether the user you're logged in as
   can reply to that discussion topic or not

Change-Id: I6311b535f2df6284a4bc6f90a875a811746ff32b
Reviewed-on: https://gerrit.instructure.com/83123
Tested-by: Jenkins
Reviewed-by: Joel Hough <joel@instructure.com>
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: Alex Boyd <aboyd@instructure.com>
2016-06-27 16:35:00 +00:00
Nick Houle 58c728e4f1 Add unlock_at and lock_at to be included in the API response
Refs: SIS-2166 and SIS-2214

Test plan:
- Query the endpoints
- Confirm the unlock_at and lock_at attributes are in the response

Change-Id: I295c3530963d9f07370fedb27dd4a581316fbb4e
Reviewed-on: https://gerrit.instructure.com/83479
Reviewed-by: Jayce Higgins <jhiggins@instructure.com>
Tested-by: Jenkins
QA-Review: Adam Phillipps <adam@instructure.com>
Product-Review: Nick Houle <nhoule@instructure.com>
2016-06-24 18:51:15 +00:00
Derek Bender d9325cb962 Merge branch 'dev/grading-periods-update' into master
Change-Id: Icb89d806b0c9474765a6024584eb4317b8c5e406
2016-06-22 10:26:21 -05:00
Simon Williams 5a07ffb8ae handle nil account when adding mobile js/css
fixes CNVS-30115

test plan:
- set up a theme with mobile js/css
- go to the calendar events ical feed (there may be other places, but
  I know this is one where it happens)
- it should work (it won't include the mobile js/css)
- make sure it is included in html content for other api endpoints (like
  an assignment description)

Change-Id: Id4dcc4c59ff9daf6a2b45084c2dc9ff44eb5fd0a
Reviewed-on: https://gerrit.instructure.com/83142
Tested-by: Jenkins
Reviewed-by: John Corrigan <jcorrigan@instructure.com>
Reviewed-by: Ryan Shaw <ryan@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2016-06-22 15:17:23 +00:00
Ryan Taylor f65ae32132 Add `result_url` to quiz submission serialization
Mobile requested feature to assist in showing result information.

Serialized json of a completed quiz submission will return the
result_url field.

Closes CNVS-29111

Test Plan:
 - Confirm the presence of result_url in the QS#show api action, and the
   QS#complete api action
 - Confirm it is not present unless the QS is completed or needs_grading

Change-Id: I63393b4a9290b8f2aa781203bffe2f166515a722
Reviewed-on: https://gerrit.instructure.com/82766
Tested-by: Jenkins
Reviewed-by: Bryan Petty <bpetty@instructure.com>
QA-Review: Michael Hargiss <mhargiss@instructure.com>
Product-Review: Jason Sparks <jsparks@instructure.com>
2016-06-20 20:18:57 +00:00
Derek Bender 0f2a46b95c Merge branch 'master' into dev/grading-periods-update
Change-Id: Iebae44c64860efd766ca7e288ca1ec112a790456
2016-06-20 10:22:17 -05:00
Stewie (Nicholas Stewart) 75646af86f Add sis_source_id to assignment_groups json object
WHY:  For Pinnacle grade pass back, we need to find/create
assignment_groups in Pinnacle using the sis_source_id.  This changeset
exposes that attribute through sis_assignments api.

Test Plan:

In your browser, go to
http://canvas.docker/api/sis/courses/:course_id/assignments

For each assignment you should see a sis_source_id in the
assignment_group

Example:
"assignment_group":
  {"id":4,"name":"quizes","sis_source_id":"0.958053570925386"}

Change-Id: Id62ba0c821a5bbaaeefc4ec1c5fe087397ab1061
Fixes: SIS-2128
Reviewed-on: https://gerrit.instructure.com/82423
Tested-by: Jenkins
Reviewed-by: Jayce Higgins <jhiggins@instructure.com>
Reviewed-by: Josh Simpson <jsimpson@instructure.com>
Reviewed-by: Brad Humphrey <brad@instructure.com>
QA-Review: Steven Shepherd <sshepherd@instructure.com>
Product-Review: Oxana
2016-06-20 14:53:35 +00:00
Andrew Butterfield 47cda00abb Add include to collaboration members api endpoint
fixes PLAT-1607

Test plan:
* In a course with some collaborations hit the following endpoint
  /api/v1/collaborations/:id/members?include[]=collaborator_lti_id&include[]=avatar_image_url
* Ensure that the collaborator_lti_id is included for both user and
  group members
* Ensure that the avatar_image_url is included for members of type user
  who have an avatar_image_url set

Change-Id: Id253242587d73b57f9caf203db2091706a347623
Reviewed-on: https://gerrit.instructure.com/82741
Tested-by: Jenkins
Reviewed-by: Brad Humphrey <brad@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Andrew Butterfield <abutterfield@instructure.com>
2016-06-17 16:38:44 +00:00
Spencer Olson 099fbc4251 Merge branch 'master' into dev/grading-periods-update
Change-Id: Iac280c0bf0d1d54780c7cf6111aa01b3b8e3a617
2016-06-16 08:35:30 -05:00
James Williams ad7b11a5bc show user sis id information for group contexts
test plan:
* user sis id information should show in the API
 to course users with the "Read SIS info" permission
 when calling "/api/v1/groups/:group_id/users"

closes #CNVS-29913

Change-Id: Ibacb88f15c31e3b6bc865c73b866f6b3cd09f004
Reviewed-on: https://gerrit.instructure.com/82335
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2016-06-14 18:25:59 +00:00
Matthew Sessions 9b2b79edc9 Add ability to create a collaboration through a tool
Fixes PLAT-1474

Test Plan:
 - Have the new collaborations feature flag turned on
 - Set up the lti_tool_provider_example application
 - in external_tools_controller.rb line 515 change false
   to true
 - Go to course settings and set up a lti tool using the
   lti_tool_provider_example application
 - Go to the collaborations page
 - Click the + Collaboration button
 - Click the one option in the drop down
 - A full screen modal should cover the screen and launch the lti
   tool
 - Click the heart icon in the top right
 - Hit the submit button
 - After all is done the modal should go away and a new
   collaboration should appear
 - Create an old collaboration and ensure that it does not
   show in the list of new collaborations on the
   lti_collaborations page

Change-Id: I8af35e1b5d7bb534ec76d4d90b5d093d55a5ede3
Reviewed-on: https://gerrit.instructure.com/81903
Reviewed-by: Steven Burnett <sburnett@instructure.com>
Tested-by: Jenkins
QA-Review: Heath Hales <hhales@instructure.com>
Product-Review: Steven Burnett <sburnett@instructure.com>
2016-06-14 15:56:50 +00:00
Simon Williams ac63f7a214 make the submission zip stale ttl configurable
Change-Id: Ia93196cc6df0c2d525b346dbec0fcd2fda84dd7f
Reviewed-on: https://gerrit.instructure.com/81226
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins
Product-Review: Simon Williams <simon@instructure.com>
QA-Review: Simon Williams <simon@instructure.com>
2016-06-09 19:01:08 +00:00
Nick Pitrak 585511c860 multiple grading periods enrollment term dropdown
adds the enrollment term dropdown to the account
grading periods page. selecting an enrollment term
from the dropdown will filter the grading period
sets to only show those that contain the selected
enrollment term.

closes CNVS-27108

test plan:
- enable multiple grading periods for an
  account
- create at least three grading period sets
- create at least three grading periods per
  grading period set
- create at least four enrollment terms belonging
  to the account. make sure three of them belong
  to one of the sets above, and one does not belong
  to any set. ensure
    a) one of the enrollment terms has a name and
       a start_at
    b) one of the enrollment terms is missing a
       name but has a start_at
    c) one of the enrollment terms is missing a
       name and a start_at
- go to the account grading periods page at
  /accounts/:id/grading_standards
- verify the enrollment terms are populated in the
  dropdown. the displayed name should be the name,
  or "Term starting **date here**" if no name exists,
  or "Term created **date here**" if no name exists
  and no start_at exists. verify the enrollment term
  that does not belong to a set is not displayed.
- verify the enrollment terms are ordered from top to
  bottom by start_at descending (if start_at exists,
  with all terms having a start_at displayed above
  all terms without a start_at), and then by created_at
  descending for terms without a start_at.
- verify selecting an enrollment term from the dropdown
  filters the grading period sets to only inlcude those
  that are associated with the selected term.
- verify the enrollment term names show below the grading
  period set name (with the correct display name as defined
  three steps before this one).

Change-Id: I920152f1c7a13720ab24e2fae0f4ec811bde5a93
Reviewed-on: https://gerrit.instructure.com/81420
Reviewed-by: Derek Bender <djbender@instructure.com>
Tested-by: Jenkins
Reviewed-by: Keith T. Garner <kgarner@instructure.com>
QA-Review: KC Naegle <knaegle@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2016-06-07 21:47:07 +00:00
Matthew Sessions 5b8173aca4 Add endpoint to list all external tool collaborations
Fixes PLAT-1556

Test Plan:
 - Create a collaboration in the context of a course.
   The collaboration_type should be 'external_tool_collaboration'
   This should be done via rails console or something similar as
   creation of these new types of collaborations is not complete
 - Hit /api/v1/courses/<course_id>/collaborations and notice that your
   newly created collaboration will show up and should include a field
   called user_name that has the creating users name
 - Try accessing the endpoint as a non member of the collaboration
 - you should not see the collaboration
 - Create another collaboration in the context of a group
 - As a member of the group hit /api/v1/groups/<group_id>/collaborations
   and notice the newly create collaboration will show up and should
   include a field called user_name that has the creating users name
Change-Id: I06045fa4bfa25722c3c790d4b7ff493098ec2670
Reviewed-on: https://gerrit.instructure.com/80235
Reviewed-by: Steven Burnett <sburnett@instructure.com>
Tested-by: Jenkins
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: Matthew Sessions <msessions@instructure.com>
2016-06-06 19:12:37 +00:00
Joel Hough 1432f586f2 hide discussion messages when non-viewably locked
fixes CNVS-28942

also fixes DiscussionTopic#visible_for? caching and cleans up
the :read permission

test plan
- regression test announcement and discussion topic visibility
- create a discussion topic in a module
- lock the topic via the module
- attempt to view the discussion topic as a student
- ensure that the discussion topic is not visible

Change-Id: I08b229e5a38803fced57afa25780b11a1dc2773e
Reviewed-on: https://gerrit.instructure.com/78152
Tested-by: Jenkins
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Joel Hough <joel@instructure.com>
2016-05-20 21:31:42 +00:00
Christian Prescott 8242fd12f7 Fix ambiguous AssignmentOverride reference
Change-Id: I9f2994e9f1f142cd163dd4afb1e510bb5bb19f4b
Reviewed-on: https://gerrit.instructure.com/79903
Tested-by: Jenkins
Reviewed-by: Clay Diffrient <cdiffrient@instructure.com>
Product-Review: Christian Prescott <cprescott@instructure.com>
QA-Review: Christian Prescott <cprescott@instructure.com>
2016-05-18 17:48:55 +00:00
Rob Orton e8ee04bdc1 drop sis_source_id from enrollment
refs CNVS-29138

test plan
 - specs should pass

Change-Id: I246725f13a5e08bc8bb81183261cf8e526419349
Reviewed-on: https://gerrit.instructure.com/78719
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
QA-Review: Rob Orton <rob@instructure.com>
2016-05-16 19:13:45 +00:00
James Williams f98b914c5b move sis id permission checks in api to courses when possible
being a teacher in an account should no longer give the
ability to see sis ids for users in every course context

test plan:
* add a teacher to a course
* add a student with an sis user id
* the teacher should be able to see the sis id for the user
 in the users api for the course
 (e.g. /api/v1/courses/:id/users)

* add the teacher to another course but as a student instead
* add the student with the sis id
* the teacher user should not be able to see the student's
sis id through the users api for this course

* also sub-account admins should be able to see sis ids
if they have the "Read SIS" permission enabled

closes #CNVS-21216 #CNVS-26688 #CNVS-29063

Change-Id: I5b0c4442626612f2770a30b6b301b57ea1a6e0a7
Reviewed-on: https://gerrit.instructure.com/78858
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Heath Hales <hhales@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2016-05-11 15:09:44 +00:00
Jeremy Stanley 7db2f23b53 expose `for_submissions` in folders API
test plan:
 - enable "submissions folder" feature
 - submit a file to an assignment if you have not done so
   previously, so you have submissions folder(s)
 - use the folders API to list user folders
 - ensure "for_submissions" is returned correctly
   ("true" for submissions folders, "false" otherwise)
 - ensure the API docs explain this field

refs CNVS-28394

Change-Id: I3cb940316a61d0138a3848d82d5288955d15f921
Reviewed-on: https://gerrit.instructure.com/78935
Tested-by: Jenkins
Reviewed-by: Clay Diffrient <cdiffrient@instructure.com>
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2016-05-09 16:02:28 +00:00
Jeremy Stanley c378afc033 upload submissions to submissions folder if feature is enabled
test plan:
 - enable the submissions folder feature
 - create an assignment that accepts file submissions
 - submit the assignment by uploading a file
 - ensure it is uploaded to the read-only Submissions folder
 - repeat this test with a group assignment

 (NOTE: submitting an assignment by choosing an alredy-uploaded
        file will not yet copy the file into the Submissions
        folder; this is coming up in another commit)

closes CNVS-28138

Change-Id: I836b26324cfa87d9a3ea62ca80569bcdfbb3b671
Reviewed-on: https://gerrit.instructure.com/77922
Tested-by: Jenkins
Reviewed-by: James Williams  <jamesw@instructure.com>
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2016-05-04 14:11:25 +00:00
John Corrigan ff88fca588 refactor logic in #assignment_overrides_json
fixes CNVS-28632

test plan:
- Create a Practice Quiz
- Assign the Quiz to everyone with a due date
- Create an ovverride of any type (adhoc, section, or group) with a
  different due date
- Save
- Attempt to Edit the quiz

Change-Id: I2bd118fb580e95465781440b0ed4c2f565ae4ab0
Reviewed-on: https://gerrit.instructure.com/76796
Reviewed-by: Marc Alan Phillips <mphillips@instructure.com>
QA-Review: Indira Pai <ipai@instructure.com>
Tested-by: Jenkins
Product-Review: Chris Wang <cwang@instructure.com>
2016-05-03 20:40:52 +00:00
Cody Cutrer f64a73a99f display app name in page view output
closes CNVS-28788

test plan:
 * enable page views
 * use an app (such as Canvas for iOS) to interact with your
   Canvas, and record page view (particularly ones that count
   as "participations")
 * look at the page views for the user
 * instead of listing a browser for the user agent, it should
   list the name of the developer key for the app

Change-Id: Id07b293db333e44db7110fc2620409535927f915
Reviewed-on: https://gerrit.instructure.com/77409
Tested-by: Jenkins
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2016-05-02 21:25:54 +00:00
Jeremy Stanley c6882e5938 read-only submissions folder
test plan:
 - create a folder in a user's files and put stuff in it
   including at least one file large enough to make a dent
   in the user's storage quota
 - in the console, turn it into a submissions folder via
   Folder.find(id).update_attribute(:submission_context_code, 'root')
 - ensure that:
   1. you cannot create new files in this folder
   2. you cannot delete existing files in there
   3. you cannot move files in
   4. you cannot move files out (copying out is okay)
 - ensure the files in this folder are not counted against
   the user's quota.
 - ensure that other folders (not marked as submission
   folders) continue to operate normally

NOTE: it is expected that you will see "Oops!" messages
   and failed AJAX requests when trying to manipulate
   the contents of a submissions folder.  this commit
   enforces the read-only state of submissions folders
   on the backend; future commit(s) will make the
   frontend deal with them gracefully.

fixes CNVS-28140
fixes CNVS-28554

Change-Id: I33f79671c3dd6bdba2fc00526f513186e8e93bf6
Reviewed-on: https://gerrit.instructure.com/77536
Tested-by: Jenkins
Reviewed-by: James Williams  <jamesw@instructure.com>
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2016-04-28 21:41:51 +00:00
Simon Williams de2df48f54 remove DeveloperKey#tool_id
fixes CNVS-28785

test plan: basic regression of creating/using developer keys

Change-Id: I64d76b559efe9b0a436f322271e0627ab7a6048e
Reviewed-on: https://gerrit.instructure.com/77391
Tested-by: Jenkins
Reviewed-by: Nathan Mills <nathanm@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2016-04-28 21:28:09 +00:00
Jeremy Neander e017e4a46a record excused/un-excused submissions in grade change log
Previously, excused and un-excused submissions were not being recorded by
the grade change log. As a result, those logs were causing invalid states
to be displayed within Admin Tools. It now correctly tracks the excusing
and un-excusing of submissions.

test plan:
 1. Create an account, course, student, and assignment
 2. Ensure the assignment is assigned to the student
 3. Visit the Gradebook Individual View
 4. Select the given student and assignment
 5. Make the following grade changes:
    a. Grade the assignment with 10
    b. Grade the assignment with -
    c. Excuse the assignment
    d. Grade the assignment with -
    e. Excuse the assignment
    f. Grade the assignment with 1
    g. Excuse the assignment
 6. Visit the Admin Tools for the account
 7. Click the Logging tab
 8. Select the 'Grade Change Activity' log type
 9. Search for the assignment
10. Verify the following logged grade changes, top-to-bottom:
    a. before: 1;    after: 'EX'
    b. before: 'EX'; after: 1
    c. before: '-';  after: 'EX'
    d. before: 'EX'; after: '-'
    e. before: '-';  after: 'EX'
    f. before: 10;   after: '-'
    g. before: '-';  after: 10
11. Visit the SpeedGrader™ for the given assignment and student
12. Verify that the student has a grade of 'EX'
13. Verify the presence of a checkmark beside the student's name

closes CNVS-28313

Change-Id: I0bac427a4b4bfe282a78cbf04b74f828c5048dc0
Reviewed-on: https://gerrit.instructure.com/77280
Tested-by: Jenkins
Reviewed-by: Derek Bender <djbender@instructure.com>
Reviewed-by: Shahbaz Javeed <sjaveed@instructure.com>
QA-Review: KC Naegle <knaegle@instructure.com>
Product-Review: Christi Wruck
2016-04-28 16:52:56 +00:00
Rob Orton 485ca4ddbf add root_account_id to course json
we already have documented that it is included

fixes CNVS-28910

test plan
 - get course api
 - json should include root_account_id

Change-Id: Iebe7e7ae788ef5c59b42cd69fd11489f32ab455b
Reviewed-on: https://gerrit.instructure.com/77720
Tested-by: Jenkins
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2016-04-28 05:37:24 +00:00
Christian Prescott eaa52716da Add WikiPage assignment type
refs CYOE-67

Test Plan
0. `rake db:migrate` and compile assets. Enable the conditional release
   feature flag in course settings.
1. Create a published WikiPage, assignment-free. Ensure it is visible
   to errybody.
2. With the API, create an assignment with submission type 'wiki_page'.
   A new page will be created for the assignment.
```sh
curl "http://canvas.dev:3000/api/v1/courses/1/assignments" \
-H "Content-Type: application/json" -H "Authorization: Bearer <token>" \
-X POST -d '{"assignment": {"name": "Page Asg", "published":true, \
"submission_types":["wiki_page"]}}'
```
3. Ensure the assignment is assigned to "Everyone" and the page is
   visible to all.
4. Assign the assignment to a specific student or section. Ensure the
   page is visible only to the assigned set.
```sh
curl "http://canvas.dev:3000/api/v1/courses/1/assignments/13" \
-H "Content-Type: application/json" -H "Authorization: Bearer <token>" \
-X PUT -d '{"assignment": {"only_visible_to_overrides": true }}'
curl "http://canvas.dev:3000/api/v1/courses/1/assignments/13/overrides" \
-H "Content-Type: application/json" -H "Authorization: Bearer <token>" \
-X POST -d '{"assignment_override": {"student_ids":[126]}}'
```
5. Ensure the DA behavior also applies to WikiPage#show and update and edit.
6. Ensure API behavior matches docs for Assignment and Page endpoints.
7. Ensure no regressions in non-page assignments, with and without CR
   feature flag. Ensure no regressions in discussion topics and
   announcements, including assigned discussions.

Change-Id: Ie53c6ffa4e4533cedd54f10aee3ba0b8a27aa4d5
Reviewed-on: https://gerrit.instructure.com/75139
Reviewed-by: Matt Berns <mberns@instructure.com>
Tested-by: Jenkins
QA-Review: Michael Hargiss <mhargiss@instructure.com>
Product-Review: Christian Prescott <cprescott@instructure.com>
2016-04-21 17:25:15 +00:00
Matthew Berns 5fd98c33e3 scale scores aligned to question banks on student LMGB
fixes CNVS-28145

test plan:
- create an outcome with a default 1/3/5 scale
- align the outcome to a question bank with 10 total points
- as a student, score 60% on the quiz
- go to the student view of learning mastery gradebook
- the alignment to the question bank should show the score
  as 3/3
- test some other results - for example, a 70% should show
  as 3.5/3 using the defaults
- test some other outcome point scales to ensure consistency

Change-Id: I70a912b57867f50f9b922615c8eafb692952525b
Reviewed-on: https://gerrit.instructure.com/75189
Reviewed-by: John Corrigan <jcorrigan@instructure.com>
Tested-by: Jenkins
QA-Review: Michael Hargiss <mhargiss@instructure.com>
Product-Review: McCall Smith <mcsmith@instructure.com>
2016-04-19 18:10:36 +00:00
James Williams 424441982b queue assignment override updates in singleton
Change-Id: I7e84b7a9a86d554a4bbb63e29c059f2b8a4aa68f
Reviewed-on: https://gerrit.instructure.com/76859
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2016-04-14 15:38:48 +00:00
James Williams 3ea6cc8812 rails 4.2: misc spec fixes
refs #CNVS-26056

Change-Id: Icd51d69d52cde329da19b006a9bc08e86891dfc3
Reviewed-on: https://gerrit.instructure.com/76905
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2016-04-13 15:21:57 +00:00
Jeremy Stanley 6ae5126d9b use real revision time in wiki pages API
The `updated_at` column can be reset for cache changes, but we're
already tracking `revision_time` in a separate column, so return
it in preference to the `updated_at` column in API results.
(Note that the API response field is still named `updated_at`.)

test plan:
1. have a course with some wiki pages, preferably last updated
   more than a day ago.
   If you don't have any, you can falsify some timestamps in
    the console:
   course.wiki.wiki_pages.update_all(:revised_at => 1.week.ago)
2. go to Course Settings and click "more options"
3. change the dropdown for "... can create, rename, and edit
   course wiki pages by default"
4. check the box marked "Change pages currently editable by"
5. click "Update Course Details"
6. go to the Pages index and confirm that the "Last edit" column
   didn't just change to today for all of the pages
7. change some page titles and contents and confirm that the
   "Last edit" column changes as expected

fixes CNVS-22072

Change-Id: I5e0cffd4611bee2e23ce66bce9c36e816a521658
Reviewed-on: https://gerrit.instructure.com/76583
Tested-by: Jenkins
Reviewed-by: James Williams  <jamesw@instructure.com>
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2016-04-12 15:28:11 +00:00
Jeremy Stanley 05b3c30dd2 scheduler: hide signups in courses the teacher isn't enrolled in
test plan:
1. set up an appointment group in Course A and Course B
2. enroll a teacher in Course A (but not Course B)
3. enroll students in both courses
4. have each student sign up for a slot
5. ensure Teacher A doesn't see Student B's signup
   on their calendar

fixes CNVS-28513

Change-Id: I59a4e4833b3e7521e016028c17c6eda1ea3217a3
Reviewed-on: https://gerrit.instructure.com/76452
Tested-by: Jenkins
Reviewed-by: Joel Hough <joel@instructure.com>
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2016-04-11 15:55:02 +00:00
Jeremy Stanley da556a6cb8 put multi-course scheduler appointments on the right calendar
test plan:
1. Have two courses with the same teacher and a different student in each
2. Enable Scheduler in the courses' root account (/accounts/X/settings)
3. Create an appointment group covering both courses, with at least two
   appointment slots
4. Enroll a student from each course in separate slots
5. As the teacher, go to the calendar and show both courses
6. Ensure each student's appointment appears on that student's
   course's calendar
7. Enroll another teacher in only one of the two courses
8. Ensure this teacher sees both signup appointments in the
   calendar for the course she is enrolled in

fixes CNVS-28134

Change-Id: Ibdf19de1c432e13c1aa85d2fdcd10a6d99c8e917
Reviewed-on: https://gerrit.instructure.com/75256
Tested-by: Jenkins
Reviewed-by: Joel Hough <joel@instructure.com>
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
Product-Review: Allison Weiss <allison@instructure.com>
2016-04-06 16:45:29 +00:00
Alex Boyd 7937e8452c Add avatars to discussion entry json
Fixes CNVS-28363

Test plan:
 - Make a user with an avatar
 - Make a discussion topic
 - As the user with an avatar, reply to the discussion topic
 - Hit /api/v1/courses/:course_id/discussion_topics/:topic_id/entries
 - Verify that the returned entry has a user key
 - Verify that the returned user has an avatar_image_url key
 - Verify that it's the user's avatar

Change-Id: Ied975ad2d78d5cac34a464af3068cde705739eb4
Reviewed-on: https://gerrit.instructure.com/75829
Tested-by: Jenkins
Reviewed-by: Joel Hough <joel@instructure.com>
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: Alex Boyd <aboyd@instructure.com>
2016-04-05 20:59:41 +00:00
Sterling Cobb f0d6932448 Make links work as expected for account search page
This makes the links on each course/user work as you
would expect them to.

fixes CNVS-25175

Test Plan:
  - Make sure the "Course and User Search" feature flag
    is enabled.
  - Go to the account show page (/accounts/XX)
  - On the Courses tab:
      - The '+' button should pull up the "Add Users" dialog
        This dialog should work to add users to the course
      - The graph button should take you to the stats page
        for the course
      - The cog icon should take you to the settings page
        for the course
  - On the People tab:
      - The masquerade mask link should take you to the
        masquerade page.
      - The mail link should take you to conversations and
        start a message for that user
      - The pencil link should open up the "Edit User Details"
        dialog.

Change-Id: Ief8ac5e7da424af481c8bd0d009f020cd80c748b
Reviewed-on: https://gerrit.instructure.com/72381
Tested-by: Jenkins
Reviewed-by: Steven Burnett <sburnett@instructure.com>
Reviewed-by: Felix Milea-Ciobanu <fmileaciobanu@instructure.com>
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
Product-Review: Cosme Salazar <cosme@instructure.com>
2016-04-05 15:33:19 +00:00
John Corrigan 86c57bbb70 don't assume an assignment override has an assignment
fixes CNVS-28406

test plan:
- Having a hard time repro'ing from the UI. Will update with more
  instructions here or in ticket soon.

Change-Id: Iedb6ddbdb383f332639e2bc08dabe5b2174adb82
Reviewed-on: https://gerrit.instructure.com/76099
Reviewed-by: Marc Alan Phillips <mphillips@instructure.com>
Tested-by: Jenkins
QA-Review: Michael Hargiss <mhargiss@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2016-04-02 17:01:36 +00:00
Dan Minkevitch 6effa2deec Fix assignment overrides for when global id != id
Fixes CNVS-28208

Test Plan:
* Create a user with an ID that differs
  from their global id
* Validate that `interpret_assignment_override_data`
  returns the student when their global id is passed

Change-Id: I41e225ebb76af01734615f401e7025119b737f7e
Reviewed-on: https://gerrit.instructure.com/75089
Tested-by: Jenkins
QA-Review: Michael Hargiss <mhargiss@instructure.com>
Reviewed-by: Mike Nomitch <mnomitch@instructure.com>
Product-Review: Dan Minkevitch <dan@instructure.com>
2016-03-30 21:15:05 +00:00
Cameron Matheson 0f3e25ff99 gradebook: incrementally load users
closes CNVS-26384
closes CNVS-26385

Test plan:
  * full regression test on gradebook. pay special attention to:
    * differentiated assignments
    * grading periods
    * sections
    * sorting
    * cell styles
  * some features are disabled while the gradebook is loading.
    the gradebook should behave identically after all data is loaded

Change-Id: I9783eb2eb4ca21fb7fd93c5e957de5800041945a
Reviewed-on: https://gerrit.instructure.com/72405
Tested-by: Jenkins
Reviewed-by: Keith T. Garner <kgarner@instructure.com>
Reviewed-by: Spencer Olson <solson@instructure.com>
Reviewed-by: Derek Bender <djbender@instructure.com>
QA-Review: KC Naegle <knaegle@instructure.com>
Product-Review: Cameron Matheson <cameron@instructure.com>
2016-03-30 19:54:44 +00:00
Spencer Olson dedb0b0594 don't load needs_grading_count for gradebook calls
closes CNVS-27812

test plan 1: test assignment groups controller

1. make a 'GET' request to assignment groups index
   (/api/v1/courses/:course_id/assignment_groups)
   as a teacher of a course, and include the
   parameter include[]=assignments.
2. verify there is a 'needs_grading_count' property
   on each assignment you get back from the API call.
3. make the same call you made in step 1, but pass
   exclude_response_fields[]=needs_grading_count
   as an additional parameter.
4. verify there is no longer a 'needs_grading_count'
   property on each assignment you get back from the
   API call.

test plan 2: make sure gradebook is not loading
             needs_grading_counts

1. open the developer tools in your browser (this
   test plan will be easiest to follow in Chrome)
2. navigate to the gradebook
3. switch to the 'Network' tab in your developer
   tools. filter for XHR requests and find the
   request for assignment groups. it will start
   with assignment_groups?include
4. verify the Request URL (in the 'Headers' tab) for
   the assignment groups call has
   `exclude_response_fields%5B%5D=needs_grading_count`
5. verify the response (in the 'Response' tab) does
   not include needs_grading_counts on the assignments.

Change-Id: Ib58954e601e3fb6d43acdae06c5b3e4ed119db14
Reviewed-on: https://gerrit.instructure.com/74059
Reviewed-by: Strand McCutchen <smccutchen@instructure.com>
Reviewed-by: Cameron Matheson <cameron@instructure.com>
Tested-by: Jenkins
QA-Review: KC Naegle <knaegle@instructure.com>
Product-Review: Spencer Olson <solson@instructure.com>
2016-03-21 15:47:13 +00:00
Strand McCutchen ebf8b4174f GradeCalculator#compute_scores returns an array of hashes
refs CNVS-26685

While investigating CNVS-26685, I discovered that
GradeCalculator#compute_scores returns an array of arrays
with arrays in them with values. This nested structure hid
the implicit meaning of the data, which maps to the current,
final, current group, and final group for the computed scores.

This more human-readable data structure improves the ability of
developers to reason about the returned values.

Test plan:

 - Run regression tests on the user, course, and enrollment APIs.

Change-Id: I58c8572f94863e47be5d67e6d50fe795d42f1856
Reviewed-on: https://gerrit.instructure.com/74093
Reviewed-by: Cameron Matheson <cameron@instructure.com>
Tested-by: Jenkins
QA-Review: KC Naegle <knaegle@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2016-03-16 21:25:54 +00:00
James Williams 49882ecdae drop data_exports
refs #CNVS-27773

Change-Id: I1d39e3858f4ff72c186159186a4aa4b0e4faf89a
Reviewed-on: https://gerrit.instructure.com/74019
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2016-03-09 21:25:15 +00:00
James Williams 0777cba946 remove differentiated assignments feature checks
test plan:
* basic regression test of assignment overrides

closes #CNVS-27549

Change-Id: Ie463848b3831087efb3f9ec762dca6264055ee76
Reviewed-on: https://gerrit.instructure.com/73139
Tested-by: Jenkins
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
Reviewed-by: Mike Nomitch <mnomitch@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2016-03-07 18:44:46 +00:00
James Williams 9e1a4ed682 only show active users to students in group roster
test plan:
* enroll two students in a course and add them
 to a group
* they should be able to see each other in the
 group roster
* inactivate one of the students
* they should no longer be visible in the group
 roster to the other student
* they should still be visible to the admin

closes #CNVS-27441

Change-Id: Ia4addb3d269a6bc84bbc08815ebf7d666512179e
Reviewed-on: https://gerrit.instructure.com/73284
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2016-03-03 16:50:46 +00:00
James Williams 0373e72d3a relock associated module when assignment overrides change
test plan:
* create a course with two sections
* create an assignment that is only assigned
 for one course section

* create two modules and make the first a prerequisite
 for the second
* add the assignment as a requirement for the first

* add a student in the other course section
* the second module should be unlocked for them since
 they can't see the required assignment

* edit the assignment to be assigned to the other
 course section
* revisit the modules page as the student
* the assignment should be visible and the second module locked

closes #CNVS-27470

Change-Id: I366592d11302362b7d92019f211915ce2c29266e
Reviewed-on: https://gerrit.instructure.com/73076
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2016-03-02 18:03:10 +00:00
Marc Alan Phillips 0fad3e1db6 fix assignment edit for multi-section course
Fix the edit for a multi-section course where an assignment
override is made for a student in another section than the
teacher who is editing the assignment.

fixes CNVS-23944

Test Plan:
  -Create a course with two sections.
  -Add a teacher that can only grade their section.
  -Create a quiz or assignment
  -Override with only student(s) that the sub-teacher cant see
  -Masquerade as the teacher and go attempt to edit the assignment.
  -Make a change
  -Click save and see that it now saves..
  -Repeat with override with mix of students that the sub-teacher
     can/cannot see
  -Repeat with various combos not stated that you can think of
  -Make sure to also test that groups and section overrides still work

Change-Id: I360368bf3340a15452da5e60e734817841df139c
Reviewed-on: https://gerrit.instructure.com/71526
Tested-by: Jenkins
Reviewed-by: Mike Nomitch <mnomitch@instructure.com>
QA-Review: Michael Hargiss <mhargiss@instructure.com>
Product-Review: Jason Sparks <jsparks@instructure.com>
2016-02-28 05:50:18 +00:00
Jeremy Stanley 5a458d729e extension point for analytics links
test plan: sanity check the following pages to ensure
they load properly:
 - account index (/accounts/X)
 - account statistics (/accounts/X/statistics)
 - courses index (/courses/X)
 - courses people page (/courses/X/users)
 - student profile page (courses/X/users/Y)
   test this with "Enable Profiles" in account settings
   on and off.

This commit enables the analytics plugin to add links in all
these places without manipulating the DOM after the page renders.
(Not all these places have analytics links now. They used to,
before page changes broke the DOM injection that this commit
prepares us to get rid of...)

refs CNVS-6298

Change-Id: Ib252655220b017c2f60c9f4aa08d65a516a82f83
Reviewed-on: https://gerrit.instructure.com/72285
Tested-by: Jenkins
Reviewed-by: Clay Diffrient <cdiffrient@instructure.com>
QA-Review: Clare Strong <clare@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2016-02-26 16:14:06 +00:00
Keith Garner b824a36778 add include[]=group to SubmissionApiController#index
This adds a check for a 'include[]=group' param in the
SubmissionApiController#index action so that the group_id and
group_name are returned with the other submission information.

fixes CNVS-25579
ref CNVS-23203

Test Plan:
 - Have a course with a few students enrolled
 - Create user groups and put at least two students in one group.
 - Create an assignment set to be graded as a group
 - Have a student from one of the groups submit to the assignment on
   behalf of the group.
 - With a teacher or admin token, ping the Submissions list API with
   include[]=group
 - Verify that group_id and group_name information was passed with the
   submission entries

Change-Id: I3484af661506c0733dc456ff7611f5e4659db573
Reviewed-on: https://gerrit.instructure.com/72288
Tested-by: Jenkins
Reviewed-by: Cameron Matheson <cameron@instructure.com>
QA-Review: KC Naegle <knaegle@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2016-02-23 17:36:08 +00:00
James Williams 0ecc78be4a show inactive students in speedgrader
also should fix submission downloading

test plan:
* create a course with a file upload assignment
* add a student
* submit to the assignment as the student

* make the student inactive in the people page
* should still be able to see the student in
 speedgrader and grade them

* also click on the "Download Submissions" link
 on the assignment page
* it should include the students submission
* the "Download Submission" dialog on the gradebook
 should work the same way

closes #CNVS-27249 #CNVS-27250 #CNVS-27251

Change-Id: Id58e28e85aa05da102e76b7ec40ed3f36acafef5
Reviewed-on: https://gerrit.instructure.com/72464
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: KC Naegle <knaegle@instructure.com>
Product-Review: Matt Goodwin <mattg@instructure.com>
2016-02-23 16:58:21 +00:00
James Williams fd7a2d9bf0 fix media comments in course section media events
* add a calendar event to a course with varied due dates by
 section and a media comment in the description
* as a student, click on the calendar feed link on the calendar
 and then click on "click here to view the feed"
* it should download successfully

closes #CNVS-24717

Change-Id: I58c6b7dac2d88e9c08ea56efc62ce8de9a5c8d48
Reviewed-on: https://gerrit.instructure.com/72565
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2016-02-22 19:36:51 +00:00
Cody Cutrer 1d722f1dd1 improve polymorphic extensions to belongs_to
particularly, allows passing specific types to `joins` in queries,
instead of having to manually create the SQL

refs CNVS-26480

Change-Id: Iccb2eb47d88c55befbadb5bdb7086e21718c59fd
Reviewed-on: https://gerrit.instructure.com/71879
Tested-by: Jenkins
Reviewed-by: Simon Williams <simon@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2016-02-12 16:48:54 +00:00
Cody Cutrer d8f3e7cdf8 remove locking_account_id from feature flags
it's never used

keep it in the API response for back-compat reasons

test plan:
 * regression test feature flags; nothing should be broken

Change-Id: I6b023c04148dc6bdb686199d1891e13fcdc8ffa8
Reviewed-on: https://gerrit.instructure.com/70442
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
2016-02-10 21:15:06 +00:00
Michael Nomitch 7dc3c90aaf DA - support student groups
fixes CNVS-22360

Test Plan:
  - create a course with multiple course
    sections, multiple group sets (each with
    many groups), and students in these
  - create an assignment with overrides
    for groups
    - they work as expected
    - adhoc and section overrides continue
      to work as expected
  - ditto for graded discussions
    - check that discussion
      alerts go out properly
    - check that individually graded
      group discussions work as intended
      as well
    - note: child discussions will still
      be made for groups that dont have
      overrides (this is unfortunate
      but known)
  - note: quizzes not included
    in this PS

  - when editing an assignment try to
    assign a due date to a group not
    in the assigned group set
    - you cannot
  - when editing an assignment that
    is not a group assignment
    - confirm that you cannot
      assign a group override

  - if an assignment override for a group
    exists (and nobody else is assigned)
    - check that a student not in that group
      - does not have a spot in the GB
      - gets redirected away from that assignment
        if they go to the show page
      - does not have that assignment factored
        into their individual grade
      - does not have that assignment show
        up on their assignment index
    - if the student is then added to that group
      - all of the above conditions are reversed
    NOTE: if a student has a grade already, they
    will not 'lose visibility' until their grade is
    taken away (so removing a student from a group
    will reverse the above conditions only if they
    are gradeless)

  - check that the calendar accurately
    reflects the due dates for group
    overrides

  - with MGP on
    - test that group overrides act in the
      same way as course_section overrides
      in regards to grading period

Change-Id: Ia32f57feabbc719568901e0763130b3c2304c7ce
Reviewed-on: https://gerrit.instructure.com/69060
Tested-by: Jenkins
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
QA-Review: Michael Hargiss <mhargiss@instructure.com>
Product-Review: Jason Sparks <jsparks@instructure.com>
2016-02-10 19:20:52 +00:00
Rob Orton 23b9c963d0 add applies_to_self and applies_to_descendants to role api
closes CNVS-23598

test plan
 - set applies_to_self true and false on create
   and update in api
 - set applies_to_descendants true and false on
   create and update in api

Change-Id: I8743c4085010da2982a9aaf380329ea96682e08c
Reviewed-on: https://gerrit.instructure.com/70675
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins
QA-Review: August Thornton <august@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2016-02-10 17:26:54 +00:00
Mark Severson ddca40cbb2 sis assignments handle only visible to overrides
some assignments are only visible to overrides, not to an entire course,
these must be handled specially when applying assignment overrides

Added a basic spec for Api::V1::SisAssignment.  Then added a failing
spec for 'sis assignments handle only visible to overrides', then added
the bit of code to get the spec to pass.

test plan:
 * in a course with multiple sections
 * create an assignment
 * create another assignment that is only applicable to a single section
 * query the sis assignments api:
   - /api/sis/courses/:course_id/assignments
 * the first assignment should return all sections in the course
 * the second assignment should only return the section for which it is
   applicable

Fixes: SIS-1623

Change-Id: Iaa34295b98ea9615df400287ffbea0d762cc48bc
Reviewed-on: https://gerrit.instructure.com/69702
Tested-by: Jenkins
Reviewed-by: Brad Humphrey <brad@instructure.com>
QA-Review: Steven Shepherd <sshepherd@instructure.com>
Product-Review: Ken Romney <kromney@instructure.com>
2016-02-05 20:21:20 +00:00
James Williams 66dcb6dc59 fix wiki pages locking on first load
test plan:
* create a wiki page and add it as a module item
* require the page to be viewed
* require the module to be progressed through
 sequentially
* as a student, visit the wiki page
* it should work on first load

closes #CNVS-26868

Change-Id: I06c8eaf571547ef4222d33e52ce40f458471dced
Reviewed-on: https://gerrit.instructure.com/71241
Tested-by: Jenkins
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2016-02-05 18:28:31 +00:00
Spencer Olson f3c956c2dd add scope_assignments_to_student parameter
scope_assignments_to_student can now be passed
as an argument to assignment_groups_controller#
index. if this argument is passed in as true,
assignments will only be returned if they apply
to the requesting user in the given grading period.

in addition, when requesting multiple grading
periods data for these endpoints:

GET /api/v1/courses
GET /api/v1/courses/:course_id
GET /api/v1/users/:user_id/courses
GET /api/v1/users/self/favorites/courses

we now include the current_grading_period_id in the response.

closes CNVS-26847

test plan 1: test scope_assignments_to_student

- create a course, and enroll two students (
  i will refer to these as Student A and
  Student B).
- enable Multiple Grading Periods for the
  course.
- create a grading period that starts Feb 1
  and ends Feb 29.
- create a grading period that starts March 1
  and ends March 31.
- create an assignment. assign it to Student A
  on March 15. Assign it to Student B on Feb 15.
  i'll refer to this as Assignment 1.
- create another assignment. assign it to Student
  A on April 15. Assign it to Student B on March 15.
  i'll refer to this as Assigment 2.
- as Student A, make a GET request to
  /api/v1/courses/:course_id/assignment_groups
  (replace :course_id with the id of the course
  created in the first step). include the following
  params with the request:
  format: 'json'
  include[]: 'assignments'
  include[]: 'assignment_visibility'
  include[]: 'overrides'
  grading_period_id: 5 #don't actually put 5 here,
    put the id of the March grading period
- verify you get two assignments back (they will
  be nested in the response, under a key named
  "assignments"). the assignment IDs should match
  the ids of Assignment 1 and Assignment 2.
- now make another GET request with Student A with
  the same params, but this time also add the
  following param:

  scope_assignments_to_student: true

- verify you get only one assignment back. the
  assignment id should match the id of Assignment
  1.

test plan 2: verify current_grading_period_id in responses

- hit the api/v1/courses, api/v1/courses/:id,
   api/v1/users/:user_id/courses, and
   api/v1/users/self/favorites/courses endpoints
   and pass in 'current_grading_period_scores'
   as an include[] argument. verify you get a
   `current_grading_period_id` in the response.
 - ping me with any questions :D

Change-Id: I5f906a8cddbc63002cadf533c46c69de0d29830f
Reviewed-on: https://gerrit.instructure.com/71169
Tested-by: Jenkins
Reviewed-by: Keith T. Garner <kgarner@instructure.com>
QA-Review: KC Naegle <knaegle@instructure.com>
Product-Review: Spencer Olson <solson@instructure.com>
2016-02-03 21:32:33 +00:00
Simon Williams 00f622e928 fix course api for logged out users
fixes CNVS-26840

test plan:
- in a public course, as a logged out user,
- hit the /api/v1/courses/X api
- it should work

Change-Id: Ibfa1b04ee0c7599d56df6d16c37c4aa615160708
Reviewed-on: https://gerrit.instructure.com/71014
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2016-02-01 20:29:19 +00:00
James Williams c06f95d270 rails 4.2: fix controller, integration and view specs
refs #CNVS-26056

Change-Id: I854a085afc6bff640c814098956344efff65f1a7
Reviewed-on: https://gerrit.instructure.com/70658
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2016-01-22 20:01:11 +00:00
Strand McCutchen feab022740 allow roles who can manage access to has_overrides in gradebook
fixes CNVS-25547

Test Plan:

 1. Create an assignment assigned to only a student or
    section. Give it a due date in a grading period.
 2. Create an admin account without the 'Manage (add/edit/
    delete) assignment and quizzes' permission.
 3. As the admin, view the gradebook for the course.
 4. View the grading period the assignment is in and verify
    you can see the grade.

Change-Id: I033ed9eba9fb5b63fbcefc84d0bc01caa85424e0
Reviewed-on: https://gerrit.instructure.com/69173
Tested-by: Jenkins
Reviewed-by: Derek Bender <djbender@instructure.com>
QA-Review: Jason Carter <jcarter@instructure.com>
Product-Review: Christi Wruck
2016-01-21 17:20:48 +00:00
James Williams 5881701e8c rails 4.2: api spec fixes
refs #CNVS-26056

Change-Id: I082e29c642b9150260f6571f0aa8ef397c6e2cca
Reviewed-on: https://gerrit.instructure.com/70593
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2016-01-21 16:14:03 +00:00
Spencer Olson 2658d2c05c mobile: add grading period scores to endpoints
adds support for a 'current_grading_period_scores'
argument that can be passed to api/v1/courses,
api/v1/courses/:id, api/v1/users/:user_id/courses,
and api/v1/users/self/favorites/courses. if this
argument is passed to these endpoints, scores for
the current grading period will be returned.

closes CNVS-26203

test plan:
 - run
     $ bundle exec rake doc:api
   to generate API documentation.
 - view the documentation at
   public/doc/api/index.html and navigate to the
   documentation for the Courses controller.
 - verify there is documentation explaining how
   to pass the 'current_grading_period_scores'
   argument, and explaining what will be returned.
 - hit the api/v1/courses, api/v1/courses/:id,
   api/v1/users/:user_id/courses, and
   api/v1/users/self/favorites/courses endpoints
   and pass in 'current_grading_period_scores'
   as an include[] argument. verify you get the
   expected responses back, as outlined in the
   API documentation for 'current_grading_period
   _scores'.
 - ping me with any questions :)

Change-Id: Ic8985c6a85af120b9d07ef2cd4e8e049e0c327fc
Reviewed-on: https://gerrit.instructure.com/69836
Tested-by: Jenkins
Reviewed-by: Derek Bender <djbender@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2016-01-18 21:19:18 +00:00
Cameron Sutter 2527f6b812 only most recent submission
fixes MBL-5281

test plan:
- use the calendar events index api to request assignments
- request submissions (with `include[]=submission`)
- the most recent submission should be returned within the
  calendar event assignment object (for assignments that have
  a submission for that student)

Change-Id: Ib060fb8557dd5f3315f058f0c4dcb989bb52aec7
Reviewed-on: https://gerrit.instructure.com/69040
Tested-by: Jenkins
Reviewed-by: Andrew Butterfield <abutterfield@instructure.com>
QA-Review: Ben Kirato <benk@instructure.com>
Product-Review: Brady Larson <brady@instructure.com>
2016-01-11 18:00:37 +00:00
James Williams 3e1481aa6e rails 4.2: s/destroy!/destroy_permanently!
destroy! is now a method in rails

refs #CNVS-26056

Change-Id: I66e512265ff5cda6a12d7820e3cf69c77ef9e746
Reviewed-on: https://gerrit.instructure.com/69721
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2016-01-07 14:00:13 +00:00
Jeremy Stanley fb1601639a use correct context in pagination headers on files api index
test plan:
 - hit the GET /groups/X/files API and ensure the response
   headers use "/groups/X" and not "/courses/X" in the
   pagination Link attributes
 - repeat for "/users/X/files"

fixes CNVS-26148

Change-Id: I81d6ef9744f6a8f39f9612525f14b55ebd78f357
Reviewed-on: https://gerrit.instructure.com/69560
Reviewed-by: James Williams  <jamesw@instructure.com>
Tested-by: Jenkins
QA-Review: Clare Strong <clare@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2016-01-06 02:24:55 +00:00
James Williams c23210564c use rails 4.2 preloader format
closes #CNVS-26031

Change-Id: I2e0351fb62e5a06b47fe8c6c3dd503318d29a7ad
Reviewed-on: https://gerrit.instructure.com/69228
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2015-12-30 14:58:10 +00:00
Jeremy Stanley 9dd3aaccc9 remove moderated_grading feature flag
test plan:
 - ensure the "Moderate Grades" permission is available
 - ensure the Moderated Grading assignment setting is available
   and persists across course copy
 - sanity check the Moderated Grading workflow to ensure all
   the pieces are still there

fixes CNVS-25080

Change-Id: I490a837f93b5ca35e57469c4411e09f2eb6f411c
Reviewed-on: https://gerrit.instructure.com/69121
Tested-by: Jenkins
Reviewed-by: James Williams  <jamesw@instructure.com>
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2015-12-23 03:29:21 +00:00
Ryan Shaw 298e6808d5 get sub account branding and custom css/includes working
fixes: CNVS-24787
fixes: CNVS-23964
fixes: CNVS-23957 - Handle parent account custom css/js for new_styles
test plan:
* set up a root account, child account, and grandchild account
* use theme editor to set a custom css/js file for each
  (eg: for css `* {color:red}` and for js 'console.log("from grandchild")`
* make a course & a group in the grandchild account
* load a page in that course and group and make sure
  you see grandchild account's branding, and root's,
  child's, and then grandchild's css loaded on the page
  (grandchild should be loaded last so you see it's css
  effects override root or child's and you should see
  the console.log from root then child then grandchild)
* view a page in "child". it should have root and child's
  css/js but not grandchild
* as a user that only has enrollments (account associations)
  in "child", go to the dashboard. you should see
  css/js for both root and child but not grandchild

fixes: CNVS-25051 Opening Theme Editor for
sub-accounts shows incorrect theme preview
test plan:
* Go to a sub-account in theme editor and change
  settings so the Branding is different and save.
* the preview on the right should reflect your
  changes both after you "apply" and "save"
  (and not just show the preview of the root
  account's branding)

fixes: CNVS-23406 - global JS and CSS files are being
included when Global CSS/JavaScript includes is false
test plan:
* go to /accounts/self/, and go to theme editor and
  upload a css_override
* see that that css is loaded on pages
* back in root account settings disable Global
  CSS/JavaScript includes
* check that the css is no longer loaded.
* do the same thing checking a subaccount's custom css

fixes: CNVS-25558 - load whole chain of custom css/js 
in native app api requests

test plan:
* make api request for a wiki page in course in a 
  subaccount that has custom css/js within a root 
  account that also has custom css/js
* you should see both the root account's css/js and 
  the child account's returned in the response

to test grandchild js issue jeremyp found:
* go to theme editor for a grandchild account
* choose a js override file (like: `console.log('first')`)
* preview & apply
* you should see "first" in console
* go back to theme editor, pick a new file (like: `console.log('second')`)
* preview & apply
* you should only see "second" in console. not "first"

Change-Id: I8d9047948f5da94be41e0205844629a170f980af
Reviewed-on: https://gerrit.instructure.com/68249
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Tested-by: Jenkins
Product-Review: Ryan Shaw <ryan@instructure.com>
2015-12-19 02:47:39 +00:00
Cameron Matheson cff0ee2991 fix assignment groups api perf regression
closes CNVS-19971
closes CNVS-25776

Test plan:
  * gradebook and srgb should load
  * srgb should never have a "download submissions" button for quizzes

Change-Id: I30e82ab6526e98a9506579d0b609f50ee7b63da1
Reviewed-on: https://gerrit.instructure.com/68716
Tested-by: Jenkins
Reviewed-by: Derek Bender <djbender@instructure.com>
QA-Review: Jason Carter <jcarter@instructure.com>
Product-Review: Cameron Matheson <cameron@instructure.com>
2015-12-16 04:28:48 +00:00
John Corrigan 788c4cc523 submission preview_url should respect quiz_submission_version
fixes CNVS-25342

When constructing submission json for the API, the preview_url value was
always being supplied a version query param that pointed to the
version_number of the submission itself. Based on the behavior in the
submissions show action, it's clear that if the submission relates to a
quiz submission, what we actually want is to provide a version number
that corresponds to the submission's quiz_submission_version.

test plan:
- See repro steps on https://instructure.atlassian.net/browse/CNVS-25342
  for actual bug fix test instructions.

Change-Id: I3adb12ad349b93b351c0f9b14a03aad5150426ed
Reviewed-on: https://gerrit.instructure.com/68719
Reviewed-by: Ryan Taylor <rtaylor@instructure.com>
Tested-by: Jenkins
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: John Corrigan <jcorrigan@instructure.com>
2015-12-15 17:41:01 +00:00
Simon Williams 67257f3dac stop stripping alt tag when generating mathml
this also fixes and issue where subsequent edits fail to generate mathml
successfully.

fixes CNVS-22762

test plan:
- in all browsers
- create an equation image, save, inspect
- edit page, re-save, inspect
- make sure things look right visually and for screenreaders

Change-Id: Ice5de7be720b217aa19850233e11fdf238d68158
Reviewed-on: https://gerrit.instructure.com/68372
Tested-by: Jenkins
Product-Review: Aaron Cannon <acannon@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
QA-Review: August Thornton <august@instructure.com>
2015-12-14 17:08:47 +00:00
Alex Boyd 554dd86f38 Expose bounce details via the API to siteadmins
Fixes CNVS-22965

Test plan:
 - Create a user and a communication channel for that user, or reuse
   an existing one that has not been deleted
 - Bounce details:
   - From a console, do the following, where "..." is the id of the
     communication channel you're working with:
       c = CommunicationChannel.find(...)
       c.last_bounce_details =
         {'bouncedRecipients' => [{'diagnosticCode' => 'foo'}]}
       c.save!
   - As a siteadmin, hit /api/v1/users/.../communication_channels, where
     ... is the id of the user that owns the communication channel
   - Verify that the communication channel includes a
     "last_bounce_summary" property whose value is "foo"
 - Transient bounce details:
   - From a console, do the following, where "..." is the id of the
     communication channel you're working with:
       c = CommunicationChannel.find(...)
       c.last_transient_bounce_details =
         {'bouncedRecipients' => [{'diagnosticCode' => 'foo'}]}
       c.save!
   - As a siteadmin, hit /api/v1/users/.../communication_channels, where
     ... is the id of the user that owns the communication channel
   - Verify that the communication channel includes a
     "last_transient_bounce_summary" property whose value is "foo"
 - Bounce date:
   - From a console, do the following, where "..." is the id of the
     communication channel you're working with:
       c = CommunicationChannel.find(...)
       c.last_bounce_at = '2015-01-01T01:01:01.000Z'
       c.save!
   - As a siteadmin, hit /api/v1/users/.../communication_channels, where
     ... is the id of the user that owns the communication channel
   - Verify that the communication channel includes a
     "last_bounce_at" key whose values is "2015-01-01T01:01:01.000Z"
 - Transient bounce date:
  - From a console, do the following, where "..." is the id of the
     communication channel you're working with:
       c = CommunicationChannel.find(...)
       c.last_transient_bounce_at = '2015-01-01T01:01:01.000Z'
       c.save!
   - As a siteadmin, hit /api/v1/users/.../communication_channels, where
     ... is the id of the user that owns the communication channel
   - Verify that the communication channel includes a
     "last_transient_bounce_at" key whose values is "2015-01-01T01:01:01.000Z"
 - Suppression bounce date:
   - From a console, do the following, where "..." is the id of the
     communication channel you're working with:
       c = CommunicationChannel.find(...)
       c.last_suppression_bounce_at = '2015-01-01T01:01:01.000Z'
       c.save!
   - As a siteadmin, hit /api/v1/users/.../communication_channels, where
     ... is the id of the user that owns the communication channel
   - Verify that the communication channel includes a
     "last_suppression_bounce_at" key whose values is "2015-01-01T01:01:01.000Z"
 - Restricted to site admins:
   - As the user whose communication channel you were working with,
     hit /api/v1/users/.../communication_channels, where ... is that
     user's id
   - Verify that the communication channel does not include
     "last_bounce_at", "last_suppression_bounce_at",
     "last_transient_bounce_at", "last_bounce_summary",
     or "last_transient_bounce_summary"

Change-Id: I10ed797620392229a55ffc797b2b35d3e979e19a
Reviewed-on: https://gerrit.instructure.com/62578
Reviewed-by: Andrew Butterfield <abutterfield@instructure.com>
Tested-by: Jenkins
QA-Review: Adrian Russell <arussell@instructure.com>
Product-Review: Allison Weiss <allison@instructure.com>
2015-12-11 18:18:49 +00:00
Cameron Sutter 0fb50838f7 return submissions in calendar events api
fixes MBL-5235

test plan:
- in the calendar events index api, add the following parameter:
  include[]=submissions
- when you request assignment type calendar events that have
  submissions, those submissions should be returned

Change-Id: Ib4626be066839ea96b6db932ef422224daeadf69
Reviewed-on: https://gerrit.instructure.com/68107
Reviewed-by: Joel Hough <joel@instructure.com>
Tested-by: Jenkins
Product-Review: Ben Kirato <benk@instructure.com>
QA-Review: Ben Kirato <benk@instructure.com>
2015-12-10 21:20:18 +00:00
James Williams b39ce9e945 preload user account for avatar_url in conversation json
closes #CNVS-25269

Change-Id: I64adbf9a8ca024bac9d69ad5c3626e95eedc3e2b
Reviewed-on: https://gerrit.instructure.com/68438
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2015-12-09 20:31:21 +00:00
James Williams 4d7060547d check sis permissions directly and not on root_account
allows sub account admins to read sis information on courses,
sections (and also groups)

test plan:
* create a sub-account with a sub account admin
* as a sub-account admin, should be able to read sis ids
 on courses and sections in the sub-account

closes #CNVS-25571

Change-Id: I6912cd65b9f14b36dadac97e70cf8fc555c3a189
Reviewed-on: https://gerrit.instructure.com/68330
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Ryan Allen <rallen@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2015-12-09 15:13:56 +00:00
Jeremy Stanley 7a1f597c93 fix hidden folder/file counts in files API
test plan:
 - have a folder that contains only hidden files
   (that is, Restricted Access / Only available to students
    with link), with at least one image file in there
 - as a teacher, make sure the image file shows up in the
   RCE embed-image dialog

fixes CNVS-12834

Change-Id: I7e0c5ddc79f3e026f3471599b868d90044e20885
Reviewed-on: https://gerrit.instructure.com/68337
Tested-by: Jenkins
Reviewed-by: James Williams  <jamesw@instructure.com>
QA-Review: Clare Strong <clare@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2015-12-07 22:15:14 +00:00
Cameron Sutter 1b2d5798b0 return grades in enrollments as parent
fixes MBL-5214

test plan
- send a POST to /users/self/observees as a parent with the
  student's token as the access_token
- query the /users/:user_id/enrollments endpoint with the
  :user_id being the student's id and the Authorization header
  using the parent's token
- it should return the student's grades in the enrollment object
- the grade object should look something like this:
 {
  html_url: "some url",
  current_score: 100,
  final_score: 90,
  current_grade: null,
  final_grade: null
 }

- if the grade object only has html_url then this doesn't pass

Change-Id: Ib2cad115c5b38bb46d5686f4ba838e43c98f31ff
Reviewed-on: https://gerrit.instructure.com/67714
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Jenkins
Product-Review: Ben Kirato <benk@instructure.com>
QA-Review: Ben Kirato <benk@instructure.com>
2015-12-02 20:55:20 +00:00
James Williams 0d821a3f63 allow inactive enrollment type
test plan:
* should be able to use the course people page to
 inactivate users (as long as you have the right to remove them)
* inactivated users should not be able to participate in the
 course (as though they were deleted), but should still show
 up in the course roster for teachers/ta's/admins
 with a label of "inactive"
 (they should not show up for students though)
* inactivated users should still show in the gradebook list
 (and their grades should be editable)

* they should not show up in other lists, such as in the
 list of students to assign to groups, or in the
 list of students that can be messaged in the inbox

closes #CNVS-24790

Change-Id: If74a37e70c5f7e2df19ac312b1ad8f9b6e83a913
Reviewed-on: https://gerrit.instructure.com/67570
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Jenkins
QA-Review: Ryan Allen <rallen@instructure.com>
Product-Review: Cosme Salazar <cosme@instructure.com>
2015-12-01 18:00:55 +00:00
Davis McClellan 800b871162 Ensure that anonymous surveys remain anonymous
fixes CNVS-24633

test plan:
1. Statistics
- answer an anonymous survey as a student
- as a teacher go to the quiz statistics page and expand the questions
- ensure that none of the questions have the student's name on them

2. Submissions
- answer an anonymous survey as a student
- as a teacher go to:
  /courses/:course_id/assignment/:assignment_id/submissions/:student_id
- should get "This student's responses are hidden because this
  assignment is anonymous." message

Change-Id: I94e08d0ad1293240ac9722a94d3365ed53ca5f7d
Reviewed-on: https://gerrit.instructure.com/67629
Tested-by: Jenkins
Reviewed-by: Ryan Taylor <rtaylor@instructure.com>
QA-Review: Michael Hargiss <mhargiss@instructure.com>
Product-Review: Jason Sparks <jsparks@instructure.com>
2015-11-25 00:16:56 +00:00
John Corrigan a6849f84d7 assignment group API includes submission information
fixes CNVS-21989

- Moves submissions_hash from AssignmentsApiController to
  Api::V1::Assignment module.
- Adds `submission` flag to index & show assignment groups api
  controller actions.

test plan:
- Have an assignment group including assignments that have submissions
  for a given user, and those that do not.
- Hit the index & show actions without any flags to make sure endpoints
  still behave as expected.
- Hit the index & show actions with the `assignments` flag to make sure
  assignmetns without the submission flag are still returned & behave as
  expected.
- Hit the index & show actions with the `assignments` & `submission`
  flag and observe that a submission object is returned for assignments
  that have a submission for the given user, and that submission objects
  are not returned for assignments without submissions for the given user.
- Hit the index & show actions with only the `submission` flag and make
  sure that neither assignments non submissions are returned (the
  `submission` flag is a noop without also providing the `assignments`
  flag).

Change-Id: I5d216a7caa65c69e0a3c219abcbe9132b6a567aa
Reviewed-on: https://gerrit.instructure.com/67010
Tested-by: Jenkins
Reviewed-by: Matt Berns <mberns@instructure.com>
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: Brandon Pluim <bpluim@instructure.com>
2015-11-24 16:40:35 +00:00
Ryan Taylor 43c821cb61 Fix scaling of the score for quiz results in the LMGB
Closes CNVS-23803

Test Plan:
  - Create a quiz with a question bank linked outcome
  - Confirm that student scores on the quiz outcome content (1/2, 3/4...
    etc) are properly scaled to the scale of the associated
    outcome/rubric

Change-Id: I8178de9031f54201b97aa642dc99ba661e3f6074
Reviewed-on: https://gerrit.instructure.com/64526
Tested-by: Jenkins
Reviewed-by: Davis McClellan <dmcclellan@instructure.com>
QA-Review: Landon Holmstead <lholmstead@instructure.com>
Product-Review: Ryan Taylor <rtaylor@instructure.com>
2015-11-23 23:19:38 +00:00
James Williams aa9af7c96a don't check for avatar service enabled unless needed
improves performance on user_json

closes #CNVS-25270

Change-Id: Ib18d8570dabb3aa7f50571280ab93c269b0adb21
Reviewed-on: https://gerrit.instructure.com/67691
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Jenkins
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2015-11-23 17:38:15 +00:00
James Williams 1cdcda1673 new account user search page
test plan:
* in development mode, enable the
 "Course and User Search" feature flag
* should be able to view the "Search" tab on the
 sidebar (may need to resave the account to
 clear the sidebar cache)
 (replaces the "Courses" and "Users" tabs)
* searching for People on the account page
 should work pretty good
 (tweaks may be forthcoming before removing the
 feature flag)

closes #CNVS-24951

Change-Id: I00a8954913201ad87d250fec7704a0bfb31abef9
Reviewed-on: https://gerrit.instructure.com/67321
Tested-by: Jenkins
Reviewed-by: Clay Diffrient <cdiffrient@instructure.com>
QA-Review: Ryan Allen <rallen@instructure.com>
Product-Review: Cosme Salazar <cosme@instructure.com>
2015-11-18 20:21:16 +00:00
Pam Hiett 19596f9e30 expand details by default for High Contrast feature option
Fixes: CNVS-24650

note:
master = http://screencast.com/t/HicaJHIjGe

this commit = http://screencast.com/t/x971tQFPmWY

test plan:
- as a user navigate to the user settings
- scroll down to the "Feature Options" header
- the new experience has the "High Contrast UI" details expanded
  by default so the user can see/read what turning on this
  feature means
- the text has also been updated so the user understands that
  enabling this feature will disable any institute customizations

Change-Id: Ifc6bd36fd1e8bfbed467d0a18f189880bc2d7156
Reviewed-on: https://gerrit.instructure.com/66823
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Jenkins
Product-Review: Colleen Palmer <colleen@instructure.com>
QA-Review: Myller de Araujo <myller@instructure.com>
2015-11-17 15:42:20 +00:00
James Williams c67e64c028 improve backend queries for new courses/users search
test plan:
* searching for courses and users should work as before

closes #CNVS-24973 #CNVS-24945

Change-Id: Ice56713466955fdd3f280f2387d774ced1c8e346
Reviewed-on: https://gerrit.instructure.com/67027
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Ryan Allen <rallen@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2015-11-17 14:04:11 +00:00
Davis McClellan bd1829bdc3 add submission_history for quiz submissions
fixes CNVS-22670

test plan:
- navigate to /api/v1/courses/:course_id/assignments/
  :assignment_id/submissions?include=submission_history
- ensure that the entire submission_history appears

Change-Id: Id0ee7e85e1c725d773f715fed061ab3aeda66fff
Reviewed-on: https://gerrit.instructure.com/66851
Tested-by: Jenkins
Reviewed-by: Matt Berns <mberns@instructure.com>
QA-Review: Michael Hargiss <mhargiss@instructure.com>
Product-Review: Davis McClellan <dmcclellan@instructure.com>
2015-11-17 01:03:53 +00:00
Jon Jensen 9bc2dc05bb new account course search page
also lay foundation for new account user search

test plan:
* in development mode, enable the
 "Course and User Search" feature flag
* should be able to view the "Search" tab on the
 sidebar (may need to resave the account to
 clear the sidebar cache)
 (replaces the "Courses" and "Users" tabs)
* searching for courses on the account page
 should work pretty good
 (the people tab is still forthcoming)

closes #CNVS-24750

Change-Id: Id44d1b3c7c36e407339858d2c1657579d1128abc
Reviewed-on: https://gerrit.instructure.com/65268
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Clare Strong <clare@instructure.com>
Product-Review: Cosme Salazar <cosme@instructure.com>
2015-11-12 19:39:16 +00:00
Dan Minkevitch b601558ad6 Fix move dialog for search results
Fixes CNVS-24291

Test Plan:

Part 1 -
  * As a teacher, go to any course's Files page
  * Search for an existing file
  * Select the file and move it with the cog menu
    to a different folder
  * The file should move successfully
  * Repeat the process, but just by navigating to a file,
    not searching for it

Part 2 -
  * As a teacher, go to your files
  * Search for one of your files
  * Use the cog menu to move it to another folder
    in your files
  * Repeat the process, but move it to a course's
    folder, in which case it should copy it
    and alert you that it's been copied
  * Repeat the above with files navigated to (not searched for)

Change-Id: I14b2e3e29460fa1369534fb1c782a387339faf55
Reviewed-on: https://gerrit.instructure.com/65948
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
Tested-by: Jenkins
Reviewed-by: Clay Diffrient <cdiffrient@instructure.com>
Product-Review: Dan Minkevitch <dan@instructure.com>
2015-11-09 23:17:08 +00:00
Davis McClellan 4a128cd89e add excused? to the quiz_submission api
fixes CNVS-22706

test plan:
- go to api/v1/courses/:course_id/quizzes/:quiz_id/submissions
  and ensure that excused? is there

Change-Id: I63ed16ad46f3af20357ff95c8900e32d94b0c108
Reviewed-on: https://gerrit.instructure.com/66508
Tested-by: Jenkins
Reviewed-by: Ryan Taylor <rtaylor@instructure.com>
QA-Review: Landon Holmstead <lholmstead@instructure.com>
Product-Review: Davis McClellan <dmcclellan@instructure.com>
2015-11-05 18:35:47 +00:00
John Corrigan 8d4d967341 add zip_attachment to EpubExport
fixes CNVS-24178

- Updates FilesConverter so that it returns both files that will be
  displayed in the ePub and the files that are unsupported.
- Adds CC::Exporters::Epub::FilesDirectory class, which accepts a
  collection of file objects and adds them to a zip file.
- Updates UI so that a separate download link is present for the zip of
  unsupported files.
- Adds support to MIME::Types library to be able identify ePubs.
- Updates EpubExport to have many attachments; one epub & one zip.
- Updates process of creating attachments related to EpubExports so that
  the content_type value is properly set.

test plan:
- Have a course that contains files that are not supported by ePub, such
  as pdf, doc or xls.
- Navigate to `/epub_exports`.
- Click the button to generate an ePub for the given course.
- Observe that, after the successful generation of the course, two
  download links appear: one for the ePub, one for additional files.

Change-Id: I2f321362bc5ed23f8b28334395f8969c9d90a5de
Reviewed-on: https://gerrit.instructure.com/65753
Tested-by: Jenkins
Reviewed-by: Matt Berns <mberns@instructure.com>
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: Cosme Salazar <cosme@instructure.com>
2015-10-29 20:23:00 +00:00
James Williams 37234f5989 allow teachers to unlink imported outcomes if unused
also don't show the delete button if it isn't going to work

test plan:
* create an account level outcome
* import it into a course
* as a teacher, link it to a assignment's rubric
* visit the outcomes page
* should not be able to delete the outcome
* delete the assignment
* should be able to delete the outcome

closes #CNVS-24106

Change-Id: Idd38d9e6fa69e3dd7d7c48b4056d6c13fa57753a
Reviewed-on: https://gerrit.instructure.com/65898
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Jenkins
QA-Review: Ryan Allen <rallen@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2015-10-29 18:41:33 +00:00
James Williams 4d0caadbf7 don't ping conversation unread_count in student view
it doesn't work

Change-Id: I8e7943e06b09cff8c54afba377d2b8c30737343b
Reviewed-on: https://gerrit.instructure.com/65562
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2015-10-23 20:18:25 +00:00
Jeremy Stanley 28a13a706b crocodoc filtering for moderated grading
Test plan:
  * Ensure Crocodoc annotation filtering works in a moderated
    assignment:
    - Prior to publishing grades,
     - Students see only their own annotations, _not_ any
       annotations made by provisional graders or moderators
       (using the View Feedback link on the submission page)
     - TAs as provisional graders see their own annotations
       and the student's annotations, _not_ those made by
       teachers or other TAs
     - Moderators see the correct provisional grader's annotations
       in the 1st Mark / 2nd Mark Speedgrader tabs
       * if the moderator copies an existing mark from another
         grader to the final mark, she should see her own
         annotations as well as the original grader's
         annotations
    - After publishing grades, all users (students, TAs, and
      teachers) should see the same set of annotations:
     - If a provisional grade was selected for publication,
       that grader's annotations and the student's annotations
       should be visible
     - If a provisional grade was copied to the final mark,
       the original grader's, moderator's, and student's
       annotations should be visible
     - If a student was not in the moderation set,
       no filtering should take place (all annotations should be
       visible to everyone)
     - Other users (provisional graders whose grades were
       not selected for publication) should not be able to
       create new annotations (because we have no way to
       hide _past_ annotations but allow _future_ ones--
       our only solution is to lock them out)
  * Regression test Crocodoc annotations in a non-moderated
    setting:
    - teachers can annotate student submissions
    - students can see teacher annotations
    - teachers can see student annotations

fixes CNVS-23952

Change-Id: Ib842fac356263cff2fc27e6ff4e9abe3e712d6c1
Reviewed-on: https://gerrit.instructure.com/64970
Tested-by: Jenkins
Reviewed-by: James Williams  <jamesw@instructure.com>
QA-Review: Clare Strong <clare@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2015-10-23 16:39:21 +00:00
Josh Orr 3d6c097ab8 Add user avatars to observee's list return object
Modifies the GET /users/<user_id>/observees endpoint to include
the observee's avatar url if avatar service is enabled on the
observee's account.

Fixes MBL-4840

Test Plan:
Create Student user in student account
Create Parent user in parent account
Add Student as an observee of parent by token
Enable avatars on student account
Add avatar to student
Ensure that the list observees endpoint returns student avatar
Add second student with avatar
Repeat test to ensure that both have correct avatar

Change-Id: I0076bbb7d45447632eb4e553829886af69618dc2
Reviewed-on: https://gerrit.instructure.com/64248
Tested-by: Jenkins
Reviewed-by: Brad Humphrey <brad@instructure.com>
QA-Review: Ben Kirato <benk@instructure.com>
Product-Review: Josh Orr <jgorr@instructure.com>
2015-10-22 16:52:43 +00:00
James Williams 596086c315 don't show user avatar path in anonymous peer review api
test plan:
* enable avatars on the root account
* create an assignment with anonymous peer reviews
* as a peer, make a review and a comment on a submission
* as the reviewed student, visit the api index for
 peer reviews, e.g.
 "api/v1/courses/X/assignments/Y/peer_reviews?
  include[]=submission_comments&include[]=user"
* it should not include the user id in the avatar_path

closes #CNVS-24046

Change-Id: I029aa9ebb203d43f546a1bb8e8f7b29160ebdba7
Reviewed-on: https://gerrit.instructure.com/65445
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2015-10-22 12:33:23 +00:00
James Williams e33bf57212 change module api completion field presence
return false when no other requirements have been completed

test plan:
* create a module with a required item
* as a student, without completing any other
 requirements, the context module items
 api should list the "completion_requirement"
 item as "completed": false

closes #CNVS-24152

Change-Id: I0d5235d2e00a5097ec9e00f0f11d593a5a733eb7
Reviewed-on: https://gerrit.instructure.com/65510
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Clare Strong <clare@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2015-10-22 12:32:55 +00:00
Jeremy Stanley 7d1a548bff course nicknames
test plan:
 0. enable New Styles
 1. go to the dashboard with the rectangle card things
 2. click the gear icon on a course card
 3. edit the course name in the box above the colors and
    click Apply
 4. notice the course name in the dashboard card has changed
    and the original name is visible if you hover over
    the nickname
 5. click the card to go to the course and notice your
    course nickname is used:
    - on the course home page (with 'recent activity'
      or 'syllabus' selected)
    - in the Courses menu
    - in "All Courses" under the Courses menu
    - in the UI navigation (breadcrumbs)
    - on the calendar (right side list)
    - in the Inbox (course dropdown)
 6. go back to the dashboard, click the gear menu on
    a course card, clear out the nickname, and click Apply.
    - the original course name should be restored
      and shown in the locations listed in step 5
 7. repeat steps 2-6 with a different student in the same
    course; ensure the first student's course nickname
    doesn't leak through to a second student
 8. regression test course color choosing functionality
    on both the dashboard and the calendar

closes CNVS-23201

Change-Id: I8dd714cad83dca5e17e65c6c463cdadc655db83c
Reviewed-on: https://gerrit.instructure.com/65052
Tested-by: Jenkins
Reviewed-by: James Williams  <jamesw@instructure.com>
QA-Review: Clare Strong <clare@instructure.com>
Product-Review: Hilary Scharton <hilary@instructure.com>
2015-10-21 23:03:51 +00:00
James Williams a0b637d973 fix quiz question api content translation
should translate the html not the text

also shouldn't api format the output for create/update

test plan:
* edit a quiz and create a multiple choice question,
 giving one of the answers a "&", "<", or ">" character
* save the question, and without refreshing or saving the quiz,
 click to edit the question again
* the answers should not be malformed

* edit a quiz and upload a media comment into a quiz question
* save the question and without refreshing or saving the quiz,
 click to edit the question again
* save it again and save the quiz
* the media comment should be preserved

closes #CNVS-21976 #CNVS-21791

Change-Id: I5a00b4d3bdfab90f441421f158782a2472c2999d
Reviewed-on: https://gerrit.instructure.com/65088
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Jenkins
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2015-10-19 15:53:29 +00:00
Keith Garner 1d190418f8 observers using the api can see observees grades
API users enrolled in courses as observers can retrieve the grades of
observed users via the API for calls to course and assignments apis
when includes[]=observed_users is added to the call.

Summary of changes to the API:
1) for course enrollments:
    o new data elements passed back in enrollment records
      * user_id is added as a data element
      * associated_user_id is added if the enrollment type is
        ObserverEnrollment
    o if include[]=observed_users is added enrollment records for
      observees are passed back along with Observers enrollments

2) For assignment data:
    o submission is returned as an array when include[]=observed_users
    o submission may have multiple values if you are an Observer with
       multiple observees and include[]=observed_users is included

fixes CNVS-13310

test plan:
 - Create a course with two users besides the teacher: one student and
   one observer.
 - Set the observer to be an observer of the student
 - Create an assignment and create a submission for the assignment from the
   student

 - Call the API at /api/v1/courses/<course_id>?include[]=term&include[]=permissions&include[]=license&include[]=is_public&include[]=needs_grading_count&include[]=total_scores (substituting the proper course_id)
 - Observe in the enrollments section of the return there is no data
   for the observed student
 - Call the API at /api/v1/courses/<course_id>?include[]=observed_users&include[]=term&include[]=permissions&include[]=license&include[]=is_public&include[]=needs_grading_count&include[]=total_scores (substituting the proper course_id)
 - Observe in the enrollments section of the return there is data
   for the observed student including the grades

 - Call the API at /api/v1/courses/<course_id>/assignments?include[]=submission (substituting the proper course_id)
 - Observe that for the created assignment there is no submission information
   for the observed student.
 - Call the API at /api/v1/courses/<course_id>/assignments?include[]=observed_users&include[]=submission (substituting the proper course_id)
 - Observe that for the assignment there is submission information
   for the observed student.

 - Call the API at /api/v1/courses/6/assignments/36?include[]=submission&include[]=rubric_assessment&needs_grading_count_by_section=true&include[]=all_dates
 - Observe that for the assignment there is no submission information
   for the observed student.
- Call the API at /api/v1/courses/6/assignments/36?include[]=observed_users&include[]=submission&include[]=rubric_assessment&needs_grading_count_by_section=true&include[]=all_dates
 - Observe that for the assignment there is submission information
   for the observed student.

Change-Id: I53f6ff0e797d9248f78b33980af138b021547992
Reviewed-on: https://gerrit.instructure.com/64229
Tested-by: Jenkins
Reviewed-by: Spencer Olson <solson@instructure.com>
Reviewed-by: Strand McCutchen <smccutchen@instructure.com>
QA-Review: Jason Carter <jcarter@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
2015-10-15 23:09:02 +00:00
John Corrigan adad2fc64f exportable considers sort setting; EpubExport hooked up to Exportable
refs CNVS-21794
closes CNVS-21802

- Adds CC::Exporter::Epub::Exportable#sort_by_content_type?, which can
  be overridden by classes that `include` the module to point to where
  the setting can be found.
- Update CC::Exporter::Epub::Exportable#convert_to_epub to pass
  `sort_by_content_type?` to CC::Exporter::Epub::Exporter.new.
- Update EpubExport to include CC::Exporter::Epub::Exportable, and
  override / add to instance methods.

test plan:
- Navigate to `/epub_exports`.
- Observe a list of courses that are active & user is enrolled in.
- Click on the Generate button.
- Observe that info about the state of the export and the timestamp are
  added to the middle of the row.
- Observe that a progress bar is displayed while the export is in
  progress.
- Observe that upon completion, the progress bar is replaced by two
  button / links: Download & Regenerate.
- Click on the download link.
- Observe that an epub file is downloaded and can be opened in an
  eReader.
- Observe that the Regenerate button triggers the process all over
  again.

Change-Id: Ib42c2d2623c3ccd394105cdf0e3809b96c8a2e60
Reviewed-on: https://gerrit.instructure.com/63469
Reviewed-by: Matt Berns <mberns@instructure.com>
Tested-by: Jenkins
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: Cosme Salazar <cosme@instructure.com>
2015-10-13 16:52:38 +00:00
Dan Minkevitch 731ee214da Allow admins to change users' default emails
fixes CNVS-23604

Test Plan:
1. As an Administrator, create a user (Users > Add a New User)
2. Add an email address and save the user
3. Edit the User (Users > click on name > click Edit link in Name and Email section
4. Administrator should be able to edit the email address field
5. Upon saving the updated email address, the change should be reflected in the UI

Change-Id: Iaba72fb5bd8bd75697f3d2e3c869a75b0686310f
Reviewed-on: https://gerrit.instructure.com/64466
Tested-by: Jenkins
Reviewed-by: James Williams  <jamesw@instructure.com>
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
Product-Review: Cosme Salazar <cosme@instructure.com>
2015-10-07 21:30:37 +00:00