Skip to content

Commit 9053f0d

Browse files
authored
Fix usage queries to reference Created (not Date) (#256)
1 parent cffb250 commit 9053f0d

File tree

6 files changed

+22
-22
lines changed

6 files changed

+22
-22
lines changed

LDK/resources/queries/core/DistinctUsersByMonth.sql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@ from (
2424

2525
SELECT
2626

27-
year(a.date) as year,
28-
month(a.date) as month,
27+
year(a.Created) as year,
28+
month(a.Created) as month,
2929
a.CreatedBy.DisplayName as user
3030

3131
FROM "/".auditlog.UserAuditEvent a
3232

3333
WHERE a.Comment LIKE '%logged in%'
3434

35-
GROUP BY year(a.date), month(a.date), a.CreatedBy.DisplayName
35+
GROUP BY year(a.Created), month(a.Created), a.CreatedBy.DisplayName
3636

3737
) a
3838

LDK/resources/queries/core/SiteUsageByDay.sql

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,19 @@
1515
*/
1616
SELECT
1717

18-
cast(a.date as date) as date,
18+
cast(a.Created as date) as Date,
1919
CASE
20-
WHEN dayofweek(cast(a.date as date)) = 1 THEN 'Sunday'
21-
WHEN dayofweek(cast(a.date as date)) = 2 THEN 'Monday'
22-
WHEN dayofweek(cast(a.date as date)) = 3 THEN 'Tuesday'
23-
WHEN dayofweek(cast(a.date as date)) = 4 THEN 'Wednesday'
24-
WHEN dayofweek(cast(a.date as date)) = 5 THEN 'Thursday'
25-
WHEN dayofweek(cast(a.date as date)) = 6 THEN 'Friday'
26-
WHEN dayofweek(cast(a.date as date)) = 7 THEN 'Saturday'
20+
WHEN dayofweek(cast(a.Created as date)) = 1 THEN 'Sunday'
21+
WHEN dayofweek(cast(a.Created as date)) = 2 THEN 'Monday'
22+
WHEN dayofweek(cast(a.Created as date)) = 3 THEN 'Tuesday'
23+
WHEN dayofweek(cast(a.Created as date)) = 4 THEN 'Wednesday'
24+
WHEN dayofweek(cast(a.Created as date)) = 5 THEN 'Thursday'
25+
WHEN dayofweek(cast(a.Created as date)) = 6 THEN 'Friday'
26+
WHEN dayofweek(cast(a.Created as date)) = 7 THEN 'Saturday'
2727
END as dayOfWeek,
2828
count(*) AS Logins
2929

3030
FROM "/".auditlog.UserAuditEvent a
3131

3232
WHERE a.Comment LIKE '%logged in%'
33-
GROUP BY cast(a.date as date)
33+
GROUP BY cast(a.Created as date)

LDK/resources/queries/core/SiteUsageByHour.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616
SELECT
1717

1818

19-
hour(a.date) as Hour,
19+
hour(a.Created) as Hour,
2020
count(*) AS Visits
2121

2222
FROM "/".auditlog.UserAuditEvent a
2323

2424
WHERE a.Comment LIKE '%logged in%'
2525

26-
GROUP BY hour(a.date)
26+
GROUP BY hour(a.Created)

LDK/resources/queries/core/SiteUsageByMonth.sql

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@
1515
*/
1616
SELECT
1717

18-
year(a.date) as year,
19-
month(a.date) as month,
20-
cast(cast(year(a.date) as varchar) || '-' || cast(month(a.date) as varchar) || '-01' as DATE) as date,
18+
year(a.Created) as year,
19+
month(a.Created) as month,
20+
cast(cast(year(a.Created) as varchar) || '-' || cast(month(a.Created) as varchar) || '-01' as DATE) as date,
2121
count(*) AS Logins
2222

2323
FROM "/".auditlog.UserAuditEvent a
2424
--FROM audit_pg.auditLog a
2525

2626
WHERE a.Comment LIKE '%logged in%'
2727

28-
GROUP BY year(a.date), month(a.date)
28+
GROUP BY year(a.Created), month(a.Created)

LDK/resources/queries/core/SiteUsageByUser.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ PARAMETERS(MinDate TIMESTAMP)
1717

1818
SELECT
1919
a.CreatedBy,
20-
COUNT(a.Date) AS LogInCount
20+
COUNT(a.Created) AS LogInCount
2121
FROM "/".auditlog.UserAuditEvent a
22-
WHERE a.Comment LIKE '%logged in%' AND cast(a.date as date) >= cast(MinDate as date)
22+
WHERE a.Comment LIKE '%logged in%' AND cast(a.Created as date) >= cast(MinDate as date)
2323
GROUP BY a.CreatedBy

LDK/resources/queries/core/SiteUsagePerGroup.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ SELECT
1717

1818
m.UserId,
1919
g.Name AS GroupName,
20-
a.Date,
20+
a.Created AS Date,
2121
a.EventType
2222

2323
FROM core.groups g
@@ -28,4 +28,4 @@ ON (a.CreatedBy.UserId = m.UserId.UserId AND a.Comment LIKE '%logged in%')
2828

2929
WHERE g.Name IS NOT NULL
3030
AND g.Name != ''
31-
AND a.Date IS NOT NULL
31+
AND a.Created IS NOT NULL

0 commit comments

Comments
 (0)