Skip to content

Commit

Permalink
5.2.0 server
Browse files Browse the repository at this point in the history
  • Loading branch information
JayAgra committed Apr 2, 2024
1 parent 9d52788 commit c346b56
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 5 deletions.
6 changes: 3 additions & 3 deletions .example.env
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FRC_API_KEY=""
MY_TEAM=766
HOSTNAME=localhost
TEAMS=766
EVENTS=CAFR,CABE
SEASONS=2023,2024
TEAMS=766,199,840,841,2288,2367,2489,4141,4904,4973,6711,7245,8404,9143
EVENTS=CASJ,CASF,CADA,CAFR,IDBO,CABE
SEASONS=2024
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "bear_tracks"
version = "5.1.3"
version = "5.2.0"
edition = "2021"
authors = ["Jayen Agrawal"]
description = "a scouting app for frc"
Expand Down
9 changes: 8 additions & 1 deletion src/analyze.rs
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,14 @@ fn season_2024(data: &web::Json<db_main::MainInsert>) -> Result<AnalysisResults,
fast_cycle = 0.0;
}

let mps_scores: Vec<f64> = vec![score, fast_intake, fast_travel, fast_shoot, fast_cycle, analysis_results[0]];
let mps_scores: Vec<f64> = vec![
score,
fast_intake,
fast_travel,
fast_shoot,
fast_cycle,
analysis_results[0]
];

let analysis: Vec<i64> = vec![
real_bool_to_num(trap_note) as i64,
Expand Down
10 changes: 10 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,12 @@ async fn data_get_main_teams(path: web::Path<String>, db: web::Data<Databases>)
.json(db_main::execute(&db.main, db_main::MainData::GetTeams, path).await?))
}

async fn data_get_scouted_teams(req: HttpRequest, db: web::Data<Databases>) -> Result<HttpResponse, AWError> {
Ok(HttpResponse::Ok()
.insert_header(("Cache-Control", "no-cache"))
.json(db_main::get_team_numbers(&db.main, req.match_info().get("season").unwrap().parse().unwrap()).await?))
}

// get POSTed data from form
async fn data_post_submit(data: web::Json<db_main::MainInsert>, db: web::Data<Databases>, user: db_auth::User) -> Result<HttpResponse, AWError> {
Ok(HttpResponse::Ok()
Expand Down Expand Up @@ -870,6 +876,10 @@ async fn main() -> io::Result<()> {
.service(
web::resource("/api/v1/data/teams/{args}*")
.route(web::get().to(data_get_main_teams)),
)
.service(
web::resource("/api/v1/data/scouted_teams/{season}")
.route(web::get().to(data_get_scouted_teams)),
) // season/event
.service(
web::resource("/api/v1/events/teams/{season}/{event}")
Expand Down

0 comments on commit c346b56

Please sign in to comment.