Commit Graph

38 Commits

Author SHA1 Message Date
Jeremy Stanley 61506b602c include role name in sis import prior enrollment search
fixes #CNVS-2516

test plan:
 - create two custom roles based on the same type
 - with a SIS import, try to enroll a user in a course with
   both roles (i.e., two rows in enrollments.csv)
 - make sure both enrollments are created

Change-Id: I09cef8a5dfbcac6e3d7fd5bd6dadbb1cebcab384
Reviewed-on: https://gerrit.instructure.com/16499
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Adam Phillipps <adam@instructure.com>
2013-01-07 09:09:12 -07:00
Jeremy Stanley b87eeb0149 course role support in sis import/export
closes #CNVS-1078
test plan:
 - create custom roles in an account
 - sis import:
   - put the custom role name in the 'role' column in a SIS
     enrollment import, and ensure the role_name is assigned
     in the Enrollment
   - ensure only valid roles can be assigned this way
     (must be defined in the course's account or parent
      account, and must not be inactive)
  - sis export:
   - ensure custom role names are exported in the 'role' column
     of the SIS enrollment export and provisioning reports

Change-Id: Ib8b4c129d451023fa51c73747baadd42cb305338
Reviewed-on: https://gerrit.instructure.com/15868
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Adam Phillipps <adam@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2012-12-10 08:41:20 -07:00
Bracken Mosbacker b6748eb1ed correctly conclude observer enrollment
if an SIS update tried to conclude an observer of a student
who was already concluded, that observer enrollment ended up
duplicated with one concluded enrollment and one active.

Test Plan:
 * Create a student with an observer
 * In an sis update conclude the enrollments with the student's row first
   (you can look at the example in the added spec)
 * Both users should be concluded and only have one enrollment

closes #11050

Change-Id: Iaf63f005397f7b93403e0fd032335bf0a1f364d2
Reviewed-on: https://gerrit.instructure.com/14094
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2012-10-02 13:25:37 -06:00
Jeremy Stanley 3fe0ef63bc clear associated_enrollment between rows; fixes #10652
test plan:
 * create a SIS import that enrolls a student after an observer
 * the student's enrollment should not have an associated user ID

Change-Id: I6b05e1c7cc4a634a77795b5d8ddc7ba269810479
Reviewed-on: https://gerrit.instructure.com/13776
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2012-09-18 11:57:13 -06:00
Cody Cutrer 9573ce76d6 search for xlisted sections when enrolling via CSV fixes #9175
test plan:
 * create two courses via SIS CSV
 * enroll a user in course 1 via SIS CSV by course_id only
 * xlist course 1's default section to course 2
 * enroll another user in course 1 via SIS CSV by course_id only again
 * the user should end up in the xlisted section in course 2

Change-Id: I3a114d70a109594a56915b705de77b87a177e966
Reviewed-on: https://gerrit.instructure.com/12122
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2012-07-11 08:59:07 -06:00
Cody Cutrer 6a5f7f6878 temporary and deleted users have no account associations
fixes #7147

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

Change-Id: I60790c213671a7c16a52082602725a2468ad2dc4
Reviewed-on: https://gerrit.instructure.com/8502
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
2012-02-08 14:37:17 -07:00
Cody Cutrer 8c68fec61a fix sis imported multiple enrollment types and multiple observers in same section
fixes #7117

test plan:
 * import a user as a student and a teacher in the same course
 * import two students, and one observer that is associated with both students

Change-Id: Iab49f6884f84a2e947edb5d5380f8d31b23c5afc
Reviewed-on: https://gerrit.instructure.com/8427
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
2012-02-08 13:06:10 -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
JT Olds 9d4a4944b6 allow sis imports to make things sticky or clear stickiness altogether
* adds ui

