Commit aeb28bdb by Brian Beggs

Adding custom tracer to help track filter_unread pagiation

parent 2e84f826
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment