diff --git a/src/import_data.jl b/src/import_data.jl index 62b0d01..8f30e16 100644 --- a/src/import_data.jl +++ b/src/import_data.jl @@ -182,29 +182,23 @@ function add_qaqc_single_result( ) """, ) + stmt_insert_resistance = DBInterface.prepare( + db, + sql""" + INSERT INTO qaqc_resistance_check(psb_id, passed) + VALUES (:psboard_id, :ispassed) + """, + ) for row in eachrow(single_result_table) if ismissing(row.runid) @assert contains("resistance")(row.comment) || contains("CN15")(row.comment) "Unexpected row with id $(row.motherboard_id) $(row.comment)" - # DBInterface.execute( - # stmt_insert_result, - # ( - # runid = row.runid, - # psboard_id = row.motherboard_id, - # daughterboard_id = row.daughterboard, - # position = nothing, - # resistance_test_passed = false, - # qspip = nothing, - # recov = nothing, - # power = nothing, - # clock = nothing, - # asdtp = nothing, - # reset = nothing, - # qaqc_result = nothing, - # ), - # ) - # TODO: maybe these should not be in this table... + DBInterface.execute( + stmt_insert_resistance, + (psboard_id = row.motherboard_id, ispassed = false), + ) + continue end @@ -255,6 +249,13 @@ function add_qaqc_single_result( ) end + # resistance + DBInterface.execute( + stmt_insert_resistance, + (psboard_id = row.motherboard_id, ispassed = true), + ) + + # main result DBInterface.execute( stmt_insert_result, ( diff --git a/src/sql/create_table.sql b/src/sql/create_table.sql index 9971e73..9eef386 100644 --- a/src/sql/create_table.sql +++ b/src/sql/create_table.sql @@ -49,7 +49,7 @@ CREATE TABLE qaqc_campaigns ( ); CREATE TABLE qaqc_resistance_check ( - id INTEGER NOT NULL PRIMARY KEY, + id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, psb_id INTEGER NOT NULL, passed BOOLEAN, FOREIGN KEY("psb_id") REFERENCES "ps_boards"("id")