equal
deleted
inserted
replaced
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 import { getSession, getSessionNotes } from '../selectors/coreSelectors'; |
|
15 import { getAutoSubmit } from '../selectors/authSelectors'; |
15 |
16 |
16 class Session extends Component { |
17 class Session extends Component { |
17 render() { |
18 render() { |
18 return ( |
19 return ( |
19 <div> |
20 <div> |
54 |
55 |
55 function mapStateToProps(state, props) { |
56 function mapStateToProps(state, props) { |
56 |
57 |
57 const sessionId = props.match.params.id; |
58 const sessionId = props.match.params.id; |
58 |
59 |
59 const sessions = state.get('sessions'); |
60 const autoSubmit = getAutoSubmit(state); |
60 const notes = state.get('notes'); |
61 const currentSession = getSession(sessionId, state); |
61 const autoSubmit = state.get('autoSubmit'); |
62 const currentNotes = getSessionNotes(sessionId, state); |
62 |
|
63 const currentSession = sessions.find(session => session._id === sessionId); |
|
64 const currentNotes = notes.filter(note => { |
|
65 return (note.get('session') === sessionId && note.get('action') !== ActionEnum.DELETED); |
|
66 }).sortBy( n => n.get('startedAt') ); |
|
67 |
63 |
68 return { |
64 return { |
69 currentSession, |
65 currentSession, |
70 sessions, |
|
71 notes: currentNotes, |
66 notes: currentNotes, |
72 autoSubmit |
67 autoSubmit |
73 }; |
68 }; |
74 } |
69 } |
75 |
70 |