Commit Graph

2251 Commits

Author SHA1 Message Date
Liz Abinante fee20a7d89 renders error when max char exceeded for outcomes title
fixes CNVS-3110

test plan:
- create a new learning outcome
- title must be greater than 255 chars
- save learning outcome
- verify presence of error dialog

Change-Id: I9f91b03f5bce60dc6e7c8ddf9fdcbf1719f8adb7
Reviewed-on: https://gerrit.instructure.com/24004
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
2013-09-05 18:58:49 +00:00
Mark Ericksen deb32ca36b handle ePortfolio name when too long
fixes CNVS-3277

testing steps:
- either create a new ePortfolio or edit
  the settings for one (i.e. left side nav
  when in a portfolio "ePortfolio Settings")
- in popup, enter text longer than 255 characters
  and try to submit
- should display that "Name is too long"
- when creating a new ePortfolio and when editing,
  verify that it requires a "Name" and gives
  a descriptive error message

Change-Id: Id7b6b495a3e47290ea5c37054865812ddc7f1dec
Reviewed-on: https://gerrit.instructure.com/23829
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Landon Wilkins <lwilkins@instructure.com>
Product-Review: Marc LeGendre <marc@instructure.com>
QA-Review: Marc LeGendre <marc@instructure.com>
2013-09-05 17:26:04 +00:00
James Williams 373a3b8f16 fix selective content when arrays are passed to migration_settings
test plan:
* import the course referenced in the ticket
with selective content

fixes #CNVS-7952

Change-Id: Ibb68623ed6b9ab9b11543f82ffa83b1a7aa92dae
Reviewed-on: https://gerrit.instructure.com/24042
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
QA-Review: Hannah Bottalla <hannah@instructure.com>
2013-09-05 16:43:29 +00:00
Mark Severson 2b0a891d80 remove hide_from_students from the new pages UI
test plan:
 - start with draft state disabled
 - for each step, exercise the api (as a teacher) to confirm the
   expected values
 1) create pages with different hide_from_students values
    a) as a teacher
       hidden pages should be visible; the hidden flag should persist
    b) as a student
       hidden pages should not be visible
 2) using the api, update published and hide_from_students
       (together and separately)
    a) the published value should not be affected
    b) the hide_from_students value should be updated when set

 3) enable draft state
    a) as a teacher
       previously hidden pages should be visible, but unpublished
    b) as a student
       previously hidden pages should not be visible
 4) edit a page
    a) ensure the "Hide from students" option is gone
 5) publishing pages should behave as expected
    a) published pages should be visible to students
    b) unpublished pages should not be visible to students
 6) using the api, update published and hide_from_students
       (together and separately)
    a) the hide_from_students value should not be affected
    b) the published value should be updated when set

 7) create new pages with different published states
    a) as a teacher
       unpublished pages should be visible, but unpublished
    b) as a student
       unpublished pages should not be visible
 8) disable draft state
    a) as a teacher
       previously unpublished pages should be marked hidden
    b) as a student
       previously unpublished pages should not be visible

fixes CNVS-7617

Change-Id: I395e0b2639543a64d9e2bc8d9377c78cf36f42d6
Reviewed-on: https://gerrit.instructure.com/23618
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
2013-09-04 22:22:21 +00:00
Liz Abinante 676683aa91 prevent comments and grading on submissions for unpublished assignments with API
fixes CNVS-7195

test plan:
- create an unpublished assignment
- make an API call to comment on a submission as a student and teacher
- verify that you are unauthorized to comment (both as student and teacher)
- make another API call to add a group comment on the submission
- verify that you are unauthorized to comment
- make another API call to grade a submission
- verify that you are unauthorized to grade the submission

Change-Id: If627df5db03e3b488c25f50a0dd2c2f715da7b98
Reviewed-on: https://gerrit.instructure.com/23936
Reviewed-by: Cameron Matheson <cameron@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
2013-09-04 19:35:21 +00:00
Jeremy Stanley e3e447d1e5 remove unnecessary and expensive prerequisite cycle check
ContextModule#prerequisites= included a very expensive check
for cycles among module prerequisites (it took several minutes
to operate on a course with ~1000 modules). This check is
redundant anyhow, since we already (in validate_prerequisites,
a ContextModule after_save) forbid a module from having any
prerequisites whose position is not less than the module's
position.

