mirror of
https://github.com/natsukagami/youmubot.git
synced 2025-04-16 07:18:54 +00:00
Merge branch 'fix-cf-rollback' of natsukagami/youmubot into master
This commit is contained in:
commit
550db3a16c
1 changed files with 12 additions and 9 deletions
|
@ -46,11 +46,7 @@ fn update_user(
|
|||
.next()
|
||||
.ok_or(CommandError::from("Not found"))?;
|
||||
|
||||
let rating_changes = {
|
||||
let mut v = info.rating_changes(reqwest)?;
|
||||
v.reverse();
|
||||
v
|
||||
};
|
||||
let rating_changes = info.rating_changes(reqwest)?;
|
||||
|
||||
let mut channels_list: Option<Vec<ChannelId>> = None;
|
||||
cfu.last_update = Utc::now();
|
||||
|
@ -86,10 +82,17 @@ fn update_user(
|
|||
|
||||
let rating_changes = match cfu.last_contest_id {
|
||||
None => rating_changes,
|
||||
Some(v) => rating_changes
|
||||
Some(v) => {
|
||||
let mut v: Vec<_> = rating_changes
|
||||
.into_iter()
|
||||
.take_while(|rc| rc.contest_id != v)
|
||||
.collect(),
|
||||
// Skip instead of take because sometimes Codeforces
|
||||
// performs rollback.
|
||||
.skip_while(|rc| rc.contest_id != v)
|
||||
.skip(1)
|
||||
.collect();
|
||||
v.reverse();
|
||||
v
|
||||
}
|
||||
};
|
||||
|
||||
cfu.last_contest_id = rating_changes
|
||||
|
|
Loading…
Add table
Reference in a new issue