Readd bids.disable_flight_on_bid, fixes tests

This commit is contained in:
Nabeel Shahzad
2018-07-24 15:58:11 -05:00
parent b2cc818b7a
commit c40a8c893d
2 changed files with 7 additions and 1 deletions

View File

@@ -13,6 +13,7 @@ use PhpUnitsOfMeasure\Exception\NonStringUnitName;
/** /**
* @property string id * @property string id
* @property mixed ident
* @property Airline airline * @property Airline airline
* @property integer airline_id * @property integer airline_id
* @property mixed flight_number * @property mixed flight_number

View File

@@ -209,7 +209,7 @@ class FlightService extends Service
# bids # bids
$bids = Bid::where('user_id', $user->id)->get(); $bids = Bid::where('user_id', $user->id)->get();
if ($bids->count() > 0 && setting('bids.allow_multiple_bids') === false) { if ($bids->count() > 0 && setting('bids.allow_multiple_bids') === false) {
throw new BidExists('User "'.$user->id.'" already has bids, skipping'); throw new BidExists('User "'.$user->ident.'" already has bids, skipping');
} }
# Get all of the bids for this flight # Get all of the bids for this flight
@@ -229,6 +229,11 @@ class FlightService extends Service
} }
} }
# Check if the flight should be blocked off
if (setting('bids.disable_flight_on_bid') === true) {
throw new BidExists('Flight "'.$flight->ident.'" already has a bid, skipping');
}
if (setting('bids.allow_multiple_bids') === false) { if (setting('bids.allow_multiple_bids') === false) {
throw new BidExists('A bid already exists for this flight'); throw new BidExists('A bid already exists for this flight');
} }