Commit Graph

394 Commits

Author SHA1 Message Date
Cody Cutrer 1bd313db23 drop unused course section columns
test plan:
 * ensure current specs pass, and no functionality changes

Change-Id: I7296f63421eb8041c1f33277244e6b745197e972
Reviewed-on: https://gerrit.instructure.com/11619
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2012-06-18 10:32:01 -06:00
Brian Palmer a6d0ecce93 remove the psql delayed jobs popping function
The performance impact of calling the function in psql 9.x outweighs the
benefits. We may re-introduce this optimization later without the
database function call overhead.

test plan: validate that delayed jobs still work on postgresql, and
don't attempt to call the pop_from_delayed_jobs function.

Change-Id: Ic9d06d87c7481b277feff058b34ee3e06277f316
Reviewed-on: https://gerrit.instructure.com/11147
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
2012-06-12 12:37:34 -06:00
Brian Palmer ba88aa3ad6 jobs index optimizing
add an index that will help with the /jobs ui, monitoring and auditing
queries. and remove failed_at from some conditions, it's no longer used
now that we have a separate failed_jobs table.

Change-Id: Ibb7bb7c2f0dc86c4c527f1c40fc6d7dc19e16494
Reviewed-on: https://gerrit.instructure.com/11454
Reviewed-by: Zach Wily <zach@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2012-06-10 13:05:26 -06:00
Brian Palmer 0e7602df97 don't set a default for the new users.public column
this requires updating every row in the table

Change-Id: Ia9ad0a78bcbd85b306ddfcfadfa673dd91935412
Reviewed-on: https://gerrit.instructure.com/11482
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Brian Palmer <brianp@instructure.com>
2012-06-09 07:10:05 -06:00
Brian Palmer d826f7c5e8 add an index to delayed_jobs (locked_by)
The update query that runs when a worker shuts itself down gracefully
will use this index to avoid the full table scan.

Also tweak the expired job auditor query to use this new index more
effectively.

Change-Id: I57b91d47604c3bc560c3412b129967f55f437199
Reviewed-on: https://gerrit.instructure.com/11427
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Brian Palmer <brianp@instructure.com>
2012-06-07 15:15:30 -06:00
Brian Palmer 9be4a8edea improve cross-shard collection item and activity stream support
Create upvotes in the upvoting user's shard, so we can query for them,
and make the upvote_count and post_count cached counts update properly
cross-shard.

Remove a foreign key constraint that was preventing users on other
shards from posting items to a collection.

Create stream_item_instances on the user's shard, and make sure to query
them from there.

Further work should be done to optimize :include so that we can
efficient pull in the stream items for the instances.

test plan: as a user on one shard, interact with a collection on another
shard -- posting to it, upvoting/downvoting, cloning items from that and
other shards. verify you don't get errors, missing data, or incorrect
counts.

Change-Id: I91aeebd404cd20663a533b2f38c08ec90c65868e
Reviewed-on: https://gerrit.instructure.com/11228
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
2012-06-07 14:31:45 -06:00
Cody Cutrer 84df9232d7 use advisory locks to avoid locking entire DJ table for strands
test plan:
 * stress test jobs; behavior should be unchanged, but load should be
   reduced on jobs db for lots of strands

Change-Id: I0d84369db76d38d927b13c5771c50e1b0b5c77ee
Reviewed-on: https://gerrit.instructure.com/11419
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2012-06-07 14:29:50 -06:00
Jon Jensen b61331effb Merge remote-tracking branch 'origin/master' into dev/fft
Conflicts:
	app/models/group.rb
	spec/selenium/profile_spec.rb

Change-Id: Ifbe09f50e90756a965d532f098f94c700225fc20
2012-06-06 15:14:35 -06:00
Brian Palmer 65b9b40802 collection item column changes
rename the mutable description field to user_comment , and add immutable
title and description fields.

attempt to pull the title and description from embedly, if they're
blank.

add image, audio and video item types, and pull that from embedly as
well.

