suggestions: Properly set VetoingId

This commit is contained in:
2017-01-07 08:39:22 -05:00
parent 9040e4fd9f
commit 908e10736a
2 changed files with 8 additions and 1 deletions

View File

@ -103,7 +103,11 @@ module.exports = React.createClass({
var suggestion = new Suggestion();
suggestion.AttendeeId = this.state.attendee.AttendeeId;
suggestion.RestaurantName = this.state.suggestion;
suggestion.VetoingId = this.getLastSuggestion();
var lastSuggestionIndex = this.getLastSuggestion();
if (lastSuggestionIndex > -1)
suggestion.VetoingId = this.props.suggestions[lastSuggestionIndex].SuggestionId;
else
suggestion.VetoingId = -1;
this.props.createSuggestion(suggestion);
this.setState({
attendee: null,