Skip to content

Commit

Permalink
fix function
Browse files Browse the repository at this point in the history
  • Loading branch information
ghareeb-falazi committed Dec 9, 2024
1 parent 9c5a718 commit 0038b50
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/flight-booking-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ class FlightBookingManager extends Contract {
async isSeatAvailable(ctx, txId, tm, seatNumber) {
let seatOwner = await this._queryVariable(ctx, txId, 'seatOwner_' + seatNumber, null, tm);

return seatOwner !== null && seatNumber !== undefined;
return seatOwner === null;
}

async queryNextAvailableSeat(ctx, txId, tm) {
Expand Down
2 changes: 2 additions & 0 deletions test/flight-booking-manager.test.ts.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ describe('Flights Manager Basic Tests', () => {
let man = new FlightBookingManager();
let value = await man.querySeatPrice(transactionContext, 'tx1', 'user1');
expect(value).to.be.equal(500);
value = await man.querySeatsCount(transactionContext, 'tx1', 'user1');
expect(value).to.be.equal(10);
await man.addToClientBalance(transactionContext, 'tx1', 'user1', 700);
value = await man.queryClientBalance(transactionContext, 'tx1', 'user1');
expect(value).to.be.equal(700);
Expand Down

0 comments on commit 0038b50

Please sign in to comment.