Fix write into devices DB

This commit is contained in:
hodasemi 2023-10-03 08:22:21 +02:00
parent e0daec4c67
commit 95c2943c24

View file

@ -79,8 +79,8 @@ impl DataBase {
for (device, control) in devices.plugs.iter() {
self.sql.execute(
&format!(
"INSERT INTO devices (device, type)
SELECT \"{device}\", \"plug\"
"INSERT INTO devices (device, type, control)
SELECT \"{device}\", \"plug\", ?1
WHERE
NOT EXISTS (
SELECT device
@ -89,7 +89,7 @@ impl DataBase {
)
"
),
[],
&[control],
)?;
let ctl = if *control { 1 } else { 0 };