scflode
scflode
AEAsh Elixir
Created by scflode on 1/26/2023 in #support
Conditions in expr (calculations)
Created a ticket: https://github.com/ash-project/ash_postgres/issues/128 Will close here. Thanks again!
33 replies
AEAsh Elixir
Created by scflode on 1/26/2023 in #support
Conditions in expr (calculations)
OK!
33 replies
AEAsh Elixir
Created by scflode on 1/26/2023 in #support
Conditions in expr (calculations)
is this an AshPostgres or Ash.Query issue?
33 replies
AEAsh Elixir
Created by scflode on 1/26/2023 in #support
Conditions in expr (calculations)
thanks for this awesomely quick help!
33 replies
AEAsh Elixir
Created by scflode on 1/26/2023 in #support
Conditions in expr (calculations)
will do (maybe you need to clarify the description as I have no idea what the root cause is)
33 replies
AEAsh Elixir
Created by scflode on 1/26/2023 in #support
Conditions in expr (calculations)
calculations do
calculate :percent_open,
:float,
expr(if(total_tickets > 0, type(open_tickets / total_tickets, :float), 100.0))
end
calculations do
calculate :percent_open,
:float,
expr(if(total_tickets > 0, type(open_tickets / total_tickets, :float), 100.0))
end
33 replies
AEAsh Elixir
Created by scflode on 1/26/2023 in #support
Conditions in expr (calculations)
that was it
33 replies
AEAsh Elixir
Created by scflode on 1/26/2023 in #support
Conditions in expr (calculations)
will try the casting
33 replies
AEAsh Elixir
Created by scflode on 1/26/2023 in #support
Conditions in expr (calculations)
looks a bit massive as I have the archival extension enabled
33 replies
AEAsh Elixir
Created by scflode on 1/26/2023 in #support
Conditions in expr (calculations)
That's the resulting query
33 replies
AEAsh Elixir
Created by scflode on 1/26/2023 in #support
Conditions in expr (calculations)
SELECT r0."id", r0."name", coalesce(s1."open_tickets"::bigint, $1::bigint)::bigint, coalesce(s1."total_tickets"::bigint, $2::bigint)::bigint, (CASE WHEN (coalesce(s1."total_tickets", $3::bigint)::bigint > $4::bigint)::boolean THEN (coalesce(s1."open_tickets", $5::bigint)::bigint / coalesce(s1."total_tickets", $6::bigint)::bigint)::float ELSE $7::float END)::float::float FROM "representatives" AS r0 LEFT OUTER JOIN LATERAL (SELECT coalesce(count(st0."id"::uuid) FILTER (WHERE ((st0."archived_at"::timestamp IS NULL) = $8) AND (st0."status"::varchar = $9::varchar)), $10::bigint)::bigint AS "open_tickets", coalesce(count(st0."id"::uuid) FILTER (WHERE (st0."archived_at"::timestamp IS NULL) = $11), $12::bigint)::bigint AS "total_tickets", st0."representative_id" AS "representative_id" FROM "public"."tickets" AS st0 WHERE ((st0."archived_at"::timestamp IS NULL) = $13) AND (r0."id" = st0."representative_id") GROUP BY st0."representative_id") AS s1 ON TRUE LIMIT $14 [0, 0, 0, 0, 0, 0, 100.0, true, :open, 0, true, 0, true, 10]
SELECT r0."id", r0."name", coalesce(s1."open_tickets"::bigint, $1::bigint)::bigint, coalesce(s1."total_tickets"::bigint, $2::bigint)::bigint, (CASE WHEN (coalesce(s1."total_tickets", $3::bigint)::bigint > $4::bigint)::boolean THEN (coalesce(s1."open_tickets", $5::bigint)::bigint / coalesce(s1."total_tickets", $6::bigint)::bigint)::float ELSE $7::float END)::float::float FROM "representatives" AS r0 LEFT OUTER JOIN LATERAL (SELECT coalesce(count(st0."id"::uuid) FILTER (WHERE ((st0."archived_at"::timestamp IS NULL) = $8) AND (st0."status"::varchar = $9::varchar)), $10::bigint)::bigint AS "open_tickets", coalesce(count(st0."id"::uuid) FILTER (WHERE (st0."archived_at"::timestamp IS NULL) = $11), $12::bigint)::bigint AS "total_tickets", st0."representative_id" AS "representative_id" FROM "public"."tickets" AS st0 WHERE ((st0."archived_at"::timestamp IS NULL) = $13) AND (r0."id" = st0."representative_id") GROUP BY st0."representative_id") AS s1 ON TRUE LIMIT $14 [0, 0, 0, 0, 0, 0, 100.0, true, :open, 0, true, 0, true, 10]
33 replies
AEAsh Elixir
Created by scflode on 1/26/2023 in #support
Conditions in expr (calculations)
the 0.0 ones should be around 0.75
33 replies
AEAsh Elixir
Created by scflode on 1/26/2023 in #support
Conditions in expr (calculations)
No description
33 replies
AEAsh Elixir
Created by scflode on 1/26/2023 in #support
Conditions in expr (calculations)
This did not change anything unfortunately.
33 replies
AEAsh Elixir
Created by scflode on 1/26/2023 in #support
Conditions in expr (calculations)
that was quick 😄
33 replies