Commit Graph

429 Commits

Author SHA1 Message Date
Cody Cutrer 5631eb41ec cache account_users by id, not object
the object is likely @current_user, which probably has lots of stuff
preloaded on it, and if the course gets cached out-of-process, it
will be lots more than we want serialized (and could cause weird
deserialization loops)

Change-Id: I815791ccc194ce285fd6573e4c97bfe7608048a8
Reviewed-on: https://gerrit.instructure.com/31433
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Anthus Williams <awilliams@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2014-03-07 21:13:47 +00:00
Rob Orton 1be0a2db95 add unique index to enrollments users per section
index should be unique per user, section, role,
type, and associated_user_id

fixes CNVS-7698
fixes CNVS-7700

test plan
 - add duplicate enrollment in script console
   - run migrations
   - duplicates should be removed
   - attempt to add duplicate enrollment in console
   - duplicate enrollment should fail
 - test user merge with conflicting enrollments
 - test creating, deleting, and restoring enrollments
 - enrollment regression testing

Change-Id: I0fb600ba6ff98054f71dc41a8519680413507494
Reviewed-on: https://gerrit.instructure.com/30986
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2014-03-06 22:20:30 +00:00
Cameron Sutter 78a7d26d91 remove :includes => :quiz_submission
fixes CNVS-9933

test plan:
 - basic regression on the following:
   - teacher activity pages
   - gradebook pages
   - grades page
   - gradebook upload
   - changing due dates on assignments
   - submissions api
   - assignments api
 - sorry

Change-Id: I7bb4c32a74b159565772da8ee1d5a43e27369ca0
Reviewed-on: https://gerrit.instructure.com/30367
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Mike Nomitch <mnomitch@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2014-03-01 01:46:22 +00:00
Raphael Weiner 644b29d12f extract auto_handle to new canvas_uuid gem
Change-Id: Ic226e61e900532cc3acf08444b316b6e2bb6b368
Reviewed-on: https://gerrit.instructure.com/30049
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2014-02-25 19:30:59 +00:00
Eric Adams afe2e87acb allow setting start_at, end_at for enrollments api
fixes SIS-160

Test Plan
---------
  - Create an enrollment via the api with start_at and end_at parameters
  - verify start_at and end_at are poplutated for resulting record in enrollments table
  - verify user can only access course during start_at and end_at times

Change-Id: Icfeaded1f43c6b0309d41280d7caa17482b9182e
Reviewed-on: https://gerrit.instructure.com/30136
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Ken Romney <kromney@instructure.com>
Reviewed-by: Duane Johnson <duane@instructure.com>
Product-Review: Duane Johnson <duane@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
2014-02-14 23:37:29 +00:00
Michael Nomitch 36de188de0 remove test student scores from assignment data
fixes CNVS-10570
fixes CNVS-11104

test plan:
  - as a teacher enter in scores for students and a test student
  - make test student grade the hightest (not tied)
    - on the grades page, in assingment stats, the test student score shouldnt show up
  - make test student grade the lowest (not tied)
    - on the grades page, in assingment stats, the test student score shouldnt show up
  - on the grades page, test student score shouldnt change the average

Change-Id: I9916a999cf7db4872b09d03e8e14883503025d96
Reviewed-on: https://gerrit.instructure.com/29091
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Reviewed-by: Matthew Irish <mirish@instructure.com>
Reviewed-by: Cameron Sutter <csutter@instructure.com>
Product-Review: Mike Nomitch <mnomitch@instructure.com>
2014-02-14 18:09:27 +00:00
Cody Cutrer a389fd18c1 rails 3 doesn't auto-require csv, so require it where necessary
Change-Id: Id76980c82024a082855f5b7b5b60cd7e760730a9
Reviewed-on: https://gerrit.instructure.com/30132
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Derek DeVries <ddevries@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2014-02-14 16:04:34 +00:00
Jacob Fugal a2c3dc44fc rename skip_callback->suspend_callbacks
refs CNVS-9522

in rails3 ActiveRecord::Base.skip_callback is a real thing that doesn't
do what this does. because of load order, ours happens, but it would be
nice to leave the other available.

to simplify the switch, both suspend_callback and suspend_callbacks are
kept as renames, but suspend_callback should not be used, preferring
suspend_callbacks. suspend_callback will go away in the near future.

skip_callback is temporarily added back in as an alias to
suspend_callback to allow time for fixing a plugin that uses
skip_callback. it will be removed as soon as that plugin is updated.

