Commit Graph

33 Commits

Author SHA1 Message Date
Cody Cutrer 102fdfc849 no more dynamic finders (models)
refs CNVS-15126

Change-Id: I2996e0e262c41274c34d0ea3bfde757074416b8c
Reviewed-on: https://gerrit.instructure.com/40973
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2014-09-24 20:51:48 +00:00
Cody Cutrer 1277aaae90 stabby lambda scopes for rails4
Change-Id: I34f2527471cdb4d8cab5cde426ba959baa26189e
Reviewed-on: https://gerrit.instructure.com/37151
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2014-07-04 02:11:56 +00:00
Braden Anderson 45d19f3003 validate types on polymorphic associations
fixes ALYT-26

test plan:
	* regression test

Change-Id: Ie93e89b842e354f1f76d75f3492145b86c79a035
Reviewed-on: https://gerrit.instructure.com/34560
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
Reviewed-by: Derek DeVries <ddevries@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Braden Anderson <banderson@instructure.com>
2014-05-28 17:05:34 +00:00
James Williams 413e30a4de only try to import active outcomes and groups
test plan:
* create an account-level outcome group
* create an outcome in that group, but then delete it
* in a course, find and import the account-level group
* should not import a broken outcome link to the deleted outcome

fixes #CNVS-2015

Change-Id: I59d3404038960e156cd7b3e8540df286f27d1569
Reviewed-on: https://gerrit.instructure.com/34797
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Clare Strong <clare@instructure.com>
2014-05-14 12:31:29 +00:00
Anthus Williams 828981e72c define exportable attributes/associations on models
instead of passing an :exportable option to
ActiveRecord::Associations, simply define a constant
on the class containing exportable associations and
attributes. This is due to :exportable breaking
ActiveRecord, and we can't simply monkey-patch in
config/initializers because models are included in
migrations before the initializers are run

Change-Id: I11f1a6b4570c397d8e01010c517bc6efdac7afca
Reviewed-on: https://gerrit.instructure.com/33235
Reviewed-by: Braden Anderson <banderson@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Anthus Williams <awilliams@instructure.com>
QA-Review: Anthus Williams <awilliams@instructure.com>
2014-05-06 23:54:24 +00:00
James Williams 7692af009a move all importing methods into models/importers
test plan:
* migration regressions

Change-Id: Ibed8d4820c05b9c69101b215932af32055c3e006
Reviewed-on: https://gerrit.instructure.com/33728
QA-Review: Clare Strong <clare@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2014-05-02 17:31:15 +00:00
Cody Cutrer 4b48998179 fix usages of scoped? to check rails 3 style x_values
Change-Id: I75142f6a2d758e1f672a79ecf3c7da69ba5c8f30
Reviewed-on: https://gerrit.instructure.com/29558
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Ryan Florence <ryanf@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2014-02-07 15:18:42 +00:00
Raphael Weiner 91944495c2 convert sanitize field plugin into proper gem: CanvasSanitize
Change-Id: I5562a318bb3f52c1374a3a69f288bfb2381f8ee7
Reviewed-on: https://gerrit.instructure.com/29405
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Stephan Hagemann <stephan@pivotallabs.com>
Product-Review: Stephan Hagemann <stephan@pivotallabs.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
QA-Review: Brian Palmer <brianp@instructure.com>
2014-01-28 22:36:18 +00:00
James Williams f360597426 remove unnecessary clone_for methods
Change-Id: I8d80d36bde5dfdcff3de2f86aa3223e6c03a23aa
Reviewed-on: https://gerrit.instructure.com/24771
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
QA-Review: Bracken Mosbacker <bracken@instructure.com>
2013-10-09 12:13:18 +00:00
Cody Cutrer d3f0b18684 validate nullness in the db on a bunch of columns
fixes CNVS-7414

Change-Id: I60978f66d88d916dc5736dbb975715172bd1e14b
Reviewed-on: https://gerrit.instructure.com/23141
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>
2013-09-12 22:20:39 +00:00
Simon Williams dc36705a0a only touch context once after outcome group delete
fixes CNVS-7045

test plan:
- create an outcome group with some outcomes in it
- delete the group and refresh
- the group should stay deleted
- watch a query log when you delete and make sure the context is only touched
  once, not once per outcome in the group

Change-Id: I656f2685b20959f2096820acc604d940e1f1c63d
Reviewed-on: https://gerrit.instructure.com/22842
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2013-08-05 17:56:50 +00:00
James Williams 566f023bad add vendor_guid to api for outcomes and outcome groups
test plan:
* confirm that the 'vendor_guid' property is accessible
and editable through the API for outcomes and outcome
groups

* confirm that in the api, if an assignment's rubric
criterion is associated with a learning outcome, that it
returns the vendor guid

closes #CNVS-6387

