Filter out already used popular suggestions
This commit is contained in:
parent
49409f84d2
commit
298b3b7cea
@ -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({
|
||||
<Col xs={4}>
|
||||
<Combobox
|
||||
value={this.state.suggestion}
|
||||
data={this.props.popularSuggestions}
|
||||
data={this.unusedPopularSuggestions()}
|
||||
valueField='RestaurantName'
|
||||
textField='RestaurantName'
|
||||
onChange={this.onChangeSuggestion} />
|
||||
|
Loading…
Reference in New Issue
Block a user