fix: was incorrectly getting roles/id's from null

This commit is contained in:
silver 2023-09-28 17:54:12 +01:00
parent 6a0b664e7d
commit 70690f712e

View file

@ -136,7 +136,11 @@ impl<'r> FromRow<'r, SqliteRow> for ServerMembersWolves {
let discord = match row.try_get("discord") { let discord = match row.try_get("discord") {
Ok(x) => { Ok(x) => {
let tmp: i64 = x; let tmp: i64 = x;
Some(UserId::from(tmp as u64)) if tmp == 0 {
None
} else {
Some(UserId::from(tmp as u64))
}
} }
_ => None, _ => None,
}; };
@ -164,7 +168,11 @@ impl<'r> FromRow<'r, SqliteRow> for Wolves {
let discord = match row.try_get("discord") { let discord = match row.try_get("discord") {
Ok(x) => { Ok(x) => {
let tmp: i64 = x; let tmp: i64 = x;
Some(UserId::from(tmp as u64)) if tmp == 0 {
None
} else {
Some(UserId::from(tmp as u64))
}
} }
_ => None, _ => None,
}; };
@ -215,14 +223,22 @@ impl<'r> FromRow<'r, SqliteRow> for Servers {
let role_past = match row.try_get("role_past") { let role_past = match row.try_get("role_past") {
Ok(x) => { Ok(x) => {
let tmp: i64 = x; let tmp: i64 = x;
Some(RoleId::from(tmp as u64)) if tmp == 0 {
None
} else {
Some(RoleId::from(tmp as u64))
}
} }
_ => None, _ => None,
}; };
let role_current = match row.try_get("role_current") { let role_current = match row.try_get("role_current") {
Ok(x) => { Ok(x) => {
let tmp: i64 = x; let tmp: i64 = x;
Some(RoleId::from(tmp as u64)) if tmp == 0 {
None
} else {
Some(RoleId::from(tmp as u64))
}
} }
_ => None, _ => None,
}; };