Change-Id: Id8f3639457879d23125c0fb04ef5038d91826f21
Reviewed-on: https://gerrit.instructure.com/6050
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
2011-10-13 10:54:58 -06:00
JT Olds 8ac681f201 adding start and end date stickiness
Change-Id: Ifd23b2731725619009884ee56f0c8b1964c6a996
Reviewed-on: https://gerrit.instructure.com/5875
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2011-09-30 11:00:09 -06:00
JT Olds 96312879f5 plumb sis stickiness override option through to the csv importer
refs #5407

Change-Id: I2532160ac519e9618e95043bd9818cf3a18b78db
Reviewed-on: https://gerrit.instructure.com/5874
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
2011-09-30 10:36:06 -06:00
Brian Palmer 3dc8ecc4df don't drop sis rows if transaction timeout is reached
Change-Id: Ib6744eb6410727afbd8b86f55d379d1c126a96db
Reviewed-on: https://gerrit.instructure.com/5830
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: JT Olds <jt@instructure.com>
2011-09-26 23:52:30 -06:00
JT Olds 006cde7157 new generic-format importer classes
notable changes:
 * nothing is processed as a sis-import blocking error now. bad imports now
   result in warnings, while just skipping bad data
 * we no longer check for duplicates before going to the database

Change-Id: Iedc96b29d92caccdc6a71ae1de8100a1c82dd137
Reviewed-on: https://gerrit.instructure.com/5724
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
2011-09-26 11:24:58 -06:00
Cody Cutrer 483786ba7e fix the -and-a-half of precalculated account associations importing enrollments
Change-Id: Ia783d496c34ff3000402108c64eca55b811b94de
Reviewed-on: https://gerrit.instructure.com/5721
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: JT Olds <jt@instructure.com>
2011-09-20 11:21:30 -06:00
Bracken Mosbacker 795d10776f clear whitespace on sis csv imports
Also clear old whitespace that was missed before this fix

closes #5448

Change-Id: I6096685223c43bfec9fd0c669c737af422687e10
Reviewed-on: https://gerrit.instructure.com/5354
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: JT Olds <jt@instructure.com>
2011-08-31 18:26:42 -06:00
Cody Cutrer 563af3816f recognize enrollment csvs with only section_id
Change-Id: I913dae88e3517d9a1dbcece39aa033f8e4affa40
Reviewed-on: https://gerrit.instructure.com/5352
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: JT Olds <jt@instructure.com>
2011-08-31 10:23:12 -06:00
Jacob Fugal 1a761c2d1f explicit utc db times in update_all
update_all's update hash doesn't have any magic performed on bare Time
objects; it assumes any Time object it's given is already in UTC. using
a TimeWithZone object (regardless of timezone), which Fixnum#ago and
friends happen to return, is still fine.

Change-Id: I297b2a3211b896b5225ebcfaaee3c1eb56e55fb6
Reviewed-on: https://gerrit.instructure.com/5351
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
2011-08-30 16:46:25 -06:00
Cody Cutrer 443d925902 add start_date/end_date to enrollment sis imports closes #5408
Change-Id: Ic300cd25ea87210e0cb61d11a433a89bd56dcb3d
Reviewed-on: https://gerrit.instructure.com/5325
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Zach Wily <zach@instructure.com>
2011-08-30 15:45:04 -06:00
Cody Cutrer ba786a4508 statelessly enforce enrollment date restrictions fixes #4996
Change-Id: I978c1524518fd17bbffca73071f7b500ca79c435
Reviewed-on: https://gerrit.instructure.com/5166
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: JT Olds <jt@instructure.com>
2011-08-23 12:23:22 -06:00
Cody Cutrer de92627373 optimize course, section, and xlist sis imports
optimize crosslisting itself:

 * use ids where possible to avoid unnecessarily loading up objects
 * Don't worry about keeping track of if we need to save; we're gonna
   save anyway
 * update account associations on any account change, not just root
   account change (if you re-crosslist a section from one sub-account
   to another sub-account, the users may no longer be associated with
   the first sub-account).

