Skip to content

Commit b75f2d9

Browse files
authored
Merge pull request #1953 from rushi-tekdi/fix-atm
ai assessments issue fix
2 parents b370c3c + 3f8283c commit b75f2d9

File tree

3 files changed

+106
-91
lines changed

3 files changed

+106
-91
lines changed

mfes/workspace/src/components/KaTableComponent.tsx

Lines changed: 69 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -143,47 +143,47 @@ const KaTableComponent: React.FC<CustomTableProps> = ({
143143
} else if (tableTitle === 'submitted') {
144144
content.contentType === 'Course'
145145
? router.push({
146-
pathname: `/course-hierarchy/${identifier}`,
147-
query: { identifier, isReadOnly: true, previousPage: 'submitted' },
148-
})
146+
pathname: `/course-hierarchy/${identifier}`,
147+
query: { identifier, isReadOnly: true, previousPage: 'submitted' },
148+
})
149149
: router.push({
150-
pathname: `/workspace/content/review`,
151-
query: { identifier },
152-
});
150+
pathname: `/workspace/content/review`,
151+
query: { identifier },
152+
});
153153
} else if (tableTitle === 'all-content' && mode === 'review') {
154154
content.contentType === 'Course'
155155
? router.push({
156-
pathname: `/course-hierarchy/${identifier}`,
157-
query: {
158-
identifier,
159-
isReadOnly: true,
160-
previousPage: 'allContents',
161-
},
162-
})
156+
pathname: `/course-hierarchy/${identifier}`,
157+
query: {
158+
identifier,
159+
isReadOnly: true,
160+
previousPage: 'allContents',
161+
},
162+
})
163163
: router.push({
164-
pathname: `/workspace/content/review`,
165-
query: { identifier, isReadOnly: true, isAllContents: true },
166-
});
164+
pathname: `/workspace/content/review`,
165+
query: { identifier, isReadOnly: true, isAllContents: true },
166+
});
167167
} else if (tableTitle === 'discover-contents') {
168168
content.contentType === 'Course'
169169
? router.push({
170-
pathname: `/course-hierarchy/${identifier}`,
171-
query: { identifier, previousPage: 'discover-contents' },
172-
})
170+
pathname: `/course-hierarchy/${identifier}`,
171+
query: { identifier, previousPage: 'discover-contents' },
172+
})
173173
: router.push({
174-
pathname: `/workspace/content/review`,
175-
query: { identifier, isDiscoverContent: true },
176-
});
174+
pathname: `/workspace/content/review`,
175+
query: { identifier, isDiscoverContent: true },
176+
});
177177
} else if (tableTitle === 'content-library') {
178178
content.contentType === 'Course'
179179
? router.push({
180-
pathname: `/course-hierarchy/${identifier}`,
181-
query: { identifier, previousPage: 'content-library' },
182-
})
180+
pathname: `/course-hierarchy/${identifier}`,
181+
query: { identifier, previousPage: 'content-library' },
182+
})
183183
: router.push({
184-
pathname: `/workspace/content/review`,
185-
query: { identifier, isContentLibrary: true },
186-
});
184+
pathname: `/workspace/content/review`,
185+
query: { identifier, isContentLibrary: true },
186+
});
187187
} else if (
188188
content?.mimeType &&
189189
MIME_TYPE.GENERIC_MIME_TYPE.includes(content?.mimeType)
@@ -211,14 +211,14 @@ const KaTableComponent: React.FC<CustomTableProps> = ({
211211
columns={
212212
selectable
213213
? [
214-
{
215-
key: '__select__',
216-
title: '',
217-
dataType: DataType.Boolean,
218-
style: { width: 40 },
219-
},
220-
...columns,
221-
]
214+
{
215+
key: '__select__',
216+
title: '',
217+
dataType: DataType.Boolean,
218+
style: { width: 40 },
219+
},
220+
...columns,
221+
]
222222
: columns
223223
}
224224
data={data}
@@ -227,25 +227,25 @@ const KaTableComponent: React.FC<CustomTableProps> = ({
227227
childComponents={{
228228
cell: selectable
229229
? {
230-
content: (props) => {
231-
if (props.column.key === '__select__') {
232-
return (
233-
<Checkbox
234-
checked={selected.includes(props.rowData.identifier)}
235-
disabled={
236-
!selected.includes(props.rowData.identifier) &&
237-
selected.length >= 3
238-
}
239-
onChange={() =>
240-
onSelect && onSelect(props.rowData.identifier)
241-
}
242-
size="small"
243-
/>
244-
);
245-
}
246-
return undefined;
247-
},
248-
}
230+
content: (props) => {
231+
if (props.column.key === '__select__') {
232+
return (
233+
<Checkbox
234+
checked={selected.includes(props.rowData.identifier)}
235+
disabled={
236+
!selected.includes(props.rowData.identifier) &&
237+
selected.length >= 3
238+
}
239+
onChange={() =>
240+
onSelect && onSelect(props.rowData.identifier)
241+
}
242+
size="small"
243+
/>
244+
);
245+
}
246+
return undefined;
247+
},
248+
}
249249
: undefined,
250250
cellText: {
251251
content: (props) => {
@@ -269,9 +269,21 @@ const KaTableComponent: React.FC<CustomTableProps> = ({
269269
style={{
270270
display: 'flex',
271271
alignItems: 'center',
272-
cursor: selectable ? 'default' : 'pointer',
272+
cursor: selectable
273+
? 'default'
274+
: props?.rowData?.aiStatus === 'FAILED'
275+
? 'not-allowed'
276+
: 'pointer',
277+
}}
278+
onClick={() => {
279+
if (props?.rowData?.aiStatus === 'FAILED') {
280+
window.alert(
281+
'The AI Assessment you are trying to create has been failed. Please try creating a new assessment.'
282+
);
283+
} else {
284+
!selectable && openEditor(props.rowData);
285+
}
273286
}}
274-
onClick={() => !selectable && openEditor(props.rowData)}
275287
>
276288
<Grid container alignItems="center" spacing={1}>
277289
<Grid item xs={3} md={3} lg={3} xl={2}>

mfes/workspace/src/components/ai-assessment/AIGenerationDialog.tsx

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -96,39 +96,39 @@ const AIGenerationDialog: React.FC<AIGenerationDialogProps> = ({
9696

9797

9898
{state === 'loader' &&(
99-
<>
100-
<Box sx={{ mb: 3 }}>
101-
<CheckCircleOutlineOutlinedIcon
102-
sx={{ fontSize: 40, color: '#019722' }}
103-
/>
104-
</Box>
105-
<Typography
106-
sx={{
107-
...poppinsFont,
108-
fontWeight: 400,
109-
fontSize: 22,
110-
color: '#1F1B13',
111-
textAlign: 'center',
112-
mb: 2,
113-
}}
114-
>
115-
Questions generated successfully!
116-
</Typography>
117-
<Typography
118-
sx={{
119-
...poppinsFont,
120-
fontWeight: 400,
121-
fontSize: 16,
122-
color: '#635E57',
123-
mb: 4,
124-
textAlign: 'center',
125-
maxWidth: 600,
126-
lineHeight: 1.5,
127-
}}
128-
>
129-
You can head to the editor and review the questions.
130-
</Typography>
131-
</>
99+
<>
100+
<Box sx={{ mb: 3 }}>
101+
<CheckCircleOutlineOutlinedIcon
102+
sx={{ fontSize: 40, color: '#019722' }}
103+
/>
104+
</Box>
105+
<Typography
106+
sx={{
107+
...poppinsFont,
108+
fontWeight: 400,
109+
fontSize: 22,
110+
color: '#1F1B13',
111+
textAlign: 'center',
112+
mb: 2,
113+
}}
114+
>
115+
Questions generated successfully!
116+
</Typography>
117+
<Typography
118+
sx={{
119+
...poppinsFont,
120+
fontWeight: 400,
121+
fontSize: 16,
122+
color: '#635E57',
123+
mb: 4,
124+
textAlign: 'center',
125+
maxWidth: 600,
126+
lineHeight: 1.5,
127+
}}
128+
>
129+
You can head to the editor and review the questions.
130+
</Typography>
131+
</>
132132
)}
133133

134134
{/* Loader State */}
@@ -229,7 +229,7 @@ const AIGenerationDialog: React.FC<AIGenerationDialogProps> = ({
229229
</>
230230
)}
231231
{/* Sub-message and Footer Button for all states */}
232-
{state !== 'failed' && (
232+
{state !== 'failed' && state !== 'processing' && (
233233
<Box
234234
sx={{
235235
width: '100%',

mfes/workspace/src/pages/ai-assessment-creator.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,9 @@ const AIAssessmentCreator: React.FC = () => {
388388
const identifier = await fetchData(newFormData);
389389
if (identifier) {
390390
handleAIGeneration({ newFormData, identifier, token });
391+
} else {
392+
setAIDialogState('failed');
393+
setErrorMessage('Something went wrong in AI assessment');
391394
}
392395
} catch (error) {
393396
console.error('Error creating question set:', error);

0 commit comments

Comments
 (0)