Skip to content

Commit

Permalink
Merge pull request #26 from datamade/bugfix/23-nightly-case-num
Browse files Browse the repository at this point in the history
Add default nightly case start
  • Loading branch information
antidipyramid authored Jan 12, 2024
2 parents f867e8b + d27cf8a commit 7137c5b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 14 deletions.
17 changes: 10 additions & 7 deletions scripts/nightly_chancery_start.sql
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,13 @@ WITH serials AS (
AND substr(case_number, 1, 4) = strftime('%Y', current_timestamp)
)

SELECT serial
FROM
serials
ORDER BY
-serial
LIMIT
1;
-- If we don't have any cases for the current year, start from zero
SELECT coalesce((
SELECT serial
FROM
serials
ORDER BY
-serial
LIMIT
1
), 0);
17 changes: 10 additions & 7 deletions scripts/nightly_civil_start.sql
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,13 @@ WITH serials AS (
AND substr(case_number, 1, 4) = strftime('%Y', current_timestamp)
)

SELECT serial
FROM
serials
ORDER BY
-serial
LIMIT
1;
-- If we don't have any cases for the current year, start from zero
SELECT coalesce((
SELECT serial
FROM
serials
ORDER BY
-serial
LIMIT
1
), 0);

0 comments on commit 7137c5b

Please sign in to comment.