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
8f69e22c
Commit
8f69e22c
authored
Mar 12, 2015
by
Chris Dodge
Committed by
Jonathan Piacenti
Aug 12, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add a get_num_followers endpoint
parent
49a53c4c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
1 deletions
+14
-1
api/comment_threads.rb
+14
-1
No files found.
api/comment_threads.rb
View file @
8f69e22c
get
"
#{
APIPREFIX
}
/threads"
do
# retrieve threads by course
get
"
#{
APIPREFIX
}
/threads"
do
# retrieve threads by course
threads
=
Content
.
where
({
"_type"
=>
"CommentThread"
,
"course_id"
=>
params
[
"course_id"
]})
threads
=
Content
.
where
({
"_type"
=>
"CommentThread"
,
"course_id"
=>
params
[
"course_id"
]})
if
params
[
:commentable_ids
]
if
params
[
:commentable_ids
]
threads
=
threads
.
in
({
"commentable_id"
=>
params
[
:commentable_ids
].
split
(
","
)})
threads
=
threads
.
in
({
"commentable_id"
=>
params
[
:commentable_ids
].
split
(
","
)})
...
@@ -105,3 +105,16 @@ get "#{APIPREFIX}/courses/*/stats" do |course_id| # retrieve stats by course
...
@@ -105,3 +105,16 @@ get "#{APIPREFIX}/courses/*/stats" do |course_id| # retrieve stats by course
course_stats
.
to_json
course_stats
.
to_json
end
end
end
end
get
"
#{
APIPREFIX
}
/threads/:thread_id/num_followers"
do
|
thread_id
|
begin
exclude_user_id
=
0
if
params
.
has_key?
(
"exclude_user_id"
)
exclude_user_id
=
Integer
(
params
[
"exclude_user_id"
])
end
thread_followers
=
{
"num_followers"
=>
Subscription
.
where
(
:subscriber_id
.
ne
=>
exclude_user_id
,
source_id:
thread_id
).
count
()
}
thread_followers
.
to_json
end
end
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