diff --git a/src/components/Solutions/TestResultsTable/TestResultsTableRow.js b/src/components/Solutions/TestResultsTable/TestResultsTableRow.js index 0e92f9cd9..0e8b72d8d 100644 --- a/src/components/Solutions/TestResultsTable/TestResultsTableRow.js +++ b/src/components/Solutions/TestResultsTable/TestResultsTableRow.js @@ -11,30 +11,40 @@ import { prettyPrintBytes } from '../../helpers/stringFormatters.js'; import exitCodeMapping from '../../helpers/exitCodeMapping.js'; import Icon, { SuccessOrFailureIcon } from '../../icons'; -const hasValue = value => value !== null; - const tickOrCrossAndRatioOrValue = (isOK, ratio, value, pretty, multiplier) => ( 0.9, })}> - {hasValue(value) && '('} - {(ratio || ratio === 0) && ( - + {Boolean(ratio) && ( + <> + {value !== null && '('} + + {value !== null && ') '} + )} - {hasValue(value) && ') '} - {hasValue(value) && pretty(value * multiplier)} + {value !== null && pretty(value * multiplier)} ); -const showTimeResults = (wallTime, wallTimeRatio, wallTimeExceeded, cpuTime, cpuTimeRatio, cpuTimeExceeded) => { - const showWall = Boolean(wallTimeRatio) || (wallTimeExceeded && !cpuTimeExceeded); - const showCpu = Boolean(cpuTimeRatio) || cpuTimeExceeded || !showWall; +const showTimeResults = ( + wallTime, + wallTimeRatio, + wallTimeExceeded, + cpuTime, + cpuTimeRatio, + cpuTimeExceeded, + wallTimeLimit, + cpuTimeLimit +) => { + const showCpu = cpuTimeLimit > 0; // || cpuTimeExceeded || !showWall; + const showWall = wallTimeLimit > 0 || (wallTimeExceeded && cpuTimeRatio < 1); return ( @@ -76,7 +86,13 @@ const showTimeResults = (wallTime, wallTimeRatio, wallTimeExceeded, cpuTime, cpu /> )} @@ -103,6 +119,8 @@ const TestResultsTableRow = ({ memory, wallTime, cpuTime, + wallTimeLimit, + cpuTimeLimit, exitCode, exitCodeOk, exitCodeNative, @@ -137,12 +155,22 @@ const TestResultsTableRow = ({ )} {status === 'SKIPPED' && ( - + )} {status === 'FAILED' && ( - + {memoryExceeded ? ( + + ) : wallTimeExceeded || cpuTimeExceeded ? ( + + ) : exitSignal ? ( + + ) : !exitCodeOk ? ( + + ) : ( + + )} )} @@ -152,7 +180,16 @@ const TestResultsTableRow = ({ {tickOrCrossAndRatioOrValue(memoryExceeded === false, memoryRatio, memory, prettyPrintBytes, 1024)}
- {tickOrCrossAndRatioOrValue(wallTimeExceeded === false, wallTimeRatio, wallTime, prettyMs, 1000)} + {tickOrCrossAndRatioOrValue( + wallTimeExceeded === false, + wallTimeLimit > 0 ? wallTimeRatio : undefined, + wallTime, + prettyMs, + 1000 + )}
- {showTimeResults(wallTime, wallTimeRatio, wallTimeExceeded, cpuTime, cpuTimeRatio, cpuTimeExceeded)} + {showTimeResults( + wallTime, + wallTimeRatio, + wallTimeExceeded, + cpuTime, + cpuTimeRatio, + cpuTimeExceeded, + wallTimeLimit, + cpuTimeLimit + )} @@ -257,7 +294,9 @@ TestResultsTableRow.propTypes = { cpuTimeRatio: PropTypes.number, memory: PropTypes.number, wallTime: PropTypes.number, + wallTimeLimit: PropTypes.number, cpuTime: PropTypes.number, + cpuTimeLimit: PropTypes.number, exitCode: PropTypes.number, exitCodeOk: PropTypes.bool, exitCodeNative: PropTypes.bool, diff --git a/src/locales/cs.json b/src/locales/cs.json index c5a9bd7ee..71e137c12 100644 --- a/src/locales/cs.json +++ b/src/locales/cs.json @@ -2019,9 +2019,13 @@ "app.submissions.testResultsTable.showLog": "Ukázat log", "app.submissions.testResultsTable.showLogInModal": "Ukázat v okně", "app.submissions.testResultsTable.signalTooltip": "Process byl ukončen signálem", + "app.submissions.testResultsTable.statusExitCode": "Běh. chyba", "app.submissions.testResultsTable.statusFailed": "Chyba", + "app.submissions.testResultsTable.statusMemoryExceeded": "Paměť", "app.submissions.testResultsTable.statusOK": "OK", + "app.submissions.testResultsTable.statusSignal": "Signál", "app.submissions.testResultsTable.statusSkipped": "Přeskočeno", + "app.submissions.testResultsTable.statusTimeExceeded": "Čas", "app.submissions.testResultsTable.timeExceeded": "Naměřený čas spuštění", "app.submissions.testResultsTable.wallTimeExplain": "Reálný čas (tzv. 'wall-time' měřený systémovými hodinami)", "app.submitButton.invalid": "Nějaký vstup není validní", @@ -2200,4 +2204,4 @@ "recodex-judge-shuffle-all": "Sudí neuspořádaných tokenů a řádků", "recodex-judge-shuffle-newline": "Sudí neuspořádaných tokenů (ignorující konce řádků)", "recodex-judge-shuffle-rows": "Sudí neuspořádaných řádků" -} \ No newline at end of file +} diff --git a/src/locales/en.json b/src/locales/en.json index 4fcd87a4a..099e6181d 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -2019,9 +2019,13 @@ "app.submissions.testResultsTable.showLog": "Show log", "app.submissions.testResultsTable.showLogInModal": "Show in window", "app.submissions.testResultsTable.signalTooltip": "Process terminated by signal", - "app.submissions.testResultsTable.statusFailed": "FAILED", + "app.submissions.testResultsTable.statusExitCode": "Run. Error", + "app.submissions.testResultsTable.statusFailed": "Failed", + "app.submissions.testResultsTable.statusMemoryExceeded": "OOM", "app.submissions.testResultsTable.statusOK": "OK", - "app.submissions.testResultsTable.statusSkipped": "SKIPPED", + "app.submissions.testResultsTable.statusSignal": "Signal", + "app.submissions.testResultsTable.statusSkipped": "Skipped", + "app.submissions.testResultsTable.statusTimeExceeded": "Timeout", "app.submissions.testResultsTable.timeExceeded": "Measured execution time", "app.submissions.testResultsTable.wallTimeExplain": "Wall time (real-time measured by external clock)", "app.submitButton.invalid": "Some input is invalid.", @@ -2200,4 +2204,4 @@ "recodex-judge-shuffle-all": "Unordered-tokens-and-rows judge", "recodex-judge-shuffle-newline": "Unordered-tokens judge (ignoring ends of lines)", "recodex-judge-shuffle-rows": "Unordered-rows judge" -} \ No newline at end of file +}