test plan: from the api, create an item with no description or title,
verify that they are auto-filled (after the background job runs, they
can't be auto-filled in the immediate response unfortunately). verify
that adding an item for a vimeo video sets the item_type to "video", for
example.

Change-Id: Ic485962d11d9fbce0ef0455982d60780d7a06800
Reviewed-on: https://gerrit.instructure.com/11171
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
2012-06-06 14:12:58 -06:00
Simon Williams 3d67154ee1 remove unused group columns
remove type, and the CourseAssignedGroup model which isn't used.
remove groupable_id and groupable_type which looks it could have been
a precursor to groups being a context, and is also not used.

test-plan:
- make sure migration runs
- make sure groups pages still load

Change-Id: I868a8c4d405e20f147de4ee23a33c946dd5691d0
Reviewed-on: https://gerrit.instructure.com/11290
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2012-06-06 12:40:33 -06:00
Jon Jensen 1dac994b2d registration page and signup flows, closes #8676, #8806
test plan:
1. sign up as a teacher
2. sign up as a student with a course code
   1. confirm that you are auto-logged in as soon as you submit valid info
      in the form
3. sign up as a student without a course code
4. sign up as an observer
   1. confirm that you are auto-enrolled in the child's courses
5. test the log in form

Change-Id: I581de48095e85ca869b9ded101fe143ffadb9c9a
Reviewed-on: https://gerrit.instructure.com/11111
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
2012-06-05 21:18:37 -06:00
Cameron Matheson 3aeca18123 Merge branch 'master' into dev/fft
Conflicts:
	app/controllers/groups_controller.rb

Change-Id: If8522f96eeb698cbeada45a49f7f5c61ba15ac84
2012-06-05 13:54:46 -06:00
Brian Palmer 3d4db97231 following models and API, closes #8713
A user can currently follow a Collection, and another User.

Right now following doesn't do anything -- a subsequent commit will add
stream item support for followed Collections.

Also don't scope collection endpoints with /users/X or /groups/Y etc,
except for the index/create actions

test plan: use the api to follow and unfollow users and collections.
verify that you can follow something on a different shard, and it'll
still get returned correctly.

Change-Id: I9fd3f179885327e49f4d220784509de0ea23c0a7
Reviewed-on: https://gerrit.instructure.com/11057
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
2012-06-05 13:11:20 -06:00
Simon Williams 51dd50f233 add avatar_attachment to groups
give groups an avatar, and add a way to set the avatar in the api.

test plan:
- add an image to the group's files (either through api or web)
- use the group api update action to set the avatar
- make sure the resulting object has a valid, non-nil avatar_url

Change-Id: I7db62615e65800fca9caba81c2de67a59bccf5f7
Reviewed-on: https://gerrit.instructure.com/11208
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
2012-06-05 12:54:02 -06:00
Zach Wily 544a0bab97 Merge branch 'master' into dev/fft 2012-06-05 12:34:35 -06:00
Simon Williams 720ee0e549 fix content migration notification datafix
the datafix logic got mistranslated when we switched to run in batches, so that
only 0.2% of NotificationPolicy objects were being considered for deletion.

test plan:
- set your 'For administrative alerts' notification to something other than
  immediate
- run the fix
- do a course export
- you should get an email when it completes/fails
- try this for a few different users

Change-Id: I29f2a0704294ad9e0a055d2a67cc5397f69af8b6
Reviewed-on: https://gerrit.instructure.com/11256
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
2012-06-04 16:23:11 -06:00
Cameron Matheson a58ad2a074 add description field to groups
Change-Id: I7ebea091c63e08f18504cde86bc24d470e3f2fd1
Reviewed-on: https://gerrit.instructure.com/11189
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
2012-06-01 15:21:56 -06:00
Cameron Matheson f3106d4602 Merge branch 'master' into dev/fft
Conflicts:
	app/controllers/collection_items_controller.rb

Change-Id: I1b92415ad1547b0047509743f652cb5c0f8545f2
2012-05-30 11:35:35 -06:00
Brian Palmer ed012e7bca fix race condition in psql jobs popping optimization
Because a volatile function gets its own mvcc view of the data, the
subselect could end up finding and locking a row that doesn't exist for
the outer select, ending up with a row that's locked but not being
worked on.

We've switched gears to return the actual job row from the function,
removing the need for the subselect.

test plan: this race condition is rare, and impossible to reproduce
without dozens of jobs processes hitting the queue, along with many
processes inserting jobs. a regressing test is worthwhile though, making
sure delayed jobs function normally.

Change-Id: I49a8eb062d4e8ceee12283510d62c0ce0087c13c
Reviewed-on: https://gerrit.instructure.com/11069
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Ben Chobot <bench@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
2012-05-29 17:46:30 -06:00
Cody Cutrer f070a4950b add index on courses (sis_source_id)
test plan:
 * run specs

Change-Id: I16aaec14dc95a0d684d8c59f4dcd0df17b1cfbf5
Reviewed-on: https://gerrit.instructure.com/11038
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
2012-05-29 13:12:47 -06:00
Brian Palmer 00df96f738 pull embedly information on item creation
We store off the html preview snippet to return with the api response,
and we prefer the first image embedly returns over a page snapshot, if
no explicit image is given by the user.

test plan: configure embedly. create a collection item pointing to a
service embedly understands -- like a tweet or youtube video. verify the
html_preview is returned with the item once the job finishes running,
and that an appropriate image is pulled from the embedly data rather
than a snapshot capture of the page.

Change-Id: Ifd99053fa3c75833656b773eba6844da5994de9e
Reviewed-on: https://gerrit.instructure.com/10851
Reviewed-by: Simon Williams <simon@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2012-05-29 13:09:39 -06:00
Jon Jensen 31a1893a54 Merge remote-tracking branch 'origin/master' into dev/fft 2012-05-29 13:04:35 -06:00
Brian Palmer f9c5ce198e return a new 640x thumbnail size for collection items
This extends Attachment with support for having multiple thumbnail sizes,
and allow specified sizes to be generated dynamically the first time
that they are requested.

test plan: create two collection items, one with an explicit image_url
and one without. Verify they both get images after the jobs run, and the
images are properly scaled.

Also verify that giving a non-image or invalid image_url ends up with a
nil image_url.

Change-Id: I4d1b1de681f2cddda0c81f1b340d32c3b5b0097b
Reviewed-on: https://gerrit.instructure.com/10822
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
2012-05-29 12:26:57 -06:00
Jon Jensen ef9be1e374 Merge remote-tracking branch 'origin/master' into dev/fft 2012-05-27 23:18:12 -06:00
Brian Whitmer 363fb4c9df add tool_id and icon url to context_external_tools
tool_id can be used to associate multiple context_external_tools
with a single third party tool (i.e. to see how many installs
there are of the youtube tool). When tools are launched Canvas
will also track a custom ganalytics event with this tool id.

icon_url is an attribute that can be set in standard LTI
config that we were ignoring before. In the future this may
be added to the UI when picking external tools.

test plan:
- find an external tool with tool_id and icon configs
  (there are some examples on lti-examples.heroku.com)
- configure an external tool using this xml
- confirm that tool_id and icon_url were correctly set
  (tool.tool_id and tool.settings[:icon_url])

- launch an external tool from within a course
- make sure that nothing breaks

Change-Id: If8d6386e8a919fa70eacd46b4fa6b68ade4b5c7b
Reviewed-on: https://gerrit.instructure.com/10568
Reviewed-by: Brian Whitmer <brian@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2012-05-25 15:49:18 -06:00
Cameron Matheson 5c1aba40c0 Merge branch 'master' into dev/fft 2012-05-24 15:09:21 -06:00
Cameron Matheson 55fe0ed12f add public property to user
Change-Id: Ic84c32aad2d51622db7b99acab9be0601631661c
Reviewed-on: https://gerrit.instructure.com/11005
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2012-05-24 15:06:21 -06:00
Jon Jensen 6aa44c4082 Merge remote-tracking branch 'origin/master' into dev/fft 2012-05-23 13:34:24 -06:00
Jon Jensen 9c4aeea0b1 short self enrollment code support, closes #8587
adds a 6-character self enrollment code. the longer version is still
supported (since links may be in the wild). courses that already have
self enrollment enabled will get a new 6-char code when someone self-
enrolls or goes to the course settings page.

test plan:
1. on the old code, create a course and enable self enrollment
2. save the self enrollment url (for step 6)
3. on this new code, go to the course settings page
4. confirm that you see the new 6-char code in the link
5. confirm that the code was saved on the course (check db or console)
6. as a student, confirm that you can enroll using the old link
7. as a student, confirm that you can enroll using the new link
8. create another course and enable self enrollment
9. as a student, confirm that you can enroll using the new link

Change-Id: I6d549b50febc3dcb596a7c6b882701aa58b5441b
Reviewed-on: https://gerrit.instructure.com/10835
Reviewed-by: Jon Jensen <jon@instructure.com>
Tested-by: Jon Jensen <jon@instructure.com>
2012-05-23 13:33:32 -06:00
Jon Jensen a1844e4414 user co-enrollment backend work, closes #8588
also fixed user merging so that observer enrollments get merged when
merging observed users

test plan:
1. test observer enrollment creation/updating
 1. enroll a student in some courses
 2. create another user
 3. add that user as an observer of the student (via console)
 4. confirm that the user gets enrolled as an observer in the student's
    courses
 5. enroll the student in another course
 6. confirm that the observer is also enrolled
 7. conclude the student's enrollment in a course
 8. confirm that the observer's enrollment is also concluded
2. test observer enrollment consolidation (via user merge)
 1. observe two users in a course
 2. merge the users
 3. confirm that you just have one observer enrollment after the merge
3. test observer enrollment creation (via user merge)
 1. enroll user 1 in course A
 2. enroll user 2 in course B
 3. observe user 1
 4. merge the users (either direction)
 5. confirm that you are now observing the user in both courses

Change-Id: Ic5ab29157ab8fc8dc9e7b32cafebbb1290bd4f6b
Reviewed-on: https://gerrit.instructure.com/10811
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cameron Matheson <cameron@instructure.com>
2012-05-23 12:21:00 -06:00
Cody Cutrer 9d205622c3 lengthen external tools url
test plan;
 * configure an external tool with a url > 255 characters
 * it should not give a page error

Change-Id: Iae622940895e191dd37b53c0f31538198dab8df5
Reviewed-on: https://gerrit.instructure.com/10981
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2012-05-23 10:27:37 -06:00
Ryan Florence af608581dc Merge branch 'master' into fft 2012-05-22 16:21:44 -06:00
Cody Cutrer f9fcbce32a lengthen external_feed_entries.url fixes #8711
test plan:
 * add an rss feed that references urls > 255 characters
 * the entries should show up

Change-Id: Iaf1691593fee5d86a705ac65e5c3686353d88e7d
Reviewed-on: https://gerrit.instructure.com/10935
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2012-05-22 12:06:46 -06:00
Cody Cutrer c571dae189 drop really old unused columns, round 3
Change-Id: I1ef828c0547167e1792aa9edba65b09673504f57
Reviewed-on: https://gerrit.instructure.com/10864
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2012-05-18 15:38:17 -06:00
Cameron Matheson b07c4b760c move current user profile page to profile/edit
also adds a bio field to the user model

Change-Id: I5e4a77a39403a31462dbaeae20a289d5a5f6761c
2012-05-18 09:18:57 -06:00
Simon Williams 51d76cd81e move migration notification cleanup to delayed job; refs #8460
moved the cleanup of obsolete notification policies to a delayed job, and make
the query more friendly by using delete_all instead of destroy_all and deleting
in batches.

test plan:
- run the migration, make sure it still succeeds
- make sure any notification policies for the migration notifications are now
  gone, and all other notification policies remain untouched.

Change-Id: I957839f7f56d9e93351c46eac1a2b551cbf6de35
Reviewed-on: https://gerrit.instructure.com/10765
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2012-05-17 16:59:57 -06:00
Simon Williams 127b9b3302 group model prep for communities; refs #8598
this commit just lays down a bit of ground work for communities. it defines
communities as a protected group category type for accounts which allows
membership in multiple groups. it also generalizes several places where student
organized groups was a special case. it also removes the restriction that
group.is_public always be false. this property will be used for different
visibility levels within communities. finally, it lays some groundwork for
handling group requests/invitations/following.

test plan:
- there should be no functional changes from this commit
- you should be able to run GroupCategory.communities_for(account) at the
  console for an account, and get a category shell for communities for that
  account.

Change-Id: Icff3f0e7fbd4ec3c0a72cdbaa310cbd0e75d0e3e
Reviewed-on: https://gerrit.instructure.com/10780
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2012-05-17 15:19:08 -06:00
Brian Palmer aafb0e247f image support for collection items
In this first phase, we use the image url passed in, or take a snapshot
of the link if no image url is given.

test plan: using the API create a collection item without an image url.
After the job runs, the item will have a image_url returned. Then create
another item passing in an explicit image url and verify that's used
instead.

Change-Id: I2134b0014a3135ef0580461a6321d1adc99c2e9c
Reviewed-on: https://gerrit.instructure.com/10764
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
2012-05-17 12:56:24 -06:00
Cody Cutrer 1474a8e13e use unicode compliant sorting for User#sortable_name (if possible)
fixes #7202

test plan:
 * Use postgres
 * Have pg_collkey installed
 * Add users whose last names are subsets of each other
 * Grade CSV, speedgrader, accounts page, etc. should sort them correctly
   (shorter last name first; case insensitively)

Change-Id: Idec2a9f0e89c4f4479b4fd54136291273ba49ad9
Reviewed-on: https://gerrit.instructure.com/10497
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Mark Ericksen <marke@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
2012-05-15 15:11:21 -06:00
Mark Ericksen 8150cf2528 Data fix migration to recompute unread conversations count. Fixes #8308
Current code that trigger incremental changes to users.unread_conversations_count
 appears to be correct. Believe the problem is a legacy data problem where data was
 incorrect from previous code issues and wasn't fixed previously.

 Test Plan:
 * setup a user with conversations
 * in the database, modify users.unread_conversations_count to be wrong (high or low)
 * run the migration and the conversation count should be corrected

Change-Id: Ibe5c1db2fb494e9800f89e9316f2a9519df77c43
Reviewed-on: https://gerrit.instructure.com/10702
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
2012-05-15 14:52:38 -06:00
Simon Williams 72be6ba687 fix immediate migration notifications
fixes #8460
refs #8318

we already fixed course migration notifications to send immediately, but we
missed content export notifications. also, the previous fix would only work for
users who didn't already have a NotificationPolicy for the migration emails.
this fix also removes those NotificationPolicy objects for existing users.

test-plan:
- make sure you already have a non-immediate notification policy for the
  'Other Administrative Alerts' category. you can do this simply by going
  to the notifications page and hitting save.
- to to courses/:id/content_exports, and perform a course export
- you should get an email when it completes
- perform a course copy
- you should not get any migration/export related emails.

Change-Id: Ie0aaeee1d8d2be4ad30fecf552973fc49e25ee28
Reviewed-on: https://gerrit.instructure.com/10652
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
2012-05-11 13:59:26 -06:00
Brian Palmer 0ec3ed5553 collections models and api
This lays the groundwork for the new collections feature. See the API
documentation for details. There is still some pending tasks before this
is totally ready, see the development board.

test plan: no UI yet, but you can make api calls to add/edit/delete
collections, add/edit/delete items, and upvote items.

Change-Id: I8fa019d428d1aae3ac62b1f34ebe2ac3c77310be
Reviewed-on: https://gerrit.instructure.com/10465
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
2012-05-10 13:38:58 -06:00
Brian Palmer b2befdfd2b optimize delayed job queue pops on psql
Use a db function with a SELECT .. FOR UPDATE clause to avoid lock
contention on the table. The makes popping off the queue a completely
serial process -- but that's what we want here.

note this also defines a maximum (lowest) priority on jobs of 1,000,000
which we didn't have before, any lower priority will now be ignored.
however, the lowest priority we use in the code is 20.

closes #8517

test plan: ensure delayed jobs still function as expected, including
when there are a very large number of jobs in the queue. test with at
least 100,000 jobs.

Change-Id: Ibf0b4ce1d54f9400d7e734f0736c702e67316b76
Reviewed-on: https://gerrit.instructure.com/10618
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
2012-05-10 13:26:41 -06:00
Brian Palmer 840de40085 select for update in the postgresql job delete trigger
we think this will avoid a deadlock condition where an insert takes the
ShareRowExclusiveLock at the wrong moment and deadlocks us inside the
trigger.

test plan: not consistently reproducable without major postgresql
instrumentation. ensure that jobs with a strand function as normal
(running the specs is a good sanity check)

Change-Id: Ib8c8ba972fd3c51ff116776213c936b9d7a48785
Reviewed-on: https://gerrit.instructure.com/10663
Reviewed-by: Zach Wily <zach@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2012-05-10 12:11:53 -06:00
Jon Jensen 994bfeb6c1 fix ungraded counts, fixes #7774
fixes two issue with the ungraded count logic:

1. the submission triggers updated the count regardless of the enrollment
   status (or existence). teachers or people not even in the course could
   cause the count to change (e.g. by taking/previewing a quiz)
2. the enrollment triggers did not factor in the enrollment type. so
   teachers/tas (un)enrolling in the course would cause the count to
   change if they had any submissions (e.g. from a quiz)

test plan:
1. create a quiz with essay questions (so that submissions will need to be
   graded)
2. enroll a student in multiple sections in the course
3. take the quiz as the student
4. take the quiz as the teacher
5. take the quiz as an admin not in the course
6. confirm the ungraded count is just 1
7. unenroll the teacher
8. confirm the ungraded count is still 1
9. unenroll the student
10. confirm the ungraded count is now 0

Change-Id: I11dbf3915d79f9820267469fad8949abfa008e14
Reviewed-on: https://gerrit.instructure.com/10451
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Joe Tanner <joe@instructure.com>
2012-05-08 16:26:05 -06:00
Brian Palmer 5551afebde migration to revert DelayedJobsDeleteTriggerLockForUpdate
The "FOR UPDATE" clause we added triggers a bug in Postgresql 9.0.{0-3},
fixed in 9.0.4. We're backing out the change for now.

we deleted the original migration that added the "FOR UPDATE", this new
migration is just to revert on any environments that had already run
that migration.

Change-Id: I021f64a63d8c401945b47a18409667422b808b76
Reviewed-on: https://gerrit.instructure.com/10569
Reviewed-by: Ben Chobot <bench@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Zach Wily <zach@instructure.com>
2012-05-06 19:01:13 -06:00
Simon Williams 0a3008e9d6 force content migration emails to send immediately; fixes #8318
content migration notifications used to be in a category that forced them to be
sent immediately, but they inadvertently got moved to a category without that
enforcement. now they have their own category that forces sending again.

test plan:
- set your 'For Administrative Alerts' to something other than 'immediately'
- do a content import or export (not course copy)
- you should get an email as soon as the migration succeeds or fails (not in
  a summary at the end of the day/week).

Change-Id: Ifb0eddf586f3e0defc11f6159f48625e7493ccf8
Reviewed-on: https://gerrit.instructure.com/10385
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
2012-05-03 10:35:49 -06:00
Zach Wily 5868bd8b34 allow saml configurations to use the eppn
Schools want to be able to specify a saml attribute used for the user's login
instead of NameId. Usually that will be the EPPN (or the portion before the
@). This adds a Login Attribute settings to the SAML settings page, with
options for NameID (the default and historic behavior), the
eduPersonPrincipalName, and the eduPersonPrincipalName with the domain part
stripped.

test plan:
 * Set up Shibboleth... just kidding. Better to just look at the spec.
   Standing up your own shib instance is a ton of work.

Change-Id: I04e32022b940da4cb82ea5f9a59012eb48de2ab6
Reviewed-on: https://gerrit.instructure.com/10120
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Tested-by: Zach Wily <zach@instructure.com>
2012-04-30 16:26:09 -06:00
Cameron Matheson a2a6579c10 multiple contexts per appointment group
closes #7561

Test plan:
  - create some appointment groups:
    - make one with multiple courses
    - make one with a course, and then add more courses after saving
    - make one restricted to some (not all) sections in a course [1]
    - make one that has students sign up in groups [1]
  - make sure that only students that match the above criteria are able
    to see/reserve those appointment groups

  [1] you can only choose the group-signup option or restrict
      appointment groups to certain sections on creation (these options
      won't be availabe when editing later)

Change-Id: I1cff5fb4ed233882c2061f8fd8a7ba6f2d4959b0
Reviewed-on: https://gerrit.instructure.com/9407
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
2012-04-30 15:30:03 -06:00
Jon Jensen 7285a705b4 fix incorrect conversation tags, fixes #8274
this is similar to #7231, though the root cause is a little different.
users with duplicate concluded enrollments (e.g. two sections in a course)
may have had improperly tagged private conversations. this was because we
weren't uniq'ing User#conversation_context_codes, so it naively assumed
that both users were in those concluded courses in Conversation#
current_context_strings

the data migration is just like the one we ran in #7231, but a little more
broad (in this case, the Conversation#tags are correct, but the
ConversationParticipant#tags are not). refactored migration code and specs
accordingly, and made it a little nicer on the db.

test plan:

1. enroll user A in two sections of course A (may only be possible via SIS
   or console)
2. conclude course A
3. enroll user A and user B in course B
4. start a private conversation between the users (doesn't matter who
   starts it), but be sure to find the recipient by searching, NOT by
   browsing the course
5. ensure that both users only see course B as the tag on the conversation

Change-Id: I3065b827433b33dbb7ff6a4d0d2affa73cc06e37
Reviewed-on: https://gerrit.instructure.com/10340
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
2012-04-30 14:16:35 -06:00
Cameron Matheson 6416844817 allow assigning section-subsets to appointment group
closes #6832

Test plan:
  - in a separate branch (master), create a new appointment group and
    assign it a group category or section
  - switch to this branch and migrate; the appointment group should
    still be assigned to the group or section you chose earlier
  - create a new appointment group and assign it some course sections
  - verify that students in those sections can reserve appointments, but
    not students that do not belong to those sections

Change-Id: I1662374c5e6d2e5e9f7d6b54b0bc91420f150b7a
Reviewed-on: https://gerrit.instructure.com/8765
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
2012-04-27 16:59:40 -06:00
Bracken Mosbacker 98fe5ee5c0 enable assignment properties to be locked
this creates a "plugin" that allows an account to choose
assignment properties that can be locked when a course is
copied

Test Plan:
 * enable the plugin for an account
 * create an assignment and set it to be locked on copy
 * copy the course to another course
 * as an admin of the account you should still be able to edit the assignment
 * as a non-admin teacher of the course you should not be able to edit the frozen properties

refs #7931

Change-Id: I61d5dbfdf10f8f7519f8db06449b14ef5e7b8454
Reviewed-on: https://gerrit.instructure.com/10190
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
2012-04-27 10:41:41 -06:00
Cody Cutrer da62c35ca9 drop some more really old columns
Change-Id: Icd7c3733c7c29234bd2c8e2e61f780104c885fad
Reviewed-on: https://gerrit.instructure.com/10305
Reviewed-by: Ben Chobot <bench@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2012-04-25 11:05:37 -06:00
Brian Palmer ea2e704904 select for update in the postgresql job delete trigger
we think this will avoid a deadlock condition where an insert takes the
ShareRowExclusiveLock at the wrong moment and deadlocks us inside the
trigger.

test plan: not consistently reproducable without major postgresql
instrumentation. ensure that jobs with a strand function as normal
(running the specs is a good sanity check)

Change-Id: I32fcac82dc5264445897a517ed582e17e896a14b
Reviewed-on: https://gerrit.instructure.com/10300
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2012-04-25 10:33:10 -06:00
Jon Jensen 48e1129eda tag a few data migrations as postdeploy
avoid a chicken/egg scenario where the data migrations might be running
broken model code, depending on how far apart the old and new versions of
canvas are

test plan:
1. set up a canvas install on a revision prior to f8caf7d4
2. create some conversations
3. pull the latest code
4. run migrations and ensure that there are no errors

Change-Id: I7013d6ea73d5913e291c44242a6eb1415100ddc7
Reviewed-on: https://gerrit.instructure.com/10267
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2012-04-24 13:13:19 -06:00
Jon Jensen 9d8bbb00a0 make attachment data migration faster and pgbouncer-friendly
also move logic into a separate file, and run it in a delayed job when in
production mode

test plan:
1. confirm the migration runs in postgres/sqlite/mysql
2. confirm the migration spec passes in postgres/sqlite/mysql

Change-Id: I1169e1fdf6d3d9996e7fbad0d2a4ab41662b7ae8
Reviewed-on: https://gerrit.instructure.com/9939
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
2012-04-12 10:29:28 -06:00
Jon Jensen e385e1af29 make migration pgbouncer-friendly, move to delayed job
* wrap temp table population and extraction in a transaction
* rework first conversation_message update to not use the temp table
* move migration into delayed job

test plan:
* run migration on mysql/postgres/sqlite
* ensure there are no errors
* run migration spec on mysql/postgres/sqlite
* ensure there are no errors

Change-Id: Ia6e645ed08dfaf75f9f3438c0968c74222f8e017
Reviewed-on: https://gerrit.instructure.com/9912
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2012-04-09 14:34:17 -06:00
Simon Williams 5c57e0714e allow student view student to upload files; fixes #7938
we tried to get away with the student view student not having a pseudonym, and
it worked until we got to file upload assignments. you need a pseudonym to
upload files, so we have to give the fake student one.

test-plan:
- before downloading, make sure you have a student view student created who
  does not have a pseudonym
- run migration and make sure that student now does have a pseudonym
- make sure a new student view student gets a pseudonym on creation
- submit a file upload assignment while in student view

Change-Id: I1a494c36cebf2b94a74cc9e531ac64b220fbfe36
Reviewed-on: https://gerrit.instructure.com/9785
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2012-04-09 10:47:49 -06:00
Jon Jensen a8dc1c32da filter conversations while masquerading, fixes #7634
start tracking root_account_ids more consistently for messages, and
aggregate them on the conversation. add a scope when masquerading such
that conversations tied to other root accounts are hidden. a masquerader
must have access to all root accounts a conversation belongs to in order
to see it (unless the masquerader is a site admin)

test plan:

1. enroll a user in courses under two different root accounts (let's call
   them accounts A and B)
2. as the user, log in under the account domain for A and send some
   messages
3. log in under the account domain for B and send some messages to
   the existing conversations, as well as to some new recipients
4. set up an account admin with access only to B
5. log in as the admin, and masquerade as the user
6. ensure you can only see conversations created under B (none of the ones
   that are solely A, or both A and B)
7. log in as a site admin, and masquerade as the user
8. ensure you can see conversations from both accounts

Change-Id: I4a26b8b8914fd531103bb92c3d4442de843d9986
Reviewed-on: https://gerrit.instructure.com/9767
Reviewed-by: Jon Jensen <jon@instructure.com>
Tested-by: Jon Jensen <jon@instructure.com>
2012-04-06 13:49:47 -06:00
Jon Jensen a33bc4683e fix conversation merge issue, fixes #7801
fix an issue where private conversations were improperly merged when
merging user accounts (only a problem when it was being merged into an
existing conversation on the target user). this would cause page errors
due to orphaned conversation_participants.

includes a data migration to fix affected conversations.

test plan:
1. on the old code, create three users (A, B, C)
2. start a private conversation between A and B
3. start a private conversation between A and C
4. merge user B into user C
5. confirm that users A and C get a page error when going to conversations
6. upgrade the code and run the migration
7. confirm that conversations load and the merged conversation appears
   correctly
8. on the new code, create three more users, repeat steps 2-4, and confirm
   that conversations load and the merged conversation appears correctly

Change-Id: I50785764ae4376a38824ffa099ff678686ec5023
Reviewed-on: https://gerrit.instructure.com/9847
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
2012-04-05 11:53:50 -06:00
Cody Cutrer fad518c082 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>
2012-04-05 08:54:01 -06:00
Cameron Matheson 038d6fac3c 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>
2012-04-03 15:55:32 -06:00
Jon Jensen 2137fc8c99 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>
2012-04-03 12:09:09 -06:00
Bracken Mosbacker a942ede9c6 convert course copy to use export/import functionality
This adds the ability for ContentMigration to copy courses
by exporting to a content package and then importing that
package. For attachments it just creates a new Attachment
object instead of exporting/importing them.

The course copy API did not change.

The endpoints used by the course copy UI did change and this
commit doesn't allow selective copying, it only has the
option to copy everything. Selective copying will come in
another commit.

There are also various bug fixes for export/import

Test Plan:
 * copy a course through the API
 * copy a course through the Content Imports path
 * copy a course through the Copy Cours button on the course settings page
 * export a course

refs #4645

Change-Id: Ie577329ab7caaea8dfb9359542224a1a2657e167
Reviewed-on: https://gerrit.instructure.com/9742
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
2012-04-02 17:29:01 -06:00
Jon Jensen 506ec04514 save attachments before message creation, fixes #7229
rather than proxy attachments through the conversations controller and
cause a long-running db transaction, we now just send them to the right
place (files controller, s3, whatever), and then create the message. we
now store the attachment in a special folder on the user so that they
can more easily be tracked in the future for quota management.

because we now just store one instance of each attachment, sending a
bulk private message w/ attachments should be a bit less painful.

known regression:
if a user deletes a conversation attachment from their files area, it
deletes if for all recipients. this is essentially the same problem as
tickets #6732 and #7481 where we don't let a "deleted" attachment to
still be viewed via associations with other objects.

test plan:
1. send an attachment on a new conversation and confirm that was sent
   correctly and can be viewed by recipients
2. send an attachment on an existing conversation and confirm that was
   sent correctly and can be viewed by recipients
3. send an attachment on a bulk private conversation and
   1. confirm that was sent correctly and can be viewed by recipients
   2. confirm that only one attachment was actually created, but each
      message in each conversation is linked to it
4. send multiple attachments and confirm that they were sent correctly
   and can be viewed by recipients
5. perform steps 1-4 for both local and s3 uploads

Change-Id: I7cb21c635f98e47163ef81f0c4050346c64faa91
Reviewed-on: https://gerrit.instructure.com/9046
Reviewed-by: Jon Jensen <jon@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2012-04-02 16:39:27 -06:00
Zach Pendleton d536bb8c31 add public_description to course model. fixes #7761
affects: course model, api
test plan:
  * add a course with the api, included a public description;
  * verify that public description field is returned and
    exists on the course in the db.

Change-Id: If2766cf7ba946af5cb8a5cafebaa8209754ec2b3
Reviewed-on: https://gerrit.instructure.com/9723
Tested-by: Cody Cutrer <cody@instructure.com>
Tested-by: Zach Wily <zach@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
2012-04-02 11:40:54 -06:00
Brian Palmer a2818dd9ea optionally include entries not in the view yet in /view response
consumers can use this to update the view client-side and ensure it's
always up-to-date even if the view is behind.

Change-Id: I1ff0cd80a758a113f8881ef74de78cc28e2fa16b
Reviewed-on: https://gerrit.instructure.com/9717
Reviewed-by: Ryan Florence <ryanf@instructure.com>
Reviewed-by: Zach Wily <zach@instructure.com>
Tested-by: Brian Palmer <brianp@instructure.com>
2012-03-30 15:33:54 -06:00
Cody Cutrer d7e3d5e842 refactor ReportSnapshot refs #7721
basically for detailed reports, have a row per account, instead of
stuffing everything into one massive hash with every account

test plan:
 * ensure that the account statistics page still works
 * ensure that the statistics update when the delayed job runs

Change-Id: I2d4c9ff5a86c8df6d82097aa4f0203a0f55ddb2d
Reviewed-on: https://gerrit.instructure.com/9565
Reviewed-by: Simon Williams <simon@instructure.com>
Tested-by: Cody Cutrer <cody@instructure.com>
2012-03-30 09:17:43 -06:00
Brian Palmer 409f78de9a return discussion_type in topics api response
We changed the threaded boolean to a discussion_type string, with
currently two types: 'side_comment' and 'threaded'

test plan: get the list of topics in the api, verify threaded is
returned appropriately.

Change-Id: Id5bfb867329d93fe8be6131e2e7c401f70ced290
Reviewed-on: https://gerrit.instructure.com/9647
Reviewed-by: Zach Wily <zach@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2012-03-28 14:13:09 -06:00
Brian Palmer 64230d2746 fix materialzed view table definition for mysql
mysql always defines a field size limit, and has a default that is too
low for our purposes here, so we need to set an explicit limit

Change-Id: I86509dae04ca4f403dd77ccf45765798b2125ae8
Reviewed-on: https://gerrit.instructure.com/9639
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Ryan Shaw <ryan@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
2012-03-28 08:53:58 -06:00
Brian Palmer 633356893e Revert "exclude deleted discussion entries from read counts; fixes #7741"
This reverts commit 76c1086dca.

Conflicts:

	lib/data_fixup/exclude_deleted_entries_from_unread_count.rb
	spec/migrations/exclude_deleted_entries_from_counts.rb

Change-Id: Ie75780d2fdfa17896e75e80dfd18749cc8eed1c8
Reviewed-on: https://gerrit.instructure.com/9486
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
2012-03-23 14:23:41 -06:00
Brian Palmer c9efb6cc72 materialized view of discussion topics, closes #7567
This is a cached-in-the-db view of the topic view json response, and
serialized arrays of participant ids and entry ids (for determining
unread entries). This is an optimization to make loading topics fast and
avoid a lot of db traffic.

test plan:

The UI for this new API is still under development, so this needs to
be tested via the API. With jobs turned off, hit the discussion view
endpoint and verify the 503 response. Then run the job to generate the
view, and verify the response json. Verify that any change to the
discussion that requires updating the view, properly updates the view.

Change-Id: I1eacace438a75a41b8b85ce6c42bfd042f27d1ea
Reviewed-on: https://gerrit.instructure.com/9443
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
2012-03-23 14:23:11 -06:00
Brian Palmer eddbe97a53 flag topics as threaded, fixes #7792
If a discussion topic is threaded, it'll allow sub-entries to have other
sub-entries as parents. otherwise it'll force sub-entries to always have
a root entry as a parent (restoring the behavior pre-e9edb2a86f

test plan:

Make a side comment in reply to another side comment, reload the page,
and verify it shows your comment. Do the same via the API. There's no UI
yet for marking a discussion as threaded, but you can do it from the
console and then verify that replies to replies are now nested.

Change-Id: I6bddcfa318f36bcbc6ddb03c152ff1fa8fa550b8
Reviewed-on: https://gerrit.instructure.com/9506
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
2012-03-20 16:07:43 -06:00
Simon Williams 76c1086dca exclude deleted discussion entries from read counts; fixes #7741
we were including deleted discussion entries in our default unread counts, but
there was no way to mark these as read from the UI so it looked like the counts
were just off.

test-plan:
- run the migration and make sure existing unread counts look good
- create a discussion, make some entries, and delete some
- as a different user, view that discussion and make sure counts look right

Change-Id: I601fc7e0726a7982a2843b5a8a71cf782e5092eb
Reviewed-on: https://gerrit.instructure.com/9468
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Zach Wily <zach@instructure.com>
2012-03-17 13:40:09 -06:00
Simon Williams 561a3c2058 move ungraded count migration to dj
Change-Id: I8f901d1618686ec98341a594cabf6b71183a89fb
test-plan: n/a
Reviewed-on: https://gerrit.instructure.com/9372
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2012-03-16 13:03:41 -06:00
Brian Palmer 0b570f89f9 remove dead code around page views
Removes unused methods and associations from models, and removes the
PageViewRange model completely, which is no longer used.

test plan:
  * run the specs
  * verify that no active page-view-related functionality was inadvertently removed

Change-Id: I8522d151555db64a0ad2548334ae642f9fefd54e
Reviewed-on: https://gerrit.instructure.com/9324
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
2012-03-15 08:46:51 -06:00
Cody Cutrer 3928851d58 clean up and stop creating duplication notification policies
fixes #5196

test plan:
 * perform an action that causes lots more than
   User.max_messages_per_day notifications to be sent out
 * in the db, there should only be one entry with notification_id
   is null for that communication channel

Change-Id: Ibd1c5f5273b171bd4ebb6252e942e23dac4aa7e3
Reviewed-on: https://gerrit.instructure.com/9260
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2012-03-13 16:22:46 -06:00
Brian Palmer e9edb2a86f model and api work for threaded discussions, refs #7567
Adds support for threaded discussions. The existing API has been updated
to allow posting replies to replies, and returns the whole thread of
sub-replies rather than just first-level side comments. For backwards
compatbility, the sub-replies are returned in a flattened newest-first,
consumers can look at the parent id of each entry to re-build the
nested, threaded structure.

Another commit will add a new API endpoint for retriving the threaded
structure of the conversation in a more efficient and natural format.

test plan: there's no UI for threaded discussions yet, but you can use
the API to post replies to replies, and retrieve threads and verify the
parent_id information.

Change-Id: I7d541d093fbbdb6fc8a18d079b4337515c02a8a4
Reviewed-on: https://gerrit.instructure.com/9121
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
2012-03-09 15:10:05 -07:00
Brian Palmer 518553a628 remove some database columns from long ago
Change-Id: I8340310cb5a4ede0097e92bd1d3691644c3d460c
Reviewed-on: https://gerrit.instructure.com/9196
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
2012-03-06 10:07:57 -07:00
Brian Palmer 1692aca64d run UseAssetUserAccessLastAccess as a delayed job
this table, it is large

test plan: run the migration, verify a job is just created. run the job,
verify it updates null last_access rows as expected.

Change-Id: Id134d6795c8eef76181c20f5e3c0920dd51dda21
Reviewed-on: https://gerrit.instructure.com/9192
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2012-03-06 09:39:09 -07:00
Bracken Mosbacker fb68a31dd1 correctly update quiz submisison when changing grade in gradebook
Before only the Submission was being updated and not the
QuizSubmission. Now the fudge points on the current QS are
updated to reflect the score set in the gradebook.

This prevented modules from progressing if the value was
changed in the gradebook.

Because the score set there should be the absolute score,
if the quiz is set to take the highest a flag is set to
prevent a previously-higher score from being the kept_score

Test Plan:
 * Create a quiz with a question with 5 points and publish it
 * Create a module item to to that quiz that needs 10 points to complete
 * Take the quiz as a student, the module should not unlock
 * As the teacher set the grade to 11 in the gradebook
 * The module item should be unlocked for the student

closes #7331 #4174

Change-Id: I30d92bfe865584b5b526cda36ef336348a647de4
Reviewed-on: https://gerrit.instructure.com/9091
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2012-03-05 11:48:32 -07:00
Brian Palmer 30de1a294e protect against timing out ldap servers, fixes #7461
If an LDAP server times out, log the time of failure to the
AccountAuthorizationConfig, and don't try to connect again until some
time passes.

test plan:
  * set up an account that uses LDAP, point it to localhost port 6767
  * run `nc -l 6767` or some other command to listen on that port, but
    not ever respond
  * attempt to log in on that account, the first log in should hang for
    5 seconds. subsequent logins should skip even trying to talk to
    ldap, until 1 minute passes.
  * change the account authorization config, verify that it tries the
    LDAP server again immediately

Change-Id: Iea5d7c27f72341d16ae370a0f6ad4ec90fb96b74
Reviewed-on: https://gerrit.instructure.com/9116
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Zach Wily <zach@instructure.com>
2012-03-02 14:14:10 -07:00
Simon Williams 69c113d1f0 add pending_review submissions to todo list for grading
quiz submissions that have essay questions are marked as pending_review, but
they have a grade, so the previous trigger was ignoring them when incrementing
the needs_grading counts. this changes increments the counter for
pending_review even if there is already a grade.

test-plan:
- create a quiz with an essay question
- as a student, submit the quiz
- as a teacher, your to do list should indicate that you have a quiz that needs
  grading.

fixes #5326
fixes #7466

Change-Id: I7cf2293bb43df882000902109124810e896e66ad
Reviewed-on: https://gerrit.instructure.com/9095
Reviewed-by: Jon Jensen <jon@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2012-03-02 13:10:22 -07:00
Zach Wily accee8cc6b make zip file processing asynchronous
also fix/enable zip file uploads in group and user contexts -- they were
partially enabled, but broken. This required generalizing
UnzipAttachment to work for any context, not just courses, though that
was mostly just a matter of renaming things.

The zip file uploads in accounts are still not enabled, as the accounts
file section is not implemented yet, though it's referenced in the
routes file.

fixes #5913
fixes #5728
fixes #5463
fixes #5012

test plan:
  * upload a zip file to a course, to a group, and to a user's files. in
    each case, try uploading the zip both through the button in the file
    browser, and by dragging a zip file into the file browser (in a
    capable web browser)

Change-Id: I6c648ef677d2bd61ae41a2b8fe0f89be43d63375
Reviewed-on: https://gerrit.instructure.com/7402
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Zach Wily <zach@instructure.com>
2012-02-29 14:04:53 -07:00
Cody Cutrer 0ce24b5887 remove unused notification categories fixes #7394
also move notifications in "new email messages" to "administrative alerts",
because that's a much better description of them

test plan:
 * go to communication preferences
 * the last one should be "administrative alerts"
 * "Files", "Private message from student", "New email messages",
   and "Context Message" should be nowhere to be found

Change-Id: I8b30d53b8137ab4b17cb436920d87331327e01f9
Reviewed-on: https://gerrit.instructure.com/8996
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
2012-02-27 13:24:50 -07:00
Simon Williams 258e6b36f3 read/unread state + counts for discussions; closes #7173
the backend for tracking read/unread state of discussion entries/topics and
unread counts for discussion topics. the strategy is to assume that an entry is
unread unless there is an an entry in the join table indicating otherwise.

interface:
- DiscussionEntry has #read_state, #read?, and #unread?. You can use these
  either by passing in a user directly, or by setting the current_user
  attribute on the object before calling the method (useful for json). This
  should already be handled for existing controllers.
- DiscussionTopic read_state functionality as above, plus #unread_count. Same
  general idea with current_user as above.
- routes are setup through the api, use PUT to mark read, DELETE to mark
  unread, or rails helpers like course_discussion_topic_mark_read_path

test plan:
- click through discussion pages, and make sure they all still work (no visible
  changes though, this is backend only)
- manually call some of the above methods from the console
- make sure sql for updates is reasonable

Change-Id: I655ab6a69a8cbdf1c7c99a5548b8ed0d7eadba02
Reviewed-on: https://gerrit.instructure.com/8671
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
2012-02-24 13:34:54 -07:00
Jon Jensen 57d3a8238f fix migration error
test plan:
* run migration, it should pass
* run migration spec, it should pass

Change-Id: I024c7b07671212eb42943273d5c361cce516e015
Reviewed-on: https://gerrit.instructure.com/8961
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Zach Wily <zach@instructure.com>
2012-02-24 10:55:24 -07:00
Cody Cutrer 7489de2d5c improve UTF-8 detection migration refs #6035
* use a single DJ instead of a DJ per applicable attachment
 * don't hold a transaction for any length of time
 * do direct updates, instead of through AR, to avoid 7 extra
   queries per update from before_save callbacks

test plan:
 * run the migration; it should run relatively quickly, and not
   have any errors

Change-Id: I6af6f0ddbcedbb69ad6afb3688d94feb32d0f201
Reviewed-on: https://gerrit.instructure.com/8905
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Zach Wily <zach@instructure.com>
2012-02-23 12:35:49 -07:00
Jon Jensen 7dad73d873 correctly merge conversations when merging users, fixes #7246
previously, merging user accounts would result in conversations with
duplicate participants if both users were involved. additionally,
moved private conversations did not get their private hashes updated,
and private conversations between the merged users would lead to page
errors.

this fixes the behavior going forward (merging conversations if
needed) and adds a migration to fix broken conversations.

test plan:
1. create user A, user B and user C
2. create a private conversation between user A and user B
3. create a private conversation between user A and user C
4. create a private conversation between user B and user C
5. create a monologue for user A
6. create a monologue for user B
7. create a group conversation between all three users
8. merge user A into user B
9. confirm that user B now has three conversations:
 1. a monologue containing the messages from 2, 5, and 6
 2. a private conversation with C containing the messages from 3 and 4
 3. a group conversation with just user C
10. confirm that all messages formerly by A now have B as the author
11. confirm that unread counts and message counts are correct

Change-Id: I1afd824ff8ce74430f247d5b4c728937786fa37f
Reviewed-on: https://gerrit.instructure.com/8738
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
2012-02-23 11:00:43 -07:00
Zach Wily ae67b679e6 don't bypass filename escaping in FileInContext; fixes #6912
FileInContext (used by the zip importer) was bypassing the filename= setter
for Attachment, so when using attachment_fu, sanitize_filename was not getting
called on the filename. This resulted in us generating S3 urls with characters
in them like filename[0].txt. That normally worked fine. However, Firefox
would escape those characters when redirected to a URL like that, which would
cause a signature mismatch with S3.

This commit stops bypassing the filename= setter so files uploaded as zip
files and in migrations have escaped filenames. Because of difficulties
testing S3 attachments, the included spec is weak.

This also includes a migration that will rename attachments with []" in their
filenames, and make a copy of the S3 object to match.

There is also an unrelated spec refactor around faking out a portion of the
code about S3.

test plan:
 * Enable S3
 * Create a ZIP file with a file in it with a name like test[0].bin
 * Upload that ZIP file to your files are, choosing to unpack the ZIP contents
 * Verify that you can download the extracted file using firefox
 * Also verify that the attachment's filename is escaped in the db

Change-Id: I54fc0682b64a9e0021b4b41236f8cab168a0e56e
Reviewed-on: https://gerrit.instructure.com/8875
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2012-02-22 21:46:00 -07:00
Cody Cutrer b48b122438 use a meaningful context for confirmation notifications
fixes #5711

also cleans up broadcast policy a bit
 * remove cruft
 * re-organize so that the DSL doesn't become methods on the model
 * add context method to the DSL that becomes asset_context on the
   message
 * only evaluate the policy block once, instead of every time a
   model that has a broadcast policy is saved

test plan:
 * add an e-mail address to a user, and check the "I want to login" checkbox
 * the notification e-mail should link back to the correct domain

Change-Id: I484d07963c86c81f9b0226fd942ef9a71ac5500c
Reviewed-on: https://gerrit.instructure.com/8830
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2012-02-22 14:43:53 -07:00
Simon Williams fba4a32328 improve student group membership state flow; fixes #6948
student group memberships support requested and invited states, but there isn't
currently frontend support for accepting these memberships. students in these
states had an inconsistent group experience. this fix retroactively accepts
these memberships, and causes new memberships in these states to be
auto-accepted. it also tries to be more consistent about showing group
membership counts/members based on accepted memberships.

test plan:
- create a student organized group, inviting some people
- make sure the counts are right.
- refresh the page and make sure the counts match the group members
- make sure the people you are invited are "accepted" in the db

Change-Id: Id0e3f183a99bd4962497388ead6884243938e6fc
Reviewed-on: https://gerrit.instructure.com/8736
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2012-02-22 13:54:12 -07:00
Brian Palmer 6486b9cefe show the correct date/time for the student access report
The report was displaying the AssetUserAccess updated_at, which isn't
always the time of the last access -- #display_name re-saves the record,
for example.

Now AssetUserAccess keeps the last access time in a dedicated
last_access field. Turns out the table already had this column, but it
was unused. So now we're using it.

fixes #6679

test plan:
  * As a student, access some course content -- look at assignments,
    quizzes, pages, the syllabus, etc
  * As a teacher, go to the student roster, select the student, and
    click to view the student access report.
  * Verify that all the last access times are correct (and not just set
    to the current time).

Change-Id: Icef3073e777d191c281a21e8d160ec08201be374
Reviewed-on: https://gerrit.instructure.com/8880
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
2012-02-22 13:50:28 -07:00
Cody Cutrer 9d930665be detect UTF-8 in attachments closes #6035
test plan:
 * upload a text file; on download the headers should indicate
   UTF-8
 * upload an image file as a text file; on download the headers
   should not indicate UTF-8

Change-Id: Id7f26380b9a697a019757a49efc83b86152725cf
Reviewed-on: https://gerrit.instructure.com/6412
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
2012-02-21 14:27:48 -07:00
Cody Cutrer 908871339e clean up old user account associations on deleted/temp users
refs #7147

test plan:
 * find a temporary user in an accounts page
 * run the migration
 * ensure that the temporary user no longer shows up

Change-Id: I4421c8b2177f9398d8b31255ed0b44f656f9ce62
Reviewed-on: https://gerrit.instructure.com/8780
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2012-02-21 13:27:30 -07:00
Zach Pendleton 05cabac7b3 fix creating user with no sis_user_id. fixes #6872
admin can now create user with no sis_user_id without receiving
an error about the sis id already existing.

also includes a migration to set all empty string sis_user_ids to
NULL.

test plan:
  * enable sis imports on an account;
  * as an admin in that account, create a new user, leaving the
    sis id blank;
  * create a second new user, also with a blank sis id;
  * verify that the second user is creating without any errors.

test plan:

Change-Id: Ia247c58e0070a4b02ecc584c18ed20bb5c05dcd3
Reviewed-on: https://gerrit.instructure.com/8665
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
2012-02-20 12:05:25 -07:00
Cody Cutrer 48b179d4ac support marking a migration as non-transactional
test plan:
 * run the migrations against postgres - confirm by looking at logs
   that most migrations run in a transaction, but those modified
   here do not

Change-Id: I4820d982e2ce6abd21bde0c882b3177c3f11984e
Reviewed-on: https://gerrit.instructure.com/8456
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2012-02-17 16:17:22 -07:00
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
Jon Jensen f523eac1ea do data migrations outside of a transaction
Change-Id: I4d43559ddff61f90593f8bb5616c2f1c57932717
Reviewed-on: https://gerrit.instructure.com/8685
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2012-02-14 11:43:27 -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
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
Zach Pendleton 95806983ac shorten migration names to avoid postgres index max-length.
test plan:
  * on an empty postgres database, run rake db:initial_setup
    and ensure that no errors are thrown.

Change-Id: I2a4b43a7fa60bcb8e81c5c578b9dfccd19b38a28
Reviewed-on: https://gerrit.instructure.com/8625
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
2012-02-10 09:11:13 -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
Brian Palmer 286e1e283d remove the unique constraint for a skipped index
This is one of the indexes that was supposed to be created long ago but
was silently skipped because of a too-long name.  We have current data
that breaks this unique constraint. It'll take some time to investigate
and determine the correct course of action, so for now, we're making the
index non-unique.

Change-Id: I3e49a11db3cab49834a4a1d41d4b9effebeab4bf
Reviewed-on: https://gerrit.instructure.com/8613
Reviewed-by: Jon Jensen <jon@instructure.com>
Tested-by: Brian Palmer <brianp@instructure.com>
2012-02-08 16:57:55 -07:00
Jon Jensen 5e34680921 fix submission comment migration, clean up data. fixes #7203
also make view resilient to bad data in the future

test plan:

confirm that the dummy conversation messages go away and that people stop
getting dashboard errors

Change-Id: I2d59bf400f7b5b92debf4a4e0af2de2204878cf8
Reviewed-on: https://gerrit.instructure.com/8578
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2012-02-07 16:08:54 -07:00
Jon Jensen 71a7af2be3 set empty tags for conversations affected by #7178 (refs #7178)
recently created (or resurrected) conversations with no common
contexts (explicit or inferred) did not get the tags set to '',
and this was preventing the course filter from displaying in the
ui

test plan:

ensure that the course filter shows up

Change-Id: I2c332eedab7765a9d8e3bcb2f41cae260e89a611
Reviewed-on: https://gerrit.instructure.com/8542
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
2012-02-07 15:01:10 -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
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
Brian Palmer f436c8f0d4 add indexes that weren't created because of too-long names
also add some code to AR to raise an exception if this happens again,
rather than just log a warning to the log file.

testplan (for all 3 supported dbs):
  * run all the migrations on a new db
    * no error, and check that the indexes in the new migration exist
  * run the new migration on a db that is up to date
    * before running, verify that the indexes in the new migration don't yet exist due to this problem
    * no error, and check that the indexes in the new migration exist

Change-Id: Iaf7ebb31763bf7e5848c26d0daf179a0b31c6625
Reviewed-on: https://gerrit.instructure.com/7162
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
2012-02-01 14:00:31 -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
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
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 1a61b5c4ec migrate labels to stars
test plan:

confirm that a previously labeled conversation is now starred, and that
they save without any errors

Change-Id: I36fab3f0406318fc2dd259c6db4f2da96cde9a48
Reviewed-on: https://gerrit.instructure.com/8330
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
2012-01-26 16:04:40 -07:00
Jon Jensen f8caf7d4a6 true data migration for conversation tags and submission messages
test plan:
ensure the data was migrated

Change-Id: I12ddd6610ac563ab52c0236b8456a8d3bd1c6dd1
Reviewed-on: https://gerrit.instructure.com/8296
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
2012-01-26 09:44:51 -07:00
Jon Jensen 53bd309860 conversation course filters, fixes #6827
implemented generic tags for conversations (and messages), but currently those
only track course/group asset strings. conversations are automatically tagged
with the most relevant courses/groups, i.e.

 1. if a specific course/group is a recipient, it will be added as a tag
 2. if a course can be inferred, it will be added as a tag. this can happen
    several ways:
    * if a user is added by browsing/searching under a course
    * if a synthetic context or section is a recipient (e.g. course_1_students)
    * if a group is a recipient
 3. if there are no explicit or inferred tags, we do the old behavior (tag
    courses/groups that are shared by > 50% of the audience)

some notes:
 1. as was the previous behavior, you can only see tags (courses/groups) that
    you belong to. for example, a teacher could send a message to a student
    group, but the teacher would not see the group as a tag (though the
    students would)
 2. tags can be added as recipients are added (though we still just show <= 2
    in the UI). a private conversation may get new tags if a bare PM is sent
    and a different context can be inferred (see below)
 3. private conversations may have tags removed, since we also track them at
    a message level. the scenario is if you have a bunch of messages from your
    Spanish 101 teacher. the course ends and you then take Spanish 102 from the
    same teacher, and the teacher sends the class a bunch of PMs. if you delete
    the old messages, your view of the conversation will lose the Spanish 101
    tags.

added a course filter dropdown in the ui. currently this is limited to active
enrollments, and only returns courses (no groups)

test plan:

 1. test automatic tagging for new conversations
    * ensure explicit tags work (course as recipient)
    * ensure inferred tags work (e.g. user under a course)
    * ensure default tags work (e.g. send a PM to someone you have a class with)
 2. test automatic tagging for adding recipients (same as above)
 3. test automatic tagging for a new message on a private conversation, i.e.
    1. find a user you share 2+ contexts with
    2. start a private conversation w/ a single inferred tag, ensure that only
       that tag is on the conversation
    3. start another private conversation w/ a different inferred tag (this will
       reuse the existing conversation), ensure it has both tags
 4. test private conversation tag recalculation, i.e. perform test 3, remove a
    message, and ensure there is just one tag again
 5. test conversation filtering in the UI

migration:

there is no traditional migration per se, rather we will run something like:
Conversation.find_each{ |c| c.migrate_context_tags! }

Change-Id: If467c8739ef39a655ef5a528b0da77213130e825
Reviewed-on: https://gerrit.instructure.com/8225
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
2012-01-25 13:51:53 -07:00
Jon Jensen 0b1655e76d conversation messages for submission comments, fixes #5443
this commit makes submission first-class citizens in conversations. this
means that when submission comments are added/deleted, or assignments are
unmuted, conversations and messages will be updated accordingly

the main impacts in the ui are:

1. submissions can be deleted from conversations. if a new comment is
   added, they will reappear
2. submissions factor into the message total for the conversation. each
   submission counts as a single message, even if there are multiple
   comments
3. submission messages affect unread-ness, and are reflected in the
   timestamp and text in the conversation preview

test plan:

1. confirm submissions appear in the appropriate conversations, i.e.
   * submissions with no comments should not appear in any conversations
   * submissions where there are comments but not by instructors:
     * should appear in each instructor's private conversation with the
       submitter
     * should not appear in the submitter's private conversations with
       anyone
   * submissions where there are comments by instructors:
     * should appear in each commenting instructor's private conversation
       with the submitter
     * should appear in submitter's private conversations with each
       commenting instructor
   adding or removing submission comments should update private
   conversations accordingly (e.g. when one teacher comments on a
   submission, it should be removed from the other teachers' private
   conversations with the submitter).
2. for each scenario above where the submission comments are added and
   appear in conversations, ensure that the submission as a whole behaves
   like a single conversation message, i.e.
   * the unread conversations count is incremented and the private
     conversation is marked as unread (if it didn't exist or was already
     read)
   * the latest submission comment and timestamp should be reflected in
     the conversation pane on the left side
   * you can delete the submission from the conversation. if new comments
     are posted on the submission, the submission should reappear in the
     conversation (provided it still matches the criteria in 1.). note
     that submission can not be forwarded to other conversations.
3. submissions should differ from traditional conversation messages in
   that:
   * they should not trigger conversation notifications
   * they should not create/bump conversation stream items. if a
     conversation has non-submission messages, the submission and its
     comments should appear in the stream item, but they should not
     cause it to jump to the top

migration:

existing submissions/comments will be migrated in, but not necessarily
through a traditional rails migration. to bring in those messages, run
the following from the rails console:

 Submission.find_each{ |s| s.create_or_update_conversations!(:migrate) }

Change-Id: I06dcb8728402a6c4c613d445b80432a1f2973b73
Reviewed-on: https://gerrit.instructure.com/8086
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
2012-01-20 15:56:32 -07:00
Brian Palmer edf2e0a43a clean up some unused and inefficient indexes
We optimize one index to leave out null values, and drop a bunch of
indexes that aren't used, or aren't generally used.

Dropping the unused stream_items.user_id column also drops two more
large unused indexes.

test plan: n/a

Change-Id: I3872365151676e5ce0867f7d6826e5a0d4447bbd
Reviewed-on: https://gerrit.instructure.com/8200
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Ben Chobot <bench@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
2012-01-20 13:53:50 -07:00
Zach Wily 179a10ff87 don't send files to users in public courses we shouldn't; fixes #6868
ContentZipper for some reason was allowing fetching all files (as if a
teacher) when user was not specified. This fixes that and requires correct
permissions when zipping up a folder.

It also runs a migration which will delete existing folder zip files for
anonymous users, since those are cached.

test plan:
 * Create a public course and put some files in it.
 * Lock and hide some of those files.
 * Log out and browse to the course files.
 * Choose "download zip file".
 * Verify that the zip file you get only has visible files in it.

Change-Id: Icf5929f7d1dbc4a7f2122337aff9ed6ae003af12
Reviewed-on: https://gerrit.instructure.com/8085
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2012-01-16 10:50:47 -07:00
Cody Cutrer 7e97621462 store sis_batch_id as an integer, not a string
test plan:
 * run the migration
 * redo the migration
 * do a batch mode sis import

Change-Id: I0204256f3825ffe0b4d252bbb83a0604d7a58942
Reviewed-on: https://gerrit.instructure.com/7904
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Reviewed-by: Ben Chobot <bench@instructure.com>
2012-01-11 09:14:36 -07:00
Bracken Mosbacker cc146e1b2e make saml entity use the account's domain
AccountAuthorizationConfigs now require the entity_id to
be set for SAML configs. It will be set to the domain of
the account. For existing SAML configs, the entity_id will
be set to what is in the SAML config file if there is one.

This commit also allows SAML meta data to show up for all
domains even if they're not configured for SAML. This helps
admins set up initial SAML configurations.

Test Plan:
 * Create a saml configuration for an account
 * Look at the metadata, the entity_id should be set to the domain/saml2 and not what is in the saml config file
 * Try loading the meta data for an account with no SAML config. It should load and have the proper entity_id

closes #6713

Change-Id: Ia98543c996285d9b1febd788c3f3ec072b672b12
Reviewed-on: https://gerrit.instructure.com/7967
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2012-01-10 12:45:08 -07:00
Cody Cutrer c2ffd6e973 drop unused sis sticky columns
these are unused since we refactored sis stickiness

test plan: run the migration

Change-Id: Ie898cefa796b2b2391caf780ad5e5481a05ee5c0
Reviewed-on: https://gerrit.instructure.com/7899
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2012-01-10 10:49:55 -07:00
Cody Cutrer f491308163 drop unused user.creation_* columns
test plan: run the migration

Change-Id: I75184edd64ddee384de485c443d4c7eee45cc26f
Reviewed-on: https://gerrit.instructure.com/7895
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
2012-01-10 10:49:49 -07:00
Simon Williams 64d687ec87 handle decimal points in rubrics correctly
allow points in rubric criteria and ratings to have decimal values. in working
with brian, we're operating under the following assumptions:
- round to 2 decimal places
- splitting always gives you a integer by default (you can change it yourself after)
- if there's not room to split with an integer, repeat the low value

test plan
- create a new rubric
- change a criterial value to something with a decimal point
- try setting specific ratings with decimals
- try to split between a large space (ie 10.5 and 0), should be 5
- try to split between a small space (ie 0.5 and 0), should be 0

closes #5355

Change-Id: I17e26fe18dda0847fa59dd40976e4d6f38851287
Reviewed-on: https://gerrit.instructure.com/7882
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Brian Palmer <brianp@instructure.com>
Reviewed-by: Ryan Florence <ryanf@instructure.com>
2012-01-06 16:34:48 -07:00
Cody Cutrer 3686b2d1eb drop unused column accounts.type
test plan: run the migration, then the specs

Change-Id: Idec29c0a9cf43a581e0ca9eae00248599270745c
Reviewed-on: https://gerrit.instructure.com/7896
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
2012-01-06 15:56:23 -07:00
Bracken Mosbacker 1cb590e216 make the migration only send later if production
refs #6718

Change-Id: Ib931b28e4b2ecacba109959d067ede1acea7fddb
Reviewed-on: https://gerrit.instructure.com/7929
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2012-01-06 15:22:00 -07:00
Jon Jensen 80c90587d6 calendar and scheduler apis; refs #3395
Change-Id: I0bafb21630086ff2a99b8b881568bff51afabedc
Reviewed-on: https://gerrit.instructure.com/7823
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
Reviewed-by: Zach Wily <zach@instructure.com>
2012-01-06 12:35:27 -07:00
Bracken Mosbacker fefb81420c migration to fix bad assessment question data
AssessmentQuestions updated after Dec. 22, 2011 lost
their numerical values. This tries to fix them.

Test Plan:
 n/a

refs #6718

Change-Id: Ieca6e1fa9ec2b7ae23b2e3dd7db433e5f98457d7
Reviewed-on: https://gerrit.instructure.com/7785
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Zach Wily <zach@instructure.com>
2012-01-06 12:30:09 -07:00
Cody Cutrer c37a83b4f8 fix existing bad data from the sis_cc bug refs #6707
the bug meant that multiple pseudonyms would point to the same
cc.  with this migration we just remove the pointer from the
pseudonym that doesn't match the the user.  in order to fully
repair the data, the SIS Import will need to be run again

test plan:
 * run the migration, and check that
   SELECT COUNT(*) FROM pseudonyms p INNER JOIN communication_channels cc ON p.sis_communication_channel_id=cc.id WHERE p.user_id<>cc.user_id;
   returns 0.

Change-Id: Idb4c9bed425bb5164ada5b4bda24871a029156e1
Reviewed-on: https://gerrit.instructure.com/7845
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2012-01-05 09:05:37 -07:00
Cody Cutrer 795b372024 don't add items to list if their scope is nil
also remove existing attachments that aren't in a folder from their list

test plan:
 * run specs
 * create sis batches - make sure their position is NULL
 * destroy their associated attachment, the query logs should not indicate
   an UPDATE attachments SET position = position - 1... being executed

Change-Id: I6117c2ade0ef5ec41a3ffeeb13096b9d8473f3f9
Reviewed-on: https://gerrit.instructure.com/7843
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2012-01-04 11:16:50 -07:00
Cody Cutrer 2b2f49d66f search for communication channels case insensitively fixes #6750
test plan:
 * create a user via SIS import with an e-mail address
 * add a different e-mail address to the user
 * re-import the user via SIS, and set their e-mail address
   to the second e-mail you added, but with a different case
 * the user should have a single e-mail address, the one set
   in the second SIS import

Change-Id: Iab6b16e0b37cfb8caac3faa453be570b99621a9e
Reviewed-on: https://gerrit.instructure.com/7784
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
2011-12-30 19:36:29 -07:00
Cody Cutrer e363203c36 better indexes for pseudonyms closes #6193
test plan:
  * run the migration

Change-Id: I24e9895ab35087fdeb607bd3ad4a1fc569e02c1f
Reviewed-on: https://gerrit.instructure.com/7721
Reviewed-by: Ben Chobot <bench@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2011-12-30 10:07:30 -07:00
Zach Pendleton 3ca0c208c9 fix spelling of "privileges" in enrollments.
enrollments previously had attribute
"limit_priveleges_to_course_section," but should
be spelled "privileges." replaced spelling in a
migration and across app.

affects: enrollments model
test plan:
  * run specs

Change-Id: I15dcf9a023ead9bb1aed42abc2d1a7c233610840
Reviewed-on: https://gerrit.instructure.com/7431
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2011-12-19 16:48:42 -07:00
Jon Jensen edd59601ee stricter checks to avoid casting error
test plan:

ensure migration runs correctly. in production this should update ~14k
rows

Change-Id: I623a3fa4fffe6faff069fb44cb2c053a97d3e4c4
Reviewed-on: https://gerrit.instructure.com/7478
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2011-12-14 09:11:29 -07:00
Jon Jensen d1d6143ce7 fix quiz_submission.quiz_points_possible
this column is copied from quiz.points_possible whenever the submission
is updated, thus the type needs to match.

test plan:
confirm that quizzes with fractional points dislay the correct message
when you go to edit fudge points on a submission.

Change-Id: Ib3f2c920ac7392b3c4a4a92a273657fe8dfcbc43
Reviewed-on: https://gerrit.instructure.com/7111
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2011-12-06 09:07:06 -07:00
Zach Pendleton 6d5ddda4c5 correctly update quiz status re: essay questions. fixes #5436
When student submits a quiz with an essay question, it now
displays as ungraded in Speedgrader until the grader reviews/
grades the essay question.

test plan:
1. create a quiz with an essay question;
2. complete the quiz;
3. view the quiz assignment in speedgrader;
4. verify that assignment is marked as "not graded"
   in the student dropdown menu;
5. grade the essay question;
6. verify that the assignment is now marked as "graded"
   in the student dropdown menu.

Change-Id: I67ca56df2ec08380c75aa1ddf64fe8848e2b574d
Reviewed-on: https://gerrit.instructure.com/6619
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
2011-11-29 10:18:25 -07:00
Cody Cutrer 85138859a9 disable open registration for accounts with delegated authentication
refs #5833

delegated authentication means the user has to already have an account
in the delegated auth system in order to log in (without using
canvas_login=1), so even creating them a canvas account won't do them
much good.

test plan:
  change an account to use CAS authentication (doesn't really need to be
  a valid config, since as a site admin user you can still log in), and
  open registration will no longer appear in account settings, and as a
  teacher in the account, you can't invite users that don't already exist

Change-Id: I26cfa8c6eaffd24572e7c16f1d935163b7143d84
Reviewed-on: https://gerrit.instructure.com/7082
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: JT Olds <jt@instructure.com>
2011-11-28 15:52:50 -07:00
Cody Cutrer 23d0a6d8c9 drop sticky_xlists from course_sections
test plan: n/a

Change-Id: I246f5f9bcd955f5f2034fd8c20402e6fa1fea792
Reviewed-on: https://gerrit.instructure.com/7170
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
2011-11-28 14:58:08 -07:00
Cameron Matheson d315baa896 keep root_account_id in sync between course/enrollments
fixes #6142

test plan: Create a course and enroll some students.  Move the course to
  another root account.  The following SQL query should return 0:

    SELECT COUNT(e.id) FROM enrollments e
    INNER JOIN courses c ON e.course_id = c.id
    WHERE e.root_account_id != c.root_account_id

  To test the migration, mess up some of the enrollment
  root_account_ids:

    UPDATE enrollments SET root_account_id = 99

  Before migrating, the SELECT COUNT snippet above should return
  false, after migrating, it should return true.

Change-Id: I9b18dded8a763a8a05f5e631907f77b4e9a1bd49
Reviewed-on: https://gerrit.instructure.com/7081
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
2011-11-28 14:29:58 -07:00
Cody Cutrer 6caf502bb8 drop SisCrossListedSection
it's ancient cruft

test plan: n/a

Change-Id: I20912454e9b35be4a292efff33a5fe2913f0bd09
Reviewed-on: https://gerrit.instructure.com/7169
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: JT Olds <jt@instructure.com>
2011-11-28 14:27:10 -07:00
Jacob Fugal 5e9ae28f13 cleanup links in quiz questions; fixes #6212
find links in quiz questions from courses other than the course the
question's quiz is in; find related assessment question and pull the
corresponding link from there to use instead.

Change-Id: I4dd2f0c279a6263f753ec898dc17e91e62997923
Reviewed-on: https://gerrit.instructure.com/6910
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Zach Wily <zach@instructure.com>
2011-11-22 16:23:44 -07:00
Brian Palmer 4ef50c16d8 make "stay logged in" use a one-time token
closes #6382

Previously, the "stay logged in" cookie just used the authlogic default
implementation, which is the pseudonym persistence_token. This is a
problem, because that persistence_token only ever changes when the
pseudonym password changes, so it's the same everywhere; so if that
cookie is stolen, it's valid for a very long time.

This switches us to one-time-use tokens that expire as soon as the token
logs the user in once. Each user agent also gets a different
one-time-use token.

Change-Id: I4f20cd7759fd74590e82ed55797552e342243d49
testplan:
  * Check that no token is set at all when "stay logged in" isn't
    selected.
  * Check "stay logged in", and verify:
    * That you don't have to login again after restarting your browser,
      but your _normandy_session got reset.
    * That if you save and try to replay using the same
      pseudonym_credentials, they don't work the second time.
    * That a second browser will get a different pseudonym_credentials
      value, and using one token doesn't affect the other.
    * That once the token is used, a new one is generated and set in
      your cookies. Verify this new token works as well.
    * That logging out removes the pseudonym_credentials cookie in your
      browser. And also that manually restoring this cookie still
      doesn't log you in, since it was removed server-side as well.
  * Change your password, and verify that the existing "stay logged in"
    tokens no longer work.
  * Delete your pseudonym, and verify the same.
Reviewed-on: https://gerrit.instructure.com/7093
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Zach Wily <zach@instructure.com>
2011-11-22 10:15:13 -07:00
Jon Jensen ca0c0c43b4 fix performance and correctness of triggers, closes #4471, #5168
fixes the behavior such that we only toggle ungraded assignment counts
related to a particular user when his active enrollments in a given
course go from zero to one and vice versa.

also fixes performance issues in mysql. this required a custom trigger
body. see https://github.com/jenseng/hair_trigger/commit/326a10c for
the related hairtrigger commit to support this

Change-Id: Ie36b3d33ced69321f3a87468ab56480b1378d235
Reviewed-on: https://gerrit.instructure.com/6808
Reviewed-by: Jon Jensen <jon@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2011-11-21 09:06:43 -07:00
Cody Cutrer 081b3d4463 remove_column, not drop_column
Change-Id: I9801854e4123a97053c8264317637839881d76bb
Reviewed-on: https://gerrit.instructure.com/7063
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2011-11-18 13:38:02 -07:00
Bracken Mosbacker ba28a28d16 copy and export/import external tool assignments
External tools weren't copied when copying a course
so that is implemented here as well

test plan:
 Export/Import:
  * Create an external tool assignment
  * export the course
  * import the course into a new course
  * set the secrets on the external tool
  * make sure the assignment works in the new course
 Copy:
  * Copy a course into a new course
	* make sure the assignment works

refs #5892

Change-Id: I4aab8966b53ca2d144fddd71eefd0acbdb7c0bff
Reviewed-on: https://gerrit.instructure.com/6958
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2011-11-15 15:33:20 -07:00
Jacob Fugal a88081100b update submissions with null submission type
when creating submissions during cleanup, if a submission with null
submission type (indicating the assignment was graded or commented on
for that student, despite lack of submission) exists, update it instead
of trying to create a new conflicting submission.

Change-Id: I3fc7a4a1eba4341d8ad6f0551754a92c93082a61
test-plan:
 * create graded discussion
 * have student post in discussion, creating a submission
 * in script/console, remove the submission's submission_type
 * run migration
 * note no new submission, but submission_type on existing submission is
   restored
Reviewed-on: https://gerrit.instructure.com/6978
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2011-11-14 15:50:31 -07:00
Jacob Fugal 23ebfa123e fix migration
fixing ability to run, not effect of running. if you already
successfully ran the migration, you don't need to rerun it. if you
haven't successfully run it, now you can. so it's kosher to fix in
place.

manually tested with full test-plan (i.e. putting migratable data in
place) this time.

Change-Id: I0db5b800a0a08a3865fd7f926c6fe8e833a88cea
test-plan:
  * create graded discussion
  * participate in discussion as student
  * in script/console, delete the corresponding submission
  * run migration
  * verify submission was recreated
Reviewed-on: https://gerrit.instructure.com/6904
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
2011-11-14 12:16:58 -07:00
Jon Jensen 84e766de0d add index on favorites.user_id
Change-Id: I832394907df87eb996b8cb4e6efc3a8f881557aa
Reviewed-on: https://gerrit.instructure.com/6961
Reviewed-by: Ben Chobot <bench@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2011-11-14 10:11:29 -07:00