From 20e7547e212188026c7d28bf95ddf2f970287e75 Mon Sep 17 00:00:00 2001
From: dcz <dcz@ipipan.waw.pl>
Date: Thu, 7 Mar 2024 08:56:05 +0100
Subject: [PATCH] Free lu add to entry bugfix.

---
 README.md        | 5 +++++
 freelus/views.py | 2 ++
 2 files changed, 7 insertions(+)

diff --git a/README.md b/README.md
index 7f86802..5869dcc 100644
--- a/README.md
+++ b/README.md
@@ -82,3 +82,8 @@ Compiled application files will be located in `frontend/dist/`.
 
     export LOADING_THE_SLOWOSIEC_ONTOLOGY_HIERARCHY_DISABLED=true
     python manage.py db_import_relation_entries
+    
+## Database update for free lexical units
+
+    export LOADING_THE_SLOWOSIEC_ONTOLOGY_HIERARCHY_DISABLED=true
+    python manage.py db_import_potential_entry_2_lu_connections
diff --git a/freelus/views.py b/freelus/views.py
index 8b41de6..a9a9544 100644
--- a/freelus/views.py
+++ b/freelus/views.py
@@ -60,6 +60,8 @@ def change_lus_in_slowal_frame(request):
         frame_lexical_units_to_add = request_lu_int_ids.difference(frame_lexical_units)
         for lu_id in frame_lexical_units_to_add:
             lu = LexicalUnit.objects.get(pk=lu_id)
+            entry.lexical_units.add(lu)
+            entry.lexical_units_count = entry.lexical_units_count + 1
             frame.lexical_units.add(lu)
 
         if len(frame.lexical_units.all()) == 0:
-- 
GitLab