Commit Graph

7 Commits

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

except for vendor files

Change-Id: I4cdf3e066852e13dc56be1037ef2c69fecd8b5f4
Reviewed-on: https://gerrit.instructure.com/110043
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:51:31 +00:00
Spencer Olson cdd029a5c3 add close_date column to grading_periods table
in addition, if no close date is provided on
creation of a grading period, the end date
will be used as the close date.

closes CNVS-26714

test plan:
* run the migration and verify it succeeds:
  $ bundle exec rake db:migrate
* open a rails console and verify the close_date
  attribute exists and it is a datetime:
  $ bundle exec rails console
  $ GradingPeriod
* verify:
  1) you can create a grading period with an end
     date but without a close date. the close date
     will get set to the end date that you provided.
  2) you can create a grading period with a unique
     end date and close date. the close date must
     be on or after the end date. if you attempt to
     create a grading period with a close date that
     is before the end date, it should fail.

Change-Id: I1a180af4eb8c23703e3844d2e93159010f0c9e58
Reviewed-on: https://gerrit.instructure.com/84340
Tested-by: Jenkins
Reviewed-by: Jeremy Neander <jneander@instructure.com>
Reviewed-by: Keith T. Garner <kgarner@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2016-07-11 15:03:39 +00:00
Derek Bender 160c169944 one grading period save button
closes CNVS-20238

this removes individual save/update buttons on the
grading periods page in favor of a single save button.
a title validation is also added to grading periods.

Change-Id: Id6fa4de38f8d9243a21ce5011f090e8782c5aec0
Also-By: Spencer Olson <solson@instructure.com>
Also-By: Strand McCutchen <smccutchen@instructure.com>
Reviewed-on: https://gerrit.instructure.com/55688
Tested-by: Jenkins
Reviewed-by: Spencer Olson <solson@instructure.com>
Product-Review: Derek Bender <dbender@instructure.com>
QA-Review: Michael Hargiss <mhargiss@instructure.com>
2015-06-18 18:46:22 +00:00
Spencer Olson 690aeb7c17 set up permissions for grading periods
closes CNVS-18438

test plan:
  1. create a root-account, a sub-account (belonging to the root-account),
    and a course belonging to the root-account (not belonging to the
    sub-account). Create an admin for your root-account and an admin for
    your sub-account, and a teacher and student for your course.
  2. create grading periods for the root-account, sub-account,
    and course. For the example below i'm using the ids 1, 5, and 10
    for the account, sub-account, and course, respectively.
    In rails console:
    $ root_gp_group = Account.find(1).grading_period_groups.create!
    $ sub_gp_group = Account.find(5).grading_period_groups.create!
    $ course_gp_group = Course.find(10).grading_period_groups.create!
    $ root_gp = root_gp_group.grading_periods.create!(
        start_date: Time.now, end_date: 2.days.from_now, weight: 0.50)
    $ sub_gp = sub_gp_group.grading_periods.create!(
        start_date: Time.now, end_date: 2.days.from_now, weight: 0.50)
    $ course_gp = root_gp_group.grading_periods.create!(
        start_date: Time.now, end_date: 2.days.from_now, weight: 0.50)
  3. check the permissions for your root-admin, sub-admin, teacher,
    and student (while still in rails console). example below assumes
    root-admin, sub-admin, teacher, and student ids are 100, 200, 300,
    and 400 respectively.
    $ root_admin = User.find(100)
    $ sub_admin = User.find(200)
    $ teacher = User.find(300)
    $ student = User.find(400)
    $ root_gp.rights_status(root_admin, :read, :manage)
        -- should return {read: true, manage: true}
    $ root_gp.rights_status(sub_admin, :read, :manage)
        -- should return {read: true, manage: false}
    $ root_gp.rights_status(teacher, :read, :manage)
        -- should return {read: true, manage: false}
    $ root_gp.rights_status(student, :read, :manage)
        -- should return {read: true, manage: false}
    $ sub_gp.rights_status(root_admin, :read, :manage)
        -- should return {read: true, manage: true}
    $ sub_gp.rights_status(sub_admin, :read, :manage)
        -- should return {read: true, manage: true}
    $ sub_gp.rights_status(teacher, :read, :manage)
        -- should return {read: false, manage: false}
    $ sub_gp.rights_status(student, :read, :manage)
        -- should return {read: false, manage: false}
    $ course_gp.rights_status(root_admin, :read, :manage)
        -- should return {read: true, manage: true}
    $ course_gp.rights_status(sub_admin, :read, :manage)
        -- should return {read: false, manage: false}
    $ course_gp.rights_status(teacher, :read, :manage)
        -- should return {read: true, manage: true}
    $ course_gp.rights_status(student, :read, :manage)
        -- should return {read: true, manage: false}

