Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

All 1.2 tn dev #178

Merged
merged 5 commits into from
Oct 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/Layouts.jsx/MainLayout.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -882,7 +882,7 @@ const MainLayout = (props) => {
/>
) : (
<img
src={correctImage}
src="https://raw.githubusercontent.com/Sunbird-ALL/all-learner-ai-app/refs/heads/all-1.2-tn-dev/src/assets/correct.svg"
alt="correctImage"
/>
)}
Expand Down
16 changes: 11 additions & 5 deletions src/components/Practice/Mechanics5.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const Mechanics5 = ({
isDiscover,
header,
parentWords,
options,
options = {},
image,
question_audio,
handleNext,
Expand Down Expand Up @@ -63,7 +63,8 @@ const Mechanics5 = ({
const updateStoredData = (audios, isCorrect) => {
if (audios) {
const newEntry = {
selectedAnswer: options[selectedOption]?.text,
selectedAnswer:
options && options.length > 0 && options[selectedOption]?.text,
audioUrl: audios,
correctAnswer: isCorrect,
};
Expand Down Expand Up @@ -218,7 +219,7 @@ const Mechanics5 = ({
</span>
</Box>

{options.length &&
{options && options.length > 0 ? (
options.map((option, i) => (
<Box
key={option.audio_url}
Expand Down Expand Up @@ -262,10 +263,13 @@ const Mechanics5 = ({
marginLeft: "10px",
}}
>
{option.text}
{option?.text || "Text is missing"}
</span>
</Box>
))}
))
) : (
<div>No options available</div>
)}
</Grid>
</Grid>

Expand All @@ -279,6 +283,8 @@ const Mechanics5 = ({
storyLine={storyLine}
dontShowListen={type === "image" || isDiscover}
originalText={
options &&
options.length > 0 &&
options.find((option) => option.isAns === true).text
? options.find((option) => option.isAns === true).text
: parentWords
Expand Down
6 changes: 3 additions & 3 deletions src/views/Practice/Practice.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -831,7 +831,7 @@ const Practice = () => {
setOpenMessageDialog,
options: questions[currentQuestion]?.mechanics_data
? questions[currentQuestion]?.mechanics_data[0]?.options
: null,
: [],
}}
/>
);
Expand Down Expand Up @@ -881,7 +881,7 @@ const Practice = () => {
} else if (mechanism.name === "readTheImage") {
const options = questions[currentQuestion]?.mechanics_data
? questions[currentQuestion]?.mechanics_data[0]?.options
: null;
: [];
const audioLink =
options && options.length > 0
? options.find((option) => option.isAns === true)?.audio_url || null
Expand Down Expand Up @@ -1059,7 +1059,7 @@ const Practice = () => {
setOpenMessageDialog,
options: questions[currentQuestion]?.mechanics_data
? questions[currentQuestion]?.mechanics_data[0]?.options
: null,
: [],
}}
/>
);
Expand Down
Loading