diff --git a/i18n/en.ts b/i18n/en.ts index e3f77a03985ea85ddd3b99a27405ef1dbb79074e..6551b34d1ebfbfcd82f34dc7d07360d4d9313f80 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 8a19ea0c639175239a0120efcb014a5caeb9245c..c6c137aadc4de32448fdc8ba9bdf90f4098cd436 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 c9be785d33bd4103ccbf10565342657e7413bb60..a478be1500ca077580eadb28620ecac7c270e538 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 e0806e085b2c92c3133780d393eec11295c79862..f94393991300d1f036c77cc3d72769cb5dedeb4e 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 720b1eb366ae61353a5f2acdd5ea427238b6bc1e..3c9d0abaaa82a2b98457a838e0124c00faef4018 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 15c20fc35821cd7e27bdbb982e2cdf9b62f4b2d8..400b68e39e6cce714ce7547bd4a0007a86838434 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'}` + +}