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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
* 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>
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>
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>
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>
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>
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>
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>
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>
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>
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>