Commit Graph

30 Commits

Author SHA1 Message Date
Landon Wilkins 242581edd3 da licença part 48
add consistent license headers to all source files

Change-Id: Ib581cddb21430cf4971aeb14980727c2935e31e4
Reviewed-on: https://gerrit.instructure.com/110154
Tested-by: Jenkins
Reviewed-by: Jon Jensen <jon@instructure.com>
Product-Review: Jon Jensen <jon@instructure.com>
QA-Review: Jon Jensen <jon@instructure.com>
2017-04-28 18:59:33 +00:00
Keith Garner 93f14c9e08 fix course section recompute final score to not use singleton
Update CourseSection#move_to_course to not use the recompute singleton
as that is intended for a single student and a course section is
likely multiple users. Also, raise an exception in
Enrollment#recompute_final_score_in_singleton if its called with more
than one user.

fixes CNVS-36089

test plan:
 - Have two courses. In the first course have a section with at least
   60 students.
 - Move the section to the second course.
 - In development mode, inspect the development.log to make sure that
   course.recompute_final_score was called with no errors by finding
   the log message that starts with "GRADES: recomputing scores in"

Change-Id: Id135e4ddc387d8faa513e2759b5e4399f9824275
Reviewed-on: https://gerrit.instructure.com/107322
Reviewed-by: Neil Gupta <ngupta@instructure.com>
Reviewed-by: Spencer Olson <solson@instructure.com>
QA-Review: KC Naegle <knaegle@instructure.com>
Tested-by: Jenkins
Product-Review: Keith T. Garner <kgarner@instructure.com>
2017-04-06 20:51:25 +00:00
Cody Cutrer ce21af8ecf rails 5: find and fix lots of deprecation warnings [ci verbose]
refs CNVS-34843

Change-Id: Idd523c2a7c37325381d590f1ee70c406ace2a459
Reviewed-on: https://gerrit.instructure.com/105033
Tested-by: Jenkins
Reviewed-by: Rob Orton <rob@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2017-03-16 16:03:51 +00:00
Simon Williams 57497719a7 spec: rename the `course` helper to `course_factory`
closes CNVS-34046

test plan: specs should pass

Change-Id: I8684d30e5af7be04566b2d3903db2b7f4b14b24b
Reviewed-on: https://gerrit.instructure.com/98439
Tested-by: Jenkins
Reviewed-by: Landon Wilkins <lwilkins@instructure.com>
Product-Review: Landon Wilkins <lwilkins@instructure.com>
QA-Review: Landon Wilkins <lwilkins@instructure.com>
2016-12-27 20:25:29 +00:00
Simon Williams ece65b5a89 spec: rename the `user` helper to `user_factory`
closes CNVS-34042

test plan: specs should pass

Change-Id: I20709a69f0cb28fb55eba18ca81f89f4d7673b56
Reviewed-on: https://gerrit.instructure.com/98426
Tested-by: Jenkins
Reviewed-by: Landon Wilkins <lwilkins@instructure.com>
Product-Review: Landon Wilkins <lwilkins@instructure.com>
QA-Review: Landon Wilkins <lwilkins@instructure.com>
2016-12-27 20:25:25 +00:00
James Williams 2db2eb3230 invalidate course section enrollment states on crosslist
test plan:
* have a section in a course set to begin in future
* enroll a student in the course
* cross list the section to an active course
* the student should have access

closes #CNVS-31553

Change-Id: I0cdf277c9c2a10f0f3cab06aaafbd1db8b753c29
Reviewed-on: https://gerrit.instructure.com/89722
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2016-09-09 17:28:28 +00:00
James Williams 4b6f17590d allow course sections with rejected enrollments to be deleted
test plan:
* create a course section
* invite a student to the section
* reject the invitation
* should be able to delete the enrollment

closes #CNVS-31092

Change-Id: I71ae19d8cbd923fc77776484487e3eaad94e619c
Reviewed-on: https://gerrit.instructure.com/88429
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Jenkins
QA-Review: Heath Hales <hhales@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2016-08-25 12:39:42 +00:00
Tyler Pickett a74aa80aba Mark enrollments as deleted when their associated section is deleted
Change-Id: If5b0c90e757a5c02b6c6dd43006f7f184ffc3aeb
Fixes: CNVS-11786
Reviewed-on: https://gerrit.instructure.com/61425
Tested-by: Jenkins
Reviewed-by: Jayce Higgins <jhiggins@instructure.com>
QA-Review: Kausty Saxena <kausty@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Tyler Pickett <tpickett@instructure.com>
2015-08-24 19:49:14 +00:00
Michael Nomitch 694c82f1f3 section and override dependent destroy
fixes CNVS-15503

