Sync your own workout data from your "Strong" app
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

sync rpe again

tolik518 9d99c25a baba0a60

+20 -5
+4
strong-api-fetch/src/clickhouse_saver.rs
··· 26 26 pub set_nr: u32, 27 27 pub weight: f32, 28 28 pub reps: u32, 29 + pub rpe: f32, 29 30 } 30 31 31 32 pub struct ClickHouseSaver { ··· 94 95 set_nr, 95 96 weight: set.weight.unwrap_or(0.0), 96 97 reps: set.reps, 98 + rpe: set.rpe.unwrap_or(0.0), 97 99 }; 100 + // debug print set.rpe.unwrap_or(0.0) 101 + println!("Inserting row: {:?}", row); 98 102 99 103 insert.write(&row).await?; 100 104 }
+16 -5
strong-api-lib/src/data_transformer.rs
··· 8 8 pub id: String, 9 9 pub weight: Option<f32>, 10 10 pub reps: u32, 11 + pub rpe: Option<f32>, 11 12 } 12 13 13 14 #[derive(Debug)] ··· 162 163 .and_then(|s| s.parse::<u32>().ok()) 163 164 .unwrap_or(0); 164 165 165 - Some(Set { 166 - id: cell_set.id.clone(), 167 - weight, 168 - reps, 169 - }) 166 + let rpe = cell_set 167 + .cells 168 + .iter() 169 + .find(|cell| cell.cell_type == "RPE") 170 + .and_then(|cell| cell.value.as_ref()) 171 + .and_then(|s| s.parse::<f32>().ok()); 172 + 173 + Some( 174 + Set { 175 + id: cell_set.id.clone(), 176 + weight, 177 + reps, 178 + rpe, 179 + } 180 + ) 170 181 } 171 182 172 183 fn get_workout_id_from_link(links: &CellSetGroupLinks) -> String {