mirror of
https://github.com/natsukagami/youmubot.git
synced 2025-05-23 16:50:49 +00:00
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
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:
parent
7542fa96f4
commit
7a1f7611aa
2 changed files with 6 additions and 4 deletions
|
@ -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<_>>()
|
||||||
|
|
|
@ -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()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue