mirror of
https://gitlab.com/wgp/dougal/software.git
synced 2025-12-06 09:47:08 +00:00
Adapt QC endpoints to new configuration APIs
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
const fs = require('fs');
|
||||
const YAML = require('yaml');
|
||||
const flattenQCDefinitions = require('../../../utils/flattenQCDefinitions');
|
||||
const configuration = require('../../configuration'); // lib/db/configuration
|
||||
const project = require('../../project'); // lib/db/project
|
||||
|
||||
|
||||
async function get (projectId, opts = {}) {
|
||||
const qcConfig = await configuration.get(projectId, "qc");
|
||||
const qcConfig = (await project.configuration.get(projectId))?.qc;
|
||||
if (qcConfig?.definitions) {
|
||||
try {
|
||||
const definitions = YAML.parse(fs.readFileSync(qcConfig.definitions).toString());
|
||||
|
||||
@@ -42,7 +42,7 @@ function forceQC (projectId, sequenceNumber) {
|
||||
|
||||
async function getProjectQCConfig (projectId) {
|
||||
console.log("getProjectQCConfig");
|
||||
const qcConfig = await configuration.get(projectId, "qc");
|
||||
const qcConfig = (await project.configuration.get(projectId))?.qc;
|
||||
console.log("qcConfig", qcConfig);
|
||||
if (qcConfig?.definitions && qcConfig?.parameters) {
|
||||
const definitions =
|
||||
@@ -57,11 +57,11 @@ async function main () {
|
||||
// Fetch list of projects
|
||||
console.log("GET PROJECTS");
|
||||
const projects = await project.get();
|
||||
console.log("PROJECTS", projects);
|
||||
|
||||
for (const proj of projects) {
|
||||
const projectId = proj.pid;
|
||||
for (const {pid} of projects) {
|
||||
const projectId = pid;
|
||||
console.log("PROJECT ID", projectId);
|
||||
const proj = await project.configuration.get(projectId);
|
||||
|
||||
if (!proj.archived) {
|
||||
const QCTstamp = new Date();
|
||||
@@ -75,7 +75,7 @@ async function main () {
|
||||
console.log("currentQCHash != lastQCHash", projectId, currentQCHash, lastQCHash);
|
||||
|
||||
// Fetch definitions and parameters
|
||||
const { definitions, parameters } = await getProjectQCConfig(projectId) ?? {};
|
||||
const { definitions, parameters } = await getProjectQCConfig(projectId, proj.qc) ?? {};
|
||||
|
||||
if (definitions && parameters) {
|
||||
console.log("PROJECT ID", projectId);
|
||||
|
||||
Reference in New Issue
Block a user