From 9532db5d83e0a52ede6aa991b0ccc455a6069721 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 27 Jan 2023 14:31:28 +0100 Subject: [PATCH] Don't include one-time sponsors in list --- tools/automator/src/sponsors.rs | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/tools/automator/src/sponsors.rs b/tools/automator/src/sponsors.rs index 9013cacdd..1f8ef0e87 100644 --- a/tools/automator/src/sponsors.rs +++ b/tools/automator/src/sponsors.rs @@ -24,6 +24,7 @@ impl Sponsors { tier { monthlyPriceInDollars } + isOneTimePayment } } ... on Organization { @@ -33,6 +34,7 @@ impl Sponsors { tier { monthlyPriceInDollars } + isOneTimePayment } } } @@ -48,7 +50,14 @@ impl Sponsors { .sponsors .nodes .into_iter() - .map(|node| { + .filter_map(|node| { + if node + .sponsorship_for_viewer_as_sponsorable + .is_one_time_payment + { + return None; + } + let login = node.login; let since = node.sponsorship_for_viewer_as_sponsorable.created_at; @@ -57,11 +66,11 @@ impl Sponsors { .tier .monthly_price_in_dollars; - Sponsor { + Some(Sponsor { login, since, dollars, - } + }) }) .collect::>(); @@ -173,6 +182,9 @@ pub struct QueryResultSponsorable { pub created_at: DateTime, pub tier: QueryResultSponsorableTier, + + #[serde(rename = "isOneTimePayment")] + pub is_one_time_payment: bool, } #[derive(Debug, serde::Deserialize)]