Commit Graph

51 Commits

Author SHA1 Message Date
Landon Wilkins 388e6f474f da licença part 28
add consistent license headers to all source files
(ruby, coffeescript, javascript)

except for vendor files

Change-Id: I394b225a1a6d43da86d0986b0ef303544bc9ddfc
Reviewed-on: https://gerrit.instructure.com/110052
Tested-by: Jenkins
Reviewed-by: Jon Jensen <jon@instructure.com>
Product-Review: Jon Jensen <jon@instructure.com>
QA-Review: Jon Jensen <jon@instructure.com>
2017-04-27 21:53:35 +00:00
Cody Cutrer d74ccdd308 rails 5: fix several deprecation warnings
Change-Id: I43a3a36da77d19e81257fb923b34e431f3d6cbfa
Reviewed-on: https://gerrit.instructure.com/104952
Tested-by: Jenkins
Reviewed-by: Simon Williams <simon@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2017-03-13 23:05:02 +00:00
James Williams 325b4bdd08 improve performance of module assignment tag info loading
particularly for admins when viewing a course that has
a soul-crushing number of assignment overrides

test plan:
* as with g/91478,
 in the rails console, configure the override threshold with

 Setting.set('assignment_all_dates_too_many_threshold', '5')

* on the modules index page, an assignment item with more than 5
 overrides should still list "Multiple Due Dates" but no longer
 shows a tooltip

closes #CNVS-32640

Change-Id: I92fecb66663c984eeb6b20aaeac53cb4e848615e
Reviewed-on: https://gerrit.instructure.com/93082
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Heath Hales <hhales@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2016-10-26 12:46:47 +00:00
Cody Cutrer b2e64d216a optimize speedgrader json for quizzes
fixes CNVS-32276

 * use a single query to check too many versions threshold
 * avoid instantiating AR objects for each of the quiz submission
   versions
 * avoid cloning the same quiz over and over again when we only
   need 1 field

Change-Id: I921e0bc7a2153a6eb7627a88bb8519beefeaa87e
Reviewed-on: https://gerrit.instructure.com/92123
Tested-by: Jenkins
Reviewed-by: Simon Williams <simon@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2016-10-06 21:49:42 +00:00
Jeremy Neander 00cef7fadd prevent assignment group movement in closed periods
Assignments which have been assigned for at least one student in
a closed grading period must not be moveable between assignment groups,
except by admins.

closes CNVS-30915

test plan:
  A. create or select:
    a. an account
    b. an enrollment term for the account
    c. a grading period set for that term with:
      * a closed grading period
      * an open grading period
    d. a course with that enrollment term
    e. two students (1 & 2) for the course
    f. three assignment groups (1, 2, 3)
    g. an assignment (A) in group 1
      * due for everyone in the closed grading period
    h. an assignment (B) in group 1
      * due for student 1 in the open grading period
      * due for student 2 after the open grading period
    i. an assignment (C) in group 2
      * due for student 1 in the closed grading period
      * due for student 2 in the open grading period
    j. an assignment (D) in group 2
      * due for student 1 after the open grading period
      * for student 2 without a due date
    k. an assignment (E) in group 3
      * due for everyone in the open grading period
  B. as a Teacher in the course, visit the course assignments page
      a. verify assignment A cannot be moved
      b. verify assignment B can be moved
      c. verify assignment C cannot be moved
      d. verify assignment D can be moved
      e. verify assignment E can be moved
  C. as an Admin, visit the course assignments page
      a. verify assignment A can be moved
      b. verify assignment B can be moved
      c. verify assignment C can be moved
      d. verify assignment D can be moved
      e. verify assignment E can be moved

