Add team info to slow game page data

O01eg
May 9, 2023, 7:21 PM
YUFPADNOF6YVVG7HWMHSAZOQGQJKNWIACI3AS3756MKGZT3P75EQC

Dependencies

  • [2] 4WG6UYDE Fix pending delegations in game status
  • [3] JM67I53C Show players list for unregistered people
  • [4] 7QCJHYB6 Show contacts in personal page
  • [5] AEWYJHUD Start to show player list
  • [6] TEB4R7OU Add form to join game
  • [7] EKDGFVDQ Update game password from personal page
  • [8] GUAEZDLE Add turns info to slow game's page
  • [9] YDWTHWAI Show form to revoke delegation
  • [10] 6BDGQ4VM Show player names for registered players
  • [11] XTHO73VK Implement leave game
  • [12] LTQCLSBU Split database usage in pages
  • [13] H7NQUYI6 Record join to the game
  • [14] 6TPV5GQ3 Show delegates in player table
  • [15] SBYGGRXY Show pending delegates
  • [16] LPK5YJ2D Show slow game's status and notes
  • [17] A2LJT7TT Show duration in turns
  • [18] C6F7SJZI Add players count to slow game's page
  • [19] 6NYILMKI Add page for slow game
  • [20] LOFH5LIA Make bold player name
  • [21] XKG2L3QB Show label if player could join the game
  • [22] BVCWJKEX Get auth info for slow game page
  • [23] B7PYGLH3 Show delegate bold if it's logged user itself
  • [24] MCF5COUL Add personal page
  • [25] G3VK7RIB Add FreeOrion forum's URL to slow game's
  • [*] 5RQCVFRH Start leave game form
  • [*] EVP2FSBH Split index page
  • [*] FUCFD4UV Add log in and log out support
  • [*] 6CFNBL5L Add headers for better security

Change contents

  • replacement in src/pages/slow_game.rs at line 7
    [5.746][5.50:127]()
    use crate::pages::{insert_security_headers, request_to_jar, CommonAuthInfo};
    [5.746]
    [5.0]
    use crate::pages::{insert_security_headers, naive_to_text, request_to_jar, CommonAuthInfo};
  • edit in src/pages/slow_game.rs at line 20
    [5.207]
    [5.115]
    team_id: i32,
    create_ts: Option<String>,
  • edit in src/pages/slow_game.rs at line 62
    [27.350]
    [5.0]
    is_teamed: bool,
  • replacement in src/pages/slow_game.rs at line 114
    [5.1441][5.321:676]()
    let stmt = match dbclient.prepare("select g.status::text, g.notes_html, g.fo_forum_url, (select count(*) from games.players p where p.game_uid = g.game_uid and p.client_type = 'p'), MIN(t.turn_ts), MAX(t.turn_ts), COUNT(t.turn) from games.games g left join games.turns t on t.game_uid = g.game_uid where g.game_uid = $1 group by g.game_uid;").await {
    [5.1441]
    [5.1790]
    let stmt = match dbclient.prepare("select g.status::text, g.notes_html, g.fo_forum_url, g.is_teamed, (select count(*) from games.players p where p.game_uid = g.game_uid and p.client_type = 'p'), MIN(t.turn_ts), MAX(t.turn_ts), COUNT(t.turn) from games.games g left join games.turns t on t.game_uid = g.game_uid where g.game_uid = $1 group by g.game_uid;").await {
  • replacement in src/pages/slow_game.rs at line 144
    [5.902][5.902:954]()
    .get::<_, Option<chrono::NaiveDateTime>>(4)
    [5.902]
    [5.954]
    .get::<_, Option<chrono::NaiveDateTime>>(5)
  • replacement in src/pages/slow_game.rs at line 147
    [5.1025][5.1025:1077]()
    .get::<_, Option<chrono::NaiveDateTime>>(5)
    [5.1025]
    [5.1077]
    .get::<_, Option<chrono::NaiveDateTime>>(6)
  • replacement in src/pages/slow_game.rs at line 179
    [5.1435][5.1435:1636]()
    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 {
    [5.1435]
    [5.1636]
    let stmt = match dbclient.prepare("select p.player_name, p.team_id, p.create_ts, 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 {
  • replacement in src/pages/slow_game.rs at line 197
    [5.159][5.159:224](),[5.224][5.331:386](),[5.980][5.331:386](),[5.386][5.949:1031]()
    let delegate_name = row.get::<_, Option<String>>(1);
    let player_itself = row.get::<_, bool>(2);
    let delegate_itself = row.get::<_, Option<bool>>(3).unwrap_or(false);
    [5.159]
    [2.0]
    let team_id = row.get::<_, i32>(1);
    let create_ts = row
    .get::<_, Option<chrono::NaiveDateTime>>(2)
    .map(naive_to_text);
    let delegate_name = row.get::<_, Option<String>>(3);
    let player_itself = row.get::<_, bool>(4);
    let delegate_itself = row.get::<_, Option<bool>>(5).unwrap_or(false);
  • edit in src/pages/slow_game.rs at line 305
    [5.1697]
    [5.1697]
    team_id,
  • edit in src/pages/slow_game.rs at line 312
    [5.2390]
    [5.343]
    create_ts,
  • replacement in src/pages/slow_game.rs at line 340
    [3.33][3.33:175]()
    let stmt = match dbclient.prepare("select p.player_name from games.players p where p.game_uid = $1 and p.client_type = 'p';").await {
    [3.33]
    [3.175]
    let stmt = match dbclient.prepare("select p.player_name, p.team_id from games.players p where p.game_uid = $1 and p.client_type = 'p';").await {
  • edit in src/pages/slow_game.rs at line 358
    [3.837]
    [3.837]
    team_id: row.get::<_, i32>(1),
  • edit in src/pages/slow_game.rs at line 365
    [3.1080]
    [3.1080]
    create_ts: None,
  • replacement in src/pages/slow_game.rs at line 385
    [5.197][5.47:90]()
    players: row.get::<_, i64>(3),
    [5.197]
    [5.1124]
    is_teamed: row.get::<_, bool>(3),
    players: row.get::<_, i64>(4),
  • replacement in src/pages/slow_game.rs at line 389
    [5.1248][5.845:886](),[5.845][5.845:886]()
    turns: row.get::<_, i64>(6),
    [5.1248]
    [5.1007]
    turns: row.get::<_, i64>(7),
  • replacement in src/pages/my.rs at line 5
    [5.1092][5.1092:1169]()
    use crate::pages::{insert_security_headers, request_to_jar, CommonAuthInfo};
    [5.1092]
    [5.1169]
    use crate::pages::{insert_security_headers, naive_to_text, request_to_jar, CommonAuthInfo};
  • edit in src/pages/my.rs at line 32
    [4.779][4.779:960]()
    }
    fn naive_to_text(ts: chrono::NaiveDateTime) -> String {
    chrono::DateTime::<chrono::Utc>::from_utc(ts, chrono::Utc)
    .format("%Y %b %d %H:%M UTC")
    .to_string()
  • edit in src/pages/mod.rs at line 95
    [29.1941]
    [30.834]
    }
    pub fn naive_to_text(ts: chrono::NaiveDateTime) -> String {
    chrono::DateTime::<chrono::Utc>::from_utc(ts, chrono::Utc)
    .format("%Y %b %d %H:%M UTC")
    .to_string()