From 1bd5078ecf8ed96c88d1fc528938f112fb899978 Mon Sep 17 00:00:00 2001 From: Matt Lott Date: Fri, 9 Oct 2015 09:27:30 -0700 Subject: [PATCH] :bug:Sort course details nameless members --- app/views/courses/CourseDetailsView.coffee | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/views/courses/CourseDetailsView.coffee b/app/views/courses/CourseDetailsView.coffee index cc6d60696..fcaae13a4 100644 --- a/app/views/courses/CourseDetailsView.coffee +++ b/app/views/courses/CourseDetailsView.coffee @@ -281,7 +281,10 @@ module.exports = class CourseDetailsView extends RootView @sortedMembers = @courseInstance.get('members') switch @memberSort when "nameDesc" - @sortedMembers.sort (a, b) => @memberUserMap[b]?.get('name').localeCompare(@memberUserMap[a]?.get('name')) + @sortedMembers.sort (a, b) => + aName = @memberUserMap[a]?.get('name') ? 'Anoner' + bName = @memberUserMap[b]?.get('name') ? 'Anoner' + bName.localeCompare(aName) when "progressAsc" @sortedMembers.sort (a, b) => for levelID, level of @campaign.get('levels') @@ -299,4 +302,7 @@ module.exports = class CourseDetailsView extends RootView return -1 0 else - @sortedMembers.sort (a, b) => @memberUserMap[a]?.get('name').localeCompare(@memberUserMap[b]?.get('name')) + @sortedMembers.sort (a, b) => + aName = @memberUserMap[a]?.get('name') ? 'Anoner' + bName = @memberUserMap[b]?.get('name') ? 'Anoner' + aName.localeCompare(bName)