test plan:
 - in both the web and APIs,
   - verify you can still create prerequisites
   - verify you cannot create a prerequisite cycle
 - context_module_spec.rb "prerequisites=" tests still pass
 - deleting or reordering modules in a course with many modules
   should not be unreasonably slow

fixes CNVS-7769

Change-Id: I5ed4c31211cb3bdf50e8c7afe4a970a86da8d472
Reviewed-on: https://gerrit.instructure.com/23826
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: James Williams  <jamesw@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
2013-09-04 17:04:04 +00:00
Cody Cutrer cde9a6af2b add foreign keys part 6
refs CNVS-6202

Change-Id: I4bfab82db8beda12a8732adade302e6df76a2d75
Reviewed-on: https://gerrit.instructure.com/11535
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-04 16:46:41 +00:00
James Williams 69b6965d07 fix content tag progression id matching
fixes #CNVS-5868

Change-Id: I76d4e4a57b1cdd0194bac21033d034c1990f3a54
Reviewed-on: https://gerrit.instructure.com/23963
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
QA-Review: Hannah Bottalla <hannah@instructure.com>
2013-09-04 15:31:04 +00:00
Cameron Matheson b469af93cc make Assignment#group_students return distinct students
fixes CNVS-7823, CNVS-7847

Test plan:
  * enroll a student in multiple sections
  * make a group assignment
  * comment on the group assignment submission for the student with
    multiple sections
  * the student should receive one copy of the comment (not multiple)

Change-Id: I26f44ef054fdb136f180c949d0676fc0168827a8
Reviewed-on: https://gerrit.instructure.com/23886
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
2013-09-03 23:09:18 +00:00
Mark Severson 932bd3dc0e fix legacy wiki front page behavior
test plan:
 - in a course with no pages (new course is best)
 * manually update the course object:
   * set default_view to 'wiki'
 * manually update the course's wiki object:
   * set front_page_url to nil
   * set has_no_front_page to true
 * navigate to the course home page
 - there should not be an error on the page

fixes CNVS-7744

Change-Id: I047db32d2fa7a376be994a1314c0e55a0cadffde
Reviewed-on: https://gerrit.instructure.com/23751
QA-Review: Hannah Bottalla <hannah@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
2013-09-03 19:27:02 +00:00
Josh Simpson ee1837fc74 fix system time exploitation of quiz timing
fixes CNVS-6858
Adds Submission#time_left and implements it within
QuizSubmissionController#backup. JavaScript syncs with server
timer.

test plan:
1. Take timed quiz
2. Note that time left timer is working
3. Change system time
 - time left timer shouldn't change

Change-Id: I3d67cb2a983dfb8f7bf762a6c980b35bb12657fc
Reviewed-on: https://gerrit.instructure.com/23879
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Myller de Araujo <myller@instructure.com>
Reviewed-by: Derek DeVries <ddevries@instructure.com>
Product-Review: Josh Simpson <jsimpson@instructure.com>
2013-08-30 22:45:17 +00:00
Simon Williams a8fb912d02 update all rubric associations when data changes
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>
2013-08-30 21:28:25 +00:00
Stanley Stuart eee237a933 only queue quiz regrade jobs if there are current question regrades
Stops an egregious amount of delayed jobs from being created due to the
Quiz model's callback that naively created jobs if there weren't
unpublished changes. Now it only creates the job if there are quiz
question regrades available for the current version of the quiz.

fixes CNVS-7838

Change-Id: I2a4e46735a063f74c3bf83b25aff3d326b68292c
Reviewed-on: https://gerrit.instructure.com/23916
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Myller de Araujo <myller@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
Product-Review: Stanley Stuart <stanley@instructure.com>
2013-08-30 21:18:54 +00:00
Jeremy Stanley fc5de0f52d touch module outside content_tag save txn to prevent deadlock
fixes CNVS-7757

