B:BD[
6.429] → [
3.747:948]
B:BD[
8.432] → [
8.432:602]
let stmt = match dbclient.prepare("select p.player_name, p.delegate_name, p.player_name = $2, p.delegate_name = $2 from games.players p where p.game_uid = $1 and p.client_type = 'p';").await {
Ok(stmt) => stmt,
Err(e) => {
log::error!("{}", e);
return HttpResponse::ServiceUnavailable().body(actix_web::body::None::new());
let stmt = match dbclient.prepare("select q.player_name, q.player_name = $2, q.delegate_name, q.delegate_name = $2 from games.query_delegation q where (q.player_name = $2 or q.delegate_name = $2) and q.game_uid = $1;").await {
Ok(stmt) => stmt,
Err(e) => {
log::error!("{}", e);
return HttpResponse::ServiceUnavailable().body(actix_web::body::None::new());
}
};
let rows = match dbclient.query(&stmt, &[&gameuid, user]).await {
Ok(rows) => rows,
Err(e) => {
log::error!("{}", e);
return HttpResponse::ServiceUnavailable().body(actix_web::body::None::new());
}
};
// player_name is user
let mut delegations_from = std::collections::HashSet::new();
// delegate_name is user
let mut delegations_to = std::collections::HashSet::new();
for row in rows {
if row.get::<_, bool>(1) {
delegations_from.insert(row.get::<_, String>(2));
} else if row.get::<_, bool>(3) {
delegations_to.insert(row.get::<_, &str>(0).to_lowercase());
}