Change-Id: I93a7f0f9391b493041172ed159136990c51d6a6a
Reviewed-on: https://gerrit.instructure.com/91744
Tested-by: Jenkins
Reviewed-by: Derek Bender <djbender@instructure.com>
Reviewed-by: Neil Gupta <ngupta@instructure.com>
QA-Review: Alex Morris <amorris@instructure.com>
Product-Review: Christi Wruck
2016-09-30 19:44:52 +00:00
James Williams a79ddb5f0e fix context_module_tag_info for public courses
Change-Id: Id5844b750e8c4cfda47f1fe24111c2d6765ac04f
Reviewed-on: https://gerrit.instructure.com/90331
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2016-09-15 18:52:31 +00:00
Cody Cutrer d283c4ae87 spec: fix false positive due to too-broad of exception handling
define and expect a specific exception, and then fix the spec so it
doesn't fail

Change-Id: I4fafd4f416f906a2d11b6ae84602c7319a116b55
Reviewed-on: https://gerrit.instructure.com/89884
Reviewed-by: Simon Williams <simon@instructure.com>
Tested-by: Jenkins
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2016-09-08 15:48:24 +00:00
Jeremy Stanley d70578b337 show date overrides in modules in courses with one section
test plan:
 - have a course with only one section
 - create an assignment and set up per-student overrides
 - add the assignment to a module
 - ensure that, as a teacher, the modules page shows
   "Multiple Due Dates" for the assignment

fixes CNVS-30620

Change-Id: I8244cac632511fcb789673270e98afc68b0378ef
Reviewed-on: https://gerrit.instructure.com/86447
Tested-by: Jenkins
Reviewed-by: James Williams  <jamesw@instructure.com>
QA-Review: Heath Hales <hhales@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2016-08-01 18:31:43 +00:00
James Williams 97cb828737 correctly determine past_due for survey quizzes on modules
test plan:
* create a survey quiz for a course
* add it as a module item
* as a student, complete the survey
* set the survey quiz due date in the past
* on the modules page for the student, it should not
 mark the quiz as being overdue

closes #CNVS-27945

Change-Id: I99a80cae209a27fbd391f07019b6a1aea6fb925d
Reviewed-on: https://gerrit.instructure.com/74410
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2016-03-17 19:58:30 +00:00
Marc Alan Phillips 0fad3e1db6 fix assignment edit for multi-section course
Fix the edit for a multi-section course where an assignment
override is made for a student in another section than the
teacher who is editing the assignment.

fixes CNVS-23944

Test Plan:
  -Create a course with two sections.
  -Add a teacher that can only grade their section.
  -Create a quiz or assignment
  -Override with only student(s) that the sub-teacher cant see
  -Masquerade as the teacher and go attempt to edit the assignment.
  -Make a change
  -Click save and see that it now saves..
  -Repeat with override with mix of students that the sub-teacher
     can/cannot see
  -Repeat with various combos not stated that you can think of
  -Make sure to also test that groups and section overrides still work

Change-Id: I360368bf3340a15452da5e60e734817841df139c
Reviewed-on: https://gerrit.instructure.com/71526
Tested-by: Jenkins
Reviewed-by: Mike Nomitch <mnomitch@instructure.com>
QA-Review: Michael Hargiss <mhargiss@instructure.com>
Product-Review: Jason Sparks <jsparks@instructure.com>
2016-02-28 05:50:18 +00:00
Cody Cutrer 9c7d006437 optimize several N+1 queries in CalendarEventsApiController#index
refs CNVS-27010

Change-Id: I74df150c660f1c72e6aa0701c063eebe9a910197
Reviewed-on: https://gerrit.instructure.com/71331
Tested-by: Jenkins
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2016-02-24 17:55:09 +00:00
Michael Nomitch 267cad5787 add scoping overrides by active enrollment
Add scoping overrides by active enrollment to prevent
unenrolled students with overrides from preventing
assignments from saving.

fixes CNVS-21655

test plan:
- Create an assignment
- Assign a due date to a particular student
- Remove that user from the course
- Edit that assignment.
- Assignments override should no longer show.
- Save the assignment should now work.

Change-Id: If08da7119172c7918b15238195e39e07ae75ea16
Reviewed-on: https://gerrit.instructure.com/71305
Tested-by: Jenkins
Reviewed-by: Davis McClellan <dmcclellan@instructure.com>
QA-Review: Michael Hargiss <mhargiss@instructure.com>
Product-Review: Jason Sparks <jsparks@instructure.com>
2016-02-10 17:26:46 +00:00
James Williams 53733b4743 rails 4.2: fix invalid assignment_override deletion
fixes problems with validates_associated

refs #CNVS-26056

Change-Id: I020a7c6905ee61a24520671a5faa472d2b791e45
Reviewed-on: https://gerrit.instructure.com/69787
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2016-02-01 21:03:26 +00:00
James Williams 9b5ef1acd9 return multiple due date info for survey quizzes on modules page
test plan:
* create a survey quiz
* create multiple due date overrides
* add the quiz as a module item
* the modules page should show the multiple due dates

closes #CNVS-25472

Change-Id: I4f32434b0a0abba451852f7aa7d0b9f39838d4e3
Reviewed-on: https://gerrit.instructure.com/68275
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Ryan Allen <rallen@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2015-12-07 18:12:29 +00:00
Cody Cutrer 7ea94c5ba8 rails 4 style associations
Change-Id: I0f80aa18ecfb73823368b7abb536d61cc0975c38
Reviewed-on: https://gerrit.instructure.com/67543
Tested-by: Jenkins
Reviewed-by: James Williams  <jamesw@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2015-12-01 20:01:34 +00:00
Cameron Sutter eed863af18 due date in assignment created notification
fixes CNVS-23430

test plan:
- when a teacher gets an assignment created notification
  email on a DA'd assignment, it should not say:
  'due: No Due Date' when there is a due date

Change-Id: I010dfc7b04cd478793cf05b5205220a33dc0e3e5
Reviewed-on: https://gerrit.instructure.com/64654
Tested-by: Jenkins
Reviewed-by: Brian Finney <bfinney@instructure.com>
QA-Review: Landon Holmstead <lholmstead@instructure.com>
Product-Review: Jason Sparks <jsparks@instructure.com>
2015-11-05 04:02:56 +00:00
James Williams df8399a834 performance improvements for assignment overrides, etc
- preload context module data for student assignments
 in calendar_events_api (improves locked_json)
- preload adhoc assignment overrides
 (i.e. assignment_student_overrides) instead of doing
 N+1 queries
- search the preloaded assignment_overrides when possible
 instead of calling yet another query

test plan:
* regression test assignments api index, assignment groups
 api index, calendar events api index, in particular
 with regards to assignment overrides

refs #CNVS-22774

Change-Id: I5c027e346c733ce0dac2fcd702c5272ff861d1b3
Reviewed-on: https://gerrit.instructure.com/62892
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Charles Kimball <ckimball@instructure.com>
Tested-by: Jenkins
Product-Review: James Williams  <jamesw@instructure.com>
2015-09-21 14:22:16 +00:00
James Williams eab9eea95f misc improvements for assignments, calendar events and modules
test plan:
* syllabus should work as before
* modules loading of assignment due dates should work
 as before
* assignments api should work as before

refs #CNVS-21476 #CNVS-21317

Change-Id: Iba183d6fda604acb29e9685f0f32be74ad27b898
Reviewed-on: https://gerrit.instructure.com/57215
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Clare Strong <clare@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2015-06-29 15:45:27 +00:00
Michael Nomitch 9f0198a430 adhoc overrides take student names
fixes CNVS-18412
fixes CNVS-19474

also fixes an N+1 during assignment saving
also fixes bug validating assignment override students

test plan:
  - make an adhoc assignment override via the API
    (pass in 5 student_ids in your course as
     "student_ids", dont pass "title")
  - on the assignment index when you look at the
    due_dates popup, it should list two students names
    and "and 3 others"
  - on the assignment show page it does the same
  - repeat with only 3 students, it should just list
    their names
    - note: the assignment edit page wont display
      the override, that is okay (for now)
  - also save an assignment with various combinations
    of due dates for sections - see if it ever errors
    on save