test plan:
  - turn DA on
  - create a course section
  - add an due date for this section and this section only
    on an assignment, graded discussion topic, and quiz
  - destroy this section
  - when you come back to the assignment edit page
    the due date for this section is gone
  - a warning telling the user that
    no students are assigned should exist
    - when you click to add a due date, this
      warning goes away
  - check that the discussion topic & quiz edit
    pages behave similarly

Change-Id: I079a025789f657fa55c66943daac14447ae288a3
Reviewed-on: https://gerrit.instructure.com/45667
Reviewed-by: Simon Williams <simon@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Sean Lewis <slewis@instructure.com>
Product-Review: Hilary Scharton <hilary@instructure.com>
2014-12-17 16:02:39 +00:00
James Williams 81d4adc319 new roles
refactor everything that used to use strings for roles
to use actual role_ids

the apis should be backwards compatible so we don't need
to update (most of) the UI's right away in this commit

test plan:
* regression tests for permissions, role overrides,
 alerts (for account roles), enrolling users,
 adding account admins, etc.

refs #CNVS-15481

Change-Id: Id57fd3104c5c518b6fbf180609950dcddcdd474d
Reviewed-on: https://gerrit.instructure.com/41208
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Steven Shepherd <sshepherd@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2014-10-31 19:44:14 +00:00
Cody Cutrer 912a2cb083 rspec 3-ify spec/models
refs CNVS-16239

Change-Id: I0dc5ac9cb86fbb5dd0335d9e21d77d4a48ecb774
Reviewed-on: https://gerrit.instructure.com/42697
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
2014-10-14 20:10:03 +00:00
Cody Cutrer dacf060160 no more dynamic finders
fixes CNVS-15126

Change-Id: I48b99ff69942463df6d6c355fe6f8a2fc679e69a
Reviewed-on: https://gerrit.instructure.com/41969
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2014-10-03 16:22:49 +00:00
Rob Orton 169a99dd06 spec change find_by_ to where().first in specs
Change-Id: Idc68e5b5bbecd27bef0f4d84e994fb2cd9680a47
Reviewed-on: https://gerrit.instructure.com/41859
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
QA-Review: Rob Orton <rob@instructure.com>
2014-10-01 18:29:36 +00:00
Rob Orton fe8e121ee3 move deleted enrollments when cross listing sections
fixes CNVS-13828

test plan
 - prior to checking out patch set
 - enroll a user in a section
 - delete the enrollment
 - cross list the section
 - attempt to add user to sections new course
 - it should fail
 - checkout patch set and run migration
 - attempt to add user to sections new course
 - it should succeed

 - enroll a user in a section
 - delete the enrollment
 - cross list the section
 - attempt to add user to sections new course
 - it should work (it will restore the old enrollment)

 - enroll a user in a cross listed section
 - delete the enrollment
 - uncross list the section
 - attempt to add the user to the sections current course
 - it should work (it will restore the old enrollment)

Change-Id: Ib397f96b0761d87bf6f9fb11ffc978012f0f5b39
Reviewed-on: https://gerrit.instructure.com/37036
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2014-07-02 18:45:04 +00:00
Jon Jensen fc9161d3f8 spec: once-ler spec/models/{b,c}*
in rails3, reduce runtime by >25% (25.5min -> 18.5min locally)

Change-Id: If2980f721f59fc04cff8d77857bb8554190c1935
Reviewed-on: https://gerrit.instructure.com/37072
Reviewed-by: Dave Donahue <ddonahue@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Jon Jensen <jon@instructure.com>
QA-Review: Jon Jensen <jon@instructure.com>
2014-07-01 16:19:44 +00:00
Nick Cloward eea4718d6b clean up calls to cached_context_grants_right?
refs: CNVS-11425

Change-Id: I0487d98b839d33a339592d312ed8ed2134c4b62e
Reviewed-on: https://gerrit.instructure.com/35528
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2014-06-19 18:10:51 +00:00
Nick Cloward e9595976c1 clean up permission calls for grants_rights?
refs: CNVS-11425

Change-Id: Ia0145e4b4d1da9e0f83a1845647ce203b3586057
Reviewed-on: https://gerrit.instructure.com/34280
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2014-06-19 18:10:30 +00:00
Rob Orton ed12014bdb validate sis_id, section name and drop section_code
fixes CNVS-10147

test plan
 - set sis id, section name to longer than 255 chars
 - should throw rails error
 - should not throw database error

Change-Id: I05ebdf3ae89ace4f737ae6c124f015efceafec1d
Reviewed-on: https://gerrit.instructure.com/27835
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2014-01-02 20:43:52 +00:00
Simon Williams c31375649d fix section :read permission for enrollments without :manage_students
it was false for sections that the user is not enrolled in, even if the user
enrollment 'limit_visibility_to_course_section' is false.

