Procházet zdrojové kódy

perf: avoid coalescing wherever possible (#17920) (#17925)

(cherry picked from commit cdb0732646)

Co-authored-by: Ankush Menat <ankush@frappe.io>
version-14
mergify[bot] před 2 roky
committed by GitHub
rodič
revize
7c8a125c74
V databázi nebyl nalezen žádný známý klíč pro tento podpis ID GPG klíče: 4AEE18F83AFDEB23
2 změnil soubory, kde provedl 8 přidání a 0 odebrání
  1. +3
    -0
      frappe/model/db_query.py
  2. +5
    -0
      frappe/tests/test_db_query.py

+ 3
- 0
frappe/model/db_query.py Zobrazit soubor

@@ -612,6 +612,9 @@ class DatabaseQuery:
)

elif f.operator.lower() in ("in", "not in"):
# if values contain '' or falsy values then only coalesce column
can_be_null = not f.value or any(v is None or v == "" for v in f.value)

values = f.value or ""
if isinstance(values, str):
values = values.split(",")


+ 5
- 0
frappe/tests/test_db_query.py Zobrazit soubor

@@ -745,6 +745,11 @@ class TestReportview(unittest.TestCase):

self.assertTrue(dashboard_settings)

def test_coalesce_with_in_ops(self):
self.assertNotIn("ifnull", frappe.get_all("User", {"name": ("in", ["a", "b"])}, run=0))
self.assertIn("ifnull", frappe.get_all("User", {"name": ("in", ["a", None])}, run=0))
self.assertIn("ifnull", frappe.get_all("User", {"name": ("in", ["a", ""])}, run=0))


def add_child_table_to_blog_post():
child_table = frappe.get_doc(


Načítá se…
Zrušit
Uložit