Skip to content

Commit

Permalink
Add a report for when pieces were last scanned (#114)
Browse files Browse the repository at this point in the history
  • Loading branch information
binaryf0x committed Jan 10, 2024
1 parent 0c81134 commit d30aad2
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 2 deletions.
10 changes: 9 additions & 1 deletion artshow/reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
25 changes: 25 additions & 0 deletions artshow/templates/artshow/reports-scanned-pieces.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{% extends "artshow/base_generic.html" %}
{% block title %}Scanned Pieces Report{% endblock %}
{% block breadcrumbs %}
<ul class="breadcrumbs">
<li><a href="/">Home</a></li>
<li><a href="{% url 'artshow-reports' %}">Reports</a></li>
<li class="current">Scanned Pieces Report</li>
</ul>
{% endblock %}
{% block content %}
<table>
<tr>
<th>Last Scanned</th>
<th>Location</th>
<th>Piece</th>
</tr>
{% for piece in pieces %}
<tr>
<td>{{ piece.bids_updated|date:"l, P" }}</td>
<td>{{ piece.location }}</td>
<td>{{ piece }}</td>
</tr>
{% endfor %}
</table>
{% endblock %}
3 changes: 2 additions & 1 deletion artshow/templates/artshow/reports.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ <h3>General Stuff</h3>
<li><a href="{% url "artshow-report-artists" %}">Showing Artists</a></li>
<li><a href="{% url "artshow-report-allocations-waiting" %}">Allocations Waiting</a></li>
<li><a href="{% url "artshow-report-winning-bidders" %}">Winning Bidders</a></li>
<li><a href="{% url 'artshow-report-unsold-pieces' %}">Unsold Pieces</a></li>
<li><a href="{% url "artshow-report-scanned-pieces" %}">Scanned Pieces</a></li>
<li><a href="{% url "artshow-report-unsold-pieces" %}">Unsold Pieces</a></li>
<li><a href="{% url "artshow-report-artist-to-panel" %}">Artist to Panel Report</a></li>
<li><a href="{% url "artshow-report-panel-to-artist" %}">Panel to Artist Report</a></li>
<li><a href="{% url "artshow-report-artist-payment" %}">Artist Payment Report</a></li>
Expand Down
2 changes: 2 additions & 0 deletions artshow/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit d30aad2

Please sign in to comment.