From 4928095abb23f953141808b193988c75a8768a88 Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Sat, 13 May 2017 15:27:08 -0700 Subject: [PATCH] Minor commentary and cleanup --- README.md | 5 +++-- etiquette/photodb.py | 16 ++++++++++++++-- frontends/etiquette_flask/templates/search.html | 8 ++++++-- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 5bf979e..b1f9db2 100644 --- a/README.md +++ b/README.md @@ -18,9 +18,10 @@ Documentation is still a work in progress. In general, I use: - Improve the "tags on this page" list. Maybe add separate buttons for must/may/forbid on each. - Some way for the database to re-identify a file that was moved / renamed (lost & found). Maybe file hash of the first few mb is good enough. - Debate whether the `UserMixin.login` method should accept usernames or I should standardize the usage of IDs only internally. -- Album size is calculated every time you refresh the page. For large albums this is very slow. Consider caching? Or saving to db? +- Ability to access user page and user photos by user's ID, not just username. +- Should album size be cached on disk? - Organize the tag exporter functions better. -- Replace columns like area, ratio, bitrate by using [expression indices](https://sqlite.org/expridx.html) — `width * height` etc. +- Replace columns like area, ratio, bitrate by using expression indices or views (`width * height` etc). - Add some way to support large image albums without flooding the search results. Considering a "hidden" property so that a handful of representative images can appear in the search results, and the rest can be found on the actual Album page. ### Changelog diff --git a/etiquette/photodb.py b/etiquette/photodb.py index 4726adf..c45ab42 100644 --- a/etiquette/photodb.py +++ b/etiquette/photodb.py @@ -778,7 +778,13 @@ class PDBPhotoMixin: yield parameters if is_must_may_forbid: - mmf_results = searchhelpers.mmf_photoids(self, tag_musts, tag_mays, tag_forbids, frozen_children) + mmf_results = searchhelpers.mmf_photoids( + self, + tag_musts, + tag_mays, + tag_forbids, + frozen_children, + ) #print('mmf accept:', mmf_results) else: mmf_results = None @@ -786,7 +792,13 @@ class PDBPhotoMixin: if mmf_results is not None and mmf_results['photoids'] == set(): generator = [] else: - query = searchhelpers.build_query(orderby, notnulls, minimums, maximums, mmf_results=mmf_results) + query = searchhelpers.build_query( + orderby, + notnulls, + minimums, + maximums, + mmf_results=mmf_results, + ) print(query[:200]) generator = helpers.select_generator(self.sql, query) diff --git a/frontends/etiquette_flask/templates/search.html b/frontends/etiquette_flask/templates/search.html index def2597..6b2de5d 100644 --- a/frontends/etiquette_flask/templates/search.html +++ b/frontends/etiquette_flask/templates/search.html @@ -291,6 +291,10 @@ form