Skip to content

Commit

Permalink
fixed issue 1
Browse files Browse the repository at this point in the history
  • Loading branch information
quasarchimaere committed Jul 19, 2017
1 parent 779c5ca commit fb9ce3c
Showing 1 changed file with 9 additions and 4 deletions.
Expand Up @@ -69,14 +69,19 @@ function genComponentConf() {
const allConnections = selectAllConnections(state);
const allMessages = selectAllMessages(state);

const nrOfUnreadMessages= allMessages && allMessages.filter(msg => !msg.get("outgoingMessage") && msg.get("newMessage")).size; //only count incoming messages
const nrOfUnreadIncomingRequests= allConnections && allConnections.filter(conn => conn.get("state") === won.WON.RequestReceived && conn.get("newConnection")).size;
const nrOfUnreadMatches= allConnections && allConnections.filter(conn => conn.get("state") === won.WON.Suggested && conn.get("newConnection")).size;
const nrOfNeedsWithUnreadEvents= undefined; //TODO: COUNT HOW MANY NEEDS HAVE AT LEAST ONE NEW CONNECTION OR ONE NEW MESSAGE

return {
hasPosts: ownNeeds && ownNeeds.size > 0,
hasRequests: allConnections && allConnections.filter(conn => conn.get("state") === won.WON.RequestReceived).size > 0,
hasMatches: allConnections && allConnections.filter(conn => conn.get("state") === won.WON.Suggested).size > 0,
nrOfUnreadMessages: allMessages && allMessages.filter(msg => !msg.get("outgoingMessage") && msg.get("newMessage")).size, //only count incoming messages
nrOfUnreadIncomingRequests: allConnections && allConnections.filter(conn => conn.get("state") === won.WON.RequestReceived && conn.get("newConnection")).size,
nrOfUnreadMatches: allConnections && allConnections.filter(conn => conn.get("state") === won.WON.Suggested && conn.get("newConnection")).size,
nrOfNeedsWithUnreadEvents: undefined, //TODO: COUNT HOW MANY NEEDS HAVE AT LEAST ONE NEW CONNECTION OR ONE NEW MESSAGE
nrOfUnreadMessages: nrOfUnreadMessages ? nrOfUnreadMessages : undefined,
nrOfUnreadIncomingRequests: nrOfUnreadIncomingRequests ? nrOfUnreadIncomingRequests : undefined,
nrOfUnreadMatches: nrOfUnreadMatches ? nrOfUnreadMatches : undefined,
nrOfNeedsWithUnreadEvents: nrOfNeedsWithUnreadEvents ? nrOfNeedsWithUnreadEvents : undefined,
};
};

Expand Down

0 comments on commit fb9ce3c

Please sign in to comment.