Commit Graph

2202 Commits

Author SHA1 Message Date
August Thornton a5edb69678 log created_by for temporary enrollment pairings
This change adds two columns to the temporary_enrollment_pairings table.
One for the created_by_id and one for the deleted_by_id. These are
references to the users table. The created_by_id is set when the
temporary_enrollment_pairing is created. The deleted_by_id is set when
the temporary_enrollment_pairing is deleted via API.

closes FOO-4113
flag = temporary_enrollments

test plan:
 • create a temporary_enrollment_pairing via the user interface
   or API, verify the created_by_id is set to the current user

Change-Id: Ic952513be528050154248d4b336673f677fbb09f
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/334840
Migration-Review: Cody Cutrer <cody@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Michael Hulse <michael.hulse@instructure.com>
QA-Review: Michael Hulse <michael.hulse@instructure.com>
Product-Review: Michael Hulse <michael.hulse@instructure.com>
2023-12-11 02:07:43 +00:00
Jackson Howe d1e54d9b50 Support page/discussion/file in AssignmentOverride
closes LF-1037
flag = none

Test plan:
 - Find a WikiPage and create an assignment override with
   `wp.assignment_overrides.create!`
 - Expect to be able to run `wp.assignment_overrides` and
   `ao.wiki_page`
 - Repeat with a DiscussionTopic and an Attachment

Change-Id: I8d01165f8b63947c9d28b1d48c4ee63e4ded174d
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/334845
Migration-Review: Cody Cutrer <cody@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Sarah Gerard <sarah.gerard@instructure.com>
QA-Review: Sarah Gerard <sarah.gerard@instructure.com>
Product-Review: Jackson Howe <jackson.howe@instructure.com>
2023-12-08 20:14:41 +00:00
Spencer Olson 44a2c605f6 rename checkpoint columns on assignments table
flag=discussion_checkpoints
closes VICE-4003

checkpointed -> has_sub_assignments
checkpoint_label -> sub_assignment_tag

Test Plan:
- specs pass

Change-Id: I7a1ef8b35913fdf13ff6b3973dbfaab2606c76d2
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/334515
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Omar Soto-Fortuño <omar.soto@instructure.com>
Product-Review: Omar Soto-Fortuño <omar.soto@instructure.com>
Migration-Review: Cody Cutrer <cody@instructure.com>
Reviewed-by: Chawn Neal <chawn.neal@instructure.com>
2023-12-08 17:06:23 +00:00
Chris Soto c6d8c39bb2 custom status grade override options
this commit adds the ability to hide custom grade statuses from being
applied to submissions and only allow them to be applied to the final
grade override if there is no score.

closes EVAL-3737
flag=custom_gradebook_statuses

test plan:
- Create a new custom status for a course.
- In a rails console run:
  CustomGradeStatus
  .find(id)
  .update(applies_to_submissions: false, allow_final_grade_value: false)
- Go to gradebook and open the submission tray. You should not see the
  custom status radio button in the list of statuses.
- Click on a final grade override and open the tray. You should see the
  custom status radio button in the list of statuses.
- Verify the next steps:
- For a final grade override with null values, you should be able to
  select the custom grade statuses.
- For a final grade override with valid values, you should not be able
  to select the custom grade statuses.
- If the custom status is selected, you should not be able to input
  a final grade override score.
- Head to speed grader and verify that the custom status is not
  available when assigning a status to a submission.

Change-Id: Iba89ab7498b62bd3d187274e44e14e50c807ad9b
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/334717
Reviewed-by: Spencer Olson <solson@instructure.com>
Reviewed-by: Cameron Ray <cameron.ray@instructure.com>
Migration-Review: Isaac Moore <isaac.moore@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Cameron Ray <cameron.ray@instructure.com>
Product-Review: Cameron Ray <cameron.ray@instructure.com>
2023-12-06 21:42:53 +00:00
Cody Cutrer ccbfef7d8d fix root account id calculation for deleted users
refs AE-547

they won't have any user account associations, so grab root account ids
from even active links

Change-Id: Ic1f04152f6e6bd28213d2eb4055d52990a5963bd
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/334687
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
Migration-Review: Jacob Burroughs <jburroughs@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2023-12-06 17:46:55 +00:00
Jacob Burroughs ca7672e400 Ensure messages partitions match the base table
fixes AE-531

Change-Id: Ib6c67986b5224d90d0631226715053d1ac84eda4
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/334526
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Migration-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Jacob Burroughs <jburroughs@instructure.com>
Product-Review: Jacob Burroughs <jburroughs@instructure.com>
2023-12-06 15:53:54 +00:00
Cody Cutrer c32d30f662 bundle update rubocop
[skip-stages=Flakey]
[skip-crystalball]

