mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 17:36:08 +08:00
core: fix pid sort
This commit is contained in:
1 parent
19ebf5e9a8
commit
65094e53b6
3 files changed
+5
-2
No files matched your search
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "hydrooj",
|
||||
"version": "2.13.53",
|
||||
"version": "2.13.54",
|
||||
"bin": "bin/hydrooj.js",
|
||||
"main": "dist/loader.js",
|
||||
"typings": "dist/loader.d.ts",
|
||||
|
||||
@@ -82,7 +82,6 @@ export async function add(
|
||||
tag: string[] = [], category: string[] = [], data: ProblemDataSource = null, hidden = false,
|
||||
) {
|
||||
const pidCounter = await domain.inc(domainId, 'pidCounter', 1);
|
||||
if (!pid) pid = pidCounter.toString();
|
||||
return await document.add(
|
||||
domainId, content, owner, document.TYPE_PROBLEM, pidCounter, null, null,
|
||||
{
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/* eslint-disable no-await-in-loop */
|
||||
import * as domain from './model/domain';
|
||||
import * as document from './model/document';
|
||||
import { db } from './service/db';
|
||||
|
||||
type UpgradeScript = () => Promise<void>;
|
||||
|
||||
@@ -29,6 +30,9 @@ const scripts: UpgradeScript[] = [
|
||||
if (bulk.length) await bulk.execute();
|
||||
}
|
||||
},
|
||||
async function _2_3() {
|
||||
await db.collection('document').updateMany({ pid: /^\d+$/i }, { $unset: { pid: '' } });
|
||||
},
|
||||
];
|
||||
|
||||
export = scripts;
|
||||
Reference in new issue
Block a user