Skip to content

Documentation fixes#804

Merged
LaurentRDC merged 3 commits into
masterfrom
documentation-fixes-580
Apr 27, 2026
Merged

Documentation fixes#804
LaurentRDC merged 3 commits into
masterfrom
documentation-fixes-580

Conversation

@LaurentRDC
Copy link
Copy Markdown
Member

@LaurentRDC LaurentRDC commented Apr 27, 2026

This pull request fixes a few documentation issues, which can now be represented on the website. Each commit is linked to an issue identified in #580.

Fixes #580

@LaurentRDC LaurentRDC changed the title Documentation fixes 580 Documentation fixes Apr 27, 2026
@LaurentRDC
Copy link
Copy Markdown
Member Author

LaurentRDC commented Apr 27, 2026

I'm requesting some extra eyes on this because it's not clear to me if the implementation of isJust_ was designed this way.

The original generated SQL query is:

SELECT 
  "t0"."email" AS "res0", 
  "t0"."first_name" AS "res1", 
  "t0"."last_name" AS "res2", 
  "t0"."password" AS "res3", 
  SUM(
    (
      CASE WHEN ("t2"."item_quantity") IS NOT NULL THEN "t2"."item_quantity" ELSE ? END
    ) * (
      CASE WHEN ("t3"."price") IS NOT NULL THEN "t3"."price" ELSE ? END
    )
  ) AS "res4" 
FROM 
  "cart_users" AS "t0" 
  LEFT JOIN "orders" AS "t1" ON ("t1"."for_user__email")=("t0"."email") 
  LEFT JOIN "line_items" AS "t2" ON CASE WHEN (
    (
      (
        (
          ("t1"."id") IS NOT NULL
        ) 
        AND (
          ("t1"."date") IS NOT NULL
        )
      ) 
      AND (
        ("t1"."for_user__email") IS NOT NULL
      )
    ) 
    AND (
      ("t1"."ship_to_address__id") IS NOT NULL
    )
  ) 
  AND (
    ("t1"."shipping_info__id") IS NOT NULL
  ) THEN ("t2"."item_in_order__id")=("t1"."id") ELSE ? END 
  LEFT JOIN "products" AS "t3" ON CASE WHEN (
    (
      ("t2"."item_in_order__id") IS NOT NULL
    ) 
    AND (
      ("t2"."item_for_product__id") IS NOT NULL
    )
  ) 
  AND (
    ("t2"."item_quantity") IS NOT NULL
  ) THEN ("t2"."item_for_product__id")=("t3"."id") ELSE ? END 
GROUP BY 
  "t0"."email", 
  "t0"."first_name", 
  "t0"."last_name", 
  "t0"."password" 
ORDER BY 
  SUM(
    (
      CASE WHEN ("t2"."item_quantity") IS NOT NULL THEN "t2"."item_quantity" ELSE ? END
    ) * (
      CASE WHEN ("t3"."price") IS NOT NULL THEN "t3"."price" ELSE ? END
    )
  ) DESC;

whereas with the third commit here, it becomes:

...
  LEFT JOIN "line_items" AS "t2" ON CASE WHEN NOT(
    (
      (
        (
          (
            ("t1"."id") IS NULL
          ) 
          AND (
            ("t1"."date") IS NULL
          )
        ) 
        AND (
          ("t1"."for_user__email") IS NULL
        )
      ) 
      AND (
        ("t1"."ship_to_address__id") IS NULL
      )
    ) 
    AND (
      ("t1"."shipping_info__id") IS NULL
    )
  ) THEN ("t2"."item_in_order__id")=("t1"."id") ELSE ? END
...

@LaurentRDC
Copy link
Copy Markdown
Member Author

LaurentRDC commented Apr 27, 2026

Hmm this is basically the same "fix" as #442.
I'll make a documentation edit to explain why the second query should be used instead of the first one.

…ng of a left Join, which by definition has nullable columns
@LaurentRDC LaurentRDC force-pushed the documentation-fixes-580 branch from 099ca8b to 93a4c08 Compare April 27, 2026 14:04
@LaurentRDC LaurentRDC merged commit 2b3e9fa into master Apr 27, 2026
1 check passed
@LaurentRDC LaurentRDC deleted the documentation-fixes-580 branch May 13, 2026 21:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Problems in tutorial 3

1 participant