Commit Graph

2807 Commits

Author SHA1 Message Date
Benjamin Porter 5a975d407f Include pdfjs in preferred_plugins array
Instead of sending a separate param to canvadocs for pdfjs as
a preferred plugin, just put it in the preferred_plugins array (which
used to be called preferred_renders)

Refs CNVS-30582

Test Plan:

    - This is very difficult to test manually, particularly without
      changing any code.  The reason for this is that canvadocs doesn't
      currently do anything with the pdfjs preferred plugin so you can't
      just check for that behavior.  However, this is something you can
      do even tho it isn't ideal (and this is how I tested this patch in
      development):
      - get canvas working with a canvadocs instance on which you can
        modify code.  By modifying the canvadocs instead of the canvas,
        the integrity of this patch is maintained for test purposes.
      - In the canvadocs session controller
        (app/controllers/session_controller.js), add a log statement to
        display what comes in in the body of the request.  Something
        like:
        - console.log('Request body: ')
        - console.dir(req.body)
      - Submit an assignment to a course as a student.
      - As a teacher, open speedgrader from that assignment.  This will
        cause a new canvadocs viewing session to be created.
      - In the console output of the canvadocs instance, see that the
        body did not include a preferred_plugin of pdfjs.
      - Toggle the feature flag to enable new annotations.
      - Repeat opening speedgrader but this time observe that the body
        includes pdfjs in the list of preferred_plugins.

Change-Id: Ie3e16e1331fcdd757e96888f033e8341e7d6a0bc
Reviewed-on: https://gerrit.instructure.com/86549
Tested-by: Jenkins
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Reviewed-by: Brad Horrocks <bhorrocks@instructure.com>
Product-Review: Benjamin Porter <bporter@instructure.com>
2016-08-03 03:07:50 +00:00
Cody Cutrer a8e4ff4dea search common accounts more exhaustively for user permissions
fixes CNVS-30666

Change-Id: I63a64c4798ef156339ec4a952faa6866fa38d95f
Reviewed-on: https://gerrit.instructure.com/86428
Tested-by: Jenkins
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Benjamin Christian Nelson <bcnelson@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2016-08-02 20:36:26 +00:00
James Williams a4f7dc86a1 conditional release content migration service
test plan:
* make sure canvas is configured with a
 conditional release service with g/85046 merged or checked out
* create assignments in a course with conditional content
* after copying the course, or exporting/importing the course,
 the new assignments should have conditional content

closes #CNVS-30371 #CYOE-235

Change-Id: I42693f2d12185f5c7f665d303baf938ad4af08ad
Reviewed-on: https://gerrit.instructure.com/85108
Tested-by: Jenkins
Reviewed-by: Michael Brewer-Davis <mbd@instructure.com>
Reviewed-by: Dan Minkevitch <dan@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Reviewed-by: Christian Prescott <cprescott@instructure.com>
QA-Review: Alex Morris <amorris@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2016-08-02 15:11:13 +00:00
James Williams 8539a6b44b allow course admins without manage rights to preview quizzes
test plan:
* create a custom teacher role with "Manage assignments/quizzes"
 disabled
* a teacher with that role should be able to see and preview
 a quiz

closes #CNVS-30574

Change-Id: Ib036b2f352c63c63fc4454e08d80d21f34415ce0
Reviewed-on: https://gerrit.instructure.com/86119
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-08-02 12:47:16 +00:00
Michael Brewer-Davis 9ab530eb04 add domain to cyoe jwt
supports cors in cyoe

refs: CYOE-245

Test plan:
1.  Parse CYOE jwt, verify that domain is included in the
    main jwt (previously only in the embedded canvas jwt)

Change-Id: I5a9949dd01271322cbd6c6f0819ea5d63a7222a0
Reviewed-on: https://gerrit.instructure.com/86172
Tested-by: Jenkins
QA-Review: Alex Morris <amorris@instructure.com>
Reviewed-by: Dan Minkevitch <dan@instructure.com>
Product-Review: Dan Minkevitch <dan@instructure.com>
2016-07-29 18:30:48 +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
Derek Bender 8d30336086 spec: update weighted grading period api
The api for weights was originally added in c18c1ab3,
this commit ensures certain specs are present for weights

closes: CNVS-26708

test plan:
 - using the api for grading periods the field
   `weight` should accept floats
 - verify this field on the following endpoints:
   - get 'accounts/:account_id/grading_periods'
   - get 'courses/:course_id/grading_periods'
   - get 'courses/:course_id/grading_periods/:id'
   - patch 'courses/:course_id/grading_periods/batch_update'
   - put 'courses/:course_id/grading_periods/:id'
   - patch 'grading_period_sets/:set_id/grading_periods/batch_update'

Change-Id: Ia2c879034da2b9b984d65a02f38ab5ef43690561
Reviewed-on: https://gerrit.instructure.com/84971
Reviewed-by: Nicholas Pitrak <npitrak@instructure.com>
Reviewed-by: Spencer Olson <solson@instructure.com>
Tested-by: Jenkins
QA-Review: Amber Taniuchi <amber@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2016-07-27 19:52:03 +00:00
James Williams d47e30ce36 fix qualified names bug with Account#users_name_like
refs #CNVS-30606

Change-Id: Ief66913dfaefe856fd893df26677c9db16a2dde9
Reviewed-on: https://gerrit.instructure.com/86248
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-07-27 16:15:32 +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 b5320c6f15 make Download Submissions respect anonymous grading
test plan:
 - enable anonymous grading in a course
 - have an assignment that accepts file submissions
 - make some submissions as students
 - as a teacher,
   1. "Download Submissions" from the assignment page;
   2. ensure the files inside the zip don't reveal the
      student's name in their filenames;
   3. re-zip and ensure "Re-upload Submissions" works

fixes CNVS-30564

Change-Id: I9b6145d6b51492fc9c08d263298c6341b73d3f51
Reviewed-on: https://gerrit.instructure.com/85980
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-07-27 00:11:42 +00:00
Keith Garner e5191cf6f2 honor gradebook inactive/concluded settings in speedgrader
Speedgrader now honors the settings from core gradebook related to
showing active and inactive enrollments.  For group assignments, the
representative student will be favored in priority order of active,
inactive, concluded.

This also fixes an issue where inactive students in a group wouldn't
receive the group grade when the group was graded in both the
gradebook and speedgrader.

fixes CNVS-28432

test plan:
 Individual assignments:
   - Create a course with at a individual assignment, and three
     students, one active, one inactive, and one concluded.
   - In gradebook turn off show inactive and show concluded.
   - Load speedgrader and note that only the active student shows.
   - In gradebook turn on show inactive.
   - Load speedgrader and note that both the active and inactive
     students show and the inactive student shows the inactive notice
   - In gradebook turn off show inactive and turn on show concluded.
   - Load speedgrader and note that both the active and concluded
     students show and the concluded student shows the concluded
     notice.
   - In gradebook turn on show inactive and turn on show concluded.
   - Load speedgrader and note that all the students show with
     appropriate notices.

 Group assignments:
   - Create a course with three students and put them in one group.
     After being grouped, set one inactive and one concluded. (If
     possible make the "third" student the active one.)
   - Create a group assignment
   - Load speedgrader for the assignment
   - Note that neither the inactive nor concluded banner
     appears. Using the debugger, note that the student id of the
     group matches that active student id.
   - In gradebook, deactivate the active student.  In the settings,
     confirm that both "show inactive" and "show concluded" is off.
   - Load speedgrader, note that it says there is no work to do.
   - In gradebook settings, confirm that both "show inactive" and
     "show concluded" is enabled.
   - Load speedgrader, note the "Inactive Student" banner. Using the
     debugger, note that the student id for the group is one of the
     inactive students.
   - Conclude all the students.
   - Load speedgrader, note the "Concluded Student" banner. Using the
     debugger, note that the student id for the group is one of the
     concluded students.

Change-Id: I60c8cbae6244e7acc85b61b99c6d03135152234a
Reviewed-on: https://gerrit.instructure.com/83272
Reviewed-by: Derek Bender <djbender@instructure.com>
Tested-by: Jenkins
QA-Review: KC Naegle <knaegle@instructure.com>
Product-Review: Christi Wruck
2016-07-22 16:40:51 +00:00
KC Naegle c5c0314fe4 spec: add testRail associations
Change-Id: I33b0bb3451d0dbc3c97e019d5062c0d487a3e2a4
Reviewed-on: https://gerrit.instructure.com/85756
Tested-by: Jenkins
Reviewed-by: Gentry Beckmann <gbeckmann@instructure.com>
Product-Review: Gentry Beckmann <gbeckmann@instructure.com>
QA-Review: Gentry Beckmann <gbeckmann@instructure.com>
2016-07-19 22:50:49 +00:00
Christian Prescott a83add0d40 Migrate wiki page assignment relationship in course copy
refs CYOE-120

