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.RestaurantName = this.state.suggestion;
|
||||||
suggestion.VetoingId = this.getLastSuggestion();
|
suggestion.VetoingId = this.getLastSuggestion();
|
||||||
this.props.createSuggestion(suggestion);
|
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() {
|
render: function() {
|
||||||
var attendeeList = this.getAttendeeList();
|
var attendeeList = this.getAttendeeList();
|
||||||
@ -101,7 +116,7 @@ module.exports = React.createClass({
|
|||||||
<Col xs={4}>
|
<Col xs={4}>
|
||||||
<Combobox
|
<Combobox
|
||||||
value={this.state.suggestion}
|
value={this.state.suggestion}
|
||||||
data={this.props.popularSuggestions}
|
data={this.unusedPopularSuggestions()}
|
||||||
valueField='RestaurantName'
|
valueField='RestaurantName'
|
||||||
textField='RestaurantName'
|
textField='RestaurantName'
|
||||||
onChange={this.onChangeSuggestion} />
|
onChange={this.onChangeSuggestion} />
|
||||||
|
Loading…
Reference in New Issue
Block a user