From 896ee094c6d79b242ae51a1294d0cf352ce962f8 Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 13 Mar 2013 19:44:41 -0400 Subject: [PATCH] added comment to explain sorting --- .../static/coffee/src/discussion/discussion.coffee | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/common/static/coffee/src/discussion/discussion.coffee b/common/static/coffee/src/discussion/discussion.coffee index 2294d4a65a..2a92091f53 100644 --- a/common/static/coffee/src/discussion/discussion.coffee +++ b/common/static/coffee/src/discussion/discussion.coffee @@ -58,7 +58,13 @@ if Backbone? @current_page = response.page sortByDate: (thread) -> - + # + #The comment client asks each thread for a value by which to sort the collection + #and calls this sort routine regardless of the order returned from the LMS/comments service + #so, this takes advantage of this per-thread value and returns tomorrow's date + #for pinned threads, ensuring that they appear first, which is the intent of pinned threads + #the negative is to display most recent first + # if thread.get('pinned') #use tomorrow's date today = new Date(); @@ -67,9 +73,11 @@ if Backbone? thread.get("created_at") - - sortByDateRecentFirst: (thread) -> + # + #Same as above + #the negative is to display most recent first (basically to flip the order) + # if thread.get('pinned') #use tomorrow's date today = new Date();