Test Plan
0. Enable conditional release feature flag.
1. Create a few pages, mark one conditional content.
2. Via course settings, copy the pages to another course.
3. Ensure any conditional pages have their assignments intact. They
   should appear in Pages and in Assignments. (for teachers and those
   students who have visibility) Ensure non-conditional pages didn't
   have assignments assigned.

Change-Id: I3ab27877ef530bd68c5c5a6990ea59a6af37e5a9
Reviewed-on: https://gerrit.instructure.com/83767
Reviewed-by: James Williams  <jamesw@instructure.com>
Tested-by: Jenkins
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
Product-Review: Christian Prescott <cprescott@instructure.com>
2016-07-18 19:23:54 +00:00
Spencer Olson d863a93de3 datafixup: set grading period close date to end date
backfill grading period close dates and add validations
for close date. validations include 1) presence and 2)
close date on or after end date. also, ensure end date
and close date are always in sync for course grading
periods.

closes CNVS-30266

test plan:
- before running migrations, make sure you have
  some grading periods without close dates on them
  and some with close dates on them (you should
  probably have some older grading periods hanging
  out that don't have close dates on them. if you
  don't, let me know and i can help you remove the
  close dates from a few)
- run the migration and verify all your grading
  periods have close dates
- enter a rails console. find a grading period
  that belongs to a grading period group that
  belongs to a _course_
- verify whenever you update that grading
  period's end_date, the close_date is changed
  to match the end date. verify if you attempt
  to change the close date and save, it does
  not change.

Change-Id: Ia680885d89db923ec945e4eb31e32d1a20b66a2e
Reviewed-on: https://gerrit.instructure.com/84591
Reviewed-by: Neil Gupta <ngupta@instructure.com>
Reviewed-by: Jeremy Neander <jneander@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins
QA-Review: KC Naegle <knaegle@instructure.com>
Product-Review: Christi Wruck
2016-07-18 15:58:12 +00:00
Tyler Scott 7ab09c9fd5 fix learning outcome import calculation method
fixes CNVS-22881

The Course Copy importer should correctly copy all content.
Previously Learning Outcomes content would get changed when
copying from another source. Now all the data, including the
calculation method should be copied.

test plan
1. Create an outcome with a calculation method other than
   Highest Score
2. As an instructor copy that outcome to another course
3. Check the outcome in the target course and notice the
   calculation method is correct and the content is the
   same as the original.

Change-Id: Ie6d502f45dc28fc524e375efe2205b87ce8efe24
Reviewed-on: https://gerrit.instructure.com/83709
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Jenkins
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2016-07-18 15:55:56 +00:00
Benjamin Porter 07687bcbd1 Add feature flag for canvadocs preferred plugin
When the new canvadocs annotation stuff is ready, we want to be able to
selectively turn it on to slowly roll it out.  This adds a feature flag
to the course that allows the new annotations to be enabled by course.
There is also an account-level flag that allows the feature to be turned
off globally per account, turned on, or simply "allowed" which delegates
to the course.

Refs CNVS-26668

Test Plan:

    - Open up the account settings and observe that there is a feature
      flag called 'New Annotations'
    - See that the feature flag can be either Off, Allowed, or On
    - Inside a course belonging to the account, see that there is
      a feature flag for New Annotations that can be toggled on/off when
      the account level setting is 'Allowed', or is Off when the account
      is off or On when the account is on.
    If you have rails console access:
        - Submit an attachment to an assignment in the course with the
          new annotations flag turned off
        - Observe that the preferred_plugin on the associated Canvadoc
          object is 'nil'
          - canvadoc_obj = Canvadoc.last # or whatever
          - # send has to be used cause #preferred_plugin is a private
          - # method.  Returns nil or 'pdfjs'
          - canvadoc_obj.send(:preferred_plugin)
        - Turn the feature flag on for the course (either through the
          course settings or through the account)
        - you should not need to resubmit, and shoudl see that the
          preferred_plugin gets set to 'pdfjs'.  It should toggle from
          pdfjs to nil and back when turning the feature flag on and
          off, whether at the account level or the course level

Change-Id: I6dd70fa2b379d527315dd7e14ee6ff8cceda024e
Reviewed-on: https://gerrit.instructure.com/84956
Tested-by: Jenkins
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Reviewed-by: Spencer Olson <solson@instructure.com>
Reviewed-by: Keith T. Garner <kgarner@instructure.com>
Product-Review: Benjamin Porter <bporter@instructure.com>
2016-07-15 21:15:37 +00:00
James Williams cdb4b3805d don't resurrect deleted quiz question groups on re-import
test plan:
 * have a course with a quiz containing two question groups
 * copy this course
 * delete one group in the source course's quiz
 * delete the entire quiz from the destination course
 * re-import the source course into the destination
 * confirm the question group deleted in step 3 isn't present
    in the destination course's quiz

