client/src/selectors/coreSelectors.js
changeset 137 279e1dffa213
parent 134 be36eed5e6e0
child 168 ea92f4fe783d
--- a/client/src/selectors/coreSelectors.js	Thu Aug 03 19:12:25 2017 +0200
+++ b/client/src/selectors/coreSelectors.js	Thu Aug 03 23:04:33 2017 +0200
@@ -43,3 +43,21 @@
 export const getCreatedNotes = getNoteMapSelector(ActionEnum.CREATED);
 
 export const getDeletedNotes = getNoteMapSelector(ActionEnum.DELETED);
+
+export const getActiveSessions = state => state.get('sessions').filter(session => session.get('action') !== ActionEnum.DELETED)
+
+export const getSessions = state => state.get('sessions')
+export const getNotes = state => state.get('notes')
+
+export const getSession = (sessionId, state) => {
+  const sessions = getSessions(state);
+  return sessions.find(session => session._id === sessionId)
+}
+
+export const getSessionNotes = (sessionId, state) => {
+  const notes = getNotes(state);
+  return notes.filter(note => {
+    return (note.get('session') === sessionId && note.get('action') !== ActionEnum.DELETED);
+  }).sortBy( n => n.get('startedAt') );
+}
+