Change-Id: I19e8f186849ee9a2dd1a9055c9ddb0df2a470c5a
Reviewed-on: https://gerrit.instructure.com/48468
Reviewed-by: Simon Williams <simon@instructure.com>
Tested-by: Jenkins
QA-Review: Adam Stone <astone@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2015-04-28 20:13:58 +00:00
Michael Nomitch addc9cdc3e add all_dates to assignment api for mobile
fixes CNVS-17096

test plan:
  - call assignment api index for course
    - if you include "all_dates" in the include
      then each assignment has an all_dates field
    - if you dont include it the assignment doesnt
  - call assignment api a single assignment
    - if you include all_dates=true, you get dates
    - if not you dont
  - call assignment_groups api
    - all_dates works like the index api
  - as a teacher and user the right dates show up
    on the assignment index & individual assignment pages

Change-Id: I172c21161f792ff0b272dec03e0eb29ec3f32503
Reviewed-on: https://gerrit.instructure.com/45196
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Sean Lewis <slewis@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2014-12-05 16:19:25 +00:00
Michael Nomitch 85a8669a56 speed up assignment index loading
fixes CNVS-16556

test plan:
  - assignment index loads fine as teacher & student
  - as does the gradebook
  - as do calls to the assignment group api

Change-Id: Iff2fe084c15500f1dd232606f9182df328c76988
Reviewed-on: https://gerrit.instructure.com/43511
Reviewed-by: Cameron Sutter <csutter@instructure.com>
Reviewed-by: Matt Berns <mberns@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Sean Lewis <slewis@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2014-11-04 16:18:28 +00:00
Michael Nomitch 4e791b941b DA - more refactoring
- cleans up assignment model
- eliminates unnecessary feature flag checks
- eliminates unnecessary teacher permission checks
- moves duplicated methods from assignment and quiz
  to new module

Change-Id: I8d1e8f99bf5c8f6a63bd670b432aeef7e8f0e86b
Reviewed-on: https://gerrit.instructure.com/41654
Reviewed-by: Cameron Sutter <csutter@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Sean Lewis <slewis@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2014-10-08 16:32:18 +00:00
Michael Nomitch dfebb4972a DA - quiz/submission/discussion notifications
fixes CNVS-15156

test plan:
  - with DA on:
    - submission:
      - make a differentiated assignment
      - turn in a submission as a student
      - give the student a grade
        - as the student, ensure you have the notification, and then
          delete it
      - as a teacher, take away visibility and delete their grade
        - as the student, you should not have a new notification for grade
          changing
      - as a teacher, comment on this submission
        - as the student, you get notified about the comment
    - quiz:
      - as a teacher make a differentiated quiz
        - students without visibility dont get notified about it
    - discussion:
      - discussion notifications are broken so we cant QA
  - with DA off:
    - submission:
      - comment on a submission as a teacher and make sure the
        student is notified
      - grade a student as a teacher and make sure the student
        is notified
    - quiz:
      - making & assignment a quiz sends out notifications properly
    - discussion:
      - discussion notifications are broken so we cant QA

Change-Id: I891f9782b5ae70252e7949a6858896b73ac28871
Reviewed-on: https://gerrit.instructure.com/41025
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cameron Sutter <csutter@instructure.com>
QA-Review: Sean Lewis <slewis@instructure.com>
Product-Review: Hilary Scharton <hilary@instructure.com>
2014-10-03 22:08:27 +00:00
James Williams b5db0a7368 fix assignment overrides double caching on update
test plan:
* due dates should not intermittently fail to update
when updating

fixes #CNVS-13067

Change-Id: Ie4faf3112c847c4e969ae59e4c782466b94a2f84
Reviewed-on: https://gerrit.instructure.com/39535
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Clare Strong <clare@instructure.com>
2014-08-20 18:27:07 +00:00
Simon Williams c0474dcd25 get rid of count(*) overrides query (take 2)
refs CNVS-6763