Change-Id: I28d4cfb42172e69f07a03a398ba15011aaab4f7c
Reviewed-on: https://gerrit.instructure.com/21642
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
QA-Review: Clare Strong <clare@instructure.com>
2013-06-22 03:21:17 +00:00
Cody Cutrer 8c94e53dc7 arel-ify scopes
s/named_scope/scope/g

refs CNVS-4707

Change-Id: I930d229fc9985c7c0096a0f4888933addd4f3aee
Reviewed-on: https://gerrit.instructure.com/18834
Reviewed-by: Duane Johnson <duane@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2013-04-01 21:57:16 +00:00
Cody Cutrer d9111f5414 arel-ify models
closes CNVS-4707

Change-Id: I32c8ec5a53525f89cf232890eaac790fbc2b4744
Reviewed-on: https://gerrit.instructure.com/18745
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2013-04-01 18:42:38 +00:00
Zach Pendleton a030142121 change course root outcome group title to course name.
fixes #11502

previously, the name of the root course outcome group was
'ROOT.' now it's named after the course to reduce user
confusion.

this commit also includes a migration to fix all existing
courses w/ 'ROOT' titled outcome groups.

test plan:
  * create a new course;
  * create an account-level outcome;
  * in the new course, import the account-level outcome by
    visiting the outcomes page, clicking the 'find' button,
    navigating to the account outcome, and clicking the 'import'
    button;
  * verify that the pop-up reads, 'import outcome <outcome name>
    to group <course name>?
  * run the migration and repeat these steps with a previously
    created course; verify that the name still displays properly.

Change-Id: I6f26a9f748b3a5127a751fb9667be9e58b1d4664
Reviewed-on: https://gerrit.instructure.com/14825
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Mark Ericksen <marke@instructure.com>
2012-10-31 10:32:00 -06:00
Joe Tanner 27edbc1e8b Nested outcomes UI, closes #9158
test plan for course, account, and sub-account
outcomes page:
- using the 'New' buttons in the toolbar
  create, edit, and delete a bunch of outcomes
  and groups and nested groups
- when editing an outcome, insert, edit, and delete the criterion ratings
- find dialog
  - inside any top level standard group
  - select an individual outcome or a group to import
  - after importing, the outcome or group should show up in the
    seleced group of the main window and show it's details on the right
  - account standards
    - the account groups (the first level under 'Account Standards') should
      not be importable
- pagination
  - add 20-30 outcomes and groups to a group
  - groups should load first and then the outcomes
  - a 'Loading more results' item should be displayed when fetching
    more pages
- test out the 'Back' button

Change-Id: Iba1bb0533fb962ac6d206179c82c388f5fee1d84
Reviewed-on: https://gerrit.instructure.com/13086
Reviewed-by: Zach Pendleton <zachp@instructure.com>
Tested-by: Bryan Madsen <bryan@instructure.com>
2012-10-25 11:03:21 -06:00
Jacob Fugal 2fc15ae69c Merge branch 'master' into dev/learning_outcome_refactor
simple keep-both resolutions for app/models/submission.rb and
config/routes.rb. spec/integration/learning_outcome_group_spec.rb stays
removed.

fixed path->url in outcome group api pagination to match master's new
rules.

Conflicts:
	app/models/submission.rb
	config/routes.rb
	spec/integration/learning_outcome_group_spec.rb

Change-Id: I8dd31e1d3764970a8f683aef362f0cca06abe90e
2012-10-24 13:56:33 -06:00
Jake Sorce e7de009d7b add data validation to learning outcome title
fixes #11057

test plan:
  1. login as a teacher and go to a course
  2. click 'Outcomes' in the left nav
  3. click 'Add Outcome Group' on the right
  4. try to type a string longer than 255 characters
  5. validate that the textbox stops you and it saves
     correctly

Change-Id: I9fb323fe6360d173c44b00206583e391dda0c0cc
Reviewed-on: https://gerrit.instructure.com/14430
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
2012-10-16 11:01:18 -06:00
Bracken Mosbacker 990d1f6457 create framework for importing standards from a vendor
This adds a migration tool that can import standards from
academic benchmarks, either by giving it a file, or by
using their API.

Test Plan:
 * Run a migration for a specific authority
 * It should import into the global group happily

refs #9866

Change-Id: If654681d60848e1233475f737dc2fadecacdbd98
Reviewed-on: https://gerrit.instructure.com/13421
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2012-09-17 15:22:36 -06:00
Jacob Fugal ca87014644 Outcome API
Change-Id: I6c33d2ab364522930b908d8edd162b20634e54b5
Reviewed-on: https://gerrit.instructure.com/12762
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
2012-08-22 14:05:36 -06:00
Jacob Fugal 976c33ada6 fixup failing specs and add temporary plugin shims
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>
2012-08-22 09:53:19 -06:00
Bracken Mosbacker 9f9e56e362 export/import and copy new outcome functionality
Change-Id: Id3b056dc527af48b08a514e309b7654da95b3829
Reviewed-on: https://gerrit.instructure.com/12705
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Tested-by: Jacob Fugal <jacob@instructure.com>
2012-08-22 09:52:13 -06:00
Bracken Mosbacker 82d4003320 learning outcomes refactor
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>
2012-08-22 09:51:39 -06:00
Bracken Mosbacker e98c5059d7 fix infinite recursion in outcome groups
The learning outcome UI has some bugs that allow you to
drag groups into other groups. This causes groups to have
multiple parents and so they'll show up on the page more
than once. Once that happens you can even drag a group
into itself. Once in that state loading the outcomes
page would cause an infinite render.