closes #CNVS-30444

Change-Id: Ia3a33bf29354eed39b0b712cf9fc91244137bcf1
Reviewed-on: https://gerrit.instructure.com/85411
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-07-15 16:31:37 +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
Nick Pitrak c9faee1caa fix anonymous moderated grading
anonymous grading was not working for moderated assignments.
this commit adds graded_anonymously to the provisional grade
model to address the issue.

fixes CNVS-29261

test plan:
- create a Course with a Teacher, Student and TA
- on the Course Settings page in the Feature Options tab,
  turn on Anonymous Grading
- create and publish an assignment with the Moderated Grading
  checkbox enabled
- masquerade as the TA and grade the assignment in Speedgrader
- note the student's name is 'Student 1'
- masquerade as the Teacher and from the Assignment page, click
  the Moderate button
- click the Post button to push the moderated grades to the
  gradebook
- masquerade as the Student and open the Assignment page
- in the Submission Details box on the right, the
  'Graded Anonymously' field should read 'Yes'

Change-Id: I2e87635020cebb0bc81853d8eead228bbb5f1e6d
Reviewed-on: https://gerrit.instructure.com/83503
Reviewed-by: Spencer Olson <solson@instructure.com>
Reviewed-by: Cody Cutrer <cody@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 22:07:45 +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 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
Brad Humphrey 18e44d4c69 do not add the same group to a collaboration multiple times
test plan:

create a content-item that adds a group through visibility
update a collaboration using content-item
update the collaboration again using that content-item
the group should only have been added to the collaboration once

fixes PLAT-1666

Change-Id: Ie5134632569f5fac331f51017edd278a8ba2d159
Reviewed-on: https://gerrit.instructure.com/85057
Reviewed-by: Andrew Butterfield <abutterfield@instructure.com>
Tested-by: Jenkins
QA-Review: August Thornton <august@instructure.com>
Product-Review: Brad Humphrey <brad@instructure.com>
2016-07-12 22:41:29 +00:00
Jeremy Stanley 93dee27904 fix discussion topic permissions for unauthenticated users
test plan:
 - in a public course, unauthenticated users should have the
   same restricted access as logged-in users who aren't enrolled
   in the course, namely:
   - the discussion topic index should not be accessible
     (/courses/X/discussion_topics redirects to a login page)
   - graded discussion topic descriptions are visible on the
     assignments page, but posts are not shown

fixes CNVS-30262

Change-Id: I8a4351c6bab5ca06a3c0c89a51b38e3d8bed3d24
Reviewed-on: https://gerrit.instructure.com/84164
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-07-11 18:42:51 +00:00
Spencer Olson cdd029a5c3 add close_date column to grading_periods table
in addition, if no close date is provided on
creation of a grading period, the end date
will be used as the close date.

closes CNVS-26714

test plan:
* run the migration and verify it succeeds:
  $ bundle exec rake db:migrate
* open a rails console and verify the close_date
  attribute exists and it is a datetime:
  $ bundle exec rails console
  $ GradingPeriod
* verify:
  1) you can create a grading period with an end
     date but without a close date. the close date
     will get set to the end date that you provided.
  2) you can create a grading period with a unique
     end date and close date. the close date must
     be on or after the end date. if you attempt to
     create a grading period with a close date that
     is before the end date, it should fail.

Change-Id: I1a180af4eb8c23703e3844d2e93159010f0c9e58
Reviewed-on: https://gerrit.instructure.com/84340
Tested-by: Jenkins
Reviewed-by: Jeremy Neander <jneander@instructure.com>
Reviewed-by: Keith T. Garner <kgarner@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2016-07-11 15:03:39 +00:00
Rob Orton eb7b11e705 handle attachments on user split
fixes CNVS-29150

test plan
 - user with attachments
 - merge into different user
 - split users
 - attachments should be restored to original users

Change-Id: Ia5696718e2bdbdae7ee47ed0916af99daee4b5b9
Reviewed-on: https://gerrit.instructure.com/79908
Tested-by: Jenkins
Reviewed-by: James Williams  <jamesw@instructure.com>
Reviewed-by: John Corrigan <jcorrigan@instructure.com>
QA-Review: Benjamin Christian Nelson <bcnelson@instructure.com>
Product-Review: Ian Hoerner <ian@instructure.com>
2016-07-08 17:24:11 +00:00
James Williams 65d3249d9b extend external content migration framework for selective export
closes #CNVS-30349

