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
OpenEdx
cs_comments_service
Commits
aeb28bdb
Commit
aeb28bdb
authored
Oct 20, 2015
by
Brian Beggs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding custom tracer to help track filter_unread pagiation
parent
2e84f826
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
0 deletions
+4
-0
lib/helpers.rb
+4
-0
No files found.
lib/helpers.rb
View file @
aeb28bdb
...
...
@@ -142,6 +142,8 @@ helpers do
comment_threads
=
context_threads
end
if
filter_flagged
self
.
class
.
trace_execution_scoped
([
'Custom/handle_threads_query/find_flagged'
])
do
# TODO replace with aggregate query?
...
...
@@ -179,6 +181,7 @@ helpers do
if
request_user
and
filter_unread
# Filter and paginate based on user read state. Requires joining a subdocument of the
# user object with documents in the contents collection, which has to be done in memory.
self
.
class
.
trace_execution_scoped
([
'Custom/handle_threads_query/filter_unread'
])
do
read_dates
=
{}
read_state
=
request_user
.
read_states
.
where
(
:course_id
=>
course_id
).
first
if
read_state
...
...
@@ -215,6 +218,7 @@ helpers do
# there definitely are no more pages. This is really only acceptable for pagers
# that don't actually reveal the total number of pages to the user onscreen.
num_pages
=
has_more
?
page
+
1
:
page
end
else
# let the installed paginator library handle pagination
num_pages
=
[
1
,
(
comment_threads
.
count
/
per_page
.
to_f
).
ceil
].
max
...
...
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