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
259f6f93
Commit
259f6f93
authored
Jun 26, 2012
by
Rocky Duan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use level instead of depth
parent
485b11b1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
Rakefile
+2
-2
No files found.
Rakefile
View file @
259f6f93
...
...
@@ -26,14 +26,14 @@ namespace :db do
CommentThread
.
delete_all
Vote
.
delete_all
User
.
delete_all
depth_limit
=
YAML
.
load_file
(
"config/application.yml"
)[
"depth
_limit"
]
level_limit
=
YAML
.
load_file
(
"config/application.yml"
)[
"level
_limit"
]
(
1
..
3
).
each
do
|
question_id
|
comment_thread
=
CommentThread
.
create!
:commentable_type
=>
"questions"
,
:commentable_id
=>
question_id
5
.
times
do
comment_thread
.
root_comments
.
create
:body
=>
"top comment"
,
:title
=>
"top
#{
rand
(
10
)
}
"
,
:user_id
=>
1
,
:course_id
=>
1
,
:comment_thread_id
=>
comment_thread
.
id
end
10
.
times
do
comment
=
Comment
.
all
.
reject
{
|
c
|
c
.
is_root?
or
c
.
depth
-
1
>=
depth
_limit
or
c
.
comment_thread_id
!=
comment_thread
.
id
}.
sample
comment
=
Comment
.
all
.
reject
{
|
c
|
c
.
is_root?
or
c
.
depth
>=
level
_limit
or
c
.
comment_thread_id
!=
comment_thread
.
id
}.
sample
comment
.
children
.
create
:body
=>
"comment body"
,
:title
=>
"comment title
#{
rand
(
50
)
}
"
,
:user_id
=>
1
,
:course_id
=>
1
,
:comment_thread_id
=>
comment_thread
.
id
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