Skip to content

Commit

Permalink
Add supplementary to file_type #4326
Browse files Browse the repository at this point in the history
  • Loading branch information
joemull authored and ajrbyers committed Sep 11, 2024
1 parent 4747f66 commit 1ffd0a0
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/core/templatetags/files.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,14 @@ def file_type(article, file):

from production.logic import get_copyedit_files
copyedited_files = get_copyedit_files(article)
galley_files = [galley.file for galley in article.galley_set.all()]
galley_files = {galley.file for galley in article.galley_set.all()}
supplementary_files = {
supp.file for supp in article.supplementary_files.all()
}
galley_sub_files = list()
review_files = [review.review_file for review in article.reviewassignment_set.all()]
review_files = {
review.review_file for review in article.reviewassignment_set.all()
}
try:
# GalleyProofing belongs to the typesetting plugin
annotated_files = models.File.objects.filter(
Expand All @@ -76,12 +81,14 @@ def file_type(article, file):
if galley.css_file:
galley_sub_files.append(galley.css_file)

if file in article.manuscript_files.all() and file not in galley_files:
if file in galley_files:
return 'Galley'
if file in supplementary_files:
return 'Supplementary'
if file in article.manuscript_files.all():
return 'Manuscript'
if file in article.data_figure_files.all():
return 'Data/Figure'
if file in galley_files:
return 'Galley'
if file in annotated_files:
return 'Proofing'
if file in copyedited_files:
Expand Down

0 comments on commit 1ffd0a0

Please sign in to comment.