client/src/components/Session.js
changeset 129 d48946d164c6
parent 125 c653f49fabfb
child 137 279e1dffa213
equal deleted inserted replaced
128:34a75bd8d0b9 129:d48946d164c6
     9 import SessionForm from './SessionForm';
     9 import SessionForm from './SessionForm';
    10 import SessionSummary from './SessionSummary';
    10 import SessionSummary from './SessionSummary';
    11 import * as sessionsActions from '../actions/sessionsActions';
    11 import * as sessionsActions from '../actions/sessionsActions';
    12 import * as notesActions from '../actions/notesActions';
    12 import * as notesActions from '../actions/notesActions';
    13 import * as userActions from '../actions/userActions';
    13 import * as userActions from '../actions/userActions';
       
    14 import { ActionEnum } from '../constants';
    14 
    15 
    15 class Session extends Component {
    16 class Session extends Component {
    16   render() {
    17   render() {
    17     return (
    18     return (
    18       <div>
    19       <div>
    53 
    54 
    54 function mapStateToProps(state, props) {
    55 function mapStateToProps(state, props) {
    55 
    56 
    56   const sessionId = props.match.params.id;
    57   const sessionId = props.match.params.id;
    57 
    58 
    58   const sessions = state['sessions'];
    59   const sessions = state.get('sessions');
    59   const notes = state['notes'];
    60   const notes = state.get('notes');
    60   const autoSubmit = state['autoSubmit'];
    61   const autoSubmit = state.get('autoSubmit');
    61 
    62 
    62   const currentSession = sessions.find(session => session._id === sessionId);
    63   const currentSession = sessions.find(session => session._id === sessionId);
    63   const currentNotes = notes.filter(note => {
    64   const currentNotes = notes.filter(note => {
    64         return (note.session === sessionId && !note.deleted);
    65         return (note.get('session') === sessionId && note.get('action') !== ActionEnum.DELETED);
    65     }).sortBy( n => n.get('startedAt') );
    66     }).sortBy( n => n.get('startedAt') );
    66 
    67 
    67   return {
    68   return {
    68     currentSession,
    69     currentSession,
    69     sessions,
    70     sessions,