From d30aad21fb90d2409f59d43434a042e149b1341c Mon Sep 17 00:00:00 2001 From: binaryfox Date: Wed, 10 Jan 2024 11:15:01 -0800 Subject: [PATCH] Add a report for when pieces were last scanned (#114) --- artshow/reports.py | 10 +++++++- .../artshow/reports-scanned-pieces.html | 25 +++++++++++++++++++ artshow/templates/artshow/reports.html | 3 ++- artshow/urls.py | 2 ++ 4 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 artshow/templates/artshow/reports-scanned-pieces.html diff --git a/artshow/reports.py b/artshow/reports.py index 8070368..a6fc70a 100644 --- a/artshow/reports.py +++ b/artshow/reports.py @@ -4,7 +4,7 @@ from decimal import Decimal from django.shortcuts import render from django.db.models import ( - Case, Count, Exists, Max, OuterRef, Q, Subquery, Sum, Value as V, When + Case, Count, Exists, F, Max, OuterRef, Q, Subquery, Sum, Value as V, When ) from django.db.models.fields import DecimalField from django.db.models.functions import Coalesce @@ -114,6 +114,14 @@ def unsold_pieces(request): {'bidders': bidders}) +@permission_required('artshow.is_artshow_staff') +def scanned_pieces(request): + pieces = Piece.objects.order_by(F('bids_updated').asc(nulls_first=True), 'location', 'artist__artistid', 'pieceid') + + return render(request, 'artshow/reports-scanned-pieces.html', + {'pieces': pieces}) + + @permission_required('artshow.is_artshow_staff') def artist_piece_report(request, artist_id): artist = Artist.objects.get(id=artist_id) diff --git a/artshow/templates/artshow/reports-scanned-pieces.html b/artshow/templates/artshow/reports-scanned-pieces.html new file mode 100644 index 0000000..f226215 --- /dev/null +++ b/artshow/templates/artshow/reports-scanned-pieces.html @@ -0,0 +1,25 @@ +{% extends "artshow/base_generic.html" %} +{% block title %}Scanned Pieces Report{% endblock %} +{% block breadcrumbs %} + +{% endblock %} +{% block content %} + + + + + + + {% for piece in pieces %} + + + + + + {% endfor %} +
Last ScannedLocationPiece
{{ piece.bids_updated|date:"l, P" }}{{ piece.location }}{{ piece }}
+{% endblock %} diff --git a/artshow/templates/artshow/reports.html b/artshow/templates/artshow/reports.html index 6ece8b0..1831e5a 100644 --- a/artshow/templates/artshow/reports.html +++ b/artshow/templates/artshow/reports.html @@ -12,7 +12,8 @@

General Stuff

  • Showing Artists
  • Allocations Waiting
  • Winning Bidders
  • -
  • Unsold Pieces
  • +
  • Scanned Pieces
  • +
  • Unsold Pieces
  • Artist to Panel Report
  • Panel to Artist Report
  • Artist Payment Report
  • diff --git a/artshow/urls.py b/artshow/urls.py index 1c93254..5ebb4c6 100644 --- a/artshow/urls.py +++ b/artshow/urls.py @@ -45,6 +45,8 @@ name='artshow-report-winning-bidders'), re_path(r'^reports/unsold-pieces/$', reports.unsold_pieces, name='artshow-report-unsold-pieces'), + re_path(r'^reports/scanned-pieces/$', reports.scanned_pieces, + name='artshow-report-scanned-pieces'), re_path(r'^reports/artist-panel-report/$', reports.artist_panel_report, name='artshow-report-artist-to-panel'), re_path(r'^reports/panel-artist-report/$', reports.panel_artist_report,