Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
franciscoBSalgueiro committed Mar 1, 2024
2 parents ea889a6 + b73247d commit 41ea97b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 13 deletions.
10 changes: 6 additions & 4 deletions src-tauri/src/chess.rs
Original file line number Diff line number Diff line change
Expand Up @@ -879,10 +879,12 @@ pub async fn get_engine_config(path: PathBuf) -> Result<EngineConfig, Error> {

loop {
if let Some(line) = stdout.next_line().await? {
if let UciMessage::Id { name, author: _ } = parse_one(&line) {
if let Some(name) = name {
config.name = name;
}
if let UciMessage::Id {
name: Some(name),
author: _,
} = parse_one(&line)
{
config.name = name;
}
if let UciMessage::Option(opt) = parse_one(&line) {
config.options.push(opt);
Expand Down
12 changes: 5 additions & 7 deletions src-tauri/src/db/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ use specta::Type;
use std::io::{BufWriter, Write};
use std::{
fs::{remove_file, File, OpenOptions},
path::{Path, PathBuf},
path::PathBuf,
sync::atomic::{AtomicI32, AtomicUsize, Ordering},
time::{Duration, Instant},
};
Expand Down Expand Up @@ -1140,7 +1140,7 @@ pub async fn get_players_game_info(
};
if outcome.as_deref() == Some("1-0") {
openings
.entry(opening.to_string())
.entry(opening)
.and_modify(|e: &mut Results| {
if is_white {
e.won += 1;
Expand All @@ -1155,7 +1155,7 @@ pub async fn get_players_game_info(
});
} else if outcome.as_deref() == Some("0-1") {
openings
.entry(opening.to_string())
.entry(opening)
.and_modify(|e| {
if is_white {
e.lost += 1;
Expand All @@ -1170,7 +1170,7 @@ pub async fn get_players_game_info(
});
} else if outcome.as_deref() == Some("1/2-1/2") {
openings
.entry(opening.to_string())
.entry(opening)
.and_modify(|e| {
e.draw += 1;
})
Expand All @@ -1193,9 +1193,7 @@ pub async fn get_players_game_info(
let month = date.format("%Y-%m").to_string();

// update count and avg elo
let mut month_data = data_per_month
.entry(month.clone())
.or_insert(MonthData::default());
let mut month_data = data_per_month.entry(month).or_insert(MonthData::default());
month_data.count += 1;
let elo = if is_white { white_elo } else { black_elo };
if let Some(elo) = elo {
Expand Down
3 changes: 1 addition & 2 deletions src-tauri/src/oauth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ impl Default for AuthState {
fn default() -> Self {
let (pkce_code_challenge, pkce_code_verifier) = PkceCodeChallenge::new_random_sha256();
let socket_addr = get_available_addr();
let redirect_url = format!("http://{socket_addr}/callback").to_string();
let redirect_url = format!("http://{socket_addr}/callback");
AuthState {
csrf_token: CsrfToken::new_random(),
pkce: Arc::new((
Expand Down Expand Up @@ -75,7 +75,6 @@ pub async fn authenticate(
Ok(())
}


#[derive(Deserialize)]
struct CallbackQuery {
code: AuthorizationCode,
Expand Down

0 comments on commit 41ea97b

Please sign in to comment.