From 932e4c6030694c6e37e6e8ebc220b40415d6354d Mon Sep 17 00:00:00 2001 From: JustATin555 Date: Fri, 28 Feb 2025 16:02:06 +0800 Subject: [PATCH 1/8] userstate.assessments.id and navigateToAssessment() now use the number field instead of id --- public/assets/mockChapter0.txt | 12 ++++++------ .../game/scenes/gameManager/GameGlobalAPI.ts | 16 +++++++++++++--- src/features/game/state/GameUserStateManager.ts | 2 +- 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/public/assets/mockChapter0.txt b/public/assets/mockChapter0.txt index b22cc9febf..27ba58a9dc 100644 --- a/public/assets/mockChapter0.txt +++ b/public/assets/mockChapter0.txt @@ -4,9 +4,9 @@ objectives finish gameStartActions - // replace 173 with assessment id - show_dialogue(welcome) if userstate.assessments.173 - show_dialogue(unwelcome) if !userstate.assessments.173 + // replace S0 with assessment number + show_dialogue(welcome) if userstate.assessments.S0 + show_dialogue(unwelcome) if !userstate.assessments.S0 checkpointCompleteActions show_dialogue(done) @@ -96,8 +96,8 @@ dialogues 1 @scottie, sad You haven't finished assessment - Finish assessment 173 first and come back? - navigate_to_assessment(173) + Finish assessment S0 first and come back? + navigate_to_assessment(S0) goto 2 2 @scottie @@ -113,7 +113,7 @@ dialogues Hmmm update_assessment_status*() Let me check - goto 1 if !userstate.assessments.173 else 3 + goto 1 if !userstate.assessments.S0 else 3 what, What should I do now, Scottie? @you diff --git a/src/features/game/scenes/gameManager/GameGlobalAPI.ts b/src/features/game/scenes/gameManager/GameGlobalAPI.ts index ac407fa84f..abd4009fbe 100644 --- a/src/features/game/scenes/gameManager/GameGlobalAPI.ts +++ b/src/features/game/scenes/gameManager/GameGlobalAPI.ts @@ -1,3 +1,5 @@ +import { getAssessmentOverviews } from 'src/commons/sagas/RequestsSaga'; + import { GameAction } from '../../action/GameActionTypes'; import { SoundAsset } from '../../assets/AssetsTypes'; import { getAwardProp } from '../../awards/GameAwardsHelper'; @@ -450,15 +452,23 @@ class GameGlobalAPI { // Assessment // ///////////////////// - public async promptNavigateToAssessment(assessmentId: number) { + public async promptNavigateToAssessment(assessmentId: string) { const response = await promptWithChoices( GameGlobalAPI.getInstance().getGameManager(), `Are you ready for the challenge?`, ['Yes', 'No'] ); if (response === 0) { - window.open(`/courses/${courseId()}/missions/${assessmentId}/0`, 'blank'); - window.focus(); + const assessments = await getAssessmentOverviews( + SourceAcademyGame.getInstance().getAccountInfo() + ); + if (assessments) { + const { id, type } = assessments.filter( + assessment => assessment.number === assessmentId + )[0]; + window.open(`/courses/${courseId()}/${type.toLowerCase()}/${id}/0`, 'blank'); + window.focus(); + } } } diff --git a/src/features/game/state/GameUserStateManager.ts b/src/features/game/state/GameUserStateManager.ts index 77c8a400f4..e394db3c13 100644 --- a/src/features/game/state/GameUserStateManager.ts +++ b/src/features/game/state/GameUserStateManager.ts @@ -55,7 +55,7 @@ export default class GameUserStateManager { (assessments || []) .filter(assessment => assessment.status === 'submitted') .sort((a, b) => (a.closeAt <= b.closeAt ? -1 : 1)) - .map(assessment => assessment.id.toString()) + .map(assessment => assessment.number || assessment.id.toString()) ); } From fed0f35f2ed962e28b98c76f5b1db10f9d5ba86b Mon Sep 17 00:00:00 2001 From: JustATin555 Date: Sat, 8 Mar 2025 15:55:27 +0800 Subject: [PATCH 2/8] Allow direct submission within AssessmentWorkspace when onSubmit == finish OR type == Visions --- src/commons/assessment/AssessmentTypes.ts | 1 + .../AssessmentWorkspace.tsx | 26 +++++++++++++++++++ .../controlBar/ControlBarNextButton.tsx | 9 ++++++- src/commons/controlBar/ControlBarSubmit.tsx | 19 ++++++++++++++ 4 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 src/commons/controlBar/ControlBarSubmit.tsx diff --git a/src/commons/assessment/AssessmentTypes.ts b/src/commons/assessment/AssessmentTypes.ts index c3d5cecbf4..2b752a94fa 100644 --- a/src/commons/assessment/AssessmentTypes.ts +++ b/src/commons/assessment/AssessmentTypes.ts @@ -92,6 +92,7 @@ export type Assessment = { globalDeployment?: Library; // For mission control graderDeployment?: Library; // For mission control hasTokenCounter?: boolean; + onFinish?: string; id: number; longSummary: string; missionPDF: string; diff --git a/src/commons/assessmentWorkspace/AssessmentWorkspace.tsx b/src/commons/assessmentWorkspace/AssessmentWorkspace.tsx index adbe92f7de..0c43202971 100644 --- a/src/commons/assessmentWorkspace/AssessmentWorkspace.tsx +++ b/src/commons/assessmentWorkspace/AssessmentWorkspace.tsx @@ -93,6 +93,7 @@ const AssessmentWorkspace: React.FC = props => { const [isSaving, setIsSaving] = useState(false); const [showResetTemplateOverlay, setShowResetTemplateOverlay] = useState(false); const [sessionId, setSessionId] = useState(''); + const [isSubmitted, setIsSubmitted] = useState(false); const { isMobileBreakpoint } = useResponsive(); const assessment = useTypedSelector(state => state.session.assessments[props.assessmentId]); @@ -622,6 +623,12 @@ const AssessmentWorkspace: React.FC = props => { setSelectedTab(SideContentType.questionOverview); }; const onClickReturn = () => navigate(listingPath); + const onClickSubmit = () => { + if (props.notAttempted) return; + + dispatch(SessionActions.submitAssessment(assessment.id)); + setIsSubmitted(true); + }; const onClickSave = () => { if (isSaving) return; @@ -686,8 +693,14 @@ const AssessmentWorkspace: React.FC = props => { ? onClickProgress(onClickReturn, question, editorTestcases, isBlocked) : onClickReturn } + onClickSubmit={ + question.blocking + ? onClickProgress(onClickSubmit, question, editorTestcases, isBlocked) + : onClickSubmit + } questionProgress={questionProgress} key="next_question" + submitOnFinish={assessment.onFinish === 'submit' || assessment.type === 'Visions'} /> ); @@ -856,6 +869,18 @@ const AssessmentWorkspace: React.FC = props => { ); + const submissionOverlay = ( + + + + + + ); + const closeOverlay = () => setShowResetTemplateOverlay(false); const resetTemplateOverlay = ( = props => { }; return (
+ {submissionOverlay} {overlay} {resetTemplateOverlay} {!isMobileBreakpoint ? ( diff --git a/src/commons/controlBar/ControlBarNextButton.tsx b/src/commons/controlBar/ControlBarNextButton.tsx index 2723e18e72..6e4d124876 100644 --- a/src/commons/controlBar/ControlBarNextButton.tsx +++ b/src/commons/controlBar/ControlBarNextButton.tsx @@ -3,22 +3,29 @@ import React from 'react'; import ControlButton from '../ControlButton'; import { ControlBarReturnToAcademyButton } from './ControlBarReturnToAcademyButton'; +import { ControlBarSubmit } from './ControlBarSubmit'; type ControlBarNextButtonProps = DispatchProps & StateProps; type DispatchProps = { onClickNext?(): any; onClickReturn?(): any; + onClickSubmit?(): any; }; type StateProps = { key: string; questionProgress: [number, number] | null; + submitOnFinish?: boolean; }; export const ControlBarNextButton: React.FC = props => { return props.questionProgress![0] === props.questionProgress![1] ? ( - + props.submitOnFinish ? ( + + ) : ( + + ) ) : ( = ({ onClick }) => { + return ( + + ); +}; From 7290bc8b486615e88a924190bf432fa5811058e9 Mon Sep 17 00:00:00 2001 From: JustATin555 Date: Wed, 19 Mar 2025 12:49:52 +0800 Subject: [PATCH 3/8] Rename onFinish flag from submit => submitAndReturnToGame --- src/commons/assessmentWorkspace/AssessmentWorkspace.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/commons/assessmentWorkspace/AssessmentWorkspace.tsx b/src/commons/assessmentWorkspace/AssessmentWorkspace.tsx index 0c43202971..ab78745ef1 100644 --- a/src/commons/assessmentWorkspace/AssessmentWorkspace.tsx +++ b/src/commons/assessmentWorkspace/AssessmentWorkspace.tsx @@ -700,7 +700,7 @@ const AssessmentWorkspace: React.FC = props => { } questionProgress={questionProgress} key="next_question" - submitOnFinish={assessment.onFinish === 'submit' || assessment.type === 'Visions'} + submitOnFinish={assessment.onFinish === 'submitAndReturnToGame'} /> ); From 1c292262798aaf19758a16c287c94813c82c03bb Mon Sep 17 00:00:00 2001 From: JustATin555 Date: Sun, 30 Mar 2025 19:45:51 +0800 Subject: [PATCH 4/8] Rename and move isMinigame to assessment config in admin panel --- .../application/actions/__tests__/SessionActions.ts | 3 +++ src/commons/assessment/AssessmentTypes.ts | 3 ++- .../assessmentWorkspace/AssessmentWorkspace.tsx | 4 +++- .../__tests__/AssessmentWorkspace.tsx | 1 + src/commons/mocks/AssessmentMocks.ts | 8 ++++++++ src/commons/sagas/BackendSaga.ts | 1 + src/commons/sagas/__tests__/BackendSaga.ts | 6 ++++++ .../assessmentConfigPanel/AssessmentConfigPanel.tsx | 11 +++++++++++ 8 files changed, 35 insertions(+), 2 deletions(-) diff --git a/src/commons/application/actions/__tests__/SessionActions.ts b/src/commons/application/actions/__tests__/SessionActions.ts index cf65144525..88301d31d3 100644 --- a/src/commons/application/actions/__tests__/SessionActions.ts +++ b/src/commons/application/actions/__tests__/SessionActions.ts @@ -264,6 +264,7 @@ test('setAssessmentConfigurations generates correct action object', () => { isManuallyGraded: true, isGradingAutoPublished: false, displayInDashboard: true, + isMinigame: false, hasTokenCounter: false, hasVotingFeatures: false, hoursBeforeEarlyXpDecay: 48, @@ -275,6 +276,7 @@ test('setAssessmentConfigurations generates correct action object', () => { isManuallyGraded: true, isGradingAutoPublished: false, displayInDashboard: true, + isMinigame: false, hasTokenCounter: false, hasVotingFeatures: false, hoursBeforeEarlyXpDecay: 48, @@ -286,6 +288,7 @@ test('setAssessmentConfigurations generates correct action object', () => { isManuallyGraded: true, isGradingAutoPublished: false, displayInDashboard: true, + isMinigame: false, hasTokenCounter: false, hasVotingFeatures: false, hoursBeforeEarlyXpDecay: 48, diff --git a/src/commons/assessment/AssessmentTypes.ts b/src/commons/assessment/AssessmentTypes.ts index 2b752a94fa..2bd726f9b3 100644 --- a/src/commons/assessment/AssessmentTypes.ts +++ b/src/commons/assessment/AssessmentTypes.ts @@ -92,7 +92,7 @@ export type Assessment = { globalDeployment?: Library; // For mission control graderDeployment?: Library; // For mission control hasTokenCounter?: boolean; - onFinish?: string; + isMinigame?: boolean; id: number; longSummary: string; missionPDF: string; @@ -106,6 +106,7 @@ export type AssessmentConfiguration = { isManuallyGraded: boolean; isGradingAutoPublished: boolean; displayInDashboard: boolean; + isMinigame: boolean; hoursBeforeEarlyXpDecay: number; earlySubmissionXp: number; hasTokenCounter: boolean; diff --git a/src/commons/assessmentWorkspace/AssessmentWorkspace.tsx b/src/commons/assessmentWorkspace/AssessmentWorkspace.tsx index ab78745ef1..75ca8255ef 100644 --- a/src/commons/assessmentWorkspace/AssessmentWorkspace.tsx +++ b/src/commons/assessmentWorkspace/AssessmentWorkspace.tsx @@ -602,6 +602,8 @@ const AssessmentWorkspace: React.FC = props => { }; }; + console.log(assessment); + /** * controlBarProps() will only be called when assessment is not undefined * (see 'Rendering Logic' below), thus it is okay to use assessment! @@ -700,7 +702,7 @@ const AssessmentWorkspace: React.FC = props => { } questionProgress={questionProgress} key="next_question" - submitOnFinish={assessment.onFinish === 'submitAndReturnToGame'} + submitOnFinish={assessment.isMinigame} /> ); diff --git a/src/commons/assessmentWorkspace/__tests__/AssessmentWorkspace.tsx b/src/commons/assessmentWorkspace/__tests__/AssessmentWorkspace.tsx index df1f2b01c8..311db2ed35 100644 --- a/src/commons/assessmentWorkspace/__tests__/AssessmentWorkspace.tsx +++ b/src/commons/assessmentWorkspace/__tests__/AssessmentWorkspace.tsx @@ -21,6 +21,7 @@ const defaultProps = assertType()({ isManuallyGraded: true, isGradingAutoPublished: false, displayInDashboard: true, + isMinigame: false, hasTokenCounter: false, hasVotingFeatures: false, hoursBeforeEarlyXpDecay: 48, diff --git a/src/commons/mocks/AssessmentMocks.ts b/src/commons/mocks/AssessmentMocks.ts index deda0f8cba..2619f87642 100644 --- a/src/commons/mocks/AssessmentMocks.ts +++ b/src/commons/mocks/AssessmentMocks.ts @@ -21,6 +21,7 @@ export const mockAssessmentConfigurations: AssessmentConfiguration[][] = [ isManuallyGraded: true, isGradingAutoPublished: false, displayInDashboard: true, + isMinigame: false, hoursBeforeEarlyXpDecay: 48, hasTokenCounter: false, hasVotingFeatures: false, @@ -32,6 +33,7 @@ export const mockAssessmentConfigurations: AssessmentConfiguration[][] = [ isManuallyGraded: true, isGradingAutoPublished: false, displayInDashboard: true, + isMinigame: false, hoursBeforeEarlyXpDecay: 48, hasTokenCounter: false, hasVotingFeatures: false, @@ -43,6 +45,7 @@ export const mockAssessmentConfigurations: AssessmentConfiguration[][] = [ isManuallyGraded: false, isGradingAutoPublished: true, displayInDashboard: true, + isMinigame: false, hoursBeforeEarlyXpDecay: 48, hasTokenCounter: false, hasVotingFeatures: false, @@ -54,6 +57,7 @@ export const mockAssessmentConfigurations: AssessmentConfiguration[][] = [ isManuallyGraded: true, isGradingAutoPublished: false, displayInDashboard: true, + isMinigame: false, hoursBeforeEarlyXpDecay: 48, hasTokenCounter: false, hasVotingFeatures: true, @@ -65,6 +69,7 @@ export const mockAssessmentConfigurations: AssessmentConfiguration[][] = [ isManuallyGraded: true, isGradingAutoPublished: false, displayInDashboard: true, + isMinigame: false, hoursBeforeEarlyXpDecay: 48, hasTokenCounter: false, hasVotingFeatures: false, @@ -78,6 +83,7 @@ export const mockAssessmentConfigurations: AssessmentConfiguration[][] = [ isManuallyGraded: true, isGradingAutoPublished: false, displayInDashboard: true, + isMinigame: false, hoursBeforeEarlyXpDecay: 48, hasTokenCounter: false, hasVotingFeatures: false, @@ -89,6 +95,7 @@ export const mockAssessmentConfigurations: AssessmentConfiguration[][] = [ isManuallyGraded: true, isGradingAutoPublished: false, displayInDashboard: true, + isMinigame: false, hoursBeforeEarlyXpDecay: 48, hasTokenCounter: false, hasVotingFeatures: false, @@ -100,6 +107,7 @@ export const mockAssessmentConfigurations: AssessmentConfiguration[][] = [ isManuallyGraded: true, isGradingAutoPublished: false, displayInDashboard: true, + isMinigame: false, hoursBeforeEarlyXpDecay: 48, hasTokenCounter: false, hasVotingFeatures: false, diff --git a/src/commons/sagas/BackendSaga.ts b/src/commons/sagas/BackendSaga.ts index b9c57609b8..22fd478e99 100644 --- a/src/commons/sagas/BackendSaga.ts +++ b/src/commons/sagas/BackendSaga.ts @@ -957,6 +957,7 @@ const newBackendSagaTwo = combineSagaHandlers(sagaActions, { isManuallyGraded: true, isGradingAutoPublished: false, displayInDashboard: true, + isMinigame: false, hoursBeforeEarlyXpDecay: 0, hasTokenCounter: false, hasVotingFeatures: false, diff --git a/src/commons/sagas/__tests__/BackendSaga.ts b/src/commons/sagas/__tests__/BackendSaga.ts index e6ea9f1320..b16308c2c7 100644 --- a/src/commons/sagas/__tests__/BackendSaga.ts +++ b/src/commons/sagas/__tests__/BackendSaga.ts @@ -177,6 +177,7 @@ const mockAssessmentConfigurations: AssessmentConfiguration[] = [ isManuallyGraded: true, isGradingAutoPublished: false, displayInDashboard: true, + isMinigame: false, hoursBeforeEarlyXpDecay: 48, hasTokenCounter: false, hasVotingFeatures: false, @@ -188,6 +189,7 @@ const mockAssessmentConfigurations: AssessmentConfiguration[] = [ isManuallyGraded: true, isGradingAutoPublished: false, displayInDashboard: true, + isMinigame: false, hoursBeforeEarlyXpDecay: 48, hasTokenCounter: false, hasVotingFeatures: false, @@ -199,6 +201,7 @@ const mockAssessmentConfigurations: AssessmentConfiguration[] = [ isManuallyGraded: false, isGradingAutoPublished: true, displayInDashboard: false, + isMinigame: false, hoursBeforeEarlyXpDecay: 48, hasTokenCounter: false, hasVotingFeatures: false, @@ -210,6 +213,7 @@ const mockAssessmentConfigurations: AssessmentConfiguration[] = [ isManuallyGraded: false, isGradingAutoPublished: false, displayInDashboard: false, + isMinigame: false, hoursBeforeEarlyXpDecay: 48, hasTokenCounter: false, hasVotingFeatures: true, @@ -221,6 +225,7 @@ const mockAssessmentConfigurations: AssessmentConfiguration[] = [ isManuallyGraded: true, isGradingAutoPublished: false, displayInDashboard: false, + isMinigame: false, hoursBeforeEarlyXpDecay: 48, hasTokenCounter: false, hasVotingFeatures: false, @@ -1042,6 +1047,7 @@ describe('Test CREATE_COURSE action', () => { isManuallyGraded: true, isGradingAutoPublished: false, displayInDashboard: true, + isMinigame: false, hoursBeforeEarlyXpDecay: 0, hasTokenCounter: false, hasVotingFeatures: false, diff --git a/src/pages/academy/adminPanel/subcomponents/assessmentConfigPanel/AssessmentConfigPanel.tsx b/src/pages/academy/adminPanel/subcomponents/assessmentConfigPanel/AssessmentConfigPanel.tsx index 18ca059f82..ef091afd65 100644 --- a/src/pages/academy/adminPanel/subcomponents/assessmentConfigPanel/AssessmentConfigPanel.tsx +++ b/src/pages/academy/adminPanel/subcomponents/assessmentConfigPanel/AssessmentConfigPanel.tsx @@ -31,6 +31,7 @@ const defaultAssessmentConfig: AssessmentConfiguration = { isManuallyGraded: true, isGradingAutoPublished: false, displayInDashboard: true, + isMinigame: false, hoursBeforeEarlyXpDecay: 0, hasTokenCounter: false, hasVotingFeatures: false, @@ -131,6 +132,7 @@ const AssessmentConfigPanel: WithImperativeApi< /* eslint-disable react-hooks/exhaustive-deps */ const setDisplayInDashboard = useCallback(valueSetter('displayInDashboard'), []); + const setIsMinigame = useCallback(valueSetter('isMinigame'), []); const setHasTokenCounter = useCallback(valueSetter('hasTokenCounter'), []); const setHasVotingFeatures = useCallback(valueSetter('hasVotingFeatures'), []); const setEarlyXp = useCallback(valueSetter('earlySubmissionXp'), []); @@ -201,6 +203,15 @@ const AssessmentConfigPanel: WithImperativeApi< field: 'displayInDashboard' } }, + { + headerName: 'Is Minigame', + field: 'isMinigame', + cellRenderer: BooleanCell, + cellRendererParams: { + setStateHandler: setIsMinigame, + field: 'isMinigame' + } + }, { headerName: 'Voting Features*', field: 'hasVotingFeatures', From 4017d743bad2c756bbae1d80ea0beb875877befc Mon Sep 17 00:00:00 2001 From: JustATin555 Date: Sun, 30 Mar 2025 19:58:49 +0800 Subject: [PATCH 5/8] Remove assessment console.log --- src/commons/assessmentWorkspace/AssessmentWorkspace.tsx | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/commons/assessmentWorkspace/AssessmentWorkspace.tsx b/src/commons/assessmentWorkspace/AssessmentWorkspace.tsx index 4f2e839b15..6d00ce5a6f 100644 --- a/src/commons/assessmentWorkspace/AssessmentWorkspace.tsx +++ b/src/commons/assessmentWorkspace/AssessmentWorkspace.tsx @@ -580,8 +580,6 @@ const AssessmentWorkspace: React.FC = props => { }; }; - console.log(assessment); - /** * controlBarProps() will only be called when assessment is not undefined * (see 'Rendering Logic' below), thus it is okay to use assessment! From ac375554607c6aa85b6a5ef25bc78b581e6a2239 Mon Sep 17 00:00:00 2001 From: JustATin555 Date: Sun, 30 Mar 2025 20:08:54 +0800 Subject: [PATCH 6/8] Add isMinigame to a few more testcases... --- .../application/actions/__tests__/SessionActions.ts | 7 +++++++ .../application/reducers/__tests__/SessionReducer.ts | 3 +++ src/commons/assessment/__tests__/Assessment.tsx | 1 + src/commons/profile/__tests__/Profile.tsx | 1 + 4 files changed, 12 insertions(+) diff --git a/src/commons/application/actions/__tests__/SessionActions.ts b/src/commons/application/actions/__tests__/SessionActions.ts index 88301d31d3..b2fdd8a26b 100644 --- a/src/commons/application/actions/__tests__/SessionActions.ts +++ b/src/commons/application/actions/__tests__/SessionActions.ts @@ -717,6 +717,7 @@ test('updateAssessmentTypes generates correct action object', () => { isManuallyGraded: true, isGradingAutoPublished: false, displayInDashboard: true, + isMinigame: false, hasTokenCounter: false, hasVotingFeatures: false, hoursBeforeEarlyXpDecay: 48, @@ -728,6 +729,7 @@ test('updateAssessmentTypes generates correct action object', () => { isManuallyGraded: true, isGradingAutoPublished: false, displayInDashboard: true, + isMinigame: false, hasTokenCounter: false, hasVotingFeatures: false, hoursBeforeEarlyXpDecay: 48, @@ -739,6 +741,7 @@ test('updateAssessmentTypes generates correct action object', () => { isManuallyGraded: false, isGradingAutoPublished: true, displayInDashboard: true, + isMinigame: false, hasTokenCounter: false, hasVotingFeatures: false, hoursBeforeEarlyXpDecay: 48, @@ -750,6 +753,7 @@ test('updateAssessmentTypes generates correct action object', () => { isManuallyGraded: true, isGradingAutoPublished: false, displayInDashboard: true, + isMinigame: false, hasTokenCounter: false, hasVotingFeatures: false, hoursBeforeEarlyXpDecay: 48, @@ -761,6 +765,7 @@ test('updateAssessmentTypes generates correct action object', () => { isManuallyGraded: false, isGradingAutoPublished: false, displayInDashboard: true, + isMinigame: false, hasTokenCounter: false, hasVotingFeatures: false, hoursBeforeEarlyXpDecay: 0, @@ -772,6 +777,7 @@ test('updateAssessmentTypes generates correct action object', () => { isManuallyGraded: true, isGradingAutoPublished: false, displayInDashboard: true, + isMinigame: false, hasTokenCounter: false, hasVotingFeatures: false, hoursBeforeEarlyXpDecay: 48, @@ -792,6 +798,7 @@ test('deleteAssessmentConfig generates correct action object', () => { isManuallyGraded: true, isGradingAutoPublished: false, displayInDashboard: true, + isMinigame: false, hasTokenCounter: false, hasVotingFeatures: false, hoursBeforeEarlyXpDecay: 48, diff --git a/src/commons/application/reducers/__tests__/SessionReducer.ts b/src/commons/application/reducers/__tests__/SessionReducer.ts index 8a589c4aad..d95a3e52a4 100644 --- a/src/commons/application/reducers/__tests__/SessionReducer.ts +++ b/src/commons/application/reducers/__tests__/SessionReducer.ts @@ -147,6 +147,7 @@ test('SET_ASSESSMENT_CONFIGURATIONS works correctly', () => { isManuallyGraded: false, isGradingAutoPublished: false, displayInDashboard: true, + isMinigame: false, hasTokenCounter: false, hasVotingFeatures: false }, @@ -161,6 +162,7 @@ test('SET_ASSESSMENT_CONFIGURATIONS works correctly', () => { isManuallyGraded: false, isGradingAutoPublished: false, displayInDashboard: true, + isMinigame: false, hasTokenCounter: false, hasVotingFeatures: false }, @@ -175,6 +177,7 @@ test('SET_ASSESSMENT_CONFIGURATIONS works correctly', () => { isManuallyGraded: false, isGradingAutoPublished: false, displayInDashboard: true, + isMinigame: false, hasTokenCounter: false, hasVotingFeatures: false } diff --git a/src/commons/assessment/__tests__/Assessment.tsx b/src/commons/assessment/__tests__/Assessment.tsx index 322d2386dd..e2f628e30e 100644 --- a/src/commons/assessment/__tests__/Assessment.tsx +++ b/src/commons/assessment/__tests__/Assessment.tsx @@ -17,6 +17,7 @@ const mockAssessmentConfig: AssessmentConfiguration = { isManuallyGraded: true, isGradingAutoPublished: false, displayInDashboard: true, + isMinigame: false, hasTokenCounter: false, hasVotingFeatures: false, hoursBeforeEarlyXpDecay: 48, diff --git a/src/commons/profile/__tests__/Profile.tsx b/src/commons/profile/__tests__/Profile.tsx index 3afa98e90b..816aa4af88 100644 --- a/src/commons/profile/__tests__/Profile.tsx +++ b/src/commons/profile/__tests__/Profile.tsx @@ -26,6 +26,7 @@ const assessmentConfigurations: AssessmentConfiguration[] = [ isManuallyGraded: false, isGradingAutoPublished: false, displayInDashboard: false, + isMinigame: false, hasTokenCounter: false, hasVotingFeatures: false, hoursBeforeEarlyXpDecay: 0, From 3f50f411cc6d37c2dbddee8a03bc1ad7b928f237 Mon Sep 17 00:00:00 2001 From: Koh Wai Kei Date: Tue, 1 Apr 2025 12:25:51 +0800 Subject: [PATCH 7/8] removed notAttempted check --- src/commons/assessmentWorkspace/AssessmentWorkspace.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/commons/assessmentWorkspace/AssessmentWorkspace.tsx b/src/commons/assessmentWorkspace/AssessmentWorkspace.tsx index 6d00ce5a6f..eb65da3ee5 100644 --- a/src/commons/assessmentWorkspace/AssessmentWorkspace.tsx +++ b/src/commons/assessmentWorkspace/AssessmentWorkspace.tsx @@ -96,6 +96,7 @@ const AssessmentWorkspace: React.FC = props => { const [sessionId, setSessionId] = useState(''); const [isSubmitted, setIsSubmitted] = useState(false); const { isMobileBreakpoint } = useResponsive(); + console.log(props); const assessment = useTypedSelector(state => state.session.assessments[props.assessmentId]); const assessmentOverviews = useTypedSelector(state => state.session.assessmentOverviews); @@ -602,8 +603,6 @@ const AssessmentWorkspace: React.FC = props => { }; const onClickReturn = () => navigate(listingPath); const onClickSubmit = () => { - if (props.notAttempted) return; - dispatch(SessionActions.submitAssessment(assessment.id)); setIsSubmitted(true); }; From dadbf56a0ad1ea2b668f561414954b6c4afd5f96 Mon Sep 17 00:00:00 2001 From: Koh Wai Kei Date: Tue, 1 Apr 2025 12:34:43 +0800 Subject: [PATCH 8/8] remove console log --- src/commons/assessmentWorkspace/AssessmentWorkspace.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/commons/assessmentWorkspace/AssessmentWorkspace.tsx b/src/commons/assessmentWorkspace/AssessmentWorkspace.tsx index eb65da3ee5..20138018e5 100644 --- a/src/commons/assessmentWorkspace/AssessmentWorkspace.tsx +++ b/src/commons/assessmentWorkspace/AssessmentWorkspace.tsx @@ -96,7 +96,6 @@ const AssessmentWorkspace: React.FC = props => { const [sessionId, setSessionId] = useState(''); const [isSubmitted, setIsSubmitted] = useState(false); const { isMobileBreakpoint } = useResponsive(); - console.log(props); const assessment = useTypedSelector(state => state.session.assessments[props.assessmentId]); const assessmentOverviews = useTypedSelector(state => state.session.assessmentOverviews);