Change-Id: Ia9e314f6495cf89127cf55ad38a28c5dc1791d10
Reviewed-on: https://gerrit.instructure.com/84594
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-07-08 16:07:06 +00:00
James Williams 479759dfc8 structure for importing/exporting external service content
services can be integrated to be told when a course export
(or course copy) occurs and can send custom data to be
saved in the package

the data can use keys with the format '$canvas_TYPE_id'
where TYPE is a canvas object (e.g. 'assignment')
where the values are ids for objects in the source course
so when the package is imported, the saved data will have the
ids translated to the new copied objects, thus preserving
relationships between objects

closes #CNVS-30161

Change-Id: Iee5400c45d6189305b8626219dbe9aef345fea9e
Reviewed-on: https://gerrit.instructure.com/83531
Reviewed-by: Dan Minkevitch <dan@instructure.com>
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-07-08 16:06:10 +00:00
Brad Humphrey d4dfac030b Do not generate LTI jwt tokens outside of the current context
Test Plan:
- create a tool
- visit /api/lti/context/:context_id/jwt_token?tool_id=:tool_id from
- a different account on the same shard
- Canvas should return a 404 not found response

fixes PLAT-1640

Change-Id: Ib0d9d6cc01f5d6687ef26b748361796d36abf8bf
Reviewed-on: https://gerrit.instructure.com/84343
Reviewed-by: Nathan Mills <nathanm@instructure.com>
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Brad Humphrey <brad@instructure.com>
2016-07-06 22:22:07 +00:00
Joel Hough fad436ea6c allow TAs to download course content epubs
fixes CNVS-30312

test plan
- as a TA, try to download course content as an epub
- ensure that course content is downloadable

Change-Id: I7834c7f2a02de4400a1a5656d08ef505fd13dcb4
Reviewed-on: https://gerrit.instructure.com/84377
Tested-by: Jenkins
Reviewed-by: James Williams  <jamesw@instructure.com>
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: Joel Hough <joel@instructure.com>
2016-07-06 18:14:29 +00:00
Andrew Huff 2776d85656 remove weird Google Doc Collaborations title synchronization
fixes CNVS-30049

Collaborations have a title stored in the db. Separately, Google stores
a Google Doc's title on their servers. When Canvas creates a
collaboration, it tells Google what the title is, so the titles are
initially synchronized. However, the only other way that the two titles
synchronize is by Canvas grabbing the Google Doc's title if the Canvas
title is null... which AFAICT will never happen.

I've removed this weird partial-synchronization.

The original bug was due to `validates_presence_of :title` not working
correctly because Collaboration objects have a `def title` method. Since
I've removed method that method, the validation works correctly now.

Test plan:
* Create a collaboration without a title
   (if this is not possible through the UI, `Collaboration.new` in
   the rails console will work)
* Try to save the collaboration to the db
* Verify that an error occurs

* Create a Google Docs collaboration with a custom title through the UI
* Verify that the title is correctly stored within the db

Change-Id: I0408004ab4056c00fbfab148685e98ff037811ec
Reviewed-on: https://gerrit.instructure.com/83153
Reviewed-by: Steven Burnett <sburnett@instructure.com>
Reviewed-by: James Williams  <jamesw@instructure.com>
Tested-by: Jenkins
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
Product-Review: Andrew Huff <ahuff@instructure.com>
2016-07-06 16:15:31 +00:00
James Williams c619c4a170 record deleted courses through full batch sis imports
test plan:
* enable sis imports for the root account
* import a course through a sis import
* re-import a sis import without the course
 using "full batch update", which will cause
 the course to be deleted
* in the course activity log, it should record that
 the course was deleted

closes #CNVS-30070

Change-Id: I4e1cd8091fc11ab88dab8f2987ecfcec0b4fa731
Reviewed-on: https://gerrit.instructure.com/82990
Reviewed-by: Steven Burnett <sburnett@instructure.com>
Tested-by: Jenkins
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2016-07-05 18:30:34 +00:00
Jeremy Neander dc88075b2a associate grading period groups with root accounts
Grading Period Sets will now be associated directly with accounts
instead of enrollment terms.

closes CNVS-29932