test plan:
  - open two Rails consoles
  - in each, create a bunch of items in the same
    module at the same time, e.g.

    mod = ContextModule.last
    100.times do |x|
      mod.add_item type: 'context_module_sub_header',
                   title: "item #{x}"
    end
  - each console should finish adding its items

 or, when deployed in a production-like environment
 (with multiple app servers, or at least a multithreaded server)
  - generate a curl command line to add an item to a module
    (works with a subheader, so you don't need corresponding
    assets)

    curl -H "Authorization: Bearer {token} \
      https://<canvas>/api/v1/courses/XXX/modules/YYY/items \
      -F module_item[title]=newthing -F module_item[type]=SubHeader &

    (the trailing &, after a space, means run in the background;
     that is, don't wait for the preceding request to finish
     before returning to the command line)
  - run the preceding command several times in rapid succession
    (up, enter, up, enter, etc.)
    (I was able to reproduce in less than 10 requests)
  - look at the json blocks returned, and make sure none of them
    are an internal server error (if they are, there will be an
    error report number you can look up and see if the deadlock
    happened)

Change-Id: I63834cfd98393e5207625db27d18451103aa2944
Reviewed-on: https://gerrit.instructure.com/23783
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2013-08-30 16:34:33 +00:00
James Williams 93fb3b95d2 copy wiki front page setting
test plan:
- account-level draft state => disabled
  * create a course
  * set a custom wiki page as the home page
  * copy the course
  * the new course's home page should be the copied front page

  * copy the original course again
  * selectively omit copying the front page
  * the new course's home page should be an empty front page

- account-level draft state => enabled
  * create a course
  * set a custom wiki page as the home page
  * copy the course
  * the new course's home page should be the copied front page

  * copy the original course again
  * selectively omit copying the front page
  * the new course's home page should be the dashboard

fixes #CNVS-7774

Change-Id: If9987cad55f069a2803002de611ecb0d81b2ebc5
Reviewed-on: https://gerrit.instructure.com/23788
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
QA-Review: Bracken Mosbacker <bracken@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2013-08-30 12:34:49 +00:00
Jacob Fugal 1c95097139 replace SisBatch#api_json with standard #as_json
refs CNVS-7597

test-plan: N/A

Change-Id: Ia8f25ff10345f9e26b7b5519f6622c42dc8d73ce
Reviewed-on: https://gerrit.instructure.com/23648
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
QA-Review: Jacob Fugal <jacob@instructure.com>
2013-08-29 22:39:45 +00:00
Jacob Fugal 34f5a5c1f1 per-instance json serialization methods/excludes
refs CNVS-7597

allows streamlining some previously overridden to_json methods

test-plan: N/A

Change-Id: I401500d4fef301c8cdae455d4f71a130e2764108
Reviewed-on: https://gerrit.instructure.com/23645
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
QA-Review: Jacob Fugal <jacob@instructure.com>
2013-08-29 22:39:17 +00:00
Bracken Mosbacker 60650da3a0 correctly check for syllabus body flag on course copy
The import code was checking the wrong property

Test Plan:
 * do a selective course copy
 * the syllabus body should copy

closes CNVS-7410

Change-Id: I70f858383f635b8ebe46287f3c94153ebe7eb00f
Reviewed-on: https://gerrit.instructure.com/23852
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: James Williams  <jamesw@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
2013-08-29 17:50:21 +00:00
Jacob Fugal 1949a8b9e2 simplify OpenStruct/OpenObject json serialization
refs CNVS-7597

I could not find any instances of as_json being called directly (i.e.
not by to_json or the recursion in as_json). I could not find any
existing instances of nested OpenObjects (i.e. to trigger the recursion
in as_json). And it appears to me that we'd want the same object_type
"scoping" that to_json was doing even in a nested OpenObject#as_json. So
I move the object_type scoping from to_json to as_json; at this point,
to_json matched Object#to_json, and could be removed.

I introduce OpenStruct#as_json for consistency and to get rid of the
bare calls to OpenStruct#table in OpenObject#as_json.

With the recent change to Time#as_json, that branch in as_json can also
be simplified to value.as_json.

But the as_json calls on the subobjects are unnecessary; when the result
of the top-level as_json is json-encoded (through to_json), each element
will go through the appropriate ->as_json->to_json transformations as
well. So the .as_json calls can be dropped, and as_json (modulo the
object_type scoping) just becomes a call to table -- which is the
superclass' as_json. Handy!

test-plan: N/A

Change-Id: I783f1d3fbdcc6d71518c5f0f2d60a1faecc0c2fb
Reviewed-on: https://gerrit.instructure.com/23646
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
QA-Review: Jacob Fugal <jacob@instructure.com>
2013-08-29 16:44:13 +00:00
James Williams 33570f6913 keep question and answer comments editable on copy
test plan:
* create a multiple-choice question in a quiz or question bank
* add comments to the question and answers
* copy the course
* edit the new question
* make sure that the comments are editable

