Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
cs_comments_service
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
cs_comments_service
Commits
d2e14133
Commit
d2e14133
authored
Sep 05, 2014
by
Greg Price
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Filter commentable queries by course_id
Bug: TNL-207
parent
d26bc6b7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
0 deletions
+10
-0
api/commentables.rb
+3
-0
spec/api/commentable_spec.rb
+7
-0
No files found.
api/commentables.rb
View file @
d2e14133
...
@@ -5,6 +5,9 @@ end
...
@@ -5,6 +5,9 @@ end
get
"
#{
APIPREFIX
}
/:commentable_id/threads"
do
|
commentable_id
|
get
"
#{
APIPREFIX
}
/:commentable_id/threads"
do
|
commentable_id
|
threads
=
Content
.
where
({
"_type"
=>
"CommentThread"
,
"commentable_id"
=>
commentable_id
})
threads
=
Content
.
where
({
"_type"
=>
"CommentThread"
,
"commentable_id"
=>
commentable_id
})
if
params
[
"course_id"
]
threads
=
threads
.
where
({
"course_id"
=>
params
[
"course_id"
]})
end
handle_threads_query
(
handle_threads_query
(
threads
,
threads
,
...
...
spec/api/commentable_spec.rb
View file @
d2e14133
...
@@ -32,6 +32,13 @@ describe "app" do
...
@@ -32,6 +32,13 @@ describe "app" do
threads
.
index
{
|
c
|
c
[
"body"
]
==
"can anyone help me?"
}.
should_not
be_nil
threads
.
index
{
|
c
|
c
[
"body"
]
==
"can anyone help me?"
}.
should_not
be_nil
threads
.
index
{
|
c
|
c
[
"body"
]
==
"it is unsolvable"
}.
should_not
be_nil
threads
.
index
{
|
c
|
c
[
"body"
]
==
"it is unsolvable"
}.
should_not
be_nil
end
end
it
"filters by course_id"
do
course1_threads
=
thread_result
"question_1"
,
course_id:
"1"
course1_threads
.
length
.
should
==
1
course2_threads
=
thread_result
"question_1"
,
course_id:
"2"
course2_threads
.
length
.
should
==
1
course1_threads
.
should_not
==
course2_threads
end
it
"filters by group_id"
do
it
"filters by group_id"
do
group_thread
=
Commentable
.
find
(
"question_1"
).
comment_threads
.
first
group_thread
=
Commentable
.
find
(
"question_1"
).
comment_threads
.
first
threads
=
thread_result
"question_1"
,
group_id:
42
threads
=
thread_result
"question_1"
,
group_id:
42
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment