From 4de9071f1a881054ce1a31cc9382c7af9c8818ee Mon Sep 17 00:00:00 2001 From: Nick Winter Date: Thu, 16 Apr 2015 08:03:02 -0700 Subject: [PATCH] Added a projection to Clans getMemberSessions to help with the gargantuan fetch running us out of memory. --- app/styles/play/campaign-view.sass | 1 - app/views/clans/ClanDetailsView.coffee | 1 + server/clans/clan_handler.coffee | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/styles/play/campaign-view.sass b/app/styles/play/campaign-view.sass index 3882f5e98..b214c3767 100644 --- a/app/styles/play/campaign-view.sass +++ b/app/styles/play/campaign-view.sass @@ -110,7 +110,6 @@ $gameControlMargin: 30px @include box-shadow(0px 0px 35px skyblue) .level-difficulty-banner-text - position: absolute position: absolute bottom: 170% pointer-events: none diff --git a/app/views/clans/ClanDetailsView.coffee b/app/views/clans/ClanDetailsView.coffee index da3640f9b..337e4c490 100644 --- a/app/views/clans/ClanDetailsView.coffee +++ b/app/views/clans/ClanDetailsView.coffee @@ -35,6 +35,7 @@ module.exports = class ClanDetailsView extends RootView @clan = new Clan _id: @clanID @members = new CocoCollection([], { url: "/db/clan/#{@clanID}/members", model: User, comparator:'slug' }) @memberAchievements = new CocoCollection([], { url: "/db/clan/#{@clanID}/member_achievements", model: EarnedAchievement, comparator:'_id' }) + # MemberSessions: only loads creatorName, levelName, codeLanguage, submittedCodeLanguage for each session @memberSessions = new CocoCollection([], { url: "/db/clan/#{@clanID}/member_sessions", model: LevelSession, comparator:'_id' }) @listenTo me, 'sync', => @render?() diff --git a/server/clans/clan_handler.coffee b/server/clans/clan_handler.coffee index d0f221518..9fdb275f1 100644 --- a/server/clans/clan_handler.coffee +++ b/server/clans/clan_handler.coffee @@ -116,7 +116,7 @@ ClanHandler = class ClanHandler extends Handler return @sendDatabaseError(res, err) if err return @sendDatabaseError(res, err) unless clan memberIDs = _.map clan.get('members') ? [], (memberID) -> memberID.toHexString() - LevelSession.find {creator: {$in: memberIDs}}, (err, documents) => + LevelSession.find {creator: {$in: memberIDs}}, 'creatorName levelName codeLanguage submittedCodeLanguage', (err, documents) => return @sendDatabaseError(res, err) if err? cleandocs = (LevelSessionHandler.formatEntity(req, doc) for doc in documents) @sendSuccess(res, cleandocs)