Change-Id: Ib5262ebcaa0554096ac9ddaacab017d45717bea6
Reviewed-on: https://gerrit.instructure.com/48524
Tested-by: Jenkins
Reviewed-by: Cameron Sutter <csutter@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
Product-Review: Spencer Olson <solson@instructure.com>
2015-02-21 00:25:21 +00:00
Spencer Olson 9cde815d68 add grading period group model
add GradingPeriodGroup, and change associations between GradingPeriods,
GradingPeriodGroups, Courses, and Accounts. also adjust the grading
periods controller to account for addition of grading period groups

closes CNVS-16538

test plan:
-run bundle exec rake db:migrate, and bundle exec rake db:migrate RAILS_ENV=test
-verify the migrations successfully run
-open the rails console in sandbox: bundle exec rails c -s
-create a course, a few grading periods, and a grading period group. Add the grading periods to the group. Assign
  the grading period group to the course.
  $ course = Course.create
  $ grading_period1 = GradingPeriod.create(weight: 25.0, start_date: Time.zone.now, end_date: 2.days.from_now)
  $ grading_period2 = GradingPeriod.create(weight: 30.0, start_date: Time.zone.now, end_date: 2.days.from_now)
  $ grading_period_group = GradingPeriodGroup.create()
  $ grading_period_group.grading_periods << grading_period1
  $ grading_period_group.grading_periods << grading_period2
  $ grading_period_group.course = course
-verify the associations are working as expected, i.e. a GradingPeriodGroup has GradingPeriods, a GradingPeriod
  belongs to a GradingPeriodGroup, and a GradingPeriodGroup belongs to a course or account.
  $ grading_period_group.grading_periods #should return an array containing grading_period1 and grading_period2
  $ grading_period1.grading_period_group #should return grading_period_group
  $ grading_period2.grading_period_group #should return grading_period_group
  $ grading_period_group.course #should return course
  $ grading_period_group.account #should return nil (should not throw error)

Change-Id: I9d7465431dabd2afa18e7a8a33706b9a78a94cd1
Reviewed-on: https://gerrit.instructure.com/43512
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Josh Simpson <jsimpson@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Product-Review: Spencer Olson <solson@instructure.com>
2014-11-14 22:07:00 +00:00
Spencer Olson 0b52ed43cf add custom naming functionality to grading period
closes CNVS-16370

test plan:
-in rails console, create a GradingPeriod and give it a title.
  $ rails c
  $ g = GradingPeriod.new(start_date: Time.zone.now, end_date: 2.days.from_now, weight: 25.0, title: "Custom Name")
-verify you can get the title, change it, and save it.
  $ g.title #should return "Custom Name"
  $ g.title = "New Title!"
  $ g.save #should return true
  $ g.title #should return "New Title!"


Change-Id: I3c1fe8f7f5849fb9550b0006b837e22aeef0abdb
Reviewed-on: https://gerrit.instructure.com/43172
Reviewed-by: Josh Simpson <jsimpson@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Sean Lewis <slewis@instructure.com>
Product-Review: Spencer Olson <solson@instructure.com>
2014-10-29 15:31:17 +00:00
Josh Simpson c18c1ab385 add grading periods api
closes CNVS-15907,CNVS-15908
This commit adds a RESTful, JSONAPI standardized api for grading
periods, along with a serializer and some naive permissions on the
GradingPeriod object.

Test plan
- Note that you'll need to enable the 'multiple_grading_periods' feature
  on the root account.

- Test each of the following endpoints, according to the newly generated
  grading period documentation:

  - GET index
    - /api/v1/accounts/:account_id/grading_periods
    - /api/v1/courses/:course_id/grading_periods

  - GET show
    - /api/v1//accounts/:account_id/grading_periods/:id
    - /api/v1/courses/:course_id/grading_periods/:id

  - POST create
    - /api/v1/accounts/:account_id/grading_periods
    - /api/v1/courses/:course_id/grading_periods

  - PUT update
    - /api/v1/accounts/:account_id/grading_periods/:id
    - /api/v1/courses/:course_id/grading_periods/:id

  - DELETE destroy
    - /api/v1/accounts/:account_id/grading_periods/:id
    - /api/v1/courses/:course_id/grading_periods/:id

Change-Id: I586d6eaf565f35d5d4bd8e22aaa9fd72f0d07832
Reviewed-on: https://gerrit.instructure.com/42451
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cameron Matheson <cameron@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
Product-Review: Josh Simpson <jsimpson@instructure.com>
2014-10-21 19:58:34 +00:00