Archived
4
2

Bug fix of query to find days to next free slot

templates/queries-index-mysql.tpl.html,
templates/queries-index-sqlite.tpl.html:
    Rather than driving the search from the eps table itself, this
    version makes a counter that generates slot numbers from the current
    show number to the highest show number in the system. The counter is
    used to interrogate the eps table to find the first empty slot. This
    sems to be a more reliable approach (but time will tell).
This commit is contained in:
Dave Morriss
2023-10-20 13:37:37 +01:00
parent dab80f1772
commit c8135d811d
2 changed files with 25 additions and 23 deletions

View File

@@ -20,8 +20,8 @@
WHERE e.id IS NULL
)
SELECT
fe.id as empty_slot,
(SELECT date(eps.date,\'+1 day\') from eps where id = fe.id-1) as slot_date,
fe.id as next_id,
(SELECT date(eps.date,\'+1 day\') from eps where id = fe.id-1) as next_date,
printf(\'%i\',abs(julianday((SELECT date(eps.date,\'+1 day\') from eps where id = fe.id-1)) - julianday(\'now\') + 1)) AS delta_days
FROM first_empty AS fe
LEFT JOIN eps e ON fe.id = e.id