Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
|||
OverallCalendar | n/a |
0 / 0 |
n/a |
0 / 0 |
0 | n/a |
0 / 0 |
1 | <?php |
2 | |
3 | namespace BO\Zmsdb\Query; |
4 | |
5 | class OverallCalendar extends Base |
6 | { |
7 | const TABLE = 'gesamtkalender'; |
8 | |
9 | const INSERT = ' |
10 | INSERT IGNORE INTO gesamtkalender |
11 | (scope_id, availability_id, time, seat, status) |
12 | VALUES (:scope_id, :availability_id, :time, :seat, :status) |
13 | '; |
14 | |
15 | const DELETE_FREE_RANGE = ' |
16 | DELETE FROM gesamtkalender |
17 | WHERE scope_id = :scope_id |
18 | AND availability_id = :availability_id |
19 | AND status = "free" |
20 | AND time >= :begin |
21 | AND time < :finish |
22 | '; |
23 | |
24 | const DELETE_ALL_BEFORE = ' |
25 | DELETE FROM gesamtkalender |
26 | WHERE time < :threshold |
27 | '; |
28 | |
29 | const FIND_FREE_SEAT = ' |
30 | SELECT seat |
31 | FROM gesamtkalender |
32 | WHERE scope_id = :scope |
33 | AND time >= :start |
34 | AND time < :end |
35 | AND status = "free" |
36 | GROUP BY seat |
37 | HAVING COUNT(*) = :units |
38 | ORDER BY seat |
39 | LIMIT 1 |
40 | '; |
41 | |
42 | const BLOCK_SEAT_RANGE = ' |
43 | UPDATE gesamtkalender |
44 | SET process_id = :pid, |
45 | slots = CASE |
46 | WHEN time = :start THEN :units |
47 | ELSE NULL |
48 | END, |
49 | status = "termin" |
50 | WHERE scope_id = :scope |
51 | AND seat = :seat |
52 | AND time >= :start |
53 | AND time < :end |
54 | '; |
55 | |
56 | const UNBOOK_PROCESS = ' |
57 | UPDATE gesamtkalender |
58 | SET process_id = NULL, |
59 | slots = NULL, |
60 | status = "free" |
61 | WHERE scope_id = :scope_id |
62 | AND process_id = :process_id |
63 | '; |
64 | |
65 | const SELECT_RANGE = ' |
66 | SELECT scope_id, time, availability_id, seat, status, process_id, slots, updated_at |
67 | FROM gesamtkalender |
68 | WHERE scope_id IN (%s) |
69 | AND time BETWEEN :from AND :until |
70 | ORDER BY scope_id, time, seat |
71 | '; |
72 | |
73 | const SELECT_RANGE_UPDATED = ' |
74 | SELECT scope_id, time, availability_id, seat, status, process_id, slots, updated_at |
75 | FROM gesamtkalender |
76 | WHERE scope_id IN (%s) |
77 | AND time BETWEEN :from AND :until |
78 | AND updated_at > :updatedAfter |
79 | ORDER BY scope_id, time, seat |
80 | '; |
81 | } |