Skip to content

Commit

Permalink
Improving visualization of solution points computation (rounding and …
Browse files Browse the repository at this point in the history
…epsilon).
  • Loading branch information
krulis-martin committed Jan 20, 2022
1 parent 8832a2a commit 94130b3
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ const EvaluationDetail = ({
'text-success': isCorrect,
})}>
<b>
<FormattedNumber style="percent" value={evaluation.score} />
<FormattedNumber style="percent" maximumFractionDigits={3} value={evaluation.score} />
</b>
{showScoreDetail && (
<span className="float-right clickable text-primary mx-2" onClick={showScoreDetail}>
Expand Down
17 changes: 15 additions & 2 deletions src/components/Solutions/SolutionStatus/SolutionStatus.js
Original file line number Diff line number Diff line change
Expand Up @@ -421,8 +421,21 @@ class SolutionStatus extends Component {
</p>
<p className="larger text-center">
<code>
floor({maxPoints} &times; <FormattedNumber style="percent" value={evaluation.score} />) ={' '}
<strong>{actualPoints}</strong>
floor({maxPoints} &times;{' '}
<FormattedNumber style="percent" maximumFractionDigits={3} value={evaluation.score} />
<OverlayTrigger
placement="bottom"
overlay={
<Tooltip id="pointsComputationEpsilon">
<FormattedMessage
id="app.solution.pointsExplainDialog.epsilonExplain"
defaultMessage="The epsilon (1e-6) is added to compensate for rounding errors."
/>
</Tooltip>
}>
<span>{' + '}&epsilon;</span>
</OverlayTrigger>
) = <strong>{actualPoints}</strong>
</code>
</p>
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const ScoreConfigInfoWeighted = ({ scoreConfig, testResults }) => {
.map(test => ({ test, weight: weightsObj[test] }));
const weightsSum = weights.reduce((acc, { weight }) => acc + weight, 0);
const testsSum = results && weights.reduce((acc, { test, weight }) => acc + weight * results[test], 0);
const totalScore = weightsSum !== 0 ? Math.round((testsSum * 1000) / weightsSum) / 1000 : '?';
const totalScore = weightsSum !== 0 ? Math.round((testsSum * 100000) / weightsSum) / 100000 : '?';

return (
<div>
Expand Down
3 changes: 1 addition & 2 deletions src/locales/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -1251,8 +1251,6 @@
"app.pipelinesList.judgeOnlyIconTooltip": "Pipeline pouze se sudím",
"app.pipelinesList.stdoutIconTooltip": "Testované řešení by mělo vypsat svoje výsledky na standardní výstup",
"app.pipelinesList.universalPipelineIconTooltip": "Univerzální pipeline, která se používá v konfiguracích běžných úloh.",
"app.pipelinesSimpleList.actions": "Akce",
"app.pipelinesSimpleList.empty": "Na seznamu nejsou žádné pipelines.",
"app.plantSisTerm.noGroupsSelected": "Musí být vybrána alespoň jedna rodičovská skupina.",
"app.plantSisTerm.plantGroups": "Osadit skupiny",
"app.plantSisTerm.planted": "Osazeno",
Expand Down Expand Up @@ -1554,6 +1552,7 @@
"app.solution.pointsExplainDialog.correctnessAboveThreshold": "Řešení překročilo požadovanou hranici správnosti.",
"app.solution.pointsExplainDialog.correctnessBelowThreshold": "Správnost řešení je pod minimální požadovanou hranicí, takže nebyly uděleny žádné body.",
"app.solution.pointsExplainDialog.deadlinesGraphNotUsedSuffix": "(graf je pouze informativní, bodový limit nebyl použit při výpočtu správnosti)",
"app.solution.pointsExplainDialog.epsilonExplain": "Epsilon (1e-6) je přičteno, aby kompenzovalo zaokrouhlovací chyby.",
"app.solution.pointsExplainDialog.overriddenPoints": "Vedoucí ručně přepsal hodnocení úlohy na <strong>{overriddenPoints}</strong> {overriddenPoints, plural, one {bod} =2 {body} =3 {body} =4 {body} other {bodů}} (a {bonusPoints} {bonusPoints, plural, one {bonusový bod} =2 {bonusové body} =3 {bonusové body} =4 {bonusové body} other {bonusových bodů}}).",
"app.solution.pointsExplainDialog.title": "Vysvětlení hodnotícího procesu",
"app.solution.reviewed": "Revidováno",
Expand Down
3 changes: 1 addition & 2 deletions src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1251,8 +1251,6 @@
"app.pipelinesList.judgeOnlyIconTooltip": "Judge-only pipeline",
"app.pipelinesList.stdoutIconTooltip": "Tested solution is expected to yield results to standard output",
"app.pipelinesList.universalPipelineIconTooltip": "Universal pipeline which is used in common (simple) exercise configurations.",
"app.pipelinesSimpleList.actions": "Actions",
"app.pipelinesSimpleList.empty": "There are no pipelines in this list.",
"app.plantSisTerm.noGroupsSelected": "At least one parent group needs to be selected.",
"app.plantSisTerm.plantGroups": "Plant Groups",
"app.plantSisTerm.planted": "Planted",
Expand Down Expand Up @@ -1554,6 +1552,7 @@
"app.solution.pointsExplainDialog.correctnessAboveThreshold": "The solution correctness is above threshold.",
"app.solution.pointsExplainDialog.correctnessBelowThreshold": "The solution correcntess is below threshold. No points are granted.",
"app.solution.pointsExplainDialog.deadlinesGraphNotUsedSuffix": "(but it was not used in the scoring process of this solution)",
"app.solution.pointsExplainDialog.epsilonExplain": "The epsilon (1e-6) is added to compensate for rounding errors.",
"app.solution.pointsExplainDialog.overriddenPoints": "A supervisor has manually overridden the points to <strong>{overriddenPoints}</strong> (and {bonusPoints} {bonusPoints, plural, one {point} other {points}}).",
"app.solution.pointsExplainDialog.title": "Explanation of the scoring process",
"app.solution.reviewed": "Reviewed",
Expand Down

0 comments on commit 94130b3

Please sign in to comment.