Commit Graph

25 Commits

Author SHA1 Message Date
Stanley Stuart 37a46fd8e0 add "id" to "all_dates" in quiz and assignment APIs
Test Plan:
  - Make a quiz and an assignment. Add some assignment overrides to
    each.
  - Query the quizzes show API for the quiz you made. You should see
    an "id" field for dates in "all_dates" that came from
    assignment overrides. For the "Everyone Else" date, it should
    not have an "id" field but should have a "base" field with the
    value of `true`.
  - Query the assignments API for the same information for the
    assignment you made. The "id" field should be present for
    dates that came from assignment overrides. For the
    "Everyone Else field" date, it should not have an "id"
    field, but should have a "base" field with the value of
    `true`.

closes CNVS-11445

Change-Id: I4136b86673cf772149b7735c0fe9c6730ff32415
Reviewed-on: https://gerrit.instructure.com/30787
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Derek DeVries <ddevries@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Myller de Araujo <myller@instructure.com>
Product-Review: Stanley Stuart <stanley@instructure.com>
2014-02-27 21:57:04 +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
Simon Williams c12d8857fe destroy section overrides when crosslisting sections
overrides can get into an invalid state with crosslisting sections, where the
set_id representing the section no longer belongs to the same course as the
assignment.  in this case, we soft delete the overrides and make sure that the
validations for this case only include active overrides.

fixes CNVS-9382
fixes CNVS-9025

test plan:
- create Course A with two sections and Course B with one section
- in Course A, create an assignment with overrides for both sections
- crosslist one of the sections from Course A to Course B
- the assignment should no longer show the override for the crosslisted
  section, and you should still be able to edit and/or delete the assignment
- in Course B, created a new assignment with an override for the crosslisted section
- de-crosslist the section
- the assignment in Course B should no longer show the override for the
  de-crosslisted section, and you should still be able to edit and/or delete it

Change-Id: I1ff2cb6eb111da2474582f9ab413952b7e8dda20
Reviewed-on: https://gerrit.instructure.com/26835
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Reviewed-by: Stanley Stuart <stanley@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2013-12-04 19:43:54 +00:00
Cody Cutrer 6f2777352c update fake_arel
and re-pull-in with_scope from it, and re-apply our monkey patch

Change-Id: I8ca5362b382dc36d0ee7671fa97085d24c599ee3
Reviewed-on: https://gerrit.instructure.com/26708
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-12-04 16:25:39 +00:00
Jacob Fugal dfab0425e3 use CANVAS_RAILS2 for conditionals
rather than CANVAS_RAILS3 or Rails.version

this is to be consistent, and to reinforce that any "special" branches
are for rails 2.3 backwards compatibility while trying to target rails
3, rather than rails 3 "forwards compatibility".

Change-Id: I4494b65e3f71108a43d09032c1569c478646a828
Reviewed-on: https://gerrit.instructure.com/24998
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
QA-Review: Jacob Fugal <jacob@instructure.com>
2013-10-10 15:58:43 +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
Brian Palmer e3109f72bb fixes for due_date_cacher changes
* don't trigger cacher for quiz override changes
 * fix time expectation with to_i in dates_overrideable_spec
 * fix incorrect expectation in due_date_cacher_spec
 * remove defunct submission lateness fixup spec
 * fix expectation in gradebook selenium spec

Change-Id: I7e0905c06b965170da283a0216ed5c0d46b85cc5
Reviewed-on: https://gerrit.instructure.com/21349
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-06-10 20:17:06 +00:00
Jacob Fugal a771fe00ef replace submissions.late column with .cached_due_date
refs CNVS-5805

with efficient calculation of all due dates for any submissions for a
given assignment when related records (the assignment, its overrides,
related enrollments, and related group memberships) changes.

compares this cached due date to the submitted_at or current time when
determining lateness.

populates the column for existing submissions in a post-deploy
data-fixup migration.

test-plan:
  - run lib/data_fixup/initialize_submission_cached_due_date.rb
  - all submissions' cached_due_dates should be updated over several
    jobs
  - enroll a student in a course and create submissions in that course
    - create a second enrollment in a second section; the
      cached_due_dates for the user's submissions should recalculate
    - destroy the second enrollment; the cached_due_dates for the user's
      submissions should recalculate
    - create a group assignment
      - add the student to a group in the assignment's category; the
        cached_due_dates for the user's submissions should recalculate
      - remove the student from the group; the cached_due_dates for the
        user's submissions should recalculate
  - enroll more students in the course
    - change an assignment's due date; the cached_due_dates for the
      assignment's submissions should recalculate
    - create an override for the assignment; the cached_due_dates for
      the assignment's submissions should recalculate
    - change the due date on the override; the cached_due_dates for the
      assignment's submissions should recalculate
    - delete the override; the cached_due_dates for the assignment's
      submissions should recalculate
  - during any of the above recalculations:
    - the most lenient applicable override should apply
    - if the most lenient applicable override is more stringent than the
      assignment due_at, it should still apply
    - the assignment due_at should apply if there are no applicable
      overrides

