client/src/selectors/coreSelectors.js
changeset 137 279e1dffa213
parent 134 be36eed5e6e0
child 168 ea92f4fe783d
equal deleted inserted replaced
136:1a3be12af395 137:279e1dffa213
    41 export const getUpdatedNotes = getNoteMapSelector(ActionEnum.UPDATED);
    41 export const getUpdatedNotes = getNoteMapSelector(ActionEnum.UPDATED);
    42 
    42 
    43 export const getCreatedNotes = getNoteMapSelector(ActionEnum.CREATED);
    43 export const getCreatedNotes = getNoteMapSelector(ActionEnum.CREATED);
    44 
    44 
    45 export const getDeletedNotes = getNoteMapSelector(ActionEnum.DELETED);
    45 export const getDeletedNotes = getNoteMapSelector(ActionEnum.DELETED);
       
    46 
       
    47 export const getActiveSessions = state => state.get('sessions').filter(session => session.get('action') !== ActionEnum.DELETED)
       
    48 
       
    49 export const getSessions = state => state.get('sessions')
       
    50 export const getNotes = state => state.get('notes')
       
    51 
       
    52 export const getSession = (sessionId, state) => {
       
    53   const sessions = getSessions(state);
       
    54   return sessions.find(session => session._id === sessionId)
       
    55 }
       
    56 
       
    57 export const getSessionNotes = (sessionId, state) => {
       
    58   const notes = getNotes(state);
       
    59   return notes.filter(note => {
       
    60     return (note.get('session') === sessionId && note.get('action') !== ActionEnum.DELETED);
       
    61   }).sortBy( n => n.get('startedAt') );
       
    62 }
       
    63