diff --git a/src/models/database.rs b/src/models/database.rs index 9ef1877..d8774c6 100644 --- a/src/models/database.rs +++ b/src/models/database.rs @@ -190,15 +190,17 @@ impl Database { users .iter() // u64 must be converted to String for templates - .filter_map(|id| -> Option> { + .map(|id| -> Result<(String, User)> { match conn.prepare("SELECT name, discriminator, avatar FROM User WHERE id = ?1") { - Ok(mut statement) => Some(statement.query_row(params![id], |row| Ok((id.to_string(), User { - id: *id, - name: row.get(0)?, - discriminator: row.get(1)?, - avatar: row.get(2)?, - }))).map_err(DatabaseError::Rusqlite)), - Err(error) => Some(Err(DatabaseError::Rusqlite(error))), + Ok(mut statement) => statement.query_row(params![id], |row| { + Ok((id.to_string(), User { + id: *id, + name: row.get(0)?, + discriminator: row.get(1)?, + avatar: row.get(2)?, + })) + }).map_err(|error| DatabaseError::Rusqlite(error)), + Err(error) => Err(DatabaseError::Rusqlite(error)), } }) .collect()