Change-Id: Ibacab27429a76755114dabb1e735d4b3d9bbd2fc
Reviewed-on: https://gerrit.instructure.com/21123
Reviewed-by: Brian Palmer <brianp@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
QA-Review: Jacob Fugal <jacob@instructure.com>
Tested-by: Jacob Fugal <jacob@instructure.com>
2013-06-10 19:11:31 +00:00
Simon Williams d96ba9c601 finish removing course.publish_grades_immediately
this was removed from the UI in Mar 2011 but was never completely ripped out.
we'd like to remove it now since it was adding extra complexity for no benefit.

closes CNVS-5929
refs #3974

test plan:
- create/update/delete an assignment from the index page, and the show page
- grade an assignment (with and without muting)
- test assignment notifications (with and without muting)
  - creating an assignment
  - editing an assignment
  - changing a due date (after 3 hours of being edited)
  - grading an assignment

Change-Id: Ie455bed41154018b5bd2c9c0e69e1e3285a0ac09
Reviewed-on: https://gerrit.instructure.com/20778
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
QA-Review: Simon Williams <simon@instructure.com>
2013-06-04 18:11:08 +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
Cameron Matheson c270f93f8f touch assignment when saving overrides
fixes CNVS-4424

This invalidates some views that were being cached too long.

Test plan:
  * make sure config.action_controller.perform_caching is true
  * make an assignment with one due date
  * add a due date override via the api
  * make sure /courses/N/assignments shows 'Multiple Due Dates' instead
    of the original assignment due date

Change-Id: Ibc6e48cd7bf9457c3ff511987f6d7ca5a95d20c8
Reviewed-on: https://gerrit.instructure.com/18373
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
2013-03-15 15:47:30 -06:00
Stanley Stuart 49f952b1d5 make fancy midnight work for assignment overrides
also fixes an issue where some dates display as "Friday at 11:59pm" instead
of just "Friday"

Also does a little bit of refactoring and spec backfilling for the
override list presenter. The override list presenter now returns a much
more friendly list of "due date" hashes to the outside world to make it
easier to consume in views. Views don't have to format the dates by
passing in a hash anymore.

test plan:
  - specs should pass
  - as a teacher, create an assignment with overrides using the web
    form. In one of the overrides, enter a day like March 1 at 12am.
  - save the overrides
  - Make sure fancy midnight works for lock dates and due dates, but not
    unlock dates (12:00 am unlock date should show up as 12:00 am, not
    11:59 pm)
  - on the assignment's show page, you should just see "Friday", meaning
    that the assignment is due at 11:59 pm on March 1.
  - The "fancy midnight" scheme should work correctly for
    assignments,quizzes,and discussion topics, including the default due
    dates.
  - Be sure to check that the dates show up correctly on the
    assignment,quiz, and discussion show pages.
  - Be sure to make an override that has a blank due_at, lock_at, and
    unlock_at, but has a default due date, lock date, and unlock date.
    The overrides should not inherit from the default due date (fixes
    CNVS-4216)

fixes CNVS-4216, CNVS-4004, CNVS-3890

Change-Id: I8b5e10c074eb2a237a1298cb7def0cb32d3dcb7f
Reviewed-on: https://gerrit.instructure.com/18142
QA-Review: Amber Taniuchi <amber@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
2013-03-07 15:53:06 -07:00
Cody Cutrer 29e8550bb9 override automatic readonly-ness from AR
refs CNVS-3980

test plan:
 * using this scope should not return readonly objects

Change-Id: I60db54bcedebf3e045aac3f168c241676608eff0
Reviewed-on: https://gerrit.instructure.com/18077
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2013-03-01 10:41:08 -07:00
Stanley Stuart bb3b65395a add varied due date editor to quiz edit page
test plan:
  - new specs should pass
  - go through and make sure assignment overrides work
    for quizzes by using the editor on the quiz
    edit page.

fixes CNVS-469

Change-Id: I6b647575bb7db34235b2a1742558f6274b2605fc
Reviewed-on: https://gerrit.instructure.com/17437
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Myller de Araujo <myller@instructure.com>
2013-02-28 10:26:06 -07:00
Stanley Stuart fe4cbf8ee9 add varied due date functionality to the assignments edit page
closes CNVS-747

