You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if year == None:
years = []
for item in db:
if not(item['ts_year'] in years):
years.append(item['ts_year'])
return sorted(years)
Belongs on tdwtf (does anyone still read that? :o). Iterating through every item in the database just to enumerate the possible values of 'ts_year' tags? Really? We need to cache this, and every place where this kind of pattern occurs, before my database gets too big.
Possible implementation: add an additional table in the database to store [years/months/whatever], add a command-line to update it manually (based on iterating the full db), and update it whenever we add/update an article (i.e. check whether the year attached to the article is in the table, if not add it).
The text was updated successfully, but these errors were encountered:
Code like this:
Belongs on tdwtf (does anyone still read that? :o). Iterating through every item in the database just to enumerate the possible values of 'ts_year' tags? Really? We need to cache this, and every place where this kind of pattern occurs, before my database gets too big.
Possible implementation: add an additional table in the database to store [years/months/whatever], add a command-line to update it manually (based on iterating the full db), and update it whenever we add/update an article (i.e. check whether the year attached to the article is in the table, if not add it).
The text was updated successfully, but these errors were encountered: