Skip to content

Commit

Permalink
Making sure that tests in result tables are displayed ordered by thei…
Browse files Browse the repository at this point in the history
…r names.
  • Loading branch information
Martin Krulis committed Apr 22, 2019
1 parent a1cc331 commit 88fc8a7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
20 changes: 13 additions & 7 deletions src/components/Solutions/TestResults/TestResults.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
import React from 'react';
import PropTypes from 'prop-types';
import { FormattedMessage } from 'react-intl';
import { FormattedMessage, intlShape, injectIntl } from 'react-intl';
import Box from '../../widgets/Box';
import TestResultsTable from '../TestResultsTable';
import { defaultMemoize } from 'reselect';

const TestResults = ({ evaluation, runtimeEnvironmentId, showJudgeLog }) => (
const getSortedTestResults = defaultMemoize(({ testResults }, locale) =>
testResults.sort((a, b) => a.testName.localeCompare(b.testName, locale))
);

const TestResults = ({ evaluation, runtimeEnvironmentId, showJudgeLog, intl: { locale } }) => (
<Box
title={<FormattedMessage id="app.submission.evaluation.title.testResults" defaultMessage="Test Results" />}
noPadding={true}
collapsable={true}
isOpen={true}
noPadding
collapsable
isOpen
unlimitedHeight>
<TestResultsTable
results={evaluation.testResults}
results={getSortedTestResults(evaluation, locale)}
runtimeEnvironmentId={runtimeEnvironmentId}
showJudgeLog={showJudgeLog}
/>
Expand All @@ -23,6 +28,7 @@ TestResults.propTypes = {
evaluation: PropTypes.object.isRequired,
runtimeEnvironmentId: PropTypes.string,
showJudgeLog: PropTypes.bool,
intl: intlShape.isRequired,
};

export default TestResults;
export default injectIntl(TestResults);
4 changes: 2 additions & 2 deletions src/components/Solutions/TestResultsTable/TestResultsTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const tickOrCrossAndRatioOrValue = (isOK, ratio, value, pretty, multiplier) => (
</span>
);

const showTimeResults = (key, wallTime, wallTimeRatio, wallTimeExceeded, cpuTime, cpuTimeRatio, cpuTimeExceeded) => {
const showTimeResults = (wallTime, wallTimeRatio, wallTimeExceeded, cpuTime, cpuTimeRatio, cpuTimeExceeded) => {
const showWall = Boolean(wallTimeRatio) || (wallTimeExceeded && !cpuTimeExceeded);
const showCpu = Boolean(cpuTimeRatio) || cpuTimeExceeded || !showWall;
return (
Expand Down Expand Up @@ -164,7 +164,7 @@ class TestResultsTable extends Component {
{tickOrCrossAndRatioOrValue(memoryExceeded === false, memoryRatio, memory, prettyPrintBytes, 1024)}
</td>
<td className="text-center">
{showTimeResults(testName, wallTime, wallTimeRatio, wallTimeExceeded, cpuTime, cpuTimeRatio, cpuTimeExceeded)}
{showTimeResults(wallTime, wallTimeRatio, wallTimeExceeded, cpuTime, cpuTimeRatio, cpuTimeExceeded)}
</td>

<td className="text-center">{exitCodeMapping(runtimeEnvironmentId, exitCode)}</td>
Expand Down

0 comments on commit 88fc8a7

Please sign in to comment.