fixes #CNVS-318

Change-Id: Id4b7f13b28fa6602653b65b1e2b44f00f1cac394
Reviewed-on: https://gerrit.instructure.com/23795
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
QA-Review: August Thornton <august@instructure.com>
2013-08-29 15:49:09 +00:00
James Williams fb09ce461c import assessment questions and banks only for selected quizzes
test plan:
* import the package referenced in the ticket
* only select certain quizzes
* confirm that question banks are created only
for those quizzes that you selected

fixes #CNVS-7633

Change-Id: Ib19eef3fc0e69b56e1cb0eab89938e24c13bfa4b
Reviewed-on: https://gerrit.instructure.com/23584
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
QA-Review: August Thornton <august@instructure.com>
2013-08-29 15:24:54 +00:00
James Williams d44247c2d5 remove unnecessary to_scrape settings from migrations
Change-Id: Id6bd50d11b8de35f803621ecc9accd83354ad2c3
Reviewed-on: https://gerrit.instructure.com/23895
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-08-29 14:04:13 +00:00
Cody Cutrer 00d5829fdc make group category assignments query fast
include conditions on the context, so it can use that index

test plan:
 * have at least one student in a course
 * create a new group category
 * it should work

Change-Id: I793d42a8838872eee407a3ba19362c14940f2d47
Reviewed-on: https://gerrit.instructure.com/23876
Reviewed-by: Jacob Fugal <jacob@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2013-08-28 22:39:32 +00:00
Stanley Stuart dfb665fc03 don't show speedgrader for unpublished assignments and quizzes
Hides SpeedGrader links and redirects to the show page for an assignment
or quiz that is "unpublished" and its context is draft state enabled.

test plan:
  - Make sure you have draft state enabled for your account.
  - Create an assignment and a quiz. Ensure the following:
    - The SpeedGrader link is not visible on page load when the item is
      unpublished.
    - The SpeedGrader link is visible on page load when the item is
      published.
  - For the assignment show page only:
    - Toggling the item's published state using the publish button
      should show/hide the SpeedGrader link appropriately.
  - Republish the quiz and assignment. Save their SpeedGrader urls
    somewhere handy. Now unpublish both of them again. Try to visit each
    url. You should be redirected back to the item's show page with a
    friendly flash message indicating that SpeedGrader is only available
    for published assignments.
  - Create a discussion topic that can be graded.
    - Unpublish it from the assignments index page.
    - On its show page, you should not see a link to speedgrader under
      admin links.
    - Republish it.
    - On its show page, you should see a link to speedgrader under
      admin links.
  - Clicking "publish" on the assignments index page should toggle the
    published status on the quiz show page, and vice versa.

Also creates a useful "enable_draft!" method on the Account model for
an easy way to enable draft state on an account rather than repeating
the setup code over and over again in various places.

fixes CNVS-7194

Change-Id: If3880c0439f3a6e63f59417c55e0e0f617c3c5ce
Reviewed-on: https://gerrit.instructure.com/23805
QA-Review: Myller de Araujo <myller@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
Product-Review: Stanley Stuart <stanley@instructure.com>
2013-08-28 21:58:11 +00:00
Jacob Fugal 20deb08ad6 run messageable user queries on the slave
test-plan:
 - all regression tests around messageable users work as before
 - queries should go to slave instead of master db

Change-Id: I272f11d02ef58ed1f120fb01601d595cd45431c9
Reviewed-on: https://gerrit.instructure.com/23459
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
2013-08-28 20:37:23 +00:00
Cody Cutrer 68fb776f68 cache plugin settings indefinitely
refs CNVS-7802

Change-Id: I55a266f758ae632ad889cb8a05de5ca0153af2c4
Reviewed-on: https://gerrit.instructure.com/23840
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>
2013-08-28 20:32:26 +00:00
Simon Williams 6d84248ddd show rubrics as aligned items to outcomes
fixes CNVS-7272

test plan:
- create a rubric with an outcome
- go to the outcome page, you should see the rubric listed as an aligned item
- try to delete the outcome
  it should fail