test plan:
 1. Visit the grading standards page for a given account
 2. Create a Grading Period Set
 3. At the Rails Console, verify:
     a. The Grading Period Set was created
     b. It has the given attributes
     c. `account.grading_period_sets` contains the created set
 4. Visit the grading standards page for a given account
 5. Delete the Grading Period Set
 6. At the Rails Console, verify the set was soft-deleted

Change-Id: I6ddbfeb2899aeb80d4594c03efc1b6788506f781
Reviewed-on: https://gerrit.instructure.com/83965
Tested-by: Jenkins
Reviewed-by: Keith T. Garner <kgarner@instructure.com>
Reviewed-by: Spencer Olson <solson@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2016-07-01 20:15:56 +00:00
Jeremy Stanley 95c7b34fc6 preserve publishing state and usage rights when overwriting
test plan:
 - ensure the following are preserved when overwriting a file:
   * published state
   * hidden state
   * available from/until dates
 - enable usage rights and ensure copyright licenses etc.
   are also preserved when a file is overwritten

fixes CNVS-22901

Change-Id: Iba9a9d9c107f30d982ea0700d4d51785f26dc23a
Reviewed-on: https://gerrit.instructure.com/83842
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-01 19:57:59 +00:00
John Corrigan 42d295b8ea remove JSON support from MediaObject.build_media_objects
fixes CNVS-29515

test plan with kaltura config:
- Configure account to use kaltura for transcoding.
- Navigate to the files page as a teacher (or someone that can upload
  media).
- Open the js console and swich to the network tab, viewing the xhr
  requests.
- Upload a file that should be transcoded (I've been using mp4s).
- ...wait a minute until the transcode is done.
- Click on the media that has shown up in the files browser.
- Observe that in the network tab, the request is made to the `/info`
  endpoint.
- Note that, in my local environment, regardless of what I used to
  transcode, I could never get previews to show up. The difference I
  could observe though is whether or not the attempt to display previews
  got to this point. This may be different in portals?
- As another check, go to the rails console and observe that the last
  Attachment instance and the last MediaObject instance are related:
  `Attachment.last.media_object == MediaObject.last`

test plan with other config:
- Configure account to use another service for transcoding.
- Navigate to the files page as a teacher (or someone that can upload
  media).
- Open the js console and swich to the network tab, viewing the xhr
  requests.
- Upload a file that should be transcoded (I've been using mp4s).
- ...wait a minute until the transcode is done.
- Click on the media that has shown up in the files browser.
- Observe that in the network tab, the request is made to the `/info`
  endpoint.
- Note that, in my local environment, regardless of what I used to
  transcode, I could never get previews to show up. The difference I
  could observe though is whether or not the attempt to display previews
  got to this point. This may be different in portals?
- As another check, go to the rails console and observe that the last
  Attachment instance and the last MediaObject instance are related:
  `Attachment.last.media_object == MediaObject.last`

Change-Id: Ic779a3d3e25c7239726321354c6c9a1100c025d1
Reviewed-on: https://gerrit.instructure.com/83665
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-06-30 20:13:12 +00:00
James Williams a3dd238e77 spec: fix intermittent quiz_question_builder_spec failure
assessment question ids can be the same as the quiz question id

Change-Id: Iafe056483990709ab8435eeac177a98cd72351d7
Reviewed-on: https://gerrit.instructure.com/84056
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-06-30 18:47:43 +00:00
Christian Prescott 88459eb4a7 add score and points_possible to grade_change live event
refs CYOE-190

Test Plan
1. Monitor live events as sent from canvas, or as received by the CYOE
   lambda or web app. Ensure grade_change events are raised with
   correct attributes for all cases where grade or score is affected:
- submission is graded for the first time in an assignment. ensure nil
  old_score and old_grade.
- submission is regraded. ensure (old_)points_possible is not changed.
- assignment changes grading_type. ensure grade changes, but score does
  not.
- assignment changes points_possible. ensure score is unchanged,
  old_points_possible is correct. ensure subsequent events have correct
  old_points_possible.

Change-Id: I0ae18772fc816340a23a9b48aee3c00af7a12bcf
Reviewed-on: https://gerrit.instructure.com/81381
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins
QA-Review: Robert Lamb <rlamb@instructure.com>
Product-Review: Christian Prescott <cprescott@instructure.com>
2016-06-30 18:19:19 +00:00
Neil Gupta b47516dc2f Scale existing scores when assignment total points change
Fixes CNVS-30027

Test plan:
* As a teacher, create an assignment worth 100 points
* As a student, submit something for the assignment
* As a teacher, grade the assignment (ie 70)
* Edit the assignment to change the possible points (ie 10 points)

The graded submission should scale its score, so 70 becomes 7 in this
example. This should work for all grade types.

Change-Id: I4e84075dbe406416df4378173a45fb5e3e9096fa
Reviewed-on: https://gerrit.instructure.com/82963
Tested-by: Jenkins
Reviewed-by: Keith T. Garner <kgarner@instructure.com>
QA-Review: KC Naegle <knaegle@instructure.com>
Product-Review: Christi Wruck
2016-06-28 18:32:50 +00:00
James Williams c34dac583d prevent negative unread_conversation_counts
also try to make sure that the unread_conversation_count is
updated correctly by running in a transaction

closes #CNVS-29376

Change-Id: I47e29e97958a6579208a711bb5fe03ee40096647
Reviewed-on: https://gerrit.instructure.com/83656
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-06-28 14:01:28 +00:00
Ryan Taylor 646a16b255 Fix speedgrader LTI integration bugs
1) Respect global context in URL lookups
2) Update submission_type when replacing previous submission

Closes PLAT-1623

Test Plan:
 - Speedgrader integrations should load without error
 - Cross-sharded speedgrading should load properly

Change-Id: I9ed6d6f629d6af9c03a5fe4d13aded771ff17f61
Reviewed-on: https://gerrit.instructure.com/83476
Reviewed-by: Cameron Matheson <cameron@instructure.com>
Reviewed-by: Davis McClellan <dmcclellan@instructure.com>
Reviewed-by: Shahbaz Javeed <sjaveed@instructure.com>
Tested-by: Jenkins
QA-Review: Benjamin Christian Nelson <bcnelson@instructure.com>
Product-Review: Brad Humphrey <brad@instructure.com>
2016-06-27 22:19:11 +00:00
James Williams b8b5443217 cache default_locale on accounts
gets called on every request - before could possibly do a N+1
search up the account chain until it found a locale

Change-Id: I5fc5643ad807ecfd0519cf9e155ec1cf955b2787
Reviewed-on: https://gerrit.instructure.com/82713
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-06-27 15:20:21 +00:00
James Williams 069ee1e547 create enrollment_states table
creates a new table that will store the enrollment
state_based_on_date information that we've been previously
calculating over and over again all the time

we'll invalidate the rows whenever we make any date
changes and recalculate them in a delayed job

also we'll periodically recalculate as relevant dates pass
for the enrollments

if the time between when we invalidate the data and when
we recalculate it is acceptably short, then we should start
using it for actual database scoping for enrollments

test plan:

* regression test term/course/section dates for future, active
 and soft-concluded enrollments
* also regression test visibility access settings (e.g.
 "Restrict students from viewing course before start date")
 on accounts and courses

closes #CNVS-29460

Change-Id: I27d23c0eb49e5b1b9a6fe532409e51be8a07be52
Reviewed-on: https://gerrit.instructure.com/80000
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2016-06-27 13:56:02 +00:00
Christian Prescott 33d21f7a71 Fix duplicate entries for adhoc overrides in due dates hash
refs CYOE-193

Test Plan
1. As teacher, add >1 individuals to an assignment override.
2. Visit assignment#show. Ensure "X students" appears in only 1 row.
3. Ensure overridden students and observers still see the correct due
   dates on the same assignment.

Change-Id: I0e240aab037861ef83dd32858c617124c37a6fcc
Reviewed-on: https://gerrit.instructure.com/82534
Reviewed-by: Marc Alan Phillips <mphillips@instructure.com>
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
Tested-by: Jenkins
Product-Review: Christian Prescott <cprescott@instructure.com>
2016-06-24 22:21:45 +00:00
Ryan Taylor f65790aa9d Respect scale settings for formula answers visualization
Previously, formula questions generated answer variable values were
always shown with at least one decimal value.  Now, they always display
with respect to the scale value used to configure the variable itself.

Closes CNVS-29480

Test Plan:
 - Set up a formula question with a 0 scale answer and see that it
   shows up without a trailing .0 in the preview or taking views

Caveat: Will not fix existing data, but only new content or updated
content.

Change-Id: I671ad8a393bc1bea24fa0addd164f0fe4558253a
Reviewed-on: https://gerrit.instructure.com/82911
Reviewed-by: Sterling Cobb <sterling@instructure.com>
Tested-by: Jenkins
QA-Review: Michael Hargiss <mhargiss@instructure.com>
Product-Review: Jason Sparks <jsparks@instructure.com>
2016-06-24 19:16:40 +00:00
Ben Rinaca dedef25236 makes assignments unavailable in availability gaps
Prevents a student from being able to submit assignments when they are
in between availability windows for an assignment, ex: when they're in a
section that had already completed and in a section that has not yet
started.

