fix(ranking): Separate Splatoon specific methods
All checks were successful
Build and Test / sonic-transformed (push) Successful in 3m17s
Build and Test / super-mario-maker (push) Successful in 3m21s
Build and Test / wii-u-chat (push) Successful in 4m31s
Build and Test / minecraft-wiiu (push) Successful in 4m39s
Build and Test / splatoon (push) Successful in 5m28s
Build and Test / fast-racing-neo (push) Successful in 6m5s
Build and Test / splatoon-testfire (push) Successful in 6m6s
Build and Test / mario-tennis (push) Successful in 6m7s
Build and Test / terraria (push) Successful in 6m13s
Build and Test / friends (push) Successful in 6m15s
Build and Test / puyopuyo (push) Successful in 6m23s
Build and Test / wii-sports-club (push) Successful in 6m24s

This commit is contained in:
BloxerHD 2026-08-08 20:26:35 +01:00
commit 5389e75aa5
Signed by: bloxerhd018
SSH key fingerprint: SHA256:ItSfcfhpXlfkMK3uQSDYW5X3XKm0hbHWQqWcCK57px8
5 changed files with 23 additions and 5 deletions

View file

@ -22,6 +22,7 @@ datastore = ["database-support", "v3-8-15"]
database-support = []
[dependencies]
cfg-if = "1.0.4"
rnex-rmc = { path = "../../rnex-rmc" }
rnex-util = { path = "../../rnex-util" }
rnex-rk-protos = { path = "../../rnex-protocols/rk-protos" }

View file

@ -1,6 +1,7 @@
use rnex_rmc::response::ErrorCode;
use rnex_server::{ConnectionInitData, EnvVarError, RnexManager, RnexModule, env_var};
use std::str::FromStr;
use cfg_if::cfg_if;
use tracing::error;
use crate::user::RankingUser;
@ -18,6 +19,7 @@ pub struct RankingModule;
impl RankingManager {
// Seperate function because I cannot give a fuck right now
#[cfg(feature = "splatoon")]
async fn fetch_team_votes(&self, fest_id: u32) -> Result<Vec<u32>, ErrorCode> {
let url_votes = format!("{}?splatfest_id={}", self.rnex_result_votes_get, fest_id);
let Ok(response) = tokio::task::spawn_blocking(move || {
@ -76,10 +78,20 @@ impl RnexModule for RankingModule {
async fn create_manager(
_: &rnex_server::ModuleHolder,
) -> Result<Self::Manager, Self::InitError> {
Ok(RankingManager {
rnex_result_votes_get: env_var("RNEX_SPLATOON_RESULTS_VOTES_GET")?,
rnex_result_post: env_var("RNEX_SPLATOON_RESULTS_POST")?,
rnex_result_get: env_var("RNEX_SPLATOON_RESULTS_GET")?,
})
cfg_if!{
if #[cfg(feature = "splatoon")] {
Ok(RankingManager {
rnex_result_votes_get: env_var("RNEX_SPLATOON_RESULTS_VOTES_GET")?,
rnex_result_post: env_var("RNEX_SPLATOON_RESULTS_POST")?,
rnex_result_get: env_var("RNEX_SPLATOON_RESULTS_GET")?,
})
} else {
Ok(RankingManager {
rnex_result_get: "".into(),
rnex_result_post: "".into(),
rnex_result_votes_get: "".into(),
})
}
}
}
}

View file

@ -30,6 +30,7 @@ pub struct CompetitionPostResults {
}
impl Ranking for RankingUser {
#[cfg(feature = "splatoon")]
async fn competition_ranking_get_param(
&self,
param: CompetitionRankingGetParam,
@ -93,6 +94,7 @@ impl Ranking for RankingUser {
Ok(vec![info])
}
#[cfg(feature = "splatoon")]
async fn upload_competition_ranking_score(
&self,
param: UploadCompetitionData,