From debaa8f5afcbac422bfd45dea9a472a7dc396032 Mon Sep 17 00:00:00 2001 From: monsieurswag Date: Wed, 15 May 2024 11:03:07 +0200 Subject: [PATCH] Set the is_loaded attribute at the initialization of stored libraries --- backend/core/models.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/backend/core/models.py b/backend/core/models.py index 680d1a29d..b76629b47 100644 --- a/backend/core/models.py +++ b/backend/core/models.py @@ -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): @@ -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.