and apply corrections from new/updated cops:

 * Layout
 * Lint/AmbiguousRange
 * Lint/RedundantSafeNavigation
 * Style/HashEachMethods
 * Style/HashSyntax
 * Style/InverseMethods
 * Style/RedundantLineContinuation
 * Style/RedundantParentheses
 * Style/RedundantReturn
 * Style/SuperWithArgsParentheses
 * Style/SymbolProc

Change-Id: I787e46f5b1c89e0fedebd5452ba74567d66954c1
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/334291
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Aaron Ogata <aogata@instructure.com>
Build-Review: Aaron Ogata <aogata@instructure.com>
Migration-Review: Aaron Ogata <aogata@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2023-12-06 14:25:02 +00:00
Roberto Noguera a081383ba6 Add index for LOR table
closes OUT-6043
flag=none

test plan:

- docker-compose run --rm web bundle exec rake db:migrate
    RAILS_ENV=development
- docker-compose run --rm web bundle exec rake db:migrate
    RAILS_ENV=test
- check the "lor_artifact_id_idx" index exists in the
learning_outcome_results table

Change-Id: I7e5075960afab3f128d5f5ef4223af0e67eadeda
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/333601
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Angela Gomba <angela.gomba@instructure.com>
QA-Review: Wilmer Corrales <wilmer.corrales@instructure.com>
Migration-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Kyle Rosenbaum <krosenbaum@instructure.com>
2023-12-05 17:57:32 +00:00
Paul Gray b30ad3fcf1 Add guid & overlay to LTI Registration
why

A guid is needed to identify a registration in the dynamic registration
modal flow UI before it's actually created. The overlay is needed to
store user edits in a way that the user can restore the defaults easily.

test plan:

1. Run the migration
2. Ensure that the dynamic registration flow still works

flag=lti_dynamic_registration
refs INTEROP-8259

Change-Id: Ic2389fe8a5254ca1823d4f182a2987a1572bbc3b
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/333296
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Migration-Review: Jake Oeding <jake.oeding@instructure.com>
Reviewed-by: Tucker Mcknight <tmcknight@instructure.com>
Product-Review: Tucker Mcknight <tmcknight@instructure.com>
QA-Review: Tucker Mcknight <tmcknight@instructure.com>
2023-11-30 19:55:56 +00:00
Evan Battaglia 3c8babe5b4 Add comments pointing people to BulkToolUpdater
flag=none
Test plan: n/a

Change-Id: Id342baf6a4ca56c4d46e8209c90852b0d5aaafcd
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/333426
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Xander Moffatt <xmoffatt@instructure.com>
Reviewed-by: Rajmund Csehil <rajmund.csehil@instructure.com>
QA-Review: Evan Battaglia <ebattaglia@instructure.com>
Product-Review: Evan Battaglia <ebattaglia@instructure.com>
Migration-Review: Cody Cutrer <cody@instructure.com>
2023-11-28 21:31:55 +00:00
Jeremy Stanley 23bafd0732 add manage_impact permission
test plan:
"Impact - Manage" should appear in account permissions

flag=none
closes FOO-4060

Change-Id: Id9baf994fecbed3a120e6554e11415491899df91
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/333161
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: August Thornton <august@instructure.com>
QA-Review: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
Migration-Review: Cody Cutrer <cody@instructure.com>
2023-11-21 23:53:02 +00:00
Sarah Gerard 9c82c86926 Account for unassign_item in ASV/QSV views
closes LF-681
closes LF-682
flag=differentiated_modules

test plan:
- with the flag on
- have an assignment/quiz with different types of overrides
- the only overrides with unassign_item as true are section
  and ADHOC overrides
- run assignment.assignment_student_visibilities
  or quiz.quiz_student_visibilities with different scenarios
- assignment has an adhoc unassigned override
- assignment has a section unassigned override
- assignment has an assigned adhoc override with an
  unassigned section override (student should still have
  visibility)
- assignment has an unassigned adhoc override with an
  assigned section override (student should not have
  visibility)
- test out including the assignment in a module with
  overrides as well (the module itself should not have
  unassigned overrides)

Change-Id: Ia2e62b3dac069c37c18babc9c5dbae34ca11c52b
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/333103
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Migration-Review: Aaron Ogata <aogata@instructure.com>
Migration-Review: Jackson Howe <jackson.howe@instructure.com>
Product-Review: Sarah Gerard <sarah.gerard@instructure.com>
Reviewed-by: Jackson Howe <jackson.howe@instructure.com>
QA-Review: Jackson Howe <jackson.howe@instructure.com>
2023-11-20 15:16:31 +00:00
Spencer Olson a1b1f2c49e clear rails cache
Note: we will mark this migration as run in production Canvas, and will
manually clear the cache there during low-tide. This commit is to clear
the cache for open source canvas.

closes VICE-3955
flag=discussion_checkpoints

Test Plan:
- Verify that running the migration clears the cache

Change-Id: I2a59d463e41a2275ce9cd82e77b6658697136f0b
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/333172
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Migration-Review: Cody Cutrer <cody@instructure.com>
Reviewed-by: Omar Soto-Fortuño <omar.soto@instructure.com>
Product-Review: Omar Soto-Fortuño <omar.soto@instructure.com>
QA-Review: Spencer Olson <solson@instructure.com>
2023-11-20 14:59:21 +00:00
Chris Soto fe2344a145 add rubric_criterion model & migration
this commit creates the first step in moving the rubric criteria into
their own model & database table.

closes EVAL-3666
flag=enhanced_rubrics

test plan:
- pipeline & tests pass

Change-Id: If101c1daf08b2c2fa9a75ed1db67831439b2590d
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/332800
Reviewed-by: Spencer Olson <solson@instructure.com>
Reviewed-by: Derek Williams <derek.williams@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Migration-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Derek Williams <derek.williams@instructure.com>
Product-Review: Cameron Ray <cameron.ray@instructure.com>
2023-11-17 16:43:46 +00:00
Sarah Gerard 6e6e58d030 Add Module Overrides to ASV/QSV views
closes LF-671
closes LF-672
flag=differentiated_modules

test plan:
- with the flag on
- have a course with multiple assignments/quizzes
  and modules
- for each assignment/quiz, run
  assignment.assignment_student_visibilities
  or quiz.quiz_student_visibilities
- test out different scenarios:
- an assignment that is in a module with an ADHOC override
- an assignment that is in a module with a section override
- an assignment in two modules, one with an override and
  one without (should be visible to everyone)
- an assignment that has an assignment override and a
  module with an override
- for each scenario, ensure that only the users with overrides
  are given visibility, unless there is a module with no
  overrides that contains the assignment.

Change-Id: I9c62c619e3f76456ca5a5eda0a85819d5c84158a
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/332730
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jackson Howe <jackson.howe@instructure.com>
QA-Review: Jackson Howe <jackson.howe@instructure.com>
Migration-Review: Jackson Howe <jackson.howe@instructure.com>
Migration-Review: Isaac Moore <isaac.moore@instructure.com>
Product-Review: Sarah Gerard <sarah.gerard@instructure.com>
2023-11-16 19:36:21 +00:00
Cody Cutrer 016ae41723 lint several more idempotent schema changes in non transactional migrations
and actually enforce the linter (by setting a cutoff date for old migrations)

Change-Id: I50001b479e24b30714c37c331515b186bc089468
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/332721
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
Migration-Review: Cody Cutrer <cody@instructure.com>
2023-11-13 21:39:11 +00:00
Omar Gerardo Soto-Fortuño a73e3d17f0 Add type to assignments
closes VICE-3934
flag=none

test plan:
  - Specs pass.
  - Make sure you can run this migration locally
      by doing bundle exec rails db:migrate
  - Make sure you can rollback this migration locally
      by doing bundle exec rails db:migrate:down VERSION=20231107133109
  - After the migration is run, create assignments
      using new and create and make sure the type is Assignment:
         a1 = Assignment.create
         a2 = Assignment.new
      And verify a1.type and a2.type.
  - Verify that all your current assignments have Assignment as type:
      Assignment.where(type: "Assignment").count == Assignment.count

qa risk: low

Change-Id: Ic1afd53de81d449963ef4d27141c7d04c367264c
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/332282
QA-Review: Spencer Olson <solson@instructure.com>
Reviewed-by: Spencer Olson <solson@instructure.com>
Reviewed-by: Jason Gillett <jason.gillett@instructure.com>
Product-Review: Omar Soto-Fortuño <omar.soto@instructure.com>
Migration-Review: Cody Cutrer <cody@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
2023-11-07 19:55:07 +00:00
Jacob Burroughs cde1c3b604 Fix migration idempotency
Change-Id: Ib7f1ce2ea8be7bc4179569c420c3a172c128b493
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/332284
Reviewed-by: Cody Cutrer <cody@instructure.com>
Migration-Review: Cody Cutrer <cody@instructure.com>
Tested-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Jacob Burroughs <jburroughs@instructure.com>
Product-Review: Jacob Burroughs <jburroughs@instructure.com>
2023-11-07 14:35:00 +00:00
Sarah Gerard c3c6a1b35a Add course overrides to ASV QSV
closes LF-678
closes LF-677
flag=differentiated_modules

