Skip to content

Commit

Permalink
Merge pull request #80 from arthur-schnitzler/main
Browse files Browse the repository at this point in the history
fix for broken clean date method, closes #187
  • Loading branch information
csae8092 authored Apr 29, 2024
2 parents df79426 + d5d82b7 commit 9fc1d26
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
22 changes: 14 additions & 8 deletions apis_core/apis_metainfo/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,18 +179,24 @@ def img_credit_label(self):
return credit

def clean_start_date_written(self):
clean_date = self.start_date_written
if self.start_date_written:
if "<" in self.start_date_written:
clean_date = self.start_date_written.split("<")[0]
return clean_date.strip()
clean_date = self.start_date_written
if self.start_date_written:
if "<" in self.start_date_written:
clean_date = self.start_date_written.split("<")[0]
return clean_date.strip()
else:
return ""

def clean_end_date_written(self):
clean_date = self.end_date_written
if self.end_date_written:
if "<" in self.end_date_written:
clean_date = self.end_date_written.split("<")[0]
return clean_date.strip()
clean_date = self.end_date_written
if self.end_date_written:
if "<" in self.end_date_written:
clean_date = self.end_date_written.split("<")[0]
return clean_date.strip()
else:
return ""

@classmethod
def get_listview_url(self):
Expand Down
2 changes: 1 addition & 1 deletion apis_core/apis_tei/templates/apis_tei/date.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% if object.start_date_written == object.end_date_written %}
{% if object.start_date_written == object.end_date_written and object.start_date_written %}
<date>{{ object.clean_start_date_written }}</date>
{% elif object.start_date_written and object.end_date_written %}
<date
Expand Down

0 comments on commit 9fc1d26

Please sign in to comment.