Skip to content

Commit

Permalink
Fix for compilation error on codeforces
Browse files Browse the repository at this point in the history
  • Loading branch information
EgorKulikov committed Dec 1, 2024
1 parent dacd86e commit 8a88a14
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions src/codeforces.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,20 +154,29 @@ pub async fn submit(
}

async fn iteration(driver: &WebDriver, last_verdict: &mut String) -> WebDriverResult<bool> {
let mut stdout = std::io::stdout();
let cell = driver.find(By::ClassName("status-cell")).await?;
let verdict = cell.find(By::Tag("span")).await?;
let verdict_text = verdict.text().await?;
let is_waiting = verdict.class_name().await? == Some("verdict-waiting".to_string());
let is_accepted = verdict.class_name().await? == Some("verdict-accepted".to_string());
let verdict = verdict_text;
let verdict = cell.text().await?;
let (is_waiting, is_accepted) = match cell.find(By::Tag("span")).await {
Ok(verdict) => (
verdict.class_name().await? == Some("verdict-waiting".to_string()),
verdict.class_name().await? == Some("verdict-accepted".to_string()),
),
Err(_) => {
if verdict.trim() == "Compilation error" {
(false, false)
} else {
(true, false)
}
}
};
clear(last_verdict.len());
if verdict == *last_verdict && is_waiting {
tokio::time::sleep(std::time::Duration::from_secs(2)).await;
driver.refresh().await?;
skip_cloudflare(driver).await?;
return Ok(false);
}
let mut stdout = std::io::stdout();
let _ = execute!(
stdout,
SetForegroundColor(if is_waiting {
Expand Down

0 comments on commit 8a88a14

Please sign in to comment.