Merge pull request #1760 from zed-industries/invite-unknown-platform

Include waitlist entries w/ unknown platform when summarizing and sending invites
This commit is contained in:
Max Brunsfeld 2022-10-14 16:24:48 -07:00 committed by GitHub
commit a4b518ec72
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View file

@ -428,7 +428,8 @@ impl Db for PostgresDb {
COUNT(*) as count, COUNT(*) as count,
COALESCE(SUM(CASE WHEN platform_linux THEN 1 ELSE 0 END), 0) as linux_count, COALESCE(SUM(CASE WHEN platform_linux THEN 1 ELSE 0 END), 0) as linux_count,
COALESCE(SUM(CASE WHEN platform_mac THEN 1 ELSE 0 END), 0) as mac_count, COALESCE(SUM(CASE WHEN platform_mac THEN 1 ELSE 0 END), 0) as mac_count,
COALESCE(SUM(CASE WHEN platform_windows THEN 1 ELSE 0 END), 0) as windows_count COALESCE(SUM(CASE WHEN platform_windows THEN 1 ELSE 0 END), 0) as windows_count,
COALESCE(SUM(CASE WHEN platform_unknown THEN 1 ELSE 0 END), 0) as unknown_count
FROM ( FROM (
SELECT * SELECT *
FROM signups FROM signups
@ -449,7 +450,7 @@ impl Db for PostgresDb {
FROM signups FROM signups
WHERE WHERE
NOT email_confirmation_sent AND NOT email_confirmation_sent AND
platform_mac (platform_mac OR platform_unknown)
LIMIT $1 LIMIT $1
", ",
) )
@ -1720,6 +1721,8 @@ pub struct WaitlistSummary {
pub mac_count: i64, pub mac_count: i64,
#[sqlx(default)] #[sqlx(default)]
pub windows_count: i64, pub windows_count: i64,
#[sqlx(default)]
pub unknown_count: i64,
} }
#[derive(FromRow, PartialEq, Debug, Serialize, Deserialize)] #[derive(FromRow, PartialEq, Debug, Serialize, Deserialize)]

View file

@ -1022,6 +1022,7 @@ async fn test_signups() {
mac_count: 8, mac_count: 8,
linux_count: 4, linux_count: 4,
windows_count: 2, windows_count: 2,
unknown_count: 0,
} }
); );
@ -1074,6 +1075,7 @@ async fn test_signups() {
mac_count: 5, mac_count: 5,
linux_count: 2, linux_count: 2,
windows_count: 1, windows_count: 1,
unknown_count: 0,
} }
); );