16 |
|
|
17 |
my $dbh = $self->dbh; |
my $dbh = $self->dbh; |
18 |
|
|
19 |
|
my $size = $self->room->seats; |
20 |
|
|
21 |
my $sth = $dbh->prepare(qq{ |
my $sth = $dbh->prepare(qq{ |
22 |
update reservation |
update reservation |
23 |
set |
set |
25 |
_seat_number = ( |
_seat_number = ( |
26 |
select |
select |
27 |
min(seat.nr) |
min(seat.nr) |
28 |
from (select generate_series(1,600) as nr) as seat |
from (select generate_series(1,$size) as nr) as seat |
29 |
full join reservation on reservation._seat_number = seat.nr |
full join reservation on reservation._seat_number = seat.nr |
30 |
where id is null |
where id is null |
31 |
group by seat.nr |
group by seat.nr |
34 |
) |
) |
35 |
where |
where |
36 |
md5(id||email) = ? |
md5(id||email) = ? |
|
and _confirmed is false |
|
37 |
and _canceled is false |
and _canceled is false |
38 |
|
and ( |
39 |
|
_confirmed is false |
40 |
|
or |
41 |
|
( _confirmed is true and _seat_number is null ) |
42 |
|
) |
43 |
}); |
}); |
44 |
|
|
45 |
my $token = $self->token; |
my $token = $self->token; |