Don't announce mapping events when already found
Some checks failed
Build and Test / Format check (push) Has been cancelled
Build and Test / Lint (push) Has been cancelled
Build and Test / Test (push) Has been cancelled
Build and Test / Check dependency hash (push) Has been cancelled
Build and Test / Build (push) Has been cancelled

This commit is contained in:
Natsu Kagami 2025-05-20 23:29:29 +02:00
parent 7542fa96f4
commit 7a1f7611aa
Signed by: nki
GPG key ID: 55A032EB38B49ADB
2 changed files with 6 additions and 4 deletions

View file

@ -183,7 +183,10 @@ impl Announcer {
let recents = recents let recents = recents
.into_iter() .into_iter()
.inspect(|v| { .inspect(|v| {
if let Some(mp) = v.to_event_mapping() { if let Some(mp) = v.to_event_mapping().filter(|s| {
let lu = last_update.values().max().cloned();
Self::is_announceable_date(s.date, lu, now)
}) {
mapping_events.push(mp); mapping_events.push(mp);
} }
}) })
@ -191,8 +194,7 @@ impl Announcer {
.filter(|s| Self::is_worth_announcing(s)) .filter(|s| Self::is_worth_announcing(s))
.filter(|s| { .filter(|s| {
let lu = last_update.get(&s.mode).cloned(); let lu = last_update.get(&s.mode).cloned();
let f = Self::is_announceable_date(s.date, lu, now); Self::is_announceable_date(s.date, lu, now)
f
}) })
.map(|e| CollectedScore::from_event(&env.client, header.clone(), e)) .map(|e| CollectedScore::from_event(&env.client, header.clone(), e))
.collect::<FuturesUnordered<_>>() .collect::<FuturesUnordered<_>>()

View file

@ -20,7 +20,7 @@ impl ApprovalStatus {
} }
} }
pub(super) fn time_to_utc(s: time::OffsetDateTime) -> DateTime<Utc> { pub fn time_to_utc(s: time::OffsetDateTime) -> DateTime<Utc> {
chrono::DateTime::from_timestamp(s.unix_timestamp(), 0).unwrap() chrono::DateTime::from_timestamp(s.unix_timestamp(), 0).unwrap()
} }