mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 09:36:08 +08:00
ui: problemconfig: patch autoconfigure
This commit is contained in:
5 files changed
+15
-4
No files matched your search
@@ -111,11 +111,16 @@ export function SubtaskConfigTree() {
|
||||
const store = useStore<RootState>();
|
||||
function autoConfigure() {
|
||||
const state = store.getState();
|
||||
const subtasks = readSubtasksFromFiles(state.testdata, state.config);
|
||||
const subtasks = readSubtasksFromFiles(state.testdata.map((t) => t.name), state.config);
|
||||
const cases = subtasks.reduce((a, b) => a.concat(b.cases), []);
|
||||
dispatch({
|
||||
type: 'CONFIG_AUTOCASES_UPDATE',
|
||||
subtasks: normalizeSubtasks(subtasks, (i) => i, state.config.time, state.config.memory, true),
|
||||
});
|
||||
dispatch({
|
||||
type: 'problemconfig/delTestcases',
|
||||
cases,
|
||||
});
|
||||
}
|
||||
return (
|
||||
<div className="bp4-tree">
|
||||
|
||||
@@ -161,6 +161,10 @@ export default function reducer(state = {
|
||||
}
|
||||
return { ...state, subtasks, __cases };
|
||||
}
|
||||
case 'problemconfig/delTestcases': {
|
||||
const testcases = action.cases;
|
||||
return { ...state, __cases: state.__cases.filter((i) => !testcases.find((j) => i.input === j.input && i.output === j.output)) };
|
||||
}
|
||||
case 'problemconfig/deleteSubtask': {
|
||||
const subtasks = state.subtasks.filter((i) => i.id !== action.id);
|
||||
return { ...state, subtasks };
|
||||
|
||||
@@ -124,6 +124,8 @@ export function SubtaskSettings(props: SubtaskSettingsProps) {
|
||||
<li className="bp4-tree-node">
|
||||
<div className="bp4-tree-node-content">
|
||||
<span className="bp4-tree-node-caret-none bp4-icon-standard"></span>
|
||||
<Icon icon="asterisk" />
|
||||
|
||||
<span className="bp4-tree-node-label">{i18n('Scoring method')}</span>
|
||||
<span className="bp4-tree-node-secondary-label">
|
||||
<select className="compact select" value={ctype} onChange={(e) => setType(e.target.value)}>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@hydrooj/ui-default",
|
||||
"version": "4.48.3",
|
||||
"version": "4.48.4",
|
||||
"author": "undefined <i@undefined.moe>",
|
||||
"license": "AGPL-3.0",
|
||||
"main": "index.ts",
|
||||
|
||||
@@ -248,7 +248,7 @@ const SubtaskMatcher: MatchRule[] = [
|
||||
(a) => (a[1].includes('input') ? `${a[1] + a[2]}.txt`.replace(/input/g, 'output') : null),
|
||||
],
|
||||
id: (a) => +a[2],
|
||||
subtask: () => 0,
|
||||
subtask: () => 1,
|
||||
preferredScorerType: 'sum',
|
||||
},
|
||||
{
|
||||
@@ -258,7 +258,7 @@ const SubtaskMatcher: MatchRule[] = [
|
||||
(a) => `${a[1]}.ou${a[2]}`.replace(/input/g, 'output'),
|
||||
],
|
||||
id: (a) => +a[2],
|
||||
subtask: () => 0,
|
||||
subtask: () => 1,
|
||||
preferredScorerType: 'sum',
|
||||
},
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user