diff --git a/js/components/NewSuggestion.js b/js/components/NewSuggestion.js index 918a251..c9b8ddf 100644 --- a/js/components/NewSuggestion.js +++ b/js/components/NewSuggestion.js @@ -82,6 +82,21 @@ module.exports = React.createClass({ suggestion.RestaurantName = this.state.suggestion; suggestion.VetoingId = this.getLastSuggestion(); this.props.createSuggestion(suggestion); + this.setState({ + attendee: null, + suggestion: null + }); + }, + unusedPopularSuggestions: function() { + var props = this.props; + return props.popularSuggestions.filter( + function(suggestion){ + for (var suggestionId in props.suggestions) { + if (props.suggestions[suggestionId].RestaurantName == suggestion.RestaurantName) + return false; + } + return true; + }); }, render: function() { var attendeeList = this.getAttendeeList(); @@ -101,7 +116,7 @@ module.exports = React.createClass({