Skip to content

Instantly share code, notes, and snippets.

Grzegorz Plebański Ygreg

Block or report user

Report or block Ygreg

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am ygreg on github.
  • I am ygreg (https://keybase.io/ygreg) on keybase.
  • I have a public key whose fingerprint is A365 3D5F 0A2F 3A10 22BA C926 9D3C 5765 C6E4 391F

To claim this, I am signing this object:

View gist:88256704232f185a4282
{"SELECT ROUND(100.0 * SUM(CASE WHEN status = $1 THEN 1 ELSE 0 END) / COUNT(*), 2) AS share, date_trunc('month', created_at) AS date_trunc_created_at
FROM \"sessions\" AS k0 GROUP BY date_trunc('month', created_at)", [2]}
{"SELECT ROUND(100.0 * SUM(CASE WHEN status = $1 THEN 1 ELSE 0 END) / COUNT(*), 2) AS share, date_trunc($2, created_at) AS date_trunc_created_at
FROM \"sessions\" AS k0 GROUP BY date_trunc($3, created_at)", [2, "month", "month"]}
View report.ex
def date_and_count1(query, "month" = period, status) do
from s in query, select:
[fragment("ROUND(100.0 * SUM(CASE WHEN status = ? THEN 1 ELSE 0 END) / COUNT(*), 2) AS share", ^status),
fragment("date_trunc(?, created_at) AS date_trunc_created_at", "month")],
group_by: fragment("date_trunc(?, created_at)", "month")
end
def date_and_count2(query, "month" = period, status) do
from s in query, select:
[fragment("ROUND(100.0 * SUM(CASE WHEN status = ? THEN 1 ELSE 0 END) / COUNT(*), 2) AS share", ^status),
You can’t perform that action at this time.