Merge pull request 'Fix: Separate Splatoon specific Ranking Methods' (#65) from fix/separate-splatoon-ranking into v0
All checks were successful
Build and Test / wii-u-chat (push) Successful in 3m47s
Build and Test / fast-racing-neo (push) Successful in 4m0s
Build and Test / super-mario-maker (push) Successful in 4m25s
Build and Test / splatoon-testfire (push) Successful in 4m27s
Build and Test / minecraft-wiiu (push) Successful in 5m15s
Build and Test / splatoon (push) Successful in 5m20s
Build and Test / sonic-transformed (push) Successful in 5m22s
Build and Test / mario-tennis (push) Successful in 5m24s
Build and Test / terraria (push) Successful in 5m22s
Build and Test / wii-sports-club (push) Successful in 5m28s
Build and Test / puyopuyo (push) Successful in 5m35s
Build and Test / friends (push) Successful in 5m55s
All checks were successful
Build and Test / wii-u-chat (push) Successful in 3m47s
Build and Test / fast-racing-neo (push) Successful in 4m0s
Build and Test / super-mario-maker (push) Successful in 4m25s
Build and Test / splatoon-testfire (push) Successful in 4m27s
Build and Test / minecraft-wiiu (push) Successful in 5m15s
Build and Test / splatoon (push) Successful in 5m20s
Build and Test / sonic-transformed (push) Successful in 5m22s
Build and Test / mario-tennis (push) Successful in 5m24s
Build and Test / terraria (push) Successful in 5m22s
Build and Test / wii-sports-club (push) Successful in 5m28s
Build and Test / puyopuyo (push) Successful in 5m35s
Build and Test / friends (push) Successful in 5m55s
Reviewed-on: #65 Reviewed-by: redbinder0526 <redbinder0526@proton.me>
This commit is contained in:
commit
f4d983aa3a
6 changed files with 25 additions and 5 deletions
|
|
@ -32,6 +32,8 @@ jobs:
|
|||
db_secret: DATABASE_SMM
|
||||
- edition: terraria
|
||||
|
||||
name: ${{ matrix.edition }}
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v7
|
||||
|
|
|
|||
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