Merge pull request 'A further fix to the free slot algorithm' (#178) from fix4_next_available_episode into main
Reviewed-on: rho_n/hpr_generator#178
This commit is contained in:
commit
15cd9018b0
@ -32,13 +32,8 @@
|
|||||||
<!--% USE DBI(constants.driver, constants.user, constants.password) %-->
|
<!--% USE DBI(constants.driver, constants.user, constants.password) %-->
|
||||||
<!--% USE date %-->
|
<!--% USE date %-->
|
||||||
<!--% calc = date.calc %-->
|
<!--% calc = date.calc %-->
|
||||||
<!--% episodes = DBI.query("SELECT id, date FROM eps WHERE date >= date('now') ORDER BY id").get_all() %-->
|
<!--% episodes = DBI.query(query_next_available_episode).get_all() %-->
|
||||||
<!--% ind = episodes.0.id %-->
|
<!--% last_date = episodes.0.date.split('-') %-->
|
||||||
<!--% FOREACH ep IN episodes %-->
|
|
||||||
<!--% LAST IF ep.id != ind %-->
|
|
||||||
<!--% last_date = ep.date.split('-') %-->
|
|
||||||
<!--% ind = ind+1 %-->
|
|
||||||
<!--% END %-->
|
|
||||||
<!--% offset = (calc.Day_of_Week(last_date.0,last_date.1,last_date.2) == 5 ? 3 : 1) %-->
|
<!--% offset = (calc.Day_of_Week(last_date.0,last_date.1,last_date.2) == 5 ? 3 : 1) %-->
|
||||||
<!--% slot_date = calc.Add_Delta_Days(last_date.0,last_date.1,last_date.2,offset) %-->
|
<!--% slot_date = calc.Add_Delta_Days(last_date.0,last_date.1,last_date.2,offset) %-->
|
||||||
<!--% now = calc.Today() %-->
|
<!--% now = calc.Today() %-->
|
||||||
|
@ -1,3 +1,15 @@
|
|||||||
|
<!--% query_next_available_episode = '
|
||||||
|
SELECT id, date FROM eps e WHERE id = (
|
||||||
|
SELECT id + 1 FROM eps mo
|
||||||
|
WHERE NOT EXISTS (
|
||||||
|
SELECT NULL
|
||||||
|
FROM eps mi
|
||||||
|
WHERE mi.id = mo.id + 1
|
||||||
|
)
|
||||||
|
ORDER BY id
|
||||||
|
LIMIT 1) - 1
|
||||||
|
'
|
||||||
|
%-->
|
||||||
<!--% query_latest_episodes = '
|
<!--% query_latest_episodes = '
|
||||||
WITH comment_tallies AS (
|
WITH comment_tallies AS (
|
||||||
SELECT
|
SELECT
|
||||||
|
@ -1,3 +1,15 @@
|
|||||||
|
<!--% query_next_available_episode = '
|
||||||
|
SELECT id, date FROM eps e WHERE id = (
|
||||||
|
SELECT id + 1 FROM eps mo
|
||||||
|
WHERE NOT EXISTS (
|
||||||
|
SELECT NULL
|
||||||
|
FROM eps mi
|
||||||
|
WHERE mi.id = mo.id + 1
|
||||||
|
)
|
||||||
|
ORDER BY id
|
||||||
|
LIMIT 1) - 1
|
||||||
|
'
|
||||||
|
%-->
|
||||||
<!--% query_latest_episodes = '
|
<!--% query_latest_episodes = '
|
||||||
WITH comment_tallies AS (
|
WITH comment_tallies AS (
|
||||||
SELECT
|
SELECT
|
||||||
|
Loading…
Reference in New Issue
Block a user