mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 09:36:08 +08:00
core: fic category selection
This commit is contained in:
1 parent
69c6a34c34
commit
fdcf06c373
2 files changed
+3
-3
No files matched your search
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "hydrooj",
|
||||
"version": "3.13.3",
|
||||
"version": "3.13.4",
|
||||
"bin": "bin/hydrooj.js",
|
||||
"main": "src/loader",
|
||||
"module": "src/loader",
|
||||
|
||||
@@ -149,7 +149,7 @@ export class ProblemMainHandler extends ProblemHandler {
|
||||
let pcountRelation = 'eq';
|
||||
const category = flattenDeep(decodeURIComponent(q).split(' ')
|
||||
.filter((i) => i.startsWith('category:'))
|
||||
.map((i) => i.split(':')[1]?.split(',')));
|
||||
.map((i) => i.split('category:')[1]?.split(',')));
|
||||
const text = q.split(' ').filter((i) => !i.startsWith('category:')).join(' ');
|
||||
if (category.length) query.$and = category.map((tag) => ({ tag }));
|
||||
if (text) category.push(text);
|
||||
@@ -288,7 +288,7 @@ export class ProblemRandomHandler extends ProblemHandler {
|
||||
async get(domainId: string, qs = '') {
|
||||
const category = flattenDeep(decodeURIComponent(qs).split(' ')
|
||||
.filter((i) => i.startsWith('category:'))
|
||||
.map((i) => i.split(':')[1]?.split(',')));
|
||||
.map((i) => i.split('category:')[1]?.split(',')));
|
||||
console.log(qs, category);
|
||||
const q = buildQuery(this.user);
|
||||
if (category.length) q.$and = category.map((tag) => ({ tag }));
|
||||
|
||||
Reference in new issue
Block a user