test plan:
- run migrations
- with the flag on (if you flipped your flag make sure
  to restart canvas)
- test with both an assignment and quiz
- create a course override for the assignment/quiz
  override = assignment.assignment_overrides.create!
  override.update_attribute(:set_type, "Course")
  override.update_attribute(:set_id, course.id)
- run assignment.assignment_student_visibilities or
  quiz.quiz_student_visibilities
- expect to see all students in the course listed

Change-Id: Icad2a2f67f41273cf89a43db288983eb0218ff3c
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/331992
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jackson Howe <jackson.howe@instructure.com>
QA-Review: Jackson Howe <jackson.howe@instructure.com>
Migration-Review: Jackson Howe <jackson.howe@instructure.com>
Migration-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Sarah Gerard <sarah.gerard@instructure.com>
2023-11-06 18:49:36 +00:00
Cody Cutrer 1d87814fbe include soft-deleted associations when calculating user root_account_ids
closes AE-547

includes backfill datafixup

Change-Id: Ie811d4e693d94a6afd3231ffe0ab5a4773aff176
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/331969
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Aaron Ogata <aogata@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
Migration-Review: Aaron Ogata <aogata@instructure.com>
Migration-Review: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2023-11-06 17:39:37 +00:00
Sarah Gerard 14a8c2a9fa Create duplicate versions of ASV/QSV
In order to allow the changes we'll be making to
the ASV/QSV views to be feature flaged, we want to
create duplicates of both views that will have the
flagged changes. We'll also start keeping track of
the different versions in lib/migration_helpers

closes LF-938
flag=differentiated_modules

test plan:
- run migrations
- in a rails console, with the flag on
  check that AssignmentStudentVisibilities.table_name
  is equal to v2, same with QuizStudentVisibilities
- as of now these views should work exactly the same
  as the current views
- you may need to restart canvas after switching
  the flag on/off

Change-Id: I0a372823a9c7b31a53c76a9ecc205105936e89d7
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/331100
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jackson Howe <jackson.howe@instructure.com>
QA-Review: Jackson Howe <jackson.howe@instructure.com>
Migration-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Sarah Gerard <sarah.gerard@instructure.com>
2023-11-02 19:12:15 +00:00
August Thornton 385b70c6c5 add TemporaryEnrollmentPairing model
closes FOO-3963
closes FOO-3964
flag = temporary_enrollments

test plan:
 • in rails console create a temporary enrollment pairing
    TemporaryEnrollmentPairing.create!(root_account: Account.default)
 • should be created with a default workflow_state of "active"
 • temporary enrollment pairings are soft-deletable
 • they have a one to many association on enrollments to be used for
   tracking the enrollments that were created from the pairing
   during temporary enrollment creation (TempEnrollAssign) modal

Change-Id: I75083d3163af13a609b15d984313f4dc8ec944a8
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/330991
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jason Perry <jason.perry@instructure.com>
Migration-Review: Cody Cutrer <cody@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: August Thornton <august@instructure.com>
2023-10-24 16:52:07 +00:00
Omar Gerardo Soto-Fortuño 176054eaf3 Add reply_to_entry_required_count to DiscussionTopic
closes VICE-3825
flag=discussion_checkpoints

test plan:
  - Specs pass.

qa risk: low

Change-Id: Ibcecf138d734732329bce1ee2ce1f69e1725a345
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/330683
Migration-Review: Aaron Ogata <aogata@instructure.com>
Reviewed-by: Jason Gillett <jason.gillett@instructure.com>
Reviewed-by: Spencer Olson <solson@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Product-Review: Omar Soto-Fortuño <omar.soto@instructure.com>
2023-10-19 20:00:49 +00:00
Jeremy Stanley 4fcb2e38b3 backfill role overrides for temporary enrollments
test plan:
 - create a role that can manage_user_logins
 - run the migration
 - that role should be have the temporary enrollments permissions

flag=temporary_enrollments
closes FOO-3938

Change-Id: Ib62c0e4224246ba1584bbab3768eb467b35123dc
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/330346
Reviewed-by: August Thornton <august@instructure.com>
Migration-Review: Isaac Moore <isaac.moore@instructure.com>
QA-Review: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
2023-10-16 17:33:29 +00:00
Spencer Olson 9cd5e4bc07 create parent/child assignment relationship
closes VICE-3859
flag=discussion_checkpoints

Test Plan:
1. Verify migration can be run and rolled back without issues
2. Verify in a rails console that associations work as intended on
   Assignment model:
   - belongs_to :parent_assignment
   - has_many :checkpoint_assignments