optimize sis imports:

 * really batch up update_account_associations

Change-Id: Ic0fbe1601afcbcd3e6540e69febc2e6a1a94157f
Reviewed-on: https://gerrit.instructure.com/5137
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: JT Olds <jt@instructure.com>
2011-08-19 10:21:56 -06:00
Cody Cutrer 4bb161c9a4 optimize sis enrollment imports
* Attempt to cache the course/section between rows
 * On section change, calculate the new account associations *once*,
   and use the new User#update_account_associations incremental mode
   for strictly new enrollments
 * Keep the account_assocations account_chain cache intact between
   calls
 * Fall back to global update_account_associations if too few
   enrollments in the section, if not a strictly new enrollment, or
   if the user is already going to be globally updated

Change-Id: I884a394aef4f4b81f4472ee3a57f89c1f72ae371
Reviewed-on: https://gerrit.instructure.com/5136
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: JT Olds <jt@instructure.com>
2011-08-19 10:21:49 -06:00
JT Olds 41785a0ea2 support importing enrollments that are enrolled to cross-listed courses
if an enrollment belongs to a course/section pair, and then the section is
crosslisted to another course while the enrollment data stays with the
original course/section pair, the next time that enrollment gets imported
canvas shouldn't bail, but should instead pick the new crosslisted course

Change-Id: Ieb93ab19be6ee620fcf39463fc31db82048f3ea8
Reviewed-on: https://gerrit.instructure.com/5125
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2011-08-17 14:39:31 -06:00
Zach Wily 8d01083315 fix importing active enrollments in courses with date restrictions
Previously we were allowing 'active' to override any term date restrictions.
Now we interpret 'active' to mean 'active excluding any other date-based
restrictions'.

Also fixed a bug that was causing inactive to be treated as active.

Change-Id: Idf435e7b5c129c410f828b6393d7d50fc366fbde
Reviewed-on: https://gerrit.instructure.com/5119
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
2011-08-17 12:26:10 -06:00
Brian Palmer b970f4a650 limit sis import transaction time
Change-Id: Ife4425585bf413f8b4c8d26a42dddff2786e7d1e
Reviewed-on: https://gerrit.instructure.com/4847
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
2011-07-29 08:41:55 -06:00
Brian Palmer 92feb2bcdb replace ActiveRecord::Base calls with subclass calls where it makes sense
This was already a small issue if the job queue was on a different
database driver than the main database, and it'll become more important
as more AR connections are introduced.

Change-Id: I204becadd32bb935df096e8c937a04bb6962f0b2
Reviewed-on: https://gerrit.instructure.com/4601
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2011-07-18 13:56:08 -06:00
JT Olds 38f221a2d4 enrollment importer fix
Change-Id: I044c8c659f6bf546c9834bb939a79c58b81ae6e8
Reviewed-on: https://gerrit.instructure.com/3896
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2011-05-26 16:48:25 -06:00
Cody Cutrer 21f636cb0f use transactions for user and enrollment imports
For "small" imports (<5000 users), this improves wall-clock time
only a bit, but is much much nicer to the db.  The larger the
import, though, the more the improvement here.

Be careful that we only use transactions on things that wouldn't
block other imports running in parallel, or even progress updates
running on the same thread.

Also be smarter about how often we update progress, since that
transaction can have a considerable impact on wall clock time.

refs #3752

Change-Id: I8a79bc530f5433858ccf7d62d33b98ba25e98ffa
Reviewed-on: https://gerrit.instructure.com/3613
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Zach Wily <zach@instructure.com>
Reviewed-by: JT Olds <jt@instructure.com>
2011-05-20 10:39:11 -06:00
Cody Cutrer 12329cc621 avoid several sub-jobs during sis import refs #3752
* Account#update_account_associations during account import
 * Course#update_account_assocations during xlist and section import
 * Course#update_enrolled_users during xlist import
 * Enrollment#recompute_final_score during xlist and section import

