add some stats
- ID
c1e01de- date
2023-05-14 15:15:35+00:00- author
Alex Chan <alex@alexwlchan.net>- parent
3584f96- message
add some stats- changed files
5 files, 41 additions, 3 deletions
Changed files
requirements.in (13) → requirements.in (29)
diff --git a/requirements.in b/requirements.in
index 31717ce..68f4f62 100644
--- a/requirements.in
+++ b/requirements.in
@@ -1 +1,2 @@
Flask==2.0.1
+humanize==4.4.0
requirements.txt (340) → requirements.txt (359)
diff --git a/requirements.txt b/requirements.txt
index 227e17a..d8356c8 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,6 +1,6 @@
#
-# This file is autogenerated by pip-compile with Python 3.9
-# by the following command:
+# This file is autogenerated by pip-compile
+# To update, run:
#
# pip-compile
#
@@ -8,6 +8,8 @@ click==8.1.3
# via flask
flask==2.0.1
# via -r requirements.in
+humanize==4.4.0
+ # via -r requirements.in
itsdangerous==2.1.2
# via flask
jinja2==3.1.2
server.py (6041) → server.py (6645)
diff --git a/server.py b/server.py
index 025abc3..53d30fd 100755
--- a/server.py
+++ b/server.py
@@ -1,5 +1,6 @@
#!/usr/bin/env python3
+import collections
import functools
import json
import os
@@ -7,11 +8,14 @@ import subprocess
import sys
from flask import Flask, redirect, render_template, request, send_file, url_for
+import humanize
app = Flask(__name__)
app.config["SEND_FILE_MAX_AGE_DEFAULT"] = 24 * 60 * 60
+app.add_template_filter(humanize.intcomma)
+
def get_asset_state(asset):
state_albums = [
@@ -74,6 +78,17 @@ class PhotosData:
this_asset = all_assets[position]
next_five = all_assets[position + 1 : position + 6]
+ if this_asset['state'] != 'Unknown':
+ unreviewed_assets = [asset for i, asset in enumerate(self.all_assets) if i < position]
+ try:
+ next_asset_id_to_review = unreviewed_assets[-1]['localIdentifier']
+ except IndexError:
+ pass
+ else:
+ next_asset_id_to_review = None
+
+ states = collections.Counter(asset['state'] for asset in self.all_assets)
+
return render_template(
"index.html",
assets=all_assets,
@@ -81,6 +96,8 @@ class PhotosData:
prev_five=prev_five,
this_asset=this_asset,
next_five=next_five,
+ next_asset_id_to_review=next_asset_id_to_review,
+ states=states,
)
def run_action(self, local_identifier, action):
static/style.css (3060) → static/style.css (3095)
diff --git a/static/style.css b/static/style.css
index ae9a6fd..b631507 100644
--- a/static/style.css
+++ b/static/style.css
@@ -156,6 +156,10 @@ img#big {
z-index: 1000;
}
+#debug ul {
+ text-align: left;
+}
+
.favorite {
text-align: right;
position: absolute;
templates/index.html (5852) → templates/index.html (6355)
diff --git a/templates/index.html b/templates/index.html
index 35df884..43b754e 100644
--- a/templates/index.html
+++ b/templates/index.html
@@ -4,7 +4,21 @@
<details id="debug">
<summary>debug</summary>
- <strong>this asset:</strong> {{ this_asset['localIdentifier'] }}
+ <ul>
+ <li><strong>this asset:</strong> {{ this_asset['localIdentifier'] }}</li>
+ {% if next_asset_id_to_review %}
+ <li>
+ <a href="/?localIdentifier={{ next_asset_id_to_review }}">jump to next unreiewed photo</a>
+ </li>
+ {% endif %}
+ <li><strong>stats:</strong>
+ {{ states["Approved"] | intcomma}} approved,
+ {{ states["Rejected"] | intcomma }} rejected,
+ {{ states["Needs Action"] | intcomma }} need action,
+ {{ states["Unknown"] | intcomma }} remaining
+ ({{ states.values() | sum | intcomma }} total)
+ </li>
+ </ul>
</details>
<div id="thumbnails">