Commit Graph

3 Commits

Author SHA1 Message Date
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