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
aaa72d0f
Commit
aaa72d0f
authored
Aug 16, 2012
by
Rocky Duan
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into benchmark
parents
376aa1dc
d45766c1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
12 additions
and
9 deletions
+12
-9
Rakefile
+2
-2
models/comment_thread.rb
+1
-3
models/content.rb
+5
-0
spec/api/comment_thread_spec.rb
+2
-2
spec/spec_helper.rb
+2
-2
No files found.
Rakefile
View file @
aaa72d0f
...
...
@@ -51,7 +51,7 @@ namespace :db do
task
:clean
=>
:environment
do
Comment
.
delete_all
CommentThread
.
delete_all
Co
mmentThread
.
recalculate_all_context_tag_weights!
Co
ntent
.
recalculate_all_context_tag_weights!
User
.
delete_all
Notification
.
delete_all
Subscription
.
delete_all
...
...
@@ -183,7 +183,7 @@ namespace :db do
Comment
.
delete_all
CommentThread
.
delete_all
Co
mmentThread
.
recalculate_all_context_tag_weights!
Co
ntent
.
recalculate_all_context_tag_weights!
User
.
delete_all
Notification
.
delete_all
Subscription
.
delete_all
...
...
models/comment_thread.rb
View file @
aaa72d0f
...
...
@@ -3,11 +3,9 @@ require_relative 'content'
class
CommentThread
<
Content
include
Mongo
::
Voteable
include
Mongoid
::
Timestamps
include
Mongoid
::
TaggableWithContext
include
Mongoid
::
TaggableWithContext
::
AggregationStrategy
::
RealTime
voteable
self
,
:up
=>
+
1
,
:down
=>
-
1
taggable
separator:
','
,
default:
[]
field
:comment_count
,
type:
Integer
,
default:
0
field
:title
,
type:
String
...
...
models/content.rb
View file @
aaa72d0f
class
Content
include
Mongoid
::
Document
include
Mongoid
::
TaggableWithContext
include
Mongoid
::
TaggableWithContext
::
AggregationStrategy
::
RealTime
taggable
separator:
','
,
default:
[]
def
author_with_anonymity
(
attr
=
nil
,
attr_when_anonymous
=
nil
)
if
not
attr
...
...
spec/api/comment_thread_spec.rb
View file @
aaa72d0f
...
...
@@ -137,7 +137,7 @@ describe "app" do
end
describe
"GET /api/v1/threads/tags"
do
it
"get all tags used in threads"
do
Co
mmentThread
.
recalculate_all_context_tag_weights!
Co
ntent
.
recalculate_all_context_tag_weights!
thread1
=
CommentThread
.
all
.
to_a
.
first
thread2
=
CommentThread
.
all
.
to_a
.
last
thread1
.
tags
=
"a, b, c"
...
...
@@ -162,7 +162,7 @@ describe "app" do
end
it
"returns autocomplete results"
do
CommentThread
.
delete_all
Co
mmentThread
.
recalculate_all_context_tag_weights!
Co
ntent
.
recalculate_all_context_tag_weights!
create_comment_thread
"c++, clojure, common-lisp, c#, c, coffeescript"
create_comment_thread
"c++, clojure, common-lisp, c#, c"
create_comment_thread
"c++, clojure, common-lisp, c#"
...
...
spec/spec_helper.rb
View file @
aaa72d0f
...
...
@@ -37,7 +37,7 @@ end
def
init_without_subscriptions
Comment
.
delete_all
CommentThread
.
delete_all
Co
mmentThread
.
recalculate_all_context_tag_weights!
Co
ntent
.
recalculate_all_context_tag_weights!
User
.
delete_all
Notification
.
delete_all
Subscription
.
delete_all
...
...
@@ -110,7 +110,7 @@ end
def
init_with_subscriptions
Comment
.
delete_all
CommentThread
.
delete_all
Co
mmentThread
.
recalculate_all_context_tag_weights!
Co
ntent
.
recalculate_all_context_tag_weights!
User
.
delete_all
Notification
.
delete_all
Subscription
.
delete_all
...
...
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