This commit makes the page render even with the existing
bad data. It also prevents groups from being added to a
group of any of its ancestors. It also fixes groups
having multiple parents.

This commit doesn't address the current bugs in the UI that
allowed these problems to happen, it just prevents those
from creating relationship loops.

Test Plan:
 * Load outcomes page and create two groups
 * Drag one group into the other group
 * Refresh page, there should not be two of the group you dragged
 * If you want to test the page loading despite existing bad relations:
 * Create a content tag that makes a group point to itself like the specs do. (You can't make this happen in the UI anymore)
 * Loading the outcomes page shouldn't freeze

Change-Id: I416e99b3bc57a3b8c82db5cc895bccd141dc3dab
closes: #6384
Reviewed-on: https://gerrit.instructure.com/7559
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2011-12-19 16:28:26 -07: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
Bracken Mosbacker ccb0aad1c5 import learning outcome groups correctly
when importing learning outcome groups the first group
became the course's default group, this commit makes
sure a default group exists before importing a group

refs #55

Change-Id: I8b7af9dbccfc8490ba3d60a17e8c4223c4fe6b28
Reviewed-on: https://gerrit.instructure.com/4464
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Bracken Mosbacker <bracken@instructure.com>
2011-06-30 10:43:28 -06:00
Bracken Mosbacker 0d8b4fce33 copy learning outcomes during course copy
closes #3805

Change-Id: I186c2ed323c5aeb29a5dfd6c40da1245c72086ee
Reviewed-on: https://gerrit.instructure.com/3846
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2011-05-25 16:26:30 -06:00
Jon Jensen 6d226272df cast columns in dynamic finders, warn on all-nil argument lists
in production mode we now cast to the appropriate type and issue a warning
if it can't be cleanly cast (e.g. '' -> 0). if all arguments are nil (or
empty arrays, e.g. find_by_id([])) and we aren't in a scope, issue a
warning (sometimes we really do want nil when we're in a scope, e.g. line
216 of app/models/folder/rb).

in development/test mode, we now raise errors in the two warning scenarios
above (though that is configurable).

fixed several places in the code where specs failed due to the change, or
where inputs to dynamic finders looked problematic

Change-Id: Ifea851cb14d3e89b6df08ade8e83934579678f8b
Reviewed-on: https://gerrit.instructure.com/3434
Reviewed-by: Zach Wily <zach@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2011-05-03 11:06:04 -06:00
Brian Palmer a42a6e3b7c fix LearningOutcomeGroup#root_learning_outcome_group association
Change-Id: Ib5e1b8c86780a8421bfe2390f7b0fb38792d051d
Reviewed-on: https://gerrit.instructure.com/3209
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2011-04-22 13:46:59 -06:00
Brian Palmer 2882b73335 fix some learning outcome group infinite loop possibilities
If you ever re-saved the default group, infinite recursion. There was
also infinite recursion happening on import, if the course didn't have
any groups at the beginning of the import, because the default group was
being assigned as a child of itself.

Change-Id: Ib504380c28ed9c6e68b2820bdf7549ec63c90061
Reviewed-on: https://gerrit.instructure.com/3132
Reviewed-by: Zach Wily <zach@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2011-04-18 10:17:55 -06:00
Bracken Mosbacker 84c048e5e6 importing more canvas export types
Added external feeds, grading standards, and learning outcomes

refs #3396

Change-Id: I138f22a6d5793e21ba49388e16be75d5f80f0e12
Reviewed-on: https://gerrit.instructure.com/3043
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2011-04-18 08:09:23 -06:00
Brian Whitmer b7f1d5ae18 align question banks to outcomes
Question banks can be aligned to outcomes that
are part of the same context.  Whenever students
take a quiz with questions from the bank they'll
get evaluated for the linked outcomes based on
the points they got for each bank question.

Also fixed a bug which may or may not have existed
before this commit that unexpectedly deleted quiz
submissions when a user tried to re-take a quiz.

refs #3317

Change-Id: I744af3915672a5e260b078503e0bc648c238eca9
Reviewed-on: https://gerrit.instructure.com/2641
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
2011-03-25 15:39:56 -06:00
Brian Whitmer 8b8173dcc9 Initial commit.
closes #6988138
2011-01-31 18:57:29 -07:00