Getting partset working

This commit is contained in:
Tris Forster 2023-02-20 14:21:34 +11:00
parent da15eebb0a
commit c720cb773e
2 changed files with 8 additions and 6 deletions

View File

@ -12,13 +12,13 @@
<span class="icon"><i class="fas fa-print"></i></span>
<span>Print Set</span>
</button>
<a class="button is-link is-light" href="{% url 'work_detail' pk=object.pk %}">
<a class="button is-link is-light" href="{% url 'work_detail' collection.pk object.pk %}">
<span>Cancel</span>
</a>
</div>
<h3 class="subtitle"><a href="{% url 'work_detail' pk=work.pk %}">{{ work.name }}</a></h3>
<h3 class="subtitle"><a href="{% url 'work_detail' collection.pk work.pk %}">{{ work.name }}</a></h3>
<p class="block">
You can generate a custom partset for printing - select the number of copies of each you want...
@ -27,9 +27,9 @@
<div class="columns is-multiline is-mobile">
{% for part in work.digital_parts %}
<div class="column is-3 has-text-right">
<span style="white-space: nowrap">{{ part.instrument }}</span>
<span style="white-space: nowrap">{{ part.name }}</span>
<input name="parts" type="hidden" value="{{ part.tag }}">
<input name="copies" type="number" value="{% if part.tag == 'Score' %}0{% else %}1{% endif %}" size="1">
<input class="input" name="copies" type="number" value="{% if part.tag == 'score' %}0{% else %}1{% endif %}" size="1">
</div>
{% endfor %}
</div>

View File

@ -279,8 +279,10 @@ class WorkPartSetView(CollectionMixin, DetailView):
sections = []
for i, tag in enumerate(parts):
part = work.digital_parts.select_related('doc').get(tag=tag)
sections.append((part.doc.upload.path, part.instrument, part.start, part.end, int(copies[i])))
c = int(copies[i])
if c > 0:
part = models.Section.objects.select_related('doc').get(tag=tag, doc__work=work)
sections.append((part.doc.upload.path, part.name, part.start, part.end, c))
result = extract_and_concat(sections)