test plan:
  - go to the assignments edit page
  - you should be able to create new assignment overrides as a teacher
  - you should be able to update existing assignment overrides as a
    teacher
  - make sure you are able to delete assignment overrides
  - make sure that using the "add due date" button, you cannot add more
    overrides than the number of the sections of the course + 1 (the +1
    is for the due date representing everyone else.
  - make sure that you can not remove the last override when hitting the
    remove buttons to the right of overrides when you have more than one
    override.
  - make sure the remove button disappears when you only have one
    override, and reappears when you add an override.
  - ensure the dates you enter on this page propogate to the assignments
    show page and other areas of Canvas.

Change-Id: I974924797d9d4783c7f6ae93a25c356112fc0f54
Reviewed-on: https://gerrit.instructure.com/17342
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2013-02-12 13:23:22 -07:00
Joel Hough f15fd0bb2a make observers viewing discussions vdd lock date aware
fixes CNVS-518

also included:
- observers now get visible students' section overrides in their
  AssignmentOverride.visible_to scope
- fixed a bug where calling some DatesOverridable methods would
  use an overridden date where you wouldn't expect (see the specs)
- added a method to get the original object from an overridden one
- made DiscussionTopicPresenter handle due dates overridden to nil

test plan notes
- keep an eye out for regressions in displayed due dates
- discussion locking behavior should be as follows
-- viewing the discussion page before the earliest applicable
   unlock date should show a locked discussion page that lists
   the earliest unlock date
-- viewing the discussion after the earliest unlock date should
   show the discussion
-- the discussion page should show the due date when only one
   due date applies
-- the discussion page should show a "multiple due dates" ui when
   more than one due date applies
-- the "multiple due dates" ui should only display entries for
   sections that the observer's linked students are in
-- the "multiple due dates" ui should display lock dates from the
   associated section override or from the original assignment
   if the section override does not override lock dates

test plan
- check an observer not observing student
-- ensure that the discussion locking behavior behaves according
   to the observer's section's override
- check an observer observing one student
-- ensure that the discussion locking behaves according to the
   student's section's override
- check an observer observing multiple student's in more than one
  section
-- make overrides for each student's section that differ in due
   dates and lock dates
-- ensure that the discussion locking behaves according to the
   students' sections' combined lock dates
-- ensure that the discussion page shows a "multiple due dates"
   ui when the discussion is unlocked

Change-Id: I8f2970f0962cdc60cf9a423f01a876bf0ae909d4
Reviewed-on: https://gerrit.instructure.com/17452
Reviewed-by: Simon Williams <simon@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Marc LeGendre <marc@instructure.com>
Reviewed-by: Mark Ericksen <marke@instructure.com>
2013-02-08 16:30:20 -07:00
Cameron Matheson f842c4ba4c cache submission lateness
fixes #CNVS-1295

* Adds a new 'late' field to submissions
* Adds compute_lateness method to submissions which
  is called on every save when the 'late' field is nil
  or when the submission time changes
* Adds after_save callbacks to Assignment and
  AssignmentOverride to recompute lateness on submissions
  in a background process
* Includes data migration for initializing the value of the
  new cache field

Change-Id: I68d47fdbcbb167bef8428b6ecd48bf6f66ef8cb7
Reviewed-on: https://gerrit.instructure.com/16086
QA-Review: Amber Taniuchi <amber@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
2012-12-26 15:37:18 -07:00
Dave Donahue 3b3b746cca vdd backend for quizzes
[Fixes #CNVS-1145]

* Adds support for attaching AssignmentOverrides to quizzes
* Links common overrides for Assignments that belong to Quizzes
  so quiz.due_dates_for(user) == quiz.assignment.due_dates_for(user)
* Moves common functionality for VDD out of the Assignment model
  and into the DatesOverridable module, which is now included on
  Quiz for a consistent interface

Test plan:
* Run through a few of the old VDD scenarios and verify things
  still work as expected since a lot of code has shifted around
* No interface changes have been made to quizzes yet, so nothing
  to check there

  https://gist.github.com/f12b3694016f3dcc979e

Change-Id: I32b4a54273f90fac689e05174039b8efc952dd39
Reviewed-on: https://gerrit.instructure.com/16028
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Simon Williams <simon@instructure.com>
2012-12-18 14:28:34 -07:00
Jeremy Stanley 6edaff4a7d VDD: notifications; closes #10896
The following changes have been made:
 - Assignment Created
  - students see the due date that applies to them
  - admins see "Multiple Dates"
 - Assignment Due Date Changed
  - students see the due date that applies to them;
    they receive no notification if their date doesn't change
  - admins receive a separate notification for each due
    date that changes, that they have access to;
    the message indicates which section or group applies
    (section-limited TAs will not get messages about due dates
    in sections they can't see)
 - Assignment Submitted Late
  - the message text does not change, but the student's overridden
    due date is checked
 - Group Assignment Submitted Late
  - same as previous

There were some bugs fixed along the way:
 - no longer send duplicate Assignment Submitted and
   Assignment Resubmitted notifications when an assignment
   is resubmitted
 - Group Assignment Submitted Late actually goes out
   (there was a typo in the whenever clause)

Test plan:
 - Create a course with two sections and a teacher
 - Enroll a student in each section
 - Enroll a section-limited TA in each section
 - Make sure everybody involved is signed up for "Due Date"
   notifications, ASAP
 - Using the API, Create an assignment with a default due date
   (in the past) and an overridden due date for section 2
   (in the future).  the assignment and override must be
   created in the same request (use the "Create an assignment"
   API and supply assignment[assignment_overrides]; it may
   be easier to use a JSON request body)
 - Verify that everybody got an "Assignment Created"
   message (use /users/X/messages)
   - the teacher should see "Multiple Dates",
     as should the TA in section 2 (because the default date
     is still visible to him)
   - the student and the TA in section 1 should see
     the default due date
   - the student in section 2 should see the overridden
     due date
 - "Due Date Changed" messages will not go out for assignments
   that were created less than 3 hours ago (by design, and not
   new with this changeset), so for the remaining items, you
   either need to wait 3 hours, or falsify created_at for the
   assignment you just made...
 - Change the default due date for the assignment, leaving it
   in the past
  - Everybody except the student in section 2 should get a
    notification with the new date
 - Change the overridden due date for section 2, leaving it
   in the future
  - everybody except the teacher and TA in section 1 should get
    a notification about the new date
  - the teacher and section-2 TA's notifications should indicate
    that they apply to section 2 (the student's should not)
 - submit the assignment as each student
  - the teacher should get one notification about each submission:
    the one about the student in section 1 should say it's late;
    the one about the student in section 2 should not
 - submit again
  - the teacher should get one notification about each submission:
    the one about the student in section 1 should say it's late;
    the one about the student in section 2 should not, and should
     be identified as a resubmission
     (there is no late-re-submission notification)

Change-Id: I26e57807ea0c83b69e2b532ec8822f6570ba1701
Reviewed-on: https://gerrit.instructure.com/14662
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
2012-11-14 09:04:07 -07:00
Stanley Stuart 1a2779eb12 add varied due date functionality to the main assignments page
test plan:
  REFERENCE:
    * "Main Assignments Page": "localhost:3000/assignments", or click on
    "Assignments" in the menu bar near the top of the page.
    * "Right Side Bar": Go to the Main Assignments Page, it's on your
    right.
    * "Course Assignments Page": Hover over "Courses" in the menu bar
    * near the top of the page, click on the course you set up. Once
    that page loads, click on "Assignments" tab on the left hand side.
  STEPS:
    * https://gist.github.com/f12b3694016f3dcc979e

Change-Id: I9a5884ec1057f196ba5b731a2978c874141bec5b
Reviewed-on: https://gerrit.instructure.com/15006
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Amber Taniuchi <amber@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
2012-11-09 23:21:44 -07:00
Jacob Fugal 0e68e4b2be dump student links when deleting an adhoc override
test-plan:
  - create a student in a course
  - create an adhoc override for an assignment in that course with the
    student as part of the override's set
  - delete the override
  - attempt to create another adhoc override for the same assignment and
    student
  - should not fail validation

Change-Id: I708ef2a219e379d12b2ddbc30cb772d0403ad84d
Reviewed-on: https://gerrit.instructure.com/15044
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2012-11-06 09:30:11 -07:00
Jacob Fugal be6093f9cd VDD: Assignment#due_dates_for(user), et al.
a convenience method to get all due dates applicable to and/or visible
to a specific user for an assignment. new named scopes on
AssignmentOverride to facilitate it, and minor bug fixes

Change-Id: I7f400fd13b7903b362e9ca0e6991f1d287f5f783
Reviewed-on: https://gerrit.instructure.com/14581
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
2012-10-23 09:06:30 -06:00
Jacob Fugal 7aaf63db52 VDD: Assignment#overrides_visible_to(user)
scopes the assignment's overrides to just those that the user can see.
intended for use with admin users (e.g. teachers or tas) not students,
since a student technically can see other students and thus this scope
will let them see the other students' adhoc overrides, which is not
desired. but this should never need to be called in the context of a
student.

test-plan:
 - architectural, run specs

Change-Id: I4e1515c263870a13f073af1b39cb19d223b41ab9
Reviewed-on: https://gerrit.instructure.com/14486
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2012-10-22 09:32:58 -06:00
Jacob Fugal 6fc0e64581 VDD: assignment override data structures
refs #10831

test-plan:
  - run specs. this is all infrastructure, no real separate test plan.

Change-Id: Ic67f574b7e4cbffd114f6ed34d306a393a6bd93c
Reviewed-on: https://gerrit.instructure.com/14117
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
2012-10-17 12:47:37 -06:00