aboutsummaryrefslogtreecommitdiffstats
path: root/main.py
diff options
context:
space:
mode:
authorPetr Šmerkl <46304018+SveterCZE@users.noreply.github.com>2021-05-05 23:36:48 +0200
committerPetr Šmerkl <46304018+SveterCZE@users.noreply.github.com>2021-05-05 23:36:48 +0200
commitba27366d9f411af56a594ccaee9895434d393ef5 (patch)
tree7e0db1afc282c7b07162c4f10f098095a70fa581 /main.py
parenta463c1dc7a5b7c0e8f9d2ac8f3f3662b926ec3b1 (diff)
downloadjustice-ba27366d9f411af56a594ccaee9895434d393ef5.tar.gz
Update form to combine foreign and domestic search
Diffstat (limited to 'main.py')
-rw-r--r--main.py33
1 files changed, 23 insertions, 10 deletions
diff --git a/main.py b/main.py
index 89c79f0..ee090d3 100644
--- a/main.py
+++ b/main.py
@@ -94,28 +94,41 @@ def search_results_entity(search):
entity_number = search.entity_number_search.data
entity_number_search_method = search.entity_number_search_selection.data
- foreign_entity_number = search.foreign_entity_number_search.data
- foreign_entity_number_search_method = search.foreign_entity_number_search_selection.data
+ # foreign_entity_number = search.foreign_entity_number_search.data
+ # foreign_entity_number_search_method = search.foreign_entity_number_search_selection.data
actual_selection = search.entity_actual_selection.data
qry = Pravnicka_Osoba.query
if entity_number:
+ qry1 = Pravnicka_Osoba.query
if entity_number_search_method == "text_anywhere":
qry = qry.filter(Pravnicka_Osoba.ico.contains(entity_number))
+ qry1 = qry1.filter(Pravnicka_Osoba.reg_cislo.contains(entity_number))
elif entity_number_search_method == "text_beginning":
qry = qry.filter(Pravnicka_Osoba.ico.like(f'{entity_number}%'))
+ qry1 = qry1.filter(Pravnicka_Osoba.reg_cislo.like(f'{entity_number}%'))
elif entity_number_search_method == "text_exact":
qry = qry.filter(Pravnicka_Osoba.ico == entity_number)
-
- if foreign_entity_number:
- if foreign_entity_number_search_method == "text_anywhere":
- qry = qry.filter(Pravnicka_Osoba.reg_cislo.contains(foreign_entity_number))
- elif foreign_entity_number_search_method == "text_beginning":
- qry = qry.filter(Pravnicka_Osoba.reg_cislo.like(f'{foreign_entity_number}%'))
- elif foreign_entity_number_search_method == "text_exact":
- qry = qry.filter(Pravnicka_Osoba.reg_cislo == foreign_entity_number)
+ qry1 = qry1.filter(Pravnicka_Osoba.reg_cislo == entity_number)
+ qry = qry.union(qry1)
+
+ # if entity_number:
+ # if entity_number_search_method == "text_anywhere":
+ # qry = qry.filter(Pravnicka_Osoba.ico.contains(entity_number))
+ # elif entity_number_search_method == "text_beginning":
+ # qry = qry.filter(Pravnicka_Osoba.ico.like(f'{entity_number}%'))
+ # elif entity_number_search_method == "text_exact":
+ # qry = qry.filter(Pravnicka_Osoba.ico == entity_number)
+
+ # if foreign_entity_number:
+ # if foreign_entity_number_search_method == "text_anywhere":
+ # qry = qry.filter(Pravnicka_Osoba.reg_cislo.contains(foreign_entity_number))
+ # elif foreign_entity_number_search_method == "text_beginning":
+ # qry = qry.filter(Pravnicka_Osoba.reg_cislo.like(f'{foreign_entity_number}%'))
+ # elif foreign_entity_number_search_method == "text_exact":
+ # qry = qry.filter(Pravnicka_Osoba.reg_cislo == foreign_entity_number)
if entity_name:
if entity_name_search_method == "text_anywhere":