Pārlūkot izejas kodu

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

(cherry picked from commit cdb0732646)

Co-authored-by: Ankush Menat <ankush@frappe.io>
version-14
mergify[bot] pirms 2 gadiem
committed by GitHub
vecāks
revīzija
7c8a125c74
Šim parakstam datu bāzē netika atrasta zināma atslēga GPG atslēgas ID: 4AEE18F83AFDEB23
2 mainītis faili ar 8 papildinājumiem un 0 dzēšanām
  1. +3
    -0
      frappe/model/db_query.py
  2. +5
    -0
      frappe/tests/test_db_query.py

+ 3
- 0
frappe/model/db_query.py Parādīt failu

@@ -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 Parādīt failu

@@ -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(


Notiek ielāde…
Atcelt
Saglabāt