- remove the outcome from the rubric
- go back to the outcome page, and the rubric should no longer be listed as
  aligned
- try to delete the outcome again
- it should succeed
- also try this with outcomes imported from accounts

Change-Id: I3242befc987e2b92f98125cbfb6d32f293cdb9d1
Reviewed-on: https://gerrit.instructure.com/23531
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>
2013-08-27 20:33:41 +00:00
Simon Williams b0be0437fb fix join query with find_each
fixes CNVS-7767

test plan
 - run sis import in batch mode
 - should remove enrollments not included for term

Change-Id: I556c4fdf6dc093da61a86322f69d3be3175a803c
Reviewed-on: https://gerrit.instructure.com/23772
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2013-08-27 19:17:55 +00:00
Cody Cutrer 369dfd88ae create progressions on the master
Change-Id: Ia55a449117242f88a6d90ca4647efd5380476e37
Reviewed-on: https://gerrit.instructure.com/23791
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2013-08-27 19:14:08 +00:00
Brian Palmer cc923e370d strand up ContextModule#update_downstreams
Change-Id: Ifbfac378e96a89688591225f91d084f107d601a9
Reviewed-on: https://gerrit.instructure.com/23762
Reviewed-by: Zach Wily <zach@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
Product-Review: Brian Palmer <brianp@instructure.com>
QA-Review: Brian Palmer <brianp@instructure.com>
Tested-by: Brian Palmer <brianp@instructure.com>
2013-08-26 23:27:18 +00:00
Stanley Stuart 7bd255ebd5 fix quiz regrading in production environments
Fixes a bug where the way DelayedJob would set up the quiz regrading job
would find the quiz by its id, not by the passed "version" of the quiz
(which was acquired by quiz.versions.first.model).

Also makes QuizRegrader take a hash for the constructor instead of
separate arguments due to the many combinations of options.

QuizRegrades now always happen in a delayed job, regardless of which
environment Canvas is running in.

test plan:
  - in a production environment, test quiz regrading
  - it should update the student view and teacher views

fixes CNVS-7639

Change-Id: If0ba155f8b285c4f66c4ffec010bef2c973e1001
Reviewed-on: https://gerrit.instructure.com/23745
Reviewed-by: Derek DeVries <ddevries@instructure.com>
QA-Review: Myller de Araujo <myller@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Stanley Stuart <stanley@instructure.com>
2013-08-26 20:37:04 +00:00
Cody Cutrer 4550e79b19 fix upcoming_events on slave
Change-Id: I638038c1ab50af816ab28b66a79c2be2696a5079
Reviewed-on: https://gerrit.instructure.com/23743
Reviewed-by: Brian Palmer <brianp@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Tested-by: Cody Cutrer <cody@instructure.com>
2013-08-26 18:49:36 +00:00
Cody Cutrer efb46dd0c6 make sure FOR UPDATE queries are on master
Change-Id: I89874d260cffbfa749779345b942a29a11e14b22
Reviewed-on: https://gerrit.instructure.com/23742
Reviewed-by: Brian Palmer <brianp@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Tested-by: Cody Cutrer <cody@instructure.com>
2013-08-26 18:46:58 +00:00
Brian Palmer 04cb3bca49 cache max_messages_per_day_per_user setting
Change-Id: If4a20cba4789904f72c5495e3b54e04a1c7d7d39
Reviewed-on: https://gerrit.instructure.com/23735
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Tested-by: Cody Cutrer <cody@instructure.com>
2013-08-26 17:55:50 +00:00
Cody Cutrer a8596e9b68 cache some settings
we can SIGHUP if we ever change them

Change-Id: I0e7d0fa63ce0e368e890eb7ea8d5e657fa3820a1
Reviewed-on: https://gerrit.instructure.com/23729
Reviewed-by: Zach Wily <zach@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
QA-Review: Rob Orton <rob@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
Tested-by: Cody Cutrer <cody@instructure.com>
2013-08-26 17:54:56 +00:00
Cameron Matheson 8dcc790c69 make submission uploads support group commenting
closes CNVS-6879

Test plan:
  * make a group assignment
  * submit homework for some groups
  * download the submissions
  * upload the submissions
  * the uploaded attachments should have gone to each student in the
    group

