Skip to content

Commit

Permalink
convert marne region to bf1 region
Browse files Browse the repository at this point in the history
  • Loading branch information
zefanjajobse committed Feb 17, 2024
1 parent bdd2209 commit 6dc4636
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/gatherer/marne.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@ async fn server_list_to_sum(
("ZoneControl0", "Rush"),
]);

let marne_regions =
HashMap::from([("AS", "Asia"), ("SA", "sam"), ("NA", "nam"), ("AF", "afr")]);

let mut all_regions: results::RegionResult = results::RegionResult {
metadata: results::Metadata {
region: "ALL".to_string(),
Expand Down Expand Up @@ -165,6 +168,10 @@ async fn server_list_to_sum(
let mut server_stats: HashMap<String, Vec<server_info::ServerInfo>> = HashMap::new();

for server in found_servers {
let server_region = marne_regions
.get(&server.region[..])
.unwrap_or(&&server.region[..])
.to_string();
let mode = modes
.get(&server.game_mode[..])
.unwrap_or(&&server.game_mode[..])
Expand All @@ -175,7 +182,7 @@ async fn server_list_to_sum(
.to_string();

regions
.entry(server.region.clone())
.entry(server_region.clone())
.and_modify(|region| {
region.amounts.server_amount += 1;
region.amounts.soldier_amount += server.current_players;
Expand Down Expand Up @@ -203,7 +210,7 @@ async fn server_list_to_sum(
.or_insert({
results::RegionResult {
metadata: results::Metadata {
region: server.region.clone(),
region: server_region.clone(),
platform: "pc".to_string(),
},
amounts: results::RegionAmounts {
Expand Down Expand Up @@ -268,7 +275,7 @@ async fn server_list_to_sum(
is_official: None,
};
server_stats
.entry(server.region)
.entry(server_region)
.and_modify(|region_info| region_info.push(current_server_info.clone()))
.or_insert_with(|| vec![current_server_info]);
}
Expand Down

0 comments on commit 6dc4636

Please sign in to comment.