mirror of
https://gitlab.cern.ch/wotsubo/PSBoardDataBase.git
synced 2025-06-11 07:19:23 +09:00
add: database view for single/extra results
This commit is contained in:
parent
21f38e83db
commit
4eafc8bdc6
2 changed files with 86 additions and 14 deletions
|
@ -362,11 +362,19 @@ function add_qaqc_runlist_from_masterlogs(db::SQLite.DB, logs_dir::AbstractStrin
|
|||
stmt_search_runid = DBInterface.prepare(
|
||||
db,
|
||||
sql"""
|
||||
SELECT id
|
||||
SELECT id, run_datetime
|
||||
FROM qaqc_runs
|
||||
WHERE id = :runid
|
||||
""",
|
||||
)
|
||||
stmt_update_runid = DBInterface.prepare(
|
||||
db,
|
||||
sql"""
|
||||
UPDATE qaqc_runs
|
||||
SET run_datetime = :run_datetime, shifter = :shifter, logfile = :logfile, shiftscript_ver = :shiftscript_ver
|
||||
WHERE id = :runid
|
||||
""",
|
||||
)
|
||||
stmt_insert_runid = DBInterface.prepare(
|
||||
db,
|
||||
sql"""
|
||||
|
@ -393,9 +401,24 @@ function add_qaqc_runlist_from_masterlogs(db::SQLite.DB, logs_dir::AbstractStrin
|
|||
if isnothing(run_metadata)
|
||||
continue
|
||||
end
|
||||
|
||||
if !isempty(DBInterface.execute(stmt_search_runid, (; runid = run_metadata.runid)))
|
||||
current_rundb =
|
||||
DBInterface.execute(stmt_search_runid, (; runid = run_metadata.runid)) |>
|
||||
DataFrame
|
||||
if !isempty(current_rundb.id)
|
||||
# runid is already in the database
|
||||
if any(ismissing, current_rundb.run_datetime)
|
||||
# add timestamp, logfile, ...etc
|
||||
DBInterface.execute(
|
||||
stmt_update_runid,
|
||||
(
|
||||
runid = run_metadata.runid,
|
||||
run_datetime = run_metadata.timestamp |> string,
|
||||
shifter = run_metadata.shifters,
|
||||
logfile = splitdir(longrun_log) |> last,
|
||||
shiftscript_ver = run_metadata.shiftscript_version,
|
||||
),
|
||||
)
|
||||
end
|
||||
continue
|
||||
end
|
||||
|
||||
|
@ -404,7 +427,7 @@ function add_qaqc_runlist_from_masterlogs(db::SQLite.DB, logs_dir::AbstractStrin
|
|||
(
|
||||
runid = run_metadata.runid,
|
||||
campaign_id = get_campaign_id_from_run_id(run_metadata.runid),
|
||||
run_datetime = run_metadata.timestamp,
|
||||
run_datetime = run_metadata.timestamp |> string,
|
||||
note = "",
|
||||
shifter = run_metadata.shifters,
|
||||
logfile = splitdir(longrun_log) |> last,
|
||||
|
@ -516,7 +539,10 @@ function add_qaqc_100test_result(db::SQLite.DB, table::DataFrame)
|
|||
if DBInterface.execute(stmt_search_runid, (; runid = row.runid)) |> isempty
|
||||
# search for resistance error
|
||||
if !isempty(
|
||||
DBInterface.execute(stmt_search_resistance_error, (; psboard_id = row.motherboard_id)),
|
||||
DBInterface.execute(
|
||||
stmt_search_resistance_error,
|
||||
(; psboard_id = row.motherboard_id),
|
||||
),
|
||||
)
|
||||
continue
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue