\n | export async function addTestdata(domainId: string, pid: number, name: string, f: Readable | Buffer | string) { | \n
\n | const [[, fileinfo]] = await Promise.all([ | \n
\n | document.getSub(domainId, document.TYPE_PROBLEM, pid, 'data', name), | \n
\n | storage.put(`problem/${domainId}/${pid}/testdata/${name}`, f), | \n
\n | ]); | \n
\n | const meta = await storage.getMeta(`problem/${domainId}/${pid}/testdata/${name}`); | \n
\n | const payload = { name, ...pick(meta, ['size', 'lastModified', 'etag']) }; | \n
\n | if (!fileinfo) await push(domainId, pid, 'data', { _id: name, ...payload }); | \n
\n | else await document.setSub(domainId, document.TYPE_PROBLEM, pid, 'data', name, payload); | \n
\n | } | \n
Solved it! Just made a function that only gets and sets the metadata.
\nasync function setTestdata(domainId, pid, name) {\n const [[, fileinfo]] = await Promise.all([\n document.getSub(domainId, document.TYPE_PROBLEM, pid, 'data', name),\n ]);\n const meta = await storage_1.default.getMetaCli(`problem/${domainId}/${pid}/testdata/${name}`);\n const payload = { name, ...lodash_1.pick(meta, ['size', 'lastModified', 'etag']) };\n await push(domainId, pid, 'data', { _id: name, ...payload });\n}\nexports.setTestdata = setTestdata;
Like this.
","upvoteCount":1,"url":"https://GitHub.com/hydro-dev/Hydro/discussions/52#discussioncomment-367574"}}}-
I have some TCs with no etags. I would like to fix it though cli because there are plenty of them. Where does hydro make the infos of TCs? Plz help me. Hydro/packages/hydrooj/src/model/problem.ts Lines 151 to 160 in 3553c2c |
Beta Was this translation helpful? Give feedback.
-
Solved it! Just made a function that only gets and sets the metadata. async function setTestdata(domainId, pid, name) {
const [[, fileinfo]] = await Promise.all([
document.getSub(domainId, document.TYPE_PROBLEM, pid, 'data', name),
]);
const meta = await storage_1.default.getMetaCli(`problem/${domainId}/${pid}/testdata/${name}`);
const payload = { name, ...lodash_1.pick(meta, ['size', 'lastModified', 'etag']) };
await push(domainId, pid, 'data', { _id: name, ...payload });
}
exports.setTestdata = setTestdata; Like this. |
Beta Was this translation helpful? Give feedback.
Solved it! Just made a function that only gets and sets the metadata.
Like this.