From 3e378ea2128fe11c4f79088341d3a3ae3ba34b9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Janis=20Daniel=20Da=CC=88hne?= <janis.daehne@informatik.uni-halle.de> Date: Fri, 21 Jan 2022 16:10:31 +0100 Subject: [PATCH] - added feature #169 - add status for passed normal tests in list views - removed first accessed at column (not needed?) --- i18n/en.ts | 2 + i18n/i18nRoot.ts | 2 + .../closedExercisesSite/listView.tsx | 80 ++++++++++++----- .../openExercises/listView.tsx | 88 +++++++++++++------ .../sites/doExerciseSite/doExerciseSite.tsx | 6 +- src/constants.ts | 2 +- src/types/exercisePreview.ts | 8 ++ 7 files changed, 137 insertions(+), 51 deletions(-) diff --git a/i18n/en.ts b/i18n/en.ts index a8a44462..69af2976 100644 --- a/i18n/en.ts +++ b/i18n/en.ts @@ -42,6 +42,8 @@ export const lang_en: LangObj = { "Created at": "Created at", "Last updated at": "Last updated at", "First accessed at": "First accessed at", + "Passed normal tests": "Passed normal tests", + "Passed normal tests (subsequent editor)": "Passed normal tests (subsequent editor)", "Last login at": "Last login at", "Information": "Information", "Search": "Search", diff --git a/i18n/i18nRoot.ts b/i18n/i18nRoot.ts index c7df5b48..b2e1d4aa 100644 --- a/i18n/i18nRoot.ts +++ b/i18n/i18nRoot.ts @@ -45,6 +45,8 @@ export interface LangObj { "Created at": string "Last updated at": string "First accessed at": string + "Passed normal tests": string + "Passed normal tests (subsequent editor)": string "Last login at": string "Information": string "Search": string diff --git a/src/components/sites/allAccessibleExercisesSite/closedExercisesSite/listView.tsx b/src/components/sites/allAccessibleExercisesSite/closedExercisesSite/listView.tsx index a5ea9545..5abfe339 100644 --- a/src/components/sites/allAccessibleExercisesSite/closedExercisesSite/listView.tsx +++ b/src/components/sites/allAccessibleExercisesSite/closedExercisesSite/listView.tsx @@ -153,26 +153,41 @@ class AllAccessibleExercisesList extends React.Component<Props, any> { } </span> </Table.HeaderCell> - <Table.HeaderCell - sorted={ - isCurrentSortingColumnPaginated<ExercisePreviewFromBackend>(this.props.sortByKey, 'firstAccessedAt', - this.props.sortDirection) - } - > - <span className="clickable" - onClick={() => { - this.props.setSortByKey('firstAccessedAt', - rotateSorting<ExercisePreviewFromBackend>(this.props.sortDirection, - this.props.sortByKey, - 'firstAccessedAt', - ), - this.props.displayAsViaCode - ) - }} - > - { - getI18n(this.props.langId,'First accessed at') - } + {/*<Table.HeaderCell*/} + {/* sorted={*/} + {/* isCurrentSortingColumnPaginated<ExercisePreviewFromBackend>(this.props.sortByKey, 'firstAccessedAt',*/} + {/* this.props.sortDirection)*/} + {/* }*/} + {/*>*/} + {/* <span className="clickable"*/} + {/* onClick={() => {*/} + {/* this.props.setSortByKey('firstAccessedAt',*/} + {/* rotateSorting<ExercisePreviewFromBackend>(this.props.sortDirection,*/} + {/* this.props.sortByKey,*/} + {/* 'firstAccessedAt',*/} + {/* ),*/} + {/* this.props.displayAsViaCode*/} + {/* )*/} + {/* }}*/} + {/* >*/} + {/* {*/} + {/* getI18n(this.props.langId,'First accessed at')*/} + {/* }*/} + {/* </span>*/} + {/*</Table.HeaderCell>*/} + { + //don't make this sortable (backend) because getting this data this is costly... + } + <Table.HeaderCell> + <span> + <HelpPopup icon="flag checkered" + defaultText={getI18n(this.props.langId,'Passed normal tests')}/> + </span> + </Table.HeaderCell> + <Table.HeaderCell> + <span> + <HelpPopup icon="life ring" + defaultText={getI18n(this.props.langId,'Passed normal tests (subsequent editor)')}/> </span> </Table.HeaderCell> <Table.HeaderCell> @@ -250,12 +265,29 @@ class AllAccessibleExercisesList extends React.Component<Props, any> { } </span> </Table.Cell> + {/*<Table.Cell>*/} + {/* <span>*/} + {/* {*/} + {/* displayDateAndTime(exercisePreview.firstAccessedAt, -1)*/} + {/* }*/} + {/* </span>*/} + {/*</Table.Cell>*/} <Table.Cell> - <span> - { - displayDateAndTime(exercisePreview.firstAccessedAt, -1) - } + { + exercisePreview.hasUserSolution && + <span className={exercisePreview.passedNormalTestsCount === exercisePreview.maxNormalTestsCount ? 'ok-colored' : ''}> + {exercisePreview.passedNormalTestsCount} / {exercisePreview.maxNormalTestsCount} </span> + } + + </Table.Cell> + <Table.Cell> + { + (exercisePreview.hasUserSolution && exercisePreview.subsequentEditorPassedNormalTestsCount !== null) && + <span className={exercisePreview.subsequentEditorPassedNormalTestsCount === exercisePreview.maxNormalTestsCount ? 'ok-colored' : ''}> + {exercisePreview.subsequentEditorPassedNormalTestsCount} / {exercisePreview.maxNormalTestsCount} + </span> + } </Table.Cell> <Table.Cell> <div> diff --git a/src/components/sites/allAccessibleExercisesSite/openExercises/listView.tsx b/src/components/sites/allAccessibleExercisesSite/openExercises/listView.tsx index ab2972ae..81eb8640 100644 --- a/src/components/sites/allAccessibleExercisesSite/openExercises/listView.tsx +++ b/src/components/sites/allAccessibleExercisesSite/openExercises/listView.tsx @@ -155,28 +155,46 @@ class AllAccessibleExercisesList extends React.Component<Props, any> { } </span> </Table.HeaderCell> - <Table.HeaderCell - sorted={ - isCurrentSortingColumnPaginated<ExercisePreviewFromBackend>(this.props.sortByKey, 'firstAccessedAt', - this.props.sortDirection) - } - > - <span className="clickable" - onClick={() => { - this.props.setSortByKey('firstAccessedAt', - rotateSorting<ExercisePreviewFromBackend>(this.props.sortDirection, - this.props.sortByKey, - 'firstAccessedAt', - ), - this.props.displayAsViaCode - ) - }} - > - { - getI18n(this.props.langId,'First accessed at') - } + {/*<Table.HeaderCell*/} + {/* sorted={*/} + {/* isCurrentSortingColumnPaginated<ExercisePreviewFromBackend>(this.props.sortByKey, 'firstAccessedAt',*/} + {/* this.props.sortDirection)*/} + {/* }*/} + {/*>*/} + {/* <span className="clickable"*/} + {/* onClick={() => {*/} + {/* this.props.setSortByKey('firstAccessedAt',*/} + {/* rotateSorting<ExercisePreviewFromBackend>(this.props.sortDirection,*/} + {/* this.props.sortByKey,*/} + {/* 'firstAccessedAt',*/} + {/* ),*/} + {/* this.props.displayAsViaCode*/} + {/* )*/} + {/* }}*/} + {/* >*/} + {/* {*/} + {/* getI18n(this.props.langId,'First accessed at')*/} + {/* }*/} + {/* </span>*/} + {/*</Table.HeaderCell>*/} + { + //don't make this sortable (backend) because getting this data this is costly... + } + <Table.HeaderCell> + <span> + <HelpPopup icon="flag checkered" + defaultText={getI18n(this.props.langId,'Passed normal tests')}/> </span> </Table.HeaderCell> + { + //consecutive editor is only available after the release finished... + } + {/*<Table.HeaderCell>*/} + {/* <span>*/} + {/* <HelpPopup icon="life ring"*/} + {/* defaultText={getI18n(this.props.langId,'Passed normal tests (subsequent editor)')}/>*/} + {/* </span>*/} + {/*</Table.HeaderCell>*/} { this.props.hideShouldNotCountColumn === false && <Table.HeaderCell> @@ -264,13 +282,33 @@ class AllAccessibleExercisesList extends React.Component<Props, any> { } </span> </Table.Cell> + {/*<Table.Cell>*/} + {/* <span>*/} + {/* {*/} + {/* displayDateAndTime(exercisePreview.firstAccessedAt, -1)*/} + {/* }*/} + {/* </span>*/} + {/*</Table.Cell>*/} <Table.Cell> - <span> - { - displayDateAndTime(exercisePreview.firstAccessedAt, -1) - } - </span> + { + exercisePreview.hasUserSolution && + <span className={exercisePreview.passedNormalTestsCount === exercisePreview.maxNormalTestsCount ? 'ok-colored' : ''}> + {exercisePreview.passedNormalTestsCount} / {exercisePreview.maxNormalTestsCount} + </span> + } + </Table.Cell> + { + //consecutive editor is only available after the release finished... + } + {/*<Table.Cell>*/} + {/* {*/} + {/* (exercisePreview.hasUserSolution && exercisePreview.subsequentEditorPassedNormalTestsCount !== null) &&*/} + {/* <span className={exercisePreview.subsequentEditorPassedNormalTestsCount === exercisePreview.maxNormalTestsCount ? 'ok-colored' : ''}>*/} + {/* {exercisePreview.subsequentEditorPassedNormalTestsCount} / {exercisePreview.maxNormalTestsCount}*/} + {/* </span>*/} + {/* }*/} + {/*</Table.Cell>*/} { this.props.hideShouldNotCountColumn === false && <Table.Cell> diff --git a/src/components/sites/doExerciseSite/doExerciseSite.tsx b/src/components/sites/doExerciseSite/doExerciseSite.tsx index 94f0d86d..fa54260b 100644 --- a/src/components/sites/doExerciseSite/doExerciseSite.tsx +++ b/src/components/sites/doExerciseSite/doExerciseSite.tsx @@ -922,7 +922,11 @@ class doExerciseSite extends React.Component<Props & RouteComponentProps<Matched releaseStartType: this.props.doExercise.exerciseRelease.releaseStartType, isVisibleToAllAfterRelease: false, releasedForPLangId: null, - leftTimeInS: null + leftTimeInS: null, + passedNormalTestsCount: 0, + maxNormalTestsCount: 0, + subsequentEditorPassedNormalTestsCount: null, + hasUserSolution: false, } const rest = updateExercisePreviews( diff --git a/src/constants.ts b/src/constants.ts index 6bfb4a76..d2f1caf8 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -13,7 +13,7 @@ import Logger from './helpers/logger' * y - breaking changes / new features * z - fixes, small changes */ -export const versionString = '2.15.0' +export const versionString = '2.16.0' export const supportMail = 'yapex@informatik.uni-halle.de' diff --git a/src/types/exercisePreview.ts b/src/types/exercisePreview.ts index 114e92fa..612fe0b1 100644 --- a/src/types/exercisePreview.ts +++ b/src/types/exercisePreview.ts @@ -115,6 +115,14 @@ export interface ExercisePreviewFromBackend { * true: is still released,false: not */ readonly isReleased: boolean + + /** + * will be zero if no test was ran yet + */ + readonly passedNormalTestsCount: number + readonly maxNormalTestsCount: number + readonly subsequentEditorPassedNormalTestsCount: number | null + readonly hasUserSolution: boolean } /** -- GitLab