mirror of
https://github.com/wallabag/wallabag.git
synced 2024-11-23 17:41:01 +00:00
Merge pull request #2020 from wallabag/fix-number-entries-per-tag
Fix number of entries in tag/list
This commit is contained in:
commit
f54de6817e
3 changed files with 14 additions and 2 deletions
|
@ -117,4 +117,16 @@ class Tag
|
|||
{
|
||||
return $this->entries;
|
||||
}
|
||||
|
||||
public function getEntriesByUserId($userId)
|
||||
{
|
||||
$filteredEntries = new ArrayCollection();
|
||||
foreach ($this->entries as $entry) {
|
||||
if ($entry->getUser()->getId() === $userId) {
|
||||
$filteredEntries->add($entry);
|
||||
}
|
||||
}
|
||||
|
||||
return $filteredEntries;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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.getEntriesByUserId(app.user.id) | length }})</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endblock %}
|
||||
|
|
|
@ -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.getEntriesByUserId(app.user.id) | length }})</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endblock %}
|
||||
|
|
Loading…
Reference in a new issue