added logs to db function

This commit is contained in:
Andre Henriques 2023-05-22 21:19:14 +01:00
parent 520b8b4b5a
commit 4f208c8ec5

View File

@ -449,10 +449,15 @@ pub fn get_animation(name: &str, db: &State<DBPool>) -> Result<Option<Animation>
})? })?
.next(); .next();
println!("got here 1");
if next.is_none() { if next.is_none() {
return Ok(None); return Ok(None);
} }
println!("got here 2");
let mut animation = next.unwrap()?; let mut animation = next.unwrap()?;
struct KeyFrameId { struct KeyFrameId {
@ -463,6 +468,8 @@ pub fn get_animation(name: &str, db: &State<DBPool>) -> Result<Option<Animation>
let mut stmt = let mut stmt =
conn.prepare("SELECT id, duration from keyframe where animation=?1 order by i asc")?; conn.prepare("SELECT id, duration from keyframe where animation=?1 order by i asc")?;
println!("got here 3");
let mut map = stmt.query_map([animation.id], |row| { let mut map = stmt.query_map([animation.id], |row| {
Ok(KeyFrameId { Ok(KeyFrameId {
id: row.get(0)?, id: row.get(0)?,
@ -473,6 +480,9 @@ pub fn get_animation(name: &str, db: &State<DBPool>) -> Result<Option<Animation>
}) })
})?; })?;
println!("got here 4");
while let Some(key_frame_id) = map.next() { while let Some(key_frame_id) = map.next() {
let mut key_frame_id = key_frame_id?; let mut key_frame_id = key_frame_id?;
@ -494,9 +504,14 @@ pub fn get_animation(name: &str, db: &State<DBPool>) -> Result<Option<Animation>
key_frame_id.keyframe.settings.push(light_setting?); key_frame_id.keyframe.settings.push(light_setting?);
} }
println!("loop stuff");
animation.animation.key_frames.push(key_frame_id.keyframe); animation.animation.key_frames.push(key_frame_id.keyframe);
} }
println!("got here 6");
Ok(Some(animation.animation)) Ok(Some(animation.animation))
} }