Skip to content

Commit c65959f

Browse files
committed
prepare for data migration
closes CNVS-34933 test plan: - specs pass Change-Id: Ife540fd1ddbc09670aed568fe38122d1090e0220 Reviewed-on: https://gerrit.instructure.com/102041 Reviewed-by: Neil Gupta <ngupta@instructure.com> Tested-by: Jenkins Product-Review: Keith T. Garner <kgarner@instructure.com> QA-Review: Keith T. Garner <kgarner@instructure.com>
1 parent b6f04e9 commit c65959f

3 files changed

Lines changed: 10 additions & 3 deletions

File tree

app/controllers/assignments_controller.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,13 @@ def edit
395395
@assignment.submission_types = params[:submission_types] if params[:submission_types]
396396
@assignment.assignment_group_id = params[:assignment_group_id] if params[:assignment_group_id]
397397
@assignment.ensure_assignment_group(false)
398-
@assignment.post_to_sis = params[:post_to_sis] if params[:post_to_sis]
398+
399+
if params.key?(:post_to_sis)
400+
@assignment.post_to_sis = value_to_boolean(params[:post_to_sis])
401+
elsif @assignment.new_record?
402+
@assignment.post_to_sis = @context.account.sis_default_grade_export[:value]
403+
end
404+
399405
if @assignment.submission_types == 'online_quiz' && @assignment.quiz
400406
return redirect_to edit_course_quiz_url(@context, @assignment.quiz, index_edit_params)
401407
elsif @assignment.submission_types == 'discussion_topic' && @assignment.discussion_topic

app/models/assignment.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ def self.all_day_interpretation(opts={})
485485
end
486486
else
487487
# no due at = all_day and all_day_date are irrelevant
488-
return nil, nil
488+
return false, nil
489489
end
490490
end
491491

@@ -952,7 +952,7 @@ def include_description?(user, lock_info=nil)
952952
end
953953

954954
def all_day
955-
read_attribute(:all_day) || (self.new_record? && self.due_at && (self.due_at.strftime("%H:%M") == '23:59' || self.due_at.strftime("%H:%M") == '00:00'))
955+
read_attribute(:all_day) || (self.new_record? && !!self.due_at && (self.due_at.strftime("%H:%M") == '23:59' || self.due_at.strftime("%H:%M") == '00:00'))
956956
end
957957

958958
def self.preload_context_module_tags(assignments, include_context_modules: false)

app/models/importers/discussion_topic_importer.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ def run
7878
# options[:skip_replies] = true unless options.importable_entries?
7979
[:migration_id, :title, :discussion_type, :position, :pinned,
8080
:require_initial_post, :allow_rating, :only_graders_can_rate, :sort_by_rating].each do |attr|
81+
next if options[attr].nil? && item.class.columns_hash[attr.to_s].type == :boolean
8182
item.send("#{attr}=", options[attr])
8283
end
8384

0 commit comments

Comments
 (0)