Change-Id: Ic97fe0e7ceeb50dcf89e4569d2571a0626f2114d
Reviewed-on: https://gerrit.instructure.com/3609
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
2011-05-16 15:38:07 -06:00
Cody Cutrer 8ac765f6ff avoid saving unchanged enrollments, and batch updating sis_source_id
refs #3752

Change-Id: If282d829a0714e98c31cfccdb94ec0639c063f9b
Reviewed-on: https://gerrit.instructure.com/3566
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: JT Olds <jt@instructure.com>
2011-05-10 10:19:53 -06:00
Cody Cutrer a349d49000 update_all needs an array, not a set
Change-Id: I16c0cd8c44e21af574b8bb5b9c137e791b334688
Reviewed-on: https://gerrit.instructure.com/3551
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
2011-05-09 10:41:28 -06:00
Cody Cutrer c4ade8327d touch courses en-masse
And avoid broadcast_policy callbacks for them
(save_without_broadcasting only affects the object you call it on,
and not everything that gets automatically saved along with it).

Change-Id: Iaeff7c038bfb2516449eaa12c8b87a1256374ca5
Reviewed-on: https://gerrit.instructure.com/3533
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2011-05-09 10:20:50 -06:00
Zach Wily 7beaf4d764 fix update_account_associations job getting created for every imported user
Change-Id: Ia7dc8ca3912510114d88035e264e59ebb54fe086
Reviewed-on: https://gerrit.instructure.com/3446
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2011-05-03 14:26:18 -06:00
Zach Wily 2f3756fc37 optimize account association setup when saving enrollments
First of all, be smarter about when we do it - it's only necessary on new
records or when something in the enrollment changes that could affect account
associations.

Second, during SIS import, gather up each user that will actually need their
associations updated and do it at the end. Normally a user will get several
enrollments during a SIS update and this can reduce the amount of work we do
by a lot.

Change-Id: I2f095dd9e7e148229e52e6b5e8b6624dfe389c31
Reviewed-on: https://gerrit.instructure.com/3200
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2011-04-22 08:40:57 -06:00
Zach Wily dc0d205b89 make sure to get the right section on sis import
Change-Id: Ie08fbaea4babc960bdb3a859b14282eaaf4b27b9
Reviewed-on: https://gerrit.instructure.com/2887
Reviewed-by: Brian Whitmer <brian@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2011-03-30 14:20:44 -06:00
Brian Whitmer 41c9f12988 enforce term/course/section start and end dates
before we were recording these values but not doing
anything about it.  This commit starts scheduling
delayed_jobs to activate/conclude enrollments
in the background when dates pass.

it does not conclude/publish courses/sections
automatically, though.  if we want that to be
automated based on dates then I think we should
do that in a separate commit.

fixes #3356

Change-Id: Id94356fbc5b82196dd041fdb250607a7633cee9f
Reviewed-on: https://gerrit.instructure.com/2431
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
2011-03-01 13:47:12 -07:00
JT Olds 148e66ac68 supporting designer/observer imports and make course_id optional
now one of course_id/section_id is required for enrollments, but not both

Change-Id: I4ebd19ac05988bf3eeffcb846d8bc1fafce73b40
Reviewed-on: https://gerrit.instructure.com/2316
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Reviewed-by: Brian Whitmer <brian@instructure.com>
2011-02-18 13:25:29 -07:00
Brian Whitmer 8035e390f4 add observer role to csv import
and add a new column for linking it to a user

refs #3315

Change-Id: I8333a0530bb2da5557385bf30f45cdd56b5eb261
Reviewed-on: https://gerrit.instructure.com/2266
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
2011-02-16 13:49:18 -07:00
Brian Whitmer 8b8173dcc9 Initial commit.
closes #6988138
2011-01-31 18:57:29 -07:00