core: sort home page training with pin (#398)

This commit is contained in:
panda authored and GitHub committed 2022-08-05 18:25:36 +08:00
1 parent 662ad7cd45
commit 8648929063
2 files changed
+2 -2

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "hydrooj",
"version": "3.15.4",
"version": "3.15.5",
"bin": "bin/hydrooj.js",
"main": "src/loader",
"module": "src/loader",
+1 -1
View File
@@ -65,7 +65,7 @@ export class HomeHandler extends Handler {
async getTraining(domainId: string, limit = 10) {
if (this.user.hasPerm(PERM.PERM_VIEW_TRAINING)) {
const tdocs = await training.getMulti(domainId)
.sort('_id', 1).limit(limit).toArray();
.sort({ pin: -1, _id: 1 }).limit(limit).toArray();
const tsdict = await training.getListStatus(
domainId, this.user._id, tdocs.map((tdoc) => tdoc.docId),
);