fixes CNVS-24849

test plan:
- make sure students in a section where an assigment is available can
  still submit assignments
- make sure students see when their assignment will be available if
  their availability window has not yet started
- make sure students see when their assignment was last available if
  their availablility window has already ended
- make sure students see when their assignment will be available if
  they're in a gap between availability windows

Change-Id: Ia2d9aa6f9a694b4c6cd434e93c1b3156d437c198
Reviewed-on: https://gerrit.instructure.com/80843
Reviewed-by: Davis McClellan <dmcclellan@instructure.com>
Tested-by: Jenkins
QA-Review: Michael Hargiss <mhargiss@instructure.com>
Product-Review: Jason Sparks <jsparks@instructure.com>
2016-06-24 19:14:15 +00:00
James Williams c206f76bf4 improve recent_stream_items performance
participating_enrollments is cached

Change-Id: Ibcaaf68ccc528376e9e0be5851317d78ddf0d688
Reviewed-on: https://gerrit.instructure.com/82638
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-06-24 02:21:28 +00:00
Simon Williams 6164d7be74 spec: fix spec about speedgrader representatives
currently, the code only prefers unexcused candidates if they have
a submission, so we need to make sure there is a submission in the spec,
otherwise it's random and the spec fails if the wrong candidate is
chosen.

Change-Id: I80f1c3c1935730f3b555acca0b7f716026f5a1bc
Reviewed-on: https://gerrit.instructure.com/83396
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Jenkins
Reviewed-by: Cameron Matheson <cameron@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
QA-Review: Simon Williams <simon@instructure.com>
2016-06-23 20:01:23 +00:00
Derek Bender d9325cb962 Merge branch 'dev/grading-periods-update' into master
Change-Id: Icb89d806b0c9474765a6024584eb4317b8c5e406
2016-06-22 10:26:21 -05:00
Brad Humphrey cded671d6d replace functionality LTI selected logos with svg paths
test plan:
 - Install a tool with an svg path specified via the icon_svg_path_64
	in XML config with a global placement
 - The logo svg path should be drawn as the logo for global navigation
	in the new UI

Change-Id: I50785da33494cb776c7765e3b46512c628174e65
Reviewed-on: https://gerrit.instructure.com/82250
Reviewed-by: Andy VanWagoner <andy@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Tested-by: Jenkins
Reviewed-by: Chandu Tennety <ctennety@instructure.com>
Reviewed-by: Nathan Mills <nathanm@instructure.com>
Product-Review: Brad Humphrey <brad@instructure.com>
2016-06-20 22:31:38 +00:00
Simon Williams 2400190ab6 improve how we choose branding outside of account context
enhance the algorithm so that if a user has courses in an account higher
than the end of the common account chain, pick the higher account
instead.

fixes CNVS-29127

test plan:
- create an account structure with a root and two sub accounts.
- play with different combinations of the user being enrolled in courses
in the root and both sub-accounts (the specific but is when they are
enrolled in a course from the root and one sub-account but not the
other)
- make sure branding on the dashboard makes sense

Change-Id: I02e36ee3a9d69a6aa23ea584ec65b43ade593ec4
Reviewed-on: https://gerrit.instructure.com/82161
Tested-by: Jenkins
Reviewed-by: Rob Orton <rob@instructure.com>
QA-Review: Myller de Araujo <myller@instructure.com>
Product-Review: Colleen Palmer <colleen@instructure.com>
2016-06-20 21:14:53 +00:00
Ryan Taylor 63f4b13bec Guard against malformed formula questions in Quiz stats
Closes CNVS-29923

Test Plan:
 - Build out a graded survey with an essay question.
 - Take the quiz
 - Change the question to a formula question with an answer
 - Take the quiz
 - Try to download stats and have :success: instead of :fail:

Change-Id: Ia9ce4b00d24136b876193e345a6a72e7b70e3b7a
Reviewed-on: https://gerrit.instructure.com/82738
Reviewed-by: Bryan Petty <bpetty@instructure.com>
Tested-by: Jenkins
QA-Review: Michael Hargiss <mhargiss@instructure.com>
Product-Review: Jason Sparks <jsparks@instructure.com>
2016-06-20 20:19:04 +00:00