mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
ui: problemconfig: bug fix
This commit is contained in:
3 files changed
+8
-3
No files matched your search
@@ -25,7 +25,7 @@ export default function reducer(state = {
|
|||||||
return { ...state, __valid: false, __errors: validate.errors.map((i) => `${i.instancePath}: ${i.message}`) };
|
return { ...state, __valid: false, __errors: validate.errors.map((i) => `${i.instancePath}: ${i.message}`) };
|
||||||
}
|
}
|
||||||
const subtasks = (data as any).subtasks;
|
const subtasks = (data as any).subtasks;
|
||||||
for (const subtask of subtasks) {
|
for (const subtask of subtasks || []) {
|
||||||
if (typeof subtask.id !== 'number') {
|
if (typeof subtask.id !== 'number') {
|
||||||
for (let i = 1; ; i++) {
|
for (let i = 1; ; i++) {
|
||||||
if (!subtasks.find((s) => s.id === i)) {
|
if (!subtasks.find((s) => s.id === i)) {
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ export function SubtaskSettings(props: SubtaskSettingsProps) {
|
|||||||
<span className="bp4-tree-node-caret-none bp4-icon-standard"></span>
|
<span className="bp4-tree-node-caret-none bp4-icon-standard"></span>
|
||||||
<span className="bp4-tree-node-label">{i18n('Scoring method')}</span>
|
<span className="bp4-tree-node-label">{i18n('Scoring method')}</span>
|
||||||
<span className="bp4-tree-node-secondary-label">
|
<span className="bp4-tree-node-secondary-label">
|
||||||
<select value={ctype} onChange={(e) => setType(e.target.value)}>
|
<select className="compact select" value={ctype} onChange={(e) => setType(e.target.value)}>
|
||||||
<option value="min">Min</option>
|
<option value="min">Min</option>
|
||||||
<option value="max">Max</option>
|
<option value="max">Max</option>
|
||||||
<option value="sum">Sum</option>
|
<option value="sum">Sum</option>
|
||||||
|
|||||||
@@ -104,7 +104,12 @@ const page = new NamedPage('problem_config', () => {
|
|||||||
if (!state.config.__loaded) return;
|
if (!state.config.__loaded) return;
|
||||||
if (state.config.cases) {
|
if (state.config.cases) {
|
||||||
const score = state.config.score * state.config.cases.length;
|
const score = state.config.score * state.config.cases.length;
|
||||||
state.config.subtasks = [{ type: 'sum' as SubtaskType, score: score && score < 100 ? score : 100, cases: state.config.cases }];
|
state.config.subtasks = [{
|
||||||
|
type: 'sum' as SubtaskType,
|
||||||
|
score: score && score < 100 ? score : 100,
|
||||||
|
cases: state.config.cases,
|
||||||
|
id: 1,
|
||||||
|
}];
|
||||||
delete state.config.cases;
|
delete state.config.cases;
|
||||||
delete state.config.score;
|
delete state.config.score;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user