diff --git a/ibihf-macros/src/lib.rs b/ibihf-macros/src/lib.rs index d144236..8bca315 100644 --- a/ibihf-macros/src/lib.rs +++ b/ibihf-macros/src/lib.rs @@ -2,20 +2,20 @@ use darling::FromDeriveInput; use proc_macro::{self, TokenStream}; use proc_macro2::{Span, TokenStream as TokenStream2}; use quote::quote; -use syn::{parse_macro_input, DeriveInput, Data, Field, Attribute, Ident}; +use syn::{parse_macro_input, Attribute, Data, DeriveInput, Field, Ident}; fn matching_attr_map(attr: &Attribute, attr_name: &str) -> bool { - if let Ok(syn::Meta::List(meta_list)) = attr.parse_meta() { - return meta_list.path.is_ident("table_names") - && meta_list.nested.iter().any(|nested_meta| { - if let syn::NestedMeta::Meta(syn::Meta::Path(path)) = nested_meta { - path.is_ident(attr_name) - } else { - false - } - }); - } - false + if let Ok(syn::Meta::List(meta_list)) = attr.parse_meta() { + return meta_list.path.is_ident("table_names") + && meta_list.nested.iter().any(|nested_meta| { + if let syn::NestedMeta::Meta(syn::Meta::Path(path)) = nested_meta { + path.is_ident(attr_name) + } else { + false + } + }); + } + false } #[derive(FromDeriveInput, Default)] @@ -49,27 +49,31 @@ pub fn derive(input: TokenStream) -> TokenStream { #[derive(FromDeriveInput, Default)] #[darling(default, attributes(table_names))] struct TableNameOpts { - table_name: String, - name_func: String, - name_table_name: String, - name_table_name_fk: String, + table_name: String, + name_func: String, + name_table_name: String, + name_table_name_fk: String, } fn get_map_filter(field: &Field) -> Option { - let name = &field.ident.as_ref().unwrap(); - if field.attrs.iter().any(|attr| attr.path.is_ident("get")) { - Some(name.to_string()) - } else { - None - } + let name = &field.ident.as_ref().unwrap(); + if field.attrs.iter().any(|attr| attr.path.is_ident("get")) { + Some(name.to_string()) + } else { + None + } } fn get_many_map_filter(field: &Field) -> Option { - let name = &field.ident.as_ref().unwrap(); - if field.attrs.iter().any(|attr| matching_attr_map(attr, "get_many")) { - Some(name.to_string()) - } else { - None - } + let name = &field.ident.as_ref().unwrap(); + if field + .attrs + .iter() + .any(|attr| matching_attr_map(attr, "get_many")) + { + Some(name.to_string()) + } else { + None + } } #[proc_macro_derive(NameTableName, attributes(table_names))] @@ -82,7 +86,7 @@ pub fn derive_get(input: TokenStream) -> TokenStream { Data::Struct(ref data) => &data.fields, _ => panic!("MyDerive only supports structs"), }; - + let by_many_names: Vec = fields.iter().filter_map(get_many_map_filter).collect(); let by_many_funcs: Vec = by_many_names.iter() .map(|name| { @@ -108,7 +112,6 @@ WHERE {name} = $1; } }.into()) .collect(); - let table_name = opts.table_name; let name_table_name = opts.name_table_name; @@ -120,22 +123,22 @@ WHERE {name} = $1; const NAME_TABLE_FK_NAME: &'static str = #name_table_name_fk; }; - let get_query = format!(r#" + let get_query = format!( + r#" SELECT {0}.*, {1}({0}.id, $2) AS name FROM {0} WHERE {0}.id = $1;"#, - table_name, - name_func, + table_name, name_func, ); - let all_query = format!(r#" + let all_query = format!( + r#" SELECT {0}.*, {1}({0}.id, $1) AS name FROM {0}"#, - table_name, - name_func, + table_name, name_func, ); let output = quote! { impl NameTableName for #ident { diff --git a/src/filters.rs b/src/filters.rs index c175f86..87f8e58 100644 --- a/src/filters.rs +++ b/src/filters.rs @@ -4,12 +4,7 @@ // We must always take references, even when it's not technically the fastest thing to do. // This sometimes also causes a clippy warning. #![allow(clippy::trivially_copy_pass_by_ref)] -use crate::{ - Player, - ShotDetails, - GoalDetails, - SupportedLanguage, -}; +use crate::{GoalDetails, Player, ShotDetails, SupportedLanguage}; pub fn seconds_as_time(secs: &i32) -> ::askama::Result { let minutes = secs / 60; @@ -17,60 +12,81 @@ pub fn seconds_as_time(secs: &i32) -> ::askama::Result { Ok(format!("{minutes}:{seconds}")) } pub fn player_name(player: &Player) -> ::askama::Result { - Ok(format!("{} {}", initials(&player.first_names)?, &player.last_name)) + Ok(format!( + "{} {}", + initials(&player.first_names)?, + &player.last_name + )) } pub fn goal_player_name(goal: &GoalDetails) -> ::askama::Result { - Ok(format!("{} {}", initials(&goal.player_first_names)?, &goal.player_last_name)) + Ok(format!( + "{} {}", + initials(&goal.player_first_names)?, + &goal.player_last_name + )) } pub fn goal_assist_name(goal: &GoalDetails, lang: &SupportedLanguage) -> ::askama::Result { - let Some(ref f_names) = goal.second_assist_first_names else { + let Some(ref f_names) = goal.second_assist_first_names else { return Ok(lang.lookup("not-applicable")); }; - let Some(ref l_name) = goal.second_assist_last_name else { + let Some(ref l_name) = goal.second_assist_last_name else { return Ok(lang.lookup("not-applicable")); }; - Ok(format!("{f_names} {l_name}")) + Ok(format!("{f_names} {l_name}")) } pub fn shot_assist_name(goal: &ShotDetails, lang: &SupportedLanguage) -> ::askama::Result { - let Some(ref f_names) = goal.second_assist_first_names else { + let Some(ref f_names) = goal.second_assist_first_names else { return Ok(lang.lookup("not-applicable")); }; - let Some(ref l_name) = goal.second_assist_last_name else { + let Some(ref l_name) = goal.second_assist_last_name else { return Ok(lang.lookup("not-applicable")); }; - Ok(format!("{f_names} {l_name}")) + Ok(format!("{f_names} {l_name}")) } -pub fn goal_second_assist_name(goal: &GoalDetails, lang: &SupportedLanguage) -> ::askama::Result { - let Some(ref f_names) = goal.second_assist_first_names else { +pub fn goal_second_assist_name( + goal: &GoalDetails, + lang: &SupportedLanguage, +) -> ::askama::Result { + let Some(ref f_names) = goal.second_assist_first_names else { return Ok(lang.lookup("not-applicable")); }; - let Some(ref l_name) = goal.second_assist_last_name else { + let Some(ref l_name) = goal.second_assist_last_name else { return Ok(lang.lookup("not-applicable")); }; - Ok(format!("{f_names} {l_name}")) + Ok(format!("{f_names} {l_name}")) } -pub fn shot_second_assist_name(goal: &ShotDetails, lang: &SupportedLanguage) -> ::askama::Result { - let Some(ref f_names) = goal.second_assist_first_names else { +pub fn shot_second_assist_name( + goal: &ShotDetails, + lang: &SupportedLanguage, +) -> ::askama::Result { + let Some(ref f_names) = goal.second_assist_first_names else { return Ok(lang.lookup("not-applicable")); }; - let Some(ref l_name) = goal.second_assist_last_name else { + let Some(ref l_name) = goal.second_assist_last_name else { return Ok(lang.lookup("not-applicable")); }; - Ok(format!("{f_names} {l_name}")) + Ok(format!("{f_names} {l_name}")) } pub fn shot_player_name(shot: &ShotDetails) -> ::askama::Result { - Ok(format!("{} {}", initials(&shot.player_first_names)?, &shot.player_last_name)) + Ok(format!( + "{} {}", + initials(&shot.player_first_names)?, + &shot.player_last_name + )) } pub fn initials(first_names: &str) -> ::askama::Result { - Ok(format!("{}.", first_names - .split_whitespace() - .map(|name| &name[0..1]) - .collect::>() - .join("."))) + Ok(format!( + "{}.", + first_names + .split_whitespace() + .map(|name| &name[0..1]) + .collect::>() + .join(".") + )) } pub fn nullable(ot: &Option) -> ::askama::Result { - match ot { - Some(t) => Ok(format!("{t}")), - None => Ok("NULL".to_string()) - } + match ot { + Some(t) => Ok(format!("{t}")), + None => Ok("NULL".to_string()), + } } diff --git a/src/languages.rs b/src/languages.rs index 05cda4d..e638a6d 100644 --- a/src/languages.rs +++ b/src/languages.rs @@ -34,12 +34,12 @@ pub enum SupportedLanguage { French = 2, } impl From for i32 { - fn from(lang: SupportedLanguage) -> Self { - match lang { - SupportedLanguage::English => 1, - SupportedLanguage::French => 2, - } - } + fn from(lang: SupportedLanguage) -> Self { + match lang { + SupportedLanguage::English => 1, + SupportedLanguage::French => 2, + } + } } impl From for FluentValue<'_> { fn from(n: SupportedLanguage) -> Self { @@ -57,7 +57,7 @@ impl From for LanguageIdentifier { impl<'a> From for Locale<'a> { fn from(lang: SupportedLanguage) -> Self { Locale::new(lang.into(), &LOCALES) - } + } } impl SupportedLanguage { pub fn lookup(self, key: &str) -> String { @@ -75,12 +75,12 @@ impl SupportedLanguage { } .to_string() } - pub fn id(self) -> i32 { - match self { - Self::English => 1, - Self::French => 2, + pub fn id(self) -> i32 { + match self { + Self::English => 1, + Self::French => 2, + } } - } } #[derive(Debug, Serialize, Deserialize, Clone)] @@ -91,24 +91,28 @@ pub struct LangLink { #[derive(Debug, Serialize, Deserialize, Clone)] pub struct LocalizedName { - pub localizations: std::collections::HashMap, + pub localizations: std::collections::HashMap, } impl LocalizedName { - fn localize(&self, lang: SupportedLanguage) -> Option { - // first, try to find the proper match for a name - self.localizations - .iter() - .find_map(|(translated_lang, string)| if translated_lang == &lang { - Some(string.to_string()) - } else { - None - }) - // if not found, replace it with ANY localization of the word; this will help when, for example, there is no matching name for a French game, but the game has already been created with the English name. - // if NO localization is found, then we can still return a None value; but hopefully through database, form, and web server restrictions, we can mostly stop that from happening - .or_else(|| if self.localizations.is_empty() { - Some(self.localizations.values().next().unwrap().to_string()) - } else { - None - }) - } + fn localize(&self, lang: SupportedLanguage) -> Option { + // first, try to find the proper match for a name + self.localizations + .iter() + .find_map(|(translated_lang, string)| { + if translated_lang == &lang { + Some(string.to_string()) + } else { + None + } + }) + // if not found, replace it with ANY localization of the word; this will help when, for example, there is no matching name for a French game, but the game has already been created with the English name. + // if NO localization is found, then we can still return a None value; but hopefully through database, form, and web server restrictions, we can mostly stop that from happening + .or_else(|| { + if self.localizations.is_empty() { + Some(self.localizations.values().next().unwrap().to_string()) + } else { + None + } + }) + } } diff --git a/src/main.rs b/src/main.rs index dc57417..3063675 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,8 +1,4 @@ -#![warn( - clippy::all, - clippy::pedantic, - unsafe_code, -)] +#![warn(clippy::all, clippy::pedantic, unsafe_code)] mod db; mod filters; @@ -310,7 +306,9 @@ async fn league_html( State(server_config): State, Path(lang): Path, ) -> impl IntoResponse { - let leagues = League::all(&server_config.db_pool, lang.into()).await.unwrap(); + let leagues = League::all(&server_config.db_pool, lang.into()) + .await + .unwrap(); let leagues_template = LeagueListTemplate { lang_links: other_lang_urls!(lang, LeagueListTemplate), locale: lang.into(), @@ -353,7 +351,10 @@ async fn games_for_division_html( let games = Game::by_division(&server_config.db_pool, division.id, lang.into()) .await .unwrap(); - let iihf_stats = division.iihf_stats(&server_config.db_pool, lang.into()).await.unwrap(); + let iihf_stats = division + .iihf_stats(&server_config.db_pool, lang.into()) + .await + .unwrap(); let games_template = GameListTemplate { locale: lang.into(), lang_links: other_lang_urls!(lang, GameListTemplate, "id" => division_id), @@ -373,13 +374,20 @@ async fn score_for_game_html( ) -> impl IntoResponse { let game = Game::get(&server_config.db_pool, game_id, lang.into()) .await - .unwrap().unwrap(); + .unwrap() + .unwrap(); let division = Division::get(&server_config.db_pool, game.division, lang.into()) .await .unwrap() .unwrap(); - let pbp = game.play_by_play(&server_config.db_pool, lang.into()).await.unwrap(); - let score = game.score(&server_config.db_pool, lang.into()).await.unwrap(); + let pbp = game + .play_by_play(&server_config.db_pool, lang.into()) + .await + .unwrap(); + let score = game + .score(&server_config.db_pool, lang.into()) + .await + .unwrap(); let score_html = TeamGameStatsTemplate { locale: lang.into(), teams: score, @@ -389,7 +397,10 @@ async fn score_for_game_html( locale: lang.into(), players: goal_details, }; - let box_score = game.goals(&server_config.db_pool, lang.into()).await.unwrap(); + let box_score = game + .goals(&server_config.db_pool, lang.into()) + .await + .unwrap(); let box_score_html = BoxScoreTemplate { locale: lang.into(), goals: box_score, @@ -398,7 +409,7 @@ async fn score_for_game_html( let pbp_html = ShotsTableTemplate { locale: lang.into(), shots: pbp, - lang + lang, }; let game_template = GameScorePageTemplate { locale: lang.into(), diff --git a/src/model.rs b/src/model.rs index c907ef0..3621d49 100644 --- a/src/model.rs +++ b/src/model.rs @@ -21,7 +21,12 @@ pub struct Language { } #[derive(FromRow, Serialize, Deserialize, Debug, NameTableName)] -#[table_names(table_name = "leagues", name_func = "league_name", name_table_name = "league_names", name_table_name_fk = "league")] +#[table_names( + table_name = "leagues", + name_func = "league_name", + name_table_name = "league_names", + name_table_name_fk = "league" +)] pub struct League { //#[ormx(default)] pub id: i32, @@ -38,7 +43,12 @@ pub struct NewLeague { */ #[derive(FromRow, Serialize, Deserialize, Debug, NameTableName)] -#[table_names(table_name = "divisions", name_func = "division_name", name_table_name = "division_names", name_table_name_fk = "division")] +#[table_names( + table_name = "divisions", + name_func = "division_name", + name_table_name = "division_names", + name_table_name_fk = "division" +)] pub struct Division { //#[ormx(default)] pub id: i32, @@ -58,7 +68,12 @@ pub struct NewDivision { #[derive(FromRow, Serialize, Deserialize, Debug, NameTableName)] //#[ormx(table = "teams", id = id, insertable, deletable)] -#[table_names(table_name = "teams", name_func = "team_name", name_table_name = "team_names", name_table_name_fk = "team")] +#[table_names( + table_name = "teams", + name_func = "team_name", + name_table_name = "team_names", + name_table_name_fk = "team" +)] pub struct Team { //#[ormx(default)] pub id: i32, @@ -140,7 +155,12 @@ pub struct GamePlayer { } #[derive(FromRow, Deserialize, Serialize, Debug, NameTableName)] -#[table_names(table_name = "games", name_func = "game_name", name_table_name = "game_names", name_table_name_fk = "game")] +#[table_names( + table_name = "games", + name_func = "game_name", + name_table_name = "game_names", + name_table_name_fk = "game" +)] pub struct Game { //#[ormx(default)] pub id: i32, @@ -225,7 +245,9 @@ mod tests { fn $func_name() { tokio_test::block_on(async move { let pool = db_connect().await; - let results = $ret_type::all(&pool, SupportedLanguage::English.into()).await.unwrap(); + let results = $ret_type::all(&pool, SupportedLanguage::English.into()) + .await + .unwrap(); assert!( results.len() > 0, "There must be at least one result in the table." @@ -235,7 +257,7 @@ mod tests { }; } //generate_select_test!(GamePlayer, selec_game_player); - // generate_select_test!(Player, select_player); + // generate_select_test!(Player, select_player); generate_select_test!(League, select_league); generate_select_test!(Division, select_division); generate_select_test!(Team, select_team); diff --git a/src/views.rs b/src/views.rs index 9d6fa30..9cc0bf3 100644 --- a/src/views.rs +++ b/src/views.rs @@ -45,8 +45,8 @@ impl From for IihfStatsI64 { ot_losses: val.ot_losses.into(), ties: val.ties.into(), points: val.points.into(), - } - } + } + } } #[derive(FromRow, Deserialize, Serialize, Debug)] @@ -107,7 +107,11 @@ ORDER BY .fetch_all(pool) .await } -pub async fn game_goals(pool: &PgPool, game_id: i32, lang: i32) -> Result, sqlx::Error> { +pub async fn game_goals( + pool: &PgPool, + game_id: i32, + lang: i32, +) -> Result, sqlx::Error> { sqlx::query_as::<_, GoalDetails>( r#" SELECT @@ -151,7 +155,11 @@ pub async fn game_goals(pool: &PgPool, game_id: i32, lang: i32) -> Result Result, sqlx::Error> { +pub async fn game_iihf_stats( + pool: &PgPool, + game_id: i32, + lang: i32, +) -> Result, sqlx::Error> { let query = r#" SELECT teams.id AS team_id, @@ -184,7 +192,11 @@ pub async fn game_iihf_stats(pool: &PgPool, game_id: i32, lang: i32) -> Result Result, sqlx::Error> { +pub async fn game_iihf_points( + pool: &PgPool, + game_id: i32, + lang: i32, +) -> Result, sqlx::Error> { let query = r#" SELECT iihf_points(games.id, teams.id) AS points, @@ -204,7 +216,11 @@ pub async fn game_iihf_points(pool: &PgPool, game_id: i32, lang: i32) -> Result< .await } /// Returns the number of shots and goals for each team in the game. -pub async fn game_score(pool: &PgPool, game_id: i32, lang: i32) -> Result, sqlx::Error> { +pub async fn game_score( + pool: &PgPool, + game_id: i32, + lang: i32, +) -> Result, sqlx::Error> { let query = r#" SELECT COUNT(CASE WHEN shots.goal = true THEN shots.id END) AS goals, @@ -279,16 +295,28 @@ impl Game { pub async fn box_score(&self, pool: &PgPool) -> Result, sqlx::Error> { game_box_score(pool, self.id).await } - pub async fn iihf_points(&self, pool: &PgPool, lang: i32) -> Result, sqlx::Error> { + pub async fn iihf_points( + &self, + pool: &PgPool, + lang: i32, + ) -> Result, sqlx::Error> { game_iihf_points(pool, self.id, lang).await } - pub async fn iihf_stats(&self, pool: &PgPool, lang: i32) -> Result, sqlx::Error> { + pub async fn iihf_stats( + &self, + pool: &PgPool, + lang: i32, + ) -> Result, sqlx::Error> { game_iihf_stats(pool, self.id, lang).await } pub async fn goals(&self, pool: &PgPool, lang: i32) -> Result, sqlx::Error> { game_goals(pool, self.id, lang).await } - pub async fn play_by_play(&self, pool: &PgPool, lang: i32) -> Result, sqlx::Error> { + pub async fn play_by_play( + &self, + pool: &PgPool, + lang: i32, + ) -> Result, sqlx::Error> { game_play_by_play(pool, self.id, lang).await } } @@ -396,13 +424,21 @@ GROUP BY team_id; } impl Division { - pub async fn iihf_stats(&self, pool: &PgPool, lang: i32) -> Result, sqlx::Error> { + pub async fn iihf_stats( + &self, + pool: &PgPool, + lang: i32, + ) -> Result, sqlx::Error> { division_iihf_stats(pool, self.id, lang).await } } impl Player { - pub async fn latest_league(pool: &PgPool, id: i32, lang: i32) -> Result, sqlx::Error> { + pub async fn latest_league( + pool: &PgPool, + id: i32, + lang: i32, + ) -> Result, sqlx::Error> { let query = r#" SELECT leagues.*,team_name(teams.id, $2) AS name FROM players @@ -421,7 +457,11 @@ impl Player { .fetch_optional(pool) .await } - pub async fn latest_stats(pool: &PgPool, id: i32, lang: i32) -> Result, sqlx::Error> { + pub async fn latest_stats( + pool: &PgPool, + id: i32, + lang: i32, + ) -> Result, sqlx::Error> { let query = r#" SELECT players.id AS player_id, @@ -622,7 +662,9 @@ mod tests { fn check_play_by_play() { tokio_test::block_on(async move { let pool = db_connect().await; - let pbp = game_play_by_play(&pool, 3, SupportedLanguage::English.into()).await.unwrap(); + let pbp = game_play_by_play(&pool, 3, SupportedLanguage::English.into()) + .await + .unwrap(); }) } @@ -631,7 +673,9 @@ mod tests { tokio_test::block_on(async move { let pool = db_connect().await; let player = Player::get(&pool, 2).await.unwrap(); - let latest = Player::latest_stats(&pool, player.id, SupportedLanguage::English.into()).await.unwrap(); + let latest = Player::latest_stats(&pool, player.id, SupportedLanguage::English.into()) + .await + .unwrap(); }) } @@ -639,7 +683,10 @@ mod tests { fn check_league_player_stats() { tokio_test::block_on(async move { let pool = db_connect().await; - let league = League::get(&pool, 1, SupportedLanguage::English.into()).await.unwrap().unwrap(); + let league = League::get(&pool, 1, SupportedLanguage::English.into()) + .await + .unwrap() + .unwrap(); let player = Player::get(&pool, 2).await.unwrap(); let stats = League::player_stats(&pool, player.id, league.id) .await @@ -665,7 +712,9 @@ mod tests { fn check_score_details_from_game() { tokio_test::block_on(async move { let pool = db_connect().await; - let scores = game_goals(&pool, 3, SupportedLanguage::English.into()).await.unwrap(); + let scores = game_goals(&pool, 3, SupportedLanguage::English.into()) + .await + .unwrap(); println!("{scores:?}"); }) } @@ -696,16 +745,32 @@ mod tests { fn check_division_iihf_stats() { tokio_test::block_on(async move { let pool = db_connect().await; - let score = division_iihf_stats(&pool, 1, SupportedLanguage::English.into()).await.unwrap(); + let score = division_iihf_stats(&pool, 1, SupportedLanguage::English.into()) + .await + .unwrap(); let team_1 = score.get(0).unwrap(); let team_2 = score.get(1).unwrap(); assert_eq!(score.len(), 2, "Too many teams selected."); assert_eq!(team_1.points, 10, "Top team should have 10 points"); - assert_eq!(team_1.team_name.as_ref().unwrap(), "Bullseye", "Top team should be bullseye"); - assert_eq!(team_1.reg_losses, 0, "The bullseye should have no regulation losses"); + assert_eq!( + team_1.team_name.as_ref().unwrap(), + "Bullseye", + "Top team should be bullseye" + ); + assert_eq!( + team_1.reg_losses, 0, + "The bullseye should have no regulation losses" + ); assert_eq!(team_1.ties, 2, "There should be two ties for the bullsye"); - assert_eq!(team_2.team_name.as_ref().unwrap(), "See Cats", "The second-place team should be the see cats"); - assert_eq!(team_2.points, 4, "The second-place team should have four points"); + assert_eq!( + team_2.team_name.as_ref().unwrap(), + "See Cats", + "The second-place team should be the see cats" + ); + assert_eq!( + team_2.points, 4, + "The second-place team should have four points" + ); }) } @@ -713,7 +778,9 @@ mod tests { fn check_iihf_stats() { tokio_test::block_on(async move { let pool = db_connect().await; - let score = game_iihf_stats(&pool, 4, SupportedLanguage::English.into()).await.unwrap(); + let score = game_iihf_stats(&pool, 4, SupportedLanguage::English.into()) + .await + .unwrap(); let team_1 = score.get(0).unwrap(); assert_eq!(team_1.points, 2); assert_eq!(team_1.team_name.as_ref().unwrap(), "Bullseye"); @@ -727,7 +794,9 @@ mod tests { fn check_iihf_points() { tokio_test::block_on(async move { let pool = db_connect().await; - let score = game_iihf_points(&pool, 4, SupportedLanguage::English.into()).await.unwrap(); + let score = game_iihf_points(&pool, 4, SupportedLanguage::English.into()) + .await + .unwrap(); assert_eq!(score.get(0).unwrap().points, 2); assert_eq!(score.get(0).unwrap().team_name, "Bullseye"); assert_eq!(score.get(1).unwrap().points, 2); @@ -738,7 +807,9 @@ mod tests { fn check_game_score() { tokio_test::block_on(async move { let pool = db_connect().await; - let score = game_score(&pool, 1, SupportedLanguage::English.into()).await.unwrap(); + let score = game_score(&pool, 1, SupportedLanguage::English.into()) + .await + .unwrap(); assert_eq!(score.get(0).unwrap().goals, 1); assert_eq!(score.get(1).unwrap().goals, 1); })