Add waitlist summary API

This commit is contained in:
Max Brunsfeld 2022-09-16 15:37:19 -07:00
parent f8c7c925af
commit 3dd8845bd8
3 changed files with 68 additions and 3 deletions

View file

@ -966,8 +966,8 @@ async fn test_signups() {
db.create_signup(Signup {
email_address: format!("person-{i}@example.com"),
platform_mac: true,
platform_linux: true,
platform_windows: false,
platform_linux: i % 2 == 0,
platform_windows: i % 4 == 0,
editor_features: vec!["speed".into()],
programming_languages: vec!["rust".into(), "c".into()],
})
@ -975,6 +975,16 @@ async fn test_signups() {
.unwrap();
}
assert_eq!(
db.get_waitlist_summary().await.unwrap(),
WaitlistSummary {
count: 8,
mac_count: 8,
linux_count: 4,
windows_count: 2,
}
);
// retrieve the next batch of signup emails to send
let signups_batch1 = db.get_unsent_invites(3).await.unwrap();
let addresses = signups_batch1
@ -1016,6 +1026,17 @@ async fn test_signups() {
]
);
// the sent invites are excluded from the summary.
assert_eq!(
db.get_waitlist_summary().await.unwrap(),
WaitlistSummary {
count: 5,
mac_count: 5,
linux_count: 2,
windows_count: 1,
}
);
// user completes the signup process by providing their
// github account.
let (user_id, inviter_id) = db