From 56656f62f280651033dd2b8329ab426d048ff7bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Janis=20Daniel=20Da=CC=88hne?= <janis.daehne2@student.uni-halle.de> Date: Wed, 12 Jun 2019 19:11:10 +0200 Subject: [PATCH] - unified display of assessment points (in submissions view and tutor view) - added note that submit tests are only executed if the normal tests have no "hard" errors (e.g. timeout to test server) --- i18n/en.ts | 2 +- i18n/i18nRoot.ts | 2 +- .../submissionsSite/listView.tsx | 21 ++++++++++---- .../submissionsSite/submissionsSite.tsx | 2 +- .../manualAssessmentPanelView.tsx | 29 +++++++++++-------- src/helpers/convertersAndTransformers.ts | 28 +++++++++++++++++- 6 files changed, 62 insertions(+), 22 deletions(-) diff --git a/i18n/en.ts b/i18n/en.ts index e3f77a03..6551b34d 100644 --- a/i18n/en.ts +++ b/i18n/en.ts @@ -616,7 +616,7 @@ export const lang_en: LangObj = { "The times the user solved this exercise (e.g. in different releases). If a user solved the exercise (release) in different programming languages then two rows are shown but it's the same participation. The participation is counted as one because the restrictions (e.g. lef time, should not count) are stored in the participation.": "The times the user solved this exercise (e.g. in different releases). If a user solved the exercise (release) in different programming languages then two rows are shown but it's the same participation. The participation is counted as one because the restrictions (e.g. lef time, should not count) are stored in the participation.", "Could not re-run all automatic assessments" : "Could not re-run all automatic assessments", "The re-run all automatic assessments has started. To get updates refresh the list" : "The re-run all automatic assessments has started. To get updates refresh the list", - "The assessment (normal and submit tests) is run on the submit test server which might have other settings (e.g. timeout). The tutor view runs the submit tests on the submit test server and the normal test on the normal test server" : "The assessment (normal and submit tests) is run on the submit test server which might have other settings (e.g. timeout). The tutor view runs the submit tests on the submit test server and the normal test on the normal test server", + "The assessment (normal and submit tests) is run on the submit test server which might have other settings (e.g. timeout). The tutor view runs the submit tests on the submit test server and the normal test on the normal test server. If normal and submit tests are run and the normal tests produce some server error (e.g. connection to test server timed out) then the submit tests are not executed." : "The assessment (normal and submit tests) is run on the submit test server which might have other settings (e.g. timeout). The tutor view runs the submit tests on the submit test server and the normal test on the normal test server. If normal and submit tests are run and the normal tests produce some server error (e.g. connection to test server timed out) then the submit tests are not executed.", "The graph only includes data displayed in the table": "The graph only includes data displayed in the table", diff --git a/i18n/i18nRoot.ts b/i18n/i18nRoot.ts index 8a19ea0c..c6c137aa 100644 --- a/i18n/i18nRoot.ts +++ b/i18n/i18nRoot.ts @@ -623,7 +623,7 @@ export interface LangObj { "The times the user solved this exercise (e.g. in different releases). If a user solved the exercise (release) in different programming languages then two rows are shown but it's the same participation. The participation is counted as one because the restrictions (e.g. lef time, should not count) are stored in the participation.": string "Could not re-run all automatic assessments": string "The re-run all automatic assessments has started. To get updates refresh the list": string - "The assessment (normal and submit tests) is run on the submit test server which might have other settings (e.g. timeout). The tutor view runs the submit tests on the submit test server and the normal test on the normal test server": string + "The assessment (normal and submit tests) is run on the submit test server which might have other settings (e.g. timeout). The tutor view runs the submit tests on the submit test server and the normal test on the normal test server. If normal and submit tests are run and the normal tests produce some server error (e.g. connection to test server timed out) then the submit tests are not executed.": string "The graph only includes data displayed in the table": string diff --git a/src/components/sites/manageOwnOrGroupExerciseComponents/submissionsSite/listView.tsx b/src/components/sites/manageOwnOrGroupExerciseComponents/submissionsSite/listView.tsx index c9be785d..a478be15 100644 --- a/src/components/sites/manageOwnOrGroupExerciseComponents/submissionsSite/listView.tsx +++ b/src/components/sites/manageOwnOrGroupExerciseComponents/submissionsSite/listView.tsx @@ -24,11 +24,11 @@ import { import {isCurrentSortingColumnPaginated, rotateSorting} from "../../../../helpers/tablesHelper"; import {HelpPopup} from "../../../helpers/helpPopup"; import {Link} from "react-router-dom"; -import {isNotEmpty} from "../../../../validation/validations"; +import {isNotEmpty, isNotNullOrUndefined} from "../../../../validation/validations"; import {ArrayHelper} from "../../../../helpers/arrayHelper"; -import {displayNumber} from "../../../../helpers/convertersAndTransformers"; +import {displayNumber, assessmentPointsToString} from "../../../../helpers/convertersAndTransformers"; import {MyPopup} from "../../../helpers/myPopup"; import {getI18n} from "../../../../../i18n/i18nRoot"; import PaginationTableFooter from '../../../helpers/paginationTableFooter' @@ -522,8 +522,13 @@ class ListView extends React.Component<Props, any> { <Table.Cell> <span> { - submission.normalTestPoints !== null && - `${submission.normalTestPoints} / ${submission.maxNormalTestPoints}` + + assessmentPointsToString(this.props.langId, + this.props.release.hasAutomaticAssessmentFinished, + false, + submission.normalTestPoints, + submission.maxNormalTestPoints + ) } </span> </Table.Cell> @@ -531,8 +536,12 @@ class ListView extends React.Component<Props, any> { <Table.Cell> <span> { - submission.submitTestPoints !== null && - `${submission.submitTestPoints} / ${submission.maxSubmitTestPoints}` + assessmentPointsToString(this.props.langId, + this.props.release.hasAutomaticAssessmentFinished, + false, + submission.submitTestPoints, + submission.maxSubmitTestPoints + ) } </span> </Table.Cell> diff --git a/src/components/sites/manageOwnOrGroupExerciseComponents/submissionsSite/submissionsSite.tsx b/src/components/sites/manageOwnOrGroupExerciseComponents/submissionsSite/submissionsSite.tsx index e0806e08..f9439399 100644 --- a/src/components/sites/manageOwnOrGroupExerciseComponents/submissionsSite/submissionsSite.tsx +++ b/src/components/sites/manageOwnOrGroupExerciseComponents/submissionsSite/submissionsSite.tsx @@ -231,7 +231,7 @@ class SubmissionsView extends React.Component<Props & RouteComponentProps<Matche } </h2> - <HelpPopup className="mar-left-half v-centered" defaultText={getI18n(this.props.langId, "The assessment (normal and submit tests) is run on the submit test server which might have other settings (e.g. timeout). The tutor view runs the submit tests on the submit test server and the normal test on the normal test server")} wide/> + <HelpPopup className="mar-left-half v-centered" defaultText={getI18n(this.props.langId, "The assessment (normal and submit tests) is run on the submit test server which might have other settings (e.g. timeout). The tutor view runs the submit tests on the submit test server and the normal test on the normal test server. If normal and submit tests are run and the normal tests produce some server error (e.g. connection to test server timed out) then the submit tests are not executed.")} wide={'very'}/> </div> <div className="view-options"> <MaterialSearchInput diff --git a/src/components/sites/tutorViewSite/manualAssessmentPanel/manualAssessmentPanelView.tsx b/src/components/sites/tutorViewSite/manualAssessmentPanel/manualAssessmentPanelView.tsx index 720b1eb3..3c9d0aba 100644 --- a/src/components/sites/tutorViewSite/manualAssessmentPanel/manualAssessmentPanelView.tsx +++ b/src/components/sites/tutorViewSite/manualAssessmentPanel/manualAssessmentPanelView.tsx @@ -16,7 +16,7 @@ import { setManualAssessmentNote, setManualAssessmentPoints } from "../../../../state/actions/tutorViewSite/sub/setAssessmentActions"; -import {parseAnyId} from "../../../../helpers/convertersAndTransformers"; +import {parseAnyId, assessmentPointsToString} from "../../../../helpers/convertersAndTransformers"; import {HelpPopup} from "../../../helpers/helpPopup"; @@ -25,6 +25,7 @@ import Logger from "../../../../helpers/logger"; import {SimpleDivider} from "../../../helpers/simpleDivider"; import {getI18n} from "../../../../../i18n/i18nRoot"; import {selectAllTextEventHandler} from '../../../../helpers/commonEventHandlers' +import {isNotNullOrUndefined} from '../../../../validation/validations' //const css = require('./styles.styl'); @@ -62,17 +63,19 @@ class manualAssessmentPanelView extends React.Component<Props, any> { render(): JSX.Element { - const submitTestPointsString = this.props.assessment - && this.props.assessment.submitTestPoints - && this.props.assessment.maxSubmitTestPoints - ? `${this.props.assessment.submitTestPoints}/${this.props.assessment.maxSubmitTestPoints}` - : getI18n(this.props.langId, 'Not assessed') - const normalTestPointsString = this.props.assessment - && this.props.assessment.normalTestPoints - && this.props.assessment.maxNormalTestPoints - ? `${this.props.assessment.normalTestPoints}/${this.props.assessment.maxNormalTestPoints}` - : getI18n(this.props.langId, 'Not assessed') + + const submitTestPointsString = assessmentPointsToString(this.props.langId, + this.props.release.hasAutomaticAssessmentFinished, + this.props.assessment === null, + this.props.assessment.submitTestPoints, + this.props.assessment.maxSubmitTestPoints) + + const normalTestPointsString = assessmentPointsToString(this.props.langId, + this.props.release.hasAutomaticAssessmentFinished, + this.props.assessment === null, + this.props.assessment.normalTestPoints, + this.props.assessment.maxNormalTestPoints) return ( <div className="fh mar-right-half"> @@ -222,7 +225,9 @@ class manualAssessmentPanelView extends React.Component<Props, any> { } this.props.setManualAssessmentPoints(manualPoints) }} - postfixText={this.props.release.maxManualPoints !== null ? `/${this.props.release.maxManualPoints}` : undefined} + postfixText={this.props.release.maxManualPoints !== null + ? `/${this.props.release.maxManualPoints}` + : undefined} /> </Form.Field> diff --git a/src/helpers/convertersAndTransformers.ts b/src/helpers/convertersAndTransformers.ts index 15c20fc3..400b68e3 100644 --- a/src/helpers/convertersAndTransformers.ts +++ b/src/helpers/convertersAndTransformers.ts @@ -40,7 +40,7 @@ import { RunnableCustomProjectTestFrontendExclusive } from "../types/customProjects"; import orderBy from 'lodash-es/orderBy' -import {getI18n} from "../../i18n/i18nRoot"; +import {getI18n, KnownLangs} from "../../i18n/i18nRoot"; import globalState from '../state/state' @@ -1057,3 +1057,29 @@ function trimStart(text: string): string { return text.substring(index) } + +/** + * converts the assessment result to a string + * @param langId + * @param hasAutomaticAssessmentFinished + * @param assessmentIsEmpty assessment === null ? + * @param testPoints + * @param maxTestPoints + */ +export function assessmentPointsToString(langId: KnownLangs, hasAutomaticAssessmentFinished: boolean, assessmentIsEmpty: boolean, testPoints: number | null, maxTestPoints: number | null): string { + + if (assessmentIsEmpty) { + return getI18n(langId, 'Not assessed') + } + + if (hasAutomaticAssessmentFinished === false) { + return getI18n(langId, 'Not assessed') + } + + return `${isNotNullOrUndefined(testPoints) + ? testPoints + : 'null'} / ${isNotNullOrUndefined(maxTestPoints) + ? maxTestPoints + : 'null'}` + +} -- GitLab