diff --git a/charts/prod-ohstaff-values.yaml b/charts/prod-ohstaff-values.yaml
index 4b21ada..ce405aa 100644
--- a/charts/prod-ohstaff-values.yaml
+++ b/charts/prod-ohstaff-values.yaml
@@ -6,7 +6,7 @@ replicaCount: 1
image:
repository: uclalibrary/oral-history-staff-ui
- tag: v1.0.11
+ tag: v1.0.12
pullPolicy: Always
nameOverride: ""
diff --git a/oh_staff_ui/classes/OralHistoryMods.py b/oh_staff_ui/classes/OralHistoryMods.py
index 47b3530..2ffd5a8 100644
--- a/oh_staff_ui/classes/OralHistoryMods.py
+++ b/oh_staff_ui/classes/OralHistoryMods.py
@@ -41,7 +41,7 @@ def populate_fields(self):
self._populate_rights()
self._populate_subjects()
self._populate_constituent_audio()
- self._populate_narrator_image()
+ self._populate_interviewee_image()
self._populate_interview_content()
self._populate_series_content()
@@ -177,21 +177,21 @@ def _create_relateditem_audio(self, mi: MediaFile) -> MODSv34:
ri.toc = TableOfContents(text=toc.value)
for ts in MediaFile.objects.filter(
- item=pi, file_type__file_code="text_master_index"
+ item=pi, file_type__file_code="text_master_transcript"
):
- if ts.file_url != "":
- ri.locations.append(
- LocationOH(url=ts.file_url, usage="primary display")
- )
+ if ts.file_url != "" and ts.file_url.endswith(".xml"):
+ # Due to legacy design the text_master_transcript can have 2 file types
+ # associated with it, we only want to show xml (TEI), and ignore html files
+ ri.locations.append(LocationOH(url=ts.file_url, usage="timed log"))
return ri
- def _populate_narrator_image(self):
+ def _populate_interviewee_image(self):
for img in MediaFile.objects.filter(
item=self._item, file_type__file_code="image_submaster"
).order_by("sequence"):
self.locations.append(
- LocationOH(url=img.file_url, label="Image of Narrator")
+ LocationOH(url=img.file_url, label="Image of Interviewee")
)
def _populate_interview_content(self):
diff --git a/oh_staff_ui/templates/oh_staff_ui/release_notes.html b/oh_staff_ui/templates/oh_staff_ui/release_notes.html
index 4efc9b4..6f94766 100644
--- a/oh_staff_ui/templates/oh_staff_ui/release_notes.html
+++ b/oh_staff_ui/templates/oh_staff_ui/release_notes.html
@@ -4,6 +4,13 @@
Release Notes
+1.0.12
+April 26, 2024
+
+ - Display value associated with images changed from Narrator to Interviewee in OAI feed
+ - TEI documents are now presented as mods:location/mods:url[@="timed_log"] inside mods:relatedItem
+
+
1.0.11
April 26, 2024
diff --git a/oh_staff_ui/tests.py b/oh_staff_ui/tests.py
index e706062..e75232c 100644
--- a/oh_staff_ui/tests.py
+++ b/oh_staff_ui/tests.py
@@ -1150,6 +1150,12 @@ def setUpTestData(cls):
file="oh_static/text/submasters/fake-abcdef-2-master-tei.xml",
)
+ # Utility methods to pretty print xml
+ def prettify_xml(self, xml: str) -> str:
+ root = etree.fromstring(xml.serializeDocument())
+ pretty_xml = etree.tostring(root, pretty_print=True, encoding="unicode")
+ return pretty_xml
+
# Utility methods to return MODS specific to item type
def get_mods_from_audio_item(self):
return self.get_mods_from_item_type(type="audio")
@@ -1322,7 +1328,7 @@ def test_valid_timing_log(self):
def test_valid_mods_image(self):
ohmods = self.get_mods_from_interview_item()
self.assertTrue(
- b''
+ b''
in ohmods.serializeDocument()
)
@@ -1356,7 +1362,8 @@ def test_series_relateditem_on_items(self):
)
def test_timed_log_attribute_is_added(self):
- # If an item contains a TEI/XML transcript, it should have a usage attribute with value "timed_log"
+ # If an item contains a TEI/XML transcript, it should have a usage attribute
+ # with value "timed_log"
if MediaFile(
item=self.audio_item,
file_type=MediaFileType.objects.get(file_code="text_master_transcript"),
@@ -1366,6 +1373,35 @@ def test_timed_log_attribute_is_added(self):
b'' in ohmods.serializeDocument()
)
+ def test_absence_of_timed_log_with_text_master_index(self):
+ # If an item does not contain a file_code of text_master_transcript,
+ # mods:url[@usage="timed log"] should not be present.
+
+ # Delete MediaFile associated with "text_master_transcript" file_code
+ media_file = MediaFile.objects.get(
+ item__id=self.audio_item.id, file_type__file_code="text_master_transcript"
+ )
+ media_file.delete()
+
+ ohmods = self.get_mods_from_audio_item()
+
+ # At this point we should only have "text_master_index" file_code MediaFile
+ if MediaFile.objects.get(
+ item__id=self.audio_item.id, file_type__file_code="text_master_index"
+ ):
+ self.assertFalse(
+ b'' in ohmods.serializeDocument()
+ )
+
+ # Add "text_master_transcript" back in case future tests rely on it
+ MediaFile.objects.create(
+ created_by=self.user,
+ file_type=MediaFileType.objects.get(file_code="text_master_transcript"),
+ item=self.audio_item,
+ original_file_name="FAKE_TEI_TIMED_LOG",
+ file="oh_static/text/submasters/fake-abcdef-2-master-tei.xml",
+ )
+
def test_writing_single_mods(self):
ohmods = self.get_mods_from_interview_item()
ohmods.write_mods_record()