Skip to content

Commit

Permalink
fix((texts api): get best priority for default.
Browse files Browse the repository at this point in the history
  • Loading branch information
YishaiGlasner committed Jun 14, 2023
1 parent f2a0651 commit b735640
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion api/texts_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@ def __init__(self, oref, versions_params):
self.return_obj = {'versions': []}

def append_required_versions(self, lang, vtitle=None):
if vtitle:
if vtitle and vtitle != 'all':
versions = [v for v in self.all_versions if v.actualLanguage == lang and v.versionTitle == vtitle]
else:
versions = [v for v in self.all_versions if v.actualLanguage == lang]
if vtitle != 'all':
versions = [min(versions, key=lambda v: getattr(v, 'proiority', 100))]
for version in versions:
if version not in self.required_versions:
self.required_versions.append(version)
Expand Down

0 comments on commit b735640

Please sign in to comment.