Commit Graph

9 Commits

Author SHA1 Message Date
Cody Cutrer 06763dd519 add # frozen_string_literal: true for lib
Change-Id: I59b751cac52367a89e03f572477f0cf1d607b405
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/251155
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2020-10-27 20:49:50 +00:00
Jeremy Stanley 1c62e34641 add include[]=can_edit to assignments index
test plan:
 - render API docs and note include[]=can_edit
 - set up some assignments and assignment overrides
   including dates inside and outside closed
   grading periods
 - use this endpoint, including can_edit and all_dates
 - as a teacher,
   - ensure can_edit is true for assignments and dates
     in the absence of grading periods or moderated grading
   - ensure can_edit is false for a date that lands in
     a closed grading period (still true for the
     assignment, however)
   - ensure can_edit is false for an assignment and all
     dates for a moderated grading assignment where the
     teacher lacks "select final grade" permission and
     isn't the moderator
  - as a student,
   - ensure can_edit is false everywhere
  - as an account administrator,
   - ensure can_edit is true everywhere
 - also test the can_edit include in
  - assignment show
  - assignment group index w/include[]=assignments

flag=none
closes LA-861

Change-Id: I7c0df7a0071cfd2bdb97e09cf4b77800de962d54
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/232004
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Anju Reddy <areddy@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
Reviewed-by: James Williams <jamesw@instructure.com>
Reviewed-by: Jon Willesen <jonw+gerrit@instructure.com>
2020-04-08 23:03:51 +00:00
Jeremy Stanley 81b55c2e9d bulk date editing API
test plan:
 - render API documentation
 - have a course with multiple assignments, some of which have
   multiple due dates
 - use the assignments index endpoint with include[]=all_dates
   to get a list of assignments and dates
 - use a JSON request body to update multiple dates for
   multiple assignments. then reload the assignments page
   and confirm the dates have changed
 - set up grading periods and ensure the endpoint returns an
   error if you try to move a due date into or out of a
   closed grading period
 - ensure you get a 401 if your update batch includes an
   assignment you don't have permission to update due to
   moderated grading (keeping in mind that TAs have
   select_final_grade permission by default)

closes LA-831

Change-Id: I804fd16c38410cbd3607f94e6a4da6e19a489d59
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/230102
Reviewed-by: James Williams <jamesw@instructure.com>
Reviewed-by: Jon Willesen <jonw+gerrit@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Anju Reddy <areddy@instructure.com>
Product-Review: Lauren Williams <lcwilliams@instructure.com>
2020-03-27 14:59:15 +00:00
Landon Wilkins e26843ff95 da licença part 34
add consistent license headers to all source files
(ruby, coffeescript, javascript)

except for vendor files

Change-Id: Ic6b3be7861a2c91d76889c1740f964e401638e04
Reviewed-on: https://gerrit.instructure.com/110061
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 22:00:30 +00:00
Neil Gupta e34d0de6a6 Merge branch 'master' into dev/weighted-grading
Fixes CNVS-35198
Fixes CNVS-34498

Change-Id: I7841fa62de2747654c3f4ad13c1124aeb10f6663
2017-02-28 16:36:42 -06:00
Spencer Olson fb9049324e set default values for booleans on various tables
This commit adds default values of false and not null constraints for
all boolean columns on the assignments, discussion_topics, and quizzes
tables. This commit also has a data fixup to backfill default values on
the boolean columns.

closes CNVS-34536

Test Plan:
* Do the following in a course with at least one closed grading period:
1. On the Assignments page, create an assignment with a due date in a
   closed grading period using the "+" button on an assignment group.
2. As a teacher, try to toggle the "Post to SIS" setting for the
   assignment from the Assignments page. Verify the setting changes.
3. Create a new assignment with a due date in a closed grading period
   using the "+Assignment" button.
4. As a teacher, try to toggle the post to SIS setting for the
   assignment from the Assignments page. Verify you can edit the
   setting as you toggle the button.

Change-Id: I7c799bb3b194363836d900287be90ca13805508e
Reviewed-on: https://gerrit.instructure.com/101315
Reviewed-by: Neil Gupta <ngupta@instructure.com>
Reviewed-by: Derek Bender <djbender@instructure.com>
QA-Review: Anju Reddy <areddy@instructure.com>
Tested-by: Jenkins
Product-Review: Keith T. Garner <kgarner@instructure.com>
2017-02-22 18:17:59 +00:00
Neil Gupta 7298b8749f Get rid of multiple_grading_periods feature flag
Fixes CNVS-27109

Test plan:
Regression test everything related to multiple grading periods.

In particular, make sure:
* there is no mention of the multiple grading periods feature flag on
  the account or course features pages
* make sure grading periods UI always shows up on the account grading
  standards page
* make sure the grading periods UI only shows on the course grading
  standards page if legacy course grading periods exist for that course
  (see below)
* grading period dropdowns only show up everywhere else if there are
  grading periods to show. Otherwise, it should behave as if MGP is
  "disabled"
* Grade calculation should work as expected with and without grading
  periods

To create legacy course grading periods, you have to use rails console:
1. Find your course:
      course = Course.find(<id>)
2. Create a grading period group:
      group = course.grading_period_groups.create!(title: "2017")
2. Create a grading period:
      group.grading_periods.create!(
        weight: 1,
        title: 'Fall',
        start_date: 5.days.ago,
        end_date: 10.days.from_now
      )

Here's the list of known places grading periods can be seen in the UI:

Instructor Assignments page
  (https://community.canvaslms.com/docs/DOC-2615)
Student Assignments page
  (https://community.canvaslms.com/docs/DOC-3123)
Gradebook (https://community.canvaslms.com/docs/DOC-2785)
Gradebook Individual View
  (https://community.canvaslms.com/docs/DOC-2788)
Course Settings grading schemes page
  (https://community.canvaslms.com/docs/DOC-4042)
Student Grades page (https://community.canvaslms.com/docs/DOC-1291)
Dashboard global Grades page
  (https://community.canvaslms.com/docs/DOC-5464)

Change-Id: Iefac4b08120bd1699d4ed98bcb418089eec9b3b8
Reviewed-on: https://gerrit.instructure.com/99744
Reviewed-by: Spencer Olson <solson@instructure.com>
Tested-by: Jenkins
QA-Review: KC Naegle <knaegle@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2017-01-25 20:35:18 +00:00
Derek Bender f30ef06a83 disable editing assignments in closed periods
if an assignment is locked by having any due date
in a closed grading period all fields are locked except
RCE, submission type fields, peer review fields.

closes: CNVS-30899

Test Plan
 - lock an assignment edit page by having at least one
   due date in a closed grading period
 - create an assignment with at least one due date in
   a closed grading period
 - go to the edit the assignment page
   (e.g. /courses/1/assignments/1/edit)
 - all fields are locked except for
   - description (RCE)
   - submission type
   - peer reviews
 - if an assignment is not locked, all fields should
   be editable as normal
 - if the user is an admin, they can edit anything they want

Change-Id: I5cbee4e552331915280c949f467565069aee8743
Reviewed-on: https://gerrit.instructure.com/93380
Reviewed-by: Jeremy Neander <jneander@instructure.com>
Reviewed-by: Shahbaz Javeed <sjaveed@instructure.com>
QA-Review: Anju Reddy <areddy@instructure.com>
Product-Review: Christi Wruck
Tested-by: Jenkins
2016-12-14 21:51:08 +00:00
Jeremy Neander 8eb038007d protect due dates in closed grading periods
This ensures that due dates cannot be set or changed in a way
which puts them into, takes them out of, or adjusts them within a
closed grading period.

closes CNVS-32489
closes CNVS-33037

test plan:

* Test the following endpoints:
  * POST     /courses/:course_id/quizzes
    (quizzes/quizzes#create)
  * PUT      /courses/:course_id/quizzes/:id
    (quizzes/quizzes#update)
  * POST     /api/v1/courses/:course_id/quizzes
    (quizzes/quizzes_api#create)
  * PUT      /api/v1/courses/:course_id/quizzes/:id
    (quizzes/quizzes_api#update)
  * POST     /api/v1/courses/:course_id/assignments
    (assignments_api#create)
  * PUT      /api/v1/courses/:course_id/assignments/:id
    (assignments_api#update)

* A teacher cannot:
  * create a quiz/assignment
    * with a due date in a closed grading period
    * with an override due date in a closed grading period
    * with a nil due date when the last grading period is closed
    * with a nil override due date when the last grading period
      is closed
  * change the due date on a quiz or assignment
    * due in a closed grading period
    * with an override due in a closed grading period
    * to a date within a closed grading period
  * change the due date of an override
    * due in a closed grading period
    * to a date within a closed grading period
  * unset (nullify) the due date when the last grading period is
    closed
  * unset (nullify) the due date of an override when the last
    grading period is closed
  * delete (by omission from parameters) an override due in a
    closed grading period

* A teacher can:
  * create a quiz/assignment with a due date in an open grading
    period
  * change the quiz/assignment due date when the assignment is
    only visible to overrides
  * change the quiz/assignment due date when not within a closed
    grading period
  * change the quiz/assignment due date when set to the same
    value

* An ADMIN does not have these restrictions.

Change-Id: I0da260e831784e7b6d0f6e5a35c43d6ecff9e977
Reviewed-on: https://gerrit.instructure.com/93806
Tested-by: Jenkins
Reviewed-by: Spencer Olson <solson@instructure.com>
Reviewed-by: Shahbaz Javeed <sjaveed@instructure.com>
QA-Review: KC Naegle <knaegle@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2016-11-18 23:50:24 +00:00