Skip to content

Commit cd31b72

Browse files
committed
add description to todo item assignment return
Change-Id: I4232f70f88c1d34310d66aa62525f56d9e4389e5 Reviewed-on: https://gerrit.instructure.com/6083 Tested-by: Hudson <hudson@instructure.com> Reviewed-by: JT Olds <jt@instructure.com> Reviewed-by: Jacob Fugal <jacob@instructure.com>
1 parent 9f0aa5f commit cd31b72

3 files changed

Lines changed: 5 additions & 3 deletions

File tree

app/models/assignment.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1201,7 +1201,7 @@ def self.percent_considered_graded
12011201
# This should only be used in the course drop down to show assignments recently graded.
12021202
named_scope :need_submitting_info, lambda{|user_id, limit, ignored_ids|
12031203
ignored_ids ||= []
1204-
{:select => 'id, title, points_possible, due_at, context_id, context_type, submission_types,' +
1204+
{:select => 'id, title, points_possible, due_at, context_id, context_type, submission_types, description, ' +
12051205
'(SELECT name FROM courses WHERE id = assignments.context_id) AS context_name',
12061206
:conditions =>["(SELECT COUNT(id) FROM submissions
12071207
WHERE assignment_id = assignments.id
@@ -1216,7 +1216,7 @@ def self.percent_considered_graded
12161216
named_scope :need_grading_info, lambda{|limit, ignore_ids|
12171217
ignore_ids ||= []
12181218
{
1219-
:select => 'assignments.id, title, points_possible, due_at, context_id, context_type, submission_types, ' +
1219+
:select => 'assignments.id, title, points_possible, due_at, context_id, context_type, submission_types, description, ' +
12201220
'(SELECT name FROM courses WHERE id = assignments.context_id) AS context_name, needs_grading_count',
12211221
:conditions => "needs_grading_count > 0 #{ignore_ids.empty? ? "" : "AND id NOT IN (#{ignore_ids.join(',')})"}",
12221222
:limit => limit,

lib/api/v1/assignment.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def assignment_json(assignment, includes = [], show_admin_fields = false)
2222
hash = assignment.as_json(:include_root => false, :only => %w(id grading_type points_possible position due_at))
2323

2424
hash['name'] = assignment.title
25-
hash['description'] = api_user_content(assignment.description)
25+
hash['description'] = api_user_content(assignment.description, @context || assignment.context)
2626

2727
if show_admin_fields
2828
hash['needs_grading_count'] = assignment.needs_grading_count

spec/apis/v1/todo_items_api_spec.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
'type' => 'submitting',
4040
'assignment' => {
4141
'name' => 'required work',
42+
'description' => nil,
4243
'id' => @a.id,
4344
'muted' => false,
4445
'points_possible' => 10,
@@ -55,6 +56,7 @@
5556
'type' => 'grading',
5657
'assignment' => {
5758
'name' => 'text',
59+
'description' => nil,
5860
'id' => @a2.id,
5961
'muted' => false,
6062
'points_possible' => 15,

0 commit comments

Comments
 (0)