Skip to content

Commit

Permalink
Merge pull request redacademy#125 from redacademy/feature-changeatten…
Browse files Browse the repository at this point in the history
…deestospeakers

Feature changeattendeestospeakers
  • Loading branch information
codedavinci authored Sep 21, 2017
2 parents 3329c9b + 0edea5b commit d7d1057
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 10 deletions.
2 changes: 1 addition & 1 deletion js/scenes/Event/Event.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ SingleEvent.propTypes = {
eventCode: PropTypes.string,
id: PropTypes.string,
location: PropTypes.objectOf(PropTypes.string),
speakers: PropTypes.arrayOf(PropTypes.string),
//speakers: PropTypes.arrayOf(PropTypes.string),
talks: PropTypes.arrayOf(PropTypes.string)
}).isRequired,
eventDataSet: PropTypes.arrayOf(PropTypes.shape({
Expand Down
4 changes: 2 additions & 2 deletions js/scenes/Event/EventContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ EventContainer.propTypes = {
eventCode: PropTypes.string,
id: PropTypes.string,
location: PropTypes.objectOf(PropTypes.string),
speakers: PropTypes.arrayOf(PropTypes.string),
//speakers: PropTypes.arrayOf(PropTypes.string),
talks: PropTypes.arrayOf(PropTypes.string)
})).isRequired,
}).isRequired,
Expand Down Expand Up @@ -115,7 +115,7 @@ EventContainer.propTypes = {
eventCode: PropTypes.string,
id: PropTypes.string,
location: PropTypes.objectOf(PropTypes.string),
speakers: PropTypes.arrayOf(PropTypes.string),
//speakers: PropTypes.arrayOf(PropTypes.string),
talks: PropTypes.arrayOf(PropTypes.string)
}).isRequired
}).isRequired
Expand Down
8 changes: 4 additions & 4 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 Expand Up @@ -108,7 +108,7 @@ Events.PropTypes = {
id: PropTypes.string,
eventCode: PropTypes.string,
attendees: PropTypes.objectOf(PropTypes.string),
speakers: PropTypes.objectOf(PropTypes.string),
//speakers: PropTypes.objectOf(PropTypes.string),
talks: PropTypes.objectOf(PropTypes.string),
location: PropTypes.objectOf(PropTypes.shape({
city: PropTypes.string,
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
2 changes: 1 addition & 1 deletion js/scenes/TalkStats/TalkStatsContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ TalkStatsContainer.propTypes = {
eventCode: PropTypes.string,
event_id: PropTypes.string,
score: PropTypes.number,
speaker_id: PropTypes.string,
//speaker_id: PropTypes.string,
talkStats: PropTypes.arrayOf(PropTypes.shape({
quality: PropTypes.string,
value: PropTypes.number,
Expand Down

0 comments on commit d7d1057

Please sign in to comment.