Change-Id: Iaefd16dde3b6ce575780cb8f721dc826258eef4e
Reviewed-on: https://gerrit.instructure.com/29808
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Nick Cloward <ncloward@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
QA-Review: Jacob Fugal <jacob@instructure.com>
2014-02-11 23:14:41 +00:00
Cody Cutrer de9bd8b898 fix files controller for rails 3 specs
* don't use respond_to if json is the only possible format
 * when filtering scribd_doc, rails 3 serializes as a hash with
   string keys, as opposed to a HashWithIndifferentAccess, so
   delete with string key
 * don't use StringIO as an uploaded file; Rails 3 TestCase will
   call to_param on it
 * don't require the .:format part of the public_url route

Change-Id: I282f529f1ee0941b52a996eefa01647a018f70d3
Reviewed-on: https://gerrit.instructure.com/29930
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: James Williams  <jamesw@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2014-02-11 16:04:43 +00:00
Raphael Weiner 6ae716da73 extracted html text helper methods into gem
test plan:
  * run specs

Change-Id: I8bd463396aee14853bdcf552eef144a509ffb62a
Reviewed-on: https://gerrit.instructure.com/29613
Reviewed-by: Zach Pendleton <zachp@instructure.com>
Product-Review: Zach Pendleton <zachp@instructure.com>
QA-Review: Zach Pendleton <zachp@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2014-02-07 20:11:19 +00:00
Michael Nomitch d4e95394ce allow displaing total grade as points for students
fixes CNVS-9874

when teacher choses to show total grade as points in GB2, a setting is saved
student grade summary page shows the total grade in same format
if assignment groups are weighted, grade is displayed as a percentage again

test plan:

  - new addition:
    - go to a course where GB2 is displaying totals as points BUT has no DB setting about show_point_totals
      (ask mike if you need help getting to this state)
    - as a student look at the grade summary page, total should be a percent
    - as a teacher in that class, go to GB2 and wait for 5 seconds
    - as that same student, go back to grade summary, total should be points now

  - as a teacher, change total grade to show as points in GB2
    - when you return to the GB, even from a new browser, this should be the same
    - in GB, tooltip should show points if cell shows percent, and visa vera
    - as a student in that class, you should see your total grade as points
      - grade tooltip should show points if cell shows percent, and visa vera
  - switch to weighted assignment groups
    - total grade as a teacher and student should switch back to percent
  - switch back to non-weighted
    - total grade should stay a percent until explicitly changed back to points

  - GB2 weighting and points/percent switching should have no unintended effects on the GB
  - student grade summary page should display everything in a consistent manner

Change-Id: Id0c4f496576c226eb7000d6684a37faf0b439359
Reviewed-on: https://gerrit.instructure.com/28780
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
Product-Review: Mike Nomitch <mnomitch@instructure.com>
2014-02-04 15:54:58 +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
Nathan Mills b9ddd5d5d1 enhance tabs get api, and add put api
fixes PS-969

test plan:
*the posistion should reflect the posistion displayed in the UI
*the visibility should reflect the visibility in the UI
*hidden should be set if the nav tab is hidden
*unused should be set if the nav item has no content
*you should be able to update a tabs position
*you should be able to set a tab to hidden
*you shouldn't be able to modify home, or settings tabs

Change-Id: I96beba411551ea0709ecf0e876c61d90b35b8482
Reviewed-on: https://gerrit.instructure.com/28093
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Adam Phillipps <adam@instructure.com>
QA-Review: Adam Phillipps <adam@instructure.com>
Reviewed-by: Brandon Broschinsky <brandonbr@instructure.com>
2014-01-28 21:18:28 +00:00
Joshua Simpson 1e81ea7caa move quiz into quizzes namespace as a precursor to enginifying
fixes CNVS-10679
this commit refactors quiz into a quizzes namespace. it contains various
shims to facilitate the data migration of polymorphic relationships
('Quiz' -> 'Quizzes::Quiz').  JIRA contains several tickets linked to
the above tickets in regards to removing these shims after the data
migration, as well as the strategies on reverting the shims once the
data migration is complete.
Change-Id: I30c566d60a87af6ee83e9d0041fdcb909ead6a89
Reviewed-on: https://gerrit.instructure.com/28573
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Derek DeVries <ddevries@instructure.com>
QA-Review: Myller de Araujo <myller@instructure.com>
Product-Review: Josh Simpson <jsimpson@instructure.com>
2014-01-24 00:08:46 +00:00
Jeremy Stanley 4cb084d4b7 don't create the default section in search_helper
test plan:
 - Create a course via SIS import or Accounts page
   (not via front page, since this will enroll you as a teacher)
 - Go to the settings page for the created course and verify
   no sections were created

