Skip to content
Snippets Groups Projects

Fix usage count.

Merged Pieter Frenssen requested to merge issue/ps-3515883:3515883-version-1.0.1-shows into 1.x
1 file
+ 4
4
Compare changes
  • Side-by-side
  • Inline
+ 4
4
@@ -383,11 +383,11 @@ class ParagraphsStats {
@@ -383,11 +383,11 @@ class ParagraphsStats {
$query = "SELECT t.*,
$query = "SELECT t.*,
IF(t.cnt > :ul4, 4, IF(t.cnt > :ul3, 3, IF(t.cnt > :ul2, 2, IF(t.cnt > :ul1, 1, 0)))) as usage_level
IF(t.cnt > :ul4, 4, IF(t.cnt > :ul3, 3, IF(t.cnt > :ul2, 2, IF(t.cnt > :ul1, 1, 0)))) as usage_level
FROM (
FROM (
SELECT ti.*, COUNT(*) AS cnt
SELECT ti.type, ti.parent_type, ti.entity_type, COUNT(*) AS cnt
FROM (" . $sqlCore . ") ti
FROM (" . $sqlCore . ") ti
WHERE ti.entity_type IS NOT NULL
WHERE ti.entity_type IS NOT NULL
AND ti.is_active <> ''
AND ti.is_active <> ''
GROUP BY ti.id, ti.status, ti.parent_id, ti.type, ti.parent_field_name, ti.parent_type, ti.entity_type, ti.is_active
GROUP BY ti.type, ti.parent_type, ti.entity_type
ORDER BY ti.type
ORDER BY ti.type
) t";
) t";
@@ -458,14 +458,14 @@ class ParagraphsStats {
@@ -458,14 +458,14 @@ class ParagraphsStats {
// Get the main dataset for the report.
// Get the main dataset for the report.
$sqlCore = $this->getSqlCore($type);
$sqlCore = $this->getSqlCore($type);
$query = "SELECT t.*, COUNT(*) AS occurrence
$query = "SELECT t.parent_id, t.parent_field_name, COUNT(*) AS occurrence
FROM (" . $sqlCore . ") t
FROM (" . $sqlCore . ") t
WHERE t.entity_type IS NOT NULL
WHERE t.entity_type IS NOT NULL
AND t.is_active <> ''
AND t.is_active <> ''
AND t.parent_type = :type
AND t.parent_type = :type
AND t.type = :par
AND t.type = :par
AND t.entity_type = :bun
AND t.entity_type = :bun
GROUP BY t.id, t.parent_id, t.status, t.parent_field_name, t.is_active
GROUP BY t.parent_id, t.parent_field_name
ORDER BY occurrence DESC";
ORDER BY occurrence DESC";
$ddData = $this->database->query($query, [
$ddData = $this->database->query($query, [
Loading