Commit Graph

937 Commits

Author SHA1 Message Date
Bracken Mosbacker 58c5ab27a7 don't include muted assignments in cached grade calculations
Test Plan:
 * Have canvas and delayed jobs running
 * Create a course with some assignments
 * Give scores to some students
 * Before muting an assignment download the CSV and make sure it's same as UI
 * Mute an assignment
 * Download CSV again and the final/current scores should be different than UI
 * In gradebook UI remove grades from muted assignment (so it's as if they weren't graded)
 * The UI grades should now be the same as the CSV grades

closes #6578

Change-Id: I5774ecb899318278a02e1bc12caaa9d02fa3dac0
Reviewed-on: https://gerrit.instructure.com/7379
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2012-02-16 14:18:06 -07:00
Bracken Mosbacker a30a1b8d9f don't fail when copying/import invalid urls
the urls for content tags didn't use to be validated so there
can be invalid urls in olds data. If you try to copy one of
those courses it fails. It also failed for importing content
packages.

This commit makes it so that importing will skip those items
and add an item about it to the migration warning. For course
copy it attempts to escape the url and continue copying.

Test Plan:
 * try to import a course from a package that has an invalid url
 * try to copy a course that has an invalid url. (You'll have to manually set the invalid url on the ContentTag)

closes #7262

Change-Id: I008b786919bb2b66e0ff546667e7c0832b52e192
Reviewed-on: https://gerrit.instructure.com/8710
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2012-02-16 13:48:33 -07:00
Brian Palmer b5c3b24b7c fix assigning of assignment group when no active groups exist
fixes #7275

Because whiny_nils on raises an exception in dev/test modes, the ".id
rescue nil" line was setting the id to nil in dev/test, but to 4
(nil.id) in production.

I reworked this so that we should always get an assignment group, and we
should never use assignment group id of 4.

test plan:
  * in production mode, create an assignment in a course that has no
    active assignment groups. this is easiest through the API, since the
    UI does stuff to ensure an assignment group always exists.
  * verify that a new group is created and the assignment is added to
    that group.

Change-Id: I34aace583c559fa9e584026612a97298177e281c
Reviewed-on: https://gerrit.instructure.com/8725
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2012-02-15 10:19:43 -07:00
Zach Pendleton 113b16e2db add course import notification. fixes #6930
when course import is happening, display notification on
course home page that explains why some content may not
be visible.

test plan:
  * create new course;
  * verify that no message displays on course home page;
  * start course import (or create a CourseImport
    in the console);
  * verify that course import notification appears on course
    home page;
  * complete CourseImport or set its workflow_state to either
    'completed' or 'failed.'
  * verify that course import notification no longer appears.

Change-Id: Ia62fbf9d8d1a36440d4f36d28ee4ebc83fe8668d
Reviewed-on: https://gerrit.instructure.com/8624
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
2012-02-14 14:57:58 -07:00
Jon Jensen b84170663e fix conversations rss links, remove unnecessary query
test plan:
ensure the rss feed still works

Change-Id: I888c6ae7903fdcc79e2b2ea3b1f974449f245aa5
Reviewed-on: https://gerrit.instructure.com/8694
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
2012-02-14 13:31:25 -07:00
Jon Jensen 6d994d08c8 refine conversation creation for group submissions, fixes #7212
changes the behavior such that the only submission comments that create/
update conversations are ones by participants in the conversation.
previously, a comment on a group submission would update all private
conversations between the teacher(s) and all group members, rather than
the one(s) between the teacher(s) and the commenter. group comments by a
teacher will still go to each of his conversations with group members

test plan:

1. create a group assignment
2. submit it as a student
3. make a group comment as that student
4. ensure the student's conversation with the teacher gets updated if it
   already exists
5. ensure the teacher's conversation with the student gets updated and
   marked as unread (if not already)
6. ensure that no conversations between other group members and the
   teacher get created/updated
7. now make a group comment as the teacher
8. ensure that the conversations get updated/created between the teacher
   and all group memebrs, i.e.
   1. they should be unread from the student's perspective
   2. for everyone, the teacher's comment should be the reflected in the
      left-hand conversation preview

Change-Id: I1cfac34fc7b78fad17edf93acaa50b8b97461af6
Reviewed-on: https://gerrit.instructure.com/8644
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
2012-02-13 13:42:16 -07:00
Jon Jensen fb2fe0d6b8 ensure context tags are shared by 2+ participants, fixes #7231
when sending bulk private messages, ensure that each created/updated
conversation only gets contexts that are relevant to both participants

also fix an issue where the tags were not getting cleared once the
last message was deleted

test plan:
1. test bulk private conversations
 1. send a bulk private conversation to several contexts
 2. ensure that only the appropriate tags show up on each
    created/updated conversation
2. test clearing out
 1. delete all messages from a conversation
 2. ensure the tags are empty in the db
3. make sure tagging/filtering isn't generally broken

Change-Id: I416a1e809bdcb0835cd9f3d281cc71ab7df057f4
Reviewed-on: https://gerrit.instructure.com/8615
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
2012-02-13 13:29:45 -07:00
Jon Jensen 626f12645d prevent duplicate messages for submissions, fixes #7221
includes a data migration to remove duplicate messages

test plan:
1. create multiple teacher enrollments for yourself in a course
   (invited/active/whatever)
2. masquerade as a student, submit homework with a comment
3. unmasquerade and go to your inbox
4. ensure that you see the submission and comment in your conversation
   with the student, but only once

Change-Id: I05c1db702b328e855aa7bcd2187617fa073d7261
Reviewed-on: https://gerrit.instructure.com/8595
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
2012-02-13 13:29:41 -07:00
Simon Williams 1af0f48d95 send notifications for discussion comments; fixes #6953
the "Topics I've Commented On" notification wasn't working, this fixes it to
correctly send messages for a new discussion entry to all other users who have
participated in that discussion already.

test plan:
- set your topics i've commented on notification to immediately
- create a discussion topic
- have another user create a response
- you should be notified

Change-Id: I6a0d90c7b8c590b645cc31ab004da991a5851b0f
Reviewed-on: https://gerrit.instructure.com/8564
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2012-02-13 09:08:40 -07:00
Jon Jensen a90dcf6e49 add unique_constraint_retry block to submit_homework
fixes remaining duplicate key errors

test plan:
1. ensure you can still submit homework, and don't get any db errors

Change-Id: Iff28ab7ea5416ca8a1758692a5b975dc4d471bbe
Reviewed-on: https://gerrit.instructure.com/8602
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2012-02-10 15:48:39 -07:00
Brian Palmer 21d2c608c6 optimization to Course#gradebook_json
The previous method of mapping over the entire submissions array once for
each student was inefficient for courses with a large number of
submissions (which is typically students * assignments)

refs #7235

test plan:
  * download the csv from the gradebook
  * re-upload the csv to the gradebook, verify that things work as before
  * on a large course, this should be significantly faster than the
    previous code. however, it could still timeout on a huge course.
    this won't be completely solved until we refactor and make this an
    async process.

Change-Id: Icd2d7aae79fa933f1338de0b1c18a7219d772e93
Reviewed-on: https://gerrit.instructure.com/8642
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
2012-02-10 13:16:29 -07:00
Brian Palmer 0b2fc926f9 fix for zero-point pass/fail assignments
The values of "pass" and "fail" are allowed in the API, but they were
intended to be saved to the DB as "complete" and "incomplete". A bug
prevented the translation from happening for zero-point pass/fail assignments.

fixes #7234

test plan:
  * create a complete/incomplete assignment worth 0 points (or leave points blank)
  * using gradebook2, give a student a passing grade (green checkmark).
    * this bug only affects grades given in gradebook2, not the old
  * masquerade as the student and go to your grades page. you should
    correctly see your grade as complete, not incomplete.

Change-Id: If5fd920af97db9181dafc0330af6aa9d8d1497a4
Reviewed-on: https://gerrit.instructure.com/8632
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
2012-02-10 12:58:48 -07:00
Bracken Mosbacker f803aa65dc make question data always a HashWithIndifferentAccess
All the code that works with question data is dependant on
the data being a HashWithIndifferentAccess. This commit
makes sure to use that in AQs and QQs, and made the
accessor to question_data set it to the expected hash
type so that old incorrectly serialized data doesn't have
to be updated.

Test Plan:
 * Create some assessment questions that will run through translate_links
 * When accesssing that data id should be an indifferent access hash
 * When viewing those questions in the UI they should display correctly for students and teachers
 * Manually set question data as a hash on a AQ or QQ, when you access it through the AQ/QQ it should be a HWIA

closes #6897

Change-Id: I526ab886aad2f96a3741330059439b100b6a1011
Reviewed-on: https://gerrit.instructure.com/8623
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Zach Wily <zach@instructure.com>
2012-02-09 16:29:54 -07:00
Simon Williams 6e0bf1954d show mult. enroll. in groups; fixes #6998
We want to show all sections that a user belongs to when building groups, and
make sure that section-restricted groups take into account multiple sections.
The data model already (mostly) supported this, but the UI did not.

Test plan:
- create a course with > 2 sections, > 2 users, at least one in multiple
  sections.
- Go to the groups page, make sure that both sections show up under the user.
- Make the group category section-restricted, make sure things work as you
  expect.

Change-Id: Ic13bc81cf62811a0e5dcb9572240fae685056989
Reviewed-on: https://gerrit.instructure.com/8435
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
2012-02-09 11:14:02 -07:00
Simon Williams 12af0a5d67 observers see all link enrollment grades for course; closes #6441
if an observer is linked to two students in the same course, we want to provide
an option on the grades page to choose which students grades to view, and be
able to switch back and forth between them.  We also want to handle these
multiple links on the course settings users tab.

test plan:
- create a course with > 2 students and 1 observer
- creates > 2 enrollments for the observer, each linked to a different student
- go to the course settings users tab, make sure the multiple links show up and
  you can change/remove/add links as you would expect.
- go to the course grades page. You'll see a dropdown allowing you to choose
  which student's grades to view.

Change-Id: Ia79cb99c0bfd54924d0aee1f8549a4e82121abae
Reviewed-on: https://gerrit.instructure.com/8481
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
2012-02-09 10:17:23 -07:00
Jon Jensen 55bbf9e87a sent filter for conversations, fixes #7012
test plan:
1. click on the sent filter
2. ensure you only see non-archived conversations where you have written
   at least one message
3. ensure that the timestamp and preview on the left reflect your latest
   message (not necessarily the latest in the conversation)
4. ensure the conversations are sorted by the timestamp of your most
   recent message
5. ensure that when you delete the last message by you in a given
   conversation, that conversation is removed from the ui

Change-Id: I85468d19122f1190bd2c53cb640145b7d14e2b42
Reviewed-on: https://gerrit.instructure.com/8416
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
2012-02-08 21:06:26 -07:00
Jon Jensen 3eaffc4859 smarter sorting in recipient finder, fixes #7044
make sorting smarter when searching for users (i.e. not just browsing).
when finding the best matches, order first by the number of common
contexts (descending), then by name, then by id. when we actually
display those 6 best results in the ui though, we still sort according
to the old logic, namely: contexts first, then users alphabetically

test plan:

 * search for some users
 * make sure the ones you see have the most contexts in common with you

Change-Id: I50f7ba5ea4c7021517eda826ae56a52459ef29ac
Reviewed-on: https://gerrit.instructure.com/8558
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
2012-02-08 18:19:01 -07:00
Cody Cutrer 6a5f7f6878 temporary and deleted users have no account associations
fixes #7147

test plan:
 * enable open registration
 * invite a new user to a course
 * that user should not show up in the account's user list
 * finish registering the user
 * the user should now show up in the account's user list

Change-Id: I60790c213671a7c16a52082602725a2468ad2dc4
Reviewed-on: https://gerrit.instructure.com/8502
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
2012-02-08 14:37:17 -07:00
Simon Williams b2587860d4 dedup speedgrader student list (mult. enroll.); fixes #7045
The speedgrader student list was showing students multiple times if they were
enrolled in multiple sections. We only want to show each student once.

test plan
- create a class with an assignment
- create a student with > 1 student enrollment
- go to speedgrader, make sure they only show up once.

Change-Id: I88e55c73fd0a5ca73ba13f27cf0fa94cf63646d9
Reviewed-on: https://gerrit.instructure.com/8373
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2012-02-08 13:59:08 -07:00
Ryan Florence a6a170e203 drag/drop learning outcomes fixes #6720
test case:
1. go to courses/:id/outcomes
2. add a couple groups
3. add a couple outcomes
4. drag and drop to re-order, nest items
5. refresh page, note that everything is how you
   left it

Previously it was using `.find` instead of
`.children`, so it sent the wrong data to the
controller.

Change-Id: I6e98f5ae2f8ace4663d6180c6774e6bd5aad426b
Reviewed-on: https://gerrit.instructure.com/8418
Reviewed-by: Zach Pendleton <zachp@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2012-02-07 14:34:16 -07:00
Brian Palmer 15c94db62b add missing sis_source_id not null scope
refs #7181

just to be safe

Change-Id: I6f182132e87688c171d3b39e07eb903a9190c1a2
Reviewed-on: https://gerrit.instructure.com/8548
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2012-02-06 17:07:16 -07:00
Brian Palmer ccc1458046 remove duplicate sis imported enrollments
prior to b6300298d it was possible to generate multiple enrollments for
the same user+section+type through deleted enrollments. that changeset
included a cleanup migration but it wasn't complete. this completes the
cleanup.

fixes #7181

Change-Id: Ia1630fdfb2714594492b87805089c02645891796
Reviewed-on: https://gerrit.instructure.com/8525
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2012-02-06 14:34:16 -07:00
Jon Jensen 466f0df5b9 always set conversation tags, even if empty, fixes #7178
because the new filter only shows up if all conversations have tags, if
you start a conversation with someone that you share no contexts with,
the conversation filter disappears. this change ensures all conversations
and conversation_participants have initial empty tags (which then get
added to as messages are added)

test plan:
* start a conversation with someone you share no courses with
* reload the page
* ensure the filter dropdown is still there

Change-Id: I535615897fc630a70baceb645d75f20d2f17a5b9
Reviewed-on: https://gerrit.instructure.com/8529
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2012-02-06 14:18:08 -07:00
Simon Williams df068f8b19 conversations rss feed; closes #6828
added a feed of all your conversation messages. each entry has the following
prperties:
- title is the first several words of the message
- author is the person who wrote the message
- content contains the body of the message, a list of any attachments, and
  a line adding context (other participants and shared classes/groups)

test plan:
- go to conversations view
- load the rss feed
- makes sure it contains your messages, attachments, and looks good

Change-Id: I3375dd01285429010b4d75fbea3bf1f7241ddddb
Reviewed-on: https://gerrit.instructure.com/8198
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
2012-02-06 13:27:19 -07:00
Cody Cutrer 1a979ac984 Revert "fix cross-shard-trusted-logins refs #6883"
This reverts commit dc7555022928c944c5c311643215fcd708b62c8c

Change-Id: I3e69b561412802ca01fcb5394f53c297abb3d868
Reviewed-on: https://gerrit.instructure.com/8517
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Zach Wily <zach@instructure.com>
2012-02-06 11:09:47 -07:00
Jon Jensen 705937d111 messaging from scheduler, fixes #6830
adds a "Message Users Who..." option to the appointment group context
menu which spawns a dialog similar to the one found in the gradebook.

adds an api endpoint to get users or groups for a given appointment
group (all eligible, registered, and not-yet registered)

test plan:

1. create an appointment group for users
2. sign up one or more users
3. open the Message Users Who dialog
4. ensure that the right users appear when the registered users option
   is selected
5. send a message and ensure it goes to those users
6. repeat steps 3-5 for unregistered users and all users
7. repeat steps 1-6, but for a section-level appointment group (the
   users should be limited just to those in the section)
8. repeat steps 1-6, but for groups instead of users (e.g. create an
   appointment group for a particular group category, and sign up a
   couple groups)

Change-Id: I3dc74c597d9846afb6a3ffe19e7f6ec09e98e8dc
Reviewed-on: https://gerrit.instructure.com/8447
Reviewed-by: Cameron Matheson <cameron@instructure.com>
Tested-by: Jon Jensen <jon@instructure.com>
2012-02-03 15:09:53 -07:00
Cameron Matheson 0eba4e96e2 allow description to be set on appointment group calendar events
closes #6831

Test-plan:
  - create an appointment group
  - reserve one of the slots as another user
  - change the description of that slot as the teacher
    - make sure that the description changed on the reserved slot also
  - change the description on the appointment group
    - the description should *not* have changed on the slot with the
      custom description (this applies to the reserved slot also)

Change-Id: I39459af6281cdacf1ccd2127d21bcf3076806082
Reviewed-on: https://gerrit.instructure.com/8208
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
2012-02-03 13:00:39 -07:00
Rob Orton e848087895 show student count for unpublished courses
students in unpublished couses do not show
count of students in accounts/:account_id

fixes #5520

test plan
 * create a claimed and active course
 * verify count

Change-Id: Ie15cff79b229f9b3616ef10425541905d385a11b
Reviewed-on: https://gerrit.instructure.com/8123
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
2012-02-03 12:42:41 -07:00
Cody Cutrer 777f8b24f5 allow open registration for delegated authentication fixes #6673
still turn open registration off when you enable delegated
authentication, and display an extra warning by the open registration
checkbox to show them why it's a bad idea

test plan:
 * enable open registration for an account
 * enable cas for the account
 * open registration should be disabled, and have a warning icon
   next to it, but you can still enable it

Change-Id: I65d54c867da5b6afbd7038b5d7ca33e0079c5726
Reviewed-on: https://gerrit.instructure.com/8406
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
2012-02-03 10:01:39 -07:00
Rob Orton e28b1263cb fixes "close for comments" button in discussions past due
closes #7026
refs #5417

tests
 * create a discussion with past due date
 * attempt to lock discussion
 * discussion should be locked
 * create a discussion with future due date
 * attempt to lock discussion
 * discussion should not be locked

Change-Id: Idc35cdbce4a3370c9a9817ae00e92ea2ced786fd
Reviewed-on: https://gerrit.instructure.com/8448
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
2012-02-03 09:32:38 -07:00
Bracken Mosbacker c7969a2368 allow requested_authn_context to be configured on saml auth
Test Plan
 * Try a SAML login with the value set to secure password
 * Try a SAML login with the value set to no value

Change-Id: I72ff456b7ce6a6ff691f9447a7b6684e8793ec16
Reviewed-on: https://gerrit.instructure.com/8350
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
2012-02-02 15:36:05 -07:00
Cameron Matheson 2893d5cdc9 fix uploading zipped assignment submissions
fixes #5462

Test plan:
  - as a teacher, download the submissions of a homework assignment that
    has uploaded submissions
  - reupload the submissions (the uploaded submission should now be
    part of a comment on the students' submission

Change-Id: Ied71a194a9f8eb3425b5d90d4829716dfc417272
Reviewed-on: https://gerrit.instructure.com/7935
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
2012-02-01 17:48:40 -07:00
Jacob Fugal 47ece9b495 date-sensitize enrollment state predicates and completed_at
predicates like Enrollment#completed? should reflect the date-based
state rather than the explicit db state in the majority of cases. same
for completed_at -- it should reflect the date that cause
soft-completion rather than nil if the enrollment is soft-concluded.

fixes #7034

test-plan:
  - create a course with explicit start and end dates
  - enroll an active user in the course
  - change the course end date to the past to soft-conclude the user
  - view the user's roster page; the enrollment should be shown as
    concluded

Change-Id: Ib4d7da99f87c0e1137005f34b863a65a61618c65
Reviewed-on: https://gerrit.instructure.com/8412
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2012-02-01 16:09:26 -07:00
Cody Cutrer 5f63a171b2 address race condition cancelling similar messages fixes #6366
use a single query to do the update to avoid causing errors,
and do it in a transaction with the creation of the new messages
so that another process has a minimal period to sneak in between
the update old and the create new

Change-Id: I80595a1e168221e39bf88c164ed110b3b11fa630
Reviewed-on: https://gerrit.instructure.com/8396
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
2012-02-01 14:05:14 -07:00
Cody Cutrer f61312f485 update account associations when deleting an enrollment
fixes #7061

test plan:
 * add a user to a course
 * delete all pseudonyms from the user
 * delete all enrollments from the user
 * the user should not have any account associations

Change-Id: Iefd82653922b6e2ef3f67426510d29bfeca9026c
Reviewed-on: https://gerrit.instructure.com/8381
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
2012-02-01 14:04:43 -07:00
Jon Jensen bbbbf18995 fix spec timing issues, ensure consistent ordering of comments
added reload calls for mysql (since the usecs get lost), and tacked
id onto the order clause for comment associations (fixes occasional
failures for both mysql and postgres)

test plan:

ensure specs pass

Change-Id: Ibc74a39edc70e9374be4e1bcc1034d65d0bbbf49
Reviewed-on: https://gerrit.instructure.com/8410
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
2012-02-01 14:02:42 -07:00
Jon Jensen 99b3da3856 more general (and slightly faster) fast distinct for postgres
test plan:
ensure error reports work (and still render quickly), and specs pass

Change-Id: I2e47171652cf429be312818070bf4a342689f1d3
Reviewed-on: https://gerrit.instructure.com/8300
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
2012-02-01 14:02:22 -07:00
Brian Palmer d2891cf603 add Attachment#root_account_id
This encapsulates our hacky pattern of using the attachment namespace to
efficiently get at the attachment root account id.

refs #5383

test plan: This is just a refactor. Do a course import of a canvas CC
package, verify the kaltura videos come in ok.

Change-Id: I7984f89dc86ed0903a5974b70354aea15e6d1758
Reviewed-on: https://gerrit.instructure.com/8421
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
2012-02-01 14:01:52 -07:00
Simon Williams a737df9866 allow ignoring learning outcomes for grading; fixes #5271
when you add a learning outcome to a rubric, you can optionally choose to
ignore it when grading. this commit ensures that point totals acutally ignore
the line consistently across the varios places they are displayed, including
when creating the rubric, when grading from the speed grader, and when grading
from the assignment submission page.

test plan:
- create a learning outcome
- create an assignment with a rubric for grading
- make sure the rubric has at least one normal criterion for grading
- include the learning outcome, and choose ignore for grading
- make sure point totals are consistent in the rubric form
- grade the assignment with the speed_grader, make sure point totals are
  consistent.
- modify the grade at /courses/c.id/assignments/a.id/submissions/user.id and
  make sure point totals are still constistant.

Change-Id: I454d73897ee5d4e6413b7c653ffafa1c4ac98e2e
Reviewed-on: https://gerrit.instructure.com/8263
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2012-02-01 13:54:07 -07:00
Cody Cutrer bc48b1ef34 normalize user_id out of notification_policies
fixes #6585, #7096

by normalizing, it's impossible to not maintain a column that isn't
there (yes, triple negative is intended in that sentence), thus
preventing sending notifications to the wrong user after a merge
or any other bugs that would have missing maintaining the
denormalization.

test plan:
 * test notifications in general
 * merge two active users together - their notification preferences
   should survive the merge

Change-Id: I239d810c5499b94550b65128cac71c42cedd11ba
Reviewed-on: https://gerrit.instructure.com/8013
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
2012-02-01 12:42:23 -07:00
Brian Palmer 1d533ef154 don't wait on media object processing when importing a course
Just fire off the kaltura upload jobs in the background, so that the
import can continue. Attachments in the special media_objects export
folder will still be deleted when those uploads complete.

Note we still wait for canvas common cartidge imports, since we need the
completed media object imports in order to translate the rich text
content. We plan to address this limitation later.

test plan:

 * do a course import from a source other than canvas CC, verify that
   the import finishes without waiting on Kaltura.
 * do a course import from a canvas CC package with
   some audio/video. Verify that the import finishes after waiting on
   kaltura, but the attachments in /media_objects are removed as the
   kaltura jobs complete.

fixes #5383

Change-Id: I7dbf12c211fc332fe9d4f16bc4d31fd0656c1941
Reviewed-on: https://gerrit.instructure.com/8031
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
2012-02-01 09:05:23 -07:00
Cody Cutrer b6300298d2 don't duplicate enrollments on sis import if all enrollments are deleted
test plan:
 * import the same deleted enrollment several times; only one should be
   in the db

Change-Id: If067578fc1b42e501e4c43243f9745654b633701
Reviewed-on: https://gerrit.instructure.com/8417
Reviewed-by: Zach Wily <zach@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2012-01-31 22:28:59 -07:00
Bracken Mosbacker 355dbf97d9 find relative pathed files when translating links on assessment questions
sometimes urls to files/images have relative urls instead of
the id of a file. Those should also be attempted to be
translated.

Test Plan:
 * Make an assessment question with both types of urls
 * run translate links on that question
 * The urls should be happy when done

refs #6951

Change-Id: I9d4a526357871ac8ea7e1018df6c39f0dda95060
Reviewed-on: https://gerrit.instructure.com/8196
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2012-01-31 12:13:07 -07:00
Cody Cutrer ed73654089 allow observers to see the observed quiz submissions fixes #6300
test plan:
 * enroll a student, and link an observer
 * as the student, take a quiz
 * as the observer, go to the grade summary page
 * click the quiz
 * you should see the quiz results for the student

Change-Id: Id0bfa2e0c1c0c7f0ce9f21095781251be47d2847
Reviewed-on: https://gerrit.instructure.com/8392
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
2012-01-31 12:03:43 -07:00
Bracken Mosbacker 27f4d24c75 allow importing of multiple module links to same external tool
The importer was incorrectly using the external tool's
migration id as the content tags migration id. This made
it so that links to the same tool just updated the first
tag instead of creating a new one.

Test Plan:
 * Create an external tool
 * Link two module items to it on the modules page
 * Export that course and import it into a different course
 * The imported module should have both items and not just the second one

refs #7017

Change-Id: Iba377b9085607e3503f7f0113a4b9720bf8f0305
Reviewed-on: https://gerrit.instructure.com/8290
Reviewed-by: Brian Whitmer <brian@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2012-01-31 10:19:48 -07:00
Jacob Fugal cf67f3f239 delay MediaObject creation from uploaded files
in some S3 regions uploads are only eventually consistent. this means a
file may not be immediately available for reading after we've finished
uploading it. when an appropriate Attachment is created,
MediaObject.add_media_files is called to tell Kaltura to try and
download the file from S3; given the eventual consistency this download
could fail. so we'll delay the add_media_files call by a configurable
amount to give S3 time to settle. fixes #6787

test-plan:
  - need delayed jobs running
  - record media to kaltura (e.g. discussions); should still work
  - set attachment_build_media_object_delay_seconds to something large,
    such as 300 (5 minutes).
  - record media to kaltura; new media should not be available for 5
    minutes, but should be available shortly after the 5 minutes expire

Change-Id: Ie39a4a32c9819dcd577fb84c3a1e6df60b2b3da0
Reviewed-on: https://gerrit.instructure.com/8298
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2012-01-30 13:24:17 -07:00
Cameron Matheson 1b42bcd1f5 Fix "needs grading" count for assignments
fixes #5968

test plan:
  - create a homework assignment with online text entry (or file upload)
  - as a student, comment on the homework assignment (don't answer it
    though)
  - the teacher should not see a todo item for grading the homework
  - the assignment page should not show a submission needing grading

Change-Id: Ibfd35b41ced27e59d865f42e823a0d9d46d25dac
Reviewed-on: https://gerrit.instructure.com/8273
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
Tested-by: Zach Pendleton <zachp@instructure.com>
2012-01-27 10:09:16 -07:00
Jacob Fugal b97f204b5d variable content-disposition in s3 urls
we use content-disposition to force a filename. but we don't always want
the attachment disposition. split cacheable_s3_url into two explicit
methods (cacheable_s3_download_url and cacheable_s3_inline_url) and use
the one at each call site that matches what the non-s3 code uses. refs #5433

while we're at it, switch to using rails caching (redis, memcache, etc.)
instead of the cached_s3_url db column (dropped, along with
s3_url_cached_at).

test-plan:
  - turn on s3 file storage.
  - put files into s3 then get them out again
  - places a download (vs. inline) is expected, should get a download
    prompt
  - places an inline (vs. download; e.g. speedgrader) is expected,
    should not get a download prompt

Change-Id: I34045279ebcf20f0fb0ba0d215b4fdd182176b24
Reviewed-on: https://gerrit.instructure.com/8220
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2012-01-27 09:14:55 -07:00
Jon Jensen 4f77f047f0 don't show the filter until everything in the scope is filterable
since the data migration will take a long time to run, we don't want to
show the filter dropdown thingy until it can be used. along with that,
we now differentiate between not-yet-tagged (null) and no tags (empty
string).

also tweaked it so we show the computed default tags if the conversation
is not-yet-tagged. this way the transition will be seamless from a ui
point of view (there will never be a period where we don't show common
contexts in the ui)

test plan:
 1. clear out all tags on conversations, conversation_participants, and
    conversation_message_participants
 2. confirm that common contexts still appear in the ui, but the filter
    is not visible
 3. re-run the tag migration
 4. confirm that the filter appears once the migration completes (it
    could appear slightly before it's done ... basically as soon as all
    *your* conversations are tagged)

Change-Id: I6df6b0653bea9d306560917c29ff31625a7b6d93
Reviewed-on: https://gerrit.instructure.com/8340
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
2012-01-26 16:28:37 -07:00
Jon Jensen e3bd30e3a0 better error handling of bad conversation data
Change-Id: Iacf5f7500520553ccb2e88c65ce4bc02e8b33ebb
Reviewed-on: https://gerrit.instructure.com/8329
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
2012-01-26 16:04:26 -07:00