fixes CNVS-10683

Change-Id: I4ee7296cf45b44335a5fc49d701951e079800b20
Reviewed-on: https://gerrit.instructure.com/29189
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
QA-Review: Nathan Rogowski <nathan@instructure.com>
2014-01-23 21:21:57 +00:00
James Williams 8a7d9d790a explicitly save course after migration for rails 3 compatibility
Change-Id: I3b2337e88c0b4717d76cd6735a82be0ededa0950
Reviewed-on: https://gerrit.instructure.com/29041
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2014-01-22 19:56:05 +00:00
Cameron Matheson b862ea30b6 add assignment group information to gradebook.csv
closes CNVS-9968

Test plan:
  Download gradebook.csv, it should include grades for each assignment
  group.  Points will be included for courses with  unweighted
  assignment groups (just like for current/final grades)

Change-Id: Ic47a4cd6cfb62726d3ec6e015b1d3ecfd71f79cc
Reviewed-on: https://gerrit.instructure.com/28579
Reviewed-by: Mike Nomitch <mnomitch@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
Product-Review: Cameron Matheson <cameron@instructure.com>
2014-01-21 21:14:37 +00:00
Cody Cutrer e535791b05 order instructor by id before touching
reduces deadlock situations

Change-Id: I46fae6a68de680b501739526304145a2d8445f08
Reviewed-on: https://gerrit.instructure.com/28862
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2014-01-20 17:08:17 +00:00
Mark Severson 0152fa52fa deprecate hide_from_students on wiki pages
hide_from_students is being deprecated in lieu of the workflow states
'active' (published) and 'unpublished'

test plan: (draft state and legacy)
  special attention should be given to areas related to hiding wiki
  pages from students (legacy: hide from students checkbox;
  draft state: published/unpublished items)

  items that are hidden from students or unpublished should show for
  teachers, but should not show for students

 - areas to test:
   - pages api and ui (regression)
     - validate hide_from_students and published values in all api calls
   - course migrations (specifically course copy)
   - wiki sidebar in other parts of canvas

fixes CNVS-10354, CNVS-10366

Change-Id: I70f4d8c07c2be4150163279f0673377bad6e9c48
Reviewed-on: https://gerrit.instructure.com/28375
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Nathan Rogowski <nathan@instructure.com>
QA-Review: Matt Fairbourn <mfairbourn@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
2014-01-15 21:29:06 +00:00
Cody Cutrer d5bb142adc fix deadlock on postgres < 9.3 enrolling users
Change-Id: I681b7c897b1118f6575e747328ab3930874f6558
Reviewed-on: https://gerrit.instructure.com/28292
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2014-01-14 22:42:45 +00:00
James Williams c86ea36c28 fix course appointment_participants association for rails 3
activerecord 3 tries to call course[:asset_string] which
returns nil because asset_string is not an attribute

Change-Id: Idb4c5da5ebf4fe2eec4946e991aa091d4bc01ce5
Reviewed-on: https://gerrit.instructure.com/28477
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2014-01-14 13:25:08 +00:00
Cody Cutrer b6338bb051 create default sections on master
Change-Id: I481ac52ac9367a1ab6d9a159c5d64d088e31d1cf
Reviewed-on: https://gerrit.instructure.com/28220
Reviewed-by: Rob Orton <rob@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2014-01-10 17:28:43 +00:00
Anthus Williams 08f41af26d cross-shard support for student interactions report
Activate the course's shard to retrieve teacher
enrollments, not necessarily the current shard

fixes CNVS-4450

