Added Post Assignment to SIS
fixes SIS-214 fixes SIS-229 fixes SIS-230 TestPlan: - go to account settings and verify post grades feature is enabled - go to course settings and verify post grades feature is off - create a new assignment, verify "Post Assignment to SIS" checkbox is not present in the view - go to course settings and enable Post Grades - create a new assignment and verify Post Assignment to SIS is present in the view and checked. NOTE: it should be checked by default if this is a NEW assignment - save the assignment - edit the assignment again and the post grades checkbox should be true - uncheck the post assignment to sis checkbox, save - re-edit the assignment, the post grades checkbox should be unchecked Conflicts: app/coffeescripts/models/Assignment.coffee Change-Id: I34cba5add03b3cb935b502e47b4537bf93c5b7c1 Reviewed-on: https://gerrit.instructure.com/33411 Reviewed-by: Eric Adams <eadams@instructure.com> QA-Review: Jeremy Putnam <jeremyp@instructure.com> Reviewed-by: Duane Johnson <duane@instructure.com> Product-Review: Eric Adams <eadams@instructure.com> Tested-by: Jenkins <jenkins@instructure.com>
This commit is contained in:
parent
cd60456c66
commit
be040d6713
app
coffeescripts
controllers
models
views/jst/assignments
lib/api/v1
|
@ -172,27 +172,37 @@ define [
|
|||
postGrades: (e)->
|
||||
json_to_post = {}
|
||||
json_to_post['canvas_domain'] = document.domain
|
||||
json_to_post['assignments'] = _.map(@model.get('assignments_to_post'), (assignment) -> assignment.id)
|
||||
if @model.get('section_id')
|
||||
json_to_post['section_id'] = @model.get('section_id')
|
||||
$.ajax 'http://localhost:9292/grades/section/' + @model.get('section_id'), #need to add SIS APP endpoint to post data
|
||||
type: 'POST'
|
||||
data: JSON.stringify(json_to_post)
|
||||
contentType: 'application/json; charset=utf-8'
|
||||
error: (data) ->
|
||||
$.flashError('An error occurred posting your grades. ' + "HTTP Error " + data.status + " : " + data.statusText)
|
||||
success: (data) ->
|
||||
$.flashMessage('Assignments are being posted.')
|
||||
console.log(data)
|
||||
|
||||
@close()
|
||||
else
|
||||
json_to_post['course_id'] = @model.get('course_id')
|
||||
$.ajax 'http://localhost:9292/grades/course' + @model.get('course_id'), #need to add SIS APP endpoint to post data
|
||||
type: 'POST'
|
||||
data: JSON.stringify(json_to_post)
|
||||
contentType: 'application/json; charset=utf-8'
|
||||
error: (data) ->
|
||||
$.flashError('An error occurred posting your grades. ' + "HTTP Error " + data.status + " : " + data.statusText)
|
||||
success: (data) ->
|
||||
$.flashMessage('Assignments are being posted.')
|
||||
console.log(data)
|
||||
|
||||
@close()
|
||||
|
||||
|
||||
|
||||
|
||||
json_to_post['assignments'] = _.map(@model.get('assignments_to_post'), (assignment) -> assignment.id)
|
||||
|
||||
$.ajax 'http://localhost:4567/post', #need to add SIS APP endpoint to post data
|
||||
type: 'POST'
|
||||
data: JSON.stringify(json_to_post)
|
||||
contentType: 'application/json; charset=utf-8'
|
||||
error: (data) ->
|
||||
window.response_data = data
|
||||
$.flashError('An error occurred posting your grades. ' + "HTTP Error " + data.status + " : " + data.statusText)
|
||||
console.log(data)
|
||||
success: (data) ->
|
||||
$.flashMessage('Assignments are being posted.')
|
||||
window.data = data
|
||||
console.log(data)
|
||||
|
||||
@close()
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -29,6 +29,9 @@ define [
|
|||
silent: true
|
||||
if (all_dates = @get('all_dates'))?
|
||||
@set 'all_dates', new DateGroupCollection(all_dates)
|
||||
if (@postToSISEnabled())
|
||||
unless @get('post_to_sis') == true || @get('post_to_sis') == false
|
||||
@set 'post_to_sis', true
|
||||
|
||||
isQuiz: => @_hasOnlyType 'online_quiz'
|
||||
isDiscussionTopic: => @_hasOnlyType 'discussion_topic'
|
||||
|
@ -65,6 +68,9 @@ define [
|
|||
return @get 'name' unless arguments.length > 0
|
||||
@set 'name', newName
|
||||
|
||||
postToSIS: =>
|
||||
return @get 'post_to_sis' unless arguments.length > 0
|
||||
|
||||
pointsPossible: (points) =>
|
||||
return @get('points_possible') || 0 unless arguments.length > 0
|
||||
@set 'points_possible', points
|
||||
|
@ -235,6 +241,9 @@ define [
|
|||
labelId: =>
|
||||
return @id
|
||||
|
||||
postToSISEnabled: =>
|
||||
return ENV.POST_TO_SIS
|
||||
|
||||
defaultDates: =>
|
||||
group = new DateGroup
|
||||
due_at: @get("due_at")
|
||||
|
@ -272,7 +281,7 @@ define [
|
|||
'gradeGroupStudentsIndividually', 'groupCategoryId', 'frozen',
|
||||
'frozenAttributes', 'freezeOnCopy', 'canFreeze', 'isSimple',
|
||||
'gradingStandardId', 'isLetterGraded', 'isGpaScaled', 'assignmentGroupId', 'iconType',
|
||||
'published', 'htmlUrl', 'htmlEditUrl', 'labelId', 'position',
|
||||
'published', 'htmlUrl', 'htmlEditUrl', 'labelId', 'position', 'postToSIS',
|
||||
'multipleDueDates', 'allDates', 'isQuiz', 'singleSectionDueDate'
|
||||
]
|
||||
hash = id: @get 'id'
|
||||
|
|
|
@ -171,6 +171,7 @@ AssignmentGroupSelector, GroupCategorySelector, toggleAccessibly) ->
|
|||
data = @assignment.toView()
|
||||
_.extend data,
|
||||
kalturaEnabled: ENV?.KALTURA_ENABLED or false
|
||||
postToSISEnabled: ENV?.POST_TO_SIS or false
|
||||
isLargeRoster: ENV?.IS_LARGE_ROSTER or false
|
||||
submissionTypesFrozen: _.include(data.frozenAttributes, 'submission_types')
|
||||
|
||||
|
@ -197,6 +198,8 @@ AssignmentGroupSelector, GroupCategorySelector, toggleAccessibly) ->
|
|||
unless ENV?.IS_LARGE_ROSTER
|
||||
data = @groupCategorySelector.filterFormData data
|
||||
# should update the date fields.. pretty hacky.
|
||||
unless data.post_to_sis
|
||||
data.post_to_sis = false
|
||||
@dueDateOverrideView.updateOverrides()
|
||||
defaultDates = @dueDateOverrideView.getDefaultDueDate()
|
||||
data.lock_at = defaultDates?.get('lock_at') or null
|
||||
|
|
|
@ -307,6 +307,11 @@
|
|||
# "example": 1,
|
||||
# "type": "integer"
|
||||
# },
|
||||
# "post_to_sis": {
|
||||
# "example": true,
|
||||
# "type" : "boolean",
|
||||
# "description" : "(optional, present if Post Grades to SIS feature is enabled)"
|
||||
# },
|
||||
# "muted": {
|
||||
# "description": "whether the assignment is muted",
|
||||
# "type": "integer"
|
||||
|
@ -658,7 +663,6 @@ class AssignmentsApiController < ApplicationController
|
|||
def create
|
||||
@assignment = @context.assignments.build
|
||||
@assignment.workflow_state = 'unpublished' if @context.feature_enabled?(:draft_state)
|
||||
|
||||
if authorized_action(@assignment, @current_user, :create)
|
||||
save_and_render_response
|
||||
end
|
||||
|
@ -682,7 +686,6 @@ class AssignmentsApiController < ApplicationController
|
|||
# @returns Assignment
|
||||
def update
|
||||
@assignment = @context.assignments.find(params[:id])
|
||||
|
||||
if authorized_action(@assignment, @current_user, :update)
|
||||
save_and_render_response
|
||||
end
|
||||
|
|
|
@ -312,6 +312,7 @@ class AssignmentsController < ApplicationController
|
|||
group = get_assignment_group(params[:assignment])
|
||||
@assignment ||= @context.assignments.build(params[:assignment])
|
||||
@assignment.workflow_state ||= @context.feature_enabled?(:draft_state) ? "unpublished" : "published"
|
||||
@assignment.post_to_sis ||= @context.feature_enabled?(:post_to_sis) ? true : false
|
||||
@assignment.updating_user = @current_user
|
||||
@assignment.content_being_saved_by(@current_user)
|
||||
@assignment.assignment_group = group if group
|
||||
|
@ -354,7 +355,7 @@ class AssignmentsController < ApplicationController
|
|||
@assignment.submission_types = params[:submission_types] if params[:submission_types]
|
||||
@assignment.assignment_group_id = params[:assignment_group_id] if params[:assignment_group_id]
|
||||
@assignment.ensure_assignment_group(false)
|
||||
|
||||
@assignment.post_to_sis = params[:post_to_sis] if params[:post_to_sis]
|
||||
if @assignment.submission_types == 'online_quiz' && @assignment.quiz
|
||||
return redirect_to edit_course_quiz_url(@context, @assignment.quiz, index_edit_params)
|
||||
elsif @assignment.submission_types == 'discussion_topic' && @assignment.discussion_topic
|
||||
|
@ -374,6 +375,7 @@ class AssignmentsController < ApplicationController
|
|||
:ASSIGNMENT_GROUPS => json_for_assignment_groups,
|
||||
:GROUP_CATEGORIES => group_categories,
|
||||
:KALTURA_ENABLED => !!feature_enabled?(:kaltura),
|
||||
:POST_TO_SIS => @context.feature_enabled?(:post_grades),
|
||||
:SECTION_LIST => (@context.course_sections.active.map { |section|
|
||||
{:id => section.id, :name => section.name }
|
||||
}),
|
||||
|
@ -400,6 +402,7 @@ class AssignmentsController < ApplicationController
|
|||
if authorized_action(@assignment, @current_user, :update)
|
||||
params[:assignment][:time_zone_edited] = Time.zone.name if params[:assignment]
|
||||
params[:assignment] ||= {}
|
||||
@assignment.post_to_sis = params[:assignment][:post_to_sis]
|
||||
@assignment.updating_user = @current_user
|
||||
if params[:assignment][:default_grade]
|
||||
params[:assignment][:overwrite_existing_grades] = (params[:assignment][:overwrite_existing_grades] == "1")
|
||||
|
|
|
@ -38,7 +38,7 @@ class Assignment < ActiveRecord::Base
|
|||
:notify_of_update, :time_zone_edited, :turnitin_enabled,
|
||||
:turnitin_settings, :context, :position, :allowed_extensions,
|
||||
:external_tool_tag_attributes, :freeze_on_copy, :assignment_group_id,
|
||||
:only_visible_to_overrides
|
||||
:only_visible_to_overrides, :post_to_sis
|
||||
|
||||
attr_accessor :previous_id, :updating_user, :copying
|
||||
|
||||
|
@ -124,6 +124,7 @@ class Assignment < ActiveRecord::Base
|
|||
all_day_date
|
||||
created_at
|
||||
updated_at
|
||||
post_to_sis
|
||||
)
|
||||
# create a shim for plugins that use the old association name. this is
|
||||
# TEMPORARY. the plugins should update to use the new association name, and
|
||||
|
|
|
@ -44,8 +44,8 @@
|
|||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="control-group">
|
||||
|
||||
<div class="form-column-left no-group">
|
||||
<label for="assignment_points_possible">
|
||||
{{#t "points_possible"}}Points{{/t}}
|
||||
|
@ -61,11 +61,27 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<fieldset id="assignment_group_selector" class="control-group">
|
||||
</fieldset>
|
||||
|
||||
<div id="grading_type_selector"></div>
|
||||
|
||||
{{#if postToSISEnabled}}
|
||||
<div class="form-column-left"></div>
|
||||
<div class="form-column-right">
|
||||
<fieldset>
|
||||
<label class="checkbox">
|
||||
{{checkbox "postToSIS"
|
||||
id="assignment_post_to_sis"
|
||||
name="post_to_sis"
|
||||
}}
|
||||
{{#t "post_to_sis"}}Post to SIS{{/t}}
|
||||
</label>
|
||||
</fieldset>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
<div id="graded_assignment_fields"
|
||||
aria-expanded="{{not isNotGraded}}"
|
||||
style="{{hiddenIf isNotGraded}}">
|
||||
|
|
|
@ -35,6 +35,7 @@ module Api::V1::Assignment
|
|||
assignment_group_id
|
||||
peer_reviews
|
||||
automatic_peer_reviews
|
||||
post_to_sis
|
||||
grade_group_students_individually
|
||||
group_category_id
|
||||
grading_standard_id
|
||||
|
@ -46,6 +47,7 @@ module Api::V1::Assignment
|
|||
points_possible
|
||||
due_at
|
||||
assignment_group_id
|
||||
post_to_sis
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -67,6 +69,8 @@ module Api::V1::Assignment
|
|||
hash = api_json(assignment, user, session, fields)
|
||||
hash['course_id'] = assignment.context_id
|
||||
hash['name'] = assignment.title
|
||||
|
||||
hash['post_to_sis'] = assignment.post_to_sis
|
||||
hash['submission_types'] = assignment.submission_types_array
|
||||
hash['has_submitted_submissions'] = assignment.has_submitted_submissions?
|
||||
|
||||
|
@ -403,6 +407,11 @@ module Api::V1::Assignment
|
|||
end
|
||||
end
|
||||
|
||||
if assignment.context.feature_enabled?(:post_grades)
|
||||
if assignment_params.has_key? "post_to_sis"
|
||||
assignment.post_to_sis = value_to_boolean(assignment_params['post_to_sis'])
|
||||
end
|
||||
end
|
||||
assignment.updating_user = @current_user
|
||||
assignment.attributes = update_params
|
||||
assignment.infer_times
|
||||
|
|
Loading…
Reference in New Issue