Expose Rubric Assessment API endpoints CUD
Test Plan. Use postman or curl to test the following endpoints Remember to change the: :course_id with the appropiate course_id :rubric_association_id with the appropiate rubric_association_id :id with the rubric_assessment_id POST 'courses/:course_id/rubric_associations/ :rubric_association_id/rubric_assessments' params example: { "rubric_assessment": { "user_id": "22", "assessment_type": "grading", "criterion__7226": { "points": "3", "comments": "", "save_comment": "0" } }, "graded_anonymously": "false" } PUT 'courses/:course_id/rubric_associations/ :rubric_association_id/rubric_assessments/:id' params example: { "rubric_assessment": { "user_id": "22", "assessment_type": "grading", "criterion__7226": { "points": "3", "comments": "", "save_comment": "0" } }, "graded_anonymously": "false" } DELETE 'courses/:course_id/rubric_associations/ :rubric_association_id/rubric_assessments/:id' refs: PFS-11756 Change-Id: Ib67898f2dec37c3438e1d8f5745c20f1c41113e0 Reviewed-on: https://gerrit.instructure.com/180683 Tested-by: Jenkins QA-Review: Aiona Rae Hernandez <ahernandez@instructure.com> QA-Review: Brian Watson <bwatson@instructure.com> Reviewed-by: Neil Gupta <ngupta@instructure.com> Reviewed-by: Colin Cromar <ccromar@instructure.com> Reviewed-by: Augusto Callejas <acallejas@instructure.com> Product-Review: Augusto Callejas <acallejas@instructure.com> (cherry picked from commit d17de50121f60104c136b0a1831db786b816231c) Reviewed-on: https://gerrit.instructure.com/183188 Product-Review: Neil Gupta <ngupta@instructure.com>
This commit is contained in:
parent
db88805d17
commit
8fccfe4463
|
@ -16,10 +16,44 @@
|
|||
# with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
# @API Rubrics
|
||||
# @subtopic RubricAssessments
|
||||
#
|
||||
|
||||
class RubricAssessmentsController < ApplicationController
|
||||
before_action :require_context
|
||||
before_action :require_user
|
||||
|
||||
|
||||
# @API Create a single rubric assessment
|
||||
#
|
||||
# Returns the rubric assessment with the given id.
|
||||
# The returned object also provides the information of
|
||||
# :ratings, :assessor_name, :related_group_submissions_and_assessments, :artifact
|
||||
#
|
||||
#
|
||||
# @argument course_id [Integer]
|
||||
# The id of the course
|
||||
# @argument rubric_association_id [Integer]
|
||||
# The id of the object with which this rubric assessment is associated
|
||||
# @argument provisional [String]
|
||||
# (optional) Indicates whether this assessment is provisional, defaults to false.
|
||||
# @argument final [String]
|
||||
# (optional) Indicates a provisional grade will be marked as final. It only takes effect if the provisional param is passed as true. Defaults to false.
|
||||
# @argument graded_anonymously [Boolean]
|
||||
# (optional) Defaults to false
|
||||
# @argument rubric_assessment [Hash]
|
||||
# A Hash of data to complement the rubric assessment:
|
||||
# The user id that refers to the person being assessed
|
||||
# rubric_assessment[user_id]
|
||||
# Assessment type. There are only three valid types: 'grading', 'peer_review', or 'provisional_grade'
|
||||
# rubric_assessment[assessment_type]
|
||||
# The points awarded for this row.
|
||||
# rubric_assessment[criterion_id][points]
|
||||
# Comments to add for this row.
|
||||
# rubric_assessment[criterion_id][comments]
|
||||
# For each criterion_id, change the id by the criterion number, ex: criterion_123
|
||||
# If the criterion_id is not specified it defaults to false, and nothing is updated.
|
||||
def create
|
||||
update
|
||||
end
|
||||
|
@ -34,6 +68,37 @@ class RubricAssessmentsController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
# @API Update a single rubric assessment
|
||||
#
|
||||
# Returns the rubric assessment with the given id.
|
||||
# The returned object also provides the information of
|
||||
# :ratings, :assessor_name, :related_group_submissions_and_assessments, :artifact
|
||||
#
|
||||
#
|
||||
# @argument id [Integer]
|
||||
# The id of the rubric assessment
|
||||
# @argument course_id [Integer]
|
||||
# The id of the course
|
||||
# @argument rubric_association_id [Integer]
|
||||
# The id of the object with which this rubric assessment is associated
|
||||
# @argument provisional [String]
|
||||
# (optional) Indicates whether this assessment is provisional, defaults to false.
|
||||
# @argument final [String]
|
||||
# (optional) Indicates a provisional grade will be marked as final. It only takes effect if the provisional param is passed as true. Defaults to false.
|
||||
# @argument graded_anonymously [Boolean]
|
||||
# (optional) Defaults to false
|
||||
# @argument rubric_assessment [Hash]
|
||||
# A Hash of data to complement the rubric assessment:
|
||||
# The user id that refers to the person being assessed
|
||||
# rubric_assessment[user_id]
|
||||
# Assessment type. There are only three valid types: 'grading', 'peer_review', or 'provisional_grade'
|
||||
# rubric_assessment[assessment_type]
|
||||
# The points awarded for this row.
|
||||
# rubric_assessment[criterion_id][points]
|
||||
# Comments to add for this row.
|
||||
# rubric_assessment[criterion_id][comments]
|
||||
# For each criterion_id, change the id by the criterion number, ex: criterion_123
|
||||
# If the criterion_id is not specified it defaults to false, and nothing is updated.
|
||||
def update
|
||||
@association = @context.rubric_associations.find(params[:rubric_association_id])
|
||||
@assessment = @association.rubric_assessments.where(id: params[:id]).first
|
||||
|
@ -109,6 +174,11 @@ class RubricAssessmentsController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
# @API Delete a single rubric assessment
|
||||
#
|
||||
# Deletes a rubric assessment
|
||||
#
|
||||
# @returns RubricAssessment
|
||||
def destroy
|
||||
@association = @context.rubric_associations.find(params[:rubric_association_id])
|
||||
@rubric = @association.rubric
|
||||
|
|
|
@ -2113,6 +2113,12 @@ CanvasRails::Application.routes.draw do
|
|||
delete 'courses/:course_id/rubric_associations/:id', action: :destroy
|
||||
end
|
||||
|
||||
scope(controller: :rubric_assessment_api) do
|
||||
post 'courses/:course_id/rubric_associations/:rubric_association_id/rubric_assessments', controller: :rubric_assessments, action: :create
|
||||
put 'courses/:course_id/rubric_associations/:rubric_association_id/rubric_assessments/:id', controller: :rubric_assessments, action: :update
|
||||
delete 'courses/:course_id/rubric_associations/:rubric_association_id/rubric_assessments/:id', controller: :rubric_assessments, action: :destroy
|
||||
end
|
||||
|
||||
scope(controller: 'master_courses/master_templates') do
|
||||
get 'courses/:course_id/blueprint_templates/:template_id', action: :show
|
||||
get 'courses/:course_id/blueprint_templates/:template_id/associated_courses', action: :associated_courses, as: :course_blueprint_associated_courses
|
||||
|
|
Loading…
Reference in New Issue