3. Verify in a rails console that associations work as intended on
   DiscussionTopic model:
   - has_many :checkpoint_assignments, through: :assignment
4. Verify in a rails console that you can set a checkpoint_label (string)
   on an assignment.

Change-Id: I259df6989c42a2d5bc2e5bb011142d1ff706d915
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/330016
Migration-Review: Cody Cutrer <cody@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Omar Soto-Fortuño <omar.soto@instructure.com>
Product-Review: Omar Soto-Fortuño <omar.soto@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
2023-10-12 17:04:47 +00:00
Evan Battaglia e97419023a Add index to content_migration (slow LTI expansion)
This will hopefully improve performance for the $Context.id.history
expansion which times out sometimes. This comes from DBA recommendations
in DBA-3999.

Test plan:
- check migration runs
- we can do more tests in beta

refs INTEROP-8258

Change-Id: I6d8aaeb91f846a5ab27f7e9d0b3df452e06bbbc6
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/329982
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Migration-Review: Isaac Moore <isaac.moore@instructure.com>
Reviewed-by: Xander Moffatt <xmoffatt@instructure.com>
QA-Review: Xander Moffatt <xmoffatt@instructure.com>
Product-Review: Evan Battaglia <ebattaglia@instructure.com>
2023-10-11 21:59:56 +00:00
Cody Cutrer ee75c847da bundle update rubocop
Change-Id: I6e4b876b20c72038862ab32294df49950402f899
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/328928
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
Build-Review: Cody Cutrer <cody@instructure.com>
Migration-Review: Cody Cutrer <cody@instructure.com>
2023-09-28 14:54:28 +00:00
Jacob Burroughs dca1218318 Improve garbage collector query performance
Also improve deletion performance by deleting in parallel

Change-Id: I38c13e543f0f962b5361b3a612882bc44067f3eb
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/328121
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Isaac Moore <isaac.moore@instructure.com>
Reviewed-by: Alex Slaughter <aslaughter@instructure.com>
Migration-Review: Isaac Moore <isaac.moore@instructure.com>
QA-Review: Alex Slaughter <aslaughter@instructure.com>
Product-Review: Alex Slaughter <aslaughter@instructure.com>
2023-09-21 20:31:53 +00:00
Tucker McKnight cdab4b61d8 Update associated line item when changing an assignment's due date
fixes INTEROP-8201

flag = none

test plan:
- using the 1.3 test tool, create an LTI 1.3 assignment
- make a note of the ID of the line item that is created
  (might be easiest to do Lti::LineItem.last in a rails console)
- in the Canvas UI, edit the assignment's due date
- call the /api/lti/courses/:course_id/line_items/:line_item_id endpoint
- see that the end_date_time field matches the due date you gave the
  assignment

Change-Id: If94edb3d795860c6746d2367e4799541a43aae8c
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/326864
Reviewed-by: Xander Moffatt <xmoffatt@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Migration-Review: Alex Slaughter <aslaughter@instructure.com>
QA-Review: Xander Moffatt <xmoffatt@instructure.com>
Product-Review: Tucker Mcknight <tmcknight@instructure.com>
2023-09-21 15:32:38 +00:00
Isaac Moore 1dd961fb47 Remove workflow_state from notifications
It appears this is unused, and we only have active notifications anyway.

refs AE-238
flag=none

test plan:
- specs pass

Change-Id: I15e13bc2bee595ade68a68debdf6469d6fc2e559
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/327919
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Migration-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Isaac Moore <isaac.moore@instructure.com>
Product-Review: Isaac Moore <isaac.moore@instructure.com>
2023-09-18 23:38:06 +00:00
Isaac Moore 613c65da4a Defer constraint checking when creating account 0
In newer postgres versions, this migration will fail, because of the
foreign key of `root_account_id` -> `id`. For this reason, we will
defer constraint checking when making this insert.

fixes AE-474
flag=none

test plan:
- with the fix:
  - the migration completes successfully on newer postgres
- without the fix:
  - the migration does not complete successfully on newer postgres

Change-Id: I1ea7b874aea4d3cae979248edafd249675fb4221
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/326597
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Build-Review: Cody Cutrer <cody@instructure.com>
Migration-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Isaac Moore <isaac.moore@instructure.com>
Product-Review: Isaac Moore <isaac.moore@instructure.com>
2023-09-13 20:11:01 +00:00
Jeremy Stanley 8d0a2bbca8 use qualified name for vector type
rather than assuming it's in `public`, in case someone installs
it elsewhere rather than using our own EnableVectorExtension migration

refs ADV-22

