add public_description to course model. fixes #7761
affects: course model, api test plan: * add a course with the api, included a public description; * verify that public description field is returned and exists on the course in the db. Change-Id: If2766cf7ba946af5cb8a5cafebaa8209754ec2b3 Reviewed-on: https://gerrit.instructure.com/9723 Tested-by: Cody Cutrer <cody@instructure.com> Tested-by: Zach Wily <zach@instructure.com> Reviewed-by: Jon Jensen <jon@instructure.com>
This commit is contained in:
parent
e51ffb965f
commit
d536bb8c31
|
@ -106,6 +106,7 @@ class CoursesController < ApplicationController
|
|||
# @argument course[conclude_at] [Datetime] [optional] Course end date in ISO8601 format. e.g. 2011-01-01T01:00Z
|
||||
# @argument course[license] [String] [optional] The name of the licensing. Should be one of the following abbreviations (a descriptive name is included in parenthesis for reference): 'private' (Private Copyrighted); 'cc_by_nc_nd' (CC Attribution Non-Commercial No Derivatives); 'cc_by_nc_sa' (CC Attribution Non-Commercial Share Alike); 'cc_by_nc' (CC Attribution Non-Commercial); 'cc_by_nd' (CC Attribution No Derivatives); 'cc_by_sa' (CC Attribution Share Alike); 'cc_by' (CC Attribution); 'public_domain' (Public Domain).
|
||||
# @argument course[is_public] [Boolean] [optional] Set to true if course if public.
|
||||
# @argument course[public_description] [String] [optional] A publicly visible description of the course.
|
||||
# @argument course[allow_student_wiki_edits] [Boolean] [optional] If true, students will be able to modify the course wiki.
|
||||
# @argument course[allow_student_assignment_edits] [optional] Set to true if students should be allowed to make modifications to assignments.
|
||||
# @argument course[allow_wiki_comments] [Boolean] [optional] If true, course members will be able to comment on wiki pages.
|
||||
|
@ -140,7 +141,7 @@ class CoursesController < ApplicationController
|
|||
[:start_at, :conclude_at, :license, :publish_grades_immediately,
|
||||
:is_public, :allow_student_assignment_edits, :allow_wiki_comments,
|
||||
:allow_student_forum_attachments, :open_enrollment, :self_enrollment,
|
||||
:root_account_id, :account_id],
|
||||
:root_account_id, :account_id, :public_description],
|
||||
nil)
|
||||
}
|
||||
else
|
||||
|
|
|
@ -35,6 +35,7 @@ class Course < ActiveRecord::Base
|
|||
:hashtag,
|
||||
:show_public_context_messages,
|
||||
:syllabus_body,
|
||||
:public_description,
|
||||
:allow_student_forum_attachments,
|
||||
:default_wiki_editing_roles,
|
||||
:allow_student_organized_groups,
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
class AddPublicDescriptionToCourses < ActiveRecord::Migration
|
||||
tag :predeploy
|
||||
|
||||
def self.up
|
||||
add_column :courses, :public_description, :text
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_column :courses, :public_description
|
||||
end
|
||||
end
|
|
@ -24,6 +24,7 @@ module Api::V1::Course
|
|||
include_syllabus = includes.include?('syllabus_body')
|
||||
include_total_scores = includes.include?('total_scores') && !course.settings[:hide_final_grade]
|
||||
include_url = includes.include?('html_url')
|
||||
include_description = includes.include?('public_description')
|
||||
|
||||
base_attributes = %w(id name course_code account_id)
|
||||
allowed_attributes = includes.is_a?(Array) ? base_attributes + includes : base_attributes
|
||||
|
@ -48,6 +49,9 @@ module Api::V1::Course
|
|||
if include_syllabus
|
||||
hash['syllabus_body'] = course.syllabus_body
|
||||
end
|
||||
if include_description
|
||||
hash['public_description'] = course.public_description
|
||||
end
|
||||
hash['html_url'] = course_url(course, :host => HostUrl.context_host(course)) if include_url
|
||||
hash
|
||||
end
|
||||
|
|
|
@ -124,7 +124,8 @@ describe CoursesController, :type => :integration do
|
|||
'open_enrollment' => true,
|
||||
'self_enrollment' => true,
|
||||
'license' => 'Creative Commons',
|
||||
'sis_course_id' => '12345'
|
||||
'sis_course_id' => '12345',
|
||||
'public_description' => 'Nature is lethal but it doesn\'t hold a candle to man.'
|
||||
}
|
||||
}
|
||||
course_response = post_params['course'].merge({
|
||||
|
@ -138,7 +139,7 @@ describe CoursesController, :type => :integration do
|
|||
[:name, :course_code, :start_at, :conclude_at, :publish_grades_immediately,
|
||||
:is_public, :allow_student_assignment_edits, :allow_wiki_comments,
|
||||
:open_enrollment, :self_enrollment, :license, :sis_course_id,
|
||||
:allow_student_forum_attachments].each do |attr|
|
||||
:allow_student_forum_attachments, :public_description].each do |attr|
|
||||
[:start_at, :conclude_at].include?(attr) ?
|
||||
new_course.send(attr).should == Time.parse(post_params['course'][attr.to_s]) :
|
||||
new_course.send(attr).should == post_params['course'][attr.to_s]
|
||||
|
|
Loading…
Reference in New Issue