Skip to content

Commit

Permalink
changed events to load speaker imgs not attendees
Browse files Browse the repository at this point in the history
  • Loading branch information
cShingleton committed Sep 21, 2017
1 parent 3329c9b commit 1e0b3e3
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
6 changes: 3 additions & 3 deletions js/scenes/Events/Events.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ const Events = ({
<Text style={styles.eventTime}>{eventTime(item.startTime)} - {eventTime(item.endTime)}</Text>
</View>
<View style={styles.attendeeContainer}>
{item.attendees.map(attendee => (
{item.speakers.map(speaker => (
<Image
key={attendee.user_id}
key={speaker.user_id}
style={styles.attendeeImage}
source={{ uri: attendee.imageUrl }}
source={{ uri: speaker.imageUrl }}
/>
))}
</View>
Expand Down
4 changes: 2 additions & 2 deletions js/scenes/Events/EventsContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import '../../redux/modules/actions/eventActions';
import { colors, typography } from '../../config/styles';
import { auth } from '../../config/firebase';
import { getTime } from '../../config/helpers';
import { idToObjs } from '../Lib/helperFunctions';
import { idToObjsSpeakers } from '../Lib/helperFunctions';

class EventsContainer extends Component {
static route = {
Expand Down Expand Up @@ -57,7 +57,7 @@ class EventsContainer extends Component {

withAttendeeData = (events, users) => {
return events.map(event => {
return idToObjs(event, users);
return idToObjsSpeakers(event, users);
});
}

Expand Down
7 changes: 7 additions & 0 deletions js/scenes/Lib/helperFunctions.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ export const idToObjs = (event, users) => {
}, { ...event, attendees: [] });
}

export const idToObjsSpeakers = (event, users) => {
return event.speakers.reduce((acc, cur) => {
acc.speakers.push(users[cur])
return acc;
}, { ...event, speakers: [] });
}

export const getNextEvent = (events, users) => {
return idToObjs(calcNextEventDate(events), users);
}
Expand Down

0 comments on commit 1e0b3e3

Please sign in to comment.