Change-Id: I7ee86103cc63a4738076d1df8ec56c6ec51ba82f
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/327503
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Migration-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2023-09-12 22:45:19 +00:00
Jeremy Stanley cac04b454e install vector extension in public schema
in the previous commit in this saga, we found that the extension
was installed in "dba" which was inaccessible to the application

also attempting to drop the extension in `down` would remove it
entirely, which isn't what we want in a sharded environment

refs ADV-22

Change-Id: I0fc7ada77beb87dee6e23d8a20951bb703fc467e
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/327384
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Migration-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2023-09-12 18:02:31 +00:00
Jared Crystal ae086f61d2 backfill NQ tool configs with anonymous_grading variable
closes QUIZ-12096
flag = none

test plan:
 - existing NQ tools receive the anonymous_grading field in the config

Change-Id: I9cdaa81d28cfe27ce81245732a08864404216e61
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/327048
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
QA-Review: Weston Dransfield <wdransfield@instructure.com>
Migration-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Jared Crystal <jcrystal@instructure.com>
2023-09-11 17:09:42 +00:00
Jeremy Stanley c67a94a3d8 smart search: schema-qualify vector type
test plan:
 - predeploys run

flag=smart_search
refs ADV-22

Change-Id: I3c1c303e804307b154cc5ca8dfb4280ea161c601
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/327269
Migration-Review: Isaac Moore <isaac.moore@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jonathan Featherstone <jfeatherstone@instructure.com>
QA-Review: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2023-09-11 15:41:05 +00:00
Jonathan Featherstone 169de2e776 Add initial smart search implementation
still very much a prototype

test plan:
 - install pgvector extension
   (i.e. `brew install pgvector` or your operating system's
    package manager)
 - run db migrations and verify the "vector" extension
   gets enabled
 - set up OpenAI API key via `bin/rails credentials:edit`
   and add
    smart_search:
      openai_api_token: <...>
 - enable the smart_search feature flag in an account
 - in a course under that account, create some wiki pages
   with nontrivial content
 - as a user who can see those pages, using the magnifying
   glass that appears in the global nav, search for things
   (by ideas and concepts rather than just keywords)
 - it should find results

limitations:
 - lots, please refer to the ADV-22 epic for next steps

flag=smart_search
closes ADV-21

Change-Id: I4a6cf4bc98cb144707df156baf143c3f9b70acdf
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/325880
Build-Review: Cody Cutrer <cody@instructure.com>
Migration-Review: Cody Cutrer <cody@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
QA-Review: Zach Pendleton <zachp@instructure.com>
Product-Review: Zach Pendleton <zachp@instructure.com>
2023-09-08 18:52:53 +00:00
Cody Cutrer c8210bee69 use a normal NOT NULL constraint for scores.course_score
it's O(1) to set the column NOT NULL once the check constraint exists

Change-Id: I5b0be774b1dea598d8c3d9a5d271e057e2f117cc
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/327176
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Keith Garner <kgarner@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
Migration-Review: Cody Cutrer <cody@instructure.com>
2023-09-07 23:01:14 +00:00
Cody Cutrer 2039924c66 use helper methods for check constraints on old migrations
not that we really need to change, but it serves as an example for future
migrations

Change-Id: Ie1a1975311c81b0c145c17af46e57e604a01eca5
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/327026
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jackson Howe <jackson.howe@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
Build-Review: Cody Cutrer <cody@instructure.com>
Migration-Review: Cody Cutrer <cody@instructure.com>
2023-09-07 23:01:00 +00:00
Jackson Howe d7756aad50 Add unassign_item to assignment_overrides
A boolean column which defaults to false. Will be used to indicate
that the AssignmentOverride's presence unassigns the item from
the linked set.

closes LF-665
flag = none

Test plan:
 - Run migrations
 - In a rails console, find an Assignment and run:
   `assignment.assignment_overrides.create!`
 - Expect assignment_override.unassign_item? to be false

Change-Id: I61e1bfb46f2a4b5434d439576769be11bdf953aa
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/326726
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Jackson Howe <jackson.howe@instructure.com>
Product-Review: Jackson Howe <jackson.howe@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Migration-Review: Cody Cutrer <cody@instructure.com>
2023-09-06 19:20:09 +00:00
Jackson Howe 0a43833574 Add context_module_id to assignment_override_students
flag = none
closes LF-650

Test plan:
 - Run the migration
 - In a rails console, find a module and run:
   `ao = context_module.assignment_overrides.create!
    ao.assignment_override_students.create!(user: <a student>,
    context_module: context_module)`
 - Expect an AssignmentOverrideStudent to be created with a
   reference to the module and the assignment override
 - In psql, run `\d assignment_override_students` and observe that
   the column is created along with the unique index and foreign key

