appointment groups: allow limiting max appts per participant

closes: #7562

Test plan:
  - create an appointment group that has a limit on per-participant
    appointments
  - make sure a student can sign up for no more than that many appointments
  - remove the limit
  - make sure that a student can sign up for all slots

Change-Id: Id6d323c056369b4e76671ef10c0fa5e2dfa740ca
Reviewed-on: https://gerrit.instructure.com/9422
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
scheduler: allow teachers to cancel student appointments

closes #7560

Test plan:
  - reserve a time slot with one or more students
  - as a teacher, click on the reserved time slot (in either scheduler
    or month view)
  - you should be able to remove the student from the appointment

Change-Id: I2b5faf813ebafe50fbf185ee8f61764667afa941
Reviewed-on: https://gerrit.instructure.com/9594
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Cameron Matheson <cameron@instructure.com>
script/server improvements

don't let guard break ruby-debug

add BARE_SERVER shortcut

don't duplicate the tailing of delayed job output -- the server is
already tailing log/development.log, so tell the job daemon not to tail
it too

Change-Id: I23f8b9b413e99f515804819292b3ae15a598290d
Reviewed-on: https://gerrit.instructure.com/9796
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Zach Wily <zach@instructure.com>
fixed bad path for json2.js

Change-Id: I49f87d58f7b7190c004fad34b102f2db44523f82
Reviewed-on: https://gerrit.instructure.com/9800
Reviewed-by: Ryan Shaw <ryan@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
add avatars to roster pages

In courses and groups, add the avatar picture below
each user's name.

test plan:
- enable avatars on an account
- load a course roster
- make sure avatar pictures appear correctly

- load a group roster
- make sure avatar pictures appear correctly

- disable avatars on the account
- load the course roster
- make sure avatar pictures appear correctly

Change-Id: Ib1f91edb153b42a20a3212aa5d12d5383d8b3325
Reviewed-on: https://gerrit.instructure.com/9024
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Ryan Shaw <ryan@instructure.com>
spec: make scheduler spec less fragile

When looking for .fc-event, there are actually several on the page that are
hidden (like templates). You didn't know if you'd happen to get the visible
one first, so now we search for the visible one explicitly.

Change-Id: I65b37a95318afb4eda7b4605247d86126bcd9b98
Reviewed-on: https://gerrit.instructure.com/9803
Reviewed-by: Simon Williams <simon@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
fix attachment migration for mysql, make it nicer for all dbs

* changes temp table usage to be more efficient (also, mysql doesn't let
  you ref the same temp table twice in a query)
* make it non-transactional to reduce locking
* break up the big update statements into batches of 1000

test plan:
* confirm the migration runs in mysql/postgres/sqlite, and the migration
  spec passes for all three as well

Change-Id: Ib15028fa49103230e2cb4957754d2ac19853f90c
Reviewed-on: https://gerrit.instructure.com/9802
Reviewed-by: Ryan Shaw <ryan@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
avatars in SpeedGrader

Add an avatar in the top right of SpeedGrader to show
the currently visible student. Also add avatars for
submission comments made on the submission.

test plan:
- enable avatars on the account
- go to SpeedGrader for an assignment
- make sure student avatars appear correctly in the top left
- add a comment to the submission
- make sure your avatar appears correctly next to your comment

- disable avatars on the account
- go back to the same SpeedGrader view
- make sure no avatars appear

Change-Id: Iac0e2305f24340a984ff5546eed7e4789f8337b5
Reviewed-on: https://gerrit.instructure.com/9675
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Ryan Shaw <ryan@instructure.com>
student view; closes #6995

allows course admins to view the course from a student perspective. this is
accessible from a button on the course/settings page. They should be able to
interact with the course as a student would, including submitting homework and
quizzes. Right now there is one student view student per course, so if the
course has multiple administrators, they will all share the same student view
student.

There are a few things that won't work in student view the way the
would for a normal student, most notably access to conversations is disabled.
Additionally, any publicly visible action that the teacher takes while in
student view will still be publicly visible -- for example if the teacher posts
a discussion topic/reply as the student view student, it will be visible to the
whole class.

test-plan:
- (the following should be tried both as a full teacher and as
  a section-limited course admin)
- set up a few assignments, quizzes, discussions, and module progressions in
  a course.
- enter student view from the coures settings page.
- work through the things you set up above.
- leave student view from the upper right corner of the page.
- as a teacher you should be able to grade the fake student so that they can
  continue to progress.
- the student should not show up in the course users list
- the student should not show up at the account level at all:
  * total user list
  * statistics

Change-Id: I886a4663777f3ef2bdae594349ff6da6981e14ed
Reviewed-on: https://gerrit.instructure.com/9484
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
scheduler: per-appointment participant limit

closes #7769

Test plan:
  - create an appointment group
  - open the appointment groups and edit one of its appointments
  - change the number of users allowed to attend the appointment
  - make sure that no more users can reserve the appointment than
    configured

Change-Id: I4365113d81d123bd8c3cdc24af8761cc6b9027a3
Reviewed-on: https://gerrit.instructure.com/9648
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Zach Wily <zach@instructure.com>
prevent intermittent selenium failures for conversation attachments

Change-Id: Ib6348f1aac572b4d9faceb00c5dbd1be4522d94b
Reviewed-on: https://gerrit.instructure.com/9818
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
fix disappearing appointment group events

fixes #7888

Test plan:
  - make an appointment group
  - reserve one of the appointments as a student
  - as the teacher, go to the month calendar view
  - edit the appointment group event
  - make sure the event doesn't disappear

Change-Id: I01574c7c343ff0681e13acd00773dc564814a437
Reviewed-on: https://gerrit.instructure.com/9661
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Cameron Matheson <cameron@instructure.com>
gradebook2 header-column fixes

fixes #6873, #7286

Test plan:
  - open the gradebook in a course with an assignment that has a very
    long name
  - verify that the assignment name is truncated
  - verify the tooltips on the column headers are sensible

Change-Id: I2309f05e0426f5d855f9e385c13934a05efa6da1
Reviewed-on: https://gerrit.instructure.com/8791
Reviewed-by: Jake Sorce <jake@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
users API endpoint (for course settings) #7764

* merged Api::V1::Enrollment into Api::V1::User because of a circular
  dependency
* adding enrollments and email fields to #user_json
* adding associated_user_id, updated_at, and locked fields to
  #enrollment_json

/api/v1/courses/:course_id/users
test plan:
* create a course
* enroll a user twice in the course (e.g. a TA)
* call the api with 'enrollments' and 'email' in include[]
* verify that the user data includes an email and two enrollments

Change-Id: I2f09c72c0e60fb7d2cd5bc7b585834970ad7a7cf
Reviewed-on: https://gerrit.instructure.com/9607
Reviewed-by: Jon Jensen <jon@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
show teacher's comments in rubric for students, fixes #7291

test plan:
- create an assignment and tie a grading rubric to it
- submit the assignment as a student
- grade the submission and add a comment to a couple of the fields in the rubric
- go back to the student and view "Submission Details"
- click on "Show Rubric"
- a comment bubble should show under the "Pts" column
- clicking on the bubble should show an un-editable popup with the comments

Change-Id: Iad9de6fd6087e7638bf26abe623bd30760e7f16a
Reviewed-on: https://gerrit.instructure.com/9740
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
properly handle selective external migration imports

The selective imports mostly worked before, but if a
given section was completely unchecked the previous
code would import it anyway. This fixes that and makes all
the decision code in one place and easy to test.

Test Plan:
 * Import a content package and only choose certain items
 * Only the items you chose should be imported

closes #5528

Change-Id: Ia6c0c1f5f9a44497053733101140cc74d6239129
Reviewed-on: https://gerrit.instructure.com/9799
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
fix cancel typos refs #7949

Change-Id: If8d9c75a9ac31b87474aa21cfdae77ef40513eb0
Reviewed-on: https://gerrit.instructure.com/9798
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
remove invalid spanish translation key

in the new discussions we changed a key that used to have an interpolated value
to one that no longer has one.  Since the spanish translation lags a bit, this
causes an error until the new translation is done.

test-plan:
- in a course that has a dashboard entry about a graded discussion topic
- switch course locale to spanish
- make sure the dashboard loads

Change-Id: Ia41fe4b40ec08ad5de78005e4b3a42d007c2c036
Reviewed-on: https://gerrit.instructure.com/9837
Reviewed-by: Jon Jensen <jon@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
spec: fix bad course import spec

we were relying on the order and array of courses got sent to the page

Change-Id: I10b4d0c6a173758f13a2b37ace059e4453fcd0d6
Reviewed-on: https://gerrit.instructure.com/9841
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
clean up temporary tables in migrations

since an external connection pool might be in use, and it would mess
up future migrations

test plan:
 * create two new shards through pgbouncer in the same database in
   quick succession

Change-Id: I2bf582a543a48f9df83888feda54818211931a34
Reviewed-on: https://gerrit.instructure.com/9842
Reviewed-by: Jon Jensen <jon@instructure.com>
Tested-by: Hudson <hudson@instructure.com>