Test plan:
- On shard A, create user A
- On shard B, create a course with one or more 
students and enroll user A as a teacher
- Log in as user A on shard A; navigate to /grades
- When you click "Student Interactions Report" you
should see the report (instead of a "this user is
not a teacher in this course" error)

Change-Id: I767c88ca1ebb27a33060dd1ba62aa2ffdd646da1
Reviewed-on: https://gerrit.instructure.com/28182
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Anthus Williams <awilliams@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Anthus Williams <awilliams@instructure.com>
2014-01-08 23:21:56 +00:00
Rob Orton ed12014bdb validate sis_id, section name and drop section_code
fixes CNVS-10147

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

Change-Id: I05ebdf3ae89ace4f737ae6c124f015efceafec1d
Reviewed-on: https://gerrit.instructure.com/27835
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2014-01-02 20:43:52 +00:00
Cameron Matheson b088c6beda custom gradebook columns api
closes CNVS-6906, CNVS-6475

Test plan:
  Use the new custom gradebook column apis to create/edit/delete custom
  gradebook columns, and set data for users in a course on those
  columns.

  only teachers/TAs should have permission to use these apis.

Change-Id: I658b8dc02d6104559c98a6b7e1be5c72e775d664
Reviewed-on: https://gerrit.instructure.com/27615
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Simon Williams <simon@instructure.com>
Product-Review: Cameron Matheson <cameron@instructure.com>
2013-12-26 17:45:40 +00:00
Zach Pendleton f5ee7dbfc3 remove tinychat code
fixes CNVS-10058

canvas no longer integrates with tinychat; this commit
removes legacy references to it.

test plan:
  * run specs

Change-Id: I4887e901d57ff39f8554af3e4eacd52ec4edd6e5
Reviewed-on: https://gerrit.instructure.com/27621
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Matt Fairbourn <mfairbourn@instructure.com>
Reviewed-by: Braden Anderson <banderson@instructure.com>
Product-Review: Zach Pendleton <zachp@instructure.com>
2013-12-18 22:51:45 +00:00
Rob Orton 22a699e885 validate the length of sis ids on the rails side
fixes CNVS-9902

test plan
 - set sis id to longer than 255 char
 - should not throw database error

Change-Id: If72466dc91c1ef48ac91b5e9d7a92bea62c88c50
Reviewed-on: https://gerrit.instructure.com/27164
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2013-12-10 18:20:50 +00:00
Jeremy Stanley 59a05a5bb9 don't create a section for student view unless no sections exist
fixes CNVS-6031

test plan:
 - create a course via the Account Settings page
   (not via the dashboard)
 - create a section in the course
 - go to student view in the course
 - leave student view
 - return to the course sections page. only the section you
   created should be there.

Change-Id: I7e86de6f27172454d3176c46f2cc986cade85a8b
Reviewed-on: https://gerrit.instructure.com/27059
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: James Williams  <jamesw@instructure.com>
QA-Review: Myller de Araujo <myller@instructure.com>
Product-Review: Jeff Fox
2013-12-06 23:39:07 +00:00
Jacob Fugal 34893f80bd remove uses of memoize
fixes CNVS-9331

instead, as appropriate, use one of (or a combination of, if necessary):

 * instance variable caching
 * Rails.cache
 * query caching (implicit)

also:

 * remove the buggy cc.active_pseudonyms (didn't account for
   sharding) in favor of cc.user.all_active_pseudonyms
 * streamline assignments in the menu to not need to construct method
   names

test-plan: N/A

Change-Id: Id0dec60464a283985e39493b90711b32cb5cca82
Reviewed-on: https://gerrit.instructure.com/26936
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
QA-Review: Jacob Fugal <jacob@instructure.com>
2013-12-06 22:03:24 +00:00
Michael Nomitch ad24eb77a9 moves test student to end of csv gradebook file
fixes CNVS-9268

added enrollments_for_csv method to course with test
moves test student enrollment to the end for enrollments array

test plan
- add multiple students to class
- add test_student to class
- download gradebook csv file
- ensure Test Student is the last student in the csv (and others are alphabetized)

Change-Id: Ic3dc92cf0a3e1da01e90fc270cb391bfa19c7fcd
Reviewed-on: https://gerrit.instructure.com/26745
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
Reviewed-by: Cameron Matheson <cameron@instructure.com>
2013-12-02 23:53:27 +00:00
Jeremy Stanley dcf3df456b move draft state under feature flag umbrella
fixes CNVS-9496

test plan:
 - draft state feature should show up in site admin feature
   flags, or root account feature flags when called as site
   admin
 - when site admin hits "allow" for the feature, it should
   appear in the root account administrator's settings
   in "Off" state
 - the root account admin should be able to "Allow" the setting
   which allows a sub-account or course to turn it on
 - when the feature is turned on via the Feature Settings tab
   or features API, draft state functionality should appear
   in the course wiki pages and elsewhere

Change-Id: Id7403f2a8371b0a7bfebffbb8f29330fff5c94c5
Reviewed-on: https://gerrit.instructure.com/26308
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Nathan Rogowski <nathan@instructure.com>
2013-11-26 20:43:49 +00:00
Jacob Fugal cd892fe723 clean up context.users_not_in_group
for rails3 and folio

fixes CNVS-8790

test-plan:
 - validate pagination of unassigned group members both for course
   groups and account groups

Change-Id: Ic9e842abdbfba714829a123ca0dee4f93e5a1fdc
Reviewed-on: https://gerrit.instructure.com/26534
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
2013-11-25 16:37:50 +00:00
Liz Abinante ae4c9def12 VDD rendering on assignments index
fixes CNVS-5860

test plan
* with draft state OFF
* in a course with 1 section
* create an assignment
* under advanced options, select the single section (usually course name)
* set the due date and save assignment
* verify that assignments index shows single date for students, teachers
* create a quiz
* under advanced options, select the single section
* set due date and save
* verify that quiz index shows single date for students, teachers
* verify that modules page shows single date for students, teachers

* with draft state OFF
* in a course with 2+ sections
* create a quiz and assignment with VDD
* verify that assignments and quiz index show 1 date for students
* verify that assignments and quiz index show multiple due dates for teachers
* verify that modules page shows "Multiple Due Dates" for observers with multiple students

Change-Id: Ie6b2f571eb7b344d40ca4ffda26e27d43778d17d
Reviewed-on: https://gerrit.instructure.com/26449
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cameron Sutter <csutter@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
Product-Review: Liz Abinante <labinante@instructure.com>
2013-11-22 21:09:11 +00:00
Ahmad Amireh 6b8d55a77b Controlling visibility of student quiz scores
Teachers can now control when, and for how long, students get to see the
correct answers to their quiz submissions.

The patchset introduces two new columns to Quiz and a CSS rework of the
quiz options form. See linked references for more info.

Quiz#show_correct_answers should no longer be directly accessed, use
Quiz#show_correct_answers? instead.

== Test plan

CAs stands for Correct Answers.

  - Create a quiz with 3 questions
  - Take the quiz as a student, and:
    - get 2/3 of the questions answered correctly
    - submit it

Case A - Showing CAs the moment the submission goes in:

  - Edit the quiz, and:
    - Tick the 'Let Students See Their Score Points' checkbox
    - Leave both date fields empty
    - Save quiz
  - Refresh student view
    - You should see the CAs

Case B - Showing CAs after some date:

  - Edit the quiz, and:
    - Tick the 'Let Students See Their Score Points' checkbox
    - Set the "Show Correct Answers At" to 3-days from now
  - Refresh student view:
    - You should not see the CAs
  - Edit the quiz, and:
    - Set the date to 3-days back
  - Refresh student view:
    - You should see the CAs

Case C - Hiding CAs after some date:

  - Edit the quiz, and:
    - Tick the 'Let Students See Their Score Points' checkbox
    - Set the "Hide Correct Answers At" to 3-days from now
  - Refresh student view:
    - You should see the CAs
    - You should see an alert that tells you the CAs will be hidden at
      the date you chose earlier
  - Edit the quiz, and:
    - Set the date to 3-days-back
  - Refresh student view:
    - You should no longer see the CAs
    - Alert should read that the answers stopped being visible as of the
      date you chose earlier

Case D - Creating a time-frame for showing CAs:

  - Edit the quiz, and:
    - Tick the 'Let Students See Their Score Points' checkbox
    - Set the "Show Correct Answers At" to yesterday
    - Set the "Hide Correct Answers At" to 3-days from now
  - Refresh student view:
    - You should see the CAs
    - You should see an alert that tells you the CAs will be visible
      between yesterday and 3 days from now
  - Edit the quiz, and:
    - Set the "Show At" date to tomorrow
  - Refresh student view:
    - You should no longer see the CAs
    - Alert should still tell you that the CAs will be visible starting
      tomorrow until 3 days from now

Case E - Choosing a bad range

  - Edit the quiz and:
    - Tick the 'Let Students See Their Score Points' checkbox
    - Set the "Show at" to tomorrow
    - Set the "Hide at" to today, or tomorrow
    - You should see an error-box

== Notes and really wild things

- http://docs.kodoware.com/canvas/cnvs-8103-take2
- http://docs.kodoware.com/canvas/cnvs-8103 (legacy changes)

refs CNVS-8103, CNVS-9386

Change-Id: Ib241ee5f143b87164105b7541aadac00f38f79ad
Reviewed-on: https://gerrit.instructure.com/25505
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Myller de Araujo <myller@instructure.com>
Reviewed-by: Derek DeVries <ddevries@instructure.com>
Product-Review: Derek DeVries <ddevries@instructure.com>
2013-11-20 22:08:21 +00:00
Jeremy Stanley 0e075a24b4 feature flags infrastructure and API
test plan:
 - install the test_features plugin (since no real features exist yet)
 - render and consult the feature flags documentation
 - have a test environment with a root account,
   sub-account, course in sub-account, and user

 - Use the "list features" endpoint as a root account admin
   (with no site admin privileges), on the root account context, and
   confirm that hidden features do not show up
 - Use the "list features" endpoint as a site admin user,
   on the root account context, and confirm that hidden features
   show up
 - Use the "list features" endpoint on the site admin account
   and confirm the hidden features show up

 - Use the "set feature flag" endpoint on a hidden feature on site
   admin and ensure the feature becomes visible in all root accounts
 - Use the "set feature flag endpoint" on a hidden feature on a
   single root account, and ensure the feature becomes visible to
   that root account and not others

 - Confirm that root_opt_in features appear "Off" by default
   in root accounts, after being "Allowed" in code or site admin

 - Confirm a feature flag that is set to "on" or "off" (vs. "allowed")
   cannot be overridden in a lower context (and the API returns
   locked=true for them)

 - Confirm that setting locking_account_id requires admin rights
   in the locking account
 - Confirm that a feature flag with locking_account_id cannot be
   changed without admin rights in the locking account (e.g.,
   set a feature flag on a course, locked with the root account's id,
   and make sure a teacher who is not an account admin can't change it)

 - Confirm feature flags can be deleted with the "remove feature flag"
   endpoint (and they are only deleted where they are defined, not
   when called on an object that inherits a flag)

Change-Id: I3e12e23b4454889b6e8b263f1315e82d8f2ada52
Reviewed-on: https://gerrit.instructure.com/25502
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Matt Fairbourn <mfairbourn@instructure.com>
Product-Review: Matt Goodwin <mattg@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
2013-11-19 20:50:03 +00:00
Jacob Fugal a5d8bb8041 limit fake_arel caveats to rails2
refs CNVS-4704

fake_arel gets us most of the way to rails3's arel, but with some
caveats. the workarounds (mostly) work in both, but it'll be nice to not
have them crufting around when we're on rails3. so only use the
workarounds in CANVAS_RAILS2 branches.

Change-Id: Ia1f5cfa6b10f83cdb8d9a6e397b12401d180118d
Reviewed-on: https://gerrit.instructure.com/26331
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-11-19 19:46:30 +00:00
Simon Williams f614fa7c30 require assignment group on course creation
fixes CNVS-9038

Change-Id: I0e6997652be27571a98428339d6f9c1cbe12aa89
Reviewed-on: https://gerrit.instructure.com/25793
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Reviewed-by: Cameron Sutter <csutter@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2013-10-31 14:54:25 +00:00
Cody Cutrer 2ce439e40c support using a scope as a condition
just like Rails 3

Change-Id: I1a93a63a61ca553676533d303f03f2ee773b0371
Reviewed-on: https://gerrit.instructure.com/25702
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2013-10-30 20:02:30 +00:00
Cody Cutrer d1cf76c786 add "none" scope
forward compatible with Rails 4 where it's actually implemented
efficiently

Change-Id: I037b5dafbc26e0bf143c84831339fa36faba60be
Reviewed-on: https://gerrit.instructure.com/25682
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-10-29 20:25:45 +00:00
Jon Jensen a9d44ffd50 restyle new group management ui, fixes CNVS-8123
refer to mockups

test plan:
1. the UI should work
2. user/group counts and info should update correctly as you do stuff
3. the UI should look like the mockups

Change-Id: Ifbf90abadf00885790328b4338eb51a4ca4b8b6c
Reviewed-on: https://gerrit.instructure.com/24556
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Mark Ericksen <marke@instructure.com>
Product-Review: Marc LeGendre <marc@instructure.com>
QA-Review: Marc LeGendre <marc@instructure.com>
2013-10-25 19:28:07 +00:00
Rob Orton db130fd333 get rid of scribd_account
refs CNVS-8282

test plan
 - have scribd enabled
 - upload a scribdable document to a course
 - document should be rendered with scribd
 - previously created documents should still render

Change-Id: Id8d7ea962c7bbe16b0f124e23447c66a48dd4100
Reviewed-on: https://gerrit.instructure.com/25566
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2013-10-25 16:56:59 +00:00
Brandon Broschinsky 52a18830f7 grade post should update enrollment status if no post resource provided
grade posting should allow plugin to post grades as needed and
still allow for enrollment status to be updated if provided
from callback

refs PS-744

test plan
1. ensure existing grade exports post data correctly
2. ensure that grade exports updates enrollment status
correcly even if no post resource is provided.
3. see specs

Change-Id: I80215461d37355f9fef02e1b7e61528e81cb9c28
Reviewed-on: https://gerrit.instructure.com/25610
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Brandon Broschinsky <brandonbr@instructure.com>
QA-Review: Brandon Broschinsky <brandonbr@instructure.com>
2013-10-25 03:15:56 +00:00
Brandon Broschinsky dc2a4d38aa allow passing header params from grade export
refs PS-744

test plan:
 1. enable grade export plugin
 2. execute grade export
 3. grade exports shoud behave as usual
 4. see spec

Change-Id: I845ad84c9abf03d5b67897a76b39e8b7474fd8d1
Reviewed-on: https://gerrit.instructure.com/25473
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Adam Phillipps <adam@instructure.com>
QA-Review: Adam Phillipps <adam@instructure.com>
2013-10-23 13:51:32 +00:00
Jeremy Stanley 5773e05c3c avoid excessive update-cached-due-date callbacks
deleting a user could cause thousands of update-cached-due-dates
jobs to be enqueued (one per assignment per enrollment; in the
referenced ticket, the test student had 13 enrollments and there
were 88 assignments, yielding 1,144 jobs, causing the request
to time out).

fix this by
 (1) using a batch job to update all assignments in the course,
     instead of a job per assignment
 (2) when deleting a user with multiple enrollments in a course,
     only run the update cached due date job once per course

test plan:
 0. run in "production" configuration (i.e., in QA portal)
 1. have a course with 10 sections and 100 assignments.
    I suggest creating these in the console, e.g.

    course = course.create! name: "CNVS-8068"
    10.times { |x| course.course_sections.create! name: "section #{x}" }
    100.times { |x| course.assignments.create! name: "assignment #{x}" }

 2. enter student view mode in this course
 3. reset the student view student
 4. verify 1000 jobs were not created (and the request doesn't time out)

fixes CNVS-8068

Change-Id: If00dd3197b70df42b0f9ec18303b02594861f69f
Reviewed-on: https://gerrit.instructure.com/25160
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Matt Fairbourn <mfairbourn@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
2013-10-16 21:04:03 +00:00
Jeremy Stanley 5c7c0078f6 make course end_at override enrollment_term end_at
test plan:
1. have an enrollment term that has ended
2. have a course in that term whose end date is in the future
3. check that you can still add users to the course
   (the add-users button shouldn't have mouseover text that
   says you can't add users because the course is concluded)

fixes CNVS-2702

Change-Id: I52e0ca83f488f737c95e7f58d2e59be1187970f1
Reviewed-on: https://gerrit.instructure.com/25210
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Matt Fairbourn <mfairbourn@instructure.com>
2013-10-15 17:06:09 +00:00
Jacob Fugal 9b3bfbfeef avoid :conditions argument to find, count, etc.
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>
2013-10-14 19:29:27 +00:00
Cody Cutrer d935ab98b1 deprecate Setting.get_cached
now that we have SIGHUP, we were changing everything to it anyway,
so just let caching in-proc be the default

Change-Id: Id1b44722522ac9693b17695da7107c99a359d5ac
Reviewed-on: https://gerrit.instructure.com/25020
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>
2013-10-10 00:42:52 +00:00
Cody Cutrer 3bb5d7aa9d enable support for publishing grades for a limited list of users
test plan:
 * specs

Change-Id: I5335726eaae8abb245e13aaed04cf6947153b5c0
Reviewed-on: https://gerrit.instructure.com/24970
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-10-09 23:37:42 +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 266a89e7db use unicode sorting for ruby and db stuff
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>
2013-10-02 21:38:03 +00:00