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
bbd83e3c
Commit
bbd83e3c
authored
Aug 29, 2014
by
Greg Price
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove unused endpoints
parent
ffb1dcfb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
34 deletions
+0
-34
api/search.rb
+0
-32
app.rb
+0
-2
No files found.
api/search.rb
View file @
bbd83e3c
...
@@ -89,35 +89,3 @@ get "#{APIPREFIX}/search/threads" do
...
@@ -89,35 +89,3 @@ get "#{APIPREFIX}/search/threads" do
result_obj
.
to_json
result_obj
.
to_json
end
end
end
end
get
"
#{
APIPREFIX
}
/search/threads/more_like_this"
do
CommentThread
.
tire
.
search
page:
1
,
per_page:
5
,
load:
true
do
|
search
|
search
.
query
do
|
query
|
query
.
more_like_this
params
[
"text"
],
fields:
[
"title"
,
"body"
],
min_doc_freq:
1
,
min_term_freq:
1
end
end
.
results
.
map
(
&
:to_hash
).
to_json
end
get
"
#{
APIPREFIX
}
/search/threads/recent_active"
do
return
[].
to_json
if
not
params
[
"course_id"
]
follower_id
=
params
[
"follower_id"
]
from_time
=
{
"today"
=>
Date
.
today
.
to_time
,
"this_week"
=>
Date
.
today
.
to_time
-
1
.
weeks
,
"this_month"
=>
Date
.
today
.
to_time
-
1
.
months
,
}[
params
[
"from_time"
]
||
"this_week"
]
query_params
=
{}
query_params
[
"course_id"
]
=
params
[
"course_id"
]
if
params
[
"course_id"
]
query_params
[
"commentable_id"
]
=
params
[
"commentable_id"
]
if
params
[
"commentable_id"
]
comment_threads
=
if
follower_id
User
.
find
(
follower_id
).
subscribed_threads
else
CommentThread
.
all
end
comment_threads
.
where
(
query_params
.
merge
(
:last_activity_at
=>
{:
$gte
=>
from_time
})).
order_by
(
:last_activity_at
.
desc
).
limit
(
5
).
to_a
.
map
(
&
:to_hash
).
to_json
end
app.rb
View file @
bbd83e3c
...
@@ -5,8 +5,6 @@ require 'erb'
...
@@ -5,8 +5,6 @@ require 'erb'
Bundler
.
setup
Bundler
.
setup
Bundler
.
require
Bundler
.
require
require
'tire/queries/more_like_this'
env_index
=
ARGV
.
index
(
"-e"
)
env_index
=
ARGV
.
index
(
"-e"
)
env_arg
=
ARGV
[
env_index
+
1
]
if
env_index
env_arg
=
ARGV
[
env_index
+
1
]
if
env_index
environment
=
env_arg
||
ENV
[
"SINATRA_ENV"
]
||
"development"
environment
=
env_arg
||
ENV
[
"SINATRA_ENV"
]
||
"development"
...
...
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