Playwright Tests / test (push) Canceled after 0s
Make invoice/reminder live-draft edits concurrency-safe with an explicit DraftFlushResult, add the fds__setReminder stored procedure, and harden the date helper functions. Includes concurrency and SQL contract tests. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
13 lines
570 B
Transact-SQL
13 lines
570 B
Transact-SQL
-- INLINE = OFF: scalar UDF inlining of this @@DATEFIRST arithmetic (reached via date_add /
|
|
-- date_addcustom) killed dashboard widget queries with error 596 ("session is in the kill state").
|
|
CREATE FUNCTION[dbo].[AddBusinessDays](@Date DATE,@n INT)
|
|
RETURNS DATE
|
|
WITH INLINE = OFF
|
|
AS
|
|
BEGIN
|
|
DECLARE @d INT,@f INT,@DW INT;
|
|
SET @f=CAST(abs(1^SIGN(DATEPART(DW, @Date)-(7-@@DATEFIRST))) AS BIT)
|
|
SET @DW=DATEPART(DW,@Date)-(7-@@DATEFIRST)*(@f^1)+@@DATEFIRST*(@f&1)
|
|
SET @d=4-SIGN(@n)*(4-@DW);
|
|
RETURN DATEADD(D,@n+((ABS(@n)+(@d%(8+SIGN(@n)))-2)/5)*2*SIGN(@n)-@d/7,@Date);
|
|
END |