Change-Id: Ia2d95eb13b75803c184441bb07ec853bf75e4938
Reviewed-on: https://gerrit.instructure.com/23661
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
Product-Review: Cameron Matheson <cameron@instructure.com>
2013-08-23 23:38:36 +00:00
Simon Williams 26214e33a4 fix existing out of sync outcome alignments
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>
2013-08-23 23:27:09 +00:00
James Williams 4f23cbd214 copy discussion topic require_initial_post attribute
test plan:
* create a discussion topic
* require 'Users must post before seeing replies'
* copy the course
* copied topic should still retain option

fixes #CNVS-2690

Change-Id: I2621b5a384c30152dc318a3553cd18d4494039f3
Reviewed-on: https://gerrit.instructure.com/23693
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Hannah Bottalla <hannah@instructure.com>
2013-08-23 22:26:51 +00:00
Cameron Matheson ab529cee8d add tests for Assignment#generate_comments_from_files
refs CNVS-6879

Change-Id: Iada892f9e518e86f7fbe73834d7675beb7d0c7c9
Reviewed-on: https://gerrit.instructure.com/23622
Reviewed-by: Simon Williams <simon@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Cameron Matheson <cameron@instructure.com>
QA-Review: Cameron Matheson <cameron@instructure.com>
2013-08-23 20:34:43 +00:00
Mark Ericksen 30fb087d37 prevent text overflow for user_profile.title
fixes CNVS-3370

testing steps:
- on a user's user profile page (/about/<user_id>),
  set the "Title" to something longer than 255 characters
- verify prevented from updating and the
   error message says: "Title is too long"
- verify still prevented from saving when user has cleared
  the "Name" input

Change-Id: I20a10edfe747d558460ee268a40a8f88a22c6514
Reviewed-on: https://gerrit.instructure.com/23635
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
Product-Review: Marc LeGendre <marc@instructure.com>
QA-Review: Marc LeGendre <marc@instructure.com>
2013-08-23 20:05:19 +00:00
Joel Hough 0348f84d8e add included messages and recipients to add_message endpoint
fixes CNVS-7676

test plan
- use the add_message endpoint to add a message, including
 recipients that weren't in the conversation and some included
 messages
- ensure that the new recipients are added to the conversation
 and can see the new message as well as the included messages
- add a message that excludes some recipients who are already
 conversation participants
- ensure that the excluded participants cannot see the new message

Change-Id: Id4f1ed741514c16cdafd81609d82e5c66aae85ac
Reviewed-on: https://gerrit.instructure.com/23627
Reviewed-by: Jon Willesen <jonw@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Clare Strong <clare@instructure.com>
Product-Review: Joel Hough <joel@instructure.com>
2013-08-23 19:45:55 +00:00
James Williams b2831bc66d add timeout for bulk media upload on import
closes #CNVS-7659

Change-Id: Iab61b5391e6d63ee39e2aeffe333b78f770af073
Reviewed-on: https://gerrit.instructure.com/23561
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-08-23 19:11:27 +00:00
Cody Cutrer a544fc8f32 only recompute due dates once after assigning group members
test plan:
 * set up a group assignment, with a few groups
 * set up a due date override for a single group
 * automatically assign all unassigned students
 * student in the group with an override should have the
   correct due date

Change-Id: Id80014b0a0d5aea1f29a20fcb0aec83a41ec9492
Reviewed-on: https://gerrit.instructure.com/23596
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2013-08-23 16:51:37 +00:00
Mark Severson cbd3641281 change pages to allow context-based draft state
test plan:
 - with draft state disabled and allow draft enabled for the account
   - account.settings[:enable_draft] = false
   - account.settings[:allow_draft] = true
 * enable draft state for the course
   - course.enable_draft = true
 * click on the 'Pages' tab in the course
   - the new pages UI should be shown
 * disable draft state for the course
   - course.enable_draft = false
 * click on the 'Pages' tab in the course
   - the legacy pages UI should be shown

Change-Id: If5d180e18451ec559d12b18784263b4ff92a754d
Reviewed-on: https://gerrit.instructure.com/23581
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2013-08-22 21:18:49 +00:00
Jon Willesen 6f814dd13e add_recipients should exclude messages this user has not seen
with new conversations, not every conversation participant will
see every message. when a user adds a participant to a
conversation in the old interface, the new participant should
only see the messages that the user adding them has seen.

whether a user has seen a message is determined by whether they
have a conversation message participant, which were recently
changed to be soft deleted instead of hard deleted.

fixes CNVS-7653

test plan:
 - in the old interface, create a group conversation with at
   least 3 messages.
 - for one of the users, delete one of the messages using the
   old interface (this will be a soft delete).
 - hard delete another one of the messages using the console:
   u = User.find(<user id>)
   m = ConversationMessage.find(<message id>)
   c = u.conversations.where(conversation_id: <conversation id>)
   c.first.delete_messages(m)
 - refresh the old conversation interface. This user should only
   see one of the three messages now (one was soft deleted, and
   one was hard deleted).
 - using the old interface, add a new user to the group
   conversation.
 - switch to the new user's view of the conversation. they
   should see two messages in the conversation: the remaining
   message and the soft deleted message. the hard deleted
   message should not be visible.
 - otherwise, conversations should behave as they used to.

Change-Id: I5a8c9ff371c2b2877b08c1480261200e0d0b28a3
Reviewed-on: https://gerrit.instructure.com/23579
Reviewed-by: Zach Pendleton <zachp@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Cam Theriault <cam@instructure.com>
Product-Review: Jon Willesen <jonw@instructure.com>
2013-08-22 20:52:56 +00:00
Jeremy Stanley 82e62e0d56 module sequence api
test plan:
 - consult the API documentation for the new Get Module Item Sequence
   endpoint, and also the Module Item Sequence return type
 - test retrieving the sequence information of a module item
   of each type
   - the ModuleItems for the prev, current, and next items
     in the sequence should be returned
   - any Modules referenced should also be returned
     (e.g., there should be three of them if you're testing
     on an item that is the only item in its module,
     and previous and next items in other modules exist)
 - verify that no more than 10 item sequences are returned
   when an item appears in modules more than 10 times
 - test as a student, ensuring that unpublished modules
   and unpublished module items are excluded from the results

fixes CNVS-7616

Change-Id: I75365dc3f169d35767525686815f9cd93e595bdb
Reviewed-on: https://gerrit.instructure.com/23578
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
QA-Review: Hannah Bottalla <hannah@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2013-08-22 20:30:28 +00:00
James Williams 9703389fa3 fix selective content with numerical migration ids
test plan:
* import the package referenced in the ticket with
'select content' checked
* select particular modules to import
* should import as expected

fixes #CNVS-7631

Change-Id: Ic3865a4c499e30ad544b1bab7d17001444a2ea88
Reviewed-on: https://gerrit.instructure.com/23497
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
QA-Review: August Thornton <august@instructure.com>
2013-08-22 19:58:24 +00:00
Cody Cutrer 229abad7f2 optimize CrocodocDocument.update_process_states
there is an index on process_states, but postgres can't use it cause
find_in_batches is ordering by id. so use the slave instead, which
allows (nay, forces) using a cursor, and no ordering, so postgres
can use it's index. (still do updates on the master)

Change-Id: I6f7a18f7ffa7a1a1971e4eb5195af890e2038fbd
Reviewed-on: https://gerrit.instructure.com/23593
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2013-08-22 19:12:15 +00:00
Mark Ericksen 314e1423a4 add model and javascript validations for accounts
fixes CNVS-3047

testing steps:
- create a new account
- edit the account and remove the "Account Name"
  try to save and verify an error displays
- edit the account name and make it longer than 255
  and verify it displays it is too long

Change-Id: I9437a16ea5f897a7ee214dcdb3b453599f99c1f7
Reviewed-on: https://gerrit.instructure.com/23465
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
Reviewed-by: Landon Wilkins <lwilkins@instructure.com>
Product-Review: Marc LeGendre <marc@instructure.com>
QA-Review: Marc LeGendre <marc@instructure.com>
2013-08-22 17:40:06 +00:00
Cody Cutrer 7c8623e9a3 optimize question bank importing
same idea as the quiz question import optimization - don't send a
huge list of strings to the database, and get a huge blob back, when
 we can exchange much less information to accomplish the same thing

test plan:
 * import a course with a question bank
 * it should work

Change-Id: I73d57cbbd600ac7c13618dc5b1dcfcef3bb92484
Reviewed-on: https://gerrit.instructure.com/23448
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2013-08-22 15:29:47 +00:00