use arel's where() instead. use of :conditions in has_many/has_one
remains, and a small handful of cases where rails2 sharding needs the
conditions in the find.
also, cleanup distinct_on() to only allow the :select/:option values it
works with directly; other finder options should be scoped in before the
distinct_on call.
fixes CNVS-8754
test-plan:
[1] communication messages API
- fetch /api/v1/comm_messages?user_id=self as a non-siteadmin; should
not error, should include the expected messages
[2] course roster
- load /courses/<id>/users
- invite a new student to the course; do not have that student accept
the invitation
- reload and open the web console; ENV.courses.pendingInvitationCount
should be 1
[4] list enrollments API endpoint
- full regression
[5] list conversations API endpoint
- fetch /api/v1/conversations; should not error, should include the
expected messages
[6] rubrics
- create a rubric with title "Example Rubric"
- create a second rubric with the same title; title should be changed
on save to "Example Rubric (1)"
- repeat to get "Example Rubric (2)"
Change-Id: I411676285348653044696d850efacf2e1a9e6585
Reviewed-on: https://gerrit.instructure.com/24996
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
* use sort_by instead of sort where possible to avoid repeating yourself
* use new SortFirst/SortLast sentinels to avoid strange magical constants
* fix a few places of complicated logic for tiered sorting to just use
an array
Change-Id: I184ef0b4e31fa18294c9beb32770101d383bbea1
Reviewed-on: https://gerrit.instructure.com/24867
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
fixes CNVS-7199, CNVS-4414
abstract some ICU stuff out to Canvas::ICU, and add some missing
functionality in FFI-ICU
test plan:
* create a bunch of groups in the same category, named 1-10.
10 should sort after 9, not 1
* repeat for creating and publishing quizzes *with the same due date*.
go to the quiz index, and 10 should sort after 9, not 1
Change-Id: I323eb12dfb5bd23dbcbb3b543fa1b90a72f4341b
Reviewed-on: https://gerrit.instructure.com/24732
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
fixes CNVS-7745
test plan:
- create a rubric with and outcome and add it to an assignment
- verify that both the rubric and assignment are aligned to the outcome
- from the course rubrics page, remove the outcome from the rubric
- verify that both the rubric and assignment alignments were removed
- quick regression around delete rubrics from different contexts
Change-Id: Ibfca5df68423a5a81e1ef2c73920d2e932c463d6
Reviewed-on: https://gerrit.instructure.com/23871
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
Reviewed-by: Cameron Matheson <cameron@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
fixes CNVS-7620
test plan:
- NOTE: before apply this patchset
* create some rubrics with and without outcomes attached to assignments
* remove some of them
- after applying this patchset, the active ones should still be active, and
the deleted ones should still be deleted.
- if you had old alignments that should have been deleted, but where not, they
should now be deleted (it's difficult to get them to test, at this point)
Change-Id: I813e083357a99a38eb22611b5b5848fbf9525156
Reviewed-on: https://gerrit.instructure.com/23475
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
Reviewed-by: Cameron Matheson <cameron@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
There are a few old LearningOutcomeResults that have a nil artifact, and
many that have a Submission as an artifact. We want to get rid of these
because they come from bad data, and step 1 toward that goal is to stop
creating them and hide them in the UI.
The LORs with a nil artifact are very old and I believe came from a very
early incarnation of outcomes. The LORs with a Submission as an artifact
came from a combination of two code problems. The first was old code
that allowed an assignment that was aligned with an outcome but did not
have a rubric to create LORs directly based on it's submission. The
second was a bug that prevented the assignment <-> outcome link from
being destroyed when a rubric with an outcome was removed from an
assignment.
fixes CNVS-7495
fixes CNVS-7498
test plan:
- try different combinations of adding a rubric with an outcome to an
assignment.
- when you grade the assignment, the grade create a learning outcome result
(which can be seen on the outcome show page, or in the account outcome
report) if the rubric+outcome are currently attached to the assignment.
- so for example, add a rubric with an outcome, check, remove just the outcome
row, check, add a new outcome row, check, remove the whole rubric, check.
- be sure to check both the show page and the outcome report
TODO:
- datafix migration
Change-Id: I37700e3e5c08fc6cfb8fcf1cac42ea6693fcaba3
Reviewed-on: https://gerrit.instructure.com/23303
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cameron Matheson <cameron@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
refs CNVS-7414
first, start at RubricsController#assessments. there is no route for it,
so remove the action and it's view. The rubric_association partial was
only used from that view, so remove it as well. Then in
RubricAssessmentController and RubricAssociationsController #create,
note that nothing ever provides an invitations param, so remove that,
and cascade down to removing or simplifying a few other methods
(particularly RubricAssociation#invite_assessors, which created users
in a bad way, and RubricAssociation#invite_assessor, which never
assigned assessor_asset, which will shortly be non-null, and is
obviously never used cause that column is never null in production).
Finally, fix some specs to properly create rubric assessments since
the (bad) helper methods are now gone.
test plan:
* specs
* basic regression test around using rubrics for grading and
peer reviews
Change-Id: Ibd7713d9fc1f847d49c47b95d8c51ce28fa41e92
Reviewed-on: https://gerrit.instructure.com/23412
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Clare Strong <clare@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
fixes CNVS-1789
test plan:
- create an outcome
- create a rubric with two rows, one normal and one linked to the outcome
- save, and then edit again
- you should be able to edit the normal one but not the linked one
Change-Id: Id8a99dab45bf1cc79cc51957de9ce527bd819265
Reviewed-on: https://gerrit.instructure.com/23073
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cameron Matheson <cameron@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
test plan:
* create an account level outcome
* create an account level rubric
* attach the outcome to the rubric
* in a course, attach the rubric to an assignment
* copy the course
* check the new assignment in which you linked the rubric to
the outcome was carried over, and the association with
the account-level rubric should be preserved,
(and by extension the association with the learning
outcome)
fixes #CNVS-4200
Change-Id: I0bfa11124d599ca1a96ed3b6e684b966974e397b
Reviewed-on: https://gerrit.instructure.com/21548
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Clare Strong <clare@instructure.com>
test plan:
* import a package containing an item that is
invalid so it will create a
"Couldn't import the" item warning, but also
have an extremely long title (~250 characters)
(an example is attached to the ticket)
* confirm that when trying to import,
the entire migration does not fail silently,
and thus hang in the import phase,
but instead creates a proper migration issue
for the invalid item and continues the import
normally
fixes #CNVS-5467
Change-Id: I2659ac0c5531ad609f3f58abc1fc0960e9d85c51
Reviewed-on: https://gerrit.instructure.com/19961
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Adam Phillipps <adam@instructure.com>
creates new permission :manage_rubrics, which was
previously a subset of the rights in :manage_grades
test plan:
* confirm that a new permission for
outcomes and rubrics is available in the ui
* confirm that this permission restricts the
creation and editing of rubrics
fixes #CNVS-266
Change-Id: I40d108b53e2771890d8fdbb108e1de24364aa055
Reviewed-on: https://gerrit.instructure.com/17763
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Adam Phillipps <adam@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
the looked like they were being maintained, but the content tag links between
rubric and outcome and between assignment and outcome were not being generated
properly after a course copy.
fixes #CNVS-1274
test plan:
- create and account level outcome and a course level outcome
- in the course create two assignments, with rubrics
- in one, add the course level outcome
- in the other add the account level outcome
- grade a student with the rubrics
- ensure that alignments and mastery look correct
- copy the course
- in the new course grade a different student
- ensure that alignments and mastery look correct
Change-Id: I04c240256f007791613e4f29b8288f1bc7729849
Reviewed-on: https://gerrit.instructure.com/15908
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
test plan:
- try to create a new rubric with a title longer than 255 characters
Change-Id: I83f17aafbd6e322132a9af67a10971aff5382d0a
Reviewed-on: https://gerrit.instructure.com/13707
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
the shims will be removed in a later commit. that commit will need to
wait for the plugins to be fixed before it can be submitted.
test-plan:
- specs pass
Change-Id: Ifd6e2a254f0272a58d507c845cdae58b7392801c
Reviewed-on: https://gerrit.instructure.com/12798
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
This list is *NOT* complete, some items may have snuck in that I forgot
to note, and/or some of the noted items may not be completely functional
yet.
Specs need to be written around a lot of this, other specs will no doubt
need to be fixed.
Some things, particularly around LearningOutcomeGroups will need data
migrations that aren't there yet.
* remove LearningOutcome.non_rubric_outcomes? and replace with false
where invoked
* remove LearningOutcome.enabled? and replace with true where invoked
* remove never-taken branches
* remove the shared/aligned_outcomes partial and it's supporting
javascript, since it's now empty
* remove js handler for add_outcome_alignment_link and supporting
method since it only occurred in never-taken branches
* mix LearningOutcomeContext into Course and Account
* replace LearningOutcomeGroup.default_for(context) with
LearningOutcomeContext#root_outcome_group
* rename LearningOutcome#content_tags to LearningOutcome#alignments
* rename LearningOutcomeGroup#content_tags to
LearningOutcomeGroup#child_links, and properly restrict
* remove ContentTag[Alignment]#rubric_association_id, add
ContentTag[Alignment]#has_rubric_association? that looks at the
presence of the content's rubric_association_id
* condition off the assignment having a rubric_association rather than
filtering tags by has_rubric_association (which just looks back at
the assignment). all or none of the assignment's alignments are
forced to have the association (via the assignment). this was true in
practice before, is now codified (and more efficient)
* rename AssessmentQuestionBank#learning_outcome_tags to
AssessmentQuestionBank#learning_outcome_alignments
* rename Assignment#learning_outcome_tags to
Assignment#learning_outcome_alignments
* rename Rubric#learning_outcome_tags to
Rubric#learning_outcome_alignments
* move/rename (Course|Account)#learning_outcome_tags to
LearningOutcomeContext#learning_outcome_links
* move/rename Account#learning_outcomes (corrected) and
Course#learning_outcomes to
LearningOutcomeContext#linked_learning_outcomes
* move/rename Account#created_learning_outcomes and
Course#created_learning_outcomes to
LearningOutcomeContext#created_learning_outcomes
* clarify and correct usage of linked_learning_outcomes vs.
created_learning_outcomes
* move/rename (Account|Account)#learning_outcome_groups to
LearningOutcomeContext#learning_outcome_groups
* remove unused Account#associated_learning_outcomes
* just remove one link to a learning outcome when deleting
* merge Account#has_outcomes?, Course#has_outcomes? and
Course#has_outcomes into LearningOutcomeContext#has_outcomes?, add a
use in Context#active_record_types
* kill LearningOutcomeGroup#root_learning_outcome_group (unused)
* rename LearningOutcomeResult#content_tag to
LearningOutcomeResult#alignment
* kill unused (and broken) OutcomesController#add_outcome_group
* kill unused OutcomesController#update_outcomes_for_asset
* kill unused OutcomesController#outcomes_for_asset
* remove unused (outside specs, correct specs)
AssessmentQuestionBank#outcomes=
* remove unused ContentTag#learning_outcome_content
* replace ContentTag.learning_outcome_tags_for(asset) (only ever called
with asset=an assignment) with call to
Assignment#learning_outcome_alignments
* remove unused ContentTag.not_rubric
* remove (now) unused ContentTag.include_outcome
* remove unused LearningOutcome#learning_outcome_group_associations
* avoid explicit use of ContentTag in outcome-related specs
* replace LearningOutcomeGroup#learning_outcome_tags with
LearningOutcomeGroup#child_outcome_links (and only use for outcome
links; not tags for child groups)
* split ContentTag#create_outcome_result into
Submission#create_outcome_result,
QuizSubmission#create_outcome_result, and
RubricAssessment#create_outcome_result. fix some bugs along the way
* refactor ContentTag.outcome_tags_for_banks and some code from
QuizSubmission#(track_outcomes|update_outcomes_for_assessment_questions)
into QuizSubmission#questions_and_alignments
* refactor RubricAssociation#update_outcome_relations and
Rubric#update_alignments into LearningOutcome.update_alignments
* don't use ContentTag#rubric_association with outcome alignments; use
the tag's content's rubric_association in its place (they should have
been equal anyways)
* refactor LearningOutcome.available_in_context and
@context.root_outcome_group.sorted_all_outcomes (only time
sorted_all_outcomes is used) into
LearningOutcomeContext#available_outcomes and
LearningOutcomeContext#available_outcome
* overhaul LearningOutcomeGroup#sorted_content and rename to
LearningOutcomeGroup#sorted_children. it not returns ContentTags
(outcome links) and LearningOutcomeGroups, vs. LearningOutcomes and
LearningOutcomeGroups; fix usages appropriately
* fix UI for arranging/deleting outcome links and groups within a group
to refer to the outcome link rather than the outcome
Change-Id: I85d99f2634f7206332cb1f5d5ea575b428988d4b
Reviewed-on: https://gerrit.instructure.com/12590
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Tested-by: Jacob Fugal <jacob@instructure.com>
If you copied content into your course, then deleted an item
and copied it again it wouldn't be active. It is now.
Test Plan:
* Create an assignment
* Copy the course and delete the assignment in the new course
* Copy the original course into the new one again
* The assignment should be active
closes#8298
Change-Id: Ief8476d2befff999ed85a35039604d34253bfa1f
Reviewed-on: https://gerrit.instructure.com/10487
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
The selective imports mostly worked before, but if a
given section was completely unchecked the previous
code would import it anyway. This fixes that and makes all
the decision code in one place and easy to test.
Test Plan:
* Import a content package and only choose certain items
* Only the items you chose should be imported
closes#5528
Change-Id: Ia6c0c1f5f9a44497053733101140cc74d6239129
Reviewed-on: https://gerrit.instructure.com/9799
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
tweak our javascript so that the rubrics controller update method knows that we
want to save the rubric association even if we can't modify the rubric. also
clean up some unused code in the rubric spec that was confusingly named
read_only, but not related to the rubric read_only property.
test-plan:
- create a rubric
- create two assignments that have the same points
- associate the rubric with the first assignment and select it be used for
grading. make sure it sticks across refresh (and the rubric is not
duplicated)
- same for the second assignment
Change-Id: I2c32d4da35eff508680f0a19c97cb1111fe4cef1
Reviewed-on: https://gerrit.instructure.com/8981
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
fixes#4818
test plan:
- create a rubric
- delete it
- make a new rubric with the same title
- it should not have a '(1)' appended to its title
Change-Id: I984d1e11d634a2426cb30adbbe53c728c5776062
Reviewed-on: https://gerrit.instructure.com/8939
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
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>
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>
Basically, don't call a bazillion procs everytime you check_policy;
just the "given" statement. Everything else is evaluated just once,
and cached on the class. This does lose functionality (the ability
to access the instance inside of set_policy, and set methods), but
none of it was currently in use.
Change-Id: I736879d98beb4115a2e8c492931c755076291d08
Reviewed-on: https://gerrit.instructure.com/4665
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: JT Olds <jt@instructure.com>
Before if any single item had an error the whole import
errored out. This lets items fail and the rest continue to
import. The single item failures are logged as warnings in
the ContentMigration and this allows the user to know what
failed.
All the warnings/failures are also shown on the migration
list page to help admins diagnose problems.
refs #4903
Change-Id: I66b81ce1c243258dfc8c1d7d1381b2ea8daa3e72
Reviewed-on: https://gerrit.instructure.com/4268
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
for some reason, this ambiguity conflict was only showing up when running the
specs under spork. you may want to try that if you can't repro on your own.
Change-Id: I3cd22a1d79aebf6db4e19af1fae8ce41d8fa3cc9
Reviewed-on: https://gerrit.instructure.com/4053
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
this commit fixes a bunch of problems with importing
a whole export package and updates the UI
refs #3396
Change-Id: Ia344b385e06df2f08bb75878234a7712a036e4b3
Reviewed-on: https://gerrit.instructure.com/3085
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
This imports the syllabus, rubrics, and modules
refs #3396
Change-Id: Ie7802aa5a064f8cee471af9bfe0a23bf224831a6
Reviewed-on: https://gerrit.instructure.com/3064
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
a rubric should only be deleted once it's not
being used anymore. It should only be unbookmarked
from a given context when it's not being used in
that context anymore.
fixes#3309
Change-Id: Icb8a79baeb0c0ec2195b7e19b1d9768eadfeb97e
Reviewed-on: https://gerrit.instructure.com/2518
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: JT Olds <jt@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>