Change-Id: I36d5d4250df09a67a2a27152bf6abc1c43d9f181
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/326702
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Product-Review: Jackson Howe <jackson.howe@instructure.com>
Reviewed-by: Robin Kuss <rkuss@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Robin Kuss <rkuss@instructure.com>
Migration-Review: Cody Cutrer <cody@instructure.com>
2023-09-06 19:20:01 +00:00
Jackson Howe dc31f3d2f1 Add context_module_id to assignment_overrides
Also updates the check constraint to allow AssignmentOverride to
have an assignment, a quiz, or a module. Changes the original
migration which created this check constraint to a predeploy to
match this migration (so that the 2 migrations are run in
chronological order on fresh databases).

flag = none
closes LF-649

Test plan:
 - Run the migration
 - In a rails console, find a module and run:
   `context_module.assignment_overrides.create!`
 - Expect an AssignmentOverride to be created with a
   context_module_id pointing to the module
 - In psql, run `\d assignment_overrides` and observe that the
   column was created, the index was created, the foreign key
   exists, and the check constraint also checks for a
   context_module_id

Change-Id: I93195e28d082411ac43ed715f8eab5b42bd0094c
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/326620
Reviewed-by: Cody Cutrer <cody@instructure.com>
Migration-Review: Cody Cutrer <cody@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Jackson Howe <jackson.howe@instructure.com>
Product-Review: Jackson Howe <jackson.howe@instructure.com>
2023-09-06 19:19:55 +00:00
Xander Moffatt cc9ad5f774 data fixup: repair LineItems from bad course copy
why:
* a bug in the assignment importer assumed that all migrations were BP
syncs and caused a NoMethodError on nil, which skipped the rest of
the importer
* this meant that the default line item for each assignment never got
updated with the correct data from the source assignment's line item,
and subsequent line items were never created

refs LF-467
closes INTEROP-8168
flag=none

test plan:
* reproducing the bug now that it's been patched involves changing
some code in app/models/importers/assignment_importer.rb:
  * replace line 510 with `if true`
  * remove the safe access modifier `&.` from
  `migration.master_course_subscription&.content_tag_for` on line 554
* in a course with the 1.3 test tool installed, create an assignment
for the 1.3 test tool
  * pass back some values for the resourceId, tag, scoreMaximum, and
  label (or modify the Lti::LineItem in a rails console after creation)
* modify the assignment in a rails console to have "been updated" during
the period in which this bug was present in prod (7/5 - 7/10)
  * `assignment.update!(updated_at: Date.parse("2023-07-06"))`
* create a new course and import the first course to it
* the created Lti::LineItem for the new assignment in the new course
should not have the same values for resource_id, tag, score_maximum,
and label
* in a rails console, run the data fixup and reload the affected
Lti::LineItem:
```
DataFixup::RepairLineItemsFromBrokenContentMigrations.run(1)
```
  * alternately, run migrations if you haven't already
* the affected Lti::LineItem should now have the same values as its
source line item

Change-Id: I6d64a3cccf768fb54bda62180bf5dc1c06fa5223
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/322632
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Mysti Lilla <mysti@instructure.com>
QA-Review: Mysti Lilla <mysti@instructure.com>
Migration-Review: Aaron Ogata <aogata@instructure.com>
Product-Review: Luis Oliveira <luis.oliveira@instructure.com>
2023-08-29 23:43:18 +00:00
Jacob Burroughs efaac42207 Greatly improve attachment garbage collector performance
refs AE-441

Change-Id: If0b0cbc8a684020780e0d66d0d955b911d57fec5
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/325931
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Alex Slaughter <aslaughter@instructure.com>
QA-Review: Jacob Burroughs <jburroughs@instructure.com>
Product-Review: Jacob Burroughs <jburroughs@instructure.com>
Migration-Review: Cody Cutrer <cody@instructure.com>
2023-08-23 22:16:10 +00:00
Derek Williams 4f3317ccd8 bring ab_guid to assignments
closes EVAL-3393
closes EVAL-3394
closes EVAL-3395

flag=none

[fsc-timeout=100]

test plan:
- all tests pass
- create an assignment with an ab_guid
- using the assignments api, verify that the ab_guid is returned in the
    show response when `?include[]=ab_guid is passed`
- using the assignments api, verify that the ab_guid is returned in the
    index response when `?include[]=ab_guid is passed`
- using the assignments api, verify that you are able to update the
    ab_guid

