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
a1da8b80
Commit
a1da8b80
authored
Sep 19, 2013
by
jimabramson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix 2 bugs in comment sort key creation
parent
113dfb91
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
3 deletions
+3
-3
models/comment.rb
+1
-1
scripts/db/migrate-001-sk-author_username.js
+2
-2
No files found.
models/comment.rb
View file @
a1da8b80
...
@@ -23,7 +23,7 @@ class Comment < Content
...
@@ -23,7 +23,7 @@ class Comment < Content
def
set_sk
()
def
set_sk
()
# this attribute is explicitly write-once
# this attribute is explicitly write-once
if
self
.
sk
.
nil?
if
self
.
sk
.
nil?
self
.
sk
=
(
self
.
parent_ids
<<
self
.
id
).
join
(
"-"
)
self
.
sk
=
(
self
.
parent_ids
.
dup
<<
self
.
id
).
join
(
"-"
)
end
end
end
end
...
...
scripts/db/migrate-001-sk-author_username.js
View file @
a1da8b80
...
@@ -31,10 +31,10 @@ db.contents.find({"_type":"Comment","sk":{$exists:false}}).forEach(function (doc
...
@@ -31,10 +31,10 @@ db.contents.find({"_type":"Comment","sk":{$exists:false}}).forEach(function (doc
if
(
typeof
(
doc
.
parent_ids
)
===
"undefined"
)
{
if
(
typeof
(
doc
.
parent_ids
)
===
"undefined"
)
{
sort_ids
=
[];
sort_ids
=
[];
}
else
{
}
else
{
sort_ids
=
doc
.
parent_ids
;
sort_ids
=
doc
.
parent_ids
.
slice
(
0
)
;
}
}
sort_ids
.
push
(
doc
.
_id
);
sort_ids
.
push
(
doc
.
_id
);
doc
.
sk
=
sort_ids
.
join
(
"-"
);
doc
.
sk
=
sort_ids
.
map
(
function
(
oid
)
{
return
oid
.
str
}).
join
(
"-"
);
db
.
contents
.
save
(
doc
);
db
.
contents
.
save
(
doc
);
}
}
cnt
+=
1
;
cnt
+=
1
;
...
...
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