mirror of
https://github.com/wallabag/wallabag.git
synced 2024-11-27 11:31:05 +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;
|
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>
|
<ul>
|
||||||
{% for tag in tags %}
|
{% 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 %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
<br />
|
<br />
|
||||||
<ul class="row data">
|
<ul class="row data">
|
||||||
{% for tag in tags %}
|
{% 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 %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
Loading…
Reference in a new issue