]> git.immae.eu Git - github/wallabag/wallabag.git/commitdiff
Fix number of entries in tag/list
authorNicolas Lœuillet <nicolas@loeuillet.org>
Tue, 3 May 2016 19:12:40 +0000 (21:12 +0200)
committerNicolas Lœuillet <nicolas@loeuillet.org>
Tue, 3 May 2016 19:12:40 +0000 (21:12 +0200)
Fix #2006

src/Wallabag/CoreBundle/Entity/Tag.php
src/Wallabag/CoreBundle/Resources/views/themes/baggy/Tag/tags.html.twig
src/Wallabag/CoreBundle/Resources/views/themes/material/Tag/tags.html.twig

index a6e2d023b8b008ef14da4ac396a917adab1f8820..f6c42f5d72eb65f02f7152b9870214218702bf4e 100644 (file)
@@ -117,4 +117,16 @@ class Tag
     {
         return $this->entries;
     }
+
+    public function getEntriesByUser($userId)
+    {
+        $filteredEntries = new ArrayCollection();
+        foreach ($this->entries as $entry) {
+            if ($entry->getUser()->getId() === $userId) {
+                $filteredEntries->add($entry);
+            }
+        }
+
+        return $filteredEntries;
+    }
 }
index bb0ca93974021cae14b29a12887ecb457c665b0c..4df371746ae8ae9271181ba27c32e5e19c0fb671 100644 (file)
@@ -9,7 +9,7 @@
 
     <ul>
     {% for tag in tags %}
-        <li id="tag-{{ tag.id|e }}">{{tag.label}} ({{ tag.entries.getValues | length }})</li>
+        <li id="tag-{{ tag.id|e }}">{{tag.label}} ({{ tag.getEntriesByUser(app.user.id) | length }})</li>
     {% endfor %}
     </ul>
 {% endblock %}
index 6fd263d8efd43d5ea72ffa22d69c8a9b22733fa9..c5b516f9bb55f19a4c16e83d0ba9616689496d89 100644 (file)
@@ -9,7 +9,7 @@
     <br />
     <ul class="row data">
     {% for tag in tags %}
-        <li id="tag-{{ tag.id|e }}" class="col l4 m6 s12">{{tag.label}} ({{ tag.entries.getValues | length }})</li>
+        <li id="tag-{{ tag.id|e }}" class="col l4 m6 s12">{{tag.label}} ({{ tag.getEntriesByUser(app.user.id) | length }})</li>
     {% endfor %}
     </ul>
 {% endblock %}