0
1
Fork 0

Visits SQL FK refactor

This commit is contained in:
Juan Ferrer 2019-07-15 13:57:34 +02:00
parent 1bbe94385b
commit 7329310f1f
5 changed files with 22 additions and 22 deletions

2
debian/changelog vendored
View File

@ -1,4 +1,4 @@
hedera-web (1.406.57) stable; urgency=low
hedera-web (1.406.58) stable; urgency=low
* Initial Release.

View File

@ -43,9 +43,9 @@
<custom>
SELECT u.stamp, a.platform, a.browser, a.version, a.javascript, a.cookies
FROM visitUser u
JOIN visitAccess c ON c.id = u.access
JOIN visitAgent a ON a.id = c.agent
WHERE u.user = #user
JOIN visitAccess c ON c.id = u.accessFk
JOIN visitAgent a ON a.id = c.agentFk
WHERE u.userFk = #user
ORDER BY u.stamp DESC
LIMIT 8
</custom>

View File

@ -22,14 +22,14 @@
<htk-repeater form-id="iter">
<db-model property="model" id="sessions" on-status-changed="onModelStatusChange">
<custom>
SELECT vu.user userId, vu.stamp, u.nickname, s.lastUpdate,
SELECT vu.userFk userId, vu.stamp, u.nickname, s.lastUpdate,
a.platform, a.browser, a.version, u.name user
FROM userSession s
JOIN visitUser vu ON vu.id = s.userVisit
JOIN visitAccess ac ON ac.id = vu.access
JOIN visitAgent a ON a.id = ac.agent
JOIN visit v ON v.id = a.visit
JOIN account.user u ON u.id = vu.user
JOIN visitUser vu ON vu.id = s.userVisitFk
JOIN visitAccess ac ON ac.id = vu.accessFk
JOIN visitAgent a ON a.id = ac.agentFk
JOIN visit v ON v.id = a.visitFk
JOIN account.user u ON u.id = vu.userFk
ORDER BY lastUpdate DESC
</custom>
</db-model>

View File

@ -51,18 +51,18 @@
<htk-repeater form-id="iter" empty-message="_Select date interval">
<db-model property="model" id="visits">
<custom>
SELECT browser
,MIN(CAST(version AS DECIMAL(4,1))) minVersion
,MAX(CAST(version AS DECIMAL(4,1))) maxVersion
,MAX(c.stamp) lastVisit
,COUNT(DISTINCT c.id) visits
,SUM(a.firstAccess = c.id AND v.firstAgent = a.id) newVisits
SELECT browser,
MIN(CAST(version AS DECIMAL(4,1))) minVersion,
MAX(CAST(version AS DECIMAL(4,1))) maxVersion,
MAX(c.stamp) lastVisit,
COUNT(DISTINCT c.id) visits,
SUM(a.firstAccessFk = c.id AND v.firstAgentFk = a.id) newVisits
FROM visitUser e
JOIN visitAccess c ON e.access = c.id
JOIN visitAgent a ON c.agent = a.id
JOIN visit v ON a.visit = v.id
WHERE c.stamp BETWEEN TIMESTAMP(#from,'00:00:00') AND TIMESTAMP(#to,'23:59:59')
GROUP BY browser ORDER BY visits DESC
JOIN visitAccess c ON c.id = e.accessFk
JOIN visitAgent a ON a.id = c.agentFk
JOIN visit v ON v.id = a.visitFk
WHERE c.stamp BETWEEN TIMESTAMP(#from,'00:00:00') AND TIMESTAMP(#to,'23:59:59')
GROUP BY browser ORDER BY visits DESC
</custom>
<sql-batch property="batch">
<custom>

View File

@ -1,6 +1,6 @@
{
"name": "hedera-web",
"version": "1.406.57",
"version": "1.406.58",
"description": "Verdnatura web page",
"license": "GPL-3.0",
"repository": {