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. * Initial Release.

View File

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

View File

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

View File

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

View File

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