Skip to content

Commit

Permalink
Set the is_loaded attribute at the initialization of stored libraries
Browse files Browse the repository at this point in the history
  • Loading branch information
monsieurswag committed May 15, 2024
1 parent 0cc1ae7 commit debaa8f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions backend/core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,11 @@ def store_library_content(cls, library_content: bytes) -> "StoredLibrary | None"
urn = library_data["urn"]
locale = library_data.get("locale", "en")
version = int(library_data["version"])
is_loaded = LoadedLibrary.objects.filter(
urn=urn,
locale=locale,
version=version
).exists()

library_matches = [*StoredLibrary.objects.filter(urn=urn, locale=locale)]
if any(library.version >= version for library in library_matches):
Expand Down Expand Up @@ -186,6 +191,7 @@ def store_library_content(cls, library_content: bytes) -> "StoredLibrary | None"
packager=library_data.get("packager"),
objects_meta=objects_meta,
dependencies=dependencies,
is_loaded=is_loaded,
builtin=library_data.get(
"builtin", False
), # We have to add a "builtin: true" line to every builtin library file.
Expand Down

0 comments on commit debaa8f

Please sign in to comment.