Skip to content

Commit

Permalink
Merge pull request #1649 from dchiller/i1635-no-ms73-volpiano
Browse files Browse the repository at this point in the history
Temporarily turn off volpiano display for MS 73
  • Loading branch information
dchiller authored Oct 4, 2024
2 parents bcfac9b + 3265dbd commit cc14cf5
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ <h3>Browse Chants</h3>
<td class="text-wrap">
<a href="{% url 'chant-detail' chant.id %}"><b>{{ chant.incipit|default:"" }}</b></a>
<p>{{ chant.manuscript_full_text_std_spelling|default:"" }}<br>
{% if chant.volpiano %}
<!-- See #1635. Temporarily disable volpiano display for this source. -->
{% if chant.volpiano and chant.source.id != 680970 %}
<span style="font-family: volpiano; font-size:25px">{{ chant.volpiano|default:"" }}</span>
{% endif %}
</p>
Expand Down
8 changes: 5 additions & 3 deletions django/cantusdb_project/main_app/templates/chant_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,9 @@ <h3>{{ chant.incipit }}</h3>
<dt>Full text as in Source (source spelling)</dt>
<dd>{{ chant.manuscript_full_text }}</dd>
{% endif %}

{% if chant.volpiano %}

<!-- See #1635. Temporarily disable volpiano display for this source. -->
{% if chant.volpiano and chant.source.id != 680970 %}
<dt>Volpiano</dt>
<dd>
<p style="font-family: volpiano; font-size:36px">{{ chant.volpiano }}</p>
Expand All @@ -253,7 +254,8 @@ <h3>{{ chant.incipit }}</h3>
<dd>{{ chant.indexing_notes }}</dd>
{% endif %}

{% if chant.volpiano %}
<!-- See #1635. Temporarily disable volpiano display for this source. -->
{% if chant.volpiano and chant.source.id != 680970 %}
<div class="row">
<div class="col">
<dt>Melody with text</dt>
Expand Down
6 changes: 5 additions & 1 deletion django/cantusdb_project/main_app/templates/chant_search.html
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,8 @@ <h3>Search Chants</h3>
</thead>
<tbody>
{% for chant in chants %}
<!-- See #1635. Temporarily disable volpiano display for this source. -->
{% if chant.source.id != 680970 or melodies != "true" %}
<tr>
{% if not source %}
<td class="text-wrap" style="text-align:left">
Expand Down Expand Up @@ -297,7 +299,8 @@ <h3>Search Chants</h3>
{% endif %}
</td>
<td class="text-wrap" style="text-align:center">
{% if chant.volpiano %}
<!-- See #1635. Temporarily disable volpiano display for this source. -->
{% if chant.volpiano and chant.source.id != 680970 %}
<span title="Chant record has Volpiano melody"></span>
{% endif %}
</td>
Expand All @@ -307,6 +310,7 @@ <h3>Search Chants</h3>
{% endif %}
</td>
</tr>
{% endif %}
{% endfor %}
</tbody>
</table>
Expand Down
3 changes: 2 additions & 1 deletion django/cantusdb_project/main_app/templates/source_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ <h3>Browse Sources</h3>
</td>
<td class="text-wrap" style="text-align:center">
<b>{{ source.number_of_chants|default_if_none:"0" }}</b>
{% if source.number_of_melodies %}
<!-- See #1635. Temporarily disable volpiano display for this source. -->
{% if source.number_of_melodies and source.id != 680970 %}
<br>/ {{ source.number_of_melodies }}
{% endif %}
</td>
Expand Down
26 changes: 15 additions & 11 deletions django/cantusdb_project/main_app/views/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,17 +265,21 @@ def ajax_melody_search(request):
chants = chants.filter(feast__name__icontains=feast_name)
if mode:
chants = chants.filter(mode__icontains=mode)

result_values = chants.order_by("id").values(
"id",
"source__holding_institution__siglum",
"source__shelfmark",
"folio",
"incipit",
"genre__name",
"feast__name",
"mode",
"volpiano",
# See #1635 re the following source exclusion. Temporarily disable volpiano display for this source.
result_values = (
chants.exclude(source__id=680970)
.order_by("id")
.values(
"id",
"source__holding_institution__siglum",
"source__shelfmark",
"folio",
"incipit",
"genre__name",
"feast__name",
"mode",
"volpiano",
)
)
# convert queryset to a list of dicts because QuerySet is not JSON serializable
# the above constructed queryset will be evaluated here
Expand Down
9 changes: 9 additions & 0 deletions django/cantusdb_project/main_app/views/chant.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,9 @@ def get_context_data(self, **kwargs) -> dict:
if search_position:
search_parameters.append(f"position={search_position}")
search_melodies: Optional[str] = self.request.GET.get("melodies")
# This was added to context so that we could implement #1635 and can be
# removed once that is undone.
context["melodies"] = search_melodies
if search_melodies:
search_parameters.append(f"melodies={search_melodies}")
search_bar: Optional[str] = self.request.GET.get("search_bar")
Expand Down Expand Up @@ -653,6 +656,12 @@ def get_queryset(self) -> QuerySet:
# If the "apply" button hasn't been clicked, return empty queryset
if not self.request.GET:
return Chant.objects.none()
# See #1635 re the following source exclusion. Temporarily disable volpiano display for this source.
if (
self.request.GET.get("melodies") == "true"
and self.kwargs["source_pk"] == 680970
):
return Chant.objects.none()

# Create a Q object to filter the QuerySet of Chants
q_obj_filter = Q()
Expand Down

0 comments on commit cc14cf5

Please sign in to comment.