add specs for using overridden dates on modules page for observers

turns out the code was already working, just needed some
specs to make sure for the case of observers

test plan:
* as an observer:
 * should see one due date, (the latest one)
  when not associated with a student

 * when associated with a student, should see the same
  due date that the student does

 * when associated with multiple students who have
  different dates applied to them, should see
  "Multiple Due Dates" indicator

closes #CNVS-2012

Change-Id: I358eb8433ff640bc9b7c15ab071b2b790ea2ce85
Reviewed-on: https://gerrit.instructure.com/16557
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
QA-Review: Bracken Mosbacker <bracken@instructure.com>
spec: fix intermittent notification policy failure

Change-Id: I62b3de6bb57bb5376e4ea3fc314a88d41aa2626b
Reviewed-on: https://gerrit.instructure.com/16634
Reviewed-by: Jake Sorce <jake@instructure.com>
QA-Review: Jake Sorce <jake@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
track the role each UserView applies to

Each user box under a role is associated with a UserView, but each UserView looks
at all the user's enrollments, not just those of the containing role.  Fix.

Test plan:
 - Enroll a user as both a TA (in Section 1) and an Observer (in Section 2).
  - Ensure the gear menu in the TA box has an "Edit Sections" menu item
   - Click Edit Sections and add the TA to Section 2; make sure this works.
  - Ensure the gear menu in the Observer box has a "Link to Students" menu item.
   - Link the observer to a student, and confirm this works as expected.
 - Enroll a user as both an Observer and a custom role based on Observer.
  - Verify this actually worked in the UI--the user should show in both
    boxes, and should not disappear from one and appear in the other
  - Link each enrollment with a different student.  Make sure the student
    appears in the right place.
 - Enroll a user as both a TA (in Section 1) and a custom TA-based role
   (in Section 2).
   - Ensure the TA box shows only "Section 1", and the Custom-TA box shows
     only "Section 2".
   - Click "Edit sections" for the Custom TA and add Section 1.  make sure
     the Custom TA box shows both sections after this, and that the
     (regular) TA box continues to show only Section 1.

fixes #CNVS-2432
fixes #CNVS-2596
fixes #CNVS-2628

Change-Id: I93fe0da90064b7530541010775f2ae0d280e033d
Reviewed-on: https://gerrit.instructure.com/16560
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: James Williams  <jamesw@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
QA-Review: Adam Phillipps <adam@instructure.com>
removal of add assignment group dialog js block

test plan:
  - as a teacher, go to Calendar 1, click on an assignment and edit it.
    Select "New Group" from the Assignment Group dropdown.
  - You should get a popup dialog to enter a new group name. Enter a
    new group name.
  - Make sure the group is really added when you hit submit by going to
    Course Assignments page (/courses/:course_id/assignmetns) and
    verifying the presence of the group there.
  - Do the same for the assignments edit page. As a teacher, add a
    new Assigment Group from that page.

Change-Id: I4f0adf6f594ef357c95c06dae2f01019d26c6fcd
Reviewed-on: https://gerrit.instructure.com/16517
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Myller de Araujo <myller@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
api: support turnitin_settings in assignment api

fixes #CNVS-2598

test plan:
- on an assignment in a course with turnitin enabled
- make sure turnitin_settings are returned in the api
- make sure you can modify them

Change-Id: Ief9465ef3ef9f1d180dd551dcb846b25bc63b3fa
Reviewed-on: https://gerrit.instructure.com/16583
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
Reviewed-by: Stanley Stuart <stanley+gerrit@instructure.com>
fix for root accounts without a custom turnitin pledge

fixes #CNVS-2608

test plan:
- create a course with turnitin on a root account
- make sure the account doesn't have a custom turnitin pledge
- as a student, submit a turnitin assignment
- it should work

Change-Id: Ic4f328ea4cc9e7d985fd15f3cb219f164a3048e1
Reviewed-on: https://gerrit.instructure.com/16629
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Simon Williams <simon@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
spec: fix spec failures in ruby 1.9

these strings are frozen, causing spec in the test controller class

Change-Id: I6ddda4de24e3661a6a0336371450b720c17563ef
Reviewed-on: https://gerrit.instructure.com/16654
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Brian Palmer <brianp@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
bug: if override due date is before default due date on an assignment, it is not applied

fixes #CNVS-2309

Problem:
Overriding a due date to be earlier than the default was having no
effect because the default date was getting lumped in with the overrides
and treated the same way when deciding which to use.

Solution:
If there are applicable overrides, don't take the default into account.

Notes:
The issue was happening as a result of the way the VariedDueDate class
indiscriminately lumped due dates together and returned the last one.
Part of the solution was removing the VariedDueDate class and instead
relying on the override methods on an Assignment. This was done not
only to fix the bug at hand but also to move toward a more consistent
interface for handling varied due dates.

Change-Id: If9d24725a19b134d5d92d3a5c08d6794f466fa9c
Reviewed-on: https://gerrit.instructure.com/16406
QA-Review: Myller de Araujo <myller@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
Fix importing an outcome into a rubric

The points and description were not getting filled in properly, so were
lost when saving.

Fixes #CNVS-1272

test plan:
1. On account level create Outcome with custom description and values
2. Import Outcome into course
3. Create rubric in course
4. Add outcome as criterion in rubric
5. Verify the points and descriptions for the ratings are correct
6. Save the rubric, reload, verify they are still correct

Change-Id: Iba1313cae77be23a8ac588c9b40f54450ddeb291
Reviewed-on: https://gerrit.instructure.com/16644
Reviewed-by: Simon Williams <simon@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Brian Palmer <brianp@instructure.com>
Enable C2 undated events to be edited and identify their type. Fixes #CNVS-459 Fixes #CNVS-460

