Avoid error sorting by relationships if related tables are not allowed

Refs #1306
pull/1357/head
Guy Freeman 2021-06-02 07:25:27 +03:00 zatwierdzone przez GitHub
rodzic f40d1b99d6
commit 0f41db1ba8
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
1 zmienionych plików z 3 dodań i 2 usunięć

Wyświetl plik

@ -78,8 +78,9 @@ class IndexView(BaseView):
# We will be sorting by number of relationships, so populate that field
all_foreign_keys = await db.get_all_foreign_keys()
for table, foreign_keys in all_foreign_keys.items():
count = len(foreign_keys["incoming"] + foreign_keys["outgoing"])
tables[table]["num_relationships_for_sorting"] = count
if table in tables.keys():
count = len(foreign_keys["incoming"] + foreign_keys["outgoing"])
tables[table]["num_relationships_for_sorting"] = count
hidden_tables = [t for t in tables.values() if t["hidden"]]
visible_tables = [t for t in tables.values() if not t["hidden"]]