Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<metadata>
<tables xmlns="http://labkey.org/data/xml">
<table tableName="AssignmentsCreatedInPast1Day" tableDbType="TABLE">
<tableTitle>Assignments created in past 24 hrs</tableTitle>
<tableTitle>Assignments created in the past 24 hrs</tableTitle>
</table>
</tables>
</metadata>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/* Created by Kollil, Dec, 2025
Tkt # 13618
Priority 1: Add Grid 1 ("Assignments Created in the Past Day ") to daily Behavior Alerts email - display full grid in email
*/
SELECT
Id,
Id.demographics.gender as Sex,
Expand All @@ -16,4 +20,4 @@ SELECT
releaseCondition.meaning as ConditionAtRelease

FROM Assignment
WHERE CAST(date AS DATE) >= TIMESTAMPADD('SQL_TSI_DAY', -1, NOW())
WHERE CAST(created AS DATE) >= TIMESTAMPADD('SQL_TSI_DAY', -1, CAST(NOW() AS DATE))
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<metadata>
<tables xmlns="http://labkey.org/data/xml">
<table tableName="AssignmentsReleasedInPast1Day" tableDbType="TABLE">
<tableTitle>Assignments released in past 24 hrs</tableTitle>
<tableTitle>Assignments released in the past 24 hrs</tableTitle>
</table>
</tables>
</metadata>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/* Created by Kollil, Dec, 2025
Tkt # 13618
Priority 2: Create new Grid 2 (Assignments ended in the Past 1 Day):
- List of records with new “Release date” added within the last 24hrs (omitting day leases). I am not omitting day leases for now as per Isabel's request.
*/
SELECT
Id,
Id.demographics.gender as Sex,
Expand All @@ -16,4 +21,9 @@ SELECT
releaseCondition.meaning as ConditionAtRelease

FROM Assignment
WHERE CAST(enddate AS DATE) >= TIMESTAMPADD('SQL_TSI_DAY', -1, NOW())
/* this condition: >= TIMESTAMPADD('SQL_TSI_DAY', -1, NOW()) → not older than 24 hours
and this one: <= NOW() → not in the future
Together, they produce exactly the last 24 hours, nothing more.
*/
WHERE CAST(enddate AS DATE) = TIMESTAMPADD('SQL_TSI_DAY', -1, CAST(NOW() AS DATE))
AND CAST(enddate AS DATE) <= CAST(NOW() AS DATE)
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<metadata>
<tables xmlns="http://labkey.org/data/xml">
<table tableName="AssignmentsStartedPast1to7Days" tableDbType="TABLE">
<tableTitle>Assignments started in past 1-7 days</tableTitle>
<tableTitle>Assignments started in the past 1-7 days</tableTitle>
</table>
</tables>
</metadata>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/* Created by Kollil, Dec, 2025
Tkt # 13618
Priority 4: Add links to grids 3 and 4 in daily Behavior Alerts email (do not need to display full grid in email)
- for grid 3 - There were __ assignments started in the past 1-7 days" with a link, including today's date

*/
SELECT
Id,
Id.demographics.gender as Sex,
Expand All @@ -16,5 +22,10 @@ SELECT
releaseCondition.meaning as ConditionAtRelease

FROM Assignment
WHERE CAST(date AS DATE) >= TIMESTAMPADD('SQL_TSI_DAY', -1, NOW())
AND CAST(date AS DATE) < TIMESTAMPADD('SQL_TSI_DAY', -7, NOW())
--including today
WHERE CAST(date AS DATE) >= TIMESTAMPADD('SQL_TSI_DAY', -7, CAST(NOW() AS DATE))
AND CAST(date AS DATE) <= CAST(NOW() AS DATE);
--excluding today
-- WHERE CAST(date AS DATE) >= TIMESTAMPADD('SQL_TSI_DAY', -1, NOW())
-- AND CAST(date AS DATE) < TIMESTAMPADD('SQL_TSI_DAY', -7, NOW())

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<metadata>
<tables xmlns="http://labkey.org/data/xml">
<table tableName="AssignmentsStartingNext1to14Days" tableDbType="TABLE">
<tableTitle>Assignments starting in next 1 to 14 days</tableTitle>
<tableTitle>Assignments starting in the next 1 to 14 days</tableTitle>
</table>
</tables>
</metadata>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/* Created by Kollil, Dec, 2025
Tkt # 13618
Priority 4: Add links to grids 3 and 4 in daily Behavior Alerts email (do not need to display full grid in email)
- for grid 4 - There are __ assignments starting in the Next 1-14 days" with a link, including today's date
*/

SELECT
Id,
Id.demographics.gender as Sex,
Expand All @@ -16,5 +22,5 @@ SELECT
releaseCondition.meaning as ConditionAtRelease

FROM Assignment
WHERE CAST(date AS DATE) >= TIMESTAMPADD('SQL_TSI_DAY', 1, NOW())
AND CAST(date AS DATE) < TIMESTAMPADD('SQL_TSI_DAY', 14, NOW())
WHERE CAST(date AS DATE) >= TIMESTAMPADD('SQL_TSI_DAY', 1, CAST(NOW() AS DATE))
AND CAST(date AS DATE) <= TIMESTAMPADD('SQL_TSI_DAY', 14, CAST(NOW() AS DATE))