core: buildContent: sv for samples
core&ui: record_main: filter_by_status
ui: scoreboard: colorize
This commit is contained in:
undefined committed 2021-05-05 21:10:17 +08:00
1 parent b0cf638616
commit 7d7d3c1599
14 files changed
+69 -38

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "hydrooj",
"version": "2.24.11",
"version": "2.24.12",
"bin": "bin/hydrooj.js",
"main": "dist/loader.js",
"typings": "dist/loader.d.ts",
+3 -1
View File
@@ -19,8 +19,9 @@ class RecordListHandler extends Handler {
@param('pid', Types.Name, true)
@param('tid', Types.ObjectID, true)
@param('uidOrName', Types.Name, true)
@param('status', Types.Int, true)
@param('allDomain', Types.Boolean, true)
async get(domainId: string, page = 1, pid?: string, tid?: ObjectID, uidOrName?: string, all = false) {
async get(domainId: string, page = 1, pid?: string, tid?: ObjectID, uidOrName?: string, status?: number, all = false) {
this.response.template = 'record_main.html';
const q: FilterQuery<Rdoc> = { 'contest.tid': tid, hidden: false };
if (tid) {
@@ -42,6 +43,7 @@ class RecordListHandler extends Handler {
if (pdoc) q.pid = pdoc.docId;
else q.pid = null;
}
if (status) q.status = status;
const [rdocs] = await paginate(
record.getMulti(domainId, q).sort('_id', -1),
page,
+6 -5
View File
@@ -11,6 +11,7 @@ export interface ProblemSource {
export function buildContent(source: ProblemSource | ContentNode[], type: 'markdown' | 'html' = 'markdown', translate?: Function) {
const _ = translate || ((s: string) => s);
let cnt = 0;
if (source instanceof Array) {
return type === 'html'
? source.map((node) => [
@@ -25,11 +26,11 @@ export function buildContent(source: ProblemSource | ContentNode[], type: 'markd
...node.type === 'Sample'
? [
`## ${_('Sample Input')}`,
'```',
`\`\`\`input${++cnt}`,
node.payload[0],
'```',
`## ${_('Sample Output')}`,
'```',
`\`\`\`output${cnt}`,
node.payload[1],
'```',
]
@@ -43,11 +44,11 @@ export function buildContent(source: ProblemSource | ContentNode[], type: 'markd
...source.input ? [`<h2>${_('Input Format')}</h2>`, source.input] : [],
...source.output ? [`<h2>${_('Output Format')}</h2>`, source.output] : [],
...(source.samples).map((sample, i) => [
`<h2>${_('Sample Input')} ${i + 1}</h2><pre>`,
`<pre><code class="language-input${i + 1}">`,
sample[0],
`</pre><h2>${_('Sample Output')} ${i + 1}</h2><pre>`,
`</code></pre><pre><code class="language-output${i + 1}">`,
sample[1],
'</pre>',
'</code></pre>',
].join('\n')),
...source.hint ? [`<h2>${_('Hint')}</h2>`, source.hint] : [],
...source.source ? [`<h2>${_('Source')}</h2>`, source.source] : [],
+11 -1
View File
@@ -462,7 +462,13 @@ export const CATEGORIES = {
'Hashing',
'函数式编程',
],
博弈论: [],
博弈论: [
'巴什博弈',
'尼姆博弈',
'威佐夫博弈',
'斐波那契博弈',
'SG定理',
],
字符串: [
'KMP',
'后缀数据结构',
@@ -506,6 +512,10 @@ export const CATEGORIES = {
'数学',
'排序',
'构造',
'打表',
'位运算',
'离散化',
'莫队',
],
};