Improves feature parity with C1. Show the undated event title as a link
that can be middle clicked to open the event. Clicking on the undated event
shows the event information in a popover. This is based on g/16332.

Testing Notes:
============
* In Calendar2, in the right sidebar, click the "Undated Events" to load them.
* Verify that an icon distinguishes an assignment from a calendar event.
* Clicking the event should open the event details popover.
* Middle-clicking (with a mouse) the event title should open the event
   in a new browser tab.

Change-Id: Ib645b753a191cd725686cf68534056a0001a64d9
Reviewed-on: https://gerrit.instructure.com/16510
Reviewed-by: Zach Pendleton <zachp@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Marc LeGendre <marc@instructure.com>
fix past enrollments scope

fixes a problem where deleted enrollments
would show up in past enrollments if course is completed

test plan:
 * Enroll a user
 * Delete the enrollment
 * Conclude the course
 * The enrollment should not show up in
 the users' past enrollments

fixes #CNVS-2237

Change-Id: I632db943c4232b5959fd7e4d87000e8e4f65225b
Reviewed-on: https://gerrit.instructure.com/16136
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
QA-Review: Adam Phillipps <adam@instructure.com>
improve sentence for modules shortcut helper

Test Plan:
 * When hitting the question mark div in a screen reader it should say "question mark" instead of "quote quote"

closes #CNVS-283

Change-Id: Ib05bc8b9a0d169e40f7b1a122dbf4572343b36e1
Reviewed-on: https://gerrit.instructure.com/16519
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Adam Phillipps <adam@instructure.com>
don't freeze on loading screen for content import with no items

handles the case when the content migration import page is stuck
on the loading screen when the content import doesn't have any
items to select on the import page (and thus populateItem never
gets run)

test plan:
* import the attached import (which only has questions, no course
 items to select)
* should load the content import screen, (even though there's
 only one option: "Copy Everything"

closes #CNVS-2662

Change-Id: I17ddeca10752f42000edc928995dd8766e9ff51c
Reviewed-on: https://gerrit.instructure.com/16661
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Adam Phillipps <adam@instructure.com>
use a shard-safe query for selecting question bank questions

refs #CNVS-2641

Change-Id: I85a60fdb7a862b1a095b40a892de2304446184e1
Reviewed-on: https://gerrit.instructure.com/16603
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
QA-Review: Clare Hetherington <clare@instructure.com>
add reserved scheduler appointments to calendar feed

fixes #CNVS-2133

test plan:
 - create an appointment group as a teacher
 - reserve some appointments as students
 - view the teacher's calendar feed in an external calendar
   program
 - make sure only the reserved appointments show up
 - view the student's calendar feed in an external calendar
   program
 - make sure that student's reserved appointment shows up
   (this behavior was already there)

Change-Id: I7b1644fd8aeba5a1e64cfab49f27a51698532b47
Reviewed-on: https://gerrit.instructure.com/16561
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
QA-Review: Marc LeGendre <marc@instructure.com>
show all users not assigned to group in unassigned

fixes #CNVS-2619

test plan:
1. create an account level group
2. put somebody in the group
3. remove them from the group
4. refresh the page
   - the user should be in the unassigned area

if a user had previously belonged to a group, they
were no longer included in unassigned since the
query didn't check the workflow state

Change-Id: Iaca501c4fc35847759f56a925707618571943bf6
Reviewed-on: https://gerrit.instructure.com/16638
Reviewed-by: Jon Jensen <jon@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Ryan Florence <ryanf@instructure.com>
document assignment override features as beta

Changes the documentation to signify the Assignment Overrides feature as
a beta feature.

test plan:
  - run rake doc:api
  - view the documentation for assignments. The Assignment Overrides
    feature should be marked as in beta.

Change-Id: I2d523e73f1dd3c610823c7f5e16dba2602980a0e
Reviewed-on: https://gerrit.instructure.com/16637
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
adding ActiveRecord::Base.count_by_date

refs #CNVS-2064

Change-Id: Idc122b7550e112abc57ac7ffd810005fd303e493
Reviewed-on: https://gerrit.instructure.com/16663
Reviewed-by: Jon Jensen <jon@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Joe Tanner <joe@instructure.com>
fix content import form submission in ie

Internet Explorer offered to download the json response
instead of parsing it and starting the progress bar. This
moves the submission out of an iframe and changes the
response type to text so that IE doesn't offer to download

Test Plan:
 * import content into a course in IE
 * import content in other browsers too to make sure they still work

closes #CNVS-2454

Change-Id: If968d2d4c01a0c4f12042d5cd7b2e177af552282
Reviewed-on: https://gerrit.instructure.com/16544
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Adam Phillipps <adam@instructure.com>
users tab: fix counts when a user is enrolled in multiple roles

fixes #CNVS_2680

test plan:
 - create a custom course role (e.g., "CustomStudent")
 - create a user with a login ID (pseudonym)
 - go to the Users tab in Course settings
 - enroll the user, via the login ID, in the _base_ role
   (e.g., "Student")
  - confirm the Student count increases by one
 - enroll the same user (by login ID) in the custom role
  - confirm the CustomStudent count increases by one
 - remove the CustomStudent enrollment (click on the cog
   next to it and select "Remove from Course")
  - confirm the CustomStudent count decreases by one
  - confirm the Student count does not change
  - reload the page and confirm the Student was not
    unenrolled

note that a prior commit fixes #CNVS_2636, but this commit
includes an automated test that verifies this

Change-Id: I9620caa017e365c34a3c0cdd3722e73fd5eb49c4
Reviewed-on: https://gerrit.instructure.com/16653
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
QA-Review: Adam Phillipps <adam@instructure.com>