Skip to content

Commit

Permalink
Merge pull request #263 from OpenTreeOfLife/collection-hotfix
Browse files Browse the repository at this point in the history
last vs latest cleanup
  • Loading branch information
snacktavish authored Dec 14, 2023
2 parents 3dae194 + c998a9f commit 22db231
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions phylesystem_api/phylesystem_api/api_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,13 @@ def get_last_modified_dict(docstore=None, doc_id=None, last_commit=None):
commit_list = docstore.get_version_history_for_doc_id(doc_id)
if not commit_list:
return None
latest_commit = commit_list[0]
last_commit = commit_list[0]
return {
"author_name": latest_commit.get("author_name"),
"relative_date": latest_commit.get("relative_date"),
"display_date": latest_commit.get("date"),
"ISO_date": latest_commit.get("date_ISO_8601"),
"sha": latest_commit.get("id"), # this is the commit hash
"author_name": last_commit.get("author_name"),
"relative_date": last_commit.get("relative_date"),
"display_date": last_commit.get("date"),
"ISO_date": last_commit.get("date_ISO_8601"),
"sha": last_commit.get("id"), # this is the commit hash
}


Expand Down
2 changes: 1 addition & 1 deletion phylesystem_api/phylesystem_api/views/collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def add_collection_specific_fields(request, collection_id, result):
version_history = result.get("versionHistory")
if version_history:
result["lastModified"] = get_last_modified_dict(
latest_commit=version_history[0]
last_commit=version_history[0]
)
return result

Expand Down

0 comments on commit 22db231

Please sign in to comment.