diff options
author | Arjun Satarkar <me@arjunsatarkar.net> | 2023-07-30 19:16:48 +0000 |
---|---|---|
committer | Arjun Satarkar <me@arjunsatarkar.net> | 2023-07-30 19:57:22 +0000 |
commit | 4e6d02e4ae9a9718e15e6b5c1328f28eea444e75 (patch) | |
tree | f296475160d0187fa8fbc00d6a2a4f109a4058c7 /views | |
parent | 88db0f45477f2278edd7877161942a215aaace3f (diff) | |
download | tagrss-4e6d02e4ae9a9718e15e6b5c1328f28eea444e75.tar tagrss-4e6d02e4ae9a9718e15e6b5c1328f28eea444e75.tar.gz tagrss-4e6d02e4ae9a9718e15e6b5c1328f28eea444e75.zip |
Get tags for all shown feeds in one query for /list_feeds
This also avoids the need to pass `core` to the template, which I never
liked since it is basically giving up on encapsulation and passing the
whole world (as far as the application is concerned) to the template -
not only the values it needs.
But that could be avoided in other ways too without reducing the number
of queries from 1 + (number of feeds shown) - eg. 51 - to just 2, which
this does.
The next place something like this needs to be done is with the /
(index.tpl) view. Currently, that is also passed `core` and actually
does 2 * (number of entries shown) + 1 queries, which could be eg. 101,
since we fetch both the feed title and feed tags for every entry
separately.
With some improvements, it should be possible to do that too in 2
queries.
Diffstat (limited to 'views')
-rw-r--r-- | views/list_feeds.tpl | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/views/list_feeds.tpl b/views/list_feeds.tpl index 05cd8c9..2b4bd6d 100644 --- a/views/list_feeds.tpl +++ b/views/list_feeds.tpl @@ -59,8 +59,7 @@ <td>{{feed["title"]}} (<a href="/?included_feeds={{feed['id']}}" class="no-visited-indication">filter</a>)</td> <td class="td-tags"> <div> - % tags = core.get_feed_tags(feed["id"]) - % for i, tag in enumerate(tags): + % for i, tag in enumerate(feed["tags"]): % if i > 0: {{", "}} % end |