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
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:
parent
bb57d26eee
commit
5389e75aa5
5 changed files with 23 additions and 5 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
|
@ -2618,6 +2618,7 @@ dependencies = [
|
|||
name = "rnex-rk"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"rnex-rk-protos",
|
||||
"rnex-rmc",
|
||||
"rnex-server",
|
||||
|
|
|
|||
|
|
@ -59,11 +59,13 @@ pub struct CompetitionRankingScoreData {
|
|||
#[rmc_proto(112)]
|
||||
pub trait Ranking {
|
||||
#[method_id(16)]
|
||||
#[cfg(feature = "splatoon")]
|
||||
async fn competition_ranking_get_param(
|
||||
&self,
|
||||
param: CompetitionRankingGetParam,
|
||||
) -> Result<Vec<CompetitionRankingScoreInfo>, ErrorCode>;
|
||||
#[method_id(18)]
|
||||
#[cfg(feature = "splatoon")]
|
||||
async fn upload_competition_ranking_score(
|
||||
&self,
|
||||
param: UploadCompetitionData,
|
||||
|
|
|
|||
|
|
@ -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" }
|
||||
|
|
|
|||
|
|
@ -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> {
|
||||
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(),
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Reference in a new issue