Last active
December 20, 2015 05:19
-
-
Save rizkyabdilah/6077212 to your computer and use it in GitHub Desktop.
Beautiful Code, blog post on my blog http://rizky.abdi.la
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function unpickSeatById($seating_id){ | |
$book_key = "booking-seat-" . strval($seating_id); | |
$this->redis->del($book_key); | |
return changeSeatStatusById($seating_id, 1); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function unpickSeatById($seating_id){ | |
$book_key = "booking-seat-" . strval($seating_id); | |
$this->redis->del($book_key); | |
$seat_status = getSeatStatusById($seating_id); | |
if ($seat_status == 3){ | |
return false; | |
} | |
return changeSeatStatusById($seating_id, 1); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function unpickSeatById($seating_id, $bypass=false){ | |
$book_key = "booking-seat-" . strval($seating_id); | |
$this->redis->del($book_key); | |
if ($bypass){ | |
return changeSeatStatusById($seating_id, 1); | |
} else{ | |
$seat_status = getSeatStatusById($seating_id); | |
if ($seat_status == 3){ | |
return false; | |
} | |
return changeSeatStatusById($seating_id, 1); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function unpickSeatById($seating_id, $bypass=false){ | |
$book_key = "booking-seat-" . strval($seating_id); | |
$this->redis->del($book_key); | |
$change = true; | |
if (!$bypass){ | |
$change = false | |
$seat_status = getSeatStatusById($seating_id); | |
if ($seat_status != 3){ | |
$change = true; | |
} | |
} | |
$rv = false; | |
if ($change){ | |
$rv = changeSeatStatusById($seating_id, 1); | |
} | |
return $rv; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function unpickSeatById($seating_id, $bypass=false){ | |
$book_key = "booking-seat-" . strval($seating_id); | |
$this->redis->del($book_key); | |
$seat_status = getSeatStatusById($seating_id); | |
// jika tidak di set bypass == true dan seat status == 3 (terjual) | |
// maka kursi tidak dilepas | |
if ($seat_status != 3 || $bypass){ | |
return changeSeatStatusById($seating_id, 1); | |
} | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment