Skip to content

Instantly share code, notes, and snippets.

@rizkyabdilah
Last active December 20, 2015 05:19
Show Gist options
  • Save rizkyabdilah/6077212 to your computer and use it in GitHub Desktop.
Save rizkyabdilah/6077212 to your computer and use it in GitHub Desktop.
Beautiful Code, blog post on my blog http://rizky.abdi.la
function unpickSeatById($seating_id){
$book_key = "booking-seat-" . strval($seating_id);
$this->redis->del($book_key);
return changeSeatStatusById($seating_id, 1);
}
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);
}
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);
}
}
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;
}
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