fixes CNVS-6092

test plan:
- turn of :manage_students for TAs on the account
- enroll TAs with and without section-limiting
- use the api to query sections in which the TA is not directly enrolled
- it should obey section-limiting

Change-Id: I28323ec46d2e47c7567e3f3973bd3bbd5b52bceb
Reviewed-on: https://gerrit.instructure.com/21045
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2013-06-27 14:50:46 +00:00
Jeremy Stanley cbe0907fb4 don't disallow deleting a section due to StudentViewEnrollments
fixes CNVS-2623

test plan:
 - create a course
 - create a section
 - use student view
 - delete the empty section
 - it should not give you a snarky message about you can't
   delete a section with enrollments

Change-Id: Ieabf6dfa6c25eed7f637d529cd755490bde5635a
Reviewed-on: https://gerrit.instructure.com/19120
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: James Williams  <jamesw@instructure.com>
QA-Review: Adam Phillipps <adam@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2013-04-02 15:02:58 +00:00
Cody Cutrer db0bf46471 clean up course account associations
closes CNVS-3417

test plan:
 * after the migrations are run, ensure that every section has at
   least one entry in CourseAccountAssociations in the database
 * smoke test SIS imports

Change-Id: I261cad633788efbf4b0c64db34436ef695856fee
Reviewed-on: https://gerrit.instructure.com/17256
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Clare Hetherington <clare@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
2013-02-08 16:33:25 -07: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 f997efd263 re-write update_account_associations for SPEED!
* Manually cache account chains (query cache gets dumped after every
   update or delete)
 * Use batch queries and preloads to make the number of queries
   constant wrt how many users are getting updated
 * Simplify calculation - find the root account ids, and merge the
   account chains together
 * Fix depth to be defined as the minimum depth to reach that account
   (rather than whichever path happened to be processed last)
 * Add incremental mode to only add accounts, rather than re-calculate
   all associations (only for User)
 * Don't auto-create the default section during
   update_account_associations; it costs a query and possibly an
   insert, causes angst with schools that don't want it, etc.
   Instead, always create associations against a 'nil' section so
   that a course has the proper associations.

Change-Id: I7d476d45f41d9c3e382fac9b5c0c0aaa5369b956
Reviewed-on: https://gerrit.instructure.com/5135
Tested-by: Hudson <hudson@instructure.com>
Tested-by: Selenium <selenium@instructure.com>
Reviewed-by: JT Olds <jt@instructure.com>
2011-08-19 10:21:42 -06:00
Zach Wily 4b57641269 make course section test more robust
Change-Id: I561a31749686e7e4ff6ea4947732310fc3216b50
Reviewed-on: https://gerrit.instructure.com/3987
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2011-06-02 09:30:18 -06:00
JT Olds 0282a637a8 don't mark courses deleted due to crosslisting anymore
Change-Id: I563e0be39a3095542ad3225c0ecebeed02df12b4
Reviewed-on: https://gerrit.instructure.com/3676
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Zach Wily <zach@instructure.com>
2011-05-31 13:41:38 -06:00
JT Olds 654bf600cf update course account associations on section save
Change-Id: I97f88e43c489691ab5f63a28e4d0695f6c8096b6
Reviewed-on: https://gerrit.instructure.com/3673
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
2011-05-31 13:02:54 -06:00
JT Olds 9ac67063f0 don't keep track of account_id for crosslisting purposes.
instead, use nonxlist_course for account associations

Change-Id: Id7b41d69b58662a811fad59e5133ea46634976a2
Reviewed-on: https://gerrit.instructure.com/3672
Reviewed-by: JT Olds <jt@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2011-05-24 10:34:53 -06:00
JT Olds 0edbecd027 showing sis id for everyone, deleting courses emptied due to crosslisting
Change-Id: Ic72b72877dcc5ea15e539545945f01a242c6c47b
Reviewed-on: https://gerrit.instructure.com/3207
Reviewed-by: Zach Wily <zach@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2011-04-22 16:47:40 -06:00
JT Olds 33854cbc4b renaming last_course to nonxlist_course and changing crosslisting semantics
Change-Id: I0b017d4506c54151f34c50c28754b6e1c1a46691
Reviewed-on: https://gerrit.instructure.com/3171
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Whitmer <brian@instructure.com>
Reviewed-by: Zach Wily <zach@instructure.com>
2011-04-21 15:43:39 -06:00
JT Olds 6ec333f475 xlist sis importing tests with fixes
Change-Id: Ied4b5fe75984bd399f294041e80935bd86671e0e
Reviewed-on: https://gerrit.instructure.com/3112
Reviewed-by: Zach Wily <zach@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2011-04-15 15:36:18 -06:00