From 809a2416c93318ec2061d6dc49b662bd8abf1c46 Mon Sep 17 00:00:00 2001 From: Daniel Schadt Date: Sat, 25 Mar 2023 17:53:02 +0100 Subject: insert user into hittekaart queue on track uploads --- fietsboek/scripts/fietscron.py | 2 +- fietsboek/views/detail.py | 4 ++++ fietsboek/views/upload.py | 3 +++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/fietsboek/scripts/fietscron.py b/fietsboek/scripts/fietscron.py index e422fb2..897078c 100644 --- a/fietsboek/scripts/fietscron.py +++ b/fietsboek/scripts/fietscron.py @@ -142,7 +142,7 @@ def refill_queue(session: Session, redis: Redis): """Refills the low-priority hittekaart queue by adding all users to it.""" LOGGER.debug("Refilling low-priority queue") for user in session.execute(select(models.User)).scalars(): - redis.sadd("hittekaart:queue:low", str(user.id)) + redis.sadd("hittekaart:queue:low", user.id) __all__ = ["cli"] diff --git a/fietsboek/views/detail.py b/fietsboek/views/detail.py index 259e5d6..f540a11 100644 --- a/fietsboek/views/detail.py +++ b/fietsboek/views/detail.py @@ -138,6 +138,10 @@ def delete_track(request): request.dbsession.delete(track) request.data_manager.purge(track_id) request.session.flash(request.localizer.translate(_("flash.track_deleted"))) + + if request.config.hittekaart_autogenerate: + request.redis.sadd("hittekaart:queue:high", request.identity.id) + return HTTPFound(request.route_url("home")) diff --git a/fietsboek/views/upload.py b/fietsboek/views/upload.py index fd93034..6fccdba 100644 --- a/fietsboek/views/upload.py +++ b/fietsboek/views/upload.py @@ -187,6 +187,9 @@ def do_finish_upload(request): request.session.flash(request.localizer.translate(_("flash.upload_success"))) + if request.config.hittekaart_autogenerate: + request.redis.sadd("hittekaart:queue:high", request.identity.id) + return HTTPFound(request.route_url("details", track_id=track.id)) -- cgit v1.2.3