Test plan:
  basic overrides regression test

Change-Id: I99600d15dd03fec6b0ad7af76adc2bdd825eff68
Reviewed-on: https://gerrit.instructure.com/37371
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cameron Matheson <cameron@instructure.com>
QA-Review: Anna Koalenz <akoalenz@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2014-07-31 16:10:21 +00:00
Cameron Sutter 79f45f569d DA - quiz edit page
fixes CNVS-9766

test plan:
 * turn on the Differentiated Assignments feature flag
 * from the quiz edit page
  - add a due date for some of the sections, but not all
  - save (update quiz)
  > the only_visible_to_overrides flag on the quiz should be true
  > edit the quiz again and there should not be an
    empty due date row for 'Everyone else'
  - add a due date for all the sections
  - update the quiz
  > the only_visible_to_overrides flag should not be there
  - edit the quiz so that there are only due dates
    for some sections but not all
 * on the normal quiz show page and
 * on the new Quiz Statistics show page
  > there should not be a row in the due date area
    for 'Everyone else'
 - turn off the DA flag and make sure the quiz show page works
   with the 'New Quiz Stats page' flag and without it
 - make sure the edit page works with the DA flag off as well

Change-Id: Ifb090a195ff3283d963df12ae7a9eb503f32ee86
Reviewed-on: https://gerrit.instructure.com/34085
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
Reviewed-by: Mike Nomitch <mnomitch@instructure.com>
Product-Review: Cameron Sutter <csutter@instructure.com>
2014-07-23 14:41:24 +00:00
Jeremy Stanley 9ddd2f53b3 fix public syllabus access
test plan:
 1. have a published course containing at least one published
    assignment
 2. check the "public syllabus" box in course settings
 3. the syllabus page should be visible as a non-logged-in user

fixes CNVS-14144

Change-Id: I5f5f357227076e657a9626cc3748ebcf0be7365e
Reviewed-on: https://gerrit.instructure.com/37528
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: James Williams  <jamesw@instructure.com>
QA-Review: Clare Strong <clare@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2014-07-11 17:13:10 +00:00
Simon Williams 23fdf303f3 Revert "get rid of count(*) overrides query"
This reverts commit b5c63024e0.

fixes CNVS-14018

test plan:
- specs should pass

Change-Id: I021598d81fb9462d6470e3b3a038e96b3d8060b4
Reviewed-on: https://gerrit.instructure.com/37366
Reviewed-by: Bryan Madsen <bryan@instructure.com>
Product-Review: Bryan Madsen <bryan@instructure.com>
QA-Review: Bryan Madsen <bryan@instructure.com>
Tested-by: Bryan Madsen <bryan@instructure.com>
2014-07-07 22:28:44 +00:00
Cameron Matheson b5c63024e0 get rid of count(*) overrides query
refs CNVS-6763

Test plan:
  basic overrides regression test

Change-Id: I0874db750299709345b241c197a0973e31569cc5
Reviewed-on: https://gerrit.instructure.com/28799
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Liz Abinante <labinante@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2014-07-07 19:49:53 +00:00
Cameron Sutter af97bbace1 fix quiz show and edit pages
fixes CNVS-13320

test plan:
 - navigate to /quizzes
 > it should load without an error message
 - navigate to a single quiz (quizzes/:id)
 > it should load without an error message

Change-Id: Ic83f6ff6d5a9ae146057efb2418c8686cf52ec49
Reviewed-on: https://gerrit.instructure.com/35533
Reviewed-by: Liz Abinante <labinante@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
Product-Review: Cameron Sutter <csutter@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2014-06-04 18:08:45 +00:00
Cameron Sutter db1e6aeaba DA - send flag from assignment edit page
fixes CNVS-9765

test plan:
 - turn on the Differentiated Assignments feature flag
 * from the edit page
  - add a due date for some of the sections, but not all
  - save (update assignment)
  - the only_visible_to_overrides flag on the assignment
    should be true
    (you'll need to check the assignment with the API)
  - edit the assignment again and there should not be an
    empty due date row for 'Everyone else'
  - add a due date for all the sections
  - update the assignment
  - the only_visible_to_overrides flag should be false
 * on the show page
  - edit the assignment so that there are only due dates
    for some sections but not all
  - there should not be a row in the due date area
    for 'Everyone else'

Change-Id: I1bce92c335c1af2c9ead6d963174c817d4b10cdd
Reviewed-on: https://gerrit.instructure.com/33706
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Anna Koalenz <akoalenz@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
Reviewed-by: Liz Abinante <labinante@instructure.com>
2014-05-28 14:57:48 +00:00
Liz Abinante e04a49235e AssignmentOverrides refactor
fixes CNVS-10793
fixes CNVS-12360

test plan
=========
- assignment overrides should still work
- general regression of assignment#new, #edit, quizzes#new, #edit, discussions#new, #edit
- check API end points for above overrides

Change-Id: I211ad888ac14d7e863ab67bfcb27d56a85e62aac
Reviewed-on: https://gerrit.instructure.com/29980
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
Product-Review: Liz Abinante <labinante@instructure.com>
2014-05-16 21:12:45 +00:00
Nick Cloward 4748aba483 extract canvas sort gem
fixes: CNVS-11890

Test Plan:

Canvas Should not be broken, test requests that use the SortLast and SortFirst
class.  One is account settings.  Make sure its sorted correctly.  Another is
submissions_controller show method and make sure the visible rubric assesments
are sorted correctly.

Change-Id: I75a61475a928e069d6566fcc51305a6c442ec5a0
Reviewed-on: https://gerrit.instructure.com/32014
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>
2014-04-04 14:53:09 +00:00
Stanley Stuart 5c2cc43a86 re-add id back to allowed fields for assignment/quiz api results
Test plan:
  - make sure ids show up for "all_dates" in quiz and assignment APIs

Change-Id: I9c3c65c044b9411c18ef018e6305c727be7ff320
Reviewed-on: https://gerrit.instructure.com/31221
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Myller de Araujo <myller@instructure.com>
Reviewed-by: Jason Madsen <jmadsen@instructure.com>
Product-Review: Stanley Stuart <stanley@instructure.com>
2014-03-06 22:41:12 +00:00
Ahmad Amireh ba316054ba Draft State Quizzes: show multiple due dates
Closes CNVS-9880

This patch enables observers watching students across multiple sections
to see each section's due date for a quiz in the quizzes index page,
it also fixes the dates students get to see when they're in a section
other than the base one.

(BREAKING?) API CHANGES
----------- --- -------

  - when a student queries a quiz, the `due_at`, `lock_at`, and
    `unlock_at` dates they receive are that of the section they're in as
    oppossed to the quiz's global dates
  - when an observer queries a quiz, they receive the dates for the
    sections they're bound to in the `all_dates` field like teachers do

TEST PLAN
---- ----

Two ways to test this patch: a simple way that tests only the case
described by the ticket, or the comprehensive way.

> The simple way

  - turn DS on
  - create a course with multiple sections
  - create a quiz and assign a due date to each section
  - as an observer who's watching more than 1 student in different
    sections, go to the quizzes index:
    - verify that you see "Multiple Dates" for due dates (and
      availability if you set them)
    - hover over the link and verify that you see the proper dates in
      the tooltip

> The comprehensive way

Check this out: https://gist.github.com/amireh/375171767da8303e1b71

Change-Id: I934cb47f0229a43713dc6b4a6d280c047a2263b9
Reviewed-on: https://gerrit.instructure.com/30083
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Myller de Araujo <myller@instructure.com>
Reviewed-by: Derek DeVries <ddevries@instructure.com>
Product-Review: Ahmad Amireh <ahmad@instructure.com>
2014-02-25 16:51:47 +00:00
Simon Williams 3274664b12 change User model to use dates_hash_visible_to
it was the only external user of all_dates_visible_to, so making this change
allows all_dates_visible_to to be module private.  additionally,
dates_hash_visible_to will ignore the default due date if all sections are
overridden, which is a more standard behavior.

closes CNVS-10538

test plan:
- basic regression test of the 'upcoming assignments' list on the user and
  course dashboards for assignments with multiple due dates (check different
  combinations of overriding all/some sections, and having dates in
  and outside of the 'upcoming' window)

Change-Id: I13ca8a61d8813204edb88f1812ec51783d6a24ce
Reviewed-on: https://gerrit.instructure.com/28658
Reviewed-by: Mike Nomitch <mnomitch@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cameron Sutter <csutter@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2014-01-24 22:20:48 +00:00
Simon Williams 7e99b7ed64 remove dead overrides code
closes CNVS-10536

test plan:
- basic regression test of create/viewing multiple
  due dates for students and teachers

Change-Id: I3c5e4707efd2b0e27908efb4f4730b2778dd2454
Reviewed-on: https://gerrit.instructure.com/28648
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cameron Matheson <cameron@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2014-01-22 16:27:02 +00:00
Simon Williams 89ee41e6a2 remove unused, deprecated method multiple_due_dates_apply_to
fixes CNVS-10361

test plan:
- tests pass
- you can still create an assignment with multiple due dates

Change-Id: Ied41b61cea32cf23d0ac86e3b4a3b3428003c6fd
Reviewed-on: https://gerrit.instructure.com/28330
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Liz Abinante <labinante@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2014-01-14 22:03:57 +00:00
Liz Abinante 6a3b8f16ca observers can see multiple due dates on assignment index
fixes CNVS-9730

test plan
- with draft state enabled
- create an assignment in a course with multiple sections, assign each
  section a different due date
- as an observer with 1 student, view assignments index
- verify that you're seeing the correct due date for the student's
  section
- as an observer with 2+ students in different sections, view the assignments index
- verify that you're seeing the due date for each section
- you should not see the due date for "Everyone else" unless a student is in that
section

- go through above with draft disabled also

Change-Id: Ia43d93e20e9cabd48879a782d286dc5b9fb28435
Reviewed-on: https://gerrit.instructure.com/26993
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
Product-Review: Liz Abinante <labinante@instructure.com>
2013-12-06 23:26:21 +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
Cody Cutrer 419877ff9d clean up sorting all over
* use sort_by instead of sort where possible to avoid repeating yourself
 * use new SortFirst/SortLast sentinels to avoid strange magical constants
 * fix a few places of complicated logic for tiered sorting to just use
   an array

Change-Id: I184ef0b4e31fa18294c9beb32770101d383bbea1
Reviewed-on: https://gerrit.instructure.com/24867
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2013-10-02 21:38:08 +00:00
Derek DeVries 89e199451b edit assignments and multiple due dates in the new index page
fixes CNVS-7190, CNVS-7652

test plan

1. editing
- click edit from cog menu
- edit in dialog
- edits should display after dialog closes

2. variable due dates
- add a section to the course in the settings
- edit an assignment, and add multiple due dates
- "multiple due dates" with a tooltip should show up in the index page
- on the edit modal, the due date is disabled and shows dates in a hover tooltip

Change-Id: I0ada6bc94964f34e8f6327edd6c52c2201637791
Reviewed-on: https://gerrit.instructure.com/23550
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Myller de Araujo <myller@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
Product-Review: Derek DeVries <ddevries@instructure.com>
2013-09-06 18:16:39 +00:00
Cameron Matheson 8ee71f6077 cheap hack to skip overriding assignments
refs CNVS-6747

Test plan:
  * Make sure the new assignments index page still shows correct dates
    (test in a course that has assignments with and without overrides)
  * Test the assignments index api action and make sure it returns the
    right dates too

Change-Id: Ibb6baaa5009fe95b68e160af2fb4e91d5ac8ef37
Reviewed-on: https://gerrit.instructure.com/22612
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-07-26 21:43:01 +00: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
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
James Williams fc9224edee indicate overridden due dates on quizzes index
show an overridden due date, or
"Multiple Dates" if there are multiple unique dates

(also some changes for consistency's sake to
context modules vdd)

test plan:
* override section due dates for a quiz
* confirm that a single due date is reflected on the quiz index
* confirm that multiple due dates are reflected

closes #CNVS-749

Change-Id: Ib59a4af4a52134514bb296906109346eeeb027d3
Reviewed-on: https://gerrit.instructure.com/17118
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Adam Phillipps <adam@instructure.com>
2013-01-30 12:49:07 -07:00
Dave Donahue 8e039da53f vdd: fix override behavior for guests
Fixes #CNVS-2017

Notes:
* Previously, code assumed a user would always be present,
  but this is not so for public courses with anonymous users
* Handles nil user cases in DatesOverridable and
  AssignmentOverrideApplicator

Test plan:
1. Create a public course.
2. Create an assignment with a default due date
   and one or more overrides.
3. View the assignment as a guest. The default due
   date should be displayed.

Change-Id: I5e4907dd52636816c6dccabc3acdbb138c638f27
Reviewed-on: https://gerrit.instructure.com/16817
Reviewed-by: Simon Williams <simon@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
2013-01-16 14:19:00 -07:00
Dave Donahue 6ab15d087b bug: if override due date is before default due date on an assignment, it is not applied
fixes #CNVS-2309

Problem:
Overriding a due date to be earlier than the default was having no
effect because the default date was getting lumped in with the overrides
and treated the same way when deciding which to use.

Solution:
If there are applicable overrides, don't take the default into account.

Notes:
The issue was happening as a result of the way the VariedDueDate class
indiscriminately lumped due dates together and returned the last one.
Part of the solution was removing the VariedDueDate class and instead
relying on the override methods on an Assignment. This was done not
only to fix the bug at hand but also to move toward a more consistent
interface for handling varied due dates.

Change-Id: If9d24725a19b134d5d92d3a5c08d6794f466fa9c
Reviewed-on: https://gerrit.instructure.com/16406
QA-Review: Myller de Araujo <myller@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
2013-01-09 09:37:00 -07:00
James Williams e41401f45c use overridden due dates on modules page
indicates multiple overridden due dates on multiple sections if
they are visible to a teacher/ta/designer

if there are different dates, it sends all the information back
this json info can be used in the future for a detailed popup

but for now, simply indicate with text that there are
multiple due dates for the assignment

if they are a student, then only show them the latest override
that applies to them

test plan:
* create an assignment
* create a module, add the assignment as an item
* create another course section
* override the assignment date for one section,
then override it to another date for the other section
* go to modules page, should see "Multiple Due Dates"

* create a ta/teacher/designer/student, restrict them to one section
* login as the ta/teacher/designer/student, should see one due date

closes #CNVS-2010 #CNVS-2011

Change-Id: Ieab089a27e4e4e7bea26b1c597859bf8b77dc802
Reviewed-on: https://gerrit.instructure.com/16401
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Adam Phillipps <adam@instructure.com>
2013-01-04 15:34:43 -07:00
Joel Hough a9626310f8 make [quiz|assignment].locked_for? vdd aware
fixes #CNVS-517
fixes #CNVS-761

test plan
- start with a course with students in different sections
- create a quiz with a lock date that locks the quiz currently
- create a lock date override that unlocks the quiz for one section
- ensure that a student from a section that the override does not apply to
  does see a lock icon on the course's quizzes list for the quiz
- ensure that a student from the section that the override does apply to
  does not see a lock icon on the course's quizzes list for the quiz

Change-Id: Ic1f553818ff106e1d29a8f1b66d8445b99aecffc
Reviewed-on: https://gerrit.instructure.com/16228
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Marc LeGendre <marc@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
2012-12-21 10:38:06 -07:00