Change-Id: Ic4e8d78a6b4dfb112168ec68bd7f6e117a8030f5
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/324884
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Spencer Olson <solson@instructure.com>
Reviewed-by: Kai Bjorkman <kbjorkman@instructure.com>
QA-Review: Cameron Ray <cameron.ray@instructure.com>
Product-Review: Cameron Ray <cameron.ray@instructure.com>
Migration-Review: Jacob Burroughs <jburroughs@instructure.com>
2023-08-22 16:35:07 +00:00
Jeremy Stanley 753fa76e1b add :view_admin_analytics permission
and default it on for account roles that enable :view_analytics
and :view_all_grades

test plan:
 *before running the included datafix migration or
 enabling the "Admin Analytics - view permission" feature flag*
  - check out the analytics plugin to gems/plugins/analytics
    (we just need it for the :view_analytics permission;
    no need to get it working or anything)
  - set up some custom roles that enable/disable various
    permutations of :view_analytics and :view_all_grades
 *run migrations*
  - the "Admin Analytics - view and export" permission still
    does not appear because the feature flag is off
 *turn on the feature flag*
  - the permission appears
  - custom roles that granted :view_analytics and :view_all_grades
    enable the permission
  - custom roles that disabled one or both disable the permission

flag=admin_analytics_view_permission
closes FOO-3701

Change-Id: Ib006293eb3b8e5dea7aeb38a4a5f5307eec3537f
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/325131
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: August Thornton <august@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
Migration-Review: Jacob Burroughs <jburroughs@instructure.com>
2023-08-18 21:42:36 +00:00
Sarah Gerard af7d698fee Clean up stuck progresses
looks for progresses for course_pace_publish that
are in a queued state and have a delayed_job_id where
the DelayedJob for that id does not exist and set them to failed

Fixes LF-506
flag=none

test plan:
- if you don't have some already, make some course pacings, thus
  making progresses for publishing the pacings
- in a rails console, find some completed progresses for
  course_pace_publish:
  Progress.where(tag: "course_pace_publish", workflow_state: "completed")
- set some of those progresses to "queued"
  Progress.find(id).update_attribute(:workflow_state, "queued")
- run the migration
- the progresses that were set to queued should now have a
  workflow_state of "failed"

Change-Id: I599b224cad9bf84b12b3e39c75c988a7c0289aaf
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/324928
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Eric Saupe <eric.saupe@instructure.com>
QA-Review: Eric Saupe <eric.saupe@instructure.com>
Migration-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Sarah Gerard <sarah.gerard@instructure.com>
2023-08-15 18:21:36 +00:00
Jared Crystal 5a0172b086 backfill NQ tool configs with RQD variable expansions
closes QUIZ-11666
flag = none

test plan:
 - existing NQ tools receive the fields in their configs for
   restrict_quantitative_data and grading_scheme

Change-Id: I7aead568043d6978da9eaaf21e236ab2e730ee6c
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/324501
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Dustin Cowles <dustin.cowles@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Dustin Cowles <dustin.cowles@instructure.com>
Product-Review: Stephen Kacsmark <skacsmark@instructure.com>
Migration-Review: Cody Cutrer <cody@instructure.com>
2023-08-14 19:32:07 +00:00
Mysti Lilla fc2450c8cd Remove unused observer alert thresholds index
This index was added when the table was created, but
it is not used

flag=none

Test plan
- Specs pass

Change-Id: I20ed228b19af4831651cde7a74be27a8d604d7f3
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/323878
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Migration-Review: Cody Cutrer <cody@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Mysti Lilla <mysti@instructure.com>
Product-Review: Mysti Lilla <mysti@instructure.com>
2023-08-10 16:55:47 +00:00
Mysti Lilla cd7b3cfbc8 Remove unused notification policy overrides index
This index was added when the table was created, but
it is not used

flag=none

Test plan
- Specs pass

Change-Id: I651e440786ab39ff63fd2888b07e11ced6d81a98
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/323877
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Migration-Review: Cody Cutrer <cody@instructure.com>
Reviewed-by: Aaron Suggs <aaron.suggs@instructure.com>
QA-Review: Aaron Suggs <aaron.suggs@instructure.com>
Product-Review: Aaron Suggs <aaron.suggs@instructure.com>
2023-08-10 16:55:05 +00:00
Mysti Lilla 58695f4720 Remove unused observer pairing codes index
This index was added when the table was created, but
it is not used

flag=none

Test plan
- Specs pass

Change-Id: I6c544a64894ebb755c5568a63d738ae5f81093cd
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/323880
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Michael Hulse <michael.hulse@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Reviewed-by: August Thornton <august@instructure.com>
Migration-Review: Isaac Moore <isaac.moore@instructure.com>
QA-Review: Mysti Lilla <mysti@instructure.com>
Product-Review: Mysti Lilla <